@toolbox-web/grid 1.3.0 → 1.4.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/all.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +997 -710
- package/all.js.map +1 -1
- package/index.js +642 -599
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts +7 -0
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/types.d.ts +151 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +19 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +42 -39
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +25 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +53 -48
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +23 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +186 -150
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +21 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +67 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +52 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +18 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +25 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +26 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +50 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts +98 -0
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
- package/lib/plugins/print/index.d.ts +10 -0
- package/lib/plugins/print/index.d.ts.map +1 -0
- package/lib/plugins/print/index.js +626 -0
- package/lib/plugins/print/index.js.map +1 -0
- package/lib/plugins/print/print-isolated.d.ts +26 -0
- package/lib/plugins/print/print-isolated.d.ts.map +1 -0
- package/lib/plugins/print/types.d.ts +147 -0
- package/lib/plugins/print/types.d.ts.map +1 -0
- package/lib/plugins/reorder/index.js +25 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +20 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +39 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -101
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +35 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +26 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +23 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +22 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +98 -24
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +76 -0
- package/umd/plugins/print.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const b = {
|
|
1
|
+
const h = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', b = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -6,9 +6,12 @@ const b = {
|
|
|
6
6
|
sortNone: "⇅",
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
|
-
toolPanel: "☰"
|
|
9
|
+
toolPanel: "☰",
|
|
10
|
+
filter: h,
|
|
11
|
+
filterActive: h,
|
|
12
|
+
print: "🖨️"
|
|
10
13
|
};
|
|
11
|
-
class
|
|
14
|
+
class C {
|
|
12
15
|
/**
|
|
13
16
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
17
|
*
|
|
@@ -321,23 +324,23 @@ function S(r, t, e) {
|
|
|
321
324
|
function y(r, t) {
|
|
322
325
|
return r == null && t == null ? 0 : r == null ? 1 : t == null ? -1 : typeof r == "number" && typeof t == "number" ? r - t : r instanceof Date && t instanceof Date ? r.getTime() - t.getTime() : typeof r == "boolean" && typeof t == "boolean" ? r === t ? 0 : r ? -1 : 1 : String(r).localeCompare(String(t));
|
|
323
326
|
}
|
|
324
|
-
function
|
|
327
|
+
function M(r, t, e, o) {
|
|
325
328
|
const i = r.find((n) => n.field === t);
|
|
326
329
|
return e ? i ? i.direction === "asc" ? r.map((n) => n.field === t ? { ...n, direction: "desc" } : n) : r.filter((n) => n.field !== t) : r.length < o ? [...r, { field: t, direction: "asc" }] : r : i?.direction === "asc" ? [{ field: t, direction: "desc" }] : i?.direction === "desc" ? [] : [{ field: t, direction: "asc" }];
|
|
327
330
|
}
|
|
328
|
-
function
|
|
331
|
+
function m(r, t) {
|
|
329
332
|
const e = r.findIndex((o) => o.field === t);
|
|
330
333
|
return e >= 0 ? e + 1 : void 0;
|
|
331
334
|
}
|
|
332
|
-
function
|
|
335
|
+
function p(r, t) {
|
|
333
336
|
return r.find((e) => e.field === t)?.direction;
|
|
334
337
|
}
|
|
335
|
-
const
|
|
336
|
-
class
|
|
338
|
+
const I = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
|
|
339
|
+
class v extends C {
|
|
337
340
|
/** @internal */
|
|
338
341
|
name = "multiSort";
|
|
339
342
|
/** @internal */
|
|
340
|
-
styles =
|
|
343
|
+
styles = I;
|
|
341
344
|
/** @internal */
|
|
342
345
|
get defaultConfig() {
|
|
343
346
|
return {
|
|
@@ -363,7 +366,7 @@ class I extends x {
|
|
|
363
366
|
onHeaderClick(t) {
|
|
364
367
|
if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
|
|
365
368
|
const o = t.originalEvent.shiftKey, i = this.config.maxSortColumns ?? 3;
|
|
366
|
-
return this.sortModel =
|
|
369
|
+
return this.sortModel = M(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
367
370
|
}
|
|
368
371
|
/** @internal */
|
|
369
372
|
afterRender() {
|
|
@@ -373,12 +376,12 @@ class I extends x {
|
|
|
373
376
|
t.querySelectorAll(".header-row .cell[data-field]").forEach((i) => {
|
|
374
377
|
const n = i.getAttribute("data-field");
|
|
375
378
|
if (!n) return;
|
|
376
|
-
const a =
|
|
379
|
+
const a = m(this.sortModel, n), d = p(this.sortModel, n);
|
|
377
380
|
if (i.querySelector(".sort-index")?.remove(), d) {
|
|
378
381
|
i.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), i.setAttribute("data-sort", d);
|
|
379
382
|
const s = document.createElement("span");
|
|
380
383
|
s.className = "sort-indicator", this.setIcon(s, this.resolveIcon(d === "asc" ? "sortAsc" : "sortDesc"));
|
|
381
|
-
const c = i.querySelector(".tbw-filter-btn"),
|
|
384
|
+
const c = i.querySelector(".tbw-filter-btn"), x = i.querySelector(".resize-handle"), g = c ?? x;
|
|
382
385
|
if (g ? i.insertBefore(s, g) : i.appendChild(s), e && this.sortModel.length > 1 && a !== void 0) {
|
|
383
386
|
const l = document.createElement("span");
|
|
384
387
|
l.className = "sort-index", l.textContent = String(a), s.nextSibling ? i.insertBefore(l, s.nextSibling) : i.appendChild(l);
|
|
@@ -415,7 +418,7 @@ class I extends x {
|
|
|
415
418
|
* @returns 1-based index or undefined if not sorted
|
|
416
419
|
*/
|
|
417
420
|
getSortIndex(t) {
|
|
418
|
-
return
|
|
421
|
+
return m(this.sortModel, t);
|
|
419
422
|
}
|
|
420
423
|
/**
|
|
421
424
|
* Get the sort direction for a specific field.
|
|
@@ -423,7 +426,7 @@ class I extends x {
|
|
|
423
426
|
* @returns Sort direction or undefined if not sorted
|
|
424
427
|
*/
|
|
425
428
|
getSortDirection(t) {
|
|
426
|
-
return
|
|
429
|
+
return p(this.sortModel, t);
|
|
427
430
|
}
|
|
428
431
|
// #endregion
|
|
429
432
|
// #region Column State Hooks
|
|
@@ -459,6 +462,6 @@ class I extends x {
|
|
|
459
462
|
// #endregion
|
|
460
463
|
}
|
|
461
464
|
export {
|
|
462
|
-
|
|
465
|
+
v as MultiSortPlugin
|
|
463
466
|
};
|
|
464
467
|
//# sourceMappingURL=index.js.map
|