@object-ui/plugin-dashboard 17.7.0 → 18.0.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/CHANGELOG.md +525 -0
- package/README.md +56 -17
- package/dist/DashboardGridLayout.d.ts +7 -6
- package/dist/DashboardGridLayout.d.ts.map +1 -1
- package/dist/DashboardRenderer.d.ts +30 -2
- package/dist/DashboardRenderer.d.ts.map +1 -1
- package/dist/DashboardWithConfig.d.ts.map +1 -1
- package/dist/DatasetWidget.d.ts +22 -23
- package/dist/DatasetWidget.d.ts.map +1 -1
- package/dist/MetricCard.d.ts +6 -0
- package/dist/MetricCard.d.ts.map +1 -1
- package/dist/MetricWidget.d.ts +21 -4
- package/dist/MetricWidget.d.ts.map +1 -1
- package/dist/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/ObjectPivotTable.d.ts +7 -6
- package/dist/ObjectPivotTable.d.ts.map +1 -1
- package/dist/RecordDetailDrawer.d.ts +13 -2
- package/dist/RecordDetailDrawer.d.ts.map +1 -1
- package/dist/chartRenderHandoff.d.ts +9 -0
- package/dist/chartRenderHandoff.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1136 -1037
- package/dist/index.umd.cjs +3 -2
- package/dist/legacyRetiredWidget.d.ts +24 -1
- package/dist/legacyRetiredWidget.d.ts.map +1 -1
- package/dist/metricTile.d.ts +87 -0
- package/dist/metricTile.d.ts.map +1 -0
- package/dist/schemaHostProps.d.ts +55 -11
- package/dist/schemaHostProps.d.ts.map +1 -1
- package/dist/utils.d.ts +24 -6
- package/dist/utils.d.ts.map +1 -1
- package/dist/widgetDispatch.d.ts +36 -6
- package/dist/widgetDispatch.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/widgetSubCaption.d.ts +0 -40
- package/dist/widgetSubCaption.d.ts.map +0 -1
|
@@ -38,6 +38,29 @@ export declare const LEGACY_RETIRED_WIDGET_SCHEMA: {
|
|
|
38
38
|
* terms for any surface that has no such fork.
|
|
39
39
|
*/
|
|
40
40
|
export declare function isLegacyRetiredWidget(widget: DashboardWidgetSlotEntry | null | undefined): boolean;
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Is `node`, read from a widget's legacy `component` envelope
|
|
43
|
+
* (`{ id, component, layout }`, objectui's own format, which the spec's widget
|
|
44
|
+
* has no member for), a node the surfaces no longer draw? True for every node
|
|
45
|
+
* but a `metric-card` (objectui#12254).
|
|
46
|
+
*
|
|
47
|
+
* The envelope takes a `metric-card` and nothing else: the 2026-08-14 slot
|
|
48
|
+
* ruling (objectstack#8593) allowed that one node, and since objectui#12163
|
|
49
|
+
* (ruling C) both zod faces and `DashboardWidgetSchema['component']` refuse any
|
|
50
|
+
* other node by name. objectui#12254 retires the draw to match, after a census
|
|
51
|
+
* of stored use found no producer. So the accept set is the authoring one, read
|
|
52
|
+
* from the same closed list, `DASHBOARD_COMPONENT_WIDGET_TYPES`: a node whose
|
|
53
|
+
* `type` is a member draws as before, and anything else in the envelope (a
|
|
54
|
+
* node of another type, a node with no `type`, a string or a number) draws
|
|
55
|
+
* {@link LEGACY_RETIRED_WIDGET_SCHEMA}, the rebind prompt the metric and pivot
|
|
56
|
+
* arms return, and sends no query. The `object-metric` node objectui#11466
|
|
57
|
+
* retired here first is one case of the rule.
|
|
58
|
+
*
|
|
59
|
+
* An empty envelope (`component` absent, or a falsy value) holds no node, so
|
|
60
|
+
* this answers false and the widget draws by its family, as before.
|
|
61
|
+
*
|
|
62
|
+
* ⛔ Read only at the envelope: the same node types authored on a page, or a
|
|
63
|
+
* `metric-card` placed directly in `widgets[]`, are not judged here.
|
|
64
|
+
*/
|
|
42
65
|
export declare function isRetiredEnvelopeNode(node: unknown): boolean;
|
|
43
66
|
//# sourceMappingURL=legacyRetiredWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyRetiredWidget.d.ts","sourceRoot":"","sources":["../src/legacyRetiredWidget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"legacyRetiredWidget.d.ts","sourceRoot":"","sources":["../src/legacyRetiredWidget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuDH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B;;;;;;CAM/B,CAAC;AAoBX;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMlG;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAI5D"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metric tile's layout rule — ONE home, read by every metric tile in this
|
|
3
|
+
* package: the plain cards (`MetricCard`, `MetricWidget`, and through it
|
|
4
|
+
* `ObjectMetricWidget` and every `object-metric` page block) and the
|
|
5
|
+
* dataset-bound tile (`DatasetWidget`) (objectui#12623).
|
|
6
|
+
*
|
|
7
|
+
* - The title owns the first line: 13 px / 500, up to two lines, an ellipsis
|
|
8
|
+
* on the second. Nothing shares its line but the plain card's icon chip.
|
|
9
|
+
* - The value never wraps, and it scales before it would clip
|
|
10
|
+
* (objectui#12942). A short value is one step smaller (20 px) in a tile
|
|
11
|
+
* narrower than 160 px, 24 px from 160 px up. A longer one — a seven-digit
|
|
12
|
+
* money figure with cents — takes a size ladder from 14 px to 24 px whose
|
|
13
|
+
* steps start where that size fits (`metricTileValueClass`).
|
|
14
|
+
* - The measure label (dataset-bound tile only) is an 11 px muted line under
|
|
15
|
+
* the value, dropped below 160 px. The title's tooltip carries it, so it is
|
|
16
|
+
* still there at every width.
|
|
17
|
+
*
|
|
18
|
+
* Width rules key off the TILE's own box (`@container` on the tile, `@[160px]:`
|
|
19
|
+
* variants), never the viewport: a dashboard grid, a page block and the
|
|
20
|
+
* Studio's folded canvas each size the same tile differently.
|
|
21
|
+
*
|
|
22
|
+
* Class strings stay static literals so Tailwind's content scanner sees them
|
|
23
|
+
* (`apps/console/src/index.css` sources this package's `src/**`).
|
|
24
|
+
*/
|
|
25
|
+
/** Put on the tile's root: the box the width rules below are measured against. */
|
|
26
|
+
export declare const METRIC_TILE_CONTAINER_CLASS = "@container";
|
|
27
|
+
/** The title: owns the first line, at most two lines, an ellipsis on the second. */
|
|
28
|
+
export declare const METRIC_TILE_TITLE_CLASS = "min-w-0 line-clamp-2 break-words text-[13px] font-medium leading-snug text-foreground";
|
|
29
|
+
/**
|
|
30
|
+
* The value: never wraps; 20 px below a 160 px tile, 24 px from 160 px up. The
|
|
31
|
+
* short value's face on a plain tile, and the dataset-bound tile's value at
|
|
32
|
+
* every length: that tile has no Card inset, so its value has the container's
|
|
33
|
+
* whole width and the ladder below, measured against a Card, does not apply.
|
|
34
|
+
*/
|
|
35
|
+
export declare const METRIC_TILE_VALUE_CLASS = "max-w-full overflow-hidden text-ellipsis whitespace-nowrap tabular-nums text-xl @[160px]:text-2xl";
|
|
36
|
+
/**
|
|
37
|
+
* The value's size ladder, chosen by how wide the value is (objectui#12942).
|
|
38
|
+
*
|
|
39
|
+
* A plain tile (`MetricCard`, `MetricWidget`: a `Card`, 1 px border, the value
|
|
40
|
+
* in `CardContent`'s 24 px side padding) gives its value the container's width
|
|
41
|
+
* less {@link METRIC_TILE_VALUE_INSET} px — the container query reads the
|
|
42
|
+
* Card's content box, inside the border. A value `em` wide fits at a size of
|
|
43
|
+
* `px` from a container `INSET + em * px` wide, so each `@[N px]:` step below
|
|
44
|
+
* starts at `ceil(INSET + maxEm * px)` for its rung's widest value. The
|
|
45
|
+
* `metricTileValueScale-12942` test re-derives every step from that formula.
|
|
46
|
+
*
|
|
47
|
+
* The first rung is the short value's face, {@link METRIC_TILE_VALUE_CLASS}'s
|
|
48
|
+
* sizes unchanged. Every later rung starts at 14 px; past the last one, 14 px
|
|
49
|
+
* at every width. A value still wider than its tile at 14 px keeps the
|
|
50
|
+
* ellipsis, and the value node carries the full figure as its tooltip.
|
|
51
|
+
*
|
|
52
|
+
* Literals only: Tailwind's content scanner must see every class.
|
|
53
|
+
*/
|
|
54
|
+
export declare const METRIC_TILE_VALUE_INSET = 48;
|
|
55
|
+
export declare const METRIC_TILE_VALUE_LADDER: ReadonlyArray<{
|
|
56
|
+
readonly maxEm: number;
|
|
57
|
+
readonly sizes: string;
|
|
58
|
+
}>;
|
|
59
|
+
/** Past the ladder's last rung: 14 px at every width. */
|
|
60
|
+
export declare const METRIC_TILE_VALUE_FINAL_SIZES = "text-sm";
|
|
61
|
+
/**
|
|
62
|
+
* How wide `text` draws, in em, at the tile's bold tabular figures — an upper
|
|
63
|
+
* bound read off Inter, the console's face: a digit is 0.65 em, a digit
|
|
64
|
+
* separator (`,` `.` `'` or a space) 0.27 em, a sign or currency symbol 0.7 em,
|
|
65
|
+
* and any other character a full em (letters, CJK).
|
|
66
|
+
*/
|
|
67
|
+
export declare function metricTileValueEm(text: string): number;
|
|
68
|
+
/**
|
|
69
|
+
* The value node's class for `value`: the rung of {@link METRIC_TILE_VALUE_LADDER}
|
|
70
|
+
* its width falls in, or the 14 px final face past the last rung.
|
|
71
|
+
*/
|
|
72
|
+
export declare function metricTileValueClass(value: string | number): string;
|
|
73
|
+
/** The measure label: an 11 px muted line under the value, dropped below 160 px. */
|
|
74
|
+
export declare const METRIC_TILE_MEASURE_LABEL_CLASS = "hidden max-w-full truncate text-[11px] text-muted-foreground @[160px]:block";
|
|
75
|
+
/**
|
|
76
|
+
* The title's tooltip: the description when one is authored, else the title,
|
|
77
|
+
* then the measure label on its own line — the one place the label survives in
|
|
78
|
+
* a tile too narrow to draw it.
|
|
79
|
+
*/
|
|
80
|
+
export declare function metricTileTooltip(title: string | undefined, description?: string, measureLabel?: string): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The value node's tooltip: the full figure, for a value past the short rung —
|
|
83
|
+
* the one place it survives in a tile too narrow even for 14 px. A short value
|
|
84
|
+
* draws none, as before.
|
|
85
|
+
*/
|
|
86
|
+
export declare function metricTileValueTitle(value: string | number): string | undefined;
|
|
87
|
+
//# sourceMappingURL=metricTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metricTile.d.ts","sourceRoot":"","sources":["../src/metricTile.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,kFAAkF;AAClF,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,0FAA0F,CAAC;AAE/H;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,sGAAsG,CAAC;AAE3I;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAOtG,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,6BAA6B,YAAY,CAAC;AAIvD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAStD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAInE;AAED,oFAAoF;AACpF,eAAO,MAAM,+BAA+B,gFAAgF,CAAC;AAE7H;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG5H;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAG/E"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* ObjectUI
|
|
3
|
-
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
1
|
+
import { DomProps } from '@object-ui/core';
|
|
8
2
|
/**
|
|
9
3
|
* The props `SchemaRenderer` hands a widget that are NOT DOM attributes
|
|
10
4
|
* (objectui#4357).
|
|
@@ -43,10 +37,21 @@
|
|
|
43
37
|
*
|
|
44
38
|
* The line this type draws is **"is the key an HTML attribute name"**. None of
|
|
45
39
|
* the seven is (the two dashed `aria-*` forms the renderer emits itself are, and
|
|
46
|
-
* they keep flowing).
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* the
|
|
40
|
+
* they keep flowing). Removing the spread instead would have been the wrong fix —
|
|
41
|
+
* it is the component's only accessibility passthrough.
|
|
42
|
+
*
|
|
43
|
+
* ⚠️ That line was a DENY-LIST, and on the renderer's door it is no longer the
|
|
44
|
+
* judge. It stripped every one of the seven and the leak gate
|
|
45
|
+
* (`packages/app-shell/src/__tests__/widget-dom-leak-sweep.test.tsx`) still
|
|
46
|
+
* found the OPEN TAIL on both components — an authored key neither declares
|
|
47
|
+
* (`zzcanary`, `reference_to`, a `props: { colorVariant }` on `metric-card`, a
|
|
48
|
+
* `label` on `metric-card`) and `name` all landed as attributes, because a
|
|
49
|
+
* deny-list can only name what already exists. Per objectui#4425's phase-2
|
|
50
|
+
* ruling, what a component reached through `SchemaRenderer` may put on its
|
|
51
|
+
* element is decided by `toDomProps`' WHITELIST — see {@link hostDomProps}
|
|
52
|
+
* below. The seven are still destructured by name: they are this type's keys,
|
|
53
|
+
* and on the direct React door (below) the destructure is still what keeps them
|
|
54
|
+
* off the element.
|
|
50
55
|
*
|
|
51
56
|
* The renderer strips its own schema metadata (`type` / `children` / `visible` /
|
|
52
57
|
* the schema's `dataSource` binding / …) before spreading, so those never
|
|
@@ -77,4 +82,43 @@ export interface SchemaHostProps {
|
|
|
77
82
|
*/
|
|
78
83
|
dataSource?: unknown;
|
|
79
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* What a KPI card may spread onto its host element, decided by the DOOR the
|
|
87
|
+
* render came through (objectui#4425, phase-2 ruling: "a registered SDUI
|
|
88
|
+
* widget's host element receives only what passes the `toDomProps` whitelist").
|
|
89
|
+
*
|
|
90
|
+
* Both metric components have two doors, and they hand the component two
|
|
91
|
+
* different populations:
|
|
92
|
+
*
|
|
93
|
+
* - **The renderer's door.** `SchemaRenderer` — the registry render path, and
|
|
94
|
+
* so also an app that registers the exported component under a key of its
|
|
95
|
+
* own — hands the component the authored node's own keys, the contents of
|
|
96
|
+
* its `props` container, the runtime props it injects and its host's
|
|
97
|
+
* trailing props. That set is unbounded, so only the whitelist may decide
|
|
98
|
+
* what reaches the element: `toDomProps` keeps the SDUI contract's declared
|
|
99
|
+
* pass-through set (`SDUI_DOM_PASS_THROUGH_KEYS`) and the `aria-*` /
|
|
100
|
+
* `data-*` families, and drops everything else — `name`, `disabled`, the
|
|
101
|
+
* injected adapter, every authored key neither component declares. One
|
|
102
|
+
* executor, `@object-ui/core`'s, the
|
|
103
|
+
* one `DashboardRenderer`'s grid container and `plugin-chatbot`'s
|
|
104
|
+
* registrations already use — not a third list.
|
|
105
|
+
* - **The direct React door.** A host rendering the exported component passes
|
|
106
|
+
* typed props, and both props interfaces DECLARE `React.HTMLAttributes` as
|
|
107
|
+
* their DOM pass-through (objectui#4426). That declaration is the
|
|
108
|
+
* objectui#4435 pattern the ruling keeps available, so this door stays as it
|
|
109
|
+
* was: narrowing it at runtime while the exported interface still extends
|
|
110
|
+
* `HTMLAttributes` would type-check a `title` or an `onMouseEnter` and drop
|
|
111
|
+
* it — declared but not delivered. Narrowing the interface itself is a
|
|
112
|
+
* public prop-surface change, which this card's fence excludes.
|
|
113
|
+
*
|
|
114
|
+
* The discriminator is `schema`: the one key `SchemaRenderer` injects on EVERY
|
|
115
|
+
* render (the table above), declared on this type as the renderer's private
|
|
116
|
+
* door and never on either exported props interface. A direct consumer that
|
|
117
|
+
* passes it anyway has chosen the renderer's door and gets the whitelist, so a
|
|
118
|
+
* mistaken reading DROPS an attribute and never leaks one. If the renderer ever
|
|
119
|
+
* stopped injecting it, every canary the leak gate plants would reach the DOM
|
|
120
|
+
* again and the gate would go red — that sweep is what holds this function to
|
|
121
|
+
* its claim, alongside `__tests__/MetricWidget.domProps.test.tsx`.
|
|
122
|
+
*/
|
|
123
|
+
export declare function hostDomProps<P extends object>(schema: unknown, rest: P): P | DomProps<P>;
|
|
80
124
|
//# sourceMappingURL=schemaHostProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaHostProps.d.ts","sourceRoot":"","sources":["../src/schemaHostProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH
|
|
1
|
+
{"version":3,"file":"schemaHostProps.d.ts","sourceRoot":"","sources":["../src/schemaHostProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAExF"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -77,6 +77,19 @@ export declare function deriveStaticTableColumns(rows: unknown): Array<{
|
|
|
77
77
|
}>;
|
|
78
78
|
export { resolveDateMacros, resolveFilterPlaceholders } from '@object-ui/core';
|
|
79
79
|
export { shiftFilterByCompareTo, compareToTrendLabelKey, type CompareToConfig, } from '@object-ui/core';
|
|
80
|
+
/**
|
|
81
|
+
* A period-over-period delta as `computeMetricDelta` returns it.
|
|
82
|
+
*
|
|
83
|
+
* `value` is the absolute percentage change, or `null` when the change has no
|
|
84
|
+
* percentage: a zero baseline with a non-zero current value (objectui#12677).
|
|
85
|
+
* Going from 0 to 10 is not a 100% increase — a percent change from zero is
|
|
86
|
+
* undefined — so the delta keeps its direction and states no number. Every
|
|
87
|
+
* reader draws it through {@link formatMetricDeltaPercent}.
|
|
88
|
+
*/
|
|
89
|
+
export interface MetricDelta {
|
|
90
|
+
value: number | null;
|
|
91
|
+
direction: 'up' | 'down' | 'neutral';
|
|
92
|
+
}
|
|
80
93
|
/**
|
|
81
94
|
* Compute a percentage delta between the current and previous metric values.
|
|
82
95
|
*
|
|
@@ -85,13 +98,18 @@ export { shiftFilterByCompareTo, compareToTrendLabelKey, type CompareToConfig, }
|
|
|
85
98
|
* - previousValue is null / undefined (no comparison data)
|
|
86
99
|
*
|
|
87
100
|
* Edge cases:
|
|
88
|
-
* - both 0 → neutral
|
|
89
|
-
* - previous is 0 and current ≠ 0 →
|
|
101
|
+
* - both 0 → neutral, `value: 0`
|
|
102
|
+
* - previous is 0 and current ≠ 0 → current's direction, `value: null` (no
|
|
103
|
+
* percentage is defined from a zero baseline; objectui#12677)
|
|
90
104
|
* - previous is negative → uses |previous| as denominator so that "less
|
|
91
105
|
* negative" reads as a positive (up) delta.
|
|
92
106
|
*/
|
|
93
|
-
export declare function computeMetricDelta(current: number | null | undefined, previous: number | null | undefined):
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
export declare function computeMetricDelta(current: number | null | undefined, previous: number | null | undefined): MetricDelta | null;
|
|
108
|
+
/**
|
|
109
|
+
* The text a delta badge draws for {@link MetricDelta.value}: `20%` for a
|
|
110
|
+
* defined percentage, and an em dash — never a number — when there is none
|
|
111
|
+
* (a zero baseline, objectui#12677). A symbol, not a word, so no locale pack
|
|
112
|
+
* carries it. The direction arrow beside it still says which way it moved.
|
|
113
|
+
*/
|
|
114
|
+
export declare function formatMetricDeltaPercent(value: number | null): string;
|
|
97
115
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,CAO1I;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC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AAM,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,CAUR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAOtG;AAUD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAG/E,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;CACtC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,WAAW,GAAG,IAAI,CAkBpB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAErE"}
|
package/dist/widgetDispatch.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ import { MetricWidgetProps } from './MetricWidget.js';
|
|
|
10
10
|
* (objectui#11514). The widget arm, `DashboardWidgetSchema`, is not a read type
|
|
11
11
|
* for an entry: since objectui#11483's closure its `type` names the widget
|
|
12
12
|
* vocabulary only, so the component arm is not assignable to it.
|
|
13
|
+
*
|
|
14
|
+
* ⛔ A widget key (`dataset`, `options`, `chartConfig`, `filter`, `component`,
|
|
15
|
+
* …) is read on the widget arm alone: narrow the entry with
|
|
16
|
+
* {@link isSlotComponentEntry} first (objectui#11598, N2 A), the read rule
|
|
17
|
+
* `DashboardComponentSchema.widgets` states. The component arm declares none
|
|
18
|
+
* of them, and a component node in the slot draws itself whatever else it
|
|
19
|
+
* carries; reading one off the entry whichever arm it was compiled only through
|
|
20
|
+
* `BaseSchema`'s index signature, which objectui#8347 removed.
|
|
13
21
|
*/
|
|
14
22
|
export type DashboardWidgetSlotEntry = DashboardComponentSchema['widgets'][number];
|
|
15
23
|
export declare function specDefaultWidgetType(): DashboardWidgetTypeName;
|
|
@@ -31,11 +39,15 @@ export declare function specDefaultWidgetType(): DashboardWidgetTypeName;
|
|
|
31
39
|
export declare function resolveWidgetType(entry: DashboardWidgetSlotEntry): DashboardWidgetSlotEntry['type'];
|
|
32
40
|
/**
|
|
33
41
|
* The node an entry's legacy `component` envelope holds, typed as the widget
|
|
34
|
-
* arm declares that member (`DashboardWidgetSchema['component']`)
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
42
|
+
* arm declares that member (`DashboardWidgetSchema['component']`), or
|
|
43
|
+
* `undefined` for a component node in the slot.
|
|
44
|
+
*
|
|
45
|
+
* `component` is a widget key, so it is read on the widget arm alone
|
|
46
|
+
* (objectui#11598, N2 A). It used to be read off the entry whichever arm it
|
|
47
|
+
* was: the component arm declares no `component`, so that read went through
|
|
48
|
+
* `BaseSchema`'s index signature, and a `metric-card` entry carrying one (a
|
|
49
|
+
* document the strict face refuses) drew the envelope's node in the card's
|
|
50
|
+
* place.
|
|
39
51
|
*/
|
|
40
52
|
export declare function entryComponent(entry: DashboardWidgetSlotEntry): DashboardWidgetSchema['component'];
|
|
41
53
|
/**
|
|
@@ -106,7 +118,11 @@ export type WidgetDispatchFamily =
|
|
|
106
118
|
| 'table'
|
|
107
119
|
/** Cross-tab — dataset-bound only; a non-dataset pivot is stale metadata. */
|
|
108
120
|
| 'pivot'
|
|
109
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* objectui's legacy `custom` widget. Its `component` envelope draws a
|
|
123
|
+
* `metric-card` and nothing else (objectui#12254); with no `component` it
|
|
124
|
+
* draws the labelled placeholder `unsupported` draws.
|
|
125
|
+
*/
|
|
110
126
|
| 'custom'
|
|
111
127
|
/** Known family, no renderer — labelled placeholder. */
|
|
112
128
|
| 'unsupported'
|
|
@@ -187,6 +203,20 @@ declare module '@object-ui/types' {
|
|
|
187
203
|
'plugin-dashboard:metric': DashboardMetricNodeSchema;
|
|
188
204
|
}
|
|
189
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* A stored inline metric widget's `options`, without the retired sub-caption
|
|
208
|
+
* key `description` (objectui#11389, ruling C).
|
|
209
|
+
*
|
|
210
|
+
* Both surfaces' metric arms spread a dataset-less widget's `options` onto the
|
|
211
|
+
* {@link DashboardMetricNodeSchema} node, and `MetricWidget` draws the node's
|
|
212
|
+
* `description` as the line under the value. So the spread alone would keep
|
|
213
|
+
* drawing a stored `options.description` as a sub-caption after every read that
|
|
214
|
+
* named it was removed. Both arms drop it here, so the two surfaces cannot
|
|
215
|
+
* disagree about it. The node's own `description` member stays: it is
|
|
216
|
+
* `MetricWidget`'s prop, which a node sets directly, not a key of a dashboard
|
|
217
|
+
* widget's options bag.
|
|
218
|
+
*/
|
|
219
|
+
export declare function withoutRetiredSubCaption<T extends Record<string, unknown>>(options: T): Omit<T, 'description'>;
|
|
190
220
|
/**
|
|
191
221
|
* `node` with its `type` moved onto the namespaced key {@link
|
|
192
222
|
* DASHBOARD_NODE_TYPES} names, or `node` itself when the type has no row.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgetDispatch.d.ts","sourceRoot":"","sources":["../src/widgetDispatch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,OAAO,KAAK,EACV,UAAU,EACV,wBAAwB,EACxB,qBAAqB,EACrB,kCAAkC,EAClC,uBAAuB,EAExB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD
|
|
1
|
+
{"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,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACxC;AAED,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,kBAAkB;QAC1B,yBAAyB,EAAE,yBAAyB,CAAC;KACtD;CACF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,aAAa,CAAC,CAG9G;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAKjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-dashboard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Dashboard plugin for Object UI",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"@dnd-kit/core": "^6.3.1",
|
|
19
19
|
"@dnd-kit/sortable": "^10.0.0",
|
|
20
20
|
"@dnd-kit/utilities": "^3.2.2",
|
|
21
|
-
"@objectstack/spec": "^
|
|
21
|
+
"@objectstack/spec": "^18.0.0",
|
|
22
22
|
"lucide-react": "^1.43.0",
|
|
23
|
-
"@object-ui/components": "
|
|
24
|
-
"@object-ui/
|
|
25
|
-
"@object-ui/
|
|
26
|
-
"@object-ui/i18n": "
|
|
27
|
-
"@object-ui/permissions": "
|
|
28
|
-
"@object-ui/
|
|
29
|
-
"@object-ui/
|
|
23
|
+
"@object-ui/components": "18.0.0",
|
|
24
|
+
"@object-ui/fields": "18.0.0",
|
|
25
|
+
"@object-ui/core": "18.0.0",
|
|
26
|
+
"@object-ui/i18n": "18.0.0",
|
|
27
|
+
"@object-ui/permissions": "18.0.0",
|
|
28
|
+
"@object-ui/types": "18.0.0",
|
|
29
|
+
"@object-ui/react": "18.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"typescript": "^6.0.3",
|
|
42
42
|
"vite": "^8.2.1",
|
|
43
43
|
"vite-plugin-dts": "^5.0.3",
|
|
44
|
-
"@object-ui/plugin-charts": "
|
|
45
|
-
"@object-ui/sdui-parser": "
|
|
44
|
+
"@object-ui/plugin-charts": "18.0.0",
|
|
45
|
+
"@object-ui/sdui-parser": "18.0.0",
|
|
46
46
|
"@object-ui/test-support": "17.4.0"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ObjectUI
|
|
3
|
-
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* The structural minimum this resolution reads. Deliberately not
|
|
10
|
-
* `DashboardWidgetSchema`: the two surfaces hold their widgets at two different
|
|
11
|
-
* static types (the grid holds the `DashboardWidgetSlotComponentSchema |
|
|
12
|
-
* DashboardWidgetSchema` union its `widgets` slot declares), and both satisfy
|
|
13
|
-
* this shape. `options` is `unknown` because that is what
|
|
14
|
-
* `DashboardWidgetSchema` declares it as.
|
|
15
|
-
*/
|
|
16
|
-
export interface SubCaptionWidget {
|
|
17
|
-
id?: string;
|
|
18
|
-
options?: unknown;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Resolve a dataset/metric widget's sub-caption for the active UI language.
|
|
22
|
-
*
|
|
23
|
-
* `dashName` is the dashboard schema's `name` — the segment every convention
|
|
24
|
-
* key on this surface is built from. Without it (or without a widget `id`)
|
|
25
|
-
* there is no key to look up, so the authored limb answers alone; that is the
|
|
26
|
-
* same silent degradation `tWidgetTitle` / `tWidgetDescription` perform, not a
|
|
27
|
-
* new one.
|
|
28
|
-
*
|
|
29
|
-
* `localized` is the host's word that the document was served already
|
|
30
|
-
* translated (`DashboardRendererProps.localized`): the authored limb then
|
|
31
|
-
* answers alone, because the served value IS the translation.
|
|
32
|
-
*
|
|
33
|
-
* Provider-safe: `useObjectLabel` and `useObjectTranslation` both degrade to a
|
|
34
|
-
* no-instance stand-in when no `I18nProvider` is mounted (objectui#5564), which
|
|
35
|
-
* `DashboardGridLayout` depends on — it is a separately exported component a
|
|
36
|
-
* host mounts standalone (its `dashboard-grid` node key was retired by
|
|
37
|
-
* objectui#10859 batch 8).
|
|
38
|
-
*/
|
|
39
|
-
export declare function useWidgetSubCaption(dashName: string | undefined, localized?: boolean): (widget: SubCaptionWidget) => string | undefined;
|
|
40
|
-
//# sourceMappingURL=widgetSubCaption.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgetSubCaption.d.ts","sourceRoot":"","sources":["../src/widgetSubCaption.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4EH;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,UAAQ,GAChB,CAAC,MAAM,EAAE,gBAAgB,KAAK,MAAM,GAAG,SAAS,CAalD"}
|