@sme.up/ketchup 11.0.0-SNAPSHOT-20241128165949 → 11.0.0-SNAPSHOT-20241129144428

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 (45) hide show
  1. package/dist/cjs/{f-cell-9f60ccb8.js → f-cell-6e92a406.js} +2 -2
  2. package/dist/cjs/f-cell-6e92a406.js.map +1 -0
  3. package/dist/cjs/kup-autocomplete_28.cjs.entry.js +1 -1
  4. package/dist/cjs/kup-box.cjs.entry.js +1 -1
  5. package/dist/cjs/kup-cell.cjs.entry.js +1 -1
  6. package/dist/cjs/kup-image-list.cjs.entry.js +1 -1
  7. package/dist/cjs/kup-input-panel.cjs.entry.js +10 -6
  8. package/dist/cjs/kup-input-panel.cjs.entry.js.map +1 -1
  9. package/dist/collection/assets/calendar.js +4 -4
  10. package/dist/collection/assets/data-table.js +8 -8
  11. package/dist/collection/components/kup-input-panel/kup-input-panel.css +3 -0
  12. package/dist/collection/components/kup-input-panel/kup-input-panel.js +10 -5
  13. package/dist/collection/components/kup-input-panel/kup-input-panel.js.map +1 -1
  14. package/dist/collection/f-components/f-cell/f-cell.js +1 -1
  15. package/dist/collection/f-components/f-cell/f-cell.js.map +1 -1
  16. package/dist/components/kup-autocomplete2.js +1 -1
  17. package/dist/components/kup-autocomplete2.js.map +1 -1
  18. package/dist/components/kup-input-panel.js +9 -5
  19. package/dist/components/kup-input-panel.js.map +1 -1
  20. package/dist/esm/{f-cell-4b8129d5.js → f-cell-bf2f63a8.js} +2 -2
  21. package/dist/esm/f-cell-bf2f63a8.js.map +1 -0
  22. package/dist/esm/kup-autocomplete_28.entry.js +1 -1
  23. package/dist/esm/kup-box.entry.js +1 -1
  24. package/dist/esm/kup-cell.entry.js +1 -1
  25. package/dist/esm/kup-image-list.entry.js +1 -1
  26. package/dist/esm/kup-input-panel.entry.js +10 -6
  27. package/dist/esm/kup-input-panel.entry.js.map +1 -1
  28. package/dist/ketchup/ketchup.esm.js +1 -1
  29. package/dist/ketchup/p-54e984ca.entry.js +2 -0
  30. package/dist/ketchup/p-54e984ca.entry.js.map +1 -0
  31. package/dist/ketchup/{p-caa70779.entry.js → p-7e994945.entry.js} +2 -2
  32. package/dist/ketchup/{p-3f141611.entry.js → p-91f3e313.entry.js} +2 -2
  33. package/dist/ketchup/{p-8afa9473.entry.js → p-c76cd6bd.entry.js} +2 -2
  34. package/dist/ketchup/{p-c3f65052.entry.js → p-cab51c5f.entry.js} +2 -2
  35. package/dist/ketchup/{p-8cbd8be4.js → p-f53792c4.js} +2 -2
  36. package/dist/ketchup/{p-8cbd8be4.js.map → p-f53792c4.js.map} +1 -1
  37. package/package.json +1 -1
  38. package/dist/cjs/f-cell-9f60ccb8.js.map +0 -1
  39. package/dist/esm/f-cell-4b8129d5.js.map +0 -1
  40. package/dist/ketchup/p-d9b99aec.entry.js +0 -2
  41. package/dist/ketchup/p-d9b99aec.entry.js.map +0 -1
  42. /package/dist/ketchup/{p-caa70779.entry.js.map → p-7e994945.entry.js.map} +0 -0
  43. /package/dist/ketchup/{p-3f141611.entry.js.map → p-91f3e313.entry.js.map} +0 -0
  44. /package/dist/ketchup/{p-8afa9473.entry.js.map → p-c76cd6bd.entry.js.map} +0 -0
  45. /package/dist/ketchup/{p-c3f65052.entry.js.map → p-cab51c5f.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as t,c as e,f as i,h as o,H as s,d as n}from"./p-d7c15b0e.js";import{k as r,y as a,g as l,s as h,a1 as c,v as p,h as u,b as d,e as f,N as b,R as x,aw as g,V as m,E as k}from"./p-1911a49e.js";import{f as w,p as v,s as y}from"./p-88d4c0ed.js";import{F as _}from"./p-2b519589.js";import{c as j}from"./p-9db21afb.js";import{c as C}from"./p-635bb4b3.js";import{F as z}from"./p-8cbd8be4.js";import{p as P,r as M,F as R}from"./p-95c78285.js";import{F as A}from"./p-c4054aba.js";import"./p-029c7cbe.js";import"./p-e3062c19.js";import"./p-5d03c077.js";import"./p-59c76030.js";import"./p-10dfd311.js";import"./p-d4a879fc.js";var I;(function(t){t["cardData"]="Data of the card linked to the box when the latter's layout must be a premade template.";t["columns"]="Number of columns.";t["customStyle"]="Custom style of the component.";t["data"]="Actual data of the box.";t["dragEnabled"]="Enable dragging.";t["dropEnabled"]="Enable dropping.";t["dropOnSection"]="Drop can be done in section.";t["enableRowActions"]="If enabled, a button to load / display the row actions will be displayed on the right of every box.";t["globalFilter"]="When set to true it activates the global filter.";t["globalFilterValue"]="The value of the global filter.";t["kanban"]="Displays the boxlist as a Kanban.";t["layout"]="How the field will be displayed. If not present, a default one will be created.";t["lazyLoadRows"]="When set to true, extra rows will be automatically loaded once the last row enters the viewport.";t["loadMoreLimit"]="Sets a maximum limit of new records which can be required by the load more functionality.";t["loadMoreMode"]="Establish the modality of how many new records will be downloaded. This property is regulated also by loadMoreStep.";t["loadMoreStep"]="The number of records which will be requested to be downloaded when clicking on the load more button. This property is regulated also by loadMoreMode.";t["multiSelection"]="Enable multi selection.";t["pageSelected"]="Current page number.";t["pagination"]="Enables pagination.";t["rowsPerPage"]="Number of current rows per page.";t["scrollOnHover"]="Activates the scroll on hover function.";t["selectBox"]="Automatically selects the box at the specified index.";t["selectedRowsState"]="Multiple selection.";t["showLoadMore"]="If set to true, displays the button to load more records.";t["showSelection"]="If enabled, highlights the selected box/boxes.";t["sortBy"]="If sorting is enabled, specifies which column to sort.";t["sortEnabled"]="Enable sorting.";t["stateId"]="";t["store"]="";t["swipeDisabled"]="Disable swipe."})(I||(I={}));var E;(function(t){t["CONSTANT"]="constant";t["CONSTANT_INCREMENT"]="constant_increment";t["PROGRESSIVE_THRESHOLD"]="progressive_threshold"})(E||(E={}));class S{constructor(){this.globalFilterValue="";this.sortBy="";this.selectedRowsState="";this.pageSelected=1;this.rowsPerPage=0;this.load=false;this.loadMoreLimit=1e3;this.showLoadMore=false}toDebugString(){return"box state"}}const O=".kup-body-compact-01{font-family:var(--kup-font-family);font-size:var(--kup-body-compact-01-font-size, 14px);line-height:18px;font-weight:400;letter-spacing:0.16px}.kup-body-01{font-family:var(--kup-font-family);font-size:var(--kup-body-01-font-size, 14px);line-height:20px;font-weight:400;letter-spacing:0.16px}.kup-code-01{font-family:var(--kup-font-family-monospace);font-size:12px;line-height:16px;font-weight:400;letter-spacing:0.32px}.kup-label-01{font-family:var(--kup-font-family);font-size:12px;line-height:16px;font-weight:400;letter-spacing:0.32px}.kup-caption-02{font-family:var(--kup-font-family);font-size:12px;line-height:15px;font-weight:500;letter-spacing:1px}.kup-caption-01{font-family:var(--kup-font-family);font-size:10px;line-height:13px;font-weight:400;letter-spacing:1px}.kup-small-label-01{font-family:var(--kup-font-family);font-size:6px;line-height:9px;font-weight:400;letter-spacing:1px}.kup-heading-compact-01{font-family:var(--kup-font-family);font-size:14px;line-height:18px;font-weight:600;letter-spacing:0.16px}.kup-heading-01{font-family:var(--kup-font-family);font-size:14px;line-height:20px;font-weight:600;letter-spacing:0.16px}.kup-heading-02{font-family:var(--kup-font-family);font-size:16px;line-height:24px;font-weight:500;letter-spacing:0}.kup-heading-03{font-family:var(--kup-font-family);font-size:20px;line-height:28px;font-weight:400;letter-spacing:0}.kup-heading-04{font-family:var(--kup-font-family);font-size:28px;line-height:36px;font-weight:400;letter-spacing:0}.kup-heading-05{font-family:var(--kup-font-family);font-size:32px;line-height:40px;font-weight:300;letter-spacing:0}.kup-heading-06{font-family:var(--kup-font-family);font-size:42px;line-height:50px;font-weight:300;letter-spacing:0}.kup-heading-07{font-family:var(--kup-font-family);font-size:54px;line-height:64px;font-weight:300;letter-spacing:0}.kup-heading-08{font-family:var(--kup-font-family);font-size:54px;line-height:64px;font-weight:600;letter-spacing:0}:host{--kup_box_background_color:var(--kup-box-background-color, var(--kup-layer-1));--kup_box_background_color_hover:var(\n --kup-box-background-color-hover,\n var(--kup-layer-1-hover)\n );--kup_box_background_color_selected:var(\n --kup-box-background-color-selected,\n var(--kup-layer-1-selected)\n );--kup_box_text_color:var(--kup-box-text-color, var(--kup-text-secondary));--kup_box_grid_gap:var(--kup-box-grid-gap, var(--kup-space-03));--kup_box_transition:var(--kup-box-transition, 0.25s);--kup_box_border_color_drag:var(--kup-box-border-color-drag, var(--kup-border-interactive))\n display: block;--kup_box_padding:var(--kup-box-padding, var(--kup-space-05))}.box-component{transition:border var(--kup_box_transition) ease}.box-component[kup-drag-over]{position:relative;border:3px dashed var(--kup_box_border_color_drag)}#box-container{display:grid;grid-gap:var(--kup_box_grid_gap);color:var(--kup_box_text_color);overflow:auto}#box-container.is-kanban .kanban-section{overflow:auto}#box-container.is-kanban .box-wrapper{padding-top:1em}#box-container.is-kanban .box-wrapper .box{overflow:auto}#box-container *:not(.progress-bar-percentage){box-sizing:border-box}#box-container .box-wrapper{display:flex;align-items:center;background-color:var(--kup_box_background_color);border-radius:var(--kup-radius-00)}#box-container .box-wrapper:hover{background-color:var(--kup_box_background_color_hover)}#box-container .box-wrapper.selected{background-color:var(--kup_box_background_color_selected)}#box-container .box-wrapper.selected .box-section.titled>h3{background-color:transparent}#box-container .box-wrapper .box{flex-grow:1;cursor:pointer;position:relative;display:flex;padding:var(--kup_box_padding);transition:background-color var(--kup_box_transition) ease, box-shadow var(--kup_box_transition) ease, border var(--kup_box_transition) ease}#box-container .box-wrapper .box.draggable{touch-action:none;user-select:none}#box-container .box-wrapper .box.column{flex-direction:column}#box-container .box-wrapper .box[kup-draggable]{opacity:0.5}#box-container .box-wrapper .box[kup-drag-over]{border:3px dashed var(--kup_box_border_color_drag);position:relative;z-index:2}#box-container .box-wrapper .box .box-section{display:flex;flex-direction:row;flex:1 1 1%;flex-wrap:wrap}#box-container .box-wrapper .box .box-section.column{flex-direction:column;justify-content:center;flex-wrap:unset}#box-container .box-wrapper .box .box-section.column>.box-section{flex:0 0 auto}#box-container .box-wrapper .box .box-section.grid{display:grid}#box-container .box-wrapper .box .box-section .box-object{min-height:16px}#box-container .box-wrapper .box .box-section .box-object img{height:auto}#box-container .box-wrapper .box .box-section.collapse-section .header{border-top:1px solid var(--kup-border-subtle);color:rgba(var(--kup-text-secondary-rgb), 0.75);display:flex;justify-content:space-around;width:100%}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content{margin:0.5em;display:flex;align-items:center}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image{transition:transform 0.15s}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image.toggled{transform:rotate(-180deg)}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .kup-icon.kup-dropdown-icon{margin:0;-webkit-mask:var(--kup-dropdown-icon);mask:var(--kup-dropdown-icon)}#box-container .box-wrapper .box .box-section.collapse-section .content{display:none;width:100%}#box-container .box-wrapper .box .box-section.collapse-section.open .content{display:block}#box-container .box-wrapper .box .box-section.titled{border:1px solid var(--kup-border-subtle);padding-top:5px;position:relative;margin:10px}#box-container .box-wrapper .box .box-section.titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}#box-container .box-wrapper .box .box-selection{position:absolute;top:0.5em;right:0.5em;z-index:1}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler{position:relative;width:24px;height:24px;margin-left:3px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler svg{cursor:pointer;opacity:0;fill:var(--kup-text-color);transition:opacity 300ms ease-out}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu{background:var(--kup-background-color);border:1px solid var(--kup-border-subtle);box-shadow:0px 0px 7.5px 0px rgba(128, 128, 128, 0.5);position:absolute;top:0;right:24px;display:none;z-index:10}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul{list-style-type:none;margin:0;padding:0}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li{cursor:pointer;white-space:nowrap;padding:0 12px;display:flex;align-items:center;line-height:30px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li:not(:last-child){border-bottom:1px solid var(--kup-border-subtle)}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu.open{display:block}#box-container .box-wrapper:hover .row-actions-wrapper .row-actions-toggler svg{opacity:1}#sort-panel,#global-filter{margin-bottom:1em}:host(.kup-center-aligned) #kup-component .box-section{text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell img{margin:auto}:host(.kup-right-aligned) #kup-component .box-section{text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell img{margin-left:auto;margin-right:0}:host(.kup-top-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-start}:host(.kup-bottom-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-end}:host(.kup-flat-on-hover) #box-container .box-wrapper .box:hover{box-shadow:none}:host(.kup-shaped) .box{border-radius:10px}:host(.kup-round) .box{border-radius:25px}:host(.kup-dashed-sections) .box-section{border:2px dashed var(--kup-text-color)}:host(:not(.kup-paddingless)) #box-container .box .box-section .box-object{padding:1px 4px}:host(:not(.kup-paddingless)) #box-container .box .box-section.last-child{padding:3px 4px}:host(.kup-danger){--kup-box-primary-color-rgb:var(--kup-danger-color-rgb)}:host(.kup-info){--kup-box-primary-color-rgb:var(--kup-info-color-rgb)}:host(.kup-secondary){--kup-box-primary-color-rgb:var(--kup-secondary-color-rgb)}:host(.kup-success){--kup-box-primary-color-rgb:var(--kup-success-color-rgb)}:host(.kup-warning){--kup-box-primary-color-rgb:var(--kup-warning-color-rgb)}";const D=O;var W=undefined&&undefined.__classPrivateFieldGet||function(t,e,i,o){if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e==="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?o:i==="a"?o.call(t):o?o.value:e.get(t)};var B=undefined&&undefined.__classPrivateFieldSet||function(t,e,i,o,s){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e==="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?s.call(t,i):s?s.value=i:e.set(t,i),i};var T,$,L,F,H,N,G,V,q;const K=class{constructor(i){t(this,i);this.kupBoxClick=e(this,"kup-box-click",6);this.kupBoxSelected=e(this,"kup-box-selected",6);this.kupAutoBoxSelect=e(this,"kup-box-autoselect",6);this.kupRowActionMenuClick=e(this,"kup-box-rowactionmenuclick",6);this.kupRowActionClick=e(this,"kup-box-rowactionclick",6);this.kupDidLoad=e(this,"kup-box-didload",6);this.kupDidUnload=e(this,"kup-box-didunload",6);this.kupBoxContextMenu=e(this,"kup-box-contextmenu",6);this.kupLoadMoreClick=e(this,"kup-box-loadmoreclick",6);T.add(this);this.state=new S;this.kupManager=r();this.visibleColumns=[];this.rows=[];this.filteredRows=[];this.sectionRef=null;this.rowsRefs=[];this.hold=false;this.interactableDrag=[];this.interactableDrop=[];this.interactableTouch=[];$.set(this,undefined);L.set(this,[]);F.set(this,0);H.set(this,0);N.set(this,0);this.collapsedSection={};this.selectedRows=[];this.rowActionMenuOpened=undefined;this.currentPage=1;this.currentRowsPerPage=10;this.cardData=null;this.columns=1;this.customStyle="";this.data=null;this.dragEnabled=false;this.dropEnabled=false;this.dropOnSection=false;this.editableData=false;this.enableRowActions=false;this.globalFilter=false;this.globalFilterValue="";this.kanban=null;this.layout=undefined;this.lazyLoadRows=false;this.loadMoreLimit=1e3;this.loadMoreMode=E.PROGRESSIVE_THRESHOLD;this.loadMoreStep=60;this.multiSelection=false;this.pageSelected=1;this.pagination=false;this.rowsPerPage=undefined;this.scrollOnHover=false;this.selectBox=undefined;this.selectedRowsState=undefined;this.showLoadMore=false;this.showSelection=true;this.sortBy=undefined;this.sortEnabled=false;this.stateId="";this.store=undefined;this.swipeDisabled=false}initWithPersistedState(){if(this.store&&this.stateId){const t=this.store.getState(this.stateId);if(t!=null){this.kupManager.debug.logMessage(this,"Initialize with state for stateId "+this.stateId+": "+t);this.sortBy=this.state.sortBy;this.globalFilterValue=this.state.globalFilterValue;this.selectedRowsState=this.state.selectedRowsState;this.pageSelected=this.state.pageSelected;this.rowsPerPage=this.state.rowsPerPage;this.loadMoreLimit=t.loadMoreLimit;this.showLoadMore=t.showLoadMore}}}persistState(){if(this.store&&this.stateId){let t=false;if(!this.kupManager.objects.deepEqual(this.state.sortBy,this.sortBy)){this.state.sortBy=this.sortBy;t=true}if(!this.kupManager.objects.deepEqual(this.state.globalFilterValue,this.globalFilterValue)){this.state.globalFilterValue=this.globalFilterValue;t=true}if(!this.kupManager.objects.deepEqual(this.state.pageSelected,this.currentPage)){this.state.pageSelected=this.currentPage;t=true}if(!this.kupManager.objects.deepEqual(this.state.rowsPerPage,this.currentRowsPerPage)){this.state.rowsPerPage=this.currentRowsPerPage;t=true}const e=this.selectedRows.reduce(((t,e,i)=>{const o=i>0?";":"";return t+o+e.id}),"");if(!this.kupManager.objects.deepEqual(this.state.selectedRowsState,e)){this.state.selectedRowsState=e;t=true}if(!this.kupManager.objects.deepEqual(this.state.loadMoreLimit,this.loadMoreLimit)){this.state.loadMoreLimit=this.loadMoreLimit;t=true}if(!this.kupManager.objects.deepEqual(this.state.showLoadMore,this.showLoadMore)){this.state.showLoadMore=this.showLoadMore;t=true}if(!this.state.load){this.state.load=true;return}if(t){this.kupManager.debug.logMessage(this,"Persisting state for stateId "+this.stateId+": "+this.state);this.store.persistState(this.stateId,this.state)}}}rowsPerPageHandler(t){this.currentRowsPerPage=t}recalculateRows(){this.initRows()}onDataChanged(){a(this.getRows());this.initVisibleColumns();this.initRows();this.checkLayout()}onLayoutChanged(){this.checkLayout()}onSelectBoxChanged(){this.handleAutomaticBoxSelection()}async getProps(t){return l(this,I,t)}async loadRowActions(t,e){t.actions=e;this.rowActionMenuOpened=t}async refresh(){i(this)}async setProps(t){h(this,I,t)}getColumns(){return this.data&&this.data.columns?this.data.columns:[{title:"",name:"",size:undefined}]}initVisibleColumns(){this.visibleColumns=this.getColumns().filter((t=>{if(t.hasOwnProperty("visible")){return t.visible}return true}))}getRows(){return this.data&&this.data.rows?this.data.rows:[]}initRows(){this.filteredRows=this.getRows();if(this.globalFilter&&this.globalFilterValue){this.filteredRows=w(this.filteredRows,null,this.globalFilterValue,this.visibleColumns)}this.rows=this.sortRows(this.filteredRows);if(this.pagination){this.rows=v(this.rows,this.currentPage,this.currentRowsPerPage,false)}}sortRows(t){let e=t;if(this.sortBy){e=y(e,this.toSortObjectList())}return e}toSortObjectList(){const t=this.sortBy.split("|").map((t=>{const e=t.split(",");const i={column:e[0],sortMode:e.length>1?c[e[1]]:c.A};return i}));return t}checkScrollOnHover(){if(this.boxContainer){if(!this.kupManager.scrollOnHover.isRegistered(this.boxContainer)){if(this.scrollOnHover){this.kupManager.scrollOnHover.register(this.boxContainer)}}else{if(!this.scrollOnHover){this.kupManager.scrollOnHover.unregister(this.boxContainer)}}}}checkLayout(){if(this.layout){this.boxLayout=this.layout;return}const t={horizontal:false,sections:[]};const e=this.visibleColumns;let i=e.length;let o=[];let s=0;while(i-- >0){o.push({column:e[s++].name})}t.content=o;this.boxLayout={sections:[t]}}onSortChange(t){let e=p(this.visibleColumns,t.detail.value);this.sortBy=e.name}onGlobalFilterChange({detail:t}){let e="";if(t&&t.value){e=t.value}this.globalFilterValue=e}isSectionExpanded(t,e){if(!t.id||!e.id){return false}return this.collapsedSection[e.id]&&this.collapsedSection[e.id][t.id]}handleAutomaticBoxSelection(){if(this.selectBox&&this.selectBox>0&&this.selectBox<=this.data.rows.length){this.selectedRows=[];for(let t of this.data.rows){if(t.id===(this.selectBox-1).toString()){this.selectedRows.push(t);break}}this.kupAutoBoxSelect.emit({comp:this,id:this.rootElement.id,row:this.selectedRows[0]})}}getEventDetails(t,e){let i=null;let o=null;let s=null;let n=null;if(t){for(let e=t.length-1;e>=0;e--){let o=t[e];if(!o.tagName){continue}switch(o.tagName.toUpperCase()){default:{if(o.classList.contains("box-object")){i=o}if(!s&&o["data-row"]){s=o["data-row"]}break}}}}if(i){if(i.classList.contains("f-cell")){const t=i["kup-get-cell-props"]();o=t.cell;n=t.column;s=t.row}else{o=i["data-cell"];s=i["data-row"];n=p(this.visibleColumns,i.dataset.column)}}return{boxObject:i?i:null,column:n?n:null,cell:o?o:null,originalEvent:e,row:s?s:null}}clickHandler(t){const e=this.getEventDetails(this.kupManager.getEventPath(t.target,this.rootElement),t);if(e.row){if(this.multiSelection){this.onSelectionCheckChange(e.row)}else{this.selectedRows=[e.row]}}return e}contextMenuHandler(t){const e=this.getEventDetails(this.kupManager.getEventPath(t.target,this.rootElement),t);return e}checkIfElementIsActionMenuIcon(t){if(t.tagName&&t.parentElement){return t.tagName==="svg"&&t.parentElement.classList.contains("row-actions-toggler")}return false}onSelectionCheckChange(t){var e=-1;for(let i=0;i<this.selectedRows.length;i++){const o=this.selectedRows[i];if(o.id===t.id){e=i;break}}if(e>=0){this.selectedRows.splice(e,1);this.selectedRows=[...this.selectedRows]}else{this.selectedRows=[...this.selectedRows,t]}this.kupBoxSelected.emit({comp:this,id:this.rootElement.id,rows:this.selectedRows})}toggleSectionExpand(t,e){if(!e.id){console.error("cannot expand / collapse a section withoun an ID");return}if(!t.id){console.error("cannot expand / collapse a section of a row without ad id");return}if(!this.collapsedSection[e.id]){this.collapsedSection[e.id]={};this.collapsedSection[e.id][t.id]=true}else{const i=this.collapsedSection[e.id];if(!i[t.id]){i[t.id]=true}else{i[t.id]=!i[t.id]}}this.collapsedSection=Object.assign({},this.collapsedSection)}onRowAction(t){if(!t){return}if(t===this.rowActionMenuOpened){this.rowActionMenuOpened=null;return}if(t.actions){this.rowActionMenuOpened=t}else{this.kupRowActionMenuClick.emit({comp:this,id:this.rootElement.id,row:t})}}onRowActionClick(t,e,i){this.kupRowActionClick.emit({comp:this,id:this.rootElement.id,row:t,action:e,index:i})}clickFunction(t){try{const e=t.composedPath();for(let t of e){if(this.checkIfElementIsActionMenuIcon(t)){return}}}catch(e){if(this.checkIfElementIsActionMenuIcon(t.target)){return}}this.rowActionMenuOpened=null}handlePageChange(t){const e=P(t,this.filteredRows.length,this.currentRowsPerPage);if(e){this.currentPage=e}}handleRowsPerPageChange(t){const e=M(t,this.filteredRows.length);if(e){this.currentRowsPerPage=e;this.adjustPaginator()}}adjustPaginator(){const t=this.rows.length;const e=Math.ceil(t/this.currentRowsPerPage);if(this.currentPage>e){this.currentPage=1}}renderSectionAsCard(t){let e=false;const i={button:[],cell:[],columns:[],image:[],progressbar:[],text:[]};for(let e=0;e<this.data.columns.length;e++){const o=this.data.columns[e];if(o.visible!==false){i.cell.push(t.cells[o.name]);i.columns.push(o)}}for(const e in t.cells){if(t.cells.hasOwnProperty(e)){const o=t.cells[e];if(o.cardID!==undefined&&o.obj){switch(o.obj.p){case"BTN":do{i.button.push({})}while(i.button.length<o.cardID);i.button[o.cardID]={label:o.value};break;case"IMG":do{i.image.push({})}while(i.image.length<o.cardID);i.image[o.cardID]={resource:o.value};break;case"PGB":do{i.progressbar.push({})}while(i.progressbar.length<o.cardID);i.progressbar[o.cardID]={value:o.value};break;default:do{i.text.push("")}while(i.text.length<o.cardID);i.text[o.cardID]=o.value;break}}}}for(const o in t.cells){if(t.cells.hasOwnProperty(o)){const s=t.cells[o];if(s.cardID===undefined&&s.obj){e=false;switch(s.obj.p){case"BTN":for(let t=0;t<i.button.length;t++){if(!Object.keys(i.button[t]).length){i.button[t]={label:s.value};e=true;break}}if(!e){i.button.push({label:s.value})}break;case"IMG":for(let t=0;t<i.image.length;t++){if(!Object.keys(i.image[t]).length){i.image[t]={resource:s.value};e=true;break}}if(!e){i.image.push({resource:s.value})}break;case"PGB":for(let t=0;t<i.progressbar.length;t++){if(!Object.keys(i.progressbar[t]).length){i.progressbar[t]={value:s.value};e=true;break}}if(!e){i.progressbar.push({value:s.value})}break;default:for(let t=0;t<i.text.length;t++){if(i.text[t]===""){i.text[t]=s.value;e=true;break}}if(!e){i.text.push(s.value)}break}}}}return o("kup-card",Object.assign({data:i},this.cardData))}renderRow(t){const e=[...this.visibleColumns];let i=null;let s=t.layout;if(!s){s=this.boxLayout}let n=false;if(s){if(s.horizontal){n=true}const o=s.sections;let r=o.length;let a=0;if(r>0){i=[]}const l={horizontal:n};while(r-- >0){if(this.cardData!==null&&this.cardData!==undefined&&typeof this.cardData==="object"){i.push(this.renderSectionAsCard(t))}else{i.push(this.renderSection(o[a++],l,t,e))}}}var r=false;for(let e of this.selectedRows){if(e.id===t.id){r=true}}let a=null;if(this.multiSelection){a=o("div",{class:"box-selection"},o("kup-checkbox",{checked:r}))}let l=null;if(this.enableRowActions&&!this.swipeDisabled){const e={"row-action-menu":true,open:t===this.rowActionMenuOpened};let i=null;if(t.actions){const e=t.actions.map(((e,i)=>{const s=`icon ${e.icon}`;return o("li",{tabindex:"0",onClick:()=>this.onRowActionClick(t,e,i)},o("div",{class:s}),o("div",{class:"text"},e.text))}));i=o("ul",null,e)}l=o("div",{class:"row-actions-wrapper"},o("div",{class:"row-actions-toggler"},o("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 24 24",onClick:()=>this.onRowAction(t)},o("path",{d:"M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z"})),o("div",{class:e},i)))}let h=null;if(t.badgeData&&t.badgeData.length>0){h=t.badgeData.map((t=>o("kup-badge",{text:t.text,class:t["className"]?`centered ${t["className"]}`:"centered",imageData:t.imageData})))}const c={box:true,draggable:this.dragEnabled,selected:this.showSelection&&r,column:!n};const p=t.style||{};return o("div",{class:"box-wrapper",style:p,ref:t=>{if(t){W(this,L,"f").push(t)}}},o("div",{class:c,"data-row":t,ref:t=>this.rowsRefs.push(t)},a,i,h),l)}renderSection(t,e,i,s){let n=null;if(t.sections&&t.sections.length>0){const e=t.sections;let o=e.length;let r=0;if(o>0){n=[]}while(o-- >0){n.push(this.renderSection(e[r++],t,i,s))}}else if(t.content){const e=t.content;let o=e.length;let r=0;if(o>0){n=[]}while(o-- >0){n.push(this.renderBoxObject({boxObject:e[r++],row:i,visibleColumns:s},true))}}else if(s.length>0){const t=s[0];n=this.renderBoxObject({boxObject:{column:t.name},row:i,visibleColumns:s})}const r=this.isSectionExpanded(i,t);const a=!!t.columns;const l={"box-section":true,open:r,column:!a&&!t.horizontal,grid:a,titled:!!t.title,"last-child":!t.sections||t.sections.length===0};const h=t.style||{};if(t.dim&&e){h.flex=`0 0 ${t.dim}`;h.overflow="hidden";if(e.horizontal){h.maxWidth=t.dim}else{h.maxHeight=t.dim}}if(a){h["grid-template-columns"]=`repeat(${t.columns}, 1fr)`}let c=null;if(t.collapsible){l["collapse-section"]=true;const e={content:true};let s="";if(t.title){s=t.title}else if(r){s=this.kupManager.language.translate(u.COLLAPSE)}else{s=this.kupManager.language.translate(u.EXPAND)}c=o("div",{class:l,style:h},o("div",{class:e},n),o("div",{class:"header",role:"button",onClick:e=>{e.stopPropagation();this.toggleSectionExpand(i,t)}},o("div",{class:"header-content"},o("span",null,s),o(_,{resource:`${d.DROPDOWN}`,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:r?"toggled":""}))))}else{const e=t.title?o("h3",null,t.title):null;c=o("div",{class:l,style:h},e,n)}return c}renderBoxObject({boxObject:t,row:e,visibleColumns:i},s){const n={"box-object":true};const r={};let a=null;let l=-1;for(let e=0;e<i.length;e++){const o=i[e];if(o.name===t.column){l=e;break}}if(l>=0){a=i[l];i.splice(l,1)}else if(s){a=this.data.columns.find((e=>e.name===t.column))}const h=e.cells[t.column];let c=undefined;if(h&&!this.kupManager.objects.isEmptyKupObj(h.obj)){n["is-obj"]=true;if(this.kupManager.debug.isDebug()){c=h.obj.t+"; "+h.obj.p+"; "+h.obj.k+";"}}const p={cell:h,column:a,component:this,editable:this.editableData,renderKup:true,row:e,setSizes:true,shape:t.shape};return o("div",{"data-cell":h,"data-row":e,"data-column":t.column,class:n,style:r,title:c},h&&a?o(z,Object.assign({},p)):o("span",null,t.value))}kanbanMode(){if(!this.kanban.columns||this.kanban.columns.length===0){this.kupManager.debug.logMessage(this,"No columns to group by detected.",f.ERROR);return{jsx:o("div",{id:"empty-data-message",class:"box-wrapper"},o("div",{ref:t=>this.rowsRefs.push(t)}),this.kupManager.language.translate(u.EMPTY_DATA)),style:{"grid-template-columns":`repeat(1, 1fr)`}}}const t=[];if(this.kanban.labels){for(let e=0;e<this.kanban.labels.length;e++){const i=this.kanban.labels[e];t.push({labels:i,nodes:[]})}}for(let e=0;e<this.rows.length;e++){let i=[];for(let t=0;t<this.kanban.columns.length;t++){try{i.push(this.rows[e].cells[this.kanban.columns[t]].value)}catch(t){this.kupManager.debug.logMessage(this,t,f.WARNING)}}const o={found:false,index:null};for(let e=0;e<t.length;e++){let s=t[e].labels;let n=true;for(let t=0;t<s.length;t++){if(i[t]!==s[t]){n=false;break}}if(n){o.found=true;o.index=e;break}}if(o.found){t[o.index].nodes.push(this.renderRow(this.rows[e]))}else{t.push({labels:i,nodes:[this.renderRow(this.rows[e])]})}}const e=[];for(let i=0;i<t.length;i++){const s=t[i].labels;const n={data:[]};for(let t=0;t<s.length;t++){n.data.push({value:s[t],id:s[t]})}e.push(o("div",{class:"kanban-section"},o(j,Object.assign({},n)),t[i].nodes))}return{jsx:e,style:{"grid-template-columns":this.kanban.isStacked?"repeat(1fr)":this.kanban.size?`repeat(${Object.keys(t).length}, ${this.kanban.size})`:`repeat(${Object.keys(t).length}, 1fr)`}}}didLoadInteractables(){this.interactableTouch.push(this.boxContainer);const t=t=>{var e;if(this.hold){this.hold=false;return}switch(t.button){case 0:const i={};for(const e in t){i[e]=t[e]}const o=this.clickHandler(i);this.kupBoxClick.emit({comp:this,id:this.rootElement.id,row:o.row,column:(e=o.column)===null||e===void 0?void 0:e.name});break;case 2:this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)});break}};const e=t=>{if(t.pointerType==="pen"||t.pointerType==="touch"){this.hold=true;this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)})}};this.kupManager.interact.on(this.boxContainer,b.TAP,t);this.kupManager.interact.on(this.boxContainer,b.HOLD,e)}didRenderInteractables(){if(this.dragEnabled){for(let t=0;t<this.rowsRefs.length;t++){const e=this.rowsRefs[t];const i=()=>{const t=this.rootElement.shadowRoot.querySelector(".box-object:hover");return{cell:t["data-cell"],column:p(this.visibleColumns,t.dataset.column),id:this.rootElement.id,multiple:this.multiSelection,row:t["data-row"],selectedRows:this.selectedRows}};if(e&&!this.interactableDrag.includes(e)){this.interactableDrag.push(e);this.kupManager.interact.draggable(e,{allowFrom:".box-object",cursorChecker(){return null}},{callback:i},x.BADGE)}}}if(this.dropEnabled){const t=()=>{const t=this.rootElement.shadowRoot.querySelector(".box:hover");if(!t){this.kupManager.debug.logMessage(this,"Couldn't find cell hovered to retrieve dropzone informations!",f.WARNING);return}const e=this.kupManager.getEventPath(t,this.rootElement);const i=this.getEventDetails(e);return{cell:i.cell,column:i.column,id:this.rootElement.id,row:i.row}};if(!this.interactableDrop.includes(this.sectionRef)){this.interactableDrop.push(this.sectionRef);this.kupManager.interact.dropzone(this.sectionRef,{accept:`[${g}]`},{dispatcher:this.rootElement,type:m.BOX})}for(let e=0;e<this.rowsRefs.length;e++){const i=this.rowsRefs[e];if(i&&!this.interactableDrop.includes(i)){this.interactableDrop.push(i);this.kupManager.interact.dropzone(i,{accept:`[${g}]`},{callback:t,dispatcher:this.rootElement,type:m.BOX})}}}}componentWillLoad(){this.kupManager.debug.logLoad(this,false);if(this.rowsPerPage){this.currentRowsPerPage=this.rowsPerPage}if(this.data&&this.data.rows&&this.currentRowsPerPage>this.data.rows.length){this.currentRowsPerPage=this.data.rows.length}this.kupManager.language.register(this);this.kupManager.theme.register(this);this.onDataChanged();this.adjustPaginator();if(document.querySelector(".header")){B(this,F,document.querySelector(".header").clientHeight,"f")}else{B(this,F,0,"f")}if(document.querySelector(".topbar")){B(this,F,W(this,F,"f")+document.querySelector(".topbar").clientHeight,"f")}W(this,T,"m",V).call(this)}componentDidLoad(){this.handleAutomaticBoxSelection();document.addEventListener("click",this.clickFunction.bind(this));this.currentPage=this.pageSelected;if(this.multiSelection&&this.selectedRowsState){this.selectedRows=[];let t=this.selectedRowsState.split(";");this.selectedRows=this.data.rows.filter((e=>t.indexOf(e.id)>=0))}this.didLoadInteractables();this.kupDidLoad.emit({comp:this,id:this.rootElement.id});this.kupManager.debug.logLoad(this,true)}componentWillRender(){this.kupManager.debug.logRender(this,false)}componentDidRender(){const t=this.rootElement.shadowRoot;if(t){const e=t.querySelectorAll(".f-text-field");for(let t=0;t<e.length;t++){A(e[t])}}this.checkScrollOnHover();this.persistState();this.didRenderInteractables();W(this,T,"m",G).call(this);this.kupManager.debug.logRender(this,true)}render(){B(this,L,[],"f");const t=!!(typeof this.kanban==="object"&&this.kanban!==null);let e=null;if(this.sortEnabled){const t=this.visibleColumns.map((t=>{const e={value:t.title,id:t.name,selected:t.name===this.sortBy};return e}));const i=[{value:"",id:""},...t];let s={label:this.kupManager.language.translate(u.SORT_BY),trailingIcon:true};let n={data:i,selectable:true};let r={"kup-text-field":s,"kup-list":n};e=o("div",{id:"sort-panel"},o("kup-combobox",{data:r,initialValue:this.sortBy,"onkup-combobox-itemclick":t=>this.onSortChange(t)}))}let i=null;if(this.globalFilter){i=o("div",{id:"global-filter"},o("kup-text-field",{fullWidth:true,label:this.kupManager.language.translate(k.SEARCH),icon:d.SEARCH,initialValue:this.globalFilterValue,"onkup-textfield-input":t=>{window.clearTimeout(this.globalFilterTimeout);this.globalFilterTimeout=window.setTimeout((()=>this.onGlobalFilterChange(t)),600)}}))}let n=null;if(this.showLoadMore||!this.lazyLoadRows&&this.pagination){n=o(R,{id:"top-paginator",currentPage:this.currentPage,max:this.filteredRows.length,perPage:this.currentRowsPerPage?this.currentRowsPerPage:this.rowsPerPage,onLoadMore:this.showLoadMore?()=>{W(this,T,"m",q).call(this)}:null,onNextPage:()=>this.handlePageChange(this.currentPage+1),onPrevPage:()=>this.handlePageChange(this.currentPage-1),onPageChange:t=>this.handlePageChange(t.detail.value),onRowsChange:t=>this.handleRowsPerPageChange(t.detail.value)})}let r=null;let a={};if(this.rows.length===0){r=o("div",{id:"empty-data-message",class:"box-wrapper"},o("div",{class:"box",ref:t=>this.rowsRefs.push(t)},this.kupManager.language.translate(u.EMPTY_DATA)));a={"grid-template-columns":`repeat(1, 1fr)`}}else if(t){const t=this.kanbanMode();r=t.jsx;a=t.style}else{a={"grid-template-columns":`repeat(${this.columns}, 1fr)`};const t=this.rows;let e=t.length;let i=0;r=[];while(e-- >0){r.push(this.renderRow(t[i++]))}}return o(s,null,o("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),o("div",{id:C},o("div",{class:"box-component",ref:t=>this.sectionRef=t},e,i,n,o("div",{class:t?"is-kanban":"",id:"box-container",style:a,onContextMenu:t=>{t.preventDefault()},ref:t=>this.boxContainer=t},r))))}disconnectedCallback(){this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop));this.kupManager.language.unregister(this);this.kupManager.theme.unregister(this);if(this.scrollOnHover){this.kupManager.scrollOnHover.unregister(this.boxContainer)}document.removeEventListener("click",this.clickFunction.bind(this));this.kupDidUnload.emit({comp:this,id:this.rootElement.id})}get rootElement(){return n(this)}static get watchers(){return{rowsPerPage:["rowsPerPageHandler","recalculateRows"],globalFilterValue:["recalculateRows"],sortBy:["recalculateRows"],pagination:["recalculateRows"],currentPage:["recalculateRows"],currentRowsPerPage:["recalculateRows"],data:["onDataChanged"],layout:["onLayoutChanged"],selectBox:["onSelectBoxChanged"]}}};$=new WeakMap,L=new WeakMap,F=new WeakMap,H=new WeakMap,N=new WeakMap,T=new WeakSet,G=function t(){if(this.lazyLoadRows&&this.currentRowsPerPage<this.data.rows.length){W(this,$,"f").observe(W(this,L,"f")[W(this,L,"f").length-1])}},V=function t(){const e=t=>{t.forEach((t=>{if(t.isIntersecting){this.kupManager.debug.logMessage(this,"Last row entering the viewport, loading more elements.");const e=this.data.rows.length-this.currentRowsPerPage;if(e<this.loadMoreStep){this.currentRowsPerPage+=e}else{this.currentRowsPerPage+=this.loadMoreStep}t.target.classList.remove("last-row");W(this,$,"f").unobserve(t.target)}}))};const i={threshold:0,rootMargin:"-"+W(this,F,"f")+"px 0px 0px 0px"};B(this,$,new IntersectionObserver(e,i),"f")},q=function t(){var e;let i=0;switch(this.loadMoreMode){case E.CONSTANT:i=this.loadMoreStep;break;case E.CONSTANT_INCREMENT:i=this.loadMoreStep*(W(this,H,"f")+1);break;case E.PROGRESSIVE_THRESHOLD:i=Math.max(W(this,N,"f"),this.loadMoreStep)*Math.min(W(this,H,"f")+1,2);break}if(i>this.loadMoreLimit){i=this.loadMoreLimit}this.kupLoadMoreClick.emit({comp:this,id:this.rootElement.id,loadItems:i});B(this,N,i,"f");B(this,H,(e=W(this,H,"f"),e++,e),"f")};K.style=D;export{K as kup_box};
2
- //# sourceMappingURL=p-c3f65052.entry.js.map
1
+ import{r as t,c as e,f as i,h as o,H as s,d as n}from"./p-d7c15b0e.js";import{k as r,y as a,g as l,s as h,a1 as c,v as p,h as u,b as d,e as f,N as b,R as x,aw as g,V as m,E as k}from"./p-1911a49e.js";import{f as w,p as v,s as y}from"./p-88d4c0ed.js";import{F as _}from"./p-2b519589.js";import{c as j}from"./p-9db21afb.js";import{c as C}from"./p-635bb4b3.js";import{F as z}from"./p-f53792c4.js";import{p as P,r as M,F as R}from"./p-95c78285.js";import{F as A}from"./p-c4054aba.js";import"./p-029c7cbe.js";import"./p-e3062c19.js";import"./p-5d03c077.js";import"./p-59c76030.js";import"./p-10dfd311.js";import"./p-d4a879fc.js";var I;(function(t){t["cardData"]="Data of the card linked to the box when the latter's layout must be a premade template.";t["columns"]="Number of columns.";t["customStyle"]="Custom style of the component.";t["data"]="Actual data of the box.";t["dragEnabled"]="Enable dragging.";t["dropEnabled"]="Enable dropping.";t["dropOnSection"]="Drop can be done in section.";t["enableRowActions"]="If enabled, a button to load / display the row actions will be displayed on the right of every box.";t["globalFilter"]="When set to true it activates the global filter.";t["globalFilterValue"]="The value of the global filter.";t["kanban"]="Displays the boxlist as a Kanban.";t["layout"]="How the field will be displayed. If not present, a default one will be created.";t["lazyLoadRows"]="When set to true, extra rows will be automatically loaded once the last row enters the viewport.";t["loadMoreLimit"]="Sets a maximum limit of new records which can be required by the load more functionality.";t["loadMoreMode"]="Establish the modality of how many new records will be downloaded. This property is regulated also by loadMoreStep.";t["loadMoreStep"]="The number of records which will be requested to be downloaded when clicking on the load more button. This property is regulated also by loadMoreMode.";t["multiSelection"]="Enable multi selection.";t["pageSelected"]="Current page number.";t["pagination"]="Enables pagination.";t["rowsPerPage"]="Number of current rows per page.";t["scrollOnHover"]="Activates the scroll on hover function.";t["selectBox"]="Automatically selects the box at the specified index.";t["selectedRowsState"]="Multiple selection.";t["showLoadMore"]="If set to true, displays the button to load more records.";t["showSelection"]="If enabled, highlights the selected box/boxes.";t["sortBy"]="If sorting is enabled, specifies which column to sort.";t["sortEnabled"]="Enable sorting.";t["stateId"]="";t["store"]="";t["swipeDisabled"]="Disable swipe."})(I||(I={}));var E;(function(t){t["CONSTANT"]="constant";t["CONSTANT_INCREMENT"]="constant_increment";t["PROGRESSIVE_THRESHOLD"]="progressive_threshold"})(E||(E={}));class S{constructor(){this.globalFilterValue="";this.sortBy="";this.selectedRowsState="";this.pageSelected=1;this.rowsPerPage=0;this.load=false;this.loadMoreLimit=1e3;this.showLoadMore=false}toDebugString(){return"box state"}}const O=".kup-body-compact-01{font-family:var(--kup-font-family);font-size:var(--kup-body-compact-01-font-size, 14px);line-height:18px;font-weight:400;letter-spacing:0.16px}.kup-body-01{font-family:var(--kup-font-family);font-size:var(--kup-body-01-font-size, 14px);line-height:20px;font-weight:400;letter-spacing:0.16px}.kup-code-01{font-family:var(--kup-font-family-monospace);font-size:12px;line-height:16px;font-weight:400;letter-spacing:0.32px}.kup-label-01{font-family:var(--kup-font-family);font-size:12px;line-height:16px;font-weight:400;letter-spacing:0.32px}.kup-caption-02{font-family:var(--kup-font-family);font-size:12px;line-height:15px;font-weight:500;letter-spacing:1px}.kup-caption-01{font-family:var(--kup-font-family);font-size:10px;line-height:13px;font-weight:400;letter-spacing:1px}.kup-small-label-01{font-family:var(--kup-font-family);font-size:6px;line-height:9px;font-weight:400;letter-spacing:1px}.kup-heading-compact-01{font-family:var(--kup-font-family);font-size:14px;line-height:18px;font-weight:600;letter-spacing:0.16px}.kup-heading-01{font-family:var(--kup-font-family);font-size:14px;line-height:20px;font-weight:600;letter-spacing:0.16px}.kup-heading-02{font-family:var(--kup-font-family);font-size:16px;line-height:24px;font-weight:500;letter-spacing:0}.kup-heading-03{font-family:var(--kup-font-family);font-size:20px;line-height:28px;font-weight:400;letter-spacing:0}.kup-heading-04{font-family:var(--kup-font-family);font-size:28px;line-height:36px;font-weight:400;letter-spacing:0}.kup-heading-05{font-family:var(--kup-font-family);font-size:32px;line-height:40px;font-weight:300;letter-spacing:0}.kup-heading-06{font-family:var(--kup-font-family);font-size:42px;line-height:50px;font-weight:300;letter-spacing:0}.kup-heading-07{font-family:var(--kup-font-family);font-size:54px;line-height:64px;font-weight:300;letter-spacing:0}.kup-heading-08{font-family:var(--kup-font-family);font-size:54px;line-height:64px;font-weight:600;letter-spacing:0}:host{--kup_box_background_color:var(--kup-box-background-color, var(--kup-layer-1));--kup_box_background_color_hover:var(\n --kup-box-background-color-hover,\n var(--kup-layer-1-hover)\n );--kup_box_background_color_selected:var(\n --kup-box-background-color-selected,\n var(--kup-layer-1-selected)\n );--kup_box_text_color:var(--kup-box-text-color, var(--kup-text-secondary));--kup_box_grid_gap:var(--kup-box-grid-gap, var(--kup-space-03));--kup_box_transition:var(--kup-box-transition, 0.25s);--kup_box_border_color_drag:var(--kup-box-border-color-drag, var(--kup-border-interactive))\n display: block;--kup_box_padding:var(--kup-box-padding, var(--kup-space-05))}.box-component{transition:border var(--kup_box_transition) ease}.box-component[kup-drag-over]{position:relative;border:3px dashed var(--kup_box_border_color_drag)}#box-container{display:grid;grid-gap:var(--kup_box_grid_gap);color:var(--kup_box_text_color);overflow:auto}#box-container.is-kanban .kanban-section{overflow:auto}#box-container.is-kanban .box-wrapper{padding-top:1em}#box-container.is-kanban .box-wrapper .box{overflow:auto}#box-container *:not(.progress-bar-percentage){box-sizing:border-box}#box-container .box-wrapper{display:flex;align-items:center;background-color:var(--kup_box_background_color);border-radius:var(--kup-radius-00)}#box-container .box-wrapper:hover{background-color:var(--kup_box_background_color_hover)}#box-container .box-wrapper.selected{background-color:var(--kup_box_background_color_selected)}#box-container .box-wrapper.selected .box-section.titled>h3{background-color:transparent}#box-container .box-wrapper .box{flex-grow:1;cursor:pointer;position:relative;display:flex;padding:var(--kup_box_padding);transition:background-color var(--kup_box_transition) ease, box-shadow var(--kup_box_transition) ease, border var(--kup_box_transition) ease}#box-container .box-wrapper .box.draggable{touch-action:none;user-select:none}#box-container .box-wrapper .box.column{flex-direction:column}#box-container .box-wrapper .box[kup-draggable]{opacity:0.5}#box-container .box-wrapper .box[kup-drag-over]{border:3px dashed var(--kup_box_border_color_drag);position:relative;z-index:2}#box-container .box-wrapper .box .box-section{display:flex;flex-direction:row;flex:1 1 1%;flex-wrap:wrap}#box-container .box-wrapper .box .box-section.column{flex-direction:column;justify-content:center;flex-wrap:unset}#box-container .box-wrapper .box .box-section.column>.box-section{flex:0 0 auto}#box-container .box-wrapper .box .box-section.grid{display:grid}#box-container .box-wrapper .box .box-section .box-object{min-height:16px}#box-container .box-wrapper .box .box-section .box-object img{height:auto}#box-container .box-wrapper .box .box-section.collapse-section .header{border-top:1px solid var(--kup-border-subtle);color:rgba(var(--kup-text-secondary-rgb), 0.75);display:flex;justify-content:space-around;width:100%}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content{margin:0.5em;display:flex;align-items:center}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image{transition:transform 0.15s}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .f-image.toggled{transform:rotate(-180deg)}#box-container .box-wrapper .box .box-section.collapse-section .header .header-content .kup-icon.kup-dropdown-icon{margin:0;-webkit-mask:var(--kup-dropdown-icon);mask:var(--kup-dropdown-icon)}#box-container .box-wrapper .box .box-section.collapse-section .content{display:none;width:100%}#box-container .box-wrapper .box .box-section.collapse-section.open .content{display:block}#box-container .box-wrapper .box .box-section.titled{border:1px solid var(--kup-border-subtle);padding-top:5px;position:relative;margin:10px}#box-container .box-wrapper .box .box-section.titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}#box-container .box-wrapper .box .box-selection{position:absolute;top:0.5em;right:0.5em;z-index:1}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler{position:relative;width:24px;height:24px;margin-left:3px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler svg{cursor:pointer;opacity:0;fill:var(--kup-text-color);transition:opacity 300ms ease-out}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu{background:var(--kup-background-color);border:1px solid var(--kup-border-subtle);box-shadow:0px 0px 7.5px 0px rgba(128, 128, 128, 0.5);position:absolute;top:0;right:24px;display:none;z-index:10}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul{list-style-type:none;margin:0;padding:0}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li{cursor:pointer;white-space:nowrap;padding:0 12px;display:flex;align-items:center;line-height:30px}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu ul>li:not(:last-child){border-bottom:1px solid var(--kup-border-subtle)}#box-container .box-wrapper .row-actions-wrapper .row-actions-toggler .row-action-menu.open{display:block}#box-container .box-wrapper:hover .row-actions-wrapper .row-actions-toggler svg{opacity:1}#sort-panel,#global-filter{margin-bottom:1em}:host(.kup-center-aligned) #kup-component .box-section{text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:center;margin:auto;text-align:center}:host(.kup-center-aligned) #kup-component .box-section .f-cell img{margin:auto}:host(.kup-right-aligned) #kup-component .box-section{text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell .f-cell__content{justify-content:flex-end;margin-left:auto;margin-right:0;text-align:right}:host(.kup-right-aligned) #kup-component .box-section .f-cell img{margin-left:auto;margin-right:0}:host(.kup-top-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-start}:host(.kup-bottom-aligned) #box-container .box-wrapper .box .box-section .column{justify-content:flex-end}:host(.kup-flat-on-hover) #box-container .box-wrapper .box:hover{box-shadow:none}:host(.kup-shaped) .box{border-radius:10px}:host(.kup-round) .box{border-radius:25px}:host(.kup-dashed-sections) .box-section{border:2px dashed var(--kup-text-color)}:host(:not(.kup-paddingless)) #box-container .box .box-section .box-object{padding:1px 4px}:host(:not(.kup-paddingless)) #box-container .box .box-section.last-child{padding:3px 4px}:host(.kup-danger){--kup-box-primary-color-rgb:var(--kup-danger-color-rgb)}:host(.kup-info){--kup-box-primary-color-rgb:var(--kup-info-color-rgb)}:host(.kup-secondary){--kup-box-primary-color-rgb:var(--kup-secondary-color-rgb)}:host(.kup-success){--kup-box-primary-color-rgb:var(--kup-success-color-rgb)}:host(.kup-warning){--kup-box-primary-color-rgb:var(--kup-warning-color-rgb)}";const D=O;var W=undefined&&undefined.__classPrivateFieldGet||function(t,e,i,o){if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e==="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?o:i==="a"?o.call(t):o?o.value:e.get(t)};var B=undefined&&undefined.__classPrivateFieldSet||function(t,e,i,o,s){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e==="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?s.call(t,i):s?s.value=i:e.set(t,i),i};var T,$,L,F,H,N,G,V,q;const K=class{constructor(i){t(this,i);this.kupBoxClick=e(this,"kup-box-click",6);this.kupBoxSelected=e(this,"kup-box-selected",6);this.kupAutoBoxSelect=e(this,"kup-box-autoselect",6);this.kupRowActionMenuClick=e(this,"kup-box-rowactionmenuclick",6);this.kupRowActionClick=e(this,"kup-box-rowactionclick",6);this.kupDidLoad=e(this,"kup-box-didload",6);this.kupDidUnload=e(this,"kup-box-didunload",6);this.kupBoxContextMenu=e(this,"kup-box-contextmenu",6);this.kupLoadMoreClick=e(this,"kup-box-loadmoreclick",6);T.add(this);this.state=new S;this.kupManager=r();this.visibleColumns=[];this.rows=[];this.filteredRows=[];this.sectionRef=null;this.rowsRefs=[];this.hold=false;this.interactableDrag=[];this.interactableDrop=[];this.interactableTouch=[];$.set(this,undefined);L.set(this,[]);F.set(this,0);H.set(this,0);N.set(this,0);this.collapsedSection={};this.selectedRows=[];this.rowActionMenuOpened=undefined;this.currentPage=1;this.currentRowsPerPage=10;this.cardData=null;this.columns=1;this.customStyle="";this.data=null;this.dragEnabled=false;this.dropEnabled=false;this.dropOnSection=false;this.editableData=false;this.enableRowActions=false;this.globalFilter=false;this.globalFilterValue="";this.kanban=null;this.layout=undefined;this.lazyLoadRows=false;this.loadMoreLimit=1e3;this.loadMoreMode=E.PROGRESSIVE_THRESHOLD;this.loadMoreStep=60;this.multiSelection=false;this.pageSelected=1;this.pagination=false;this.rowsPerPage=undefined;this.scrollOnHover=false;this.selectBox=undefined;this.selectedRowsState=undefined;this.showLoadMore=false;this.showSelection=true;this.sortBy=undefined;this.sortEnabled=false;this.stateId="";this.store=undefined;this.swipeDisabled=false}initWithPersistedState(){if(this.store&&this.stateId){const t=this.store.getState(this.stateId);if(t!=null){this.kupManager.debug.logMessage(this,"Initialize with state for stateId "+this.stateId+": "+t);this.sortBy=this.state.sortBy;this.globalFilterValue=this.state.globalFilterValue;this.selectedRowsState=this.state.selectedRowsState;this.pageSelected=this.state.pageSelected;this.rowsPerPage=this.state.rowsPerPage;this.loadMoreLimit=t.loadMoreLimit;this.showLoadMore=t.showLoadMore}}}persistState(){if(this.store&&this.stateId){let t=false;if(!this.kupManager.objects.deepEqual(this.state.sortBy,this.sortBy)){this.state.sortBy=this.sortBy;t=true}if(!this.kupManager.objects.deepEqual(this.state.globalFilterValue,this.globalFilterValue)){this.state.globalFilterValue=this.globalFilterValue;t=true}if(!this.kupManager.objects.deepEqual(this.state.pageSelected,this.currentPage)){this.state.pageSelected=this.currentPage;t=true}if(!this.kupManager.objects.deepEqual(this.state.rowsPerPage,this.currentRowsPerPage)){this.state.rowsPerPage=this.currentRowsPerPage;t=true}const e=this.selectedRows.reduce(((t,e,i)=>{const o=i>0?";":"";return t+o+e.id}),"");if(!this.kupManager.objects.deepEqual(this.state.selectedRowsState,e)){this.state.selectedRowsState=e;t=true}if(!this.kupManager.objects.deepEqual(this.state.loadMoreLimit,this.loadMoreLimit)){this.state.loadMoreLimit=this.loadMoreLimit;t=true}if(!this.kupManager.objects.deepEqual(this.state.showLoadMore,this.showLoadMore)){this.state.showLoadMore=this.showLoadMore;t=true}if(!this.state.load){this.state.load=true;return}if(t){this.kupManager.debug.logMessage(this,"Persisting state for stateId "+this.stateId+": "+this.state);this.store.persistState(this.stateId,this.state)}}}rowsPerPageHandler(t){this.currentRowsPerPage=t}recalculateRows(){this.initRows()}onDataChanged(){a(this.getRows());this.initVisibleColumns();this.initRows();this.checkLayout()}onLayoutChanged(){this.checkLayout()}onSelectBoxChanged(){this.handleAutomaticBoxSelection()}async getProps(t){return l(this,I,t)}async loadRowActions(t,e){t.actions=e;this.rowActionMenuOpened=t}async refresh(){i(this)}async setProps(t){h(this,I,t)}getColumns(){return this.data&&this.data.columns?this.data.columns:[{title:"",name:"",size:undefined}]}initVisibleColumns(){this.visibleColumns=this.getColumns().filter((t=>{if(t.hasOwnProperty("visible")){return t.visible}return true}))}getRows(){return this.data&&this.data.rows?this.data.rows:[]}initRows(){this.filteredRows=this.getRows();if(this.globalFilter&&this.globalFilterValue){this.filteredRows=w(this.filteredRows,null,this.globalFilterValue,this.visibleColumns)}this.rows=this.sortRows(this.filteredRows);if(this.pagination){this.rows=v(this.rows,this.currentPage,this.currentRowsPerPage,false)}}sortRows(t){let e=t;if(this.sortBy){e=y(e,this.toSortObjectList())}return e}toSortObjectList(){const t=this.sortBy.split("|").map((t=>{const e=t.split(",");const i={column:e[0],sortMode:e.length>1?c[e[1]]:c.A};return i}));return t}checkScrollOnHover(){if(this.boxContainer){if(!this.kupManager.scrollOnHover.isRegistered(this.boxContainer)){if(this.scrollOnHover){this.kupManager.scrollOnHover.register(this.boxContainer)}}else{if(!this.scrollOnHover){this.kupManager.scrollOnHover.unregister(this.boxContainer)}}}}checkLayout(){if(this.layout){this.boxLayout=this.layout;return}const t={horizontal:false,sections:[]};const e=this.visibleColumns;let i=e.length;let o=[];let s=0;while(i-- >0){o.push({column:e[s++].name})}t.content=o;this.boxLayout={sections:[t]}}onSortChange(t){let e=p(this.visibleColumns,t.detail.value);this.sortBy=e.name}onGlobalFilterChange({detail:t}){let e="";if(t&&t.value){e=t.value}this.globalFilterValue=e}isSectionExpanded(t,e){if(!t.id||!e.id){return false}return this.collapsedSection[e.id]&&this.collapsedSection[e.id][t.id]}handleAutomaticBoxSelection(){if(this.selectBox&&this.selectBox>0&&this.selectBox<=this.data.rows.length){this.selectedRows=[];for(let t of this.data.rows){if(t.id===(this.selectBox-1).toString()){this.selectedRows.push(t);break}}this.kupAutoBoxSelect.emit({comp:this,id:this.rootElement.id,row:this.selectedRows[0]})}}getEventDetails(t,e){let i=null;let o=null;let s=null;let n=null;if(t){for(let e=t.length-1;e>=0;e--){let o=t[e];if(!o.tagName){continue}switch(o.tagName.toUpperCase()){default:{if(o.classList.contains("box-object")){i=o}if(!s&&o["data-row"]){s=o["data-row"]}break}}}}if(i){if(i.classList.contains("f-cell")){const t=i["kup-get-cell-props"]();o=t.cell;n=t.column;s=t.row}else{o=i["data-cell"];s=i["data-row"];n=p(this.visibleColumns,i.dataset.column)}}return{boxObject:i?i:null,column:n?n:null,cell:o?o:null,originalEvent:e,row:s?s:null}}clickHandler(t){const e=this.getEventDetails(this.kupManager.getEventPath(t.target,this.rootElement),t);if(e.row){if(this.multiSelection){this.onSelectionCheckChange(e.row)}else{this.selectedRows=[e.row]}}return e}contextMenuHandler(t){const e=this.getEventDetails(this.kupManager.getEventPath(t.target,this.rootElement),t);return e}checkIfElementIsActionMenuIcon(t){if(t.tagName&&t.parentElement){return t.tagName==="svg"&&t.parentElement.classList.contains("row-actions-toggler")}return false}onSelectionCheckChange(t){var e=-1;for(let i=0;i<this.selectedRows.length;i++){const o=this.selectedRows[i];if(o.id===t.id){e=i;break}}if(e>=0){this.selectedRows.splice(e,1);this.selectedRows=[...this.selectedRows]}else{this.selectedRows=[...this.selectedRows,t]}this.kupBoxSelected.emit({comp:this,id:this.rootElement.id,rows:this.selectedRows})}toggleSectionExpand(t,e){if(!e.id){console.error("cannot expand / collapse a section withoun an ID");return}if(!t.id){console.error("cannot expand / collapse a section of a row without ad id");return}if(!this.collapsedSection[e.id]){this.collapsedSection[e.id]={};this.collapsedSection[e.id][t.id]=true}else{const i=this.collapsedSection[e.id];if(!i[t.id]){i[t.id]=true}else{i[t.id]=!i[t.id]}}this.collapsedSection=Object.assign({},this.collapsedSection)}onRowAction(t){if(!t){return}if(t===this.rowActionMenuOpened){this.rowActionMenuOpened=null;return}if(t.actions){this.rowActionMenuOpened=t}else{this.kupRowActionMenuClick.emit({comp:this,id:this.rootElement.id,row:t})}}onRowActionClick(t,e,i){this.kupRowActionClick.emit({comp:this,id:this.rootElement.id,row:t,action:e,index:i})}clickFunction(t){try{const e=t.composedPath();for(let t of e){if(this.checkIfElementIsActionMenuIcon(t)){return}}}catch(e){if(this.checkIfElementIsActionMenuIcon(t.target)){return}}this.rowActionMenuOpened=null}handlePageChange(t){const e=P(t,this.filteredRows.length,this.currentRowsPerPage);if(e){this.currentPage=e}}handleRowsPerPageChange(t){const e=M(t,this.filteredRows.length);if(e){this.currentRowsPerPage=e;this.adjustPaginator()}}adjustPaginator(){const t=this.rows.length;const e=Math.ceil(t/this.currentRowsPerPage);if(this.currentPage>e){this.currentPage=1}}renderSectionAsCard(t){let e=false;const i={button:[],cell:[],columns:[],image:[],progressbar:[],text:[]};for(let e=0;e<this.data.columns.length;e++){const o=this.data.columns[e];if(o.visible!==false){i.cell.push(t.cells[o.name]);i.columns.push(o)}}for(const e in t.cells){if(t.cells.hasOwnProperty(e)){const o=t.cells[e];if(o.cardID!==undefined&&o.obj){switch(o.obj.p){case"BTN":do{i.button.push({})}while(i.button.length<o.cardID);i.button[o.cardID]={label:o.value};break;case"IMG":do{i.image.push({})}while(i.image.length<o.cardID);i.image[o.cardID]={resource:o.value};break;case"PGB":do{i.progressbar.push({})}while(i.progressbar.length<o.cardID);i.progressbar[o.cardID]={value:o.value};break;default:do{i.text.push("")}while(i.text.length<o.cardID);i.text[o.cardID]=o.value;break}}}}for(const o in t.cells){if(t.cells.hasOwnProperty(o)){const s=t.cells[o];if(s.cardID===undefined&&s.obj){e=false;switch(s.obj.p){case"BTN":for(let t=0;t<i.button.length;t++){if(!Object.keys(i.button[t]).length){i.button[t]={label:s.value};e=true;break}}if(!e){i.button.push({label:s.value})}break;case"IMG":for(let t=0;t<i.image.length;t++){if(!Object.keys(i.image[t]).length){i.image[t]={resource:s.value};e=true;break}}if(!e){i.image.push({resource:s.value})}break;case"PGB":for(let t=0;t<i.progressbar.length;t++){if(!Object.keys(i.progressbar[t]).length){i.progressbar[t]={value:s.value};e=true;break}}if(!e){i.progressbar.push({value:s.value})}break;default:for(let t=0;t<i.text.length;t++){if(i.text[t]===""){i.text[t]=s.value;e=true;break}}if(!e){i.text.push(s.value)}break}}}}return o("kup-card",Object.assign({data:i},this.cardData))}renderRow(t){const e=[...this.visibleColumns];let i=null;let s=t.layout;if(!s){s=this.boxLayout}let n=false;if(s){if(s.horizontal){n=true}const o=s.sections;let r=o.length;let a=0;if(r>0){i=[]}const l={horizontal:n};while(r-- >0){if(this.cardData!==null&&this.cardData!==undefined&&typeof this.cardData==="object"){i.push(this.renderSectionAsCard(t))}else{i.push(this.renderSection(o[a++],l,t,e))}}}var r=false;for(let e of this.selectedRows){if(e.id===t.id){r=true}}let a=null;if(this.multiSelection){a=o("div",{class:"box-selection"},o("kup-checkbox",{checked:r}))}let l=null;if(this.enableRowActions&&!this.swipeDisabled){const e={"row-action-menu":true,open:t===this.rowActionMenuOpened};let i=null;if(t.actions){const e=t.actions.map(((e,i)=>{const s=`icon ${e.icon}`;return o("li",{tabindex:"0",onClick:()=>this.onRowActionClick(t,e,i)},o("div",{class:s}),o("div",{class:"text"},e.text))}));i=o("ul",null,e)}l=o("div",{class:"row-actions-wrapper"},o("div",{class:"row-actions-toggler"},o("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 24 24",onClick:()=>this.onRowAction(t)},o("path",{d:"M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z"})),o("div",{class:e},i)))}let h=null;if(t.badgeData&&t.badgeData.length>0){h=t.badgeData.map((t=>o("kup-badge",{text:t.text,class:t["className"]?`centered ${t["className"]}`:"centered",imageData:t.imageData})))}const c={box:true,draggable:this.dragEnabled,selected:this.showSelection&&r,column:!n};const p=t.style||{};return o("div",{class:"box-wrapper",style:p,ref:t=>{if(t){W(this,L,"f").push(t)}}},o("div",{class:c,"data-row":t,ref:t=>this.rowsRefs.push(t)},a,i,h),l)}renderSection(t,e,i,s){let n=null;if(t.sections&&t.sections.length>0){const e=t.sections;let o=e.length;let r=0;if(o>0){n=[]}while(o-- >0){n.push(this.renderSection(e[r++],t,i,s))}}else if(t.content){const e=t.content;let o=e.length;let r=0;if(o>0){n=[]}while(o-- >0){n.push(this.renderBoxObject({boxObject:e[r++],row:i,visibleColumns:s},true))}}else if(s.length>0){const t=s[0];n=this.renderBoxObject({boxObject:{column:t.name},row:i,visibleColumns:s})}const r=this.isSectionExpanded(i,t);const a=!!t.columns;const l={"box-section":true,open:r,column:!a&&!t.horizontal,grid:a,titled:!!t.title,"last-child":!t.sections||t.sections.length===0};const h=t.style||{};if(t.dim&&e){h.flex=`0 0 ${t.dim}`;h.overflow="hidden";if(e.horizontal){h.maxWidth=t.dim}else{h.maxHeight=t.dim}}if(a){h["grid-template-columns"]=`repeat(${t.columns}, 1fr)`}let c=null;if(t.collapsible){l["collapse-section"]=true;const e={content:true};let s="";if(t.title){s=t.title}else if(r){s=this.kupManager.language.translate(u.COLLAPSE)}else{s=this.kupManager.language.translate(u.EXPAND)}c=o("div",{class:l,style:h},o("div",{class:e},n),o("div",{class:"header",role:"button",onClick:e=>{e.stopPropagation();this.toggleSectionExpand(i,t)}},o("div",{class:"header-content"},o("span",null,s),o(_,{resource:`${d.DROPDOWN}`,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:r?"toggled":""}))))}else{const e=t.title?o("h3",null,t.title):null;c=o("div",{class:l,style:h},e,n)}return c}renderBoxObject({boxObject:t,row:e,visibleColumns:i},s){const n={"box-object":true};const r={};let a=null;let l=-1;for(let e=0;e<i.length;e++){const o=i[e];if(o.name===t.column){l=e;break}}if(l>=0){a=i[l];i.splice(l,1)}else if(s){a=this.data.columns.find((e=>e.name===t.column))}const h=e.cells[t.column];let c=undefined;if(h&&!this.kupManager.objects.isEmptyKupObj(h.obj)){n["is-obj"]=true;if(this.kupManager.debug.isDebug()){c=h.obj.t+"; "+h.obj.p+"; "+h.obj.k+";"}}const p={cell:h,column:a,component:this,editable:this.editableData,renderKup:true,row:e,setSizes:true,shape:t.shape};return o("div",{"data-cell":h,"data-row":e,"data-column":t.column,class:n,style:r,title:c},h&&a?o(z,Object.assign({},p)):o("span",null,t.value))}kanbanMode(){if(!this.kanban.columns||this.kanban.columns.length===0){this.kupManager.debug.logMessage(this,"No columns to group by detected.",f.ERROR);return{jsx:o("div",{id:"empty-data-message",class:"box-wrapper"},o("div",{ref:t=>this.rowsRefs.push(t)}),this.kupManager.language.translate(u.EMPTY_DATA)),style:{"grid-template-columns":`repeat(1, 1fr)`}}}const t=[];if(this.kanban.labels){for(let e=0;e<this.kanban.labels.length;e++){const i=this.kanban.labels[e];t.push({labels:i,nodes:[]})}}for(let e=0;e<this.rows.length;e++){let i=[];for(let t=0;t<this.kanban.columns.length;t++){try{i.push(this.rows[e].cells[this.kanban.columns[t]].value)}catch(t){this.kupManager.debug.logMessage(this,t,f.WARNING)}}const o={found:false,index:null};for(let e=0;e<t.length;e++){let s=t[e].labels;let n=true;for(let t=0;t<s.length;t++){if(i[t]!==s[t]){n=false;break}}if(n){o.found=true;o.index=e;break}}if(o.found){t[o.index].nodes.push(this.renderRow(this.rows[e]))}else{t.push({labels:i,nodes:[this.renderRow(this.rows[e])]})}}const e=[];for(let i=0;i<t.length;i++){const s=t[i].labels;const n={data:[]};for(let t=0;t<s.length;t++){n.data.push({value:s[t],id:s[t]})}e.push(o("div",{class:"kanban-section"},o(j,Object.assign({},n)),t[i].nodes))}return{jsx:e,style:{"grid-template-columns":this.kanban.isStacked?"repeat(1fr)":this.kanban.size?`repeat(${Object.keys(t).length}, ${this.kanban.size})`:`repeat(${Object.keys(t).length}, 1fr)`}}}didLoadInteractables(){this.interactableTouch.push(this.boxContainer);const t=t=>{var e;if(this.hold){this.hold=false;return}switch(t.button){case 0:const i={};for(const e in t){i[e]=t[e]}const o=this.clickHandler(i);this.kupBoxClick.emit({comp:this,id:this.rootElement.id,row:o.row,column:(e=o.column)===null||e===void 0?void 0:e.name});break;case 2:this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)});break}};const e=t=>{if(t.pointerType==="pen"||t.pointerType==="touch"){this.hold=true;this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)})}};this.kupManager.interact.on(this.boxContainer,b.TAP,t);this.kupManager.interact.on(this.boxContainer,b.HOLD,e)}didRenderInteractables(){if(this.dragEnabled){for(let t=0;t<this.rowsRefs.length;t++){const e=this.rowsRefs[t];const i=()=>{const t=this.rootElement.shadowRoot.querySelector(".box-object:hover");return{cell:t["data-cell"],column:p(this.visibleColumns,t.dataset.column),id:this.rootElement.id,multiple:this.multiSelection,row:t["data-row"],selectedRows:this.selectedRows}};if(e&&!this.interactableDrag.includes(e)){this.interactableDrag.push(e);this.kupManager.interact.draggable(e,{allowFrom:".box-object",cursorChecker(){return null}},{callback:i},x.BADGE)}}}if(this.dropEnabled){const t=()=>{const t=this.rootElement.shadowRoot.querySelector(".box:hover");if(!t){this.kupManager.debug.logMessage(this,"Couldn't find cell hovered to retrieve dropzone informations!",f.WARNING);return}const e=this.kupManager.getEventPath(t,this.rootElement);const i=this.getEventDetails(e);return{cell:i.cell,column:i.column,id:this.rootElement.id,row:i.row}};if(!this.interactableDrop.includes(this.sectionRef)){this.interactableDrop.push(this.sectionRef);this.kupManager.interact.dropzone(this.sectionRef,{accept:`[${g}]`},{dispatcher:this.rootElement,type:m.BOX})}for(let e=0;e<this.rowsRefs.length;e++){const i=this.rowsRefs[e];if(i&&!this.interactableDrop.includes(i)){this.interactableDrop.push(i);this.kupManager.interact.dropzone(i,{accept:`[${g}]`},{callback:t,dispatcher:this.rootElement,type:m.BOX})}}}}componentWillLoad(){this.kupManager.debug.logLoad(this,false);if(this.rowsPerPage){this.currentRowsPerPage=this.rowsPerPage}if(this.data&&this.data.rows&&this.currentRowsPerPage>this.data.rows.length){this.currentRowsPerPage=this.data.rows.length}this.kupManager.language.register(this);this.kupManager.theme.register(this);this.onDataChanged();this.adjustPaginator();if(document.querySelector(".header")){B(this,F,document.querySelector(".header").clientHeight,"f")}else{B(this,F,0,"f")}if(document.querySelector(".topbar")){B(this,F,W(this,F,"f")+document.querySelector(".topbar").clientHeight,"f")}W(this,T,"m",V).call(this)}componentDidLoad(){this.handleAutomaticBoxSelection();document.addEventListener("click",this.clickFunction.bind(this));this.currentPage=this.pageSelected;if(this.multiSelection&&this.selectedRowsState){this.selectedRows=[];let t=this.selectedRowsState.split(";");this.selectedRows=this.data.rows.filter((e=>t.indexOf(e.id)>=0))}this.didLoadInteractables();this.kupDidLoad.emit({comp:this,id:this.rootElement.id});this.kupManager.debug.logLoad(this,true)}componentWillRender(){this.kupManager.debug.logRender(this,false)}componentDidRender(){const t=this.rootElement.shadowRoot;if(t){const e=t.querySelectorAll(".f-text-field");for(let t=0;t<e.length;t++){A(e[t])}}this.checkScrollOnHover();this.persistState();this.didRenderInteractables();W(this,T,"m",G).call(this);this.kupManager.debug.logRender(this,true)}render(){B(this,L,[],"f");const t=!!(typeof this.kanban==="object"&&this.kanban!==null);let e=null;if(this.sortEnabled){const t=this.visibleColumns.map((t=>{const e={value:t.title,id:t.name,selected:t.name===this.sortBy};return e}));const i=[{value:"",id:""},...t];let s={label:this.kupManager.language.translate(u.SORT_BY),trailingIcon:true};let n={data:i,selectable:true};let r={"kup-text-field":s,"kup-list":n};e=o("div",{id:"sort-panel"},o("kup-combobox",{data:r,initialValue:this.sortBy,"onkup-combobox-itemclick":t=>this.onSortChange(t)}))}let i=null;if(this.globalFilter){i=o("div",{id:"global-filter"},o("kup-text-field",{fullWidth:true,label:this.kupManager.language.translate(k.SEARCH),icon:d.SEARCH,initialValue:this.globalFilterValue,"onkup-textfield-input":t=>{window.clearTimeout(this.globalFilterTimeout);this.globalFilterTimeout=window.setTimeout((()=>this.onGlobalFilterChange(t)),600)}}))}let n=null;if(this.showLoadMore||!this.lazyLoadRows&&this.pagination){n=o(R,{id:"top-paginator",currentPage:this.currentPage,max:this.filteredRows.length,perPage:this.currentRowsPerPage?this.currentRowsPerPage:this.rowsPerPage,onLoadMore:this.showLoadMore?()=>{W(this,T,"m",q).call(this)}:null,onNextPage:()=>this.handlePageChange(this.currentPage+1),onPrevPage:()=>this.handlePageChange(this.currentPage-1),onPageChange:t=>this.handlePageChange(t.detail.value),onRowsChange:t=>this.handleRowsPerPageChange(t.detail.value)})}let r=null;let a={};if(this.rows.length===0){r=o("div",{id:"empty-data-message",class:"box-wrapper"},o("div",{class:"box",ref:t=>this.rowsRefs.push(t)},this.kupManager.language.translate(u.EMPTY_DATA)));a={"grid-template-columns":`repeat(1, 1fr)`}}else if(t){const t=this.kanbanMode();r=t.jsx;a=t.style}else{a={"grid-template-columns":`repeat(${this.columns}, 1fr)`};const t=this.rows;let e=t.length;let i=0;r=[];while(e-- >0){r.push(this.renderRow(t[i++]))}}return o(s,null,o("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),o("div",{id:C},o("div",{class:"box-component",ref:t=>this.sectionRef=t},e,i,n,o("div",{class:t?"is-kanban":"",id:"box-container",style:a,onContextMenu:t=>{t.preventDefault()},ref:t=>this.boxContainer=t},r))))}disconnectedCallback(){this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop));this.kupManager.language.unregister(this);this.kupManager.theme.unregister(this);if(this.scrollOnHover){this.kupManager.scrollOnHover.unregister(this.boxContainer)}document.removeEventListener("click",this.clickFunction.bind(this));this.kupDidUnload.emit({comp:this,id:this.rootElement.id})}get rootElement(){return n(this)}static get watchers(){return{rowsPerPage:["rowsPerPageHandler","recalculateRows"],globalFilterValue:["recalculateRows"],sortBy:["recalculateRows"],pagination:["recalculateRows"],currentPage:["recalculateRows"],currentRowsPerPage:["recalculateRows"],data:["onDataChanged"],layout:["onLayoutChanged"],selectBox:["onSelectBoxChanged"]}}};$=new WeakMap,L=new WeakMap,F=new WeakMap,H=new WeakMap,N=new WeakMap,T=new WeakSet,G=function t(){if(this.lazyLoadRows&&this.currentRowsPerPage<this.data.rows.length){W(this,$,"f").observe(W(this,L,"f")[W(this,L,"f").length-1])}},V=function t(){const e=t=>{t.forEach((t=>{if(t.isIntersecting){this.kupManager.debug.logMessage(this,"Last row entering the viewport, loading more elements.");const e=this.data.rows.length-this.currentRowsPerPage;if(e<this.loadMoreStep){this.currentRowsPerPage+=e}else{this.currentRowsPerPage+=this.loadMoreStep}t.target.classList.remove("last-row");W(this,$,"f").unobserve(t.target)}}))};const i={threshold:0,rootMargin:"-"+W(this,F,"f")+"px 0px 0px 0px"};B(this,$,new IntersectionObserver(e,i),"f")},q=function t(){var e;let i=0;switch(this.loadMoreMode){case E.CONSTANT:i=this.loadMoreStep;break;case E.CONSTANT_INCREMENT:i=this.loadMoreStep*(W(this,H,"f")+1);break;case E.PROGRESSIVE_THRESHOLD:i=Math.max(W(this,N,"f"),this.loadMoreStep)*Math.min(W(this,H,"f")+1,2);break}if(i>this.loadMoreLimit){i=this.loadMoreLimit}this.kupLoadMoreClick.emit({comp:this,id:this.rootElement.id,loadItems:i});B(this,N,i,"f");B(this,H,(e=W(this,H,"f"),e++,e),"f")};K.style=D;export{K as kup_box};
2
+ //# sourceMappingURL=p-cab51c5f.entry.js.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./p-e3062c19.js";import{a8 as t,a9 as s,d as n,a5 as i,aa as c,ab as a,ac as l,F as o,ad as r,ae as u,af as d,ag as f,ah as p,ai as b,aj as k,e as h}from"./p-1911a49e.js";import{h as v,g as m,F as g}from"./p-d7c15b0e.js";import{F as j}from"./p-5d03c077.js";import{F as w}from"./p-59c76030.js";import{F as O}from"./p-2b519589.js";import{F as y,c as $}from"./p-9db21afb.js";import{F as x}from"./p-10dfd311.js";var _;(function(e){e["customStyle"]="Custom style of the component.";e["data"]="The data of the list.";e["displayMode"]="Selects how the items must display their label and how they can be filtered for.";e["filter"]="Keeps string for filtering elements when filter mode is active";e["hideText"]="Hides rows' text, ideally to display a list of icons only.";e["isMenu"]="Defines whether the list is a menu or not.";e["keyboardNavigation"]="When true, enables items' navigation through arrow keys.";e["menuVisible"]="Sets the status of the menu, when false it's hidden otherwise it's visible.";e["roleType"]="Defines the type of selection. Values accepted: listbox, radiogroup or group.";e["selectable"]="Defines whether items are selectable or not.";e["showIcons"]="Displays the icons associated to each row when set to true.";e["twoLine"]="The list elements descriptions will be arranged in two lines."})(_||(_={}));var C;(function(e){e["LISTBOX"]="listbox";e["RADIOGROUP"]="radiogroup";e["GROUP"]="group"})(C||(C={}));var I;(function(e){e["CODE"]="code";e["DESCRIPTION"]="description";e["DESCRIPTION_AND_CODE"]="both"})(I||(I={}));var z;(function(e){e["SMALL"]="small";e["MEDIUM"]="medium"})(z||(z={}));const N=e=>{if(!e.sizing){e.sizing=z.MEDIUM}e.sizing.toLowerCase()===z.SMALL;const t={switch:true,"switch--checked":e.checked,"switch--disabled":e.disabled,[`switch--${e.sizing}`]:e.sizing?true:false};return v("div",Object.assign({class:`f-switch ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`},e.dataSet,{id:e.id,title:e.title}),v("div",{class:`form-field ${e.leadingLabel?"form-field--align-end":""}`},v("div",{class:t},v("div",{class:"switch__track"}),v("div",{class:"switch__thumb-underlay"},v("div",{class:"switch__thumb"},v("input",{type:"checkbox",class:"switch__native-control",role:"switch",checked:e.checked,disabled:e.disabled,value:e.checked?"on":"off",onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus})))),v("label",{onClick:e.onChange},e.label)))};const F=e=>{if(!e.centeredLabel&&!e.centeredLabel!==false){e.centeredLabel=true}let t=`f-progress-bar ${e.danger?"kup-danger":""} ${e.animated?"kup-animated":""} ${e.padded?"kup-padded":""} ${e.info?"kup-info":""} ${e.slim?"kup-slim":""} ${e.striped?"kup-striped":""} ${e.secondary?"kup-secondary":""} ${e.slim?"kup-slim":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`;let s="pie";let n=undefined;if(e.isRadial){t+=" pie-wrapper is-radial"}else{t+=" progress-bar"}let i=undefined;const c={width:`${e.value}%`};if(!e.centeredLabel){i=c;if(e.value>2){t+=" text-color-on-primary"}}else if(e.value>49){t+=" text-color-on-primary"}let a=null;if(e.icon){a=H(e)}else{if(!e.hideLabel){if(e.isRadial){if(e.label){a=v("span",{class:"label"},e.label)}else{a=v("span",{class:"label"},e.value,v("span",{class:"smaller"},"%"))}}else{if(e.label){a=e.label}else{a=e.value+"%"}}}}if(e.value>0){s+=" has-value";if(e.value>50){s+=" is-more-than-half"}else{s+=" is-less-than-half"}}if(e.isRadial){return v("div",{class:t},a,v("div",{class:s},v("div",{style:n,class:"left-side half-circle"}),v("div",{class:"right-side half-circle"})),v("div",{class:"shadow"}))}else{return v("div",{class:t},v("div",{class:"progress-bar-percentage",style:c},v("span",{style:i},a)))}};function H(e){if(!e.icon){return undefined}if(e.icon.indexOf(".")>-1||e.icon.indexOf("/")>-1||e.icon.indexOf("\\")>-1){return v("span",{class:"label kup-icon is-image"},v("img",{src:e.icon}))}else{let t=`url('${m(`./assets/svg/${e.icon}.svg`)}') no-repeat center`;let s={mask:t,webkitMask:t};return v("span",{style:s,class:"label kup-icon"})}}var D;(function(e){e["RADIO"]="radio";e["CHEVRON"]="chevron"})(D||(D={}));const T=e=>{var t;const s=!!e.columns;const n=[];const i=e.type||D.RADIO;for(let s=0;s<((t=e.data)===null||t===void 0?void 0:t.length);s++){const t=e.data[s];const c={radio:true,"radio--checked":t.checked?true:false,"radio--disabled":e.disabled?true:false,[`radio--${e.type}`]:e.type?true:false};n.push(v("div",{class:`form-field \n ${e.leadingLabel?" form-field--align-end":""} ${e.disabled?"radio--disabled":""}`},v("div",{class:c},i===D.RADIO?v("input",{class:"radio__native-control",type:"radio",name:"radio-element",value:t.value,checked:t.checked,disabled:e.disabled,onBlur:e.onBlur,onChange:e.onChange?e.onChange.bind(e.onChange,s):null,onFocus:e.onFocus}):v(g,null,t.checked?v(O,{resource:"check",sizeX:"14px",sizeY:"14px"}):v(O,{sizeX:"14px",sizeY:"14px",onClick:e.onChange?e.onChange.bind(e.onChange,s):null})),i===D.RADIO&&v("div",{class:"radio__background"},v("div",{class:"radio__outer-circle"}),v("div",{class:"radio__inner-circle"}))),v("label",{htmlFor:"radio-element",onClick:e.onChange?e.onChange.bind(e.onChange,s):null},t.label?t.label:"")))}const c={"--kup_radio_columns":s?`repeat(${e.columns}, 1fr)`:""};return v("div",{class:`f-radio radio-wrapper\n ${s?"radio-wrapper-grid":""} ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""} ${e.horizontal?"kup-horizontal":""}`,style:c},n)};const M=e=>{if(!e.maxValue){e.maxValue=5}return v("div",{class:`f-rating ${e.disabled?"disabled":""} ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`},S(e))};function S(e){const t=[];for(let s=1;s<=e.maxValue;s++){if(s<=e.value){t.push(v("span",{class:"rating",onClick:e.onClick?e.onClick.bind(e.onClick,s):null},"★"))}else{t.push(v("span",{class:"rating",onClick:e.onClick?e.onClick.bind(e.onClick,s):null},"☆"))}}return t}const E=document.documentElement;const V=(e,c)=>{var a;const l=e.cell;const o=e.column;const r=e.row;const d=e.shape?e.shape:l.shape?l.shape:o.shape?o.shape:null;const f=!E.ketchup.objects.isEmptyKupObj(l.obj);let h=false;if(l.hasOwnProperty("isEditable")){h=l.isEditable}else if(o.hasOwnProperty("isEditable")){h=o.isEditable}h=h&&e.editable;if(l.options){l.data=(a=X(l,o))!==null&&a!==void 0?a:l.data}const m=e.previousValue!==l.value?l.value:"";const g=E.ketchup.data.cell.getType(l,d);const j=Object.assign({},l.data);let w=l.cssClass?l.cssClass:(o===null||o===void 0?void 0:o.cssClass)?o===null||o===void 0?void 0:o.cssClass:"";if(e.component.legacyLook){w+=" monospace c-pre"}const y={"f-cell":true,[u.OBJ]:f?true:false,[g+"-cell"]:true,[e.wrapperClass]:e.wrapperClass?true:false,[e.density]:e.density&&g!==i.BAR?true:false,[w]:w?true:false,"c-input-uppercase":b(l),"c-input-lowercase":k(l)};let $=m;if(!l.data){ne(g,l)}if(h&&t.includes(g)){$=ee(g,y,l,o,e)}else if(l.data&&s.includes(g)){if(e.setSizes){Z(g,j,l)}if(!e.renderKup){const e="cell-"+g+" placeholder";$=v("span",{class:e})}else{$=se(g,y,j,l,r,o,e)}}else{if(e.setSizes){Q(g,j,l,e)}$=te(g,j,$,y,l,o,e)}let x=null;if(!h&&(o.icon||l.icon)&&$){const e={color:`rgba(var(${n.TEXT}-rgb), 0.375)`,resource:l.icon?l.icon:o.icon,placeholderResource:l.placeholderIcon?l.placeholderIcon:o.placeholderIcon,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:"obj-icon"};x=v(O,Object.assign({},e))}let _=null;if(E.ketchup.debug.isDebug()&&f){_=l.obj.t+"; "+l.obj.p+"; "+l.obj.k+";"}else if(l.title!=null&&l.title.trim()!=""){_=l.title}let C=null;if(l.info){const e=Object.assign({},l.info);if(!e.color){e.color=`var(${n.INFO})`}if(!e.icon){e.icon="info"}const t={color:e.color,resource:e.icon,placeholderResource:e.placeholderIcon,sizeX:"1.25em",sizeY:"1.25em",title:e.message?e.message:"",wrapperClass:"cell-info"};C=v(O,Object.assign({},t))}return v("div",{onKeyUp:t=>ie(t,e,g,p.KEYUP),class:y,"kup-get-cell-props":()=>e,ref:e=>l.element=e,style:l.style},v("div",{class:"f-cell__content",style:l.styleContent,title:_},e.cellActionIcon&&v(O,{resource:"more_vert",sizeX:"16px",sizeY:"16px",wrapperClass:`f-cell__iconfunction ${g===i.NUMBER?"left":"right"}`,onClick:e.cellActionIcon.onClick,tabIndex:0}),c&&c.length>0?c:[e.indents,C,x,$]))};const X=(e,t)=>{if(!e){return null}const s=e.options;const n=t.title;const c=e.value;const a=E.ketchup.data.cell.getType(e,e.shape);const l=new Map([[i.BUTTON_LIST,W.bind(undefined)],[i.STRING,A.bind(undefined)],[i.RADIO,B.bind(undefined)],[i.AUTOCOMPLETE,G.bind(undefined)],[i.COMBOBOX,G.bind(undefined)],[i.CHECKBOX,K.bind(undefined)],[i.OBJECT,Y.bind(undefined)],[i.CHIP,R.bind(undefined)]]);const o=l.get(a);return o?o(s,n,c,e):null};const R=(e,t,s,n)=>{const i={data:(e===null||e===void 0?void 0:e.length)?e===null||e===void 0?void 0:e.map((e=>({id:e.id,value:e.id}))):[]};n.data=Object.assign(Object.assign({},n.data),i)};const Y=(e,t,s,n,i)=>({data:{initialValue:s||"",label:t||"",value:s||""}});const K=(e,t,s,n)=>Object.assign(Object.assign({},n.data),{checked:s==="on"||s==="1",label:t});const W=(e,t,s,n)=>({data:[Object.assign(Object.assign({},n.data),{icon:n.icon,value:s})]});const A=(e,t,s,n)=>Object.assign(Object.assign({},n.data),{label:t});const B=(e,t,s,n)=>{const i=c(s,e);n.data=Object.assign(Object.assign({},n.data),i)};const G=(e,t,s,n,i)=>{var c;if(!((c=n.data)===null||c===void 0?void 0:c.data)&&e){const n=a(s,t,[]);n.data["kup-list"].data=P(e,s);return n}};const P=(e,t)=>{const s=J.get(e.type);if(s){return s(e,t)}else{return e.map((e=>({value:e.label,id:e.id,selected:t===e.id})))}};const L=(e,t)=>e.children.map((e=>{var s;return{id:e.content.codice,value:e.content.testo,selected:t===e.content.codice,children:((s=e.children)===null||s===void 0?void 0:s.length)?L(e,t):[]}}));const U=(e,t)=>e.children.map((e=>{var s;return{id:e.obj.k,value:e.value,selected:t===e.obj.k,children:((s=e.children)===null||s===void 0?void 0:s.length)?U(e,t):[]}}));const q=(e,t)=>e.rows.map((e=>{var s;const n=e.fields||e.cells;const[i,c]=Object.keys(n);return{id:n[i].value,value:((s=n[c])===null||s===void 0?void 0:s.value)||n[i].value,selected:t===n[i].value}}));const J=new Map([["SmeupTreeNode",L.bind(undefined)],["SmeupDataTree",U.bind(undefined)],["SmeupTable",q.bind(undefined)],["SmeupDataTable",q.bind(undefined)]]);function Q(e,t,s,n){var c;switch(e){case i.CHECKBOX:case i.ICON:if(!t.sizeX){t.sizeX="18px"}if(!t.sizeY){t.sizeY="18px"}if(s.style){if(!s.style.height){s.style["minHeight"]=t.sizeY}}else{s.style={minHeight:t.sizeY}}break;case i.IMAGE:const e=((c=n.cell)===null||c===void 0?void 0:c.value)||"";const a=e.indexOf(".")>-1||e.indexOf("/")>-1||e.indexOf("\\")>-1;if(n.component.rootElement.tagName===l.DATA_TABLE&&!a){if(!t.sizeX&&!t.sizeY){t.sizeX="100%";t.sizeY="64px";t.wrapperClass="noWidth"}else{if(!t.sizeX){t.sizeX="100%";t.wrapperClass="noWidth"}if(!t.sizeY){t.sizeY="auto"}}}if(n.component.rootElement.tagName===l.BOX){if(!t.sizeY){t.sizeY="auto"}if(t.fit===undefined){t.fit=true}}else if(!t.sizeX){t.sizeX="auto"}if(!t.sizeY){t.sizeY="64px"}break}}function Z(e,t,s){switch(e){case i.BAR:if(!t.sizeY){t.sizeY="26px"}break;case i.BUTTON:let e="";if(t.label){e="36px"}if(s.style){if(!s.style.height){s.style["minHeight"]=e}}else{s.style={minHeight:e}}break;case i.CHART:if(!t.sizeX){t.sizeX="100%"}if(!t.sizeY){t.sizeY="100%"}break;case i.CHIP:if(s.style){if(!s.style.height){s.style["minHeight"]="40px"}}else{s.style={minHeight:"40px"}}break;case i.RADIO:if(s.style){if(!s.style.height){s.style["minHeight"]="40px"}}else{s.style={minHeight:"40px"}}break}}function ee(t,s,n,c,a){var l,r;switch(t){case i.AUTOCOMPLETE:return v("kup-autocomplete",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-autocomplete-change":e=>ie(e,a,t,p.UPDATE),"onkup-autocomplete-input":e=>ie(e,a,t,p.INPUT),"onkup-autocomplete-iconclick":e=>ie(e,a,t,p.ICON_CLICK)}));case i.CHECKBOX:if(ae(a)){s[u.C_CENTERED]=true}if(n.shape===o.INPUT_CHECKBOX){return v("input",{checked:n.value==="on"||n.value==="1"?true:false,class:"input-checkbox",onChange:e=>ie(e,a,t,p.UPDATE),type:"checkbox"})}else{return v(j,Object.assign({},n.data,{onChange:e=>ie(e,a,t,p.UPDATE)}))}case i.CHIP:return v("kup-chip",Object.assign({},n.data,{type:y.INPUT,enableInput:true,"onKup-chip-change":e=>ie(e,a,t,p.UPDATE)}),v("kup-text-field",Object.assign({fullWidth:true,slot:"field"},n.slotData,{error:n.data.error})));case i.COLOR_PICKER:return v("kup-color-picker",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"",disabled:false,"onkup-colorpicker-change":e=>ie(e,a,t,p.UPDATE)}));case i.COMBOBOX:return v("kup-combobox",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-combobox-change":e=>ie(e,a,t,p.UPDATE),"onkup-combobox-input":e=>ie(e,a,t,p.INPUT),"onkup-combobox-iconclick":e=>ie(e,a,t,p.ICON_CLICK)}));case i.DATE:return v("kup-date-picker",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-datepicker-change":e=>ie(e,a,t,p.UPDATE),"onkup-datepicker-input":e=>ie(e,a,t,p.INPUT)}));case i.MULTI_AUTOCOMPLETE:return v("kup-chip",Object.assign({displayId:true},n.data,{type:y.INPUT,enableInput:true,"onKup-chip-change":e=>ie(e,a,t,p.UPDATE)}),v("kup-autocomplete",Object.assign({class:"kup-full-width",slot:"field",displayMode:I.DESCRIPTION_AND_CODE,selectMode:I.DESCRIPTION_AND_CODE,"onkup-autocomplete-input":e=>ie(e,a,t,p.INPUT),"onkup-autocomplete-iconclick":e=>ie(e,a,t,p.ICON_CLICK),showDropDownIcon:false},n.slotData,{error:n.data.error})));case i.MULTI_COMBOBOX:return v("kup-chip",Object.assign({displayId:true},n.data,{type:y.INPUT,enableInput:true,"onKup-chip-change":e=>ie(e,a,t,p.UPDATE)}),v("kup-combobox",Object.assign({class:"kup-full-width",slot:"field",displayMode:I.DESCRIPTION_AND_CODE,selectMode:I.DESCRIPTION_AND_CODE,"onkup-combobox-input":e=>ie(e,a,t,p.INPUT),"onkup-combobox-iconclick":e=>ie(e,a,t,p.ICON_CLICK)},n.slotData,{error:n.data.error})));case i.RADIO:return v(T,Object.assign({},n.data,{disabled:false,onChange:(e,s)=>{const i=n.data.data;for(let t=0;t<i.length;t++){const s=i[t];if(t===e){s.checked=true}else{s.checked=false}}ie(s,a,t,p.UPDATE)}}));case i.RATING:return v("kup-rating",Object.assign({key:c.name+a.row.id},n.data,{disabled:false,"onkup-rating-click":e=>ie(e,a,t,p.UPDATE)}));case i.SWITCH:return v(N,Object.assign({},n.data,{disabled:false,onChange:e=>ie(e,a,t,p.UPDATE)}));case i.TIME:return v("kup-time-picker",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-timepicker-change":e=>ie(e,a,t,p.UPDATE),"onkup-timepicker-input":e=>ie(e,a,t,p.INPUT)}));case i.OBJECT:return v(g,null,v(w,Object.assign({icon:"table"},n.data,{disabled:false,onIconClick:e=>ie(e,a,t,p.ICON_CLICK)})),v(x,{icon:"menu",onClick:e=>ie(e,a,t,p.ICON_CLICK),styling:e.FLAT,wrapperClass:"obj-field-extra-btn"}));case i.NUMBER:s[u.C_RIGHT_ALIGNED]=true;case i.LINK:case i.STRING:const d=e=>ie(e,a,t,p.UPDATE);const f=e=>ie(e,a,t,p.INPUT);const b=t===i.NUMBER?"number":null;const k=t===i.NUMBER&&n.value?E.ketchup.math.numberifySafe(n.value).toString():n.value;if(n.shape===o.INPUT_FIELD){return v("input",{class:"input-field",onChange:d,onInput:f,type:b,value:k,maxLength:(r=(l=c.cellData)===null||l===void 0?void 0:l.maxLength)!==null&&r!==void 0?r:-1})}else{return v(w,Object.assign({inputType:b,fullWidth:le(a)?true:false},n.data,{icon:n.data&&n.data.icon?n.data.icon:n.icon?n.icon:c.icon?c.icon:null,decimals:a.column.decimals,integers:a.column.integers,value:k,onChange:d,onInput:f,onIconClick:e=>ie(e,a,t,p.ICON_CLICK)}))}}}function te(e,t,s,n,c,a,l){switch(e){case i.AUTOCOMPLETE:case i.COMBOBOX:case i.DATE:case i.DATETIME:case i.TIME:if(s&&s!=""){const e=f(a,c);return v("div",{class:"f-cell__text"},e)}return s;case i.CHECKBOX:if(ae(l)){n[u.C_CENTERED]=true}return v(O,{resource:t.checked?"check_box":"check_box_outline_blank",sizeX:"18px",sizeY:"18px"});case i.EDITOR:return v("div",{innerHTML:c.value});case i.ICON:if(ae(l)){n[u.C_CENTERED]=true}if(t.badgeData){n[u.C_PADDED]=true}return v(O,Object.assign({},t));case i.IMAGE:if(ae(l)){n[u.C_CENTERED]=true}if(t.badgeData){n[u.C_PADDED]=true}return v(O,Object.assign({},t));case i.LINK:return v("a",{href:s,target:"_blank"},c.value);case i.NUMBER:if(s&&s!=""){const e=E.ketchup.math.numberifySafe(c.value);const t=f(a,c);if(e<0){n[u.TEXT_DANGER]=true}if(ae(l)){n[u.C_RIGHT_ALIGNED]=true}return v("div",{class:"f-cell__text"},t)}return v("div",{class:"f-cell__text"},s);case i.SWITCH:if(ae(l)){n[u.C_CENTERED]=true}t["disabled"]=true;return v(N,Object.assign({},t));default:return v("div",{class:"f-cell__text"},s)}}function se(e,t,s,n,c,a,l){switch(e){case i.BAR:if(!s.data){return v("kup-image",Object.assign({key:a.name+l.row.id,sizeX:"250px"},s))}else{const e={height:s.sizeY,width:"100%"};return v("div",{style:e},v(O,Object.assign({},s)))}case i.BUTTON:if(ae(l)){t[u.C_CENTERED]=true}return v(x,Object.assign({},s,{onClick:t=>ie(t,l,e,p.CLICK)}));case i.BUTTON_LIST:if(ae(l)){t[u.C_CENTERED]=true}s["data-storage"]={cell:n,row:c,column:a};return v("kup-button-list",Object.assign({key:a.name+l.row.id},s));case i.CHART:if(ae(l)){t[u.C_CENTERED]=true}return v("kup-chart",Object.assign({key:a.name+l.row.id},s));case i.MULTI_AUTOCOMPLETE:case i.MULTI_COMBOBOX:case i.CHIP:return v($,Object.assign({},s));case i.COLOR_PICKER:return v("kup-color-picker",Object.assign({key:a.name+l.row.id},s,{class:le(l)?"kup-full-width":"",disabled:true}));case i.GAUGE:return v("kup-gauge",Object.assign({key:a.name+l.row.id,value:E.ketchup.math.numberifySafe(n.value),"width-component":"280px"},s));case i.KNOB:case i.PROGRESS_BAR:return s.customStyle?v("kup-progress-bar",Object.assign({key:a.name+l.row.id},s)):v(F,Object.assign({},s));case i.RADIO:if(ae(l)){t[u.C_CENTERED]=true}s["disabled"]=c.readOnly;return v(T,Object.assign({},s));case i.RATING:return v(M,Object.assign({},s,{disabled:true}));case i.OBJECT:return v(w,Object.assign({icon:"table"},s,{disabled:true}))}}function ne(e,t){function s(e){return e.toUpperCase().startsWith("SHAPE;BAR")}function n(e){return e.toUpperCase().startsWith("SHAPE;")}function c(e){return e.toUpperCase().startsWith("BCOLOR;")}function a(e){return e.toUpperCase().startsWith("HEIGHT;")}function l(e){return e.toUpperCase().startsWith("SEP;")||e.toUpperCase().startsWith("DIV;")||e.toUpperCase().startsWith("ARW;")||e.toUpperCase().startsWith("GRID;")}function o(e){if(!e){return null}const t=e.split("\\\\AND\\");const s=[];for(const e of t){const t=r(e);if(t){s.push(...t)}else{return null}}return s}function r(e){const t={};const i=e.split("\\\\");const o=[];for(const e of i){if(e){if(l(e)){return null}if(n(e)){if(!s(e)){return null}else{const s=e.split(";");if(s.length===3){const e=s[2].replace(",",".");if(!isNaN(parseFloat(e))){t.width=`${e}%`}}}}else if(c(e));else if(a(e)){const s=e.substring("HEIGHT;".length).replace(",",".");if(!isNaN(parseFloat(s))){t.height=`${s}%`}}else{o.push(r(e,t))}}return o.length?o:null}function r(e,t){const s=Object.assign({},t);const n=e.split(";");if(n.length>=1){const e=/R(\d+)G(\d+)B(\d+)/;const t=e.exec(n[0]);if(t){const[,e,n,i]=t;if(!isNaN(parseInt(e,10))&&!isNaN(parseInt(n,10))&&!isNaN(parseInt(i,10))){s.color=`rgb(${parseInt(e)},${parseInt(n)},${parseInt(i)})`}}if(n.length>=2){const e=n[1].replace(",",".");if(!isNaN(parseFloat(e))){s.width=`${e}%`}}}return s}}t.data={};const u=()=>{var e;const s=(e=t.value)===null||e===void 0?void 0:e.split(";");if((s===null||s===void 0?void 0:s[s.length-1].trim())===""){s.pop()}if(s&&s.length){t.data.data=[];for(let e of s){t.data.data.push({id:e,value:e})}}};switch(e){case i.CHECKBOX:case i.SWITCH:t.data.checked=t.value==="1"?true:false;break;case i.BAR:if(n(t.value)){t.data.isCanvas=true;t.data.resource=t.value}else{t.data.data=o(t.value)}break;case i.BUTTON:t.data.label=t.value;break;case i.CHART:Object.assign(t.data,{sizeX:"100px",sizeY:"100px",offlineMode:{value:t.value,shape:"pie"}});break;case i.BUTTON_LIST:case i.CHIP:case i.MULTI_AUTOCOMPLETE:case i.MULTI_COMBOBOX:case i.RADIO:u();break;case i.COLOR_PICKER:t.data.initialValue=t.value;break;case i.GAUGE:case i.KNOB:case i.PROGRESS_BAR:case i.RATING:t.data.value=parseInt(t.value);break;case i.ICON:case i.IMAGE:t.data.resource=t.value;break}}function ie(e,t,s,n){const c=t.cell;const a=t.column;const l=t.component;const o=t.row;if(n===p.UPDATE){let t=ce(e,s);if(b(c)){t=t===null||t===void 0?void 0:t.toUpperCase()}else if(k(c)){t=t===null||t===void 0?void 0:t.toLowerCase()}switch(s){case i.AUTOCOMPLETE:case i.COMBOBOX:case i.DATE:case i.TIME:if(c.data){c.data["initialValue"]=t}break;case i.CHECKBOX:case i.SWITCH:t=t==="on"?"0":"1";if(c.data){c.data.checked=t==="0"?false:true}break;case i.RADIO:if(c.data.data){const e=c.data.data;const s=e.find((e=>e.checked));if(s){t=s.value}}break;case i.CHIP:case i.MULTI_AUTOCOMPLETE:case i.MULTI_COMBOBOX:t=e.detail.stringifiedValues;if(c.data){c.data.data=e.detail.comp.data}break}if(c.obj){c.obj.k=t===null||t===void 0?void 0:t.toString()}c.value=t===null||t===void 0?void 0:t.toString();c.displayedValue=null;c.displayedValue=f(a,c)}if(l&&l.rootElement){const t=new CustomEvent(n,{bubbles:true,cancelable:true,composed:true,detail:{comp:l,id:l.rootElement.id,cell:c,column:a,event:e,row:o,type:s}});l.rootElement.dispatchEvent(t);if(n===p.UPDATE){try{l.refresh()}catch(e){E.ketchup.debug.logMessage(l,e,h.ERROR)}}}}function ce(e,t){const s=!!(e.target.tagName==="INPUT");let n=s?e.target.value:e.detail.value;if(t===i.CHECKBOX&&s){n=e.target.checked?"off":"on"}if(t===i.NUMBER&&s){n=E.ketchup.math.formattedStringToNumberString(n,"")}return n}function ae(e){var t;return d.includes((t=e.component)===null||t===void 0?void 0:t.rootElement.tagName)}function le(e){var t;return r.includes((t=e.component)===null||t===void 0?void 0:t.rootElement.tagName)}export{V as F,I,C as K,_ as a,F as b,T as c,M as d,z as e,N as f};
2
- //# sourceMappingURL=p-8cbd8be4.js.map
1
+ import{a as e}from"./p-e3062c19.js";import{a8 as t,a9 as s,d as n,a5 as i,aa as c,ab as a,ac as l,F as o,ad as r,ae as u,af as d,ag as f,ah as p,ai as b,aj as k,e as h}from"./p-1911a49e.js";import{h as v,g as m,F as g}from"./p-d7c15b0e.js";import{F as j}from"./p-5d03c077.js";import{F as w}from"./p-59c76030.js";import{F as O}from"./p-2b519589.js";import{F as y,c as $}from"./p-9db21afb.js";import{F as x}from"./p-10dfd311.js";var _;(function(e){e["customStyle"]="Custom style of the component.";e["data"]="The data of the list.";e["displayMode"]="Selects how the items must display their label and how they can be filtered for.";e["filter"]="Keeps string for filtering elements when filter mode is active";e["hideText"]="Hides rows' text, ideally to display a list of icons only.";e["isMenu"]="Defines whether the list is a menu or not.";e["keyboardNavigation"]="When true, enables items' navigation through arrow keys.";e["menuVisible"]="Sets the status of the menu, when false it's hidden otherwise it's visible.";e["roleType"]="Defines the type of selection. Values accepted: listbox, radiogroup or group.";e["selectable"]="Defines whether items are selectable or not.";e["showIcons"]="Displays the icons associated to each row when set to true.";e["twoLine"]="The list elements descriptions will be arranged in two lines."})(_||(_={}));var C;(function(e){e["LISTBOX"]="listbox";e["RADIOGROUP"]="radiogroup";e["GROUP"]="group"})(C||(C={}));var I;(function(e){e["CODE"]="code";e["DESCRIPTION"]="description";e["DESCRIPTION_AND_CODE"]="both"})(I||(I={}));var z;(function(e){e["SMALL"]="small";e["MEDIUM"]="medium"})(z||(z={}));const N=e=>{if(!e.sizing){e.sizing=z.MEDIUM}e.sizing.toLowerCase()===z.SMALL;const t={switch:true,"switch--checked":e.checked,"switch--disabled":e.disabled,[`switch--${e.sizing}`]:e.sizing?true:false};return v("div",Object.assign({class:`f-switch ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`},e.dataSet,{id:e.id,title:e.title}),v("div",{class:`form-field ${e.leadingLabel?"form-field--align-end":""}`},v("div",{class:t},v("div",{class:"switch__track"}),v("div",{class:"switch__thumb-underlay"},v("div",{class:"switch__thumb"},v("input",{type:"checkbox",class:"switch__native-control",role:"switch",checked:e.checked,disabled:e.disabled,value:e.checked?"on":"off",onBlur:e.onBlur,onChange:e.onChange,onFocus:e.onFocus})))),v("label",{onClick:e.onChange},e.label)))};const F=e=>{if(!e.centeredLabel&&!e.centeredLabel!==false){e.centeredLabel=true}let t=`f-progress-bar ${e.danger?"kup-danger":""} ${e.animated?"kup-animated":""} ${e.padded?"kup-padded":""} ${e.info?"kup-info":""} ${e.slim?"kup-slim":""} ${e.striped?"kup-striped":""} ${e.secondary?"kup-secondary":""} ${e.slim?"kup-slim":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`;let s="pie";let n=undefined;if(e.isRadial){t+=" pie-wrapper is-radial"}else{t+=" progress-bar"}let i=undefined;const c={width:`${e.value}%`};if(!e.centeredLabel){i=c;if(e.value>2){t+=" text-color-on-primary"}}else if(e.value>49){t+=" text-color-on-primary"}let a=null;if(e.icon){a=T(e)}else{if(!e.hideLabel){if(e.isRadial){if(e.label){a=v("span",{class:"label"},e.label)}else{a=v("span",{class:"label"},e.value,v("span",{class:"smaller"},"%"))}}else{if(e.label){a=e.label}else{a=e.value+"%"}}}}if(e.value>0){s+=" has-value";if(e.value>50){s+=" is-more-than-half"}else{s+=" is-less-than-half"}}if(e.isRadial){return v("div",{class:t},a,v("div",{class:s},v("div",{style:n,class:"left-side half-circle"}),v("div",{class:"right-side half-circle"})),v("div",{class:"shadow"}))}else{return v("div",{class:t},v("div",{class:"progress-bar-percentage",style:c},v("span",{style:i},a)))}};function T(e){if(!e.icon){return undefined}if(e.icon.indexOf(".")>-1||e.icon.indexOf("/")>-1||e.icon.indexOf("\\")>-1){return v("span",{class:"label kup-icon is-image"},v("img",{src:e.icon}))}else{let t=`url('${m(`./assets/svg/${e.icon}.svg`)}') no-repeat center`;let s={mask:t,webkitMask:t};return v("span",{style:s,class:"label kup-icon"})}}var H;(function(e){e["RADIO"]="radio";e["CHEVRON"]="chevron"})(H||(H={}));const D=e=>{var t;const s=!!e.columns;const n=[];const i=e.type||H.RADIO;for(let s=0;s<((t=e.data)===null||t===void 0?void 0:t.length);s++){const t=e.data[s];const c={radio:true,"radio--checked":t.checked?true:false,"radio--disabled":e.disabled?true:false,[`radio--${e.type}`]:e.type?true:false};n.push(v("div",{class:`form-field \n ${e.leadingLabel?" form-field--align-end":""} ${e.disabled?"radio--disabled":""}`},v("div",{class:c},i===H.RADIO?v("input",{class:"radio__native-control",type:"radio",name:"radio-element",value:t.value,checked:t.checked,disabled:e.disabled,onBlur:e.onBlur,onChange:e.onChange?e.onChange.bind(e.onChange,s):null,onFocus:e.onFocus}):v(g,null,t.checked?v(O,{resource:"check",sizeX:"14px",sizeY:"14px"}):v(O,{sizeX:"14px",sizeY:"14px",onClick:e.onChange?e.onChange.bind(e.onChange,s):null})),i===H.RADIO&&v("div",{class:"radio__background"},v("div",{class:"radio__outer-circle"}),v("div",{class:"radio__inner-circle"}))),v("label",{htmlFor:"radio-element",onClick:e.onChange?e.onChange.bind(e.onChange,s):null},t.label?t.label:"")))}const c={"--kup_radio_columns":s?`repeat(${e.columns}, 1fr)`:""};return v("div",{class:`f-radio radio-wrapper\n ${s?"radio-wrapper-grid":""} ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""} ${e.horizontal?"kup-horizontal":""}`,style:c},n)};const E=e=>{if(!e.maxValue){e.maxValue=5}return v("div",{class:`f-rating ${e.disabled?"disabled":""} ${e.danger?"kup-danger":""} ${e.info?"kup-info":""} ${e.secondary?"kup-secondary":""} ${e.success?"kup-success":""} ${e.warning?"kup-warning":""} ${e.wrapperClass?e.wrapperClass:""}`},M(e))};function M(e){const t=[];for(let s=1;s<=e.maxValue;s++){if(s<=e.value){t.push(v("span",{class:"rating",onClick:e.onClick?e.onClick.bind(e.onClick,s):null},"★"))}else{t.push(v("span",{class:"rating",onClick:e.onClick?e.onClick.bind(e.onClick,s):null},"☆"))}}return t}const S=document.documentElement;const X=(e,c)=>{var a;const l=e.cell;const o=e.column;const r=e.row;const d=e.shape?e.shape:l.shape?l.shape:o.shape?o.shape:null;const f=!S.ketchup.objects.isEmptyKupObj(l.obj);let h=false;if(l.hasOwnProperty("isEditable")){h=l.isEditable}else if(o.hasOwnProperty("isEditable")){h=o.isEditable}h=h&&e.editable;if(l.options){l.data=(a=R(l,o))!==null&&a!==void 0?a:l.data}const m=e.previousValue!==l.value?l.value:"";const g=S.ketchup.data.cell.getType(l,d);const j=Object.assign({},l.data);let w=l.cssClass?l.cssClass:(o===null||o===void 0?void 0:o.cssClass)?o===null||o===void 0?void 0:o.cssClass:"";if(e.component.legacyLook){w+=" monospace c-pre"}const y={"f-cell":true,[u.OBJ]:f?true:false,[g+"-cell"]:true,[e.wrapperClass]:e.wrapperClass?true:false,[e.density]:e.density&&g!==i.BAR?true:false,[w]:w?true:false,"c-input-uppercase":b(l),"c-input-lowercase":k(l)};let $=m;if(!l.data){ne(g,l)}if(h&&t.includes(g)){$=ee(g,y,l,o,e)}else if(l.data&&s.includes(g)){if(e.setSizes){Z(g,j,l)}if(!e.renderKup){const e="cell-"+g+" placeholder";$=v("span",{class:e})}else{$=se(g,y,j,l,r,o,e)}}else{if(e.setSizes){Q(g,j,l,e)}$=te(g,j,$,y,l,o,e)}let x=null;if(!h&&(o.icon||l.icon)&&$){const e={color:`rgba(var(${n.TEXT}-rgb), 0.375)`,resource:l.icon?l.icon:o.icon,placeholderResource:l.placeholderIcon?l.placeholderIcon:o.placeholderIcon,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:"obj-icon"};x=v(O,Object.assign({},e))}let _=null;if(S.ketchup.debug.isDebug()&&f){_=l.obj.t+"; "+l.obj.p+"; "+l.obj.k+";"}else if(l.title!=null&&l.title.trim()!=""){_=l.title}let C=null;if(l.info){const e=Object.assign({},l.info);if(!e.color){e.color=`var(${n.INFO})`}if(!e.icon){e.icon="info"}const t={color:e.color,resource:e.icon,placeholderResource:e.placeholderIcon,sizeX:"1.25em",sizeY:"1.25em",title:e.message?e.message:"",wrapperClass:"cell-info"};C=v(O,Object.assign({},t))}return v("div",{onKeyUp:t=>ie(t,e,g,p.KEYUP),class:y,"kup-get-cell-props":()=>e,ref:e=>l.element=e,style:l.style},v("div",{class:"f-cell__content",style:l.styleContent,title:_},e.cellActionIcon&&v(O,{resource:"more_vert",sizeX:"16px",sizeY:"16px",wrapperClass:`f-cell__iconfunction ${g===i.NUMBER?"left":"right"}`,onClick:e.cellActionIcon.onClick,tabIndex:0}),c&&c.length>0?c:[e.indents,C,x,$]))};const R=(e,t)=>{if(!e){return null}const s=e.options;const n=t.title;const c=e.value;const a=S.ketchup.data.cell.getType(e,e.shape);const l=new Map([[i.BUTTON_LIST,K.bind(undefined)],[i.STRING,W.bind(undefined)],[i.RADIO,B.bind(undefined)],[i.AUTOCOMPLETE,G.bind(undefined)],[i.COMBOBOX,G.bind(undefined)],[i.CHECKBOX,Y.bind(undefined)],[i.OBJECT,A.bind(undefined)],[i.CHIP,V.bind(undefined)]]);const o=l.get(a);return o?o(s,n,c,e):null};const V=(e,t,s,n)=>{const i={data:(e===null||e===void 0?void 0:e.length)?e===null||e===void 0?void 0:e.map((e=>({id:e.id,value:e.id}))):[]};n.data=Object.assign(Object.assign({},n.data),i)};const A=(e,t,s,n,i)=>({data:{initialValue:s||"",label:t||"",value:s||""}});const Y=(e,t,s,n)=>Object.assign(Object.assign({},n.data),{checked:s==="on"||s==="1",label:t});const K=(e,t,s,n)=>({data:[Object.assign(Object.assign({},n.data),{icon:n.icon,value:s})]});const W=(e,t,s,n)=>Object.assign(Object.assign({},n.data),{label:t});const B=(e,t,s,n)=>{const i=c(s,e);n.data=Object.assign(Object.assign({},n.data),i)};const G=(e,t,s,n,i)=>{var c;if(!((c=n.data)===null||c===void 0?void 0:c.data)&&e){const n=a(s,t,[]);n.data["kup-list"].data=P(e,s);return n}};const P=(e,t)=>{const s=J.get(e.type);if(s){return s(e,t)}else{return e.map((e=>({value:e.label,id:e.id,selected:t===e.id})))}};const L=(e,t)=>e.children.map((e=>{var s;return{id:e.content.codice,value:e.content.testo,selected:t===e.content.codice,children:((s=e.children)===null||s===void 0?void 0:s.length)?L(e,t):[]}}));const U=(e,t)=>e.children.map((e=>{var s;return{id:e.obj.k,value:e.value,selected:t===e.obj.k,children:((s=e.children)===null||s===void 0?void 0:s.length)?U(e,t):[]}}));const q=(e,t)=>e.rows.map((e=>{var s;const n=e.fields||e.cells;const[i,c]=Object.keys(n);return{id:n[i].value,value:((s=n[c])===null||s===void 0?void 0:s.value)||n[i].value,selected:t===n[i].value}}));const J=new Map([["SmeupTreeNode",L.bind(undefined)],["SmeupDataTree",U.bind(undefined)],["SmeupTable",q.bind(undefined)],["SmeupDataTable",q.bind(undefined)]]);function Q(e,t,s,n){var c;switch(e){case i.CHECKBOX:case i.ICON:if(!t.sizeX){t.sizeX="18px"}if(!t.sizeY){t.sizeY="18px"}if(s.style){if(!s.style.height){s.style["minHeight"]=t.sizeY}}else{s.style={minHeight:t.sizeY}}break;case i.IMAGE:const e=((c=n.cell)===null||c===void 0?void 0:c.value)||"";const a=e.indexOf(".")>-1||e.indexOf("/")>-1||e.indexOf("\\")>-1;if(n.component.rootElement.tagName===l.DATA_TABLE&&!a){if(!t.sizeX&&!t.sizeY){t.sizeX="100%";t.sizeY="64px";t.wrapperClass="noWidth"}else{if(!t.sizeX){t.sizeX="100%";t.wrapperClass="noWidth"}if(!t.sizeY){t.sizeY="auto"}}}if(n.component.rootElement.tagName===l.BOX){if(!t.sizeY){t.sizeY="auto"}if(t.fit===undefined){t.fit=true}}else if(!t.sizeX){t.sizeX="auto"}if(!t.sizeY){t.sizeY="64px"}break}}function Z(e,t,s){switch(e){case i.BAR:if(!t.sizeY){t.sizeY="26px"}break;case i.BUTTON:let e="";if(t.label){e="36px"}if(s.style){if(!s.style.height){s.style["minHeight"]=e}}else{s.style={minHeight:e}}break;case i.CHART:if(!t.sizeX){t.sizeX="100%"}if(!t.sizeY){t.sizeY="100%"}break;case i.CHIP:if(s.style){if(!s.style.height){s.style["minHeight"]="40px"}}else{s.style={minHeight:"40px"}}break;case i.RADIO:if(s.style){if(!s.style.height){s.style["minHeight"]="40px"}}else{s.style={minHeight:"40px"}}break}}function ee(t,s,n,c,a){var l,r;switch(t){case i.AUTOCOMPLETE:return v("kup-autocomplete",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-autocomplete-change":e=>ie(e,a,t,p.UPDATE),"onkup-autocomplete-input":e=>ie(e,a,t,p.INPUT),"onkup-autocomplete-iconclick":e=>ie(e,a,t,p.ICON_CLICK)}));case i.CHECKBOX:if(ae(a)){s[u.C_CENTERED]=true}if(n.shape===o.INPUT_CHECKBOX){return v("input",{checked:n.value==="on"||n.value==="1"?true:false,class:"input-checkbox",onChange:e=>ie(e,a,t,p.UPDATE),type:"checkbox"})}else{return v(j,Object.assign({},n.data,{onChange:e=>ie(e,a,t,p.UPDATE)}))}case i.CHIP:return v("kup-chip",Object.assign({},n.data,{type:y.INPUT,enableInput:true,"onKup-chip-change":e=>ie(e,a,t,p.UPDATE)}),v("kup-text-field",Object.assign({fullWidth:true,slot:"field"},n.slotData,{error:n.data.error})));case i.COLOR_PICKER:return v("kup-color-picker",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"",disabled:false,"onkup-colorpicker-change":e=>ie(e,a,t,p.UPDATE)}));case i.COMBOBOX:return v("kup-combobox",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-combobox-change":e=>ie(e,a,t,p.UPDATE),"onkup-combobox-input":e=>ie(e,a,t,p.INPUT),"onkup-combobox-iconclick":e=>ie(e,a,t,p.ICON_CLICK)}));case i.DATE:return v("kup-date-picker",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-datepicker-change":e=>ie(e,a,t,p.UPDATE),"onkup-datepicker-input":e=>ie(e,a,t,p.INPUT)}));case i.MULTI_AUTOCOMPLETE:return v("kup-chip",Object.assign({displayId:true},n.data,{type:y.INPUT,enableInput:true,"onKup-chip-change":e=>ie(e,a,t,p.UPDATE)}),v("kup-autocomplete",Object.assign({class:"kup-full-width",slot:"field",displayMode:I.DESCRIPTION_AND_CODE,selectMode:I.DESCRIPTION_AND_CODE,"onkup-autocomplete-input":e=>ie(e,a,t,p.INPUT),"onkup-autocomplete-iconclick":e=>ie(e,a,t,p.ICON_CLICK),showDropDownIcon:false},n.slotData,{error:n.data.error})));case i.MULTI_COMBOBOX:return v("kup-chip",Object.assign({displayId:true},n.data,{type:y.INPUT,enableInput:true,"onKup-chip-change":e=>ie(e,a,t,p.UPDATE)}),v("kup-combobox",Object.assign({class:"kup-full-width",slot:"field",displayMode:I.DESCRIPTION_AND_CODE,selectMode:I.DESCRIPTION_AND_CODE,"onkup-combobox-input":e=>ie(e,a,t,p.INPUT),"onkup-combobox-iconclick":e=>ie(e,a,t,p.ICON_CLICK)},n.slotData,{error:n.data.error})));case i.RADIO:return v(D,Object.assign({},n.data,{disabled:false,onChange:(e,s)=>{const i=n.data.data;for(let t=0;t<i.length;t++){const s=i[t];if(t===e){s.checked=true}else{s.checked=false}}ie(s,a,t,p.UPDATE)}}));case i.RATING:return v("kup-rating",Object.assign({key:c.name+a.row.id},n.data,{disabled:false,"onkup-rating-click":e=>ie(e,a,t,p.UPDATE)}));case i.SWITCH:return v(N,Object.assign({},n.data,{disabled:false,onChange:e=>ie(e,a,t,p.UPDATE)}));case i.TIME:return v("kup-time-picker",Object.assign({key:c.name+a.row.id,initialValue:n.value},n.data,{class:le(a)?"kup-full-width":"","onkup-timepicker-change":e=>ie(e,a,t,p.UPDATE),"onkup-timepicker-input":e=>ie(e,a,t,p.INPUT)}));case i.OBJECT:return v(g,null,v(w,Object.assign({icon:"table"},n.data,{disabled:false,onIconClick:e=>ie(e,a,t,p.ICON_CLICK)})),v(x,{icon:"menu",onClick:e=>ie(e,a,t,p.ICON_CLICK),styling:e.FLAT,wrapperClass:"obj-field-extra-btn"}));case i.NUMBER:s[u.C_RIGHT_ALIGNED]=true;case i.LINK:case i.STRING:const d=e=>ie(e,a,t,p.UPDATE);const f=e=>ie(e,a,t,p.INPUT);const b=t===i.NUMBER?"number":null;const k=t===i.NUMBER&&n.value?S.ketchup.math.numberifySafe(n.value).toString():n.value;if(n.shape===o.INPUT_FIELD){return v("input",{class:"input-field",onChange:d,onInput:f,type:b,value:k,maxLength:(r=(l=c.cellData)===null||l===void 0?void 0:l.maxLength)!==null&&r!==void 0?r:-1})}else{return v(w,Object.assign({inputType:b,fullWidth:le(a)?true:false},n.data,{icon:n.data&&n.data.icon?n.data.icon:n.icon?n.icon:c.icon?c.icon:null,decimals:a.column.decimals,integers:a.column.integers,value:k,onChange:d,onInput:f,onIconClick:e=>ie(e,a,t,p.ICON_CLICK)}))}}}function te(e,t,s,n,c,a,l){switch(e){case i.AUTOCOMPLETE:case i.COMBOBOX:case i.DATE:case i.DATETIME:case i.TIME:if(s&&s!=""){const e=f(a,c);return v("div",{class:"f-cell__text"},e)}return s;case i.CHECKBOX:if(ae(l)){n[u.C_CENTERED]=true}return v(O,{resource:t.checked?"check_box":"check_box_outline_blank",sizeX:"18px",sizeY:"18px"});case i.EDITOR:return v("div",{innerHTML:c.value});case i.ICON:if(ae(l)){n[u.C_CENTERED]=true}if(t.badgeData){n[u.C_PADDED]=true}return v(O,Object.assign({},t));case i.IMAGE:if(ae(l)){n[u.C_CENTERED]=true}if(t.badgeData){n[u.C_PADDED]=true}return v(O,Object.assign({},t));case i.LINK:return v("a",{href:s,target:"_blank"},c.value);case i.NUMBER:if(s&&s!=""){const e=S.ketchup.math.numberifySafe(c.value);const t=f(a,c);if(e<0){n[u.TEXT_DANGER]=true}if(ae(l)){n[u.C_RIGHT_ALIGNED]=true}return v("div",{class:"f-cell__text"},t)}return v("div",{class:"f-cell__text"},s);case i.SWITCH:if(ae(l)){n[u.C_CENTERED]=true}t["disabled"]=true;return v(N,Object.assign({},t));default:return v("div",{class:"f-cell__text"},s)}}function se(e,t,s,n,c,a,l){switch(e){case i.BAR:if(!s.data){return v("kup-image",Object.assign({key:a.name+l.row.id,sizeX:"250px"},s))}else{const e={height:s.sizeY,width:"100%"};return v("div",{style:e},v(O,Object.assign({},s)))}case i.BUTTON:if(ae(l)){t[u.C_CENTERED]=true}return v(x,Object.assign({},s,{onClick:t=>ie(t,l,e,p.CLICK)}));case i.BUTTON_LIST:if(ae(l)){t[u.C_CENTERED]=true}s["data-storage"]={cell:n,row:c,column:a};return v("kup-button-list",Object.assign({key:a.name+l.row.id},s));case i.CHART:if(ae(l)){t[u.C_CENTERED]=true}return v("kup-chart",Object.assign({key:a.name+l.row.id},s));case i.MULTI_AUTOCOMPLETE:case i.MULTI_COMBOBOX:case i.CHIP:return v($,Object.assign({},s));case i.COLOR_PICKER:return v("kup-color-picker",Object.assign({key:a.name+l.row.id},s,{class:le(l)?"kup-full-width":"",disabled:true}));case i.GAUGE:return v("kup-gauge",Object.assign({key:a.name+l.row.id,value:S.ketchup.math.numberifySafe(n.value),"width-component":"280px"},s));case i.KNOB:case i.PROGRESS_BAR:return s.customStyle?v("kup-progress-bar",Object.assign({key:a.name+l.row.id},s)):v(F,Object.assign({},s));case i.RADIO:if(ae(l)){t[u.C_CENTERED]=true}s["disabled"]=c.readOnly;return v(D,Object.assign({},s));case i.RATING:return v(E,Object.assign({},s,{disabled:true}));case i.OBJECT:return v(w,Object.assign({icon:"table"},s,{disabled:true}))}}function ne(e,t){function s(e){return e.toUpperCase().startsWith("SHAPE;BAR")}function n(e){return e.toUpperCase().startsWith("SHAPE;")}function c(e){return e.toUpperCase().startsWith("BCOLOR;")}function a(e){return e.toUpperCase().startsWith("HEIGHT;")}function l(e){return e.toUpperCase().startsWith("SEP;")||e.toUpperCase().startsWith("DIV;")||e.toUpperCase().startsWith("ARW;")||e.toUpperCase().startsWith("GRID;")}function o(e){if(!e){return null}const t=e.split("\\\\AND\\");const s=[];for(const e of t){const t=r(e);if(t){s.push(...t)}else{return null}}return s}function r(e){const t={};const i=e.split("\\\\");const o=[];for(const e of i){if(e){if(l(e)){return null}if(n(e)){if(!s(e)){return null}else{const s=e.split(";");if(s.length===3){const e=s[2].replace(",",".");if(!isNaN(parseFloat(e))){t.width=`${e}%`}}}}else if(c(e));else if(a(e)){const s=e.substring("HEIGHT;".length).replace(",",".");if(!isNaN(parseFloat(s))){t.height=`${s}%`}}else{o.push(r(e,t))}}return o.length?o:null}function r(e,t){const s=Object.assign({},t);const n=e.split(";");if(n.length>=1){const e=/R(\d+)G(\d+)B(\d+)/;const t=e.exec(n[0]);if(t){const[,e,n,i]=t;if(!isNaN(parseInt(e,10))&&!isNaN(parseInt(n,10))&&!isNaN(parseInt(i,10))){s.color=`rgb(${parseInt(e)},${parseInt(n)},${parseInt(i)})`}}if(n.length>=2){const e=n[1].replace(",",".");if(!isNaN(parseFloat(e))){s.width=`${e}%`}}}return s}}t.data={};const u=()=>{var e;const s=(e=t.value)===null||e===void 0?void 0:e.split(";");if((s===null||s===void 0?void 0:s[s.length-1].trim())===""){s.pop()}if(s&&s.length){t.data.data=[];for(let e of s){t.data.data.push({id:e,value:e})}}};switch(e){case i.CHECKBOX:case i.SWITCH:t.data.checked=t.value==="1"?true:false;break;case i.BAR:if(n(t.value)){t.data.isCanvas=true;t.data.resource=t.value}else{t.data.data=o(t.value)}break;case i.BUTTON:t.data.label=t.value;break;case i.CHART:Object.assign(t.data,{sizeX:"100px",sizeY:"100px",offlineMode:{value:t.value,shape:"pie"}});break;case i.BUTTON_LIST:case i.CHIP:case i.MULTI_AUTOCOMPLETE:case i.MULTI_COMBOBOX:case i.RADIO:u();break;case i.COLOR_PICKER:t.data.initialValue=t.value;break;case i.GAUGE:case i.KNOB:case i.PROGRESS_BAR:case i.RATING:t.data.value=parseInt(t.value);break;case i.ICON:case i.IMAGE:t.data.resource=t.value;break}}function ie(e,t,s,n){const c=t.cell;const a=t.column;const l=t.component;const o=t.row;if(n===p.UPDATE){let t=ce(e,s);if(b(c)){t=t===null||t===void 0?void 0:t.toUpperCase()}else if(k(c)){t=t===null||t===void 0?void 0:t.toLowerCase()}switch(s){case i.AUTOCOMPLETE:case i.COMBOBOX:case i.DATE:case i.TIME:if(c.data){c.data["initialValue"]=t}break;case i.CHECKBOX:case i.SWITCH:t=t==="on"?"0":"1";if(c.data){c.data.checked=t==="0"?false:true}break;case i.RADIO:if(c.data.data){const e=c.data.data;const s=e.find((e=>e.checked));if(s){t=s.value}}break;case i.CHIP:case i.MULTI_AUTOCOMPLETE:case i.MULTI_COMBOBOX:t=e.detail.stringifiedValues;if(c.data){c.data.data=e.detail.comp.data}break}if(c.obj){c.obj.k=t===null||t===void 0?void 0:t.toString()}c.value=t===null||t===void 0?void 0:t.toString();c.displayedValue=null;c.displayedValue=f(a,c)}if(l&&l.rootElement){const t=new CustomEvent(n,{bubbles:true,cancelable:true,composed:true,detail:{comp:l,id:l.rootElement.id,cell:c,column:a,event:e,row:o,type:s}});l.rootElement.dispatchEvent(t);if(n===p.UPDATE){try{l.refresh()}catch(e){S.ketchup.debug.logMessage(l,e,h.ERROR)}}}}function ce(e,t){const s=!!(e.target.tagName==="INPUT"||"TEXTAREA");let n=s?e.target.value:e.detail.value;if(t===i.CHECKBOX&&s){n=e.target.checked?"off":"on"}if(t===i.NUMBER&&s){n=S.ketchup.math.formattedStringToNumberString(n,"")}return n}function ae(e){var t;return d.includes((t=e.component)===null||t===void 0?void 0:t.rootElement.tagName)}function le(e){var t;return r.includes((t=e.component)===null||t===void 0?void 0:t.rootElement.tagName)}export{X as F,I,C as K,_ as a,F as b,D as c,E as d,z as e,N as f};
2
+ //# sourceMappingURL=p-f53792c4.js.map