@sme.up/ketchup 9.3.0 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{f-button-4caf541a.js → f-button-033ed6d4.js} +1 -1
- package/dist/cjs/{f-cell-979c26ea.js → f-cell-ef276797.js} +5 -5
- package/dist/cjs/{f-chip-8957940b.js → f-chip-d4e26a2b.js} +2 -2
- package/dist/cjs/{f-image-e16fe10d.js → f-image-33be7baf.js} +1 -1
- package/dist/cjs/{f-paginator-utils-f2dd0322.js → f-paginator-utils-5a18cc19.js} +2 -2
- package/dist/cjs/{f-text-field-2fac8078.js → f-text-field-f03e97f8.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/ketchup.cjs.js +1 -1
- package/dist/cjs/kup-accordion.cjs.entry.js +2 -2
- package/dist/cjs/kup-autocomplete_27.cjs.entry.js +18 -9
- package/dist/cjs/kup-box.cjs.entry.js +9 -9
- package/dist/cjs/kup-calendar.cjs.entry.js +4 -4
- package/dist/cjs/kup-card-list.cjs.entry.js +1 -1
- package/dist/cjs/kup-cell.cjs.entry.js +6 -6
- package/dist/cjs/kup-dashboard.cjs.entry.js +4 -4
- package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
- package/dist/cjs/kup-echart.cjs.entry.js +1 -1
- package/dist/cjs/kup-family-tree.cjs.entry.js +3 -3
- package/dist/cjs/kup-grid.cjs.entry.js +1 -1
- package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
- package/dist/cjs/kup-image-list.cjs.entry.js +6 -6
- package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
- package/dist/cjs/kup-magic-box.cjs.entry.js +2 -2
- package/dist/cjs/{kup-manager-c63f4fb9.js → kup-manager-f90f1b6d.js} +125 -0
- package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
- package/dist/cjs/kup-openai-interface.cjs.entry.js +146 -0
- package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
- package/dist/cjs/kup-planner.cjs.entry.js +2 -2
- package/dist/cjs/kup-probe.cjs.entry.js +1 -1
- package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
- package/dist/cjs/kup-snackbar.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/kup-box/kup-box.js +3 -3
- package/dist/collection/components/kup-data-table/kup-data-table.js +11 -2
- package/dist/collection/components/kup-image/assets/svg/open-ai.svg +1 -0
- package/dist/collection/components/kup-openai-interface/kup-openai-interface-declarations.js +11 -0
- package/dist/collection/components/kup-openai-interface/kup-openai-interface.css +64 -0
- package/dist/collection/components/kup-openai-interface/kup-openai-interface.js +340 -0
- package/dist/collection/managers/kup-manager/kup-manager.js +124 -0
- package/dist/components/kup-autocomplete2.js +11 -2
- package/dist/components/kup-box2.js +3 -3
- package/dist/components/kup-dashboard.js +1 -1
- package/dist/components/kup-magic-box.js +1 -1
- package/dist/components/kup-manager.js +125 -1
- package/dist/components/kup-openai-interface.d.ts +11 -0
- package/dist/components/kup-openai-interface.js +301 -0
- package/dist/esm/{f-button-5ccc2e50.js → f-button-ccde4447.js} +1 -1
- package/dist/esm/{f-cell-6f4290b2.js → f-cell-2ad41d52.js} +5 -5
- package/dist/esm/{f-chip-465aa432.js → f-chip-3df1c255.js} +2 -2
- package/dist/esm/{f-image-c5063342.js → f-image-5434b351.js} +1 -1
- package/dist/esm/{f-paginator-utils-6903534b.js → f-paginator-utils-b90cdd2b.js} +2 -2
- package/dist/esm/{f-text-field-28b2b26d.js → f-text-field-f0b81f8b.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/ketchup.js +1 -1
- package/dist/esm/kup-accordion.entry.js +2 -2
- package/dist/esm/kup-autocomplete_27.entry.js +18 -9
- package/dist/esm/kup-box.entry.js +9 -9
- package/dist/esm/kup-calendar.entry.js +4 -4
- package/dist/esm/kup-card-list.entry.js +1 -1
- package/dist/esm/kup-cell.entry.js +6 -6
- package/dist/esm/kup-dashboard.entry.js +4 -4
- package/dist/esm/kup-drawer.entry.js +1 -1
- package/dist/esm/kup-echart.entry.js +1 -1
- package/dist/esm/kup-family-tree.entry.js +3 -3
- package/dist/esm/kup-grid.entry.js +1 -1
- package/dist/esm/kup-iframe.entry.js +1 -1
- package/dist/esm/kup-image-list.entry.js +6 -6
- package/dist/esm/kup-lazy.entry.js +1 -1
- package/dist/esm/kup-magic-box.entry.js +2 -2
- package/dist/esm/{kup-manager-bfea4e6f.js → kup-manager-e33d8d8c.js} +125 -1
- package/dist/esm/kup-nav-bar.entry.js +1 -1
- package/dist/esm/kup-numeric-picker.entry.js +2 -2
- package/dist/esm/kup-openai-interface.entry.js +142 -0
- package/dist/esm/kup-photo-frame.entry.js +1 -1
- package/dist/esm/kup-planner.entry.js +2 -2
- package/dist/esm/kup-probe.entry.js +1 -1
- package/dist/esm/kup-qlik.entry.js +1 -1
- package/dist/esm/kup-snackbar.entry.js +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/ketchup/assets/svg/open-ai.svg +1 -0
- package/dist/ketchup/index.esm.js +1 -1
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-f2df4ce9.entry.js → p-01aaf3e4.entry.js} +1 -1
- package/dist/ketchup/{p-ce9ef2d5.js → p-11e7be94.js} +1 -1
- package/dist/ketchup/{p-903d1b10.entry.js → p-190d0bc5.entry.js} +1 -1
- package/dist/ketchup/{p-95272714.entry.js → p-1a594e06.entry.js} +1 -1
- package/dist/ketchup/{p-7c5a1357.entry.js → p-1dbfcab5.entry.js} +1 -1
- package/dist/ketchup/{p-85279516.entry.js → p-23e4caa1.entry.js} +2 -2
- package/dist/ketchup/p-2681d3a2.entry.js +1 -0
- package/dist/ketchup/p-269a1dfe.entry.js +1 -0
- package/dist/ketchup/{p-829d7060.entry.js → p-2940b559.entry.js} +1 -1
- package/dist/ketchup/{p-4bc3b3a6.js → p-39ba3355.js} +1 -1
- package/dist/ketchup/{p-eae42bff.entry.js → p-4725191c.entry.js} +1 -1
- package/dist/ketchup/{p-097500fe.js → p-4afe8662.js} +1 -1
- package/dist/ketchup/{p-8591ac0b.entry.js → p-58798e2d.entry.js} +1 -1
- package/dist/ketchup/{p-e46470a6.entry.js → p-5b3d8636.entry.js} +1 -1
- package/dist/ketchup/{p-0f91d4de.entry.js → p-5fa089cd.entry.js} +1 -1
- package/dist/ketchup/{p-db93bc06.entry.js → p-645d881d.entry.js} +1 -1
- package/dist/ketchup/{p-d7b8295a.entry.js → p-6a8fcb02.entry.js} +1 -1
- package/dist/ketchup/{p-20aa95ae.entry.js → p-6f108540.entry.js} +1 -1
- package/dist/ketchup/{p-8ecdd076.entry.js → p-788da2d9.entry.js} +1 -1
- package/dist/ketchup/{p-69287f4a.entry.js → p-7e5d8532.entry.js} +1 -1
- package/dist/ketchup/{p-ee6305f5.js → p-95b31ede.js} +1 -1
- package/dist/ketchup/{p-4c1ec006.js → p-9df95b9f.js} +1 -1
- package/dist/ketchup/{p-7a72c4fa.entry.js → p-a5229d3d.entry.js} +1 -1
- package/dist/ketchup/{p-0cb5e9ae.entry.js → p-b104afb6.entry.js} +1 -1
- package/dist/ketchup/{p-8e180c01.entry.js → p-b857aab2.entry.js} +1 -1
- package/dist/ketchup/{p-1872c92e.entry.js → p-c0c65349.entry.js} +1 -1
- package/dist/ketchup/{p-f1efab38.entry.js → p-ddd25869.entry.js} +1 -1
- package/dist/ketchup/p-eea1ee1b.js +1 -0
- package/dist/ketchup/{p-21c640a5.js → p-f0e4e190.js} +1 -1
- package/dist/ketchup/{p-51f9b230.entry.js → p-f81d7218.entry.js} +1 -1
- package/dist/types/components/kup-openai-interface/kup-openai-interface-declarations.d.ts +10 -0
- package/dist/types/components/kup-openai-interface/kup-openai-interface.d.ts +59 -0
- package/dist/types/components.d.ts +86 -0
- package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +15 -0
- package/dist/types/managers/kup-manager/kup-manager.d.ts +17 -1
- package/package.json +1 -1
- package/dist/ketchup/p-612b46da.entry.js +0 -1
- package/dist/ketchup/p-84be8f0b.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as o,f as i,h as e,H as s,d as r}from"./p-cd9a4274.js";import{k as n,x as a,g as l,s as h,u as c,l as p,a as b,d,M as u,Q as x,R as f,U as g,D as w,$ as m}from"./p-4bc3b3a6.js";import{f as k,p as v,s as y,d as _,r as j,h as C,b as P}from"./p-ee6305f5.js";import{F as R}from"./p-ce9ef2d5.js";import{a as A}from"./p-4c1ec006.js";import{c as z}from"./p-635bb4b3.js";import{F as M}from"./p-84be8f0b.js";import{F as E}from"./p-b3577066.js";import"./p-c23731ca.js";import"./p-21c640a5.js";import"./p-c634eb82.js";import"./p-f51dbf68.js";import"./p-097500fe.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.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.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={}));class O{constructor(){this.globalFilterValue="",this.sortBy="",this.selectedRowsState="",this.pageSelected=1,this.rowsPerPage=0,this.load=!1}toDebugString(){return"box state"}}var S,D,B,$,W,L,T=function(t,o,i,e){if("a"===i&&!e)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof o?t!==o||!e:!o.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?e:"a"===i?e.call(t):e?e.value:o.get(t)},F=function(t,o,i,e,s){if("m"===e)throw new TypeError("Private method is not writable");if("a"===e&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof o?t!==o||!s:!o.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===e?s.call(t,i):s?s.value=i:o.set(t,i),i};const H=class{constructor(i){t(this,i),this.kupBoxClick=o(this,"kup-box-click",6),this.kupBoxSelected=o(this,"kup-box-selected",6),this.kupAutoBoxSelect=o(this,"kup-box-autoselect",6),this.kupRowActionMenuClick=o(this,"kup-box-rowactionmenuclick",6),this.kupRowActionClick=o(this,"kup-box-rowactionclick",6),this.kupDidLoad=o(this,"kup-box-didload",6),this.kupDidUnload=o(this,"kup-box-didunload",6),this.kupBoxContextMenu=o(this,"kup-box-contextmenu",6),S.add(this),this.state=new O,this.kupManager=n(),this.visibleColumns=[],this.rows=[],this.filteredRows=[],this.sectionRef=null,this.rowsRefs=[],this.hold=!1,this.interactableDrag=[],this.interactableDrop=[],this.interactableTouch=[],D.set(this,void 0),B.set(this,[]),$.set(this,0),this.collapsedSection={},this.selectedRows=[],this.rowActionMenuOpened=void 0,this.currentPage=1,this.currentRowsPerPage=10,this.cardData=null,this.columns=1,this.customStyle="",this.data=null,this.dragEnabled=!1,this.dropEnabled=!1,this.dropOnSection=!1,this.editableData=!1,this.enableRowActions=!1,this.globalFilter=!1,this.globalFilterValue="",this.kanban=null,this.layout=void 0,this.lazyLoadRows=!1,this.multiSelection=!1,this.pageSelected=1,this.pagination=!1,this.rowsPerPage=void 0,this.scrollOnHover=!1,this.selectBox=void 0,this.selectedRowsState=void 0,this.showSelection=!0,this.sortBy=void 0,this.sortEnabled=!1,this.stateId="",this.store=void 0,this.swipeDisabled=!1}initWithPersistedState(){if(this.store&&this.stateId){const t=this.store.getState(this.stateId);null!=t&&(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)}}persistState(){if(this.store&&this.stateId){let t=!1;this.kupManager.objects.deepEqual(this.state.sortBy,this.sortBy)||(this.state.sortBy=this.sortBy,t=!0),this.kupManager.objects.deepEqual(this.state.globalFilterValue,this.globalFilterValue)||(this.state.globalFilterValue=this.globalFilterValue,t=!0),this.kupManager.objects.deepEqual(this.state.pageSelected,this.currentPage)||(this.state.pageSelected=this.currentPage,t=!0),this.kupManager.objects.deepEqual(this.state.rowsPerPage,this.currentRowsPerPage)||(this.state.rowsPerPage=this.currentRowsPerPage,t=!0);const o=this.selectedRows.reduce(((t,o,i)=>t+(i>0?";":"")+o.id),"");if(this.kupManager.objects.deepEqual(this.state.selectedRowsState,o)||(this.state.selectedRowsState=o,t=!0),!this.state.load)return void(this.state.load=!0);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,o){t.actions=o,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:void 0}]}initVisibleColumns(){this.visibleColumns=this.getColumns().filter((t=>!t.hasOwnProperty("visible")||t.visible))}getRows(){return this.data&&this.data.rows?this.data.rows:[]}initRows(){this.filteredRows=this.getRows(),this.globalFilter&&this.globalFilterValue&&(this.filteredRows=k(this.filteredRows,null,this.globalFilterValue,this.visibleColumns)),this.rows=this.sortRows(this.filteredRows),this.pagination&&(this.rows=v(this.rows,this.currentPage,this.currentRowsPerPage,!1))}sortRows(t){let o=t;return this.sortBy&&(o=y(o,this.toSortObjectList())),o}toSortObjectList(){return this.sortBy.split("|").map((t=>{const o=t.split(",");return{column:o[0],sortMode:o.length>1?m[o[1]]:m.A}}))}checkScrollOnHover(){this.kupManager.scrollOnHover.isRegistered(this.boxContainer)?this.scrollOnHover||this.kupManager.scrollOnHover.unregister(this.boxContainer):this.scrollOnHover&&this.kupManager.scrollOnHover.register(this.boxContainer)}checkLayout(){if(this.layout)return void(this.boxLayout=this.layout);const t={horizontal:!1,sections:[]},o=this.visibleColumns;let i=o.length,e=[],s=0;for(;i-- >0;)e.push({column:o[s++].name});t.content=e,this.boxLayout={sections:[t]}}onSortChange(t){let o=c(this.visibleColumns,t.detail.value);this.sortBy=o.name}onGlobalFilterChange({detail:t}){let o="";t&&t.value&&(o=t.value),this.globalFilterValue=o}isSectionExpanded(t,o){return!(!t.id||!o.id)&&this.collapsedSection[o.id]&&this.collapsedSection[o.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,o){let i=null,e=null,s=null,r=null;if(t&&(i=t.closest(".box-object")||t.querySelector(".box-object")||t.closest(".f-cell")),i)if(i.classList.contains("f-cell")){const t=i["kup-get-cell-props"]();e=t.cell,r=t.column,s=t.row}else e=i["data-cell"],s=i["data-row"],r=c(this.visibleColumns,i.dataset.column);return{boxObject:i||null,column:r||null,cell:e||null,originalEvent:o,row:s||null}}contextMenuHandler(t){return this.getEventDetails(t.target,t)}checkIfElementIsActionMenuIcon(t){return!(!t.tagName||!t.parentElement)&&"svg"===t.tagName&&t.parentElement.classList.contains("row-actions-toggler")}onBoxClick({target:t},o){if(!(t instanceof HTMLElement))return;let i=t,e=i.classList;for(;!e.contains("box-object")&&!e.contains("box-section")&&!e.contains("box")&&(i=i.parentElement,null!==i);)e=i.classList;let s=null;e.contains("box-object")&&(s=i.dataset.column),this.kupBoxClick.emit({comp:this,id:this.rootElement.id,row:o,column:s}),this.multiSelection?this.onSelectionCheckChange(o):this.selectedRows=[o]}onSelectionCheckChange(t){var o=-1;for(let i=0;i<this.selectedRows.length;i++)if(this.selectedRows[i].id===t.id){o=i;break}o>=0?(this.selectedRows.splice(o,1),this.selectedRows=[...this.selectedRows]):this.selectedRows=[...this.selectedRows,t],this.kupBoxSelected.emit({comp:this,id:this.rootElement.id,rows:this.selectedRows})}toggleSectionExpand(t,o){if(o.id)if(t.id){if(this.collapsedSection[o.id]){const i=this.collapsedSection[o.id];i[t.id]=!i[t.id]||!i[t.id]}else this.collapsedSection[o.id]={},this.collapsedSection[o.id][t.id]=!0;this.collapsedSection=Object.assign({},this.collapsedSection)}else console.error("cannot expand / collapse a section of a row without ad id");else console.error("cannot expand / collapse a section withoun an ID")}onRowAction(t){t&&(t!==this.rowActionMenuOpened?t.actions?this.rowActionMenuOpened=t:this.kupRowActionMenuClick.emit({comp:this,id:this.rootElement.id,row:t}):this.rowActionMenuOpened=null)}onRowActionClick(t,o,i){this.kupRowActionClick.emit({comp:this,id:this.rootElement.id,row:t,action:o,index:i})}clickFunction(t){try{const o=t.composedPath();for(let t of o)if(this.checkIfElementIsActionMenuIcon(t))return}catch(o){if(this.checkIfElementIsActionMenuIcon(t.target))return}this.rowActionMenuOpened=null}handlePageChange(t){const o=_(t,this.filteredRows.length,this.currentRowsPerPage);o&&(this.currentPage=o)}handleRowsPerPageChange(t){const o=j(t,this.filteredRows.length);o&&(this.currentRowsPerPage=o,this.adjustPaginator())}adjustPaginator(){const t=Math.ceil(this.rows.length/this.currentRowsPerPage);this.currentPage>t&&(this.currentPage=1)}renderSectionAsCard(t){let o=!1;const i={button:[],cell:[],columns:[],image:[],progressbar:[],text:[]};for(let o=0;o<this.data.columns.length;o++){const e=this.data.columns[o];!1!==e.visible&&(i.cell.push(t.cells[e.name]),i.columns.push(e))}for(const o in t.cells)if(t.cells.hasOwnProperty(o)){const e=t.cells[o];if(void 0!==e.cardID&&e.obj)switch(e.obj.p){case"BTN":do{i.button.push({})}while(i.button.length<e.cardID);i.button[e.cardID]={label:e.value};break;case"IMG":do{i.image.push({})}while(i.image.length<e.cardID);i.image[e.cardID]={resource:e.value};break;case"PGB":do{i.progressbar.push({})}while(i.progressbar.length<e.cardID);i.progressbar[e.cardID]={value:e.value};break;default:do{i.text.push("")}while(i.text.length<e.cardID);i.text[e.cardID]=e.value}}for(const e in t.cells)if(t.cells.hasOwnProperty(e)){const s=t.cells[e];if(void 0===s.cardID&&s.obj)switch(o=!1,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},o=!0;break}o||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},o=!0;break}o||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},o=!0;break}o||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,o=!0;break}o||i.text.push(s.value)}}return e("kup-card",Object.assign({data:i},this.cardData))}renderRow(t){const o=[...this.visibleColumns];let i=null,s=t.layout;s||(s=this.boxLayout);let r=!1;if(s){s.horizontal&&(r=!0);const e=s.sections;let n=e.length,a=0;n>0&&(i=[]);const l={horizontal:r};for(;n-- >0;)i.push(null!=this.cardData&&"object"==typeof this.cardData?this.renderSectionAsCard(t):this.renderSection(e[a++],l,t,o))}var n=!1;for(let o of this.selectedRows)o.id===t.id&&(n=!0);let a=null;this.multiSelection&&(a=e("div",{class:"box-selection"},e("kup-checkbox",{checked:n})));let l=null;if(this.enableRowActions&&!this.swipeDisabled){const o={"row-action-menu":!0,open:t===this.rowActionMenuOpened};let i=null;if(t.actions){const o=t.actions.map(((o,i)=>e("li",{tabindex:"0",onClick:()=>this.onRowActionClick(t,o,i)},e("div",{class:`icon ${o.icon}`}),e("div",{class:"text"},o.text))));i=e("ul",null,o)}l=e("div",{class:"row-actions-wrapper"},e("div",{class:"row-actions-toggler"},e("svg",{version:"1.1",width:"24",height:"24",viewBox:"0 0 24 24",onClick:()=>this.onRowAction(t)},e("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"})),e("div",{class:o},i)))}let h=null;return t.badgeData&&t.badgeData.length>0&&(h=t.badgeData.map((t=>e("kup-badge",{text:t.text,class:t.className?`centered ${t.className}`:"centered",imageData:t.imageData})))),e("div",{class:"box-wrapper",style:t.style||{},ref:t=>T(this,B,"f").push(t)},e("div",{class:{box:!0,draggable:this.dragEnabled,selected:this.showSelection&&n,column:!r},onClick:o=>this.onBoxClick(o,t),ref:t=>this.rowsRefs.push(t)},a,i,h),l)}renderSection(t,o,i,s){let r=null;if(t.sections&&t.sections.length>0){const o=t.sections;let e=o.length,n=0;for(e>0&&(r=[]);e-- >0;)r.push(this.renderSection(o[n++],t,i,s))}else if(t.content){const o=t.content;let e=o.length,n=0;for(e>0&&(r=[]);e-- >0;)r.push(this.renderBoxObject({boxObject:o[n++],row:i,visibleColumns:s},!0))}else s.length>0&&(r=this.renderBoxObject({boxObject:{column:s[0].name},row:i,visibleColumns:s}));const n=this.isSectionExpanded(i,t),a=!!t.columns,l={"box-section":!0,open:n,column:!a&&!t.horizontal,grid:a,titled:!!t.title,"last-child":!t.sections||0===t.sections.length},h=t.style||{};t.dim&&o&&(h.flex=`0 0 ${t.dim}`,h.overflow="hidden",o.horizontal?h.maxWidth=t.dim:h.maxHeight=t.dim),a&&(h["grid-template-columns"]=`repeat(${t.columns}, 1fr)`);let c=null;if(t.collapsible){l["collapse-section"]=!0;const o={content:!0};let s="";s=t.title?t.title:this.kupManager.language.translate(n?p.COLLAPSE:p.EXPAND),c=e("div",{class:l,style:h},e("div",{class:o},r),e("div",{class:"header",role:"button",onClick:o=>{o.stopPropagation(),this.toggleSectionExpand(i,t)}},e("div",{class:"header-content"},e("span",null,s),e(R,{resource:`${b.DROPDOWN}`,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:n?"toggled":""}))))}else{const o=t.title?e("h3",null,t.title):null;c=e("div",{class:l,style:h},o,r)}return c}renderBoxObject({boxObject:t,row:o,visibleColumns:i},s){const r={"box-object":!0};let n=null,a=-1;for(let o=0;o<i.length;o++)if(i[o].name===t.column){a=o;break}a>=0?(n=i[a],i.splice(a,1)):s&&(n=this.data.columns.find((o=>o.name===t.column)));const l=o.cells[t.column];let h;return l&&!this.kupManager.objects.isEmptyKupObj(l.obj)&&(r["is-obj"]=!0,this.kupManager.debug.isDebug()&&(h=l.obj.t+"; "+l.obj.p+"; "+l.obj.k+";")),e("div",{"data-cell":l,"data-row":o,"data-column":t.column,class:r,style:{},title:h},l&&n?e(M,Object.assign({},{cell:l,column:n,component:this,editable:this.editableData,renderKup:!0,row:o,setSizes:!0,shape:t.shape})):e("span",null,t.value))}kanbanMode(){if(!this.kanban.columns||0===this.kanban.columns.length)return this.kupManager.debug.logMessage(this,"No columns to group by detected.",d.ERROR),{jsx:e("div",{id:"empty-data-message",class:"box-wrapper"},e("div",{ref:t=>this.rowsRefs.push(t)}),this.kupManager.language.translate(p.EMPTY_DATA)),style:{"grid-template-columns":"repeat(1, 1fr)"}};const t=[];if(this.kanban.labels)for(let o=0;o<this.kanban.labels.length;o++)t.push({labels:this.kanban.labels[o],nodes:[]});for(let o=0;o<this.rows.length;o++){let i=[];for(let t=0;t<this.kanban.columns.length;t++)try{i.push(this.rows[o].cells[this.kanban.columns[t]].value)}catch(t){this.kupManager.debug.logMessage(this,t,d.WARNING)}const e={found:!1,index:null};for(let o=0;o<t.length;o++){let s=t[o].labels,r=!0;for(let t=0;t<s.length;t++)if(i[t]!==s[t]){r=!1;break}if(r){e.found=!0,e.index=o;break}}e.found?t[e.index].nodes.push(this.renderRow(this.rows[o])):t.push({labels:i,nodes:[this.renderRow(this.rows[o])]})}const o=[];for(let i=0;i<t.length;i++){const s=t[i].labels,r={data:[]};for(let t=0;t<s.length;t++)r.data.push({value:s[t],id:s[t]});o.push(e("div",{class:"kanban-section"},e(A,Object.assign({},r)),t[i].nodes))}return{jsx:o,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),this.kupManager.interact.on(this.boxContainer,u.TAP,(t=>{this.hold?this.hold=!1:2===t.button&&this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)})})),this.kupManager.interact.on(this.boxContainer,u.HOLD,(t=>{"pen"!==t.pointerType&&"touch"!==t.pointerType||(this.hold=!0,this.kupBoxContextMenu.emit({comp:this,id:this.rootElement.id,details:this.contextMenuHandler(t)}))}))}didRenderInteractables(){if(this.dragEnabled)for(let t=0;t<this.rowsRefs.length;t++){const o=this.rowsRefs[t],i=()=>{const t=this.rootElement.shadowRoot.querySelector(".box-object:hover");return{cell:t["data-cell"],column:c(this.visibleColumns,t.dataset.column),id:this.rootElement.id,multiple:this.multiSelection,row:t["data-row"],selectedRows:this.selectedRows}};o&&!this.interactableDrag.includes(o)&&(this.interactableDrag.push(o),this.kupManager.interact.draggable(o,{allowFrom:".box-object",cursorChecker:()=>null},{callback:i},x.BADGE))}if(this.dropEnabled){const t=()=>{const t=this.getEventDetails(this.rootElement.shadowRoot.querySelector(".box:hover"));return{cell:t.cell,column:t.column,id:this.rootElement.id,row:t.row}};this.interactableDrop.includes(this.sectionRef)||(this.interactableDrop.push(this.sectionRef),this.kupManager.interact.dropzone(this.sectionRef,{accept:`[${f}]`},{dispatcher:this.rootElement,type:g.BOX}));for(let o=0;o<this.rowsRefs.length;o++){const i=this.rowsRefs[o];i&&!this.interactableDrop.includes(i)&&(this.interactableDrop.push(i),this.kupManager.interact.dropzone(i,{accept:`[${f}]`},{callback:t,dispatcher:this.rootElement,type:g.BOX}))}}}componentWillLoad(){this.kupManager.debug.logLoad(this,!1),this.rowsPerPage&&(this.currentRowsPerPage=this.rowsPerPage),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(),document.querySelector(".header")?F(this,$,document.querySelector(".header").clientHeight,"f"):F(this,$,0,"f"),document.querySelector(".topbar")&&F(this,$,T(this,$,"f")+document.querySelector(".topbar").clientHeight,"f"),T(this,S,"m",L).call(this)}componentDidLoad(){if(this.handleAutomaticBoxSelection(),document.addEventListener("click",this.clickFunction.bind(this)),this.currentPage=this.pageSelected,this.multiSelection&&this.selectedRowsState){this.selectedRows=[];let t=this.selectedRowsState.split(";");this.selectedRows=this.data.rows.filter((o=>t.indexOf(o.id)>=0))}this.didLoadInteractables(),this.kupDidLoad.emit({comp:this,id:this.rootElement.id}),this.kupManager.debug.logLoad(this,!0)}componentWillRender(){this.kupManager.debug.logRender(this,!1)}componentDidRender(){const t=this.rootElement.shadowRoot;if(t){const o=t.querySelectorAll(".f-text-field");for(let t=0;t<o.length;t++)E(o[t])}this.checkScrollOnHover(),this.persistState(),this.didRenderInteractables(),T(this,S,"m",W).call(this),this.kupManager.debug.logRender(this,!0)}render(){const t=!("object"!=typeof this.kanban||null===this.kanban);let o=null;if(this.sortEnabled){const t=[{value:"",id:""},...this.visibleColumns.map((t=>({value:t.title,id:t.name,selected:t.name===this.sortBy})))];let i={label:this.kupManager.language.translate(p.SORT_BY),trailingIcon:!0};o=e("div",{id:"sort-panel"},e("kup-combobox",{data:{"kup-text-field":i,"kup-list":{data:t,selectable:!0}},initialValue:this.sortBy,"onkup-combobox-itemclick":t=>this.onSortChange(t)}))}let i=null;this.globalFilter&&(i=e("div",{id:"global-filter"},e("kup-text-field",{fullWidth:!0,label:this.kupManager.language.translate(w.SEARCH),icon:b.SEARCH,initialValue:this.globalFilterValue,"onkup-textfield-input":t=>{window.clearTimeout(this.globalFilterTimeout),this.globalFilterTimeout=window.setTimeout((()=>this.onGlobalFilterChange(t)),600)}})));let r=null;!this.lazyLoadRows&&this.pagination&&(r=e(P,{id:top?"top-paginator":"bottom-paginator",currentPage:this.currentPage,max:this.filteredRows.length,mode:C.SIMPLE,perPage:this.currentRowsPerPage?this.currentRowsPerPage:this.rowsPerPage,onPageChange:t=>this.handlePageChange(t.detail.value),onRowsChange:t=>this.handleRowsPerPageChange(t.detail.value)}));let n=null,a={};if(0===this.rows.length)n=e("div",{id:"empty-data-message",class:"box-wrapper"},e("div",{class:"box",ref:t=>this.rowsRefs.push(t)},this.kupManager.language.translate(p.EMPTY_DATA))),a={"grid-template-columns":"repeat(1, 1fr)"};else if(t){const t=this.kanbanMode();n=t.jsx,a=t.style}else{a={"grid-template-columns":`repeat(${this.columns}, 1fr)`};const t=this.rows;let o=t.length,i=0;for(n=[];o-- >0;)n.push(this.renderRow(t[i++]))}return e(s,null,e("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),e("div",{id:z},e("div",{class:"box-component",ref:t=>this.sectionRef=t},o,i,r,e("div",{class:t?"is-kanban":"",id:"box-container",style:a,onContextMenu:t=>{t.preventDefault()},ref:t=>this.boxContainer=t},n))))}disconnectedCallback(){this.kupManager.interact.unregister(this.interactableDrag.concat(this.interactableDrop)),this.kupManager.language.unregister(this),this.kupManager.theme.unregister(this),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 r(this)}static get watchers(){return{rowsPerPage:["rowsPerPageHandler","recalculateRows"],globalFilterValue:["recalculateRows"],sortBy:["recalculateRows"],pagination:["recalculateRows"],currentPage:["recalculateRows"],currentRowsPerPage:["recalculateRows"],data:["onDataChanged"],layout:["onLayoutChanged"],selectBox:["onSelectBoxChanged"]}}};D=new WeakMap,B=new WeakMap,$=new WeakMap,S=new WeakSet,W=function(){this.lazyLoadRows&&this.currentRowsPerPage<this.data.rows.length&&T(this,D,"f").observe(T(this,B,"f")[T(this,B,"f").length-1])},L=function(){const t={threshold:0,rootMargin:"-"+T(this,$,"f")+"px 0px 0px 0px"};F(this,D,new IntersectionObserver((t=>{t.forEach((t=>{if(t.isIntersecting){this.kupManager.debug.logMessage(this,"Last row entering the viewport, loading more elements.");const o=this.data.rows.length-this.currentRowsPerPage;this.currentRowsPerPage+=o<10?o:10,t.target.classList.remove("last-row"),T(this,D,"f").unobserve(t.target)}}))}),t),"f")},H.style=":host{--kup_box_background_color:var(\n --kup-box-background-color,\n var(--kup-background-color)\n );--kup_box_color:var(--kup-box-color, var(--kup-text-color));--kup_box_font_family:var(--kup-box-font-family, var(--kup-font-family));--kup_box_font_size:var(--kup-box-font-size, var(--kup-font-size));--kup_box_grid_gap:var(--kup-box-grid-gap, 1em);--kup_box_hover_box_shadow:var(\n --kup-box-hover-box-shadow,\n 0px 0px 7.5px 0px rgba(128, 128, 128, 0.5)\n );--kup_box_primary_color_rgb:var(\n --kup-box-primary-color-rgb,\n var(--kup-primary-color-rgb)\n );--kup_box_transition:var(--kup-box-transition, 0.25s);display:block;font-family:var(--kup_box_font_family);font-size:var(--kup_box_font_size)}.box-component{background:var(--kup_box_background_color);transition:border var(--kup_box_transition) ease}.box-component[kup-drag-over]{position:relative;border:3px dashed var(--kup-border-color)}#box-container{display:grid;grid-gap:var(--kup_box_grid_gap);color:var(--kup_box_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 *{box-sizing:border-box}#box-container .box-wrapper{display:flex;align-items:center}#box-container .box-wrapper .box{flex-grow:1;cursor:pointer;position:relative;display:flex;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:hover{box-shadow:var(--kup_box_hover_box_shadow)}#box-container .box-wrapper .box.selected{background-color:rgba(var(--kup_box_primary_color_rgb), 0.175)}#box-container .box-wrapper .box.selected .box-section.titled>h3{background-color:transparent}#box-container .box-wrapper .box[kup-draggable]{opacity:0.5}#box-container .box-wrapper .box[kup-drag-over]{border:3px dashed var(--kup-border-color);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-color);color:rgba(var(--kup-text-color-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-color);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 500ms 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-color);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-color)}#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(:not(.kup-borderless)) .box{border:1px solid var(--kup-border-color)}: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{padding:3px}: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{margin: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)}";export{H as kup_box}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a6 as e,a7 as s,c,a3 as t,a8 as a,F as i,a9 as n,aa as l,ab as o,ac as r,ad as u}from"./p-4bc3b3a6.js";import{h as p,g as d}from"./p-cd9a4274.js";import{F as k}from"./p-f51dbf68.js";import{F as b}from"./p-097500fe.js";import{F as h}from"./p-ce9ef2d5.js";import{F as f,a as m}from"./p-4c1ec006.js";import{F as g}from"./p-21c640a5.js";var v,w,y;!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."}(v||(v={})),function(e){e.LISTBOX="listbox",e.RADIOGROUP="radiogroup",e.GROUP="group"}(w||(w={})),function(e){e.CODE="code",e.DESCRIPTION="description",e.DESCRIPTION_AND_CODE="both"}(y||(y={}));const j=e=>p("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}),p("div",{class:"form-field "+(e.leadingLabel?"form-field--align-end":"")},p("div",{class:`switch ${e.checked?"switch--checked":""} ${e.disabled?"switch--disabled":""}`},p("div",{class:"switch__track"}),p("div",{class:"switch__thumb-underlay"},p("div",{class:"switch__thumb"},p("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})))),p("label",{onClick:e.onChange},e.label))),$=e=>{e.centeredLabel||0==!e.centeredLabel||(e.centeredLabel=!0);let s,c=`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:""}`,t="pie";c+=e.isRadial?" pie-wrapper is-radial":" progress-bar";const a={width:`${e.value}%`};e.centeredLabel?e.value>49&&(c+=" text-color-on-primary"):(s=a,e.value>2&&(c+=" text-color-on-primary"));let i=null;return e.icon?i=function(e){if(e.icon){if(e.icon.indexOf(".")>-1||e.icon.indexOf("/")>-1||e.icon.indexOf("\\")>-1)return p("span",{class:"label kup-icon is-image"},p("img",{src:e.icon}));{let s=`url('${d(`./assets/svg/${e.icon}.svg`)}') no-repeat center`;return p("span",{style:{mask:s,webkitMask:s},class:"label kup-icon"})}}}(e):e.hideLabel||(i=e.isRadial?e.label?p("span",{class:"label"},e.label):p("span",{class:"label"},e.value,p("span",{class:"smaller"},"%")):e.label?e.label:e.value+"%"),e.value>0&&(t+=" has-value",t+=e.value>50?" is-more-than-half":" is-less-than-half"),e.isRadial?p("div",{class:c},i,p("div",{class:t},p("div",{style:undefined,class:"left-side half-circle"}),p("div",{class:"right-side half-circle"})),p("div",{class:"shadow"})):p("div",{class:c},p("div",{class:"progress-bar-percentage",style:a},p("span",{style:s},i)))},x=e=>{var s;const c=!!e.columns,t=[];for(let c=0;c<(null===(s=e.data)||void 0===s?void 0:s.length);c++){const s=e.data[c];t.push(p("div",{class:"form-field "+(e.leadingLabel?" form-field--align-end":"")},p("div",{class:{radio:!0,"radio--checked":!!s.checked,"radio--disabled":!!e.disabled}},p("input",{class:"radio__native-control",type:"radio",name:"radio-element",value:s.value,checked:s.checked,disabled:e.disabled,onBlur:e.onBlur,onChange:e.onChange?e.onChange.bind(e.onChange,c):null,onFocus:e.onFocus}),p("div",{class:"radio__background"},p("div",{class:"radio__outer-circle"}),p("div",{class:"radio__inner-circle"}))),p("label",{htmlFor:"radio-element",onClick:e.onChange?e.onChange.bind(e.onChange,c):null},s.label?s.label:"")))}return p("div",{class:`f-radio radio-wrapper ${c?"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:""}`,style:{"--kup_radio_columns":c?`repeat(${e.columns}, 1fr)`:""}},t)},O=e=>(e.maxValue||(e.maxValue=5),p("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:""}`},function(e){const s=[];for(let c=1;c<=e.maxValue;c++)s.push(p("span",{class:"rating",onClick:e.onClick?e.onClick.bind(e.onClick,c):null},c<=e.value?"★":"☆"));return s}(e))),_=document.documentElement,C=(n,o)=>{const d=n.cell,v=n.column,w=n.row,C=n.shape?n.shape:d.shape?d.shape:v.shape?v.shape:null,D=!_.ketchup.objects.isEmptyKupObj(d.obj),K=!(!d.isEditable&&!v.isEditable||!n.editable),M=n.previousValue!==d.value?d.value:"",V=_.ketchup.data.cell.getType(d,C),H=Object.assign({},d.data);let T=d.cssClass?d.cssClass:v.cssClass?v.cssClass:"";const X={"f-cell":!0,[l.OBJ]:!!D,[V+"-cell"]:!0,[n.wrapperClass]:!!n.wrapperClass,[n.density]:!(!n.density||V===t.BAR),[T]:!!T};let W=M;K&&e.includes(V)?W=function(e,s,c,a,n){switch(e){case t.AUTOCOMPLETE:return p("kup-autocomplete",Object.assign({key:a.name+n.row.id,initialValue:c.value},c.data,{class:z(n)?"kup-full-width":"","onkup-autocomplete-change":s=>I(s,n,e,u.UPDATE),"onkup-autocomplete-input":s=>I(s,n,e,u.INPUT),"onkup-autocomplete-iconclick":s=>I(s,n,e,u.ICON_CLICK)}));case t.CHECKBOX:return F(n)&&(s[l.C_CENTERED]=!0),c.shape===i.INPUT_CHECKBOX?p("input",{checked:"on"===c.value||"1"===c.value,class:"input-checkbox",onChange:s=>I(s,n,e,u.UPDATE),type:"checkbox"}):p(k,Object.assign({},c.data,{onChange:s=>I(s,n,e,u.UPDATE)}));case t.CHIP:return p("kup-chip",Object.assign({},c.data,{type:f.INPUT,enableInput:!0,"onKup-chip-change":s=>I(s,n,e,u.UPDATE)}),p("kup-text-field",Object.assign({fullWidth:!0,slot:"field"},c.slotData)));case t.COLOR_PICKER:return p("kup-color-picker",Object.assign({key:a.name+n.row.id,initialValue:c.value},c.data,{class:z(n)?"kup-full-width":"",disabled:!1,"onkup-colorpicker-change":s=>I(s,n,e,u.UPDATE)}));case t.COMBOBOX:return p("kup-combobox",Object.assign({key:a.name+n.row.id,initialValue:c.value},c.data,{class:z(n)?"kup-full-width":"","onkup-combobox-change":s=>I(s,n,e,u.UPDATE),"onkup-combobox-input":s=>I(s,n,e,u.INPUT),"onkup-combobox-iconclick":s=>I(s,n,e,u.ICON_CLICK)}));case t.DATE:return p("kup-date-picker",Object.assign({key:a.name+n.row.id,initialValue:c.value},c.data,{class:z(n)?"kup-full-width":"","onkup-datepicker-change":s=>I(s,n,e,u.UPDATE),"onkup-datepicker-input":s=>I(s,n,e,u.INPUT)}));case t.MULTI_AUTOCOMPLETE:return p("kup-chip",Object.assign({displayId:!0},c.data,{type:f.INPUT,enableInput:!0,"onKup-chip-change":s=>I(s,n,e,u.UPDATE)}),p("kup-autocomplete",Object.assign({class:"kup-full-width",slot:"field",displayMode:y.DESCRIPTION_AND_CODE,selectMode:y.DESCRIPTION_AND_CODE,"onkup-autocomplete-input":s=>I(s,n,e,u.INPUT),"onkup-autocomplete-iconclick":s=>I(s,n,e,u.ICON_CLICK),showDropDownIcon:!1},c.slotData)));case t.MULTI_COMBOBOX:return p("kup-chip",Object.assign({displayId:!0},c.data,{type:f.INPUT,enableInput:!0,"onKup-chip-change":s=>I(s,n,e,u.UPDATE)}),p("kup-combobox",Object.assign({class:"kup-full-width",slot:"field",displayMode:y.DESCRIPTION_AND_CODE,selectMode:y.DESCRIPTION_AND_CODE,"onkup-combobox-input":s=>I(s,n,e,u.INPUT),"onkup-combobox-iconclick":s=>I(s,n,e,u.ICON_CLICK)},c.slotData)));case t.RATING:return p("kup-rating",Object.assign({key:a.name+n.row.id},c.data,{disabled:!1,"onkup-rating-click":s=>I(s,n,e,u.UPDATE)}));case t.SWITCH:return p(j,Object.assign({},c.data,{disabled:!1,onChange:s=>I(s,n,e,u.UPDATE)}));case t.TIME:return p("kup-time-picker",Object.assign({key:a.name+n.row.id,initialValue:c.value},c.data,{class:z(n)?"kup-full-width":"","onkup-timepicker-change":s=>I(s,n,e,u.UPDATE),"onkup-timepicker-input":s=>I(s,n,e,u.INPUT)}));case t.NUMBER:s[l.C_RIGHT_ALIGNED]=!0;case t.LINK:case t.STRING:const o=s=>I(s,n,e,u.UPDATE),r=s=>I(s,n,e,u.INPUT),d=e===t.NUMBER?"number":null,h=e===t.NUMBER&&c.value?_.ketchup.math.numberifySafe(c.value).toString():c.value;return c.shape===i.INPUT_FIELD?p("input",{class:"input-field",onChange:o,onInput:r,type:d,value:h}):p(b,Object.assign({inputType:d,fullWidth:!!z(n)},c.data,{icon:c.data&&c.data.icon?c.data.icon:c.icon?c.icon:a.icon?a.icon:null,value:h,onChange:o,onInput:r,onIconClick:s=>I(s,n,e,u.ICON_CLICK)}))}}(V,X,d,v,n):d.data&&s.includes(V)?(n.setSizes&&function(e,s,c){switch(e){case t.BAR:s.sizeY||(s.sizeY="26px");break;case t.BUTTON:let e="";s.label&&(e="36px"),c.style?c.style.height||(c.style.minHeight=e):c.style={minHeight:e};break;case t.CHART:s.sizeX||(s.sizeX="100%"),s.sizeY||(s.sizeY="100%");break;case t.CHIP:case t.RADIO:c.style?c.style.height||(c.style.minHeight="40px"):c.style={minHeight:"40px"}}}(V,H,d),W=n.renderKup?function(e,s,c,a,i,n,o){switch(e){case t.BAR:return c.data?p("div",{style:{height:c.sizeY,width:"100%"}},p(h,Object.assign({},c))):p("kup-image",Object.assign({key:n.name+o.row.id,sizeX:"250px"},c));case t.BUTTON:return F(o)&&(s[l.C_CENTERED]=!0),p(g,Object.assign({},c,{onClick:s=>I(s,o,e,u.CLICK)}));case t.BUTTON_LIST:return F(o)&&(s[l.C_CENTERED]=!0),c["data-storage"]={cell:a,row:i,column:n},p("kup-button-list",Object.assign({key:n.name+o.row.id},c));case t.CHART:return F(o)&&(s[l.C_CENTERED]=!0),p("kup-chart",Object.assign({key:n.name+o.row.id},c));case t.MULTI_AUTOCOMPLETE:case t.MULTI_COMBOBOX:case t.CHIP:return p(m,Object.assign({},c));case t.COLOR_PICKER:return p("kup-color-picker",Object.assign({key:n.name+o.row.id},c,{class:z(o)?"kup-full-width":"",disabled:!0}));case t.GAUGE:return p("kup-gauge",Object.assign({key:n.name+o.row.id,value:_.ketchup.math.numberifySafe(a.value),"width-component":"280px"},c));case t.KNOB:case t.PROGRESS_BAR:return c.customStyle?p("kup-progress-bar",Object.assign({key:n.name+o.row.id},c)):p($,Object.assign({},c));case t.RADIO:return F(o)&&(s[l.C_CENTERED]=!0),c.disabled=i.readOnly,p(x,Object.assign({},c));case t.RATING:return p(O,Object.assign({},c,{disabled:!0}))}}(V,X,H,d,w,v,n):p("span",{class:"cell-"+V+" placeholder"})):(n.setSizes&&function(e,s,c,i){switch(e){case t.CHECKBOX:case t.ICON:s.sizeX||(s.sizeX="18px"),s.sizeY||(s.sizeY="18px"),c.style?c.style.height||(c.style.minHeight=s.sizeY):c.style={minHeight:s.sizeY};break;case t.IMAGE:i.component.rootElement.tagName===a.BOX?(s.sizeY||(s.sizeY="auto"),void 0===s.fit&&(s.fit=!0)):s.sizeX||(s.sizeX="auto"),s.sizeY||(s.sizeY="64px")}}(V,H,d,n),W=function(e,s,c,a,i,n,o){switch(e){case t.AUTOCOMPLETE:case t.COMBOBOX:case t.DATE:case t.DATETIME:case t.TIME:if(c&&""!=c){const e=r(n,i);return p("div",{class:"f-cell__text"},e)}return c;case t.CHECKBOX:return F(o)&&(a[l.C_CENTERED]=!0),p(h,{resource:s.checked?"check_box":"check_box_outline_blank",sizeX:"18px",sizeY:"18px"});case t.EDITOR:return p("div",{innerHTML:i.value});case t.ICON:case t.IMAGE:return F(o)&&(a[l.C_CENTERED]=!0),s.badgeData&&(a[l.C_PADDED]=!0),p(h,Object.assign({},s));case t.LINK:return p("a",{href:c,target:"_blank"},i.value);case t.NUMBER:if(c&&""!=c){const e=_.ketchup.math.numberifySafe(i.value),s=r(n,i);return e<0&&(a[l.TEXT_DANGER]=!0),F(o)&&(a[l.C_RIGHT_ALIGNED]=!0),p("div",{class:"f-cell__text"},s)}return p("div",{class:"f-cell__text"},c);case t.SWITCH:return F(o)&&(a[l.C_CENTERED]=!0),s.disabled=!0,p(j,Object.assign({},s));default:return p("div",{class:"f-cell__text"},c)}}(V,H,W,X,d,v,n));let Y=null;!K&&(v.icon||d.icon)&&W&&(Y=p(h,Object.assign({},{color:`rgba(var(${c.TEXT}-rgb), 0.375)`,resource:d.icon?d.icon:v.icon,sizeX:"1.25em",sizeY:"1.25em",wrapperClass:"obj-icon"})));let B=null;_.ketchup.debug.isDebug()&&D?B=d.obj.t+"; "+d.obj.p+"; "+d.obj.k+";":null!=d.title&&""!=d.title.trim()&&(B=d.title);let S=null;if(d.info){const e=Object.assign({},d.info);e.color||(e.color=`var(${c.INFO})`),e.icon||(e.icon="info"),S=p(h,Object.assign({},{color:e.color,resource:e.icon,sizeX:"1.25em",sizeY:"1.25em",title:e.message?e.message:"",wrapperClass:"cell-info"}))}return p("div",{onKeyUp:e=>I(e,n,V,u.KEYUP),class:X,"kup-get-cell-props":()=>n,ref:e=>d.element=e,style:d.style},p("div",{class:"f-cell__content",style:d.styleContent,title:B},o&&o.length>0?o:[n.indents,S,Y,W]))};function I(e,s,c,a){const i=s.cell,n=s.column,l=s.component,o=s.row;let p=function(e,s){const c=!("INPUT"!==e.target.tagName);let a=c?e.target.value:e.detail.value;return s===t.CHECKBOX&&c&&(a=e.target.checked?"off":"on"),s===t.NUMBER&&c&&(a=_.ketchup.math.formattedStringToNumberString(a,"")),a}(e,c);if(a===u.UPDATE){switch(c){case t.AUTOCOMPLETE:case t.COMBOBOX:case t.DATE:case t.TIME:i.data&&(i.data.initialValue=p);break;case t.CHECKBOX:case t.SWITCH:p="on"===p?"0":"1",i.data&&(i.data.checked="0"!==p);break;case t.CHIP:case t.MULTI_AUTOCOMPLETE:case t.MULTI_COMBOBOX:p=e.detail.stringifiedValues,i.data&&(i.data.data=e.detail.comp.data)}i.obj&&(i.obj.k=p.toString()),i.value=p.toString(),i.displayedValue=null,i.displayedValue=r(n,i)}if(l&&l.rootElement){const s=new CustomEvent(a,{bubbles:!0,cancelable:!0,composed:!0,detail:{comp:l,id:l.rootElement.id,cell:i,column:n,event:e,row:o,type:c}});if(l.rootElement.dispatchEvent(s),a===u.UPDATE)try{l.refresh()}catch(e){}}}function F(e){var s;return o.includes(null===(s=e.component)||void 0===s?void 0:s.rootElement.tagName)}function z(e){var s;return n.includes(null===(s=e.component)||void 0===s?void 0:s.rootElement.tagName)}export{C as F,y as I,w as K,v as a,$ as b,x as c,O as d,j as e}
|