react-semaphor 0.1.591 → 0.1.593

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 (46) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/briefings/index.js +2 -2
  3. package/dist/chunks/{assistant-chat-Cazikwyh.js → assistant-chat-D05uNAeO.js} +7 -7
  4. package/dist/chunks/bookmark-impact-B0k90wq8.js +76 -0
  5. package/dist/chunks/{bookmark-state-Bt_eQEqt.js → bookmark-state-Be2W3s6t.js} +174 -166
  6. package/dist/chunks/{card-filter-builder-DFR-6Jpm.js → card-filter-builder-CiafWE26.js} +73 -73
  7. package/dist/chunks/{comparison-window-caption-CFaw-kIV.js → comparison-window-caption-h8w3ySL6.js} +88 -89
  8. package/dist/chunks/{dashboard-DCh9hKnJ.js → dashboard-T-gYKGTF.js} +1 -1
  9. package/dist/chunks/{dashboard-briefing-launcher-ob8G1b58.js → dashboard-briefing-launcher-CPh2B3Rf.js} +84 -84
  10. package/dist/chunks/{dashboard-controls-Nszg0k1A.js → dashboard-controls-Cijc9c3G.js} +9 -9
  11. package/dist/chunks/{dashboard-json-BpwnG23b.js → dashboard-json-D3m7h4VL.js} +1 -1
  12. package/dist/chunks/{dates-BOLBSBpn.js → dates-Bb0sn54j.js} +6 -6
  13. package/dist/chunks/{edit-dashboard-visual-BvM7br5P.js → edit-dashboard-visual-C0iSuX9t.js} +374 -374
  14. package/dist/chunks/{filter-reach-copy-By3r7O3G.js → filter-reach-copy-CifrEFxj.js} +221 -221
  15. package/dist/chunks/{filter-value-text-CFiIZWJP.js → filter-value-text-CHBm4IU7.js} +10 -10
  16. package/dist/chunks/{index-CsQYlwhU.js → index-CzM2w1kY.js} +22 -22
  17. package/dist/chunks/{pivot-result-contract-expectations-BkMRCjzf.js → pivot-result-contract-expectations-CaS0y823.js} +588 -552
  18. package/dist/chunks/{report-preferences-dialog-ChXt8wCt.js → report-preferences-dialog-GHvai50w.js} +9 -9
  19. package/dist/chunks/{resolve-dashboard-input-context-BlyFX8He.js → resolve-dashboard-input-context-BcQHmMlw.js} +7585 -6490
  20. package/dist/chunks/{saved-dashboard-context-BPSdH2jW.js → saved-dashboard-context-BHHEzmwM.js} +16 -16
  21. package/dist/chunks/{semaphor-ready-indicator-BZUMCHRU.js → semaphor-ready-indicator-AOUJrUAJ.js} +21334 -21330
  22. package/dist/chunks/{shelf-drop-preview-context-yJheoeTC.js → shelf-drop-preview-context-Cs62lWI1.js} +2 -2
  23. package/dist/chunks/stored-dashboard-Cmtl_Obh.js +4029 -0
  24. package/dist/chunks/{table-export-sheet-h7wm5TwP.js → table-export-sheet-Cd6z7SsG.js} +1 -1
  25. package/dist/chunks/{variable-draft-OpYyaVCW.js → variable-draft-CSK9Ps1o.js} +2 -2
  26. package/dist/dashboard/index.js +2 -2
  27. package/dist/dashboard-authoring/index.js +1097 -1105
  28. package/dist/format-utils/index.js +215 -216
  29. package/dist/index.js +56 -56
  30. package/dist/surfboard/index.js +2 -2
  31. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +3 -3
  32. package/dist/types/components/visual/data-table/types/data-table.d.ts +24 -2
  33. package/dist/types/index.js +30 -29
  34. package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +27 -0
  35. package/dist/types/lib/dashboard-viewer/table-view.d.ts +37 -1
  36. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  37. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +3 -0
  38. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +6 -0
  39. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +11 -0
  40. package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +56 -0
  41. package/dist/types/shared/dashboard-viewer/table-settings.d.ts +7 -0
  42. package/package.json +1 -1
  43. package/dist/chunks/bookmark-impact-rWjQgk8h.js +0 -75
  44. package/dist/chunks/pivot-header-presentation-gUxhdIdr.js +0 -42
  45. package/dist/chunks/stored-dashboard-CxQl9g0l.js +0 -4994
  46. package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -53
@@ -0,0 +1,56 @@
1
+ import { TableColumnId } from './table-settings.js';
2
+ /**
3
+ * The one move rule for a table's columns (table column order TCO-D7), for
4
+ * the author's header drag, the viewer's column panel and the MCP alike.
5
+ * Callers pass the current arrangement of the addressable columns; they differ
6
+ * only in what they compare the result against when they store it (the field
7
+ * order for the author, the author's order for a viewer).
8
+ *
9
+ * Pivot rule A (TCO-D6): without pivots any column goes anywhere. With pivots
10
+ * the dimensions stay left of the pivot area and reorder among themselves, and
11
+ * the measures reorder among themselves (their order applies inside every
12
+ * pivot block). An order keeps the rule when no dimension follows a measure.
13
+ * Comparison columns have no position of their own (TCO-D8): they are never
14
+ * in the order. Pure, React-free.
15
+ */
16
+ /**
17
+ * The one arrangement (TCO-D1, TCO-D4): items whose id the order lists go in
18
+ * the order's sequence (a repeated id counts once); every other item goes
19
+ * right after its baseline predecessor (first if none). `resolveTableView` arranges its column groups
20
+ * with it and the writer normalizes a stored order with it.
21
+ */
22
+ export declare function arrangeByOrder<T>(items: readonly T[], idOf: (item: T) => TableColumnId | undefined, order: readonly TableColumnId[]): T[];
23
+ /** True when no dimension follows a measure in a pivoted table; always true without pivots. */
24
+ export declare function orderKeepsPivotRule(order: readonly TableColumnId[], pivoted: boolean): boolean;
25
+ /**
26
+ * An order that keeps pivot rule A: in a pivoted table, dimensions first,
27
+ * each side in its own order; any order without pivots. The writer stores
28
+ * it and the view's field order follows it.
29
+ */
30
+ export declare function withPivotRule(order: readonly TableColumnId[], pivoted: boolean): TableColumnId[];
31
+ /** The columns of `order` that have somewhere to go: another column in their area (TCO-D9). */
32
+ export declare function listMovableTableColumns(order: readonly TableColumnId[], pivoted: boolean): ReadonlySet<TableColumnId>;
33
+ /** Where the moved column lands: before a column (`null`: at the end), or right after one. */
34
+ export type TableColumnPlacement = {
35
+ readonly before: TableColumnId | null;
36
+ } | {
37
+ readonly after: TableColumnId;
38
+ };
39
+ export type TableColumnMoveResult = {
40
+ readonly ok: true;
41
+ readonly order: readonly TableColumnId[];
42
+ } | {
43
+ readonly ok: false;
44
+ /**
45
+ * `unknown`: the column or its target is not in the order. `unchanged`:
46
+ * the column is already there. `pivot-area`: the move would put a
47
+ * dimension inside the pivot area or a measure before a dimension.
48
+ */
49
+ readonly reason: 'unknown' | 'unchanged' | 'pivot-area';
50
+ };
51
+ export declare function moveTableColumn(input: {
52
+ readonly order: readonly TableColumnId[];
53
+ readonly columnId: TableColumnId;
54
+ readonly to: TableColumnPlacement;
55
+ readonly pivoted: boolean;
56
+ }): TableColumnMoveResult;
@@ -61,6 +61,13 @@ export type ViewerTableSettings = {
61
61
  /** Column widths in whole pixels, only for columns the viewer resized. Unlisted columns keep the author's width. */
62
62
  readonly widths?: Readonly<Record<TableColumnId, number>>;
63
63
  };
64
+ /**
65
+ * An author's stored column order (`tablePrefs.columnOrder`, table column
66
+ * order TCO-D2) as the view reads it: duplicate and malformed ids dropped,
67
+ * anything that is not a list read as no order (TCO-INV-4). Ids the card no
68
+ * longer defines are left for the arrangement to ignore.
69
+ */
70
+ export declare function normalizeTableColumnOrder(value: unknown): TableColumnId[] | undefined;
64
71
  /**
65
72
  * Drops empty fields and duplicate or malformed column ids. `sort: []` is kept:
66
73
  * it means "explicitly unsorted". Returns `undefined` when nothing is left.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.591",
8
+ "version": "0.1.593",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,75 +0,0 @@
1
- import { x as g, z as $ } from "./bookmark-state-Bt_eQEqt.js";
2
- import { l as F, h as C, a as O, b as v, i as S, f as T } from "./stored-dashboard-CxQl9g0l.js";
3
- function D(e) {
4
- var d, c, f;
5
- const { saved: s, draft: a, usage: l } = e, b = [], j = F(s);
6
- for (const [t, o] of Object.entries(l.inputs))
7
- !o || !C(s, t) || C(a, t) || b.push({
8
- target: "input",
9
- id: t,
10
- label: O(s, j, t),
11
- bookmarks: o,
12
- remembered: 0
13
- });
14
- const z = new Set((a.sheets ?? []).map((t) => t.id));
15
- for (const t of s.sheets ?? []) {
16
- const o = l.sheets[t.id] ?? 0;
17
- !o || z.has(t.id) || b.push({
18
- target: "sheet",
19
- id: t.id,
20
- label: ((d = t.title) == null ? void 0 : d.trim()) || "Untitled sheet",
21
- bookmarks: o,
22
- remembered: 0
23
- });
24
- }
25
- const B = g(s), y = g(a);
26
- for (const [t, o] of Object.entries(l.tables)) {
27
- if (!B.has(t)) continue;
28
- const r = $(s, t), i = ((c = r == null ? void 0 : r.title) == null ? void 0 : c.trim()) || "Untitled table";
29
- if (!y.has(t)) {
30
- b.push({
31
- target: "table",
32
- id: t,
33
- label: i,
34
- bookmarks: o.bookmarks,
35
- remembered: o.remembered
36
- });
37
- continue;
38
- }
39
- const h = r ? v(r) : void 0, k = $(a, t), p = k ? v(k) : void 0;
40
- if (!(!r || !h || !p))
41
- for (const [m, u] of Object.entries(o.columns)) {
42
- if (!(u.bookmarks || u.remembered) || S(m) || !h.has(m) || p.has(m))
43
- continue;
44
- const n = T(r, m), I = ((f = n == null ? void 0 : n.label) == null ? void 0 : f.trim()) || (n == null ? void 0 : n.name);
45
- b.push({
46
- target: "column",
47
- id: m,
48
- cardId: t,
49
- label: I ? `${I} in ${i}` : `A column in ${i}`,
50
- bookmarks: u.bookmarks,
51
- remembered: u.remembered
52
- });
53
- }
54
- }
55
- return b;
56
- }
57
- function w(e, s, a) {
58
- return `${e} ${e === 1 ? s : a}`;
59
- }
60
- function x(e) {
61
- const s = [
62
- e.bookmarks ? w(e.bookmarks, "bookmark", "bookmarks") : null,
63
- e.remembered ? w(e.remembered, "remembered layout", "remembered layouts") : null
64
- ].filter(Boolean).join(", ");
65
- return e.target === "sheet" ? { name: `${e.label} sheet`, uses: s } : e.target === "table" ? { name: `${e.label} table`, uses: s } : { name: e.label, uses: s };
66
- }
67
- function G(e) {
68
- const { uses: s } = x(e), a = e.target === "column" ? `the column ${e.label}` : `the ${e.target === "input" ? "filter" : e.target} "${e.label}"`, l = e.bookmarks + e.remembered === 1 ? "uses" : "use";
69
- return `This change removes ${a}, which ${s} ${l}; those saved views still open, with a note about what no longer applies.`;
70
- }
71
- export {
72
- x as a,
73
- G as b,
74
- D as d
75
- };
@@ -1,42 +0,0 @@
1
- var d = Object.defineProperty;
2
- var c = (e, r, t) => r in e ? d(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var i = (e, r, t) => c(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { f } from "./pivot-result-contract-expectations-BkMRCjzf.js";
5
- class v extends Error {
6
- constructor(t, a) {
7
- super(`${t}: ${a}`);
8
- i(this, "deliveryBlocking", !0);
9
- this.code = t, this.name = "PivotHeaderPresentationError";
10
- }
11
- }
12
- function p(e) {
13
- var l;
14
- const r = e.mode ?? "formatted", t = e.members.map((o) => {
15
- var n;
16
- if (r === "canonical" || !o.temporalBucket)
17
- return o.value === null ? "" : String(o.value);
18
- const s = (n = e.resolveTemporalFormat) == null ? void 0 : n.call(e, o.fieldId);
19
- if (!s)
20
- throw new v(
21
- "missing_resolved_temporal_format",
22
- `Missing resolved temporal presentation for pivot field "${o.fieldId}"`
23
- );
24
- return f({
25
- value: o.value,
26
- metadata: o.temporalBucket,
27
- format: s
28
- });
29
- }), a = ((l = e.metricLabel) == null ? void 0 : l.trim()) || void 0;
30
- return {
31
- memberLabels: t,
32
- ...a ? { metricLabel: a } : {},
33
- flattenedLabel: [
34
- ...t,
35
- ...a ? [a] : []
36
- ].join(" / ")
37
- };
38
- }
39
- export {
40
- v as P,
41
- p
42
- };