@object-ui/plugin-dashboard 17.5.0 → 17.7.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 +5042 -0
- package/README.md +544 -74
- package/dist/DashboardConfigPanel.d.ts +3 -0
- package/dist/DashboardConfigPanel.d.ts.map +1 -1
- package/dist/DashboardFilterBar.d.ts.map +1 -1
- package/dist/DashboardGridLayout.d.ts +3 -2
- package/dist/DashboardGridLayout.d.ts.map +1 -1
- package/dist/DashboardRenderer.d.ts +32 -2
- package/dist/DashboardRenderer.d.ts.map +1 -1
- package/dist/DashboardWithConfig.d.ts +1 -1
- package/dist/DashboardWithConfig.d.ts.map +1 -1
- package/dist/DatasetWidget.d.ts +43 -119
- package/dist/DatasetWidget.d.ts.map +1 -1
- package/dist/DrillDownDrawer.d.ts +14 -5
- package/dist/DrillDownDrawer.d.ts.map +1 -1
- package/dist/MetricCard.d.ts +1 -1
- package/dist/MetricWidget.d.ts +27 -2
- package/dist/MetricWidget.d.ts.map +1 -1
- package/dist/ObjectDataTable.d.ts +473 -19
- package/dist/ObjectDataTable.d.ts.map +1 -1
- package/dist/ObjectMetricWidget.d.ts +65 -27
- package/dist/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/ObjectPivotTable.d.ts +46 -7
- package/dist/ObjectPivotTable.d.ts.map +1 -1
- package/dist/PivotTable.d.ts +20 -3
- package/dist/PivotTable.d.ts.map +1 -1
- package/dist/RecordDetailDrawer.d.ts +8 -0
- package/dist/RecordDetailDrawer.d.ts.map +1 -1
- package/dist/WidgetConfigPanel.d.ts +29 -1
- package/dist/WidgetConfigPanel.d.ts.map +1 -1
- package/dist/WidgetEmptyState.d.ts +27 -0
- package/dist/WidgetEmptyState.d.ts.map +1 -0
- package/dist/domPassthroughPins.d.ts.map +1 -1
- package/dist/index.d.ts +30 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2306 -1858
- package/dist/index.umd.cjs +2 -2
- package/dist/legacyRetiredWidget.d.ts +5 -3
- package/dist/legacyRetiredWidget.d.ts.map +1 -1
- package/dist/measureRefusal.d.ts +50 -0
- package/dist/measureRefusal.d.ts.map +1 -0
- package/dist/recordFields.d.ts +159 -9
- package/dist/recordFields.d.ts.map +1 -1
- package/dist/retired-node-types.d.ts +29 -0
- package/dist/retired-node-types.d.ts.map +1 -0
- package/dist/useConfigPanelTranslation.d.ts +35 -0
- package/dist/useConfigPanelTranslation.d.ts.map +1 -0
- package/dist/useDashboardAutoRefresh.d.ts +47 -0
- package/dist/useDashboardAutoRefresh.d.ts.map +1 -0
- package/dist/utils.d.ts +36 -7
- package/dist/utils.d.ts.map +1 -1
- package/dist/widgetDispatch.d.ts +144 -18
- package/dist/widgetDispatch.d.ts.map +1 -1
- package/dist/widgetSubCaption.d.ts +40 -0
- package/dist/widgetSubCaption.d.ts.map +1 -0
- package/package.json +15 -15
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
* objectui#8894 — what the widget door says about a widget's MEASURES.
|
|
10
|
+
*
|
|
11
|
+
* Returns the message of the `custom` issue objectui's authoring door raises at
|
|
12
|
+
* `values` for this type, these measures and these dimensions, or `undefined`
|
|
13
|
+
* when the door accepts them. The door is `DashboardWidgetSchema` from
|
|
14
|
+
* `@object-ui/types/zod`, which re-attaches the spec's own object-level checks,
|
|
15
|
+
* so its verdict and its message are the spec's (pinned by
|
|
16
|
+
* `packages/types/src/__tests__/dashboard-widget-metric-measure-door-8894.test.ts`).
|
|
17
|
+
*
|
|
18
|
+
* The door is ASKED, never restated: no widget-type list lives here. Whichever
|
|
19
|
+
* types the spec refuses a second measure on — the metric family since
|
|
20
|
+
* `@objectstack/spec` 17.5.0 (`checkDashboardWidgetMetricMeasureArity`), and
|
|
21
|
+
* any further shape once a spec release refuses it and the mirror re-attaches
|
|
22
|
+
* that check (objectstack#20958 is the pending one) — the authoring pickers that
|
|
23
|
+
* read this follow without an edit here.
|
|
24
|
+
*
|
|
25
|
+
* Only the keys a measure rule reads go into the probe — `id` (the message
|
|
26
|
+
* names it), `type`, `values` and `dimensions` — each kept to a shape the door
|
|
27
|
+
* accepts. zod skips object-level checks once a field-level issue aborts the
|
|
28
|
+
* parse, and a draft in an editor is half-written by nature: measured on the
|
|
29
|
+
* mirror, a numeric `id`, a non-string dimension or a malformed `title`
|
|
30
|
+
* anywhere in the document each hide the measure verdict completely, which
|
|
31
|
+
* would read as "accepted". The probe keeps those faults out of the question it
|
|
32
|
+
* asks.
|
|
33
|
+
*
|
|
34
|
+
* Module-private to this package (not re-exported from its index).
|
|
35
|
+
*/
|
|
36
|
+
export declare function measureRefusal(widget: {
|
|
37
|
+
id?: unknown;
|
|
38
|
+
type?: unknown;
|
|
39
|
+
values?: unknown;
|
|
40
|
+
dimensions?: unknown;
|
|
41
|
+
}): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* A stand-in for "one more measure", used to ask the door whether a picker may
|
|
44
|
+
* offer another one before the author has chosen which. The door's measure
|
|
45
|
+
* rules judge how many measures a widget declares, not their names (whether a
|
|
46
|
+
* measure exists in the bound dataset is out of the widget schema's reach), so
|
|
47
|
+
* any name the widget does not already carry asks the same question.
|
|
48
|
+
*/
|
|
49
|
+
export declare const NEXT_MEASURE_PROBE = "__next_measure__";
|
|
50
|
+
//# sourceMappingURL=measureRefusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measureRefusal.d.ts","sourceRoot":"","sources":["../src/measureRefusal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,GAAG,SAAS,CAgBrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,qBAAqB,CAAC"}
|
package/dist/recordFields.d.ts
CHANGED
|
@@ -8,6 +8,74 @@ export declare const SYSTEM_FIELDS: Set<string>;
|
|
|
8
8
|
export declare function isSystemField(name: string, def?: any): boolean;
|
|
9
9
|
/** Numeric-flavoured field types (right-aligned in tables). */
|
|
10
10
|
export declare const NUMERIC_FIELD_TYPES: Set<string>;
|
|
11
|
+
/**
|
|
12
|
+
* The override vocabulary this package's two field surfaces share.
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ This type is a DERIVATION SOURCE, not only a shape: `ObjectDataTable`'s
|
|
15
|
+
* two column bands are both `Exclude<keyof FieldMeta, …>` — `EnrichedColumn`'s
|
|
16
|
+
* write-side tombstones (objectui#6373) and `AuthoredColumnOverrides`' read-side
|
|
17
|
+
* refusal band (objectui#6425). So a member REMOVED here silently leaves both
|
|
18
|
+
* bands, and any refusal that rode on its membership stops enforcing with
|
|
19
|
+
* nothing going red. A member being retired must therefore be re-refused
|
|
20
|
+
* explicitly at that seam before it leaves this type — see
|
|
21
|
+
* `ObjectDataTableRetiredDecimalsTombstone` in `ObjectDataTable.tsx`, which is
|
|
22
|
+
* what `decimals` left behind.
|
|
23
|
+
*
|
|
24
|
+
* ⛔ `decimals` was RETIRED from this type by objectui#6625 — written from the
|
|
25
|
+
* schema def on every call and read by nothing (zero `.decimals` member reads
|
|
26
|
+
* across `@object-ui/fields`, `@object-ui/i18n`, `@object-ui/components`,
|
|
27
|
+
* `@object-ui/core` and this package, measured against a `.scale` positive
|
|
28
|
+
* control that hits `NumberField.tsx` / `GridField.tsx` / `index.tsx`). If a
|
|
29
|
+
* reader is ever wanted here it reads `scale` — the field def's decimal-places
|
|
30
|
+
* key, which is what the retired write resolved to anyway and what
|
|
31
|
+
* `NumberCellRenderer` already reads (`precision` is the total digit count, a
|
|
32
|
+
* different question — objectui#2131). ⛔ Do not resurrect `decimals`.
|
|
33
|
+
*
|
|
34
|
+
* ⛔ `referenceTo` was RETIRED from this type by objectui#6597 (enforce-or-remove,
|
|
35
|
+
* withdraw branch — maintainer's standing startup-stage rule, 2026-08-27: no
|
|
36
|
+
* measured demand retires immediately). It was documented by this package's
|
|
37
|
+
* README as an author-facing column override, but the promise was never kept:
|
|
38
|
+
* `LookupCellRenderer` (`@object-ui/fields`) resolves its lookup target from
|
|
39
|
+
* `field.reference_to` / `field.reference` — never `field.referenceTo` — and
|
|
40
|
+
* `computeLookupExpand` (`ObjectDataTable.tsx`) builds `$expand` from the OBJECT
|
|
41
|
+
* SCHEMA's field types, never from an authored override. Measured with the
|
|
42
|
+
* `referenceTo`-vs-`options` positive control in
|
|
43
|
+
* `ObjectDataTable.overrideSource-6425.test.tsx`: `options` (a live override)
|
|
44
|
+
* separates two equal-valued columns, `referenceTo` does not — an authored
|
|
45
|
+
* override renders byte-identical to its absence. No authoring story survived
|
|
46
|
+
* the search either: the sibling `ObjectGrid` producer's own relational-meta
|
|
47
|
+
* pass-through (`applyRelationalMeta`, `plugin-grid/src/ObjectGrid.tsx`) copies
|
|
48
|
+
* `reference_to` / `reference` from the SCHEMA field def only, never from an
|
|
49
|
+
* authored column override, and no example/doc/fixture in this repo shows a
|
|
50
|
+
* table column pinning a lookup's target to something other than what its
|
|
51
|
+
* schema field already says. If a reader for the resolved reference target is
|
|
52
|
+
* ever wanted here, it reads `reference_to` / `reference` off the schema field
|
|
53
|
+
* def directly — the spelling `LookupCellRenderer` and `computeLookupExpand`
|
|
54
|
+
* actually use. ⛔ Do not resurrect `referenceTo`.
|
|
55
|
+
*
|
|
56
|
+
* ⭐ That reader ARRIVED (objectui#6694): `reference` / `displayField` below
|
|
57
|
+
* (with `reference_to` beside them until objectui#11070 round 4 retired it,
|
|
58
|
+
* and `display_field` until objectui#11070's text-family round did), copied
|
|
59
|
+
* from the SCHEMA field def by {@link buildFieldMeta} and justified per key on
|
|
60
|
+
* `CELL_RELATIONAL_META_KEYS`.
|
|
61
|
+
* They are the "future reader" both retirement notes predicted, in the spelling
|
|
62
|
+
* they named, and they change neither verdict — the source is the schema field
|
|
63
|
+
* def, never an authored column override, which is the exact distinction
|
|
64
|
+
* objectui#6597 measured and withdrew on.
|
|
65
|
+
*
|
|
66
|
+
* ⚠️ Being `FieldMeta` members they GROW both derived bands in
|
|
67
|
+
* `ObjectDataTable.tsx` — `EnrichedColumn`'s emit tombstones and
|
|
68
|
+
* `UnheldFieldMetaOverrideKey`'s read-side refusal. `reference_to` left the
|
|
69
|
+
* type in objectui#11070 round 4 and `display_field` in its text-family round,
|
|
70
|
+
* so — by the rule at the top of this docblock — each one's refusal is
|
|
71
|
+
* re-stated by hand there (`ObjectDataTableRetiredReferenceToSnakeTombstone`,
|
|
72
|
+
* `ObjectDataTableRetiredDisplayFieldSnakeTombstone`). That is the intended
|
|
73
|
+
* verdict rather than a side effect: an AUTHORED column may not source a
|
|
74
|
+
* lookup's reference target (objectui#6597 measured no authoring story for
|
|
75
|
+
* one), while the schema-derived write is reached by neither band. They landed
|
|
76
|
+
* in both without anyone editing a list — the property this derivation exists
|
|
77
|
+
* for.
|
|
78
|
+
*/
|
|
11
79
|
export interface FieldMeta {
|
|
12
80
|
name: string;
|
|
13
81
|
label: string;
|
|
@@ -17,10 +85,34 @@ export interface FieldMeta {
|
|
|
17
85
|
label: string;
|
|
18
86
|
color?: string;
|
|
19
87
|
}>;
|
|
20
|
-
referenceTo?: unknown;
|
|
21
88
|
format?: string;
|
|
22
89
|
currency?: string;
|
|
23
|
-
|
|
90
|
+
/**
|
|
91
|
+
* The field def's declared upper bound, which on a `percent` field is its
|
|
92
|
+
* STORAGE statement: the spec's `percentScaleOf` reads a fraction unless
|
|
93
|
+
* `max` is above 1 (objectui#11475). Copied from the SCHEMA field def by
|
|
94
|
+
* {@link buildFieldMeta} so the percent cell and the `%` branch of
|
|
95
|
+
* {@link renderFieldValue} read the field's storage rather than guess it
|
|
96
|
+
* from the value. Never an authored column override: as a `FieldMeta`
|
|
97
|
+
* member it lands in `ObjectDataTable`'s read-side refusal band, which is
|
|
98
|
+
* the intended verdict — a column may not restate how its field stores.
|
|
99
|
+
*/
|
|
100
|
+
max?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Lookup target object — the spelling `@objectstack/spec`'s `FieldSchema`
|
|
103
|
+
* declares and the only one `LookupCellRenderer` reads. Its snake_case twin
|
|
104
|
+
* `reference_to` was RETIRED from this type by objectui#11070 round 4.
|
|
105
|
+
*/
|
|
106
|
+
reference?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Author-declared display field on the lookup, in the SPEC spelling
|
|
109
|
+
* (`FieldSchema.displayField`) — it beats every resolver in the cell. The
|
|
110
|
+
* first leg of `LookupCellRenderer`'s `displayField || reference_field`
|
|
111
|
+
* chain, and the only leg a spec-compliant producer can emit
|
|
112
|
+
* (objectui#6875). Its snake_case twin `display_field` was RETIRED from this
|
|
113
|
+
* type by objectui#11070's text-family round: no reader read it.
|
|
114
|
+
*/
|
|
115
|
+
displayField?: string;
|
|
24
116
|
}
|
|
25
117
|
/**
|
|
26
118
|
* Normalize an object schema's `fields` into a `{ name → def }` map. Accepts
|
|
@@ -37,20 +129,39 @@ export interface BuildFieldMetaParams {
|
|
|
37
129
|
objectName?: string;
|
|
38
130
|
/** Translator for per-option labels (from `useSafeFieldLabel`). */
|
|
39
131
|
fieldOptionLabel?: (objectName: string, field: string, value: string, fallback: string) => string;
|
|
40
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Per-column overrides (table columns may pin type/format/options).
|
|
134
|
+
*
|
|
135
|
+
* A subset of {@link FieldMeta}, which is what makes that type the pool
|
|
136
|
+
* `ObjectDataTable`'s refusal band derives from. `decimals` left with the
|
|
137
|
+
* member (objectui#6625): its last feeder went when objectui#6425's ruling
|
|
138
|
+
* removed the authored read from `ObjectDataTable.enrich()`, and
|
|
139
|
+
* `RecordDetailDrawer` — the only other caller — passes no overrides at all.
|
|
140
|
+
* `referenceTo` left the same way (objectui#6597): `ObjectDataTable.enrich()`
|
|
141
|
+
* no longer reads it off the authored column, and `RecordDetailDrawer` never
|
|
142
|
+
* did.
|
|
143
|
+
*/
|
|
41
144
|
overrides?: {
|
|
42
145
|
type?: string;
|
|
43
146
|
format?: string;
|
|
44
147
|
options?: any;
|
|
45
|
-
referenceTo?: unknown;
|
|
46
148
|
currency?: string;
|
|
47
|
-
decimals?: number;
|
|
48
149
|
};
|
|
49
150
|
}
|
|
50
151
|
/**
|
|
51
|
-
* Build the `FieldMeta` for a single field, resolving
|
|
52
|
-
*
|
|
53
|
-
*
|
|
152
|
+
* Build the `FieldMeta` for a single field, resolving currency from the
|
|
153
|
+
* schema field def and translating select options. Column-level overrides
|
|
154
|
+
* win over schema-derived values.
|
|
155
|
+
*
|
|
156
|
+
* The field def's currency goes through `resolveFieldCurrency`
|
|
157
|
+
* (`@object-ui/i18n`) rather than a chain of this helper's own (objectui#10463).
|
|
158
|
+
* The resolver is what reads `currencyConfig`, the spec's one fixed-currency
|
|
159
|
+
* declaration, and only under `currencyMode: 'fixed'`. The chain it replaced
|
|
160
|
+
* read the flat `currency` / `defaultCurrency` spellings only, so a fixed
|
|
161
|
+
* field painted in the tenant currency in both the table cell and the record
|
|
162
|
+
* drawer. The call passes NO tenant default: `renderFieldValue` backstops with
|
|
163
|
+
* the tenant only after the symbol it infers from a `format`, and a tenant code
|
|
164
|
+
* resolved here would jump ahead of that symbol.
|
|
54
165
|
*/
|
|
55
166
|
export declare function buildFieldMeta(params: BuildFieldMetaParams): FieldMeta;
|
|
56
167
|
/** Whether a `FieldMeta` should be right-aligned (numeric / currency / percent). */
|
|
@@ -65,6 +176,45 @@ export declare function isNumericFieldMeta(fieldMeta: Pick<FieldMeta, 'type' | '
|
|
|
65
176
|
* cell and the record-detail drawer honor the tenant default.
|
|
66
177
|
*/
|
|
67
178
|
export declare function renderFieldValue(value: any, fieldMeta: FieldMeta, tenantCurrency?: string, displayLocale?: string): React.ReactNode;
|
|
68
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* Whether a field is a relation/lookup (used to drive `$expand`).
|
|
181
|
+
*
|
|
182
|
+
* THE GATE (objectui#4914, ruling B) runs ahead of the membership test.
|
|
183
|
+
* Measured before the ruling: `isLookupType('owner')` was `true` — a retired
|
|
184
|
+
* spelling holding first-class relation status. It answers `false` now, and
|
|
185
|
+
* says why once.
|
|
186
|
+
*
|
|
187
|
+
* The membership half is no longer a private table (objectui#5692). It used to
|
|
188
|
+
* be `new Set(['lookup', 'reference', 'master_detail', 'user'])`, one of TWO
|
|
189
|
+
* copies this package held — the other inline in `computeLookupExpand` — and
|
|
190
|
+
* neither derived from nor pinned against {@link EXPANDABLE_FIELD_TYPES}, the
|
|
191
|
+
* family `@object-ui/core` publishes for exactly this question. objectui#5312's
|
|
192
|
+
* claim to have converted "the LAST private copy" was false by these two: they
|
|
193
|
+
* predate that sweep and were outside its file surface.
|
|
194
|
+
*
|
|
195
|
+
* The convergence moved membership in two directions, each decided by
|
|
196
|
+
* measurement rather than by preference (objectui#5692):
|
|
197
|
+
*
|
|
198
|
+
* - `tree` is GAINED. A self-referencing hierarchy field is reference-bearing,
|
|
199
|
+
* it is a member of the spec's closed `FieldType`, and the form / grid road
|
|
200
|
+
* already `$expand`s it. The dashboard road giving it the same treatment is
|
|
201
|
+
* family behaviour restored, not a new decision.
|
|
202
|
+
* - `reference` is DROPPED, and dropping it is a no-op on spec-compliant data.
|
|
203
|
+
* The spelling is absent from `@objectstack/spec`'s closed `FieldType`
|
|
204
|
+
* vocabulary and is refused by `FieldSchema.safeParse` — measured with
|
|
205
|
+
* `lookup` / `master_detail` / `user` / `tree` as live controls and the
|
|
206
|
+
* retired `owner` plus a nonsense spelling as dead ones — so no
|
|
207
|
+
* spec-compliant object schema can declare a field whose stored type is
|
|
208
|
+
* `reference`. Where the spelling IS live it is a legacy DIALECT alias on the
|
|
209
|
+
* action-param surface, folded to `lookup` before any field-type data is read
|
|
210
|
+
* (`PARAM_TYPE_ALIASES` in `app-shell/src/utils/paramToField.ts`). Keeping it
|
|
211
|
+
* here would be a lenient renderer-side alias for off-spec metadata, which is
|
|
212
|
+
* what AGENTS.md #0.1 bans.
|
|
213
|
+
*
|
|
214
|
+
* Extending this surface later: OR in a second, surface-local set, the way the
|
|
215
|
+
* object form's `needsDataSourceWiring` does. Never
|
|
216
|
+
* `new Set([...EXPANDABLE_FIELD_TYPES, …])` — a copy re-forks the table, which
|
|
217
|
+
* is the defect this change removed, and the identity pin fails on it by design.
|
|
218
|
+
*/
|
|
69
219
|
export declare function isLookupType(t: unknown): boolean;
|
|
70
220
|
//# sourceMappingURL=recordFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordFields.d.ts","sourceRoot":"","sources":["../src/recordFields.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"recordFields.d.ts","sourceRoot":"","sources":["../src/recordFields.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAyB1B;;;GAGG;AACH,eAAO,MAAM,aAAa,aAIxB,CAAC;AAEH,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAG9D;AAKD,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,aAE9B,CAAC;AAyIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAA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,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,OAAO,CAKzF;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,EACV,SAAS,EAAE,SAAS,EACpB,cAAc,CAAC,EAAE,MAAM,EAKvB,aAAa,CAAC,EAAE,MAAM,GACrB,KAAK,CAAC,SAAS,CA4EjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAMhD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The bare name of every retired spelling, mapped to the refusal text the
|
|
4
|
+
* tombstone renders and logs. Keyed by the BARE name because that is what
|
|
5
|
+
* `ComponentRegistry.register` takes; the namespace is spelled at the call.
|
|
6
|
+
*
|
|
7
|
+
* The message names BOTH halves deliberately — the spelling that was written
|
|
8
|
+
* and the spelling that replaces it. A refusal that only says "unknown" is the
|
|
9
|
+
* one this table exists to stop being.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RETIRED_DASHBOARD_NODE_TYPES: Readonly<Record<string, string>>;
|
|
12
|
+
/**
|
|
13
|
+
* Log a retired node-type spelling once. Exported for the pin test, which has
|
|
14
|
+
* to be able to observe a SECOND occurrence being suppressed without inventing
|
|
15
|
+
* its own copy of the set.
|
|
16
|
+
*/
|
|
17
|
+
export declare function reportRetiredDashboardNodeType(spelling: string): void;
|
|
18
|
+
/** Test seam: forget what has been reported, so a pin can measure the first one. */
|
|
19
|
+
export declare function resetRetiredDashboardNodeTypeReports(): void;
|
|
20
|
+
/**
|
|
21
|
+
* The widget a RETIRED dashboard node-type spelling renders.
|
|
22
|
+
*
|
|
23
|
+
* The rendered text and the logged text are the SAME string, read from
|
|
24
|
+
* {@link RETIRED_DASHBOARD_NODE_TYPES}. A pin that asserts only "nothing
|
|
25
|
+
* rendered" cannot tell this refusal apart from the key having been deleted
|
|
26
|
+
* outright, which is why the text is part of the contract and not decoration.
|
|
27
|
+
*/
|
|
28
|
+
export declare const RetiredDashboardNodeTombstone: React.FC<Record<string, unknown>>;
|
|
29
|
+
//# sourceMappingURL=retired-node-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retired-node-types.d.ts","sourceRoot":"","sources":["../src/retired-node-types.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxE,CAAC;AAKH;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOrE;AAED,oFAAoF;AACpF,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwB3E,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
* Default English translations for the dashboard config panels.
|
|
10
|
+
*
|
|
11
|
+
* Used as the fallback when no `I18nProvider` is available (standalone embeds,
|
|
12
|
+
* the preview gallery, this package's own unit tests). Every row's key exists
|
|
13
|
+
* in all ten packs and every row's value equals the `en` pack's.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CONFIG_PANEL_DEFAULT_TRANSLATIONS: Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Safe translation hook for the dashboard config panels.
|
|
18
|
+
*
|
|
19
|
+
* Falls back to {@link CONFIG_PANEL_DEFAULT_TRANSLATIONS} when no
|
|
20
|
+
* `I18nProvider` is mounted. The name matches the repo's `use*Translation`
|
|
21
|
+
* convention, which is what `scripts/check-i18n-call-site-keys.mjs` classifies
|
|
22
|
+
* as a pack-backed translator — so every key the panels ask for is checked
|
|
23
|
+
* against the `en` pack, and `scripts/check-i18n-dead-keys.mjs` sees the
|
|
24
|
+
* namespace as read.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useConfigPanelTranslation: () => {
|
|
27
|
+
t: (key: string, options?: Record<string, unknown>) => string;
|
|
28
|
+
language: string;
|
|
29
|
+
} | {
|
|
30
|
+
t: import('i18next').TFunction<string, undefined>;
|
|
31
|
+
language: string;
|
|
32
|
+
};
|
|
33
|
+
/** The translate function the schema builders receive. */
|
|
34
|
+
export type ConfigPanelTranslate = (key: string, options?: Record<string, unknown>) => string;
|
|
35
|
+
//# sourceMappingURL=useConfigPanelTranslation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfigPanelTranslation.d.ts","sourceRoot":"","sources":["../src/useConfigPanelTranslation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+CH;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuHpE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB;4BA1LrC,CAAC;;;;;CA6LD,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,GAAG,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,MAAM,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DashboardComponentSchema } from '@object-ui/types';
|
|
2
|
+
/**
|
|
3
|
+
* The dashboard auto-refresh timer: ONE implementation, two mount points
|
|
4
|
+
* (objectui#8820).
|
|
5
|
+
*
|
|
6
|
+
* `DashboardGridLayout` and `DashboardRenderer` each used to carry their own
|
|
7
|
+
* copy of the same three things: a `refreshing` flag, a `handleRefresh`
|
|
8
|
+
* callback shared by the manual "Refresh All" button and the timer, and an
|
|
9
|
+
* effect that read the authored period and drove `setInterval`. The copies were
|
|
10
|
+
* identical in logic, and two copies of one rule is two places to change and
|
|
11
|
+
* one place to forget: the `refreshInterval` to `refreshIntervalSeconds` rename
|
|
12
|
+
* (objectui#7783) had to be made twice, and a copy that drifted would still
|
|
13
|
+
* pass its own component's tests.
|
|
14
|
+
*
|
|
15
|
+
* This hook is that logic, moved here. Both surfaces call it, so the authored
|
|
16
|
+
* period is read in exactly one place.
|
|
17
|
+
*
|
|
18
|
+
* - The period is `refreshIntervalSeconds`, in seconds, and nothing else. The
|
|
19
|
+
* retired `refreshInterval` spelling is refused by the spec's
|
|
20
|
+
* `DashboardSchema`, so no fallback reads it (AGENTS.md #0.1).
|
|
21
|
+
* - The timer runs only when the host wired `onRefresh` AND the period is
|
|
22
|
+
* greater than zero: an absent period, `0` and a negative value all mean
|
|
23
|
+
* "off".
|
|
24
|
+
* - The interval is armed on VALUES only: the period and whether a handler is
|
|
25
|
+
* wired. The handler itself is read through a ref when a run happens, so a
|
|
26
|
+
* new handler identity, from the host or from React discarding a memo, never
|
|
27
|
+
* re-arms the interval or moves its phase, and the run still calls the
|
|
28
|
+
* CURRENT handler (AGENTS.md #10, objectui#11004).
|
|
29
|
+
* - The indicator clears itself 600ms after each run, manual or timed.
|
|
30
|
+
*
|
|
31
|
+
* `__tests__/dashboardAutoRefreshTimer.test.tsx` mounts both surfaces and
|
|
32
|
+
* counts `onRefresh` calls under fake timers. It pins the first three points,
|
|
33
|
+
* the third under a forced memo discard; nothing pins the 600ms indicator.
|
|
34
|
+
*/
|
|
35
|
+
/** What a dashboard surface needs to drive its refresh affordance. */
|
|
36
|
+
export interface DashboardAutoRefresh {
|
|
37
|
+
/** True while a refresh is in flight; drives the spinner and disables the button. */
|
|
38
|
+
refreshing: boolean;
|
|
39
|
+
/** Run a refresh now. Wired to both the manual button and the timer. */
|
|
40
|
+
handleRefresh: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Owns the refresh indicator, the manual refresh handler, and the auto-refresh
|
|
44
|
+
* interval for one dashboard surface.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useDashboardAutoRefresh(schema: DashboardComponentSchema, onRefresh?: () => void): DashboardAutoRefresh;
|
|
47
|
+
//# sourceMappingURL=useDashboardAutoRefresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDashboardAutoRefresh.d.ts","sourceRoot":"","sources":["../src/useDashboardAutoRefresh.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,qFAAqF;IACrF,UAAU,EAAE,OAAO,CAAC;IACpB,wEAAwE;IACxE,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAoBD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,wBAAwB,EAChC,SAAS,CAAC,EAAE,MAAM,IAAI,GACrB,oBAAoB,CAsCtB"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -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 { useObjectLabel, useObjectTranslation } from '@object-ui/i18n';
|
|
8
2
|
/** Returns true when the widget data config uses provider: 'object' (async data source). */
|
|
9
3
|
export declare function isObjectProvider(widgetData: unknown): widgetData is {
|
|
10
4
|
provider: 'object';
|
|
@@ -21,6 +15,41 @@ export declare function isObjectProvider(widgetData: unknown): widgetData is {
|
|
|
21
15
|
* path derives headers with it when no columns were declared at all.
|
|
22
16
|
*/
|
|
23
17
|
export declare function humanizeFieldKey(key: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a chart series label — the SINGLE authority both dashboard relays
|
|
20
|
+
* (`DashboardRenderer`, `DashboardGridLayout`) call, so the three-arm decision
|
|
21
|
+
* below lives once instead of as two copies that could drift.
|
|
22
|
+
*
|
|
23
|
+
* Originated as a `DashboardRenderer`-local `useCallback` (objectui#9055,
|
|
24
|
+
* which fixed arms 2 and 3 there). `DashboardGridLayout` composed
|
|
25
|
+
* `series: [{ dataKey }]` with no `label` key on either of its branches — the
|
|
26
|
+
* legend and tooltip rendered the raw field key while the sibling relay's
|
|
27
|
+
* chart for the same widget rendered the humanized one (objectui#9172). That
|
|
28
|
+
* card is what moved this here rather than growing a second copy of the
|
|
29
|
+
* three-arm logic: a helper duplicated across the two relays is exactly the
|
|
30
|
+
* "one value, two spellings" class `56f4e34c0` ruled out.
|
|
31
|
+
*
|
|
32
|
+
* ⭐ THREE ARMS, and only the last two derive a display string from a FIELD
|
|
33
|
+
* KEY:
|
|
34
|
+
*
|
|
35
|
+
* arm 1 synthetic y-field ('value' / 'count' / '') + an aggregate function
|
|
36
|
+
* -> an i18n'd aggregate name (Count / Sum / Average …), so a
|
|
37
|
+
* fieldless count aggregate doesn't leak the placeholder 'value' /
|
|
38
|
+
* 'count' string into the legend / tooltip.
|
|
39
|
+
* arm 2 a real object + a real field -> `fieldLabel`'s bundle lookup, with
|
|
40
|
+
* the HUMANIZED key (not the raw one) as its fallback.
|
|
41
|
+
* arm 3 no object name at all (a static-data chart) -> the humanized key
|
|
42
|
+
* outright.
|
|
43
|
+
*
|
|
44
|
+
* `t` and `fieldLabel` are injected rather than the hooks themselves, so this
|
|
45
|
+
* stays a plain function callable from either relay's own
|
|
46
|
+
* `useObjectTranslation()` / `useObjectLabel()` instances — no shared hook
|
|
47
|
+
* identity to manage, and each relay keeps memoizing its own `useCallback`
|
|
48
|
+
* wrapper over this (objectui#10's caution against depending on a memo's
|
|
49
|
+
* IDENTITY is about correctness, not about composing plain functions like
|
|
50
|
+
* this one).
|
|
51
|
+
*/
|
|
52
|
+
export declare function composeSeriesLabel(t: ReturnType<typeof useObjectTranslation>['t'], fieldLabel: ReturnType<typeof useObjectLabel>['fieldLabel'], objectName: string | undefined, yField: string, aggFn: string | undefined): string;
|
|
24
53
|
/**
|
|
25
54
|
* Columns for a STATIC (inline `options.data`) table widget whose author
|
|
26
55
|
* declared none — objectui#4618.
|
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,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;;;;;;;;;;;;;;;;;;;;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,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