@object-ui/plugin-dashboard 17.3.0 → 17.6.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +1445 -0
  2. package/README.md +199 -33
  3. package/dist/DashboardConfigPanel.d.ts +3 -0
  4. package/dist/DashboardConfigPanel.d.ts.map +1 -1
  5. package/dist/DashboardFilterBar.d.ts.map +1 -1
  6. package/dist/DashboardGridLayout.d.ts +27 -0
  7. package/dist/DashboardGridLayout.d.ts.map +1 -1
  8. package/dist/DashboardRenderer.d.ts +46 -4
  9. package/dist/DashboardRenderer.d.ts.map +1 -1
  10. package/dist/DashboardWithConfig.d.ts.map +1 -1
  11. package/dist/DatasetWidget.d.ts +70 -6
  12. package/dist/DatasetWidget.d.ts.map +1 -1
  13. package/dist/MetricCard.d.ts +29 -10
  14. package/dist/MetricCard.d.ts.map +1 -1
  15. package/dist/MetricWidget.d.ts +82 -17
  16. package/dist/MetricWidget.d.ts.map +1 -1
  17. package/dist/ObjectDataTable.d.ts +68 -3
  18. package/dist/ObjectDataTable.d.ts.map +1 -1
  19. package/dist/ObjectMetricWidget.d.ts +41 -27
  20. package/dist/ObjectMetricWidget.d.ts.map +1 -1
  21. package/dist/ObjectPivotTable.d.ts.map +1 -1
  22. package/dist/PivotTable.d.ts.map +1 -1
  23. package/dist/RecordDetailDrawer.d.ts.map +1 -1
  24. package/dist/WidgetConfigPanel.d.ts +28 -0
  25. package/dist/WidgetConfigPanel.d.ts.map +1 -1
  26. package/dist/colorVariants.d.ts +56 -0
  27. package/dist/colorVariants.d.ts.map +1 -0
  28. package/dist/domPassthroughPins.d.ts +9 -0
  29. package/dist/domPassthroughPins.d.ts.map +1 -0
  30. package/dist/index.d.ts +16 -11
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2087 -1564
  33. package/dist/index.umd.cjs +2 -2
  34. package/dist/legacyRetiredWidget.d.ts +41 -0
  35. package/dist/legacyRetiredWidget.d.ts.map +1 -0
  36. package/dist/recordFields.d.ts +41 -2
  37. package/dist/recordFields.d.ts.map +1 -1
  38. package/dist/schemaHostProps.d.ts +80 -0
  39. package/dist/schemaHostProps.d.ts.map +1 -0
  40. package/dist/useConfigPanelTranslation.d.ts +35 -0
  41. package/dist/useConfigPanelTranslation.d.ts.map +1 -0
  42. package/dist/utils.d.ts +34 -0
  43. package/dist/utils.d.ts.map +1 -1
  44. package/package.json +14 -12
@@ -0,0 +1,80 @@
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 props `SchemaRenderer` hands a widget that are NOT DOM attributes
10
+ * (objectui#4357).
11
+ *
12
+ * A dashboard widget is two things at once: an SDUI block reached through
13
+ * `SchemaRenderer`, and a plain React component a host may render directly.
14
+ * The React half wants a `...props` spread onto its root element so callers can
15
+ * pass `aria-*`, `data-*`, `id`, `role`, `className`. The SDUI half means that
16
+ * spread also receives the node's own metadata — and React writes unknown
17
+ * lowercase attributes straight to the DOM, stringifying object values. That is
18
+ * how every KPI card ended up with `schema="[object Object]"`.
19
+ *
20
+ * MEASURED at the call site (`packages/react/src/SchemaRenderer.tsx`, the
21
+ * `React.createElement(Component, …)` block), one render carrying every SDUI key
22
+ * at once. What a widget receives, and the attribute each one emitted:
23
+ *
24
+ * | prop | emitted as | what it is |
25
+ * |-------------------|------------------------------|--------------------------------------|
26
+ * | `schema` | `schema="[object Object]"` | the node itself, injected EVERY render |
27
+ * | `events` | `events="[object Object]"` | SDUI action metadata (`onClick: […]`) |
28
+ * | `props` | `props="[object Object]"` | the props container — the renderer already spreads its CONTENTS separately, so the container is pure metadata |
29
+ * | `bind` | `bind="data.revenue"` | SDUI data-binding path |
30
+ * | `ariaLabel` | `arialabel="…"` | camelCase authored form; the renderer already emits the resolved `aria-label` |
31
+ * | `ariaDescribedBy` | `ariadescribedby="…"` | ditto for `aria-describedby` |
32
+ * | `dataSource` | `datasource="[object Object]"` | the injected data-source ADAPTER |
33
+ *
34
+ * `dataSource` is the one a schema-only measurement misses, and the only one
35
+ * that leaks on a *production* dashboard rather than an authored edge case.
36
+ * It does not come from the node: `SchemaRenderer` strips the schema's own
37
+ * `dataSource` BINDING by name (objectstack#5576) — this is the adapter object
38
+ * `DashboardRenderer` hands its `SchemaRenderer` call, which arrives through the
39
+ * renderer's trailing `...props` and lands on whatever the widget spreads onto.
40
+ * A dashboard rendered without a data source (every test fixture) leaves it
41
+ * `undefined` and nothing shows; a dashboard rendered with one — every live
42
+ * deployment — put `datasource="[object Object]"` on the card.
43
+ *
44
+ * The line this type draws is **"is the key an HTML attribute name"**. None of
45
+ * the seven is (the two dashed `aria-*` forms the renderer emits itself are, and
46
+ * they keep flowing). Everything that IS one stays in the spread and reaches the
47
+ * DOM exactly as before: `id`, `name`, `role`, `disabled`, `aria-*`, `data-*`,
48
+ * `className`. Removing the spread instead would have been the wrong fix — it is
49
+ * the component's only accessibility passthrough.
50
+ *
51
+ * The renderer strips its own schema metadata (`type` / `children` / `visible` /
52
+ * the schema's `dataSource` binding / …) before spreading, so those never
53
+ * arrive; this type covers only what survives that strip — including the
54
+ * adapter, which arrives by a different door. Declared here rather than in each component
55
+ * because two copies of one key list is how a list becomes two disagreeing
56
+ * lists — the same reason `colorVariants` was extracted. The pin that keeps the
57
+ * declaration honest for BOTH components is
58
+ * `__tests__/MetricWidget.domProps.test.tsx`.
59
+ */
60
+ export interface SchemaHostProps {
61
+ /** The widget's own schema node, injected by `SchemaRenderer` on every render. */
62
+ schema?: unknown;
63
+ /** SDUI data-binding path (`'user.address.city'`). */
64
+ bind?: unknown;
65
+ /** SDUI event handlers (`{ onClick: [ActionDef, …] }`) — data, not DOM. */
66
+ events?: unknown;
67
+ /** The schema's props container; its contents are spread separately. */
68
+ props?: unknown;
69
+ /** Authored camelCase ARIA; the renderer emits the resolved `aria-label`. */
70
+ ariaLabel?: unknown;
71
+ /** Authored camelCase ARIA; the renderer emits `aria-describedby`. */
72
+ ariaDescribedBy?: unknown;
73
+ /**
74
+ * The injected data-source adapter, forwarded by `DashboardRenderer` through
75
+ * `SchemaRenderer`'s trailing props. Neither metric component reads it — the
76
+ * async, object-aware KPI is `ObjectMetricWidget`.
77
+ */
78
+ dataSource?: unknown;
79
+ }
80
+ //# sourceMappingURL=schemaHostProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaHostProps.d.ts","sourceRoot":"","sources":["../src/schemaHostProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;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"}
@@ -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"}
package/dist/utils.d.ts CHANGED
@@ -12,6 +12,40 @@ export declare function isObjectProvider(widgetData: unknown): widgetData is {
12
12
  aggregate?: any;
13
13
  filter?: any;
14
14
  };
15
+ /**
16
+ * A record key → a human column header: `unit_price` / `unitPrice` → "Unit Price".
17
+ *
18
+ * Single home for the convention, because both halves of the `table` widget
19
+ * family need it and they must agree: the object-bound path normalizes an
20
+ * author's `string[]` shorthand with it (`normalizeColumns`), and the static
21
+ * path derives headers with it when no columns were declared at all.
22
+ */
23
+ export declare function humanizeFieldKey(key: string): string;
24
+ /**
25
+ * Columns for a STATIC (inline `options.data`) table widget whose author
26
+ * declared none — objectui#4618.
27
+ *
28
+ * `DataTableSchema.columns` is a REQUIRED key (`@object-ui/types`
29
+ * `data-display.ts`), and a `data-table` handed rows but no columns draws one
30
+ * empty `tr` per row: no `th`, no `td`, nothing readable. Both dashboard
31
+ * surfaces built exactly that node whenever the widget carried only
32
+ * `options.data`, so a documented authoring surface rendered a silent blank.
33
+ *
34
+ * The object-bound half of the same widget family has always derived columns
35
+ * from the fetched rows when none were declared (`ObjectDataTable`), so this is
36
+ * that behaviour reaching the static half — not a new capability. Keys come
37
+ * from the FIRST row for the same reason it does there: the first record is the
38
+ * shape the author is describing, and scanning every row would let one ragged
39
+ * record widen the table.
40
+ *
41
+ * `_`-prefixed keys are internal bookkeeping and stay out. Non-record rows
42
+ * (strings, numbers, arrays) have no keys to name, so they derive nothing and
43
+ * the table renders its own empty state rather than a header row of noise.
44
+ */
45
+ export declare function deriveStaticTableColumns(rows: unknown): Array<{
46
+ header: string;
47
+ accessorKey: string;
48
+ }>;
15
49
  export { resolveDateMacros, resolveFilterPlaceholders } from '@object-ui/core';
16
50
  export { shiftFilterByCompareTo, compareToTrendLabelKey, type CompareToConfig, } from '@object-ui/core';
17
51
  /**
@@ -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;AAUD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,iBA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,SAAS,GAClC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,IAAI,CAkBhE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-dashboard",
3
- "version": "17.3.0",
3
+ "version": "17.6.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Dashboard plugin for Object UI",
@@ -19,16 +19,16 @@
19
19
  "@dnd-kit/sortable": "^10.0.0",
20
20
  "@dnd-kit/utilities": "^3.2.2",
21
21
  "clsx": "^2.1.1",
22
- "lucide-react": "^1.28.0",
22
+ "lucide-react": "^1.31.0",
23
23
  "react": "19.2.8",
24
24
  "react-dom": "19.2.8",
25
25
  "tailwind-merge": "^3.6.0",
26
- "@object-ui/components": "17.3.0",
27
- "@object-ui/core": "17.3.0",
28
- "@object-ui/fields": "17.3.0",
29
- "@object-ui/i18n": "17.3.0",
30
- "@object-ui/react": "17.3.0",
31
- "@object-ui/types": "17.3.0"
26
+ "@object-ui/components": "17.6.0",
27
+ "@object-ui/core": "17.6.0",
28
+ "@object-ui/fields": "17.6.0",
29
+ "@object-ui/i18n": "17.6.0",
30
+ "@object-ui/react": "17.6.0",
31
+ "@object-ui/types": "17.6.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": "^18.0.0 || ^19.0.0",
@@ -36,13 +36,15 @@
36
36
  "react-grid-layout": "^2.2.0 || ^1.4.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@objectstack/spec": "^17.0.0-rc.2",
39
+ "@objectstack/spec": "^17.0.0",
40
40
  "@types/react-grid-layout": "^2.1.0",
41
41
  "@vitejs/plugin-react": "^6.0.5",
42
42
  "react-grid-layout": "^2.2.4",
43
43
  "typescript": "^6.0.3",
44
- "vite": "^8.2.0",
45
- "vite-plugin-dts": "^5.0.3"
44
+ "vite": "^8.2.1",
45
+ "vite-plugin-dts": "^5.0.3",
46
+ "@object-ui/plugin-charts": "17.6.0",
47
+ "@object-ui/sdui-parser": "17.6.0"
46
48
  },
47
49
  "keywords": [
48
50
  "objectui",
@@ -79,7 +81,7 @@
79
81
  ],
80
82
  "scripts": {
81
83
  "build": "vite build",
82
- "type-check": "tsc --noEmit",
84
+ "type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
83
85
  "test": "vitest run",
84
86
  "lint": "eslint ."
85
87
  }