@ixfx/components 0.9.7 → 0.10.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/bundle/index.d.ts +839 -68
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +16398 -13118
- package/bundle/index.js.map +1 -1
- package/bundle/style.css +2 -2
- package/dist/ac-text.d.ts +1 -1
- package/dist/ac-text.js +2 -2
- package/dist/{ac-token-TCLAZeVg.d.ts → ac-token--_vCHXWw.d.ts} +2 -2
- package/dist/{ac-token-TCLAZeVg.d.ts.map → ac-token--_vCHXWw.d.ts.map} +1 -1
- package/dist/ac-token.d.ts +1 -1
- package/dist/ac-token.js +2 -2
- package/dist/button.d.ts +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{colour-picker-CSxwUmtE.js → colour-picker-R73i0QTP.js} +2 -2
- package/dist/{colour-picker-CSxwUmtE.js.map → colour-picker-R73i0QTP.js.map} +1 -1
- package/dist/colour-picker.d.ts +1 -1
- package/dist/colour-picker.js +1 -1
- package/dist/crumbs.d.ts +2 -2
- package/dist/crumbs.js +2 -2
- package/dist/data-display.js +1 -1
- package/dist/{data-grid-8N0Kd5-6.d.ts → data-grid-C5hk_pzK.d.ts} +34 -4
- package/dist/data-grid-C5hk_pzK.d.ts.map +1 -0
- package/dist/data-grid.d.ts +2 -2
- package/dist/data-grid.js +126 -18
- package/dist/data-grid.js.map +1 -1
- package/dist/{detail-list-CQguZg9h.d.ts → detail-list-CxPpv89T.d.ts} +6 -5
- package/dist/detail-list-CxPpv89T.d.ts.map +1 -0
- package/dist/detail-list.d.ts +3 -3
- package/dist/detail-list.js +5 -3
- package/dist/detail-list.js.map +1 -1
- package/dist/editable-label.js +1 -1
- package/dist/{fallbacks-BcKGq-2F.js → fallbacks-DQ_5OsmR.js} +2 -2
- package/dist/{fallbacks-BcKGq-2F.js.map → fallbacks-DQ_5OsmR.js.map} +1 -1
- package/dist/{grid-list-CSw1VMXT.d.ts → grid-list-BGvoWbZz.d.ts} +30 -69
- package/dist/grid-list-BGvoWbZz.d.ts.map +1 -0
- package/dist/{grid-list-mL0GJTQR.js → grid-list-DSnYOGh7.js} +64 -233
- package/dist/grid-list-DSnYOGh7.js.map +1 -0
- package/dist/grid-list.d.ts +2 -2
- package/dist/grid-list.js +1 -1
- package/dist/{grouped-item-lister-CEZ72VOs.d.ts → grouped-item-lister-fdZHVxFM.d.ts} +2 -2
- package/dist/{grouped-item-lister-CEZ72VOs.d.ts.map → grouped-item-lister-fdZHVxFM.d.ts.map} +1 -1
- package/dist/grouped-item-lister.d.ts +1 -1
- package/dist/{icon-Dy33gu4Z.js → icon-BCJJYEpm.js} +2 -2
- package/dist/{icon-Dy33gu4Z.js.map → icon-BCJJYEpm.js.map} +1 -1
- package/dist/{icon-DR_3rSyZ.d.ts → icon-CDGprSdE.d.ts} +2 -2
- package/dist/icon-CDGprSdE.d.ts.map +1 -0
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +1 -1
- package/dist/incr-search.d.ts +1 -1
- package/dist/{index--qnhBWZJ.d.ts → index--5BSdbnL.d.ts} +2 -2
- package/dist/{index--qnhBWZJ.d.ts.map → index--5BSdbnL.d.ts.map} +1 -1
- package/dist/{index-C59-JEPl.d.ts → index-9AhaHIT2.d.ts} +3 -3
- package/dist/{index-C59-JEPl.d.ts.map → index-9AhaHIT2.d.ts.map} +1 -1
- package/dist/{index-DsjpDksO.d.ts → index-CS9yM8L-.d.ts} +2 -2
- package/dist/{index-DsjpDksO.d.ts.map → index-CS9yM8L-.d.ts.map} +1 -1
- package/dist/{index-BUB5SICW.d.ts → index-CoqtMSd9.d.ts} +2 -2
- package/dist/{index-BUB5SICW.d.ts.map → index-CoqtMSd9.d.ts.map} +1 -1
- package/dist/{index-CJ5fshD3.d.ts → index-UvnoZUAo.d.ts} +2 -2
- package/dist/{index-CJ5fshD3.d.ts.map → index-UvnoZUAo.d.ts.map} +1 -1
- package/dist/{index-BOUaDIW-.d.ts → index-tq6f8007.d.ts} +2 -2
- package/dist/{index-BOUaDIW-.d.ts.map → index-tq6f8007.d.ts.map} +1 -1
- package/dist/index.d.ts +648 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4815 -2323
- package/dist/index.js.map +1 -1
- package/dist/{labelled-input-base-Dp_9KP0G.d.ts → labelled-input-base-DiTme1JO.d.ts} +2 -2
- package/dist/{labelled-input-base-Dp_9KP0G.d.ts.map → labelled-input-base-DiTme1JO.d.ts.map} +1 -1
- package/dist/labelled-radial-input.d.ts +2 -2
- package/dist/labelled-radial-input.d.ts.map +1 -1
- package/dist/labelled-radial-input.js +2 -2
- package/dist/labelled-range-input.d.ts +1 -1
- package/dist/{labelled-slider-input-aEYDvW2S.js → labelled-slider-input-CF2RtzgG.js} +3 -3
- package/dist/{labelled-slider-input-aEYDvW2S.js.map → labelled-slider-input-CF2RtzgG.js.map} +1 -1
- package/dist/labelled-slider-input.d.ts +1 -1
- package/dist/labelled-slider-input.js +1 -1
- package/dist/{list-native-drag-controller-B0hWdbtM.js → list-native-drag-controller-D97TYjn1.js} +36 -5
- package/dist/list-native-drag-controller-D97TYjn1.js.map +1 -0
- package/dist/{list-native-drag-controller-Cmpx7jnx.d.ts → list-native-drag-controller-DWiXQZou.d.ts} +3 -2
- package/dist/list-native-drag-controller-DWiXQZou.d.ts.map +1 -0
- package/dist/{menu-CMXhIaNZ.js → menu-C8a-84S5.js} +4 -4
- package/dist/{menu-CMXhIaNZ.js.map → menu-C8a-84S5.js.map} +1 -1
- package/dist/{menu-item-ZmkXNjek.d.ts → menu-item-CZi9vy5O.d.ts} +2 -2
- package/dist/{menu-item-ZmkXNjek.d.ts.map → menu-item-CZi9vy5O.d.ts.map} +1 -1
- package/dist/{menu-item-BYGQzyCe.js → menu-item-DzizkMH-.js} +3 -3
- package/dist/{menu-item-BYGQzyCe.js.map → menu-item-DzizkMH-.js.map} +1 -1
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +2 -2
- package/dist/miller.d.ts +2 -2
- package/dist/miller.js +1 -1
- package/dist/narrowed-text.js +1 -1
- package/dist/notifier.js +1 -1
- package/dist/pan-text-CoYmt2qd.d.ts +67 -0
- package/dist/pan-text-CoYmt2qd.d.ts.map +1 -0
- package/dist/pan-text-CqtvjPyK.js +235 -0
- package/dist/pan-text-CqtvjPyK.js.map +1 -0
- package/dist/panel.d.ts +1 -1
- package/dist/panel.js +1 -1
- package/dist/polar-pad.js +1 -1
- package/dist/{radial-input-DyxfbNzD.js → radial-input-KMVltQfe.js} +2 -2
- package/dist/{radial-input-DyxfbNzD.js.map → radial-input-KMVltQfe.js.map} +1 -1
- package/dist/radial-input.js +1 -1
- package/dist/range-input.js +1 -1
- package/dist/range.js +1 -1
- package/dist/select-horiz.js +1 -1
- package/dist/{slider-input-Cb5uSV42.js → slider-input-ByHdotzp.js} +2 -2
- package/dist/{slider-input-Cb5uSV42.js.map → slider-input-ByHdotzp.js.map} +1 -1
- package/dist/slider-input.js +1 -1
- package/dist/snackbar.js +1 -1
- package/dist/{split-layout-Bx0g8k8-.js → split-layout-3yBOEVZW.js} +2 -2
- package/dist/{split-layout-Bx0g8k8-.js.map → split-layout-3yBOEVZW.js.map} +1 -1
- package/dist/{split-layout-C5SYbDrq.d.ts → split-layout-JK3xWVX2.d.ts} +2 -2
- package/dist/{split-layout-C5SYbDrq.d.ts.map → split-layout-JK3xWVX2.d.ts.map} +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +1 -1
- package/dist/style.css +2 -2
- package/dist/swipe.js +1 -1
- package/dist/{tab-list-DbMIL520.d.ts → tab-list-CGyPt07Z.d.ts} +2 -2
- package/dist/{tab-list-DbMIL520.d.ts.map → tab-list-CGyPt07Z.d.ts.map} +1 -1
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/{timeline-THyvH8xy.js → timeline-CFlBFFGZ.js} +2 -2
- package/dist/{timeline-THyvH8xy.js.map → timeline-CFlBFFGZ.js.map} +1 -1
- package/dist/timeline.js +1 -1
- package/dist/{titlebar-B5zSTZnF.d.ts → titlebar-Tqu-VvMU.d.ts} +2 -2
- package/dist/{titlebar-B5zSTZnF.d.ts.map → titlebar-Tqu-VvMU.d.ts.map} +1 -1
- package/dist/titlebar.d.ts +1 -1
- package/dist/titlebar.js +2 -2
- package/dist/{tree-DAFBO_MF.js → tree-C25xYUa6.js} +5 -3
- package/dist/tree-C25xYUa6.js.map +1 -0
- package/dist/{tree-component-BW2iCFq9.d.ts → tree-component-mw8x-n2Y.d.ts} +4 -2
- package/dist/tree-component-mw8x-n2Y.d.ts.map +1 -0
- package/dist/tree.d.ts +4 -3
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +1 -1
- package/dist/{vertical-list-CHrXmmQ3.d.ts → vertical-list--tFanQwM.d.ts} +92 -4
- package/dist/vertical-list--tFanQwM.d.ts.map +1 -0
- package/dist/vertical-list.d.ts +2 -2
- package/dist/vertical-list.js +618 -29
- package/dist/vertical-list.js.map +1 -1
- package/dist/xy-pad.js +1 -1
- package/docs-user/data-grid.md +59 -0
- package/docs-user/grid-list.md +14 -0
- package/docs-user/index.json +2 -2
- package/package.json +1 -1
- package/dist/data-grid-8N0Kd5-6.d.ts.map +0 -1
- package/dist/detail-list-CQguZg9h.d.ts.map +0 -1
- package/dist/grid-list-CSw1VMXT.d.ts.map +0 -1
- package/dist/grid-list-mL0GJTQR.js.map +0 -1
- package/dist/icon-DR_3rSyZ.d.ts.map +0 -1
- package/dist/list-native-drag-controller-B0hWdbtM.js.map +0 -1
- package/dist/list-native-drag-controller-Cmpx7jnx.d.ts.map +0 -1
- package/dist/tree-DAFBO_MF.js.map +0 -1
- package/dist/tree-component-BW2iCFq9.d.ts.map +0 -1
- package/dist/vertical-list-CHrXmmQ3.d.ts.map +0 -1
package/dist/data-grid.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { t as TickledController } from "./tickled-controller-Dh1Uh_vG.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-BrAHEj1q.js";
|
|
3
|
-
import { t as themeFallbacks } from "./fallbacks-
|
|
3
|
+
import { t as themeFallbacks } from "./fallbacks-DQ_5OsmR.js";
|
|
4
4
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
5
5
|
import { i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES } from "./incr-search-C05WjbZh.js";
|
|
6
6
|
import { t as handleStyles } from "./handle-BPOxBOKf.js";
|
|
7
|
-
import { t as ListNativeDragController } from "./list-native-drag-controller-
|
|
7
|
+
import { t as ListNativeDragController } from "./list-native-drag-controller-D97TYjn1.js";
|
|
8
8
|
import { i as listItemFadeKeyframes } from "./list-item-animation-BUoEKi5s.js";
|
|
9
9
|
import "./interaction-BskmlA9t.js";
|
|
10
10
|
import { t as createDragGhost } from "./drag-ghost-DtSDvjri.js";
|
|
11
|
-
import "./menu-
|
|
11
|
+
import "./menu-C8a-84S5.js";
|
|
12
|
+
import "./pan-text-CqtvjPyK.js";
|
|
12
13
|
import { LitElement, css, html, nothing } from "lit";
|
|
13
14
|
import { property, query, state } from "lit/decorators.js";
|
|
14
15
|
import { createCommandRegistry } from "@clinth/ui-commands";
|
|
@@ -26,12 +27,16 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
26
27
|
this.getRowKey = (r, i) => r.key ?? r.id ?? String(i);
|
|
27
28
|
this.editable = false;
|
|
28
29
|
this.editability = `user`;
|
|
30
|
+
this.cellOverflow = `ellipsis`;
|
|
31
|
+
this.zebraStripes = false;
|
|
29
32
|
this.groupBy = null;
|
|
30
33
|
this.allowGrouping = false;
|
|
31
34
|
this.crossGroupSelection = false;
|
|
32
35
|
this.columnMenu = `auto`;
|
|
33
36
|
this.itemsDraggable = false;
|
|
34
37
|
this._columnFormatters = /* @__PURE__ */ new Map();
|
|
38
|
+
this._resizingColKey = void 0;
|
|
39
|
+
this._animatingColKeys = /* @__PURE__ */ new Set();
|
|
35
40
|
this._selectedKeys = /* @__PURE__ */ new Set();
|
|
36
41
|
this._scrollTop = 0;
|
|
37
42
|
this._scrollLeft = 0;
|
|
@@ -64,6 +69,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
64
69
|
prepareSelection: (originKey) => this.#prepareNativeDrag(originKey),
|
|
65
70
|
getMetrics: () => ({ rowHeight: this.rowHeight }),
|
|
66
71
|
getRenderer: () => this.dragPreviewRenderer,
|
|
72
|
+
getDragPreviewSourceResolver: () => this.dragPreviewSource,
|
|
67
73
|
dispatch: (detail) => this.dispatchEvent(new CustomEvent(`list-native-drag-start`, {
|
|
68
74
|
detail,
|
|
69
75
|
bubbles: true,
|
|
@@ -312,6 +318,14 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
312
318
|
--data-grid-header-bg: var(--surface-2);
|
|
313
319
|
--data-grid-border: var(--border);
|
|
314
320
|
--data-grid-header-text: var(--surface-3-text);
|
|
321
|
+
--data-grid-reorder-handle-width: 10px;
|
|
322
|
+
/* How strongly the alternate ("zebra") row stands out from the base row
|
|
323
|
+
background when [zebra-stripes] is set - a color-mix() percentage. */
|
|
324
|
+
--data-grid-zebra-intensity: 6%;
|
|
325
|
+
/* Duration of the width transition when a column is auto-sized via
|
|
326
|
+
autoSizeColumn(). Read back in JS (_columnResizeAnimationMs) to know
|
|
327
|
+
when the animation has finished, so keep it a plain time value. */
|
|
328
|
+
--data-grid-column-resize-duration: 180ms;
|
|
315
329
|
position: relative;
|
|
316
330
|
display: block;
|
|
317
331
|
overflow: hidden;
|
|
@@ -340,11 +354,28 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
340
354
|
box-sizing: border-box;
|
|
341
355
|
}
|
|
342
356
|
.header-cell[data-tickled] { background: var(--surface-5); }
|
|
357
|
+
/* Applied to a header-cell / cell while its column is animating towards
|
|
358
|
+
an autoSizeColumn() target width. */
|
|
359
|
+
.header-cell.width-animating, .cell.width-animating {
|
|
360
|
+
transition: width var(--data-grid-column-resize-duration, 180ms) ease-out;
|
|
361
|
+
}
|
|
362
|
+
@media (prefers-reduced-motion: reduce) {
|
|
363
|
+
.header-cell.width-animating, .cell.width-animating { transition: none; }
|
|
364
|
+
}
|
|
343
365
|
.header-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
344
366
|
.sort-icon { font-size: 10px; opacity: 0.7; }
|
|
345
|
-
.resize-handle {
|
|
346
|
-
|
|
347
|
-
|
|
367
|
+
.resize-handle {
|
|
368
|
+
position: absolute; right: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 1;
|
|
369
|
+
display: flex; align-items: stretch; justify-content: center;
|
|
370
|
+
}
|
|
371
|
+
.resize-handle::before {
|
|
372
|
+
content: ''; width: 2px; margin: 2px 0; border-radius: 1px; background: var(--split-gutter-color, transparent);
|
|
373
|
+
transition: background-color var(--transition, 0.15s ease-out);
|
|
374
|
+
}
|
|
375
|
+
.resize-handle:hover::before { background: var(--split-gutter-hover-color, var(--surface-6)); }
|
|
376
|
+
.resize-handle[data-active]::before { background: var(--split-gutter-active-color, var(--accent)); }
|
|
377
|
+
.reorder-handle { cursor: grab; opacity: 0.5; display: inline-flex; align-items: center; }
|
|
378
|
+
.reorder-handle .ixfx-handle { --ixfx-handle-length: 14px; --ixfx-handle-thickness: var(--data-grid-reorder-handle-width, 10px); --ixfx-handle-dot-size: 3px; }
|
|
348
379
|
.flyout-trigger { flex-shrink: 0; width: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-left: var(--border-subtle); background: var(--data-grid-header-bg); }
|
|
349
380
|
.viewport { flex: 1; overflow: auto; position: relative; }
|
|
350
381
|
.spacer { position: relative; }
|
|
@@ -352,14 +383,28 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
352
383
|
position: absolute; left: 0; right: 0; display: flex; align-items: stretch;
|
|
353
384
|
gap: 0;
|
|
354
385
|
height: var(--data-grid-row-height);
|
|
355
|
-
|
|
356
|
-
|
|
386
|
+
/* Border width is always 1px, even when not visually shown (transparent),
|
|
387
|
+
so hover/selection never changes the box size and shifts content. */
|
|
388
|
+
border: 1px solid transparent;
|
|
357
389
|
background: var(--item-bg);
|
|
358
390
|
border-radius: var(--item-border-radius);
|
|
359
391
|
padding: 0;
|
|
360
392
|
box-sizing: border-box;
|
|
393
|
+
/* Only background transitions - hover ("tickled") no longer changes
|
|
394
|
+
border, so there is nothing else to animate. */
|
|
395
|
+
transition: background var(--transition, 0.1s ease-out);
|
|
396
|
+
}
|
|
397
|
+
/* Zebra striping: alternate rows tint towards the text colour, which
|
|
398
|
+
lightens in dark themes and darkens in light themes - so it reads as
|
|
399
|
+
"more contrast" either way. The zebra-odd class is only applied when
|
|
400
|
+
zebraStripes is set (see render()). Declared before .tickled /
|
|
401
|
+
.selected so those states (same specificity) still win when a striped
|
|
402
|
+
row is also hovered or selected. */
|
|
403
|
+
.row.item.zebra-odd {
|
|
404
|
+
background: color-mix(in oklch, transparent calc(100% - var(--data-grid-zebra-intensity, 6%)), var(--surface-3-text) var(--data-grid-zebra-intensity, 6%));
|
|
361
405
|
}
|
|
362
|
-
|
|
406
|
+
/* Hover: background only, no border change (avoids layout shift + colour flash). */
|
|
407
|
+
.row.item.tickled { background: var(--item-bg-tickled); color: var(--item-text-tickled); }
|
|
363
408
|
.row.item.selected { background: var(--item-bg-selected); border: var(--item-border-selected); color: var(--item-text-selected); }
|
|
364
409
|
.row.item.selected.tickled { background: var(--item-bg-selected-tickled); }
|
|
365
410
|
.row.item.dragging-origin { opacity: 0.6; }
|
|
@@ -1228,7 +1273,13 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1228
1273
|
composed: true
|
|
1229
1274
|
}));
|
|
1230
1275
|
}
|
|
1231
|
-
|
|
1276
|
+
/**
|
|
1277
|
+
* Measure the width a column would need to show its header label and every
|
|
1278
|
+
* row's (formatted) value without truncation, clamped to `minWidth`/`maxWidth`.
|
|
1279
|
+
* Values are measured from their formatted string via canvas `measureText` -
|
|
1280
|
+
* accurate for plain text, an estimate for anything else.
|
|
1281
|
+
*/
|
|
1282
|
+
_measureAutoWidth(col) {
|
|
1232
1283
|
const cs = getComputedStyle(this);
|
|
1233
1284
|
const font = `${cs.fontSize} ${cs.fontFamily}`;
|
|
1234
1285
|
const ctx = document.createElement(`canvas`).getContext(`2d`);
|
|
@@ -1243,12 +1294,15 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1243
1294
|
for (const r of this.rows) {
|
|
1244
1295
|
const v = r[col.key];
|
|
1245
1296
|
if (v === null || v === void 0 || v === ``) continue;
|
|
1246
|
-
const w = measure(String(v)) + cellPad;
|
|
1297
|
+
const w = measure(String(this._formatValue(v, col, r))) + cellPad;
|
|
1247
1298
|
if (w > maxW) maxW = w;
|
|
1248
1299
|
}
|
|
1249
1300
|
const min = col.minWidth ?? 40;
|
|
1250
1301
|
const max = col.maxWidth ?? 600;
|
|
1251
|
-
|
|
1302
|
+
return Math.max(min, Math.min(max, maxW));
|
|
1303
|
+
}
|
|
1304
|
+
_autoSizeColumn(col) {
|
|
1305
|
+
const w = this._measureAutoWidth(col);
|
|
1252
1306
|
col.width = w;
|
|
1253
1307
|
this.requestUpdate();
|
|
1254
1308
|
this.dispatchEvent(new CustomEvent(`datagrid-column-resize`, {
|
|
@@ -1260,11 +1314,50 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1260
1314
|
composed: true
|
|
1261
1315
|
}));
|
|
1262
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Resize a single column, by key, to fit its contents (header label + every
|
|
1319
|
+
* row's formatted value), animating the width change smoothly. Only works
|
|
1320
|
+
* for plain columns - one with a custom `renderer` can't be measured
|
|
1321
|
+
* reliably from its raw value, so it's left untouched. Returns `false` (and
|
|
1322
|
+
* does nothing) if the column doesn't exist, isn't resizable, or has a
|
|
1323
|
+
* `renderer`.
|
|
1324
|
+
*/
|
|
1325
|
+
autoSizeColumn(key) {
|
|
1326
|
+
const col = this.columns.find((c) => c.key === key);
|
|
1327
|
+
if (!col || col.resizable === false || col.renderer) return false;
|
|
1328
|
+
const target = this._measureAutoWidth(col);
|
|
1329
|
+
if ((col.width ?? 150) === target) return true;
|
|
1330
|
+
this._animatingColKeys = new Set(this._animatingColKeys).add(key);
|
|
1331
|
+
requestAnimationFrame(() => {
|
|
1332
|
+
col.width = target;
|
|
1333
|
+
this.requestUpdate();
|
|
1334
|
+
this.dispatchEvent(new CustomEvent(`datagrid-column-resize`, {
|
|
1335
|
+
detail: {
|
|
1336
|
+
key,
|
|
1337
|
+
width: target
|
|
1338
|
+
},
|
|
1339
|
+
bubbles: true,
|
|
1340
|
+
composed: true
|
|
1341
|
+
}));
|
|
1342
|
+
window.setTimeout(() => {
|
|
1343
|
+
const next = new Set(this._animatingColKeys);
|
|
1344
|
+
next.delete(key);
|
|
1345
|
+
this._animatingColKeys = next;
|
|
1346
|
+
}, this._columnResizeAnimationMs());
|
|
1347
|
+
});
|
|
1348
|
+
return true;
|
|
1349
|
+
}
|
|
1350
|
+
_columnResizeAnimationMs() {
|
|
1351
|
+
const raw = getComputedStyle(this).getPropertyValue(`--data-grid-column-resize-duration`).trim();
|
|
1352
|
+
const ms = raw.endsWith(`ms`) ? Number.parseFloat(raw) : raw.endsWith(`s`) ? Number.parseFloat(raw) * 1e3 : Number.parseFloat(raw);
|
|
1353
|
+
return (Number.isFinite(ms) && ms > 0 ? ms : 180) + 30;
|
|
1354
|
+
}
|
|
1263
1355
|
_onResizePointerDown(e, col) {
|
|
1264
1356
|
e.preventDefault();
|
|
1265
1357
|
e.stopPropagation();
|
|
1266
1358
|
const startX = e.clientX;
|
|
1267
1359
|
const startW = col.width ?? 150;
|
|
1360
|
+
this._resizingColKey = col.key;
|
|
1268
1361
|
const onMove = (ev) => {
|
|
1269
1362
|
col.width = Math.max(col.minWidth ?? 40, Math.min(col.maxWidth ?? 600, startW + ev.clientX - startX));
|
|
1270
1363
|
this.requestUpdate();
|
|
@@ -1272,6 +1365,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1272
1365
|
const onUp = (ev) => {
|
|
1273
1366
|
window.removeEventListener(`pointermove`, onMove);
|
|
1274
1367
|
window.removeEventListener(`pointerup`, onUp);
|
|
1368
|
+
this._resizingColKey = void 0;
|
|
1275
1369
|
const w = Math.max(col.minWidth ?? 40, Math.min(col.maxWidth ?? 600, startW + ev.clientX - startX));
|
|
1276
1370
|
this.dispatchEvent(new CustomEvent(`datagrid-column-resize`, {
|
|
1277
1371
|
detail: {
|
|
@@ -1328,15 +1422,15 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1328
1422
|
<div class="header-scroll">
|
|
1329
1423
|
${showCheckbox ? html`<div class="header-cell checkbox-col"></div>` : nothing}
|
|
1330
1424
|
${repeat(this._visibleColumns, (c) => c.key, (col, idx) => html`
|
|
1331
|
-
<div class="header-cell" style="width:${col.width ?? 150}px" ?drag-source=${this._drag?.active && this._drag.sourceCol.key === col.key}
|
|
1425
|
+
<div class="header-cell ${this._animatingColKeys.has(col.key) ? `width-animating` : ``}" style="width:${col.width ?? 150}px" ?drag-source=${this._drag?.active && this._drag.sourceCol.key === col.key}
|
|
1332
1426
|
@click=${() => this._onHeaderClick(col)}
|
|
1333
1427
|
@pointerenter=${() => this._tickled.handlePointerEnter(col.key)}>
|
|
1334
1428
|
${col.reorderable !== false ? html`<span class="reorder-handle" draggable="false"
|
|
1335
1429
|
@pointerdown=${(e) => this._beginHeaderDrag(e, col, idx)}
|
|
1336
|
-
><span class="ixfx-handle" data-handle="dotted" data-shape="
|
|
1430
|
+
><span class="ixfx-handle" data-handle="dotted" data-shape="vertical" part="reorder-handle"></span></span>` : nothing}
|
|
1337
1431
|
<span class="header-label">${col.label}</span>
|
|
1338
1432
|
${this.sortState?.key === col.key ? html`<span class="sort-icon">${this.sortState.direction === `asc` ? `▲` : `▼`}</span>` : nothing}
|
|
1339
|
-
${col.resizable !== false ? html`<span class="resize-handle" @pointerdown=${(e) => this._onResizePointerDown(e, col)} @click=${(e) => e.stopPropagation()} @dblclick=${(e) => {
|
|
1433
|
+
${col.resizable !== false ? html`<span class="resize-handle" ?data-active=${this._resizingColKey === col.key} @pointerdown=${(e) => this._onResizePointerDown(e, col)} @click=${(e) => e.stopPropagation()} @dblclick=${(e) => {
|
|
1340
1434
|
e.preventDefault();
|
|
1341
1435
|
e.stopPropagation();
|
|
1342
1436
|
this._autoSizeColumn(col);
|
|
@@ -1407,7 +1501,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1407
1501
|
const selected = this._selectedKeys.has(rowKey);
|
|
1408
1502
|
const tickled = this._tickled.isTickled(rowKey);
|
|
1409
1503
|
return html`
|
|
1410
|
-
<div class="row item ${selected ? `selected` : ``} ${tickled ? `tickled` : ``} ${this.#enteringRowKeys.has(rowKey) ? `entering` : ``} ${this.#nativeDragging && rowKey === this.#dragOriginKey ? `dragging-origin` : ``}" style="top:${absIdx * rh}px; height:${rh}px"
|
|
1504
|
+
<div class="row item ${selected ? `selected` : ``} ${tickled ? `tickled` : ``} ${this.zebraStripes && absIdx2 % 2 === 1 ? `zebra-odd` : ``} ${this.#enteringRowKeys.has(rowKey) ? `entering` : ``} ${this.#nativeDragging && rowKey === this.#dragOriginKey ? `dragging-origin` : ``}" style="top:${absIdx * rh}px; height:${rh}px"
|
|
1411
1505
|
data-key=${rowKey}
|
|
1412
1506
|
draggable=${this.#nativeDrag.draggableAttr}
|
|
1413
1507
|
@click=${(e) => {
|
|
@@ -1513,7 +1607,9 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1513
1607
|
const rendered = col.renderer ? col.renderer(row, col, absIdx2) : displayVal;
|
|
1514
1608
|
const cellContent = col.renderer ? rendered : displayVal;
|
|
1515
1609
|
const textEditable = this._isEditable(row, col) && this._isTextEditor(col);
|
|
1516
|
-
|
|
1610
|
+
const indent = col.align !== `right` && col.align !== `center` && col.reorderable !== false ? `padding-left:calc(var(--space-s) + var(--data-grid-reorder-handle-width, 10px) + var(--space-xs));` : ``;
|
|
1611
|
+
const canPan = this.cellOverflow === `pan-text` && !col.renderer && (selected || tickled);
|
|
1612
|
+
return html`<div class="cell ${textEditable ? `editable-text` : ``} ${this._animatingColKeys.has(col.key) ? `width-animating` : ``}" data-col=${col.key} style="width:${col.width ?? 150}px; justify-content:${col.align === `right` ? `flex-end` : col.align === `center` ? `center` : `flex-start`}; ${indent}"
|
|
1517
1613
|
@click=${(e) => {
|
|
1518
1614
|
this._lastClickedCell = {
|
|
1519
1615
|
rowKey,
|
|
@@ -1535,7 +1631,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1535
1631
|
composed: true
|
|
1536
1632
|
}));
|
|
1537
1633
|
}}
|
|
1538
|
-
>${cellContent}</div>`;
|
|
1634
|
+
>${canPan ? html`<ixfx-pan-text mode="loop">${cellContent}</ixfx-pan-text>` : cellContent}</div>`;
|
|
1539
1635
|
})}
|
|
1540
1636
|
</div>
|
|
1541
1637
|
`;
|
|
@@ -1569,6 +1665,15 @@ __decorate([property({
|
|
|
1569
1665
|
type: String,
|
|
1570
1666
|
reflect: true
|
|
1571
1667
|
})], DataGridElement.prototype, "editability", void 0);
|
|
1668
|
+
__decorate([property({
|
|
1669
|
+
type: String,
|
|
1670
|
+
attribute: `cell-overflow`
|
|
1671
|
+
})], DataGridElement.prototype, "cellOverflow", void 0);
|
|
1672
|
+
__decorate([property({
|
|
1673
|
+
type: Boolean,
|
|
1674
|
+
attribute: `zebra-stripes`,
|
|
1675
|
+
reflect: true
|
|
1676
|
+
})], DataGridElement.prototype, "zebraStripes", void 0);
|
|
1572
1677
|
__decorate([property({ attribute: false })], DataGridElement.prototype, "groupBy", void 0);
|
|
1573
1678
|
__decorate([property({
|
|
1574
1679
|
type: Boolean,
|
|
@@ -1599,6 +1704,9 @@ __decorate([property({
|
|
|
1599
1704
|
reflect: true
|
|
1600
1705
|
})], DataGridElement.prototype, "itemsDraggable", void 0);
|
|
1601
1706
|
__decorate([property({ attribute: false })], DataGridElement.prototype, "dragPreviewRenderer", void 0);
|
|
1707
|
+
__decorate([property({ attribute: false })], DataGridElement.prototype, "dragPreviewSource", void 0);
|
|
1708
|
+
__decorate([state()], DataGridElement.prototype, "_resizingColKey", void 0);
|
|
1709
|
+
__decorate([state()], DataGridElement.prototype, "_animatingColKeys", void 0);
|
|
1602
1710
|
__decorate([state()], DataGridElement.prototype, "_selectedKeys", void 0);
|
|
1603
1711
|
__decorate([state()], DataGridElement.prototype, "_scrollTop", void 0);
|
|
1604
1712
|
__decorate([state()], DataGridElement.prototype, "_scrollLeft", void 0);
|