@design.estate/dees-catalog 3.63.0 → 3.64.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.
@@ -169342,6 +169342,7 @@ var tableStyles = [
169342
169342
  tbody tr {
169343
169343
  transition: background-color 0.15s ease;
169344
169344
  position: relative;
169345
+ user-select: none;
169345
169346
  }
169346
169347
 
169347
169348
  /* Default horizontal lines (bottom border only) */
@@ -169895,7 +169896,7 @@ __name(compileLucenePredicate, "compileLucenePredicate");
169895
169896
  init_dist_ts30();
169896
169897
  init_dist_ts29();
169897
169898
  init_theme();
169898
- var _selectedIds_dec, _selectionMode_dec, _searchMode_dec, _fixedHeight_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, _fixedHeight, _searchMode, _selectionMode, _selectedIds;
169899
+ var _selectedIds_dec, _selectionMode_dec, _searchMode_dec, _fixedHeight_dec, _showSelectionCheckbox_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, _showSelectionCheckbox, _fixedHeight, _searchMode, _selectionMode, _selectedIds;
169899
169900
  function ordinalLabel(n12) {
169900
169901
  const s10 = ["th", "st", "nd", "rd"];
169901
169902
  const v5 = n12 % 100;
@@ -169944,7 +169945,7 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
169944
169945
  type: Boolean,
169945
169946
  reflect: true,
169946
169947
  attribute: "show-grid"
169947
- })], _sortBy_dec = [n5({ attribute: false })], _filterText_dec = [n5({ type: String })], _columnFilters_dec = [n5({ attribute: false })], _showColumnFilters_dec = [n5({ type: Boolean, attribute: "show-column-filters" })], _fixedHeight_dec = [n5({ type: Boolean, reflect: true, attribute: "fixed-height" })], _searchMode_dec = [n5({ type: String })], _selectionMode_dec = [n5({ type: String })], _selectedIds_dec = [n5({ attribute: false })], _a42) {
169948
+ })], _sortBy_dec = [n5({ attribute: false })], _filterText_dec = [n5({ type: String })], _columnFilters_dec = [n5({ attribute: false })], _showColumnFilters_dec = [n5({ type: Boolean, attribute: "show-column-filters" })], _showSelectionCheckbox_dec = [n5({ type: Boolean, reflect: true, attribute: "show-selection-checkbox" })], _fixedHeight_dec = [n5({ type: Boolean, reflect: true, attribute: "fixed-height" })], _searchMode_dec = [n5({ type: String })], _selectionMode_dec = [n5({ type: String })], _selectedIds_dec = [n5({ attribute: false })], _a42) {
169948
169949
  constructor() {
169949
169950
  super();
169950
169951
  __privateAdd(this, _heading1, __runInitializers(_init39, 8, this, "heading 1")), __runInitializers(_init39, 11, this);
@@ -169975,26 +169976,84 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
169975
169976
  __privateAdd(this, _filterText, __runInitializers(_init39, 92, this, "")), __runInitializers(_init39, 95, this);
169976
169977
  __privateAdd(this, _columnFilters, __runInitializers(_init39, 96, this, {})), __runInitializers(_init39, 99, this);
169977
169978
  __privateAdd(this, _showColumnFilters, __runInitializers(_init39, 100, this, false)), __runInitializers(_init39, 103, this);
169978
- __privateAdd(this, _fixedHeight, __runInitializers(_init39, 104, this, false)), __runInitializers(_init39, 107, this);
169979
- __privateAdd(this, _searchMode, __runInitializers(_init39, 108, this, "table")), __runInitializers(_init39, 111, this);
169979
+ __privateAdd(this, _showSelectionCheckbox, __runInitializers(_init39, 104, this, false)), __runInitializers(_init39, 107, this);
169980
+ __privateAdd(this, _fixedHeight, __runInitializers(_init39, 108, this, false)), __runInitializers(_init39, 111, this);
169981
+ __privateAdd(this, _searchMode, __runInitializers(_init39, 112, this, "table")), __runInitializers(_init39, 115, this);
169980
169982
  __publicField(this, "__searchTextSub");
169981
169983
  __publicField(this, "__searchModeSub");
169982
- __privateAdd(this, _selectionMode, __runInitializers(_init39, 112, this, "none")), __runInitializers(_init39, 115, this);
169983
- __privateAdd(this, _selectedIds, __runInitializers(_init39, 116, this, /* @__PURE__ */ new Set())), __runInitializers(_init39, 119, this);
169984
+ __privateAdd(this, _selectionMode, __runInitializers(_init39, 116, this, "none")), __runInitializers(_init39, 119, this);
169985
+ __privateAdd(this, _selectedIds, __runInitializers(_init39, 120, this, /* @__PURE__ */ new Set())), __runInitializers(_init39, 123, this);
169984
169986
  __publicField(this, "_rowIdMap", /* @__PURE__ */ new WeakMap());
169985
169987
  __publicField(this, "_rowIdCounter", 0);
169988
+ /**
169989
+ * Anchor row id for shift+click range selection. Set whenever the user
169990
+ * makes a non-range click (plain or cmd/ctrl) so the next shift+click
169991
+ * can compute a contiguous range from this anchor.
169992
+ */
169993
+ __publicField(this, "__selectionAnchorId");
169994
+ /**
169995
+ * Ctrl/Cmd+C copies the currently selected rows as a JSON array. Falls
169996
+ * back to copying the focused-row (`selectedDataRow`) if no multi
169997
+ * selection exists. No-op if a focused input/textarea would normally
169998
+ * receive the copy.
169999
+ */
170000
+ __publicField(this, "__handleHostKeydown", /* @__PURE__ */ __name((eventArg) => {
170001
+ const isCopy = (eventArg.metaKey || eventArg.ctrlKey) && (eventArg.key === "c" || eventArg.key === "C");
170002
+ if (!isCopy) return;
170003
+ const path2 = eventArg.composedPath?.() || [];
170004
+ for (const t9 of path2) {
170005
+ const tag = t9?.tagName;
170006
+ if (tag === "INPUT" || tag === "TEXTAREA") return;
170007
+ if (t9?.isContentEditable) return;
170008
+ }
170009
+ const rows = [];
170010
+ if (this.selectedIds.size > 0) {
170011
+ for (const r11 of this.data) if (this.selectedIds.has(this.getRowId(r11))) rows.push(r11);
170012
+ } else if (this.selectedDataRow) {
170013
+ rows.push(this.selectedDataRow);
170014
+ }
170015
+ if (rows.length === 0) return;
170016
+ eventArg.preventDefault();
170017
+ this.__writeRowsAsJson(rows);
170018
+ }, "__handleHostKeydown"));
169986
170019
  // ─── Floating header (page-sticky) lifecycle ─────────────────────────
169987
170020
  __publicField(this, "__floatingResizeObserver");
169988
170021
  __publicField(this, "__floatingScrollHandler");
169989
170022
  __publicField(this, "__floatingActive", false);
169990
170023
  __publicField(this, "__scrollAncestors", []);
169991
170024
  __publicField(this, "__debounceTimer");
170025
+ if (!this.hasAttribute("tabindex")) this.setAttribute("tabindex", "0");
170026
+ this.addEventListener("keydown", this.__handleHostKeydown);
169992
170027
  }
169993
170028
  get value() {
169994
170029
  return this.data;
169995
170030
  }
169996
170031
  set value(_valueArg) {
169997
170032
  }
170033
+ /**
170034
+ * Copies the current selection as a JSON array. If `fallbackRow` is given
170035
+ * and there is no multi-selection, that row is copied instead. Used both
170036
+ * by the Ctrl/Cmd+C handler and by the default context-menu action.
170037
+ */
170038
+ copySelectionAsJson(fallbackRow) {
170039
+ const rows = [];
170040
+ if (this.selectedIds.size > 0) {
170041
+ for (const r11 of this.data) if (this.selectedIds.has(this.getRowId(r11))) rows.push(r11);
170042
+ } else if (fallbackRow) {
170043
+ rows.push(fallbackRow);
170044
+ } else if (this.selectedDataRow) {
170045
+ rows.push(this.selectedDataRow);
170046
+ }
170047
+ if (rows.length === 0) return;
170048
+ this.__writeRowsAsJson(rows);
170049
+ }
170050
+ __writeRowsAsJson(rows) {
170051
+ try {
170052
+ const json = JSON.stringify(rows, null, 2);
170053
+ navigator.clipboard?.writeText(json);
170054
+ } catch {
170055
+ }
170056
+ }
169998
170057
  render() {
169999
170058
  const usingColumns = Array.isArray(this.columns) && this.columns.length > 0;
170000
170059
  const effectiveColumns = usingColumns ? computeEffectiveColumns(this.columns, this.augmentFromDisplayFunction, this.displayFunction, this.data) : computeColumnsFromDisplayFunction(this.displayFunction, this.data);
@@ -170091,15 +170150,9 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
170091
170150
  }, "getTr");
170092
170151
  return b2`
170093
170152
  <tr
170094
- @click=${() => {
170095
- this.selectedDataRow = itemArg;
170096
- if (this.selectionMode === "single") {
170097
- const id = this.getRowId(itemArg);
170098
- this.selectedIds.clear();
170099
- this.selectedIds.add(id);
170100
- this.emitSelectionChange();
170101
- this.requestUpdate();
170102
- }
170153
+ @click=${(e11) => this.handleRowClick(e11, itemArg, rowIndex, viewData)}
170154
+ @mousedown=${(e11) => {
170155
+ if (e11.shiftKey && this.selectionMode !== "single") e11.preventDefault();
170103
170156
  }}
170104
170157
  @dragenter=${async (eventArg) => {
170105
170158
  eventArg.preventDefault();
@@ -170134,27 +170187,43 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
170134
170187
  }
170135
170188
  }}
170136
170189
  @contextmenu=${async (eventArg) => {
170137
- DeesContextmenu.openContextMenuWithOptions(
170138
- eventArg,
170139
- this.getActionsForType("contextmenu").map((action) => {
170140
- const menuItem = {
170141
- name: action.name,
170142
- iconName: action.iconName,
170143
- action: /* @__PURE__ */ __name(async () => {
170144
- await action.actionFunc({
170145
- item: itemArg,
170146
- table: this
170147
- });
170148
- return null;
170149
- }, "action")
170150
- };
170151
- return menuItem;
170152
- })
170153
- );
170190
+ if (!this.isRowSelected(itemArg)) {
170191
+ this.selectedDataRow = itemArg;
170192
+ this.selectedIds.clear();
170193
+ this.selectedIds.add(this.getRowId(itemArg));
170194
+ this.__selectionAnchorId = this.getRowId(itemArg);
170195
+ this.emitSelectionChange();
170196
+ this.requestUpdate();
170197
+ }
170198
+ const userItems = this.getActionsForType("contextmenu").map((action) => ({
170199
+ name: action.name,
170200
+ iconName: action.iconName,
170201
+ action: /* @__PURE__ */ __name(async () => {
170202
+ await action.actionFunc({
170203
+ item: itemArg,
170204
+ table: this
170205
+ });
170206
+ return null;
170207
+ }, "action")
170208
+ }));
170209
+ const defaultItems = [
170210
+ {
170211
+ name: this.selectedIds.size > 1 ? `Copy ${this.selectedIds.size} rows as JSON` : "Copy row as JSON",
170212
+ iconName: "lucide:Copy",
170213
+ action: /* @__PURE__ */ __name(async () => {
170214
+ this.copySelectionAsJson(itemArg);
170215
+ return null;
170216
+ }, "action")
170217
+ }
170218
+ ];
170219
+ DeesContextmenu.openContextMenuWithOptions(eventArg, [
170220
+ ...userItems,
170221
+ ...defaultItems
170222
+ ]);
170154
170223
  }}
170155
- class="${itemArg === this.selectedDataRow ? "selected" : ""}"
170224
+ class="${itemArg === this.selectedDataRow || this.isRowSelected(itemArg) ? "selected" : ""}"
170156
170225
  >
170157
- ${this.selectionMode !== "none" ? b2`<td style="width:42px; text-align:center;">
170226
+ ${this.showSelectionCheckbox ? b2`<td style="width:42px; text-align:center;">
170158
170227
  <dees-input-checkbox
170159
170228
  .value=${this.isRowSelected(itemArg)}
170160
170229
  @newValue=${(e11) => {
@@ -170261,7 +170330,7 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
170261
170330
  renderHeaderRows(effectiveColumns) {
170262
170331
  return b2`
170263
170332
  <tr>
170264
- ${this.selectionMode !== "none" ? b2`
170333
+ ${this.showSelectionCheckbox ? b2`
170265
170334
  <th style="width:42px; text-align:center;">
170266
170335
  ${this.selectionMode === "multi" ? b2`
170267
170336
  <dees-input-checkbox
@@ -170293,7 +170362,7 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
170293
170362
  ${this.dataActions && this.dataActions.length > 0 ? b2`<th class="actionsCol">Actions</th>` : b2``}
170294
170363
  </tr>
170295
170364
  ${this.showColumnFilters ? b2`<tr class="filtersRow">
170296
- ${this.selectionMode !== "none" ? b2`<th style="width:42px;"></th>` : b2``}
170365
+ ${this.showSelectionCheckbox ? b2`<th style="width:42px;"></th>` : b2``}
170297
170366
  ${effectiveColumns.filter((c11) => !c11.hidden).map((col) => {
170298
170367
  const key2 = String(col.key);
170299
170368
  if (col.filterable === false) return b2`<th></th>`;
@@ -170917,6 +170986,64 @@ var _DeesTable = class _DeesTable extends (_a42 = DeesElement, _heading1_dec = [
170917
170986
  this.emitSelectionChange();
170918
170987
  this.requestUpdate();
170919
170988
  }
170989
+ /**
170990
+ * Handles row clicks with file-manager style selection semantics:
170991
+ * - plain click: select only this row, set anchor
170992
+ * - cmd/ctrl+click: toggle this row in/out, set anchor
170993
+ * - shift+click: select the contiguous range from the anchor to this row
170994
+ *
170995
+ * Multi-row click selection is always available (`selectionMode === 'none'`
170996
+ * and `'multi'` both behave this way) so consumers can always copy a set
170997
+ * of rows. Only `selectionMode === 'single'` restricts to one row.
170998
+ */
170999
+ handleRowClick(eventArg, item, rowIndex, view) {
171000
+ const id = this.getRowId(item);
171001
+ if (this.selectionMode === "single") {
171002
+ this.selectedDataRow = item;
171003
+ this.selectedIds.clear();
171004
+ this.selectedIds.add(id);
171005
+ this.__selectionAnchorId = id;
171006
+ this.emitSelectionChange();
171007
+ this.requestUpdate();
171008
+ return;
171009
+ }
171010
+ const isToggle = eventArg.metaKey || eventArg.ctrlKey;
171011
+ const isRange = eventArg.shiftKey;
171012
+ if (isRange && this.__selectionAnchorId !== void 0) {
171013
+ window.getSelection?.()?.removeAllRanges();
171014
+ const anchorIdx = view.findIndex((r11) => this.getRowId(r11) === this.__selectionAnchorId);
171015
+ if (anchorIdx >= 0) {
171016
+ const [a5, b5] = anchorIdx <= rowIndex ? [anchorIdx, rowIndex] : [rowIndex, anchorIdx];
171017
+ this.selectedIds.clear();
171018
+ for (let i11 = a5; i11 <= b5; i11++) this.selectedIds.add(this.getRowId(view[i11]));
171019
+ } else {
171020
+ this.selectedIds.clear();
171021
+ this.selectedIds.add(id);
171022
+ this.__selectionAnchorId = id;
171023
+ }
171024
+ this.selectedDataRow = item;
171025
+ } else if (isToggle) {
171026
+ const wasSelected = this.selectedIds.has(id);
171027
+ if (wasSelected) {
171028
+ this.selectedIds.delete(id);
171029
+ if (this.selectedDataRow === item) {
171030
+ const remaining = view.find((r11) => this.selectedIds.has(this.getRowId(r11)));
171031
+ this.selectedDataRow = remaining;
171032
+ }
171033
+ } else {
171034
+ this.selectedIds.add(id);
171035
+ this.selectedDataRow = item;
171036
+ }
171037
+ this.__selectionAnchorId = id;
171038
+ } else {
171039
+ this.selectedDataRow = item;
171040
+ this.selectedIds.clear();
171041
+ this.selectedIds.add(id);
171042
+ this.__selectionAnchorId = id;
171043
+ }
171044
+ this.emitSelectionChange();
171045
+ this.requestUpdate();
171046
+ }
170920
171047
  setRowSelected(row, checked) {
170921
171048
  const id = this.getRowId(row);
170922
171049
  if (this.selectionMode === "single") {
@@ -171033,6 +171160,7 @@ _sortBy = new WeakMap();
171033
171160
  _filterText = new WeakMap();
171034
171161
  _columnFilters = new WeakMap();
171035
171162
  _showColumnFilters = new WeakMap();
171163
+ _showSelectionCheckbox = new WeakMap();
171036
171164
  _fixedHeight = new WeakMap();
171037
171165
  _searchMode = new WeakMap();
171038
171166
  _selectionMode = new WeakMap();
@@ -171061,6 +171189,7 @@ __decorateElement(_init39, 4, "sortBy", _sortBy_dec, _DeesTable, _sortBy);
171061
171189
  __decorateElement(_init39, 4, "filterText", _filterText_dec, _DeesTable, _filterText);
171062
171190
  __decorateElement(_init39, 4, "columnFilters", _columnFilters_dec, _DeesTable, _columnFilters);
171063
171191
  __decorateElement(_init39, 4, "showColumnFilters", _showColumnFilters_dec, _DeesTable, _showColumnFilters);
171192
+ __decorateElement(_init39, 4, "showSelectionCheckbox", _showSelectionCheckbox_dec, _DeesTable, _showSelectionCheckbox);
171064
171193
  __decorateElement(_init39, 4, "fixedHeight", _fixedHeight_dec, _DeesTable, _fixedHeight);
171065
171194
  __decorateElement(_init39, 4, "searchMode", _searchMode_dec, _DeesTable, _searchMode);
171066
171195
  __decorateElement(_init39, 4, "selectionMode", _selectionMode_dec, _DeesTable, _selectionMode);