@svgrid/enterprise 3.1.21 → 3.1.22

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.
Files changed (44) hide show
  1. package/dist/SvGridRowCount.svelte +23 -0
  2. package/dist/SvGridRowCount.svelte.d.ts +6 -0
  3. package/dist/cdn/svgrid-enterprise.svelte-external.js +8691 -8479
  4. package/dist/designer/assets/GridFooter-DKMfZpL4.js +2 -0
  5. package/dist/designer/assets/GridMenus-DWDghydL.js +6 -0
  6. package/dist/designer/assets/{PinSplitter-C5AwA1xV.js → PinSplitter-BfIjd7pi.js} +1 -1
  7. package/dist/designer/assets/grid-extension.svelte-G1ng0xd2.js +1 -0
  8. package/dist/designer/assets/index-9APkRkTg.css +1 -0
  9. package/dist/designer/assets/{index-DLJjuVA4.js → index-ICCQKTGR.js} +324 -324
  10. package/dist/designer/index.html +3 -3
  11. package/dist/expressions/compile.js +11 -7
  12. package/dist/expressions/evaluate.js +4 -0
  13. package/dist/expressions/expression-columns.d.ts +4 -1
  14. package/dist/expressions/expression-columns.js +12 -3
  15. package/dist/expressions/parse.js +19 -7
  16. package/dist/filter-labels.d.ts +16 -0
  17. package/dist/filter-labels.js +83 -0
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.js +7 -0
  20. package/dist/install.js +8 -0
  21. package/dist/node/studio.js +12 -5
  22. package/dist/relative-date-core.d.ts +40 -0
  23. package/dist/relative-date-core.js +85 -0
  24. package/dist/relative-dates.d.ts +28 -0
  25. package/dist/relative-dates.js +61 -0
  26. package/dist/row-count.d.ts +28 -0
  27. package/dist/row-count.js +39 -0
  28. package/dist/sort-blanks.d.ts +8 -0
  29. package/dist/sort-blanks.js +47 -0
  30. package/dist/studio/ui-components.generated.js +1 -1
  31. package/dist/version.d.ts +2 -2
  32. package/dist/version.js +2 -2
  33. package/dist/wc/GridFooter-CKC4L36O.js +162 -0
  34. package/dist/wc/{GridMenus-DVGuqp2l.js → GridMenus-h7RsvcmI.js} +320 -303
  35. package/dist/wc/{PinSplitter-Btco0txr.js → PinSplitter-BN6ybmjs.js} +1 -1
  36. package/dist/wc/grid-extension.svelte-CDf5EUyz.js +27 -0
  37. package/dist/wc/sv-sheet-element.js +6775 -6767
  38. package/package.json +3 -3
  39. package/dist/designer/assets/GridFooter-CKBVItAU.js +0 -2
  40. package/dist/designer/assets/GridMenus-Dzwu7M9r.js +0 -6
  41. package/dist/designer/assets/grid-extension.svelte-BZ7AqyJI.js +0 -1
  42. package/dist/designer/assets/index-WCxj6WfJ.css +0 -1
  43. package/dist/wc/GridFooter-BgoA77TJ.js +0 -145
  44. package/dist/wc/grid-extension.svelte-CucBS4FL.js +0 -20
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Row count - "250 rows", or "12 of 250 rows" while filters hide some, at the
3
+ * start of the grid's status bar, and the same two numbers from code.
4
+ *
5
+ * ```ts
6
+ * import { enableRowCount, getRowCounts } from '@svgrid/enterprise'
7
+ * enableRowCount()
8
+ * // <SvGrid {data} {columns} statusBar={{ rows: true, aggregates: [] }} />
9
+ * const { total, filtered } = getRowCounts(api)
10
+ * ```
11
+ */
12
+ import { registerGridExtension } from '@svgrid/grid';
13
+ import { hasValidLicense } from './license.js';
14
+ import { emitUnlicensedNudge } from './watermark.js';
15
+ import SvGridRowCount from './SvGridRowCount.svelte';
16
+ let enabled = false;
17
+ /**
18
+ * Draw the row count in every grid whose `statusBar` sets `rows: true`.
19
+ * Idempotent; also invoked by {@link installEnterprise}.
20
+ */
21
+ export function enableRowCount() {
22
+ if (enabled)
23
+ return;
24
+ enabled = true;
25
+ registerGridExtension({ statusBarRows: () => SvGridRowCount });
26
+ if (!hasValidLicense())
27
+ emitUnlicensedNudge();
28
+ }
29
+ /**
30
+ * How many rows the grid holds (`total`) and how many pass the current
31
+ * filters (`filtered`), for an "X of Y" of your own. Pagination changes
32
+ * neither. With grouping on, `filtered` counts the group rows too. Under
33
+ * `externalPagination` both come from the `rowCount` you pass.
34
+ */
35
+ export function getRowCounts(api) {
36
+ const filtered = api.getPageInfo().total;
37
+ return { total: api.getOption('externalPagination') ? filtered : api.getData().length, filtered };
38
+ }
39
+ export { default as SvGridRowCount } from './SvGridRowCount.svelte';
@@ -0,0 +1,8 @@
1
+ /** How the non-blank values compare: as the grid compares that data type. */
2
+ export type BlanksSortType = 'auto' | 'number' | 'date';
3
+ type ColumnComparator = (a: unknown, b: unknown, desc: boolean) => number;
4
+ /** Sort blank cells last in both directions. Pass as a column's `sortComparator`. */
5
+ export declare function blanksLast(type?: BlanksSortType): ColumnComparator;
6
+ /** Sort blank cells first in both directions. Pass as a column's `sortComparator`. */
7
+ export declare function blanksFirst(type?: BlanksSortType): ColumnComparator;
8
+ export {};
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Blanks at one end - column comparators that hold blank cells (null,
3
+ * undefined, '') at the bottom or the top whichever way the column sorts. The
4
+ * grid's own order puts blanks first ascending and last descending, so rows
5
+ * with no due date jump to the top when the dates run up.
6
+ *
7
+ * ```ts
8
+ * import { blanksLast } from '@svgrid/enterprise'
9
+ * const columns = [
10
+ * { field: 'due', header: 'Due', cellDataType: 'dateString', sortComparator: blanksLast('date') },
11
+ * ]
12
+ * ```
13
+ *
14
+ * The values themselves sort as the grid sorts them (`sortFns`). The grid's
15
+ * `sortComparator` hands the direction over; a column with `sortValue` keeps
16
+ * using that instead.
17
+ */
18
+ import { sortFns } from '@svgrid/grid/core';
19
+ import { hasValidLicense } from './license.js';
20
+ import { emitUnlicensedNudge } from './watermark.js';
21
+ const isBlank = (v) => v == null || v === '';
22
+ function holdBlanks(end, type) {
23
+ if (!hasValidLicense())
24
+ emitUnlicensedNudge();
25
+ const compare = sortFns[type];
26
+ return (a, b, desc) => {
27
+ const aBlank = isBlank(a);
28
+ const bBlank = isBlank(b);
29
+ if (aBlank || bBlank) {
30
+ if (aBlank === bBlank)
31
+ return 0;
32
+ // The grid reverses the result for a descending sort; answer for blanks
33
+ // before that happens, so they stay put.
34
+ const side = aBlank ? end : -end;
35
+ return desc ? -side : side;
36
+ }
37
+ return compare(a, b);
38
+ };
39
+ }
40
+ /** Sort blank cells last in both directions. Pass as a column's `sortComparator`. */
41
+ export function blanksLast(type = 'auto') {
42
+ return holdBlanks(1, type);
43
+ }
44
+ /** Sort blank cells first in both directions. Pass as a column's `sortComparator`. */
45
+ export function blanksFirst(type = 'auto') {
46
+ return holdBlanks(-1, type);
47
+ }
@@ -7172,7 +7172,7 @@ export const GENERATED_UI_SURFACE = {
7172
7172
  "key": "statusBar",
7173
7173
  "label": "Status Bar",
7174
7174
  "type": "boolean",
7175
- "description": "Excel-style status bar under the grid showing live aggregates of the selected cell range (count, numeric count, sum, average, min, max). `true` shows the default set; pass `{ aggregates: [...] }` to choose which. Requires `enableCellSelection`.",
7175
+ "description": "Excel-style status bar under the grid showing live aggregates of the selected cell range (count, numeric count, sum, average, min, max). `true` shows the default set; pass `{ aggregates: [...] }` to choose which. The aggregates need `enableCellSelection`. `rows: true` adds a row count that is always shown, \"250 rows\" or \"12 of 250 rows\" while filters hide some, once `@svgrid/enterprise`'s `enableRowCount()` has run. `{ rows: true, aggregates: [] }` shows the count alone.",
7176
7176
  "group": "common"
7177
7177
  },
7178
7178
  {
package/dist/version.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export declare const SVGRID_VERSION = "3.1.21";
13
+ export declare const SVGRID_VERSION = "3.1.22";
14
14
  /**
15
15
  * The version of `@svgrid/grid`, which releases on its own line: enterprise is
16
16
  * on 3.1.x while the grid is on 3.0.x.
@@ -23,4 +23,4 @@ export declare const SVGRID_VERSION = "3.1.21";
23
23
  *
24
24
  * `version.test.ts` asserts this matches packages/grid/package.json.
25
25
  */
26
- export declare const GRID_VERSION = "3.0.20";
26
+ export declare const GRID_VERSION = "3.0.21";
package/dist/version.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export const SVGRID_VERSION = '3.1.21';
13
+ export const SVGRID_VERSION = '3.1.22';
14
14
  /**
15
15
  * The version of `@svgrid/grid`, which releases on its own line: enterprise is
16
16
  * on 3.1.x while the grid is on 3.0.x.
@@ -23,4 +23,4 @@ export const SVGRID_VERSION = '3.1.21';
23
23
  *
24
24
  * `version.test.ts` asserts this matches packages/grid/package.json.
25
25
  */
26
- export const GRID_VERSION = '3.0.20';
26
+ export const GRID_VERSION = '3.0.21';
@@ -0,0 +1,162 @@
1
+ import { D as e, G as t, H as n, I as r, L as i, M as a, O as o, P as s, R as c, S as l, U as u, Y as d, at as f, ct as p, dt as m, ft as h, ht as g, j as _, m as v, n as y, nt as b, ot as x, rt as S, tt as C } from "./client-GWAV79ON.js";
2
+ import { s as w } from "./SvGrid.helpers-tk7gWxcT.js";
3
+ import { r as T } from "./grid-extension.svelte-CDf5EUyz.js";
4
+ import "./sv-sheet-element.js";
5
+ //#region ../grid/dist/GridFooter.svelte
6
+ var ee = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), E = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\">Numeric</span> </span>"), D = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), O = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), k = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), te = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), A = c("<span class=\"sv-grid-status-aggregates\" role=\"status\" aria-live=\"polite\"></span>"), j = c("<div class=\"sv-grid-status-bar\"><!> <!></div>"), ne = c("<div class=\"sv-grid-dropdown\"><button type=\"button\" class=\"sv-grid-dropdown-trigger\" aria-haspopup=\"listbox\" aria-expanded=\"false\"><span class=\"sv-grid-dropdown-label\"> </span> <span class=\"sv-grid-dropdown-caret\" aria-hidden=\"true\"><!></span></button></div>"), re = c("<div role=\"navigation\" aria-label=\"Pagination\"><div class=\"sv-grid-pagination-pagesize\"><span> </span> <div class=\"sv-grid-pagination-pagesize-dd\"><!></div></div> <span class=\"sv-grid-pagination-range\"><strong> </strong> to <strong> </strong> of <strong> </strong></span> <div class=\"sv-grid-pagination-nav\"><button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button> <button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button> <span class=\"sv-grid-pagination-label\"> <strong> </strong> <strong> </strong></span> <button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button> <button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button></div></div>"), M = c("<!> <!>", 1);
7
+ function N(n, c) {
8
+ h(c, !0);
9
+ let N = y(c, "pager", 3, !0), P = y(c, "showStatus", 3, !0), ie = y(c, "top", 3, !1), F = x(null), I = x(!1);
10
+ async function ae() {
11
+ if (!(t(F) || t(I))) {
12
+ f(I, !0);
13
+ try {
14
+ f(F, (await import("./SvGridDropdown-BVnpNU_I.js")).default, !0);
15
+ } finally {
16
+ f(I, !1);
17
+ }
18
+ }
19
+ }
20
+ let L = p(() => c.ctrl.paginationEnabled), R = p(() => c.ctrl.statusBarEnabled), oe = p(() => c.ctrl.statusBarAggregates), z = p(() => typeof c.ctrl.props.statusBar == "object" && c.ctrl.props.statusBar.rows ? T()?.statusBarRows?.(c.ctrl) ?? null : null), B = p(() => c.ctrl.statusBarStats), V = p(() => c.ctrl.changePage), H = p(() => c.ctrl.goToPage), se = p(() => c.ctrl.setPageSize), U = p(() => c.ctrl.messages);
21
+ var W = M(), G = b(W), K = (n) => {
22
+ var a = j(), l = C(a), u = (n) => {
23
+ var a = i(), o = b(a);
24
+ e(o, () => t(z), (e, t) => {
25
+ t(e, { get ctrl() {
26
+ return c.ctrl;
27
+ } });
28
+ }), r(n, a);
29
+ };
30
+ _(l, (e) => {
31
+ t(z) && e(u);
32
+ });
33
+ var f = S(l, 2), m = (e) => {
34
+ let n = p(() => t(B));
35
+ var a = A();
36
+ o(a, 20, () => t(oe), (e) => e, (e, a) => {
37
+ var o = i(), c = b(o), l = (e) => {
38
+ var i = ee(), a = C(i), o = C(a, !0);
39
+ g(a);
40
+ var c = S(a, 1, !0);
41
+ g(i), d((e) => {
42
+ s(o, t(U).statCount), s(c, e);
43
+ }, [() => w(t(n).count)]), r(e, i);
44
+ }, u = (e) => {
45
+ var i = E(), a = S(C(i), 1, !0);
46
+ g(i), d((e) => s(a, e), [() => w(t(n).numericCount)]), r(e, i);
47
+ }, f = (e) => {
48
+ var i = D(), a = C(i), o = C(a, !0);
49
+ g(a);
50
+ var c = S(a, 1, !0);
51
+ g(i), d((e) => {
52
+ s(o, t(U).statSum), s(c, e);
53
+ }, [() => w(t(n).sum)]), r(e, i);
54
+ }, p = (e) => {
55
+ var i = O(), a = C(i), o = C(a, !0);
56
+ g(a);
57
+ var c = S(a, 1, !0);
58
+ g(i), d((e) => {
59
+ s(o, t(U).statAvg), s(c, e);
60
+ }, [() => w(t(n).avg)]), r(e, i);
61
+ }, m = (e) => {
62
+ var i = k(), a = C(i), o = C(a, !0);
63
+ g(a);
64
+ var c = S(a, 1, !0);
65
+ g(i), d((e) => {
66
+ s(o, t(U).statMin), s(c, e);
67
+ }, [() => w(t(n).min)]), r(e, i);
68
+ }, h = (e) => {
69
+ var i = te(), a = C(i), o = C(a, !0);
70
+ g(a);
71
+ var c = S(a, 1, !0);
72
+ g(i), d((e) => {
73
+ s(o, t(U).statMax), s(c, e);
74
+ }, [() => w(t(n).max)]), r(e, i);
75
+ };
76
+ _(c, (e) => {
77
+ a === "count" ? e(l) : a === "numericCount" ? e(u, 1) : t(n).numericCount > 0 && a === "sum" ? e(f, 2) : t(n).numericCount > 0 && a === "avg" ? e(p, 3) : t(n).numericCount > 0 && a === "min" ? e(m, 4) : t(n).numericCount > 0 && a === "max" && e(h, 5);
78
+ }), r(e, o);
79
+ }), g(a), r(e, a);
80
+ };
81
+ _(f, (e) => {
82
+ t(B) && e(m);
83
+ }), g(a), r(n, a);
84
+ };
85
+ _(G, (e) => {
86
+ P() && t(R) && (t(B) || t(z)) && e(K);
87
+ });
88
+ var q = S(G, 2), J = (n) => {
89
+ let o = p(() => c.ctrl.paginationTotalRows), f = p(() => c.ctrl.paginationPageSize), m = p(() => Math.max(1, Math.ceil(t(o) / t(f)))), h = p(() => Math.min(c.ctrl.paginationPageIndex + 1, t(m))), y = p(() => t(o) === 0 ? 0 : (t(h) - 1) * t(f) + 1), x = p(() => Math.min(t(o), t(h) * t(f))), w = p(() => t(h) <= 1), T = p(() => t(h) >= t(m)), ee = p(() => c.pageSizeOptions && c.pageSizeOptions.length ? c.pageSizeOptions : [
90
+ 10,
91
+ 25,
92
+ 50,
93
+ 100
94
+ ]);
95
+ var E = re();
96
+ let D;
97
+ var O = C(E), k = C(O), te = C(k, !0);
98
+ g(k);
99
+ var A = S(k, 2), j = C(A), M = (n) => {
100
+ var a = i(), o = b(a);
101
+ {
102
+ let n = p(() => t(ee).map((e) => ({
103
+ value: e,
104
+ label: String(e)
105
+ })));
106
+ e(o, () => t(F), (e, r) => {
107
+ r(e, {
108
+ get options() {
109
+ return t(n);
110
+ },
111
+ get value() {
112
+ return t(f);
113
+ },
114
+ autoOpen: !0,
115
+ onChange: (e) => t(se)(Number(e))
116
+ });
117
+ });
118
+ }
119
+ r(n, a);
120
+ }, N = (e) => {
121
+ var n = ne(), i = C(n), o = C(i), l = C(o, !0);
122
+ g(o);
123
+ var p = S(o, 2), m = C(p);
124
+ a(m, () => c.icon, () => "page-size-caret"), g(p), g(i), g(n), d(() => s(l, t(f))), u("click", i, ae), r(e, n);
125
+ };
126
+ _(j, (e) => {
127
+ t(F) ? e(M) : e(N, -1);
128
+ }), g(A), g(O);
129
+ var P = S(O, 2), I = C(P), L = C(I, !0);
130
+ g(I);
131
+ var R = S(I, 2), oe = C(R, !0);
132
+ g(R);
133
+ var z = S(R, 2), B = C(z, !0);
134
+ g(z), g(P);
135
+ var W = S(P, 2), G = C(W), K = C(G);
136
+ a(K, () => c.icon, () => "page-first"), g(G);
137
+ var q = S(G, 2), J = C(q);
138
+ a(J, () => c.icon, () => "page-prev"), g(q);
139
+ var Y = S(q, 2), X = C(Y), Z = S(X), ce = C(Z, !0);
140
+ g(Z);
141
+ var le = S(Z), ue = S(le), de = C(ue, !0);
142
+ g(ue), g(Y);
143
+ var Q = S(Y, 2), fe = C(Q);
144
+ a(fe, () => c.icon, () => "page-next"), g(Q);
145
+ var $ = S(Q, 2), pe = C($);
146
+ a(pe, () => c.icon, () => "page-last"), g($), g(W), g(E), d((e, n, r, i, a) => {
147
+ D = l(E, 1, "sv-grid-pagination", null, D, { "sv-grid-pagination-top": ie() }), s(te, t(U).pageSize), s(L, e), s(oe, n), s(B, r), G.disabled = t(w), v(G, "aria-label", t(U).firstPage), q.disabled = t(w), v(q, "aria-label", t(U).prevPage), s(X, `${t(U).page ?? ""} `), s(ce, i), s(le, ` ${t(U).of ?? ""} `), s(de, a), Q.disabled = t(T), v(Q, "aria-label", t(U).nextPage), $.disabled = t(T), v($, "aria-label", t(U).lastPage);
148
+ }, [
149
+ () => t(y).toLocaleString(),
150
+ () => t(x).toLocaleString(),
151
+ () => t(o).toLocaleString(),
152
+ () => t(h).toLocaleString(),
153
+ () => t(m).toLocaleString()
154
+ ]), u("click", G, () => t(H)(0)), u("click", q, () => t(V)(-1)), u("click", Q, () => t(V)(1)), u("click", $, () => t(H)(t(m) - 1)), r(n, E);
155
+ };
156
+ _(q, (e) => {
157
+ N() && t(L) && e(J);
158
+ }), r(n, W), m();
159
+ }
160
+ n(["click"]);
161
+ //#endregion
162
+ export { N as default };