@design.estate/dees-catalog 3.61.2 → 3.63.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_bundle/bundle.js +677 -128
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-dataview/dees-table/data.d.ts +8 -2
- package/dist_ts_web/elements/00group-dataview/dees-table/data.js +40 -22
- package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.d.ts +110 -6
- package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.demo.js +39 -1
- package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.js +629 -114
- package/dist_ts_web/elements/00group-dataview/dees-table/styles.js +72 -18
- package/dist_ts_web/elements/00group-dataview/dees-table/types.d.ts +8 -0
- package/dist_watch/bundle.js +675 -126
- package/dist_watch/bundle.js.map +3 -3
- package/package.json +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-dataview/dees-table/data.ts +33 -17
- package/ts_web/elements/00group-dataview/dees-table/dees-table.demo.ts +38 -0
- package/ts_web/elements/00group-dataview/dees-table/dees-table.ts +656 -92
- package/ts_web/elements/00group-dataview/dees-table/styles.ts +71 -17
- package/ts_web/elements/00group-dataview/dees-table/types.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-catalog",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.63.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
|
|
6
6
|
"main": "dist_ts_web/index.js",
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-catalog',
|
|
6
|
-
version: '3.
|
|
6
|
+
version: '3.63.0',
|
|
7
7
|
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Column, TDisplayFunction } from './types.js';
|
|
1
|
+
import type { Column, ISortDescriptor, TDisplayFunction } from './types.js';
|
|
2
2
|
|
|
3
3
|
export function computeColumnsFromDisplayFunction<T>(
|
|
4
4
|
displayFunction: TDisplayFunction<T>,
|
|
@@ -36,11 +36,31 @@ export function getCellValue<T>(row: T, col: Column<T>, displayFunction?: TDispl
|
|
|
36
36
|
return col.value ? col.value(row) : (row as any)[col.key as any];
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Compares two cell values in ascending order. Returns -1, 0, or 1.
|
|
41
|
+
* Null/undefined values sort before defined values. Numbers compare numerically;
|
|
42
|
+
* everything else compares as case-insensitive strings.
|
|
43
|
+
*/
|
|
44
|
+
export function compareCellValues(va: any, vb: any): number {
|
|
45
|
+
if (va == null && vb == null) return 0;
|
|
46
|
+
if (va == null) return -1;
|
|
47
|
+
if (vb == null) return 1;
|
|
48
|
+
if (typeof va === 'number' && typeof vb === 'number') {
|
|
49
|
+
if (va < vb) return -1;
|
|
50
|
+
if (va > vb) return 1;
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
const sa = String(va).toLowerCase();
|
|
54
|
+
const sb = String(vb).toLowerCase();
|
|
55
|
+
if (sa < sb) return -1;
|
|
56
|
+
if (sa > sb) return 1;
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
export function getViewData<T>(
|
|
40
61
|
data: T[],
|
|
41
62
|
effectiveColumns: Column<T>[],
|
|
42
|
-
|
|
43
|
-
sortDir?: 'asc' | 'desc' | null,
|
|
63
|
+
sortBy: ISortDescriptor[],
|
|
44
64
|
filterText?: string,
|
|
45
65
|
columnFilters?: Record<string, string>,
|
|
46
66
|
filterMode: 'table' | 'data' = 'table',
|
|
@@ -94,21 +114,17 @@ export function getViewData<T>(
|
|
|
94
114
|
return true;
|
|
95
115
|
});
|
|
96
116
|
}
|
|
97
|
-
if (!
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
117
|
+
if (!sortBy || sortBy.length === 0) return arr;
|
|
118
|
+
// Pre-resolve descriptors -> columns once for performance.
|
|
119
|
+
const resolved = sortBy
|
|
120
|
+
.map((desc) => ({ desc, col: effectiveColumns.find((c) => String(c.key) === desc.key) }))
|
|
121
|
+
.filter((entry): entry is { desc: ISortDescriptor; col: Column<T> } => !!entry.col);
|
|
122
|
+
if (resolved.length === 0) return arr;
|
|
101
123
|
arr.sort((a, b) => {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (vb == null) return 1 * dir;
|
|
107
|
-
if (typeof va === 'number' && typeof vb === 'number') return (va - vb) * dir;
|
|
108
|
-
const sa = String(va).toLowerCase();
|
|
109
|
-
const sb = String(vb).toLowerCase();
|
|
110
|
-
if (sa < sb) return -1 * dir;
|
|
111
|
-
if (sa > sb) return 1 * dir;
|
|
124
|
+
for (const { desc, col } of resolved) {
|
|
125
|
+
const cmp = compareCellValues(getCellValue(a, col), getCellValue(b, col));
|
|
126
|
+
if (cmp !== 0) return desc.dir === 'asc' ? cmp : -cmp;
|
|
127
|
+
}
|
|
112
128
|
return 0;
|
|
113
129
|
});
|
|
114
130
|
return arr;
|
|
@@ -580,6 +580,44 @@ export const demoFunc = () => html`
|
|
|
580
580
|
></dees-table>
|
|
581
581
|
</div>
|
|
582
582
|
|
|
583
|
+
<div class="demo-section">
|
|
584
|
+
<h2 class="demo-title">Multi-Column Sort</h2>
|
|
585
|
+
<p class="demo-description">
|
|
586
|
+
Click any column header for a single-column sort. Hold Shift while clicking to add the
|
|
587
|
+
column to a multi-sort cascade (or cycle its direction). Right-click any sortable header
|
|
588
|
+
to open a menu where you can pin a column to a specific priority slot, remove it, or
|
|
589
|
+
clear the cascade.
|
|
590
|
+
</p>
|
|
591
|
+
<dees-table
|
|
592
|
+
heading1="People Directory"
|
|
593
|
+
heading2="Pre-seeded with department ▲ 1, name ▲ 2"
|
|
594
|
+
.sortBy=${[
|
|
595
|
+
{ key: 'department', dir: 'asc' },
|
|
596
|
+
{ key: 'name', dir: 'asc' },
|
|
597
|
+
]}
|
|
598
|
+
.columns=${[
|
|
599
|
+
{ key: 'department', header: 'Department', sortable: true },
|
|
600
|
+
{ key: 'name', header: 'Name', sortable: true },
|
|
601
|
+
{ key: 'role', header: 'Role', sortable: true },
|
|
602
|
+
{ key: 'createdAt', header: 'Created', sortable: true },
|
|
603
|
+
{ key: 'location', header: 'Location', sortable: true },
|
|
604
|
+
{ key: 'status', header: 'Status', sortable: true },
|
|
605
|
+
]}
|
|
606
|
+
.data=${[
|
|
607
|
+
{ department: 'R&D', name: 'Alice Johnson', role: 'Engineer', createdAt: '2023-01-12', location: 'Berlin', status: 'Active' },
|
|
608
|
+
{ department: 'R&D', name: 'Diana Martinez', role: 'Engineer', createdAt: '2020-06-30', location: 'Madrid', status: 'Active' },
|
|
609
|
+
{ department: 'R&D', name: 'Mark Lee', role: 'Engineer', createdAt: '2024-03-04', location: 'Berlin', status: 'Active' },
|
|
610
|
+
{ department: 'Design', name: 'Bob Smith', role: 'Designer', createdAt: '2022-11-05', location: 'Paris', status: 'Active' },
|
|
611
|
+
{ department: 'Design', name: 'Sara Kim', role: 'Designer', createdAt: '2021-08-19', location: 'Paris', status: 'On Leave' },
|
|
612
|
+
{ department: 'Ops', name: 'Charlie Davis', role: 'Manager', createdAt: '2021-04-21', location: 'London', status: 'On Leave' },
|
|
613
|
+
{ department: 'Ops', name: 'Helena Voss', role: 'SRE', createdAt: '2023-07-22', location: 'London', status: 'Active' },
|
|
614
|
+
{ department: 'QA', name: 'Fiona Clark', role: 'QA', createdAt: '2022-03-14', location: 'Vienna', status: 'Active' },
|
|
615
|
+
{ department: 'QA', name: 'Tomás Rivera', role: 'QA', createdAt: '2024-01-09', location: 'Madrid', status: 'Active' },
|
|
616
|
+
{ department: 'CS', name: 'Ethan Brown', role: 'Support', createdAt: '2019-09-18', location: 'Rome', status: 'Inactive' },
|
|
617
|
+
]}
|
|
618
|
+
></dees-table>
|
|
619
|
+
</div>
|
|
620
|
+
|
|
583
621
|
<div class="demo-section">
|
|
584
622
|
<h2 class="demo-title">Wide Properties + Many Actions</h2>
|
|
585
623
|
<p class="demo-description">A table with many columns and rich actions to stress test layout and sticky Actions.</p>
|