@design.estate/dees-catalog 3.61.2 → 3.62.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.
@@ -275,6 +275,32 @@ export const tableStyles = [
275
275
  color: ${cssManager.bdTheme('hsl(215.4 16.3% 46.9%)', 'hsl(215 20.2% 65.1%)')};
276
276
  letter-spacing: -0.01em;
277
277
  }
278
+
279
+ th[role='columnheader']:hover {
280
+ color: var(--dees-color-text-primary);
281
+ }
282
+
283
+ th .sortArrow {
284
+ display: inline-block;
285
+ margin-left: 6px;
286
+ font-size: 10px;
287
+ line-height: 1;
288
+ opacity: 0.7;
289
+ vertical-align: middle;
290
+ }
291
+
292
+ th .sortBadge {
293
+ display: inline-block;
294
+ margin-left: 3px;
295
+ padding: 1px 5px;
296
+ font-size: 10px;
297
+ font-weight: 600;
298
+ line-height: 1;
299
+ color: ${cssManager.bdTheme('hsl(222.2 47.4% 30%)', 'hsl(217.2 91.2% 75%)')};
300
+ background: ${cssManager.bdTheme('hsl(222.2 47.4% 51.2% / 0.12)', 'hsl(217.2 91.2% 59.8% / 0.18)')};
301
+ border-radius: 999px;
302
+ vertical-align: middle;
303
+ }
278
304
 
279
305
  :host([show-vertical-lines]) th {
280
306
  border-right: 1px solid var(--dees-color-border-default);
@@ -436,4 +462,4 @@ export const tableStyles = [
436
462
  }
437
463
  `,
438
464
  ];
439
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3R5bGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vdHNfd2ViL2VsZW1lbnRzLzAwZ3JvdXAtZGF0YXZpZXcvZGVlcy10YWJsZS9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxHQUFHLEVBQWtCLE1BQU0sNkJBQTZCLENBQUM7QUFDOUUsT0FBTyxFQU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VUsQ0FBQyxPQUFPLENBQUMsOEJBQThCLEVBQUUsOEJBQThCLENBQUM7Ozs7Ozs7Ozs7Ozs7O3NCQWM1RixVQUFVLENBQUMsT0FBTyxDQUFDLGdCQUFnQixFQUFFLGNBQWMsQ0FBQzs7Ozs7Ozs7Ozs7Ozs7OztpQkFnQnpELFVBQVUsQ0FBQyxPQUFPLENBQUMsd0JBQXdCLEVBQUUsc0JBQXNCLENBQUM7Ozs7OztzQkFNL0QsVUFBVSxDQUFDLE9BQU8sQ0FBQyxvQkFBb0IsRUFBRSxpQkFBaUIsQ0FBQztpQkFDaEUsVUFBVSxDQUFDLE9BQU8sQ0FBQyxjQUFjLEVBQUUsZUFBZSxDQUFDOzs7O3NCQUk5QyxVQUFVLENBQUMsT0FBTyxDQUFDLG9CQUFvQixFQUFFLGlCQUFpQixDQUFDOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7aUJBb0NoRSxVQUFVLENBQUMsT0FBTyxDQUFDLHdCQUF3QixFQUFFLHNCQUFzQixDQUFDOzs7Ozs7OztzQkFRL0QsVUFBVSxDQUFDLE9BQU8sQ0FBQyxpQkFBaUIsRUFBRSxpQkFBaUIsQ0FBQztpQkFDN0QsVUFBVSxDQUFDLE9BQU8sQ0FBQyxjQUFjLEVBQUUsZUFBZSxDQUFDOzs7Ozs7O0dBT2pFO0NBQ0YsQ0FBQyJ9
@@ -26,4 +26,12 @@ export interface Column<T = any> {
26
26
  filterable?: boolean;
27
27
  hidden?: boolean;
28
28
  }
29
+ /**
30
+ * One entry in a multi-column sort cascade. Order in the array reflects priority:
31
+ * index 0 is the primary sort key, index 1 the secondary tiebreaker, and so on.
32
+ */
33
+ export interface ISortDescriptor {
34
+ key: string;
35
+ dir: 'asc' | 'desc';
36
+ }
29
37
  export type TDisplayFunction<T = any> = (itemArg: T) => Record<string, any>;
@@ -168991,6 +168991,44 @@ var demoFunc29 = /* @__PURE__ */ __name(() => b2`
168991
168991
  ></dees-table>
168992
168992
  </div>
168993
168993
 
168994
+ <div class="demo-section">
168995
+ <h2 class="demo-title">Multi-Column Sort</h2>
168996
+ <p class="demo-description">
168997
+ Click any column header for a single-column sort. Hold Shift while clicking to add the
168998
+ column to a multi-sort cascade (or cycle its direction). Right-click any sortable header
168999
+ to open a menu where you can pin a column to a specific priority slot, remove it, or
169000
+ clear the cascade.
169001
+ </p>
169002
+ <dees-table
169003
+ heading1="People Directory"
169004
+ heading2="Pre-seeded with department ▲ 1, name ▲ 2"
169005
+ .sortBy=${[
169006
+ { key: "department", dir: "asc" },
169007
+ { key: "name", dir: "asc" }
169008
+ ]}
169009
+ .columns=${[
169010
+ { key: "department", header: "Department", sortable: true },
169011
+ { key: "name", header: "Name", sortable: true },
169012
+ { key: "role", header: "Role", sortable: true },
169013
+ { key: "createdAt", header: "Created", sortable: true },
169014
+ { key: "location", header: "Location", sortable: true },
169015
+ { key: "status", header: "Status", sortable: true }
169016
+ ]}
169017
+ .data=${[
169018
+ { department: "R&D", name: "Alice Johnson", role: "Engineer", createdAt: "2023-01-12", location: "Berlin", status: "Active" },
169019
+ { department: "R&D", name: "Diana Martinez", role: "Engineer", createdAt: "2020-06-30", location: "Madrid", status: "Active" },
169020
+ { department: "R&D", name: "Mark Lee", role: "Engineer", createdAt: "2024-03-04", location: "Berlin", status: "Active" },
169021
+ { department: "Design", name: "Bob Smith", role: "Designer", createdAt: "2022-11-05", location: "Paris", status: "Active" },
169022
+ { department: "Design", name: "Sara Kim", role: "Designer", createdAt: "2021-08-19", location: "Paris", status: "On Leave" },
169023
+ { department: "Ops", name: "Charlie Davis", role: "Manager", createdAt: "2021-04-21", location: "London", status: "On Leave" },
169024
+ { department: "Ops", name: "Helena Voss", role: "SRE", createdAt: "2023-07-22", location: "London", status: "Active" },
169025
+ { department: "QA", name: "Fiona Clark", role: "QA", createdAt: "2022-03-14", location: "Vienna", status: "Active" },
169026
+ { department: "QA", name: "Tom\xE1s Rivera", role: "QA", createdAt: "2024-01-09", location: "Madrid", status: "Active" },
169027
+ { department: "CS", name: "Ethan Brown", role: "Support", createdAt: "2019-09-18", location: "Rome", status: "Inactive" }
169028
+ ]}
169029
+ ></dees-table>
169030
+ </div>
169031
+
168994
169032
  <div class="demo-section">
168995
169033
  <h2 class="demo-title">Wide Properties + Many Actions</h2>
168996
169034
  <p class="demo-description">A table with many columns and rich actions to stress test layout and sticky Actions.</p>
@@ -169384,6 +169422,32 @@ var tableStyles = [
169384
169422
  color: ${cssManager.bdTheme("hsl(215.4 16.3% 46.9%)", "hsl(215 20.2% 65.1%)")};
169385
169423
  letter-spacing: -0.01em;
169386
169424
  }
169425
+
169426
+ th[role='columnheader']:hover {
169427
+ color: var(--dees-color-text-primary);
169428
+ }
169429
+
169430
+ th .sortArrow {
169431
+ display: inline-block;
169432
+ margin-left: 6px;
169433
+ font-size: 10px;
169434
+ line-height: 1;
169435
+ opacity: 0.7;
169436
+ vertical-align: middle;
169437
+ }
169438
+
169439
+ th .sortBadge {
169440
+ display: inline-block;
169441
+ margin-left: 3px;
169442
+ padding: 1px 5px;
169443
+ font-size: 10px;
169444
+ font-weight: 600;
169445
+ line-height: 1;
169446
+ color: ${cssManager.bdTheme("hsl(222.2 47.4% 30%)", "hsl(217.2 91.2% 75%)")};
169447
+ background: ${cssManager.bdTheme("hsl(222.2 47.4% 51.2% / 0.12)", "hsl(217.2 91.2% 59.8% / 0.18)")};
169448
+ border-radius: 999px;
169449
+ vertical-align: middle;
169450
+ }
169387
169451
 
169388
169452
  :host([show-vertical-lines]) th {
169389
169453
  border-right: 1px solid var(--dees-color-border-default);
@@ -169575,7 +169639,23 @@ function getCellValue(row, col, displayFunction) {
169575
169639
  return col.value ? col.value(row) : row[col.key];
169576
169640
  }
169577
169641
  __name(getCellValue, "getCellValue");
169578
- function getViewData(data, effectiveColumns, sortKey, sortDir, filterText, columnFilters, filterMode = "table", lucenePredicate) {
169642
+ function compareCellValues(va, vb) {
169643
+ if (va == null && vb == null) return 0;
169644
+ if (va == null) return -1;
169645
+ if (vb == null) return 1;
169646
+ if (typeof va === "number" && typeof vb === "number") {
169647
+ if (va < vb) return -1;
169648
+ if (va > vb) return 1;
169649
+ return 0;
169650
+ }
169651
+ const sa = String(va).toLowerCase();
169652
+ const sb = String(vb).toLowerCase();
169653
+ if (sa < sb) return -1;
169654
+ if (sa > sb) return 1;
169655
+ return 0;
169656
+ }
169657
+ __name(compareCellValues, "compareCellValues");
169658
+ function getViewData(data, effectiveColumns, sortBy, filterText, columnFilters, filterMode = "table", lucenePredicate) {
169579
169659
  let arr = data.slice();
169580
169660
  const ft = (filterText || "").trim().toLowerCase();
169581
169661
  const cf = columnFilters || {};
@@ -169589,9 +169669,9 @@ function getViewData(data, effectiveColumns, sortKey, sortDir, filterText, colum
169589
169669
  const needle = String(cf[k4]).toLowerCase();
169590
169670
  if (!s10.includes(needle)) return false;
169591
169671
  } else {
169592
- const col2 = effectiveColumns.find((c11) => String(c11.key) === k4);
169593
- if (!col2 || col2.hidden || col2.filterable === false) continue;
169594
- const val = getCellValue(row, col2);
169672
+ const col = effectiveColumns.find((c11) => String(c11.key) === k4);
169673
+ if (!col || col.hidden || col.filterable === false) continue;
169674
+ const val = getCellValue(row, col);
169595
169675
  const s10 = String(val ?? "").toLowerCase();
169596
169676
  const needle = String(cf[k4]).toLowerCase();
169597
169677
  if (!s10.includes(needle)) return false;
@@ -169612,9 +169692,9 @@ function getViewData(data, effectiveColumns, sortKey, sortDir, filterText, colum
169612
169692
  }
169613
169693
  }
169614
169694
  } else {
169615
- for (const col2 of effectiveColumns) {
169616
- if (col2.hidden) continue;
169617
- const val = getCellValue(row, col2);
169695
+ for (const col of effectiveColumns) {
169696
+ if (col.hidden) continue;
169697
+ const val = getCellValue(row, col);
169618
169698
  const s10 = String(val ?? "").toLowerCase();
169619
169699
  if (s10.includes(ft)) {
169620
169700
  any = true;
@@ -169627,21 +169707,14 @@ function getViewData(data, effectiveColumns, sortKey, sortDir, filterText, colum
169627
169707
  return true;
169628
169708
  });
169629
169709
  }
169630
- if (!sortKey || !sortDir) return arr;
169631
- const col = effectiveColumns.find((c11) => String(c11.key) === sortKey);
169632
- if (!col) return arr;
169633
- const dir = sortDir === "asc" ? 1 : -1;
169710
+ if (!sortBy || sortBy.length === 0) return arr;
169711
+ const resolved2 = sortBy.map((desc) => ({ desc, col: effectiveColumns.find((c11) => String(c11.key) === desc.key) })).filter((entry) => !!entry.col);
169712
+ if (resolved2.length === 0) return arr;
169634
169713
  arr.sort((a5, b5) => {
169635
- const va = getCellValue(a5, col);
169636
- const vb = getCellValue(b5, col);
169637
- if (va == null && vb == null) return 0;
169638
- if (va == null) return -1 * dir;
169639
- if (vb == null) return 1 * dir;
169640
- if (typeof va === "number" && typeof vb === "number") return (va - vb) * dir;
169641
- const sa = String(va).toLowerCase();
169642
- const sb = String(vb).toLowerCase();
169643
- if (sa < sb) return -1 * dir;
169644
- if (sa > sb) return 1 * dir;
169714
+ for (const { desc, col } of resolved2) {
169715
+ const cmp2 = compareCellValues(getCellValue(a5, col), getCellValue(b5, col));
169716
+ if (cmp2 !== 0) return desc.dir === "asc" ? cmp2 : -cmp2;
169717
+ }
169645
169718
  return 0;
169646
169719
  });
169647
169720
  return arr;
@@ -169794,7 +169867,13 @@ __name(compileLucenePredicate, "compileLucenePredicate");
169794
169867
  init_dist_ts30();
169795
169868
  init_dist_ts29();
169796
169869
  init_theme();
169797
- var _selectedIds_dec, _selectionMode_dec, _searchMode_dec, _stickyHeader_dec, _showColumnFilters_dec, _columnFilters_dec, _filterText_dec, _sortDir_dec, _sortKey_dec, _showGrid_dec, _showHorizontalLines_dec, _showVerticalLines_dec, _editableFields_dec, _selectedDataRow_dec, _reverseDisplayFunction_dec, _displayFunction_dec, _augmentFromDisplayFunction_dec, _rowKey_dec, _columns_dec, _dataActions_dec, _searchable_dec, _dataName_dec, _required_dec3, _disabled_dec3, _label_dec3, _key_dec2, _data_dec, _heading2_dec, _heading1_dec, _a42, _DeesTable_decorators, _init39, _heading1, _heading22, _data, _key2, _label3, _disabled3, _required3, _dataName, _searchable, _dataActions, _columns, _rowKey, _augmentFromDisplayFunction, _displayFunction, _reverseDisplayFunction, _selectedDataRow, _editableFields, _showVerticalLines, _showHorizontalLines, _showGrid, _sortKey, _sortDir, _filterText, _columnFilters, _showColumnFilters, _stickyHeader, _searchMode, _selectionMode, _selectedIds;
169870
+ var _selectedIds_dec, _selectionMode_dec, _searchMode_dec, _stickyHeader_dec, _showColumnFilters_dec, _columnFilters_dec, _filterText_dec, _sortBy_dec, _showGrid_dec, _showHorizontalLines_dec, _showVerticalLines_dec, _editableFields_dec, _selectedDataRow_dec, _reverseDisplayFunction_dec, _displayFunction_dec, _augmentFromDisplayFunction_dec, _rowKey_dec, _columns_dec, _dataActions_dec, _searchable_dec, _dataName_dec, _required_dec3, _disabled_dec3, _label_dec3, _key_dec2, _data_dec, _heading2_dec, _heading1_dec, _a42, _DeesTable_decorators, _init39, _heading1, _heading22, _data, _key2, _label3, _disabled3, _required3, _dataName, _searchable, _dataActions, _columns, _rowKey, _augmentFromDisplayFunction, _displayFunction, _reverseDisplayFunction, _selectedDataRow, _editableFields, _showVerticalLines, _showHorizontalLines, _showGrid, _sortBy, _filterText, _columnFilters, _showColumnFilters, _stickyHeader, _searchMode, _selectionMode, _selectedIds;
169871
+ function ordinalLabel(n12) {
169872
+ const s10 = ["th", "st", "nd", "rd"];
169873
+ const v5 = n12 % 100;
169874
+ return n12 + (s10[(v5 - 20) % 10] || s10[v5] || s10[0]);
169875
+ }
169876
+ __name(ordinalLabel, "ordinalLabel");
169798
169877
  _DeesTable_decorators = [customElement("dees-table")];
169799
169878
  var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [n5({
169800
169879
  type: String
@@ -169837,7 +169916,7 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
169837
169916
  type: Boolean,
169838
169917
  reflect: true,
169839
169918
  attribute: "show-grid"
169840
- })], _sortKey_dec = [n5({ attribute: false })], _sortDir_dec = [n5({ attribute: false })], _filterText_dec = [n5({ type: String })], _columnFilters_dec = [n5({ attribute: false })], _showColumnFilters_dec = [n5({ type: Boolean, attribute: "show-column-filters" })], _stickyHeader_dec = [n5({ type: Boolean, reflect: true, attribute: "sticky-header" })], _searchMode_dec = [n5({ type: String })], _selectionMode_dec = [n5({ type: String })], _selectedIds_dec = [n5({ attribute: false })], _a42) {
169919
+ })], _sortBy_dec = [n5({ attribute: false })], _filterText_dec = [n5({ type: String })], _columnFilters_dec = [n5({ attribute: false })], _showColumnFilters_dec = [n5({ type: Boolean, attribute: "show-column-filters" })], _stickyHeader_dec = [n5({ type: Boolean, reflect: true, attribute: "sticky-header" })], _searchMode_dec = [n5({ type: String })], _selectionMode_dec = [n5({ type: String })], _selectedIds_dec = [n5({ attribute: false })], _a42) {
169841
169920
  constructor() {
169842
169921
  super();
169843
169922
  __privateAdd(this, _heading1, __runInitializers(_init39, 8, this, "heading 1")), __runInitializers(_init39, 11, this);
@@ -169864,17 +169943,16 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
169864
169943
  __publicField(this, "files", []);
169865
169944
  __publicField(this, "fileWeakMap", /* @__PURE__ */ new WeakMap());
169866
169945
  __publicField(this, "dataChangeSubject", new domtools_pluginexports_exports.smartrx.rxjs.Subject());
169867
- __privateAdd(this, _sortKey, __runInitializers(_init39, 88, this)), __runInitializers(_init39, 91, this);
169868
- __privateAdd(this, _sortDir, __runInitializers(_init39, 92, this, null)), __runInitializers(_init39, 95, this);
169869
- __privateAdd(this, _filterText, __runInitializers(_init39, 96, this, "")), __runInitializers(_init39, 99, this);
169870
- __privateAdd(this, _columnFilters, __runInitializers(_init39, 100, this, {})), __runInitializers(_init39, 103, this);
169871
- __privateAdd(this, _showColumnFilters, __runInitializers(_init39, 104, this, false)), __runInitializers(_init39, 107, this);
169872
- __privateAdd(this, _stickyHeader, __runInitializers(_init39, 108, this, false)), __runInitializers(_init39, 111, this);
169873
- __privateAdd(this, _searchMode, __runInitializers(_init39, 112, this, "table")), __runInitializers(_init39, 115, this);
169946
+ __privateAdd(this, _sortBy, __runInitializers(_init39, 88, this, [])), __runInitializers(_init39, 91, this);
169947
+ __privateAdd(this, _filterText, __runInitializers(_init39, 92, this, "")), __runInitializers(_init39, 95, this);
169948
+ __privateAdd(this, _columnFilters, __runInitializers(_init39, 96, this, {})), __runInitializers(_init39, 99, this);
169949
+ __privateAdd(this, _showColumnFilters, __runInitializers(_init39, 100, this, false)), __runInitializers(_init39, 103, this);
169950
+ __privateAdd(this, _stickyHeader, __runInitializers(_init39, 104, this, false)), __runInitializers(_init39, 107, this);
169951
+ __privateAdd(this, _searchMode, __runInitializers(_init39, 108, this, "table")), __runInitializers(_init39, 111, this);
169874
169952
  __publicField(this, "__searchTextSub");
169875
169953
  __publicField(this, "__searchModeSub");
169876
- __privateAdd(this, _selectionMode, __runInitializers(_init39, 116, this, "none")), __runInitializers(_init39, 119, this);
169877
- __privateAdd(this, _selectedIds, __runInitializers(_init39, 120, this, /* @__PURE__ */ new Set())), __runInitializers(_init39, 123, this);
169954
+ __privateAdd(this, _selectionMode, __runInitializers(_init39, 112, this, "none")), __runInitializers(_init39, 115, this);
169955
+ __privateAdd(this, _selectedIds, __runInitializers(_init39, 116, this, /* @__PURE__ */ new Set())), __runInitializers(_init39, 119, this);
169878
169956
  __publicField(this, "_rowIdMap", /* @__PURE__ */ new WeakMap());
169879
169957
  __publicField(this, "_rowIdCounter", 0);
169880
169958
  __publicField(this, "__debounceTimer");
@@ -169895,8 +169973,7 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
169895
169973
  const viewData = getViewData(
169896
169974
  this.data,
169897
169975
  effectiveColumns,
169898
- this.sortKey,
169899
- this.sortDir,
169976
+ this.sortBy,
169900
169977
  this.filterText,
169901
169978
  this.columnFilters,
169902
169979
  this.searchMode === "data" ? "data" : "table",
@@ -169991,7 +170068,8 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
169991
170068
  role="columnheader"
169992
170069
  aria-sort=${ariaSort}
169993
170070
  style="${isSortable ? "cursor: pointer;" : ""}"
169994
- @click=${() => isSortable ? this.toggleSort(col) : null}
170071
+ @click=${(eventArg) => isSortable ? this.handleHeaderClick(eventArg, col, effectiveColumns) : null}
170072
+ @contextmenu=${(eventArg) => isSortable ? this.openHeaderContextMenu(eventArg, col, effectiveColumns) : null}
169995
170073
  >
169996
170074
  ${col.header ?? col.key}
169997
170075
  ${this.renderSortIndicator(col)}
@@ -170287,33 +170365,302 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
170287
170365
  table2.style.tableLayout = "fixed";
170288
170366
  }
170289
170367
  // compute helpers moved to ./data.ts
170290
- toggleSort(col) {
170291
- const key2 = String(col.key);
170292
- if (this.sortKey !== key2) {
170293
- this.sortKey = key2;
170294
- this.sortDir = "asc";
170295
- } else {
170296
- if (this.sortDir === "asc") this.sortDir = "desc";
170297
- else if (this.sortDir === "desc") {
170298
- this.sortDir = null;
170299
- this.sortKey = void 0;
170300
- } else this.sortDir = "asc";
170301
- }
170368
+ // ─── sort: public API ────────────────────────────────────────────────
170369
+ /** Returns the descriptor for `key` if the column is currently in the cascade. */
170370
+ getSortDescriptor(key2) {
170371
+ return this.sortBy.find((d6) => d6.key === key2);
170372
+ }
170373
+ /** Returns the 0-based priority of `key` in the cascade, or -1 if not present. */
170374
+ getSortPriority(key2) {
170375
+ return this.sortBy.findIndex((d6) => d6.key === key2);
170376
+ }
170377
+ /** Replaces the cascade with a single sort entry. */
170378
+ setSort(key2, dir) {
170379
+ this.sortBy = [{ key: key2, dir }];
170380
+ this.emitSortChange();
170381
+ this.requestUpdate();
170382
+ }
170383
+ /**
170384
+ * Inserts (or moves) `key` to a 0-based position in the cascade. If the key is
170385
+ * already present elsewhere, its previous entry is removed before insertion so
170386
+ * a column appears at most once.
170387
+ */
170388
+ addSortAt(key2, position3, dir) {
170389
+ const next2 = this.sortBy.filter((d6) => d6.key !== key2);
170390
+ const clamped = Math.max(0, Math.min(position3, next2.length));
170391
+ next2.splice(clamped, 0, { key: key2, dir });
170392
+ this.sortBy = next2;
170393
+ this.emitSortChange();
170394
+ this.requestUpdate();
170395
+ }
170396
+ /** Appends `key` to the end of the cascade (or moves it there if already present). */
170397
+ appendSort(key2, dir) {
170398
+ const next2 = this.sortBy.filter((d6) => d6.key !== key2);
170399
+ next2.push({ key: key2, dir });
170400
+ this.sortBy = next2;
170401
+ this.emitSortChange();
170402
+ this.requestUpdate();
170403
+ }
170404
+ /** Removes `key` from the cascade. No-op if not present. */
170405
+ removeSort(key2) {
170406
+ if (!this.sortBy.some((d6) => d6.key === key2)) return;
170407
+ this.sortBy = this.sortBy.filter((d6) => d6.key !== key2);
170408
+ this.emitSortChange();
170409
+ this.requestUpdate();
170410
+ }
170411
+ /** Empties the cascade. */
170412
+ clearSorts() {
170413
+ if (this.sortBy.length === 0) return;
170414
+ this.sortBy = [];
170415
+ this.emitSortChange();
170416
+ this.requestUpdate();
170417
+ }
170418
+ emitSortChange() {
170302
170419
  this.dispatchEvent(
170303
170420
  new CustomEvent("sortChange", {
170304
- detail: { key: this.sortKey, dir: this.sortDir },
170421
+ detail: { sortBy: this.sortBy.map((d6) => ({ ...d6 })) },
170305
170422
  bubbles: true
170306
170423
  })
170307
170424
  );
170308
- this.requestUpdate();
170309
170425
  }
170426
+ // ─── sort: header interaction handlers ───────────────────────────────
170427
+ /**
170428
+ * Plain left-click on a sortable header. Cycles `none → asc → desc → none`
170429
+ * collapsing the cascade to a single column. If a multi-column cascade is
170430
+ * active, asks the user to confirm the destructive replacement first. A
170431
+ * Shift+click bypasses the modal and routes through the multi-sort cycle.
170432
+ */
170433
+ async handleHeaderClick(eventArg, col, _effectiveColumns) {
170434
+ if (eventArg.shiftKey) {
170435
+ this.handleHeaderShiftClick(col);
170436
+ return;
170437
+ }
170438
+ const proceed = await this.confirmReplaceCascade(col);
170439
+ if (!proceed) return;
170440
+ this.cycleSingleSort(col);
170441
+ }
170442
+ /**
170443
+ * Cycles a single column through `none → asc → desc → none`, collapsing the
170444
+ * cascade. Used by both plain click and the menu's "Sort Ascending/Descending"
170445
+ * shortcuts (after confirmation).
170446
+ */
170447
+ cycleSingleSort(col) {
170448
+ const key2 = String(col.key);
170449
+ const current = this.sortBy.length === 1 && this.sortBy[0].key === key2 ? this.sortBy[0].dir : null;
170450
+ if (current === "asc") this.setSort(key2, "desc");
170451
+ else if (current === "desc") this.clearSorts();
170452
+ else this.setSort(key2, "asc");
170453
+ }
170454
+ /**
170455
+ * Shift+click cycle on a sortable header. Edits the cascade in place without
170456
+ * destroying other sort keys: append → flip dir → remove.
170457
+ */
170458
+ handleHeaderShiftClick(col) {
170459
+ const key2 = String(col.key);
170460
+ const existing = this.getSortDescriptor(key2);
170461
+ if (!existing) {
170462
+ this.appendSort(key2, "asc");
170463
+ } else if (existing.dir === "asc") {
170464
+ this.sortBy = this.sortBy.map((d6) => d6.key === key2 ? { key: key2, dir: "desc" } : d6);
170465
+ this.emitSortChange();
170466
+ this.requestUpdate();
170467
+ } else {
170468
+ this.removeSort(key2);
170469
+ }
170470
+ }
170471
+ /**
170472
+ * Opens a confirmation modal when the cascade has more than one entry and the
170473
+ * user attempts a destructive single-sort replacement. Resolves to `true` if
170474
+ * the user accepts, `false` if they cancel. If the cascade has 0 or 1 entries
170475
+ * the modal is skipped and we resolve to `true` immediately.
170476
+ */
170477
+ confirmReplaceCascade(targetCol) {
170478
+ if (this.sortBy.length <= 1) return Promise.resolve(true);
170479
+ return new Promise((resolve2) => {
170480
+ let settled = false;
170481
+ const settle = /* @__PURE__ */ __name((result) => {
170482
+ if (settled) return;
170483
+ settled = true;
170484
+ resolve2(result);
170485
+ }, "settle");
170486
+ const summary = this.sortBy.map((d6, i11) => {
170487
+ const c11 = this._lookupColumnByKey?.(d6.key);
170488
+ const label = c11?.header ?? d6.key;
170489
+ return b2`<li>${i11 + 1}. ${label} ${d6.dir === "asc" ? "\u25B2" : "\u25BC"}</li>`;
170490
+ });
170491
+ DeesModal.createAndShow({
170492
+ heading: "Replace multi-column sort?",
170493
+ width: "small",
170494
+ showCloseButton: true,
170495
+ content: b2`
170496
+ <div style="font-size:13px; line-height:1.55;">
170497
+ <p style="margin:0 0 8px;">
170498
+ You currently have a ${this.sortBy.length}-column sort active:
170499
+ </p>
170500
+ <ul style="margin:0 0 12px; padding-left:18px;">${summary}</ul>
170501
+ <p style="margin:0;">
170502
+ Continuing will discard the cascade and replace it with a single sort on
170503
+ <strong>${targetCol.header ?? String(targetCol.key)}</strong>.
170504
+ </p>
170505
+ </div>
170506
+ `,
170507
+ menuOptions: [
170508
+ {
170509
+ name: "Cancel",
170510
+ iconName: "lucide:x",
170511
+ action: /* @__PURE__ */ __name(async (modal) => {
170512
+ settle(false);
170513
+ await modal.destroy();
170514
+ return null;
170515
+ }, "action")
170516
+ },
170517
+ {
170518
+ name: "Replace",
170519
+ iconName: "lucide:check",
170520
+ action: /* @__PURE__ */ __name(async (modal) => {
170521
+ settle(true);
170522
+ await modal.destroy();
170523
+ return null;
170524
+ }, "action")
170525
+ }
170526
+ ]
170527
+ });
170528
+ });
170529
+ }
170530
+ /**
170531
+ * Looks up a column by its string key in the currently effective column set.
170532
+ * Used by the modal helper to render human-friendly labels.
170533
+ */
170534
+ _lookupColumnByKey(key2) {
170535
+ const usingColumns = Array.isArray(this.columns) && this.columns.length > 0;
170536
+ const effective = usingColumns ? computeEffectiveColumns(this.columns, this.augmentFromDisplayFunction, this.displayFunction, this.data) : computeColumnsFromDisplayFunction(this.displayFunction, this.data);
170537
+ return effective.find((c11) => String(c11.key) === key2);
170538
+ }
170539
+ /**
170540
+ * Opens the header context menu for explicit multi-sort priority control.
170541
+ */
170542
+ openHeaderContextMenu(eventArg, col, effectiveColumns) {
170543
+ const items = this.buildHeaderMenuItems(col, effectiveColumns);
170544
+ DeesContextmenu.openContextMenuWithOptions(eventArg, items);
170545
+ }
170546
+ /**
170547
+ * Builds the dynamic context-menu structure for a single column header.
170548
+ */
170549
+ buildHeaderMenuItems(col, effectiveColumns) {
170550
+ const key2 = String(col.key);
170551
+ const existing = this.getSortDescriptor(key2);
170552
+ const cascadeLen = this.sortBy.length;
170553
+ const sortableColumnCount = effectiveColumns.filter((c11) => !!c11.sortable).length;
170554
+ const maxSlot = Math.min(
170555
+ Math.max(cascadeLen + (existing ? 0 : 1), 1),
170556
+ Math.max(sortableColumnCount, 1)
170557
+ );
170558
+ const items = [];
170559
+ items.push({
170560
+ name: "Sort Ascending",
170561
+ iconName: cascadeLen === 1 && existing?.dir === "asc" ? "lucide:check" : "lucide:arrowUp",
170562
+ action: /* @__PURE__ */ __name(async () => {
170563
+ if (await this.confirmReplaceCascade(col)) this.setSort(key2, "asc");
170564
+ return null;
170565
+ }, "action")
170566
+ });
170567
+ items.push({
170568
+ name: "Sort Descending",
170569
+ iconName: cascadeLen === 1 && existing?.dir === "desc" ? "lucide:check" : "lucide:arrowDown",
170570
+ action: /* @__PURE__ */ __name(async () => {
170571
+ if (await this.confirmReplaceCascade(col)) this.setSort(key2, "desc");
170572
+ return null;
170573
+ }, "action")
170574
+ });
170575
+ items.push({ divider: true });
170576
+ for (let slot = 1; slot <= maxSlot; slot++) {
170577
+ const ordinal = ordinalLabel(slot);
170578
+ const isCurrentSlot = existing && this.getSortPriority(key2) === slot - 1;
170579
+ items.push({
170580
+ name: `Set as ${ordinal} sort`,
170581
+ iconName: isCurrentSlot ? "lucide:check" : "lucide:listOrdered",
170582
+ submenu: [
170583
+ {
170584
+ name: "Ascending",
170585
+ iconName: "lucide:arrowUp",
170586
+ action: /* @__PURE__ */ __name(async () => {
170587
+ this.addSortAt(key2, slot - 1, "asc");
170588
+ return null;
170589
+ }, "action")
170590
+ },
170591
+ {
170592
+ name: "Descending",
170593
+ iconName: "lucide:arrowDown",
170594
+ action: /* @__PURE__ */ __name(async () => {
170595
+ this.addSortAt(key2, slot - 1, "desc");
170596
+ return null;
170597
+ }, "action")
170598
+ }
170599
+ ]
170600
+ });
170601
+ }
170602
+ items.push({ divider: true });
170603
+ items.push({
170604
+ name: "Append to sort",
170605
+ iconName: "lucide:plus",
170606
+ submenu: [
170607
+ {
170608
+ name: "Ascending",
170609
+ iconName: "lucide:arrowUp",
170610
+ action: /* @__PURE__ */ __name(async () => {
170611
+ this.appendSort(key2, "asc");
170612
+ return null;
170613
+ }, "action")
170614
+ },
170615
+ {
170616
+ name: "Descending",
170617
+ iconName: "lucide:arrowDown",
170618
+ action: /* @__PURE__ */ __name(async () => {
170619
+ this.appendSort(key2, "desc");
170620
+ return null;
170621
+ }, "action")
170622
+ }
170623
+ ]
170624
+ });
170625
+ if (existing) {
170626
+ items.push({ divider: true });
170627
+ items.push({
170628
+ name: "Remove from sort",
170629
+ iconName: "lucide:minus",
170630
+ action: /* @__PURE__ */ __name(async () => {
170631
+ this.removeSort(key2);
170632
+ return null;
170633
+ }, "action")
170634
+ });
170635
+ }
170636
+ if (cascadeLen > 0) {
170637
+ if (!existing) items.push({ divider: true });
170638
+ items.push({
170639
+ name: "Clear all sorts",
170640
+ iconName: "lucide:trash",
170641
+ action: /* @__PURE__ */ __name(async () => {
170642
+ this.clearSorts();
170643
+ return null;
170644
+ }, "action")
170645
+ });
170646
+ }
170647
+ return items;
170648
+ }
170649
+ // ─── sort: indicator + ARIA ──────────────────────────────────────────
170310
170650
  getAriaSort(col) {
170311
- if (String(col.key) !== this.sortKey || !this.sortDir) return "none";
170312
- return this.sortDir === "asc" ? "ascending" : "descending";
170651
+ const primary = this.sortBy[0];
170652
+ if (!primary || primary.key !== String(col.key)) return "none";
170653
+ return primary.dir === "asc" ? "ascending" : "descending";
170313
170654
  }
170314
170655
  renderSortIndicator(col) {
170315
- if (String(col.key) !== this.sortKey || !this.sortDir) return b2``;
170316
- return b2`<span style="margin-left:6px; opacity:0.7;">${this.sortDir === "asc" ? "\u25B2" : "\u25BC"}</span>`;
170656
+ const idx = this.getSortPriority(String(col.key));
170657
+ if (idx < 0) return b2``;
170658
+ const desc = this.sortBy[idx];
170659
+ const arrow2 = desc.dir === "asc" ? "\u25B2" : "\u25BC";
170660
+ if (this.sortBy.length === 1) {
170661
+ return b2`<span class="sortArrow">${arrow2}</span>`;
170662
+ }
170663
+ return b2`<span class="sortArrow">${arrow2}</span><span class="sortBadge">${idx + 1}</span>`;
170317
170664
  }
170318
170665
  // filtering helpers
170319
170666
  setFilterText(value2) {
@@ -170478,8 +170825,7 @@ _editableFields = new WeakMap();
170478
170825
  _showVerticalLines = new WeakMap();
170479
170826
  _showHorizontalLines = new WeakMap();
170480
170827
  _showGrid = new WeakMap();
170481
- _sortKey = new WeakMap();
170482
- _sortDir = new WeakMap();
170828
+ _sortBy = new WeakMap();
170483
170829
  _filterText = new WeakMap();
170484
170830
  _columnFilters = new WeakMap();
170485
170831
  _showColumnFilters = new WeakMap();
@@ -170507,8 +170853,7 @@ __decorateElement(_init39, 4, "editableFields", _editableFields_dec, _DeesTable,
170507
170853
  __decorateElement(_init39, 4, "showVerticalLines", _showVerticalLines_dec, _DeesTable, _showVerticalLines);
170508
170854
  __decorateElement(_init39, 4, "showHorizontalLines", _showHorizontalLines_dec, _DeesTable, _showHorizontalLines);
170509
170855
  __decorateElement(_init39, 4, "showGrid", _showGrid_dec, _DeesTable, _showGrid);
170510
- __decorateElement(_init39, 4, "sortKey", _sortKey_dec, _DeesTable, _sortKey);
170511
- __decorateElement(_init39, 4, "sortDir", _sortDir_dec, _DeesTable, _sortDir);
170856
+ __decorateElement(_init39, 4, "sortBy", _sortBy_dec, _DeesTable, _sortBy);
170512
170857
  __decorateElement(_init39, 4, "filterText", _filterText_dec, _DeesTable, _filterText);
170513
170858
  __decorateElement(_init39, 4, "columnFilters", _columnFilters_dec, _DeesTable, _columnFilters);
170514
170859
  __decorateElement(_init39, 4, "showColumnFilters", _showColumnFilters_dec, _DeesTable, _showColumnFilters);