@prioticket/design-system-web 1.6.3 → 1.7.0-beta.1
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/COMPONENT-DOCUMENTATION.md +1 -1
- package/component-documentation.json +2 -2
- package/custom-elements.json +48 -0
- package/dist/client-C4NwtAXt.js +20655 -0
- package/dist/client-CjTRT4wy.cjs +212 -0
- package/dist/components/pd-table.cjs.js +47 -47
- package/dist/components/pd-table.es.js +90 -53
- package/dist/types/components/pd-table.d.ts +7 -2
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lit"),l=require("lit/decorators.js"),u=require("lit/directives/repeat.js"),g=require("lit/directives/class-map.js"),b=require("lit/directives/ref.js");require("./pd-icon.cjs.js");require("./pd-checkbox.cjs.js");require("./pd-text-field.cjs.js");require("./pd-icon-button.cjs.js");require("./pd-select.cjs.js");require("./pd-menu-item.cjs.js");var m=Object.defineProperty,y=Object.getOwnPropertyDescriptor,d=(p,e,t,a)=>{for(var r=a>1?void 0:a?y(e,t):e,s=p.length-1,n;s>=0;s--)(n=p[s])&&(r=(a?n(e,t,r):n(r))||r);return a&&r&&m(e,t,r),r};exports.PdTable=class extends i.LitElement{constructor(){super(...arguments),this.columns=[],this.data=[],this.rowKey=(e,t)=>{const a=e.id;return a!=null?String(a):`__idx_${t}`},this.selectable=!1,this.sortable=!1,this.pagination=!1,this.pageSize=10,this.pageIndex=0,this.totalItems=0,this.draggableRows=!1,this.draggableColumns=!1,this.loading=!1,this.clearSelectionOnDataChange=!1,this.currencyCode="EUR",this.pageSizeOptions=[5,10,25,50,100],this._sortColumn=null,this._sortDirection="asc",this._selectedRowKeys=new Set,this._draggedRowIndex=null,this._dragOverRowIndex=null,this._isDragHandleGrabbed=!1,this._draggedColumnIndex=null,this._dragOverColumnIndex=null,this._displayDataCache=[],this._displayDataCacheKey="",this._reactRoots=new Map,this._uniqueId=Math.random().toString(36).substring(2,9)}get _isServerSidePagination(){return this.totalItems>0}get _totalCount(){return this._isServerSidePagination?this.totalItems:this.data.length}get _totalPages(){return Math.ceil(this._totalCount/this.pageSize)}get _displayData(){const e=this._computeCacheKey();if(e===this._displayDataCacheKey)return this._displayDataCache;let t=[...this.data];if(this.sortable&&this._sortColumn&&(t=this._sortData(t)),this.pagination&&!this._isServerSidePagination&&this.data.length>this.pageSize){const a=this.pageIndex*this.pageSize,r=a+this.pageSize;t=t.slice(a,r)}return this._displayDataCacheKey=e,this._displayDataCache=t,t}disconnectedCallback(){super.disconnectedCallback(),this._reactRoots.forEach(({unmount:e})=>e()),this._reactRoots.clear()}willUpdate(e){super.willUpdate(e),e.has("data")&&this.clearSelectionOnDataChange&&(this._selectedRowKeys=new Set),(e.has("data")||e.has("pageSize"))&&this.pageIndex>=this._totalPages&&this._totalPages>0&&(this.pageIndex=this._totalPages-1)}_computeCacheKey(){let e="empty";if(this.data.length>0){const t=this.rowKey(this.data[0],0),a=this.rowKey(this.data[this.data.length-1],this.data.length-1),r=this.data.length>2?this.rowKey(this.data[Math.floor(this.data.length/2)],Math.floor(this.data.length/2)):"";e=`${this.data.length}-${t}-${r}-${a}`}return`${e}|${this._sortColumn}|${this._sortDirection}|${this.pageIndex}|${this.pageSize}|${this.totalItems}`}_sortData(e){const t=this._sortColumn,a=this._sortDirection;return[...e].sort((r,s)=>{const n=r[t],o=s[t];if(n==null&&o==null)return 0;if(n==null)return a==="asc"?1:-1;if(o==null)return a==="asc"?-1:1;if(typeof n=="number"&&typeof o=="number")return a==="asc"?n-o:o-n;if(n instanceof Date&&o instanceof Date)return a==="asc"?n.getTime()-o.getTime():o.getTime()-n.getTime();const h=String(n).toLowerCase(),c=String(o).toLowerCase();return h<c?a==="asc"?-1:1:h>c?a==="asc"?1:-1:0})}_getRowKey(e,t){return this.rowKey(e,t)}_getActualDataIndex(e){return this.data.indexOf(e)}_isColumnSortable(e){return e.sortable!==void 0?e.sortable:this.sortable}_getColumnAlignment(e){return e.align?e.align:e.type==="number"||e.type==="currency"?"right":e.type==="boolean"?"center":"left"}_getColspan(){return this.columns.length+(this.selectable?1:0)+(this.draggableRows?1:0)}_handleSort(e){if(!this._isColumnSortable(e))return;const t=this._sortColumn===e.id&&this._sortDirection==="asc"?"desc":"asc";this._sortColumn=e.id,this._sortDirection=t,this.dispatchEvent(new CustomEvent("pd-table-sort",{detail:{columnId:e.id,direction:t},bubbles:!0,composed:!0}))}_handleHeaderKeyDown(e,t){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._handleSort(t))}_handleSelectAll(e){const t=e.target,a=new Set;t.checked&&this.data.forEach((r,s)=>{a.add(this._getRowKey(r,s))}),this._selectedRowKeys=a,this._emitSelectionChange()}_handleSelectRow(e,t,a){const r=this._getRowKey(e,t),s=new Set(this._selectedRowKeys);a?s.add(r):s.delete(r),this._selectedRowKeys=s,this._emitSelectionChange()}_emitSelectionChange(){const e=this.data.filter((t,a)=>this._selectedRowKeys.has(this._getRowKey(t,a)));this.dispatchEvent(new CustomEvent("pd-table-selection-change",{detail:{selectedKeys:Array.from(this._selectedRowKeys),selectedRows:e},bubbles:!0,composed:!0}))}_handleRowClick(e,t){this.dispatchEvent(new CustomEvent("pd-table-row-click",{detail:{row:e,index:t},bubbles:!0,composed:!0}))}_handleCellChange(e,t,a,r){const s=r.target,n=e[a.id];let o=s.value;if(a.type==="number"||a.type==="currency"){const h=parseFloat(s.value);o=isNaN(h)?null:h}this.dispatchEvent(new CustomEvent("pd-table-cell-change",{detail:{row:e,rowIndex:t,columnId:a.id,value:o,previousValue:n},bubbles:!0,composed:!0}))}_onDragStart(e,t){if(!this.draggableRows||!this._isDragHandleGrabbed){e.preventDefault();return}this._draggedRowIndex=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(t))),requestAnimationFrame(()=>{e.target.classList.add("dragging")})}_onDragOver(e,t){!this.draggableRows||this._draggedRowIndex===null||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this._dragOverRowIndex!==t&&(this._dragOverRowIndex=t))}_onDragEnd(e){this._resetDragState(),e.target.classList.remove("dragging")}_onDrop(e,t){if(e.preventDefault(),!this.draggableRows||this._draggedRowIndex===null)return;const a=this._draggedRowIndex;a!==t&&(this._sortColumn=null,this._sortDirection="asc",this.dispatchEvent(new CustomEvent("pd-table-row-reorder",{detail:{fromIndex:a,toIndex:t,item:this.data[a]},bubbles:!0,composed:!0}))),this._resetDragState()}_resetDragState(){this._draggedRowIndex=null,this._dragOverRowIndex=null,this._isDragHandleGrabbed=!1}_handleDragHandleMouseDown(){this._isDragHandleGrabbed=!0}_handleDragHandleMouseUp(){this._isDragHandleGrabbed=!1}_handleDragHandleKeyDown(e,t){e.key==="ArrowUp"&&t>0?(e.preventDefault(),this._emitReorder(t,t-1)):e.key==="ArrowDown"&&t<this.data.length-1&&(e.preventDefault(),this._emitReorder(t,t+1))}_emitReorder(e,t){this._sortColumn=null,this._sortDirection="asc",this.dispatchEvent(new CustomEvent("pd-table-row-reorder",{detail:{fromIndex:e,toIndex:t,item:this.data[e]},bubbles:!0,composed:!0}))}_onColumnDragStart(e,t){if(!this.draggableColumns){e.preventDefault();return}this._draggedColumnIndex=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",`column:${t}`)),requestAnimationFrame(()=>{e.target.classList.add("column-dragging")})}_onColumnDragOver(e,t){!this.draggableColumns||this._draggedColumnIndex===null||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this._dragOverColumnIndex!==t&&(this._dragOverColumnIndex=t))}_onColumnDragEnd(e){this._resetColumnDragState(),e.target.classList.remove("column-dragging")}_onColumnDrop(e,t){if(e.preventDefault(),!this.draggableColumns||this._draggedColumnIndex===null)return;const a=this._draggedColumnIndex;a!==t&&this.dispatchEvent(new CustomEvent("pd-table-column-reorder",{detail:{fromIndex:a,toIndex:t,column:this.columns[a]},bubbles:!0,composed:!0})),this._resetColumnDragState()}_resetColumnDragState(){this._draggedColumnIndex=null,this._dragOverColumnIndex=null}_handleColumnHeaderKeyDown(e,t){this.draggableColumns&&(e.key==="ArrowLeft"&&t>0?(e.preventDefault(),this._emitColumnReorder(t,t-1)):e.key==="ArrowRight"&&t<this.columns.length-1&&(e.preventDefault(),this._emitColumnReorder(t,t+1)))}_emitColumnReorder(e,t){this.dispatchEvent(new CustomEvent("pd-table-column-reorder",{detail:{fromIndex:e,toIndex:t,column:this.columns[e]},bubbles:!0,composed:!0}))}_handlePageChange(e){e<0||e>=this._totalPages||(this.pageIndex=e,this.dispatchEvent(new CustomEvent("pd-table-page-change",{detail:{pageIndex:e,pageSize:this.pageSize},bubbles:!0,composed:!0})))}_handlePageSizeChange(e){const t=parseInt(e.detail.value,10);this.pageSize=t,this.pageIndex=0,this.dispatchEvent(new CustomEvent("pd-table-page-change",{detail:{pageIndex:0,pageSize:t},bubbles:!0,composed:!0}))}_renderHeader(){const e=this.data.length>0&&this._selectedRowKeys.size===this.data.length,t=this._selectedRowKeys.size>0&&this._selectedRowKeys.size<this.data.length;return i.html`
|
|
2
2
|
<thead>
|
|
3
3
|
<tr role="row">
|
|
4
|
-
${this.draggableRows?
|
|
4
|
+
${this.draggableRows?i.html`
|
|
5
5
|
<th class="drag-handle-header" role="columnheader" aria-label="Reorder">
|
|
6
6
|
<span class="visually-hidden">Reorder</span>
|
|
7
7
|
</th>
|
|
8
|
-
`:
|
|
8
|
+
`:i.nothing}
|
|
9
9
|
|
|
10
|
-
${this.selectable?
|
|
10
|
+
${this.selectable?i.html`
|
|
11
11
|
<th class="checkbox-cell" role="columnheader">
|
|
12
12
|
<pd-checkbox
|
|
13
13
|
aria-label="Select all rows"
|
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
@change=${this._handleSelectAll}
|
|
17
17
|
></pd-checkbox>
|
|
18
18
|
</th>
|
|
19
|
-
`:
|
|
19
|
+
`:i.nothing}
|
|
20
20
|
|
|
21
21
|
${this.columns.map((a,r)=>this._renderHeaderCell(a,r))}
|
|
22
22
|
</tr>
|
|
23
23
|
</thead>
|
|
24
|
-
`}_renderHeaderCell(e,t){const a=this._isColumnSortable(e),r=this._getColumnAlignment(e),
|
|
24
|
+
`}_renderHeaderCell(e,t){const a=this._isColumnSortable(e),r=this._getColumnAlignment(e),s=this._sortColumn===e.id,n=this._draggedColumnIndex===t,o=this._dragOverColumnIndex===t&&!n,h=s?this._sortDirection==="asc"?"ascending":"descending":"none";return i.html`
|
|
25
25
|
<th
|
|
26
26
|
role="columnheader"
|
|
27
|
-
class=${g.classMap({sortable:a,sorted:
|
|
27
|
+
class=${g.classMap({sortable:a,sorted:s,[`align-${r}`]:!0,"column-draggable":this.draggableColumns,"column-dragging":n,"column-drag-over":o})}
|
|
28
28
|
style=${e.width?`width: ${e.width};`:""}${e.minWidth?` min-width: ${e.minWidth};`:""}
|
|
29
|
-
aria-sort=${a?h:
|
|
30
|
-
tabindex=${a||this.draggableColumns?"0":
|
|
29
|
+
aria-sort=${a?h:i.nothing}
|
|
30
|
+
tabindex=${a||this.draggableColumns?"0":i.nothing}
|
|
31
31
|
draggable=${this.draggableColumns?"true":"false"}
|
|
32
32
|
@click=${()=>this._handleSort(e)}
|
|
33
33
|
@keydown=${c=>{this._handleHeaderKeyDown(c,e),this._handleColumnHeaderKeyDown(c,t)}}
|
|
@@ -37,54 +37,54 @@
|
|
|
37
37
|
@dragend=${c=>this._onColumnDragEnd(c)}
|
|
38
38
|
>
|
|
39
39
|
<div class=${g.classMap({"header-content":!0,[`align-${r}`]:!0})}>
|
|
40
|
-
${this.draggableColumns?
|
|
40
|
+
${this.draggableColumns?i.html`
|
|
41
41
|
<pd-icon
|
|
42
42
|
class="column-drag-handle"
|
|
43
43
|
name="drag_indicator"
|
|
44
44
|
size="small"
|
|
45
45
|
aria-hidden="true"
|
|
46
46
|
></pd-icon>
|
|
47
|
-
`:
|
|
47
|
+
`:i.nothing}
|
|
48
48
|
<span class="header-text">${e.header}</span>
|
|
49
|
-
${a?
|
|
49
|
+
${a?i.html`
|
|
50
50
|
<pd-icon
|
|
51
|
-
class=${g.classMap({"sort-icon":!0,"sort-icon-visible":
|
|
51
|
+
class=${g.classMap({"sort-icon":!0,"sort-icon-visible":s,"sort-icon-desc":s&&this._sortDirection==="desc"})}
|
|
52
52
|
name="arrow_upward"
|
|
53
53
|
size="small"
|
|
54
54
|
aria-hidden="true"
|
|
55
55
|
></pd-icon>
|
|
56
|
-
`:
|
|
56
|
+
`:i.nothing}
|
|
57
57
|
</div>
|
|
58
58
|
</th>
|
|
59
|
-
`}_renderCell(e,t,a){if(a.cellTemplate)
|
|
59
|
+
`}_renderCell(e,t,a){if(a.cellTemplate){const s=a.cellTemplate(e,t);if(this._isReactElement(s)){const n=`${this.rowKey(e,t)}-${a.id}`;return this._renderReactCellContent(s,n)}return s}const r=e[a.id];if(a.editable)return this._renderEditableCell(e,t,a,r);switch(a.type){case"currency":return this._formatCurrency(r,a.currencyCode);case"number":return this._formatNumber(r);case"date":return this._formatDate(r);case"boolean":return this._renderBoolean(r);default:return r!=null?String(r):""}}_renderEditableCell(e,t,a,r){const s=a.type==="number"||a.type==="currency"?"number":"text";return i.html`
|
|
60
60
|
<pd-text-field
|
|
61
|
-
type=${
|
|
61
|
+
type=${s}
|
|
62
62
|
.value=${r!=null?String(r):""}
|
|
63
63
|
aria-label="${a.header}"
|
|
64
|
-
@change=${
|
|
65
|
-
@click=${
|
|
64
|
+
@change=${n=>this._handleCellChange(e,t,a,n)}
|
|
65
|
+
@click=${n=>n.stopPropagation()}
|
|
66
66
|
style="width: 100%;"
|
|
67
67
|
></pd-text-field>
|
|
68
|
-
`}_formatCurrency(e,t){const a=Number(e);if(e==null||isNaN(a))return String(e??"");const r=t||this.currencyCode;try{return a.toLocaleString(this.locale,{style:"currency",currency:r})}catch{return a.toLocaleString(this.locale)}}_formatNumber(e){const t=Number(e);return e==null||isNaN(t)?String(e??""):t.toLocaleString(this.locale)}_formatDate(e){if(e==null)return"";const t=e instanceof Date?e:new Date(String(e));return isNaN(t.getTime())?String(e):t.toLocaleDateString(this.locale)}_renderBoolean(e){const t=!!e;return
|
|
68
|
+
`}_formatCurrency(e,t){const a=Number(e);if(e==null||isNaN(a))return String(e??"");const r=t||this.currencyCode;try{return a.toLocaleString(this.locale,{style:"currency",currency:r})}catch{return a.toLocaleString(this.locale)}}_formatNumber(e){const t=Number(e);return e==null||isNaN(t)?String(e??""):t.toLocaleString(this.locale)}_formatDate(e){if(e==null)return"";const t=e instanceof Date?e:new Date(String(e));return isNaN(t.getTime())?String(e):t.toLocaleDateString(this.locale)}_renderBoolean(e){const t=!!e;return i.html`
|
|
69
69
|
<pd-icon
|
|
70
70
|
name=${t?"check":"close"}
|
|
71
71
|
size="small"
|
|
72
72
|
aria-label=${t?"Yes":"No"}
|
|
73
73
|
class=${g.classMap({"boolean-true":t,"boolean-false":!t})}
|
|
74
74
|
></pd-icon>
|
|
75
|
-
`}_renderRow(e,t){const a=this._getRowKey(e,t),r=this._selectedRowKeys.has(a),
|
|
75
|
+
`}_isReactElement(e){return typeof e=="object"&&e!==null&&"$$typeof"in e}_renderReactCellContent(e,t){return i.html`<span style="display:contents" ${b.ref(a=>{if(!a){this._reactRoots.get(t)?.unmount(),this._reactRoots.delete(t);return}const r=this._reactRoots.get(t);if(r){r.render(e);return}Promise.resolve().then(()=>require("../client-CjTRT4wy.cjs")).then(s=>s.client).then(({createRoot:s})=>{if(this._reactRoots.has(t))this._reactRoots.get(t).render(e);else{const n=s(a);n.render(e),this._reactRoots.set(t,{render:o=>n.render(o),unmount:()=>n.unmount()})}})})}></span>`}_renderRow(e,t){const a=this._getRowKey(e,t),r=this._selectedRowKeys.has(a),s=this._draggedRowIndex===t,n=this._dragOverRowIndex===t&&!s;return i.html`
|
|
76
76
|
<tr
|
|
77
77
|
role="row"
|
|
78
|
-
class=${g.classMap({selected:r,draggable:this.draggableRows,dragging:
|
|
79
|
-
aria-selected=${this.selectable?String(r):
|
|
78
|
+
class=${g.classMap({selected:r,draggable:this.draggableRows,dragging:s,"drag-over":n})}
|
|
79
|
+
aria-selected=${this.selectable?String(r):i.nothing}
|
|
80
80
|
draggable=${this.draggableRows?"true":"false"}
|
|
81
|
-
@dragstart=${
|
|
82
|
-
@dragover=${
|
|
83
|
-
@drop=${
|
|
84
|
-
@dragend=${
|
|
81
|
+
@dragstart=${o=>this._onDragStart(o,t)}
|
|
82
|
+
@dragover=${o=>this._onDragOver(o,t)}
|
|
83
|
+
@drop=${o=>this._onDrop(o,t)}
|
|
84
|
+
@dragend=${o=>this._onDragEnd(o)}
|
|
85
85
|
@click=${()=>this._handleRowClick(e,t)}
|
|
86
86
|
>
|
|
87
|
-
${this.draggableRows?
|
|
87
|
+
${this.draggableRows?i.html`
|
|
88
88
|
<td class="drag-handle-cell" role="cell">
|
|
89
89
|
<pd-icon
|
|
90
90
|
name="drag_indicator"
|
|
@@ -95,32 +95,32 @@
|
|
|
95
95
|
aria-label="Drag to reorder row. Use arrow keys to move up or down."
|
|
96
96
|
@mousedown=${this._handleDragHandleMouseDown}
|
|
97
97
|
@mouseup=${this._handleDragHandleMouseUp}
|
|
98
|
-
@keydown=${
|
|
98
|
+
@keydown=${o=>this._handleDragHandleKeyDown(o,t)}
|
|
99
99
|
></pd-icon>
|
|
100
100
|
</td>
|
|
101
|
-
`:
|
|
101
|
+
`:i.nothing}
|
|
102
102
|
|
|
103
|
-
${this.selectable?
|
|
103
|
+
${this.selectable?i.html`
|
|
104
104
|
<td class="checkbox-cell" role="cell">
|
|
105
105
|
<pd-checkbox
|
|
106
106
|
aria-label="Select row"
|
|
107
107
|
?checked=${r}
|
|
108
|
-
@change=${
|
|
109
|
-
@click=${
|
|
108
|
+
@change=${o=>{const h=o.target;this._handleSelectRow(e,t,h.checked)}}
|
|
109
|
+
@click=${o=>o.stopPropagation()}
|
|
110
110
|
></pd-checkbox>
|
|
111
111
|
</td>
|
|
112
|
-
`:
|
|
112
|
+
`:i.nothing}
|
|
113
113
|
|
|
114
|
-
${this.columns.map(
|
|
114
|
+
${this.columns.map(o=>i.html`
|
|
115
115
|
<td
|
|
116
116
|
role="cell"
|
|
117
|
-
class=${g.classMap({[`align-${this._getColumnAlignment(
|
|
117
|
+
class=${g.classMap({[`align-${this._getColumnAlignment(o)}`]:!0,editable:!!o.editable})}
|
|
118
118
|
>
|
|
119
|
-
${this._renderCell(e,t,
|
|
119
|
+
${this._renderCell(e,t,o)}
|
|
120
120
|
</td>
|
|
121
121
|
`)}
|
|
122
122
|
</tr>
|
|
123
|
-
`}_renderEmptyState(){return
|
|
123
|
+
`}_renderEmptyState(){return i.html`
|
|
124
124
|
<tr class="state-row">
|
|
125
125
|
<td colspan=${this._getColspan()} class="no-data">
|
|
126
126
|
<slot name="no-data">
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</slot>
|
|
132
132
|
</td>
|
|
133
133
|
</tr>
|
|
134
|
-
`}_renderLoadingState(){return
|
|
134
|
+
`}_renderLoadingState(){return i.html`
|
|
135
135
|
<tr class="state-row">
|
|
136
136
|
<td colspan=${this._getColspan()} class="loading-cell">
|
|
137
137
|
<slot name="loading">
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
</slot>
|
|
142
142
|
</td>
|
|
143
143
|
</tr>
|
|
144
|
-
`}_renderPagination(){if(!this.pagination)return
|
|
144
|
+
`}_renderPagination(){if(!this.pagination)return i.nothing;const e=this._totalCount,t=e===0?0:this.pageIndex*this.pageSize+1,a=Math.min((this.pageIndex+1)*this.pageSize,e),r=this.pageIndex===0,s=this.pageIndex>=this._totalPages-1||e===0;return i.html`
|
|
145
145
|
<nav class="pagination">
|
|
146
146
|
<div class="items-per-page">
|
|
147
147
|
<label id="page-size-label-${this._uniqueId}">Items per page:</label>
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
variant="filled"
|
|
151
151
|
aria-labelledby="page-size-label-${this._uniqueId}"
|
|
152
152
|
.value=${this.pageSize.toString()}
|
|
153
|
-
.options=${this.pageSizeOptions.map(
|
|
153
|
+
.options=${this.pageSizeOptions.map(n=>({value:String(n),label:String(n)}))}
|
|
154
154
|
@change=${this._handlePageSizeChange}
|
|
155
155
|
></pd-select>
|
|
156
156
|
</div>
|
|
@@ -177,19 +177,19 @@
|
|
|
177
177
|
<pd-icon-button
|
|
178
178
|
icon="chevron_right"
|
|
179
179
|
aria-label="Next page"
|
|
180
|
-
?disabled=${
|
|
180
|
+
?disabled=${s}
|
|
181
181
|
@click=${()=>this._handlePageChange(this.pageIndex+1)}
|
|
182
182
|
></pd-icon-button>
|
|
183
183
|
<pd-icon-button
|
|
184
184
|
icon="last_page"
|
|
185
185
|
aria-label="Last page"
|
|
186
|
-
?disabled=${
|
|
186
|
+
?disabled=${s}
|
|
187
187
|
@click=${()=>this._handlePageChange(this._totalPages-1)}
|
|
188
188
|
></pd-icon-button>
|
|
189
189
|
</div>
|
|
190
190
|
|
|
191
191
|
</nav>
|
|
192
|
-
`}render(){const e=this._displayData,t=e.length===0&&!this.loading;return
|
|
192
|
+
`}render(){const e=this._displayData,t=e.length===0&&!this.loading;return i.html`
|
|
193
193
|
<div class="table-wrapper">
|
|
194
194
|
<div class="table-container">
|
|
195
195
|
<table
|
|
@@ -199,15 +199,15 @@
|
|
|
199
199
|
>
|
|
200
200
|
${this._renderHeader()}
|
|
201
201
|
<tbody>
|
|
202
|
-
${this.loading?this._renderLoadingState():
|
|
203
|
-
${t?this._renderEmptyState():
|
|
204
|
-
${this.loading?
|
|
202
|
+
${this.loading?this._renderLoadingState():i.nothing}
|
|
203
|
+
${t?this._renderEmptyState():i.nothing}
|
|
204
|
+
${this.loading?i.nothing:u.repeat(e,a=>{const r=this._getActualDataIndex(a);return this._getRowKey(a,r)},a=>{const r=this._getActualDataIndex(a);return this._renderRow(a,r)})}
|
|
205
205
|
</tbody>
|
|
206
206
|
</table>
|
|
207
207
|
</div>
|
|
208
208
|
${this._renderPagination()}
|
|
209
209
|
</div>
|
|
210
|
-
`}clearSelection(){this._selectedRowKeys=new Set,this._emitSelectionChange()}selectByKeys(e){this._selectedRowKeys=new Set(e.map(t=>String(t))),this._emitSelectionChange()}selectAll(){const e=this.data.map((t,a)=>this._getRowKey(t,a));this._selectedRowKeys=new Set(e),this._emitSelectionChange()}getSelectedRows(){return this.data.filter((e,t)=>this._selectedRowKeys.has(this._getRowKey(e,t)))}getSelectedKeys(){return Array.from(this._selectedRowKeys)}clearSort(){this._sortColumn=null,this._sortDirection="asc"}setSort(e,t="asc"){this._sortColumn=e,this._sortDirection=t}goToPage(e){this._handlePageChange(e)}invalidateCache(){this._displayDataCacheKey=""}};exports.PdTable.styles=
|
|
210
|
+
`}clearSelection(){this._selectedRowKeys=new Set,this._emitSelectionChange()}selectByKeys(e){this._selectedRowKeys=new Set(e.map(t=>String(t))),this._emitSelectionChange()}selectAll(){const e=this.data.map((t,a)=>this._getRowKey(t,a));this._selectedRowKeys=new Set(e),this._emitSelectionChange()}getSelectedRows(){return this.data.filter((e,t)=>this._selectedRowKeys.has(this._getRowKey(e,t)))}getSelectedKeys(){return Array.from(this._selectedRowKeys)}clearSort(){this._sortColumn=null,this._sortDirection="asc"}setSort(e,t="asc"){this._sortColumn=e,this._sortDirection=t}goToPage(e){this._handlePageChange(e)}invalidateCache(){this._displayDataCacheKey=""}};exports.PdTable.styles=i.css`
|
|
211
211
|
:host {
|
|
212
212
|
display: block;
|
|
213
213
|
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { css as b, LitElement as
|
|
2
|
-
import { property as c, state as u, customElement as
|
|
1
|
+
import { css as b, LitElement as _, nothing as g, html as d } from "lit";
|
|
2
|
+
import { property as c, state as u, customElement as y } from "lit/decorators.js";
|
|
3
3
|
import { repeat as f } from "lit/directives/repeat.js";
|
|
4
4
|
import { classMap as m } from "lit/directives/class-map.js";
|
|
5
|
+
import { ref as v } from "lit/directives/ref.js";
|
|
5
6
|
import "./pd-icon.es.js";
|
|
6
7
|
import "./pd-checkbox.es.js";
|
|
7
8
|
import "./pd-text-field.es.js";
|
|
8
9
|
import "./pd-icon-button.es.js";
|
|
9
10
|
import "./pd-select.es.js";
|
|
10
11
|
import "./pd-menu-item.es.js";
|
|
11
|
-
var
|
|
12
|
-
for (var
|
|
13
|
-
(
|
|
14
|
-
return r &&
|
|
12
|
+
var w = Object.defineProperty, C = Object.getOwnPropertyDescriptor, l = (e, t, a, r) => {
|
|
13
|
+
for (var s = r > 1 ? void 0 : r ? C(t, a) : t, n = e.length - 1, o; n >= 0; n--)
|
|
14
|
+
(o = e[n]) && (s = (r ? o(t, a, s) : o(s)) || s);
|
|
15
|
+
return r && s && w(t, a, s), s;
|
|
15
16
|
};
|
|
16
|
-
let i = class extends
|
|
17
|
+
let i = class extends _ {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments), this.columns = [], this.data = [], this.rowKey = (e, t) => {
|
|
19
20
|
const a = e.id;
|
|
20
21
|
return a != null ? String(a) : `__idx_${t}`;
|
|
21
|
-
}, this.selectable = !1, this.sortable = !1, this.pagination = !1, this.pageSize = 10, this.pageIndex = 0, this.totalItems = 0, this.draggableRows = !1, this.draggableColumns = !1, this.loading = !1, this.clearSelectionOnDataChange = !1, this.currencyCode = "EUR", this.pageSizeOptions = [5, 10, 25, 50, 100], this._sortColumn = null, this._sortDirection = "asc", this._selectedRowKeys = /* @__PURE__ */ new Set(), this._draggedRowIndex = null, this._dragOverRowIndex = null, this._isDragHandleGrabbed = !1, this._draggedColumnIndex = null, this._dragOverColumnIndex = null, this._displayDataCache = [], this._displayDataCacheKey = "", this._uniqueId = Math.random().toString(36).substring(2, 9);
|
|
22
|
+
}, this.selectable = !1, this.sortable = !1, this.pagination = !1, this.pageSize = 10, this.pageIndex = 0, this.totalItems = 0, this.draggableRows = !1, this.draggableColumns = !1, this.loading = !1, this.clearSelectionOnDataChange = !1, this.currencyCode = "EUR", this.pageSizeOptions = [5, 10, 25, 50, 100], this._sortColumn = null, this._sortDirection = "asc", this._selectedRowKeys = /* @__PURE__ */ new Set(), this._draggedRowIndex = null, this._dragOverRowIndex = null, this._isDragHandleGrabbed = !1, this._draggedColumnIndex = null, this._dragOverColumnIndex = null, this._displayDataCache = [], this._displayDataCacheKey = "", this._reactRoots = /* @__PURE__ */ new Map(), this._uniqueId = Math.random().toString(36).substring(2, 9);
|
|
22
23
|
}
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
24
25
|
// Getters
|
|
@@ -53,6 +54,9 @@ let i = class extends y {
|
|
|
53
54
|
// ---------------------------------------------------------------------------
|
|
54
55
|
// Lifecycle
|
|
55
56
|
// ---------------------------------------------------------------------------
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
super.disconnectedCallback(), this._reactRoots.forEach(({ unmount: e }) => e()), this._reactRoots.clear();
|
|
59
|
+
}
|
|
56
60
|
willUpdate(e) {
|
|
57
61
|
super.willUpdate(e), e.has("data") && this.clearSelectionOnDataChange && (this._selectedRowKeys = /* @__PURE__ */ new Set()), (e.has("data") || e.has("pageSize")) && this.pageIndex >= this._totalPages && this._totalPages > 0 && (this.pageIndex = this._totalPages - 1);
|
|
58
62
|
}
|
|
@@ -69,16 +73,16 @@ let i = class extends y {
|
|
|
69
73
|
}
|
|
70
74
|
_sortData(e) {
|
|
71
75
|
const t = this._sortColumn, a = this._sortDirection;
|
|
72
|
-
return [...e].sort((r,
|
|
73
|
-
const n = r[t],
|
|
74
|
-
if (n == null &&
|
|
76
|
+
return [...e].sort((r, s) => {
|
|
77
|
+
const n = r[t], o = s[t];
|
|
78
|
+
if (n == null && o == null) return 0;
|
|
75
79
|
if (n == null) return a === "asc" ? 1 : -1;
|
|
76
|
-
if (
|
|
77
|
-
if (typeof n == "number" && typeof
|
|
78
|
-
return a === "asc" ? n -
|
|
79
|
-
if (n instanceof Date &&
|
|
80
|
-
return a === "asc" ? n.getTime() -
|
|
81
|
-
const p = String(n).toLowerCase(), h = String(
|
|
80
|
+
if (o == null) return a === "asc" ? -1 : 1;
|
|
81
|
+
if (typeof n == "number" && typeof o == "number")
|
|
82
|
+
return a === "asc" ? n - o : o - n;
|
|
83
|
+
if (n instanceof Date && o instanceof Date)
|
|
84
|
+
return a === "asc" ? n.getTime() - o.getTime() : o.getTime() - n.getTime();
|
|
85
|
+
const p = String(n).toLowerCase(), h = String(o).toLowerCase();
|
|
82
86
|
return p < h ? a === "asc" ? -1 : 1 : p > h ? a === "asc" ? 1 : -1 : 0;
|
|
83
87
|
});
|
|
84
88
|
}
|
|
@@ -121,13 +125,13 @@ let i = class extends y {
|
|
|
121
125
|
// ---------------------------------------------------------------------------
|
|
122
126
|
_handleSelectAll(e) {
|
|
123
127
|
const t = e.target, a = /* @__PURE__ */ new Set();
|
|
124
|
-
t.checked && this.data.forEach((r,
|
|
125
|
-
a.add(this._getRowKey(r,
|
|
128
|
+
t.checked && this.data.forEach((r, s) => {
|
|
129
|
+
a.add(this._getRowKey(r, s));
|
|
126
130
|
}), this._selectedRowKeys = a, this._emitSelectionChange();
|
|
127
131
|
}
|
|
128
132
|
_handleSelectRow(e, t, a) {
|
|
129
|
-
const r = this._getRowKey(e, t),
|
|
130
|
-
a ?
|
|
133
|
+
const r = this._getRowKey(e, t), s = new Set(this._selectedRowKeys);
|
|
134
|
+
a ? s.add(r) : s.delete(r), this._selectedRowKeys = s, this._emitSelectionChange();
|
|
131
135
|
}
|
|
132
136
|
_emitSelectionChange() {
|
|
133
137
|
const e = this.data.filter(
|
|
@@ -153,18 +157,18 @@ let i = class extends y {
|
|
|
153
157
|
}));
|
|
154
158
|
}
|
|
155
159
|
_handleCellChange(e, t, a, r) {
|
|
156
|
-
const
|
|
157
|
-
let
|
|
160
|
+
const s = r.target, n = e[a.id];
|
|
161
|
+
let o = s.value;
|
|
158
162
|
if (a.type === "number" || a.type === "currency") {
|
|
159
|
-
const p = parseFloat(
|
|
160
|
-
|
|
163
|
+
const p = parseFloat(s.value);
|
|
164
|
+
o = isNaN(p) ? null : p;
|
|
161
165
|
}
|
|
162
166
|
this.dispatchEvent(new CustomEvent("pd-table-cell-change", {
|
|
163
167
|
detail: {
|
|
164
168
|
row: e,
|
|
165
169
|
rowIndex: t,
|
|
166
170
|
columnId: a.id,
|
|
167
|
-
value:
|
|
171
|
+
value: o,
|
|
168
172
|
previousValue: n
|
|
169
173
|
},
|
|
170
174
|
bubbles: !0,
|
|
@@ -322,17 +326,17 @@ let i = class extends y {
|
|
|
322
326
|
`;
|
|
323
327
|
}
|
|
324
328
|
_renderHeaderCell(e, t) {
|
|
325
|
-
const a = this._isColumnSortable(e), r = this._getColumnAlignment(e),
|
|
329
|
+
const a = this._isColumnSortable(e), r = this._getColumnAlignment(e), s = this._sortColumn === e.id, n = this._draggedColumnIndex === t, o = this._dragOverColumnIndex === t && !n, p = s ? this._sortDirection === "asc" ? "ascending" : "descending" : "none";
|
|
326
330
|
return d`
|
|
327
331
|
<th
|
|
328
332
|
role="columnheader"
|
|
329
333
|
class=${m({
|
|
330
334
|
sortable: a,
|
|
331
|
-
sorted:
|
|
335
|
+
sorted: s,
|
|
332
336
|
[`align-${r}`]: !0,
|
|
333
337
|
"column-draggable": this.draggableColumns,
|
|
334
338
|
"column-dragging": n,
|
|
335
|
-
"column-drag-over":
|
|
339
|
+
"column-drag-over": o
|
|
336
340
|
})}
|
|
337
341
|
style=${e.width ? `width: ${e.width};` : ""}${e.minWidth ? ` min-width: ${e.minWidth};` : ""}
|
|
338
342
|
aria-sort=${a ? p : g}
|
|
@@ -364,8 +368,8 @@ let i = class extends y {
|
|
|
364
368
|
<pd-icon
|
|
365
369
|
class=${m({
|
|
366
370
|
"sort-icon": !0,
|
|
367
|
-
"sort-icon-visible":
|
|
368
|
-
"sort-icon-desc":
|
|
371
|
+
"sort-icon-visible": s,
|
|
372
|
+
"sort-icon-desc": s && this._sortDirection === "desc"
|
|
369
373
|
})}
|
|
370
374
|
name="arrow_upward"
|
|
371
375
|
size="small"
|
|
@@ -380,8 +384,14 @@ let i = class extends y {
|
|
|
380
384
|
// Rendering - Cells
|
|
381
385
|
// ---------------------------------------------------------------------------
|
|
382
386
|
_renderCell(e, t, a) {
|
|
383
|
-
if (a.cellTemplate)
|
|
384
|
-
|
|
387
|
+
if (a.cellTemplate) {
|
|
388
|
+
const s = a.cellTemplate(e, t);
|
|
389
|
+
if (this._isReactElement(s)) {
|
|
390
|
+
const n = `${this.rowKey(e, t)}-${a.id}`;
|
|
391
|
+
return this._renderReactCellContent(s, n);
|
|
392
|
+
}
|
|
393
|
+
return s;
|
|
394
|
+
}
|
|
385
395
|
const r = e[a.id];
|
|
386
396
|
if (a.editable)
|
|
387
397
|
return this._renderEditableCell(e, t, a, r);
|
|
@@ -399,10 +409,10 @@ let i = class extends y {
|
|
|
399
409
|
}
|
|
400
410
|
}
|
|
401
411
|
_renderEditableCell(e, t, a, r) {
|
|
402
|
-
const
|
|
412
|
+
const s = a.type === "number" || a.type === "currency" ? "number" : "text";
|
|
403
413
|
return d`
|
|
404
414
|
<pd-text-field
|
|
405
|
-
type=${
|
|
415
|
+
type=${s}
|
|
406
416
|
.value=${r != null ? String(r) : ""}
|
|
407
417
|
aria-label="${a.header}"
|
|
408
418
|
@change=${(n) => this._handleCellChange(e, t, a, n)}
|
|
@@ -444,26 +454,53 @@ let i = class extends y {
|
|
|
444
454
|
></pd-icon>
|
|
445
455
|
`;
|
|
446
456
|
}
|
|
457
|
+
_isReactElement(e) {
|
|
458
|
+
return typeof e == "object" && e !== null && "$$typeof" in e;
|
|
459
|
+
}
|
|
460
|
+
_renderReactCellContent(e, t) {
|
|
461
|
+
return d`<span style="display:contents" ${v((a) => {
|
|
462
|
+
if (!a) {
|
|
463
|
+
this._reactRoots.get(t)?.unmount(), this._reactRoots.delete(t);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const r = this._reactRoots.get(t);
|
|
467
|
+
if (r) {
|
|
468
|
+
r.render(e);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
import("../client-C4NwtAXt.js").then((s) => s.c).then(({ createRoot: s }) => {
|
|
472
|
+
if (this._reactRoots.has(t))
|
|
473
|
+
this._reactRoots.get(t).render(e);
|
|
474
|
+
else {
|
|
475
|
+
const n = s(a);
|
|
476
|
+
n.render(e), this._reactRoots.set(t, {
|
|
477
|
+
render: (o) => n.render(o),
|
|
478
|
+
unmount: () => n.unmount()
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
})}></span>`;
|
|
483
|
+
}
|
|
447
484
|
// ---------------------------------------------------------------------------
|
|
448
485
|
// Rendering - Rows
|
|
449
486
|
// ---------------------------------------------------------------------------
|
|
450
487
|
_renderRow(e, t) {
|
|
451
|
-
const a = this._getRowKey(e, t), r = this._selectedRowKeys.has(a),
|
|
488
|
+
const a = this._getRowKey(e, t), r = this._selectedRowKeys.has(a), s = this._draggedRowIndex === t, n = this._dragOverRowIndex === t && !s;
|
|
452
489
|
return d`
|
|
453
490
|
<tr
|
|
454
491
|
role="row"
|
|
455
492
|
class=${m({
|
|
456
493
|
selected: r,
|
|
457
494
|
draggable: this.draggableRows,
|
|
458
|
-
dragging:
|
|
495
|
+
dragging: s,
|
|
459
496
|
"drag-over": n
|
|
460
497
|
})}
|
|
461
498
|
aria-selected=${this.selectable ? String(r) : g}
|
|
462
499
|
draggable=${this.draggableRows ? "true" : "false"}
|
|
463
|
-
@dragstart=${(
|
|
464
|
-
@dragover=${(
|
|
465
|
-
@drop=${(
|
|
466
|
-
@dragend=${(
|
|
500
|
+
@dragstart=${(o) => this._onDragStart(o, t)}
|
|
501
|
+
@dragover=${(o) => this._onDragOver(o, t)}
|
|
502
|
+
@drop=${(o) => this._onDrop(o, t)}
|
|
503
|
+
@dragend=${(o) => this._onDragEnd(o)}
|
|
467
504
|
@click=${() => this._handleRowClick(e, t)}
|
|
468
505
|
>
|
|
469
506
|
${this.draggableRows ? d`
|
|
@@ -477,7 +514,7 @@ let i = class extends y {
|
|
|
477
514
|
aria-label="Drag to reorder row. Use arrow keys to move up or down."
|
|
478
515
|
@mousedown=${this._handleDragHandleMouseDown}
|
|
479
516
|
@mouseup=${this._handleDragHandleMouseUp}
|
|
480
|
-
@keydown=${(
|
|
517
|
+
@keydown=${(o) => this._handleDragHandleKeyDown(o, t)}
|
|
481
518
|
></pd-icon>
|
|
482
519
|
</td>
|
|
483
520
|
` : g}
|
|
@@ -487,24 +524,24 @@ let i = class extends y {
|
|
|
487
524
|
<pd-checkbox
|
|
488
525
|
aria-label="Select row"
|
|
489
526
|
?checked=${r}
|
|
490
|
-
@change=${(
|
|
491
|
-
const p =
|
|
527
|
+
@change=${(o) => {
|
|
528
|
+
const p = o.target;
|
|
492
529
|
this._handleSelectRow(e, t, p.checked);
|
|
493
530
|
}}
|
|
494
|
-
@click=${(
|
|
531
|
+
@click=${(o) => o.stopPropagation()}
|
|
495
532
|
></pd-checkbox>
|
|
496
533
|
</td>
|
|
497
534
|
` : g}
|
|
498
535
|
|
|
499
|
-
${this.columns.map((
|
|
536
|
+
${this.columns.map((o) => d`
|
|
500
537
|
<td
|
|
501
538
|
role="cell"
|
|
502
539
|
class=${m({
|
|
503
|
-
[`align-${this._getColumnAlignment(
|
|
504
|
-
editable: !!
|
|
540
|
+
[`align-${this._getColumnAlignment(o)}`]: !0,
|
|
541
|
+
editable: !!o.editable
|
|
505
542
|
})}
|
|
506
543
|
>
|
|
507
|
-
${this._renderCell(e, t,
|
|
544
|
+
${this._renderCell(e, t, o)}
|
|
508
545
|
</td>
|
|
509
546
|
`)}
|
|
510
547
|
</tr>
|
|
@@ -545,7 +582,7 @@ let i = class extends y {
|
|
|
545
582
|
// ---------------------------------------------------------------------------
|
|
546
583
|
_renderPagination() {
|
|
547
584
|
if (!this.pagination) return g;
|
|
548
|
-
const e = this._totalCount, t = e === 0 ? 0 : this.pageIndex * this.pageSize + 1, a = Math.min((this.pageIndex + 1) * this.pageSize, e), r = this.pageIndex === 0,
|
|
585
|
+
const e = this._totalCount, t = e === 0 ? 0 : this.pageIndex * this.pageSize + 1, a = Math.min((this.pageIndex + 1) * this.pageSize, e), r = this.pageIndex === 0, s = this.pageIndex >= this._totalPages - 1 || e === 0;
|
|
549
586
|
return d`
|
|
550
587
|
<nav class="pagination">
|
|
551
588
|
<div class="items-per-page">
|
|
@@ -585,13 +622,13 @@ let i = class extends y {
|
|
|
585
622
|
<pd-icon-button
|
|
586
623
|
icon="chevron_right"
|
|
587
624
|
aria-label="Next page"
|
|
588
|
-
?disabled=${
|
|
625
|
+
?disabled=${s}
|
|
589
626
|
@click=${() => this._handlePageChange(this.pageIndex + 1)}
|
|
590
627
|
></pd-icon-button>
|
|
591
628
|
<pd-icon-button
|
|
592
629
|
icon="last_page"
|
|
593
630
|
aria-label="Last page"
|
|
594
|
-
?disabled=${
|
|
631
|
+
?disabled=${s}
|
|
595
632
|
@click=${() => this._handlePageChange(this._totalPages - 1)}
|
|
596
633
|
></pd-icon-button>
|
|
597
634
|
</div>
|
|
@@ -1098,7 +1135,7 @@ l([
|
|
|
1098
1135
|
u()
|
|
1099
1136
|
], i.prototype, "_dragOverColumnIndex", 2);
|
|
1100
1137
|
i = l([
|
|
1101
|
-
|
|
1138
|
+
y("pd-table")
|
|
1102
1139
|
], i);
|
|
1103
1140
|
export {
|
|
1104
1141
|
i as PdTable
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
2
3
|
import './pd-icon';
|
|
3
4
|
import './pd-checkbox';
|
|
4
5
|
import './pd-text-field';
|
|
@@ -29,8 +30,8 @@ export interface PdTableColumn<T extends PdTableRowData = PdTableRowData> {
|
|
|
29
30
|
type?: 'text' | 'number' | 'currency' | 'date' | 'boolean' | 'action';
|
|
30
31
|
/** Currency code for currency type (overrides table-level currencyCode) */
|
|
31
32
|
currencyCode?: string;
|
|
32
|
-
/** Custom cell renderer */
|
|
33
|
-
cellTemplate?: (row: T, index: number) => TemplateResult | string;
|
|
33
|
+
/** Custom cell renderer. Accepts a Lit TemplateResult, a plain string, or a React element (e.g. MUI components). */
|
|
34
|
+
cellTemplate?: (row: T, index: number) => TemplateResult | string | ReactElement;
|
|
34
35
|
}
|
|
35
36
|
export interface PdTableSortEvent {
|
|
36
37
|
columnId: string;
|
|
@@ -120,6 +121,7 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
120
121
|
private _dragOverColumnIndex;
|
|
121
122
|
private _displayDataCache;
|
|
122
123
|
private _displayDataCacheKey;
|
|
124
|
+
private _reactRoots;
|
|
123
125
|
/** Whether server-side pagination is active */
|
|
124
126
|
private get _isServerSidePagination();
|
|
125
127
|
/** Total count for pagination display */
|
|
@@ -131,6 +133,7 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
131
133
|
* Results are memoized for performance.
|
|
132
134
|
*/
|
|
133
135
|
private get _displayData();
|
|
136
|
+
disconnectedCallback(): void;
|
|
134
137
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
135
138
|
private _computeCacheKey;
|
|
136
139
|
private _sortData;
|
|
@@ -176,6 +179,8 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
176
179
|
private _formatNumber;
|
|
177
180
|
private _formatDate;
|
|
178
181
|
private _renderBoolean;
|
|
182
|
+
private _isReactElement;
|
|
183
|
+
private _renderReactCellContent;
|
|
179
184
|
private _renderRow;
|
|
180
185
|
private _renderEmptyState;
|
|
181
186
|
private _renderLoadingState;
|