@toolbox-web/grid 1.2.0 → 1.3.1
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/README.md +80 -22
- package/all.js +619 -571
- package/all.js.map +1 -1
- package/index.js +362 -302
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +64 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/types.d.ts +17 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +82 -76
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +43 -41
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +24 -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 +83 -52
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +22 -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 +160 -125
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +20 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +66 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +51 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +17 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +24 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +25 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +49 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +24 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +19 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +38 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +118 -85
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +34 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +25 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +22 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +21 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +21 -4
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.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/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,11 @@ const b = {
|
|
|
6
6
|
sortNone: "⇅",
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
|
-
toolPanel: "☰"
|
|
9
|
+
toolPanel: "☰",
|
|
10
|
+
filter: h,
|
|
11
|
+
filterActive: h
|
|
10
12
|
};
|
|
11
|
-
class
|
|
13
|
+
class C {
|
|
12
14
|
/**
|
|
13
15
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
16
|
*
|
|
@@ -321,23 +323,23 @@ function S(r, t, e) {
|
|
|
321
323
|
function y(r, t) {
|
|
322
324
|
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
325
|
}
|
|
324
|
-
function
|
|
326
|
+
function M(r, t, e, o) {
|
|
325
327
|
const i = r.find((n) => n.field === t);
|
|
326
328
|
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
329
|
}
|
|
328
|
-
function
|
|
330
|
+
function m(r, t) {
|
|
329
331
|
const e = r.findIndex((o) => o.field === t);
|
|
330
332
|
return e >= 0 ? e + 1 : void 0;
|
|
331
333
|
}
|
|
332
|
-
function
|
|
334
|
+
function p(r, t) {
|
|
333
335
|
return r.find((e) => e.field === t)?.direction;
|
|
334
336
|
}
|
|
335
|
-
const
|
|
336
|
-
class
|
|
337
|
+
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}}';
|
|
338
|
+
class v extends C {
|
|
337
339
|
/** @internal */
|
|
338
340
|
name = "multiSort";
|
|
339
341
|
/** @internal */
|
|
340
|
-
styles =
|
|
342
|
+
styles = I;
|
|
341
343
|
/** @internal */
|
|
342
344
|
get defaultConfig() {
|
|
343
345
|
return {
|
|
@@ -363,7 +365,7 @@ class I extends x {
|
|
|
363
365
|
onHeaderClick(t) {
|
|
364
366
|
if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
|
|
365
367
|
const o = t.originalEvent.shiftKey, i = this.config.maxSortColumns ?? 3;
|
|
366
|
-
return this.sortModel =
|
|
368
|
+
return this.sortModel = M(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
367
369
|
}
|
|
368
370
|
/** @internal */
|
|
369
371
|
afterRender() {
|
|
@@ -373,12 +375,12 @@ class I extends x {
|
|
|
373
375
|
t.querySelectorAll(".header-row .cell[data-field]").forEach((i) => {
|
|
374
376
|
const n = i.getAttribute("data-field");
|
|
375
377
|
if (!n) return;
|
|
376
|
-
const a =
|
|
378
|
+
const a = m(this.sortModel, n), d = p(this.sortModel, n);
|
|
377
379
|
if (i.querySelector(".sort-index")?.remove(), d) {
|
|
378
380
|
i.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), i.setAttribute("data-sort", d);
|
|
379
381
|
const s = document.createElement("span");
|
|
380
382
|
s.className = "sort-indicator", this.setIcon(s, this.resolveIcon(d === "asc" ? "sortAsc" : "sortDesc"));
|
|
381
|
-
const c = i.querySelector(".tbw-filter-btn"),
|
|
383
|
+
const c = i.querySelector(".tbw-filter-btn"), x = i.querySelector(".resize-handle"), g = c ?? x;
|
|
382
384
|
if (g ? i.insertBefore(s, g) : i.appendChild(s), e && this.sortModel.length > 1 && a !== void 0) {
|
|
383
385
|
const l = document.createElement("span");
|
|
384
386
|
l.className = "sort-index", l.textContent = String(a), s.nextSibling ? i.insertBefore(l, s.nextSibling) : i.appendChild(l);
|
|
@@ -415,7 +417,7 @@ class I extends x {
|
|
|
415
417
|
* @returns 1-based index or undefined if not sorted
|
|
416
418
|
*/
|
|
417
419
|
getSortIndex(t) {
|
|
418
|
-
return
|
|
420
|
+
return m(this.sortModel, t);
|
|
419
421
|
}
|
|
420
422
|
/**
|
|
421
423
|
* Get the sort direction for a specific field.
|
|
@@ -423,7 +425,7 @@ class I extends x {
|
|
|
423
425
|
* @returns Sort direction or undefined if not sorted
|
|
424
426
|
*/
|
|
425
427
|
getSortDirection(t) {
|
|
426
|
-
return
|
|
428
|
+
return p(this.sortModel, t);
|
|
427
429
|
}
|
|
428
430
|
// #endregion
|
|
429
431
|
// #region Column State Hooks
|
|
@@ -459,6 +461,6 @@ class I extends x {
|
|
|
459
461
|
// #endregion
|
|
460
462
|
}
|
|
461
463
|
export {
|
|
462
|
-
|
|
464
|
+
v as MultiSortPlugin
|
|
463
465
|
};
|
|
464
466
|
//# sourceMappingURL=index.js.map
|