@object-ui/plugin-dashboard 3.3.0 → 3.3.1
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 +10 -0
- package/README.md +21 -1
- package/dist/index.js +869 -787
- package/dist/index.umd.cjs +4 -4
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts +5 -0
- package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts +4 -1
- package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts +2 -0
- package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +1 -1
- package/dist/packages/plugin-dashboard/src/index.d.ts +1 -1
- package/package.json +40 -7
- package/.turbo/turbo-build.log +0 -41
- package/src/DashboardConfigPanel.stories.tsx +0 -164
- package/src/DashboardConfigPanel.tsx +0 -158
- package/src/DashboardGridLayout.tsx +0 -367
- package/src/DashboardRenderer.stories.tsx +0 -173
- package/src/DashboardRenderer.tsx +0 -479
- package/src/DashboardWithConfig.tsx +0 -211
- package/src/MetricCard.tsx +0 -102
- package/src/MetricWidget.tsx +0 -96
- package/src/ObjectDataTable.tsx +0 -226
- package/src/ObjectMetricWidget.tsx +0 -159
- package/src/ObjectPivotTable.tsx +0 -160
- package/src/PivotTable.tsx +0 -262
- package/src/WidgetConfigPanel.tsx +0 -540
- package/src/__tests__/DashboardConfigPanel.test.tsx +0 -206
- package/src/__tests__/DashboardGridLayout.test.tsx +0 -199
- package/src/__tests__/DashboardRenderer.autoRefresh.test.tsx +0 -124
- package/src/__tests__/DashboardRenderer.designMode.test.tsx +0 -386
- package/src/__tests__/DashboardRenderer.header.test.tsx +0 -114
- package/src/__tests__/DashboardRenderer.mobile.test.tsx +0 -214
- package/src/__tests__/DashboardRenderer.widgetData.test.tsx +0 -1411
- package/src/__tests__/DashboardWithConfig.test.tsx +0 -276
- package/src/__tests__/MetricCard.test.tsx +0 -107
- package/src/__tests__/ObjectDataTable.test.tsx +0 -211
- package/src/__tests__/ObjectMetricWidget.test.tsx +0 -196
- package/src/__tests__/ObjectPivotTable.test.tsx +0 -192
- package/src/__tests__/PivotTable.test.tsx +0 -162
- package/src/__tests__/WidgetConfigPanel.test.tsx +0 -492
- package/src/__tests__/ensureWidgetIds.test.tsx +0 -103
- package/src/index.tsx +0 -236
- package/src/utils.ts +0 -17
- package/tsconfig.json +0 -19
- package/vite.config.ts +0 -64
- package/vitest.config.ts +0 -9
- package/vitest.setup.tsx +0 -18
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DashboardSchema } from '../../types/src';
|
|
2
|
+
import { ActionDef, ActionResult, ActionContext, ModalHandler } from '../../core/src';
|
|
2
3
|
export interface DashboardRendererProps {
|
|
3
4
|
schema: DashboardSchema;
|
|
4
5
|
className?: string;
|
|
@@ -18,6 +19,10 @@ export interface DashboardRendererProps {
|
|
|
18
19
|
selectedWidgetId?: string | null;
|
|
19
20
|
/** Callback when a widget is clicked in design mode */
|
|
20
21
|
onWidgetClick?: (widgetId: string | null) => void;
|
|
22
|
+
/** Optional handler for actionType="modal" header actions. Receives a schema and ActionContext. */
|
|
23
|
+
modalHandler?: ModalHandler;
|
|
24
|
+
/** Optional named handlers for actionType="script" header actions, keyed by action name (actionUrl). */
|
|
25
|
+
scriptHandlers?: Record<string, (action: ActionDef, context: ActionContext) => Promise<ActionResult> | ActionResult>;
|
|
21
26
|
[key: string]: any;
|
|
22
27
|
}
|
|
23
28
|
export declare const DashboardRenderer: import('react').ForwardRefExoticComponent<Omit<DashboardRendererProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardRenderer.d.ts","sourceRoot":"","sources":["../../../../src/DashboardRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,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default as React } from 'react';
|
|
2
|
+
export type MetricColorVariant = 'default' | 'blue' | 'teal' | 'orange' | 'purple' | 'success' | 'warning' | 'danger';
|
|
2
3
|
export interface MetricWidgetProps {
|
|
3
4
|
label: string | {
|
|
4
5
|
key?: string;
|
|
@@ -23,6 +24,8 @@ export interface MetricWidgetProps {
|
|
|
23
24
|
loading?: boolean;
|
|
24
25
|
/** Error message from a failed data fetch. When set, the widget shows an error state. */
|
|
25
26
|
error?: string | null;
|
|
27
|
+
/** Visual color variant — tints the icon container while keeping the card neutral. */
|
|
28
|
+
colorVariant?: MetricColorVariant;
|
|
26
29
|
}
|
|
27
|
-
export declare const MetricWidget: ({ label, value, trend, icon, className, description, loading, error, ...props }: MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, ...props }: MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
31
|
//# sourceMappingURL=MetricWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../../../../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAavC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,IAAI,CAAC,EAAE,KAAK,CAA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,CAAC,EAAE,OAAO,CAAC;IAClB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,sFAAsF;IACtF,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC;AAED,eAAO,MAAM,YAAY,GAAI,+FAW1B,iBAAiB,4CAkEnB,CAAC"}
|
|
@@ -52,6 +52,8 @@ export interface ObjectMetricWidgetProps {
|
|
|
52
52
|
};
|
|
53
53
|
/** External data source (overrides context) */
|
|
54
54
|
dataSource?: any;
|
|
55
|
+
/** Visual color variant for the icon container */
|
|
56
|
+
colorVariant?: 'default' | 'blue' | 'teal' | 'orange' | 'purple' | 'success' | 'warning' | 'danger';
|
|
55
57
|
}
|
|
56
58
|
export declare const ObjectMetricWidget: React.FC<ObjectMetricWidgetProps>;
|
|
57
59
|
//# sourceMappingURL=ObjectMetricWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectMetricWidget.d.ts","sourceRoot":"","sources":["../../../../src/ObjectMetricWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAuD,MAAM,OAAO,CAAC;AAI5E;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,wBAAwB;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,iBAAiB;IACjB,KA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ACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,6BAA6B;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,+CAA+C;IAC/C,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;CACrG;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA0GhE,CAAC"}
|
|
@@ -13,7 +13,7 @@ export { DashboardRenderer, DashboardGridLayout, MetricWidget, MetricCard, Objec
|
|
|
13
13
|
export declare const dashboardComponents: {
|
|
14
14
|
DashboardRenderer: import('react').ForwardRefExoticComponent<Omit<import('./DashboardRenderer').DashboardRendererProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
15
15
|
DashboardGridLayout: import('react').FC<import('./DashboardGridLayout').DashboardGridLayoutProps>;
|
|
16
|
-
MetricWidget: ({ label, value, trend, icon, className, description, loading, error, ...props }: import('./MetricWidget').MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, ...props }: import('./MetricWidget').MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
MetricCard: import('react').FC<import('./MetricCard').MetricCardProps>;
|
|
18
18
|
ObjectMetricWidget: import('react').FC<import('./ObjectMetricWidget').ObjectMetricWidgetProps>;
|
|
19
19
|
PivotTable: import('react').FC<import('./PivotTable').PivotTableProps>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-dashboard",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Dashboard plugin for Object UI",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"react-dom": "19.2.5",
|
|
22
22
|
"react-grid-layout": "^2.2.3",
|
|
23
23
|
"tailwind-merge": "^3.5.0",
|
|
24
|
-
"@object-ui/components": "3.3.
|
|
25
|
-
"@object-ui/core": "3.3.
|
|
26
|
-
"@object-ui/react": "3.3.
|
|
27
|
-
"@object-ui/types": "3.3.
|
|
24
|
+
"@object-ui/components": "3.3.1",
|
|
25
|
+
"@object-ui/core": "3.3.1",
|
|
26
|
+
"@object-ui/react": "3.3.1",
|
|
27
|
+
"@object-ui/types": "3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^18.0.0",
|
|
@@ -33,10 +33,43 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/react-grid-layout": "^2.1.0",
|
|
35
35
|
"@vitejs/plugin-react": "^6.0.1",
|
|
36
|
-
"typescript": "^6.0.
|
|
37
|
-
"vite": "^8.0.
|
|
36
|
+
"typescript": "^6.0.3",
|
|
37
|
+
"vite": "^8.0.9",
|
|
38
38
|
"vite-plugin-dts": "^4.5.4"
|
|
39
39
|
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"objectui",
|
|
42
|
+
"sdui",
|
|
43
|
+
"schema-driven-ui",
|
|
44
|
+
"react",
|
|
45
|
+
"tailwind",
|
|
46
|
+
"shadcn",
|
|
47
|
+
"objectstack",
|
|
48
|
+
"plugin",
|
|
49
|
+
"dashboard",
|
|
50
|
+
"bi",
|
|
51
|
+
"widgets",
|
|
52
|
+
"grid-layout"
|
|
53
|
+
],
|
|
54
|
+
"author": "ObjectStack Team <team@objectstack.ai>",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/objectstack-ai/objectui.git",
|
|
58
|
+
"directory": "packages/plugin-dashboard"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/objectstack-ai/objectui/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://www.objectui.org/docs/plugins/plugin-dashboard",
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"dist",
|
|
69
|
+
"README.md",
|
|
70
|
+
"CHANGELOG.md",
|
|
71
|
+
"LICENSE"
|
|
72
|
+
],
|
|
40
73
|
"scripts": {
|
|
41
74
|
"build": "vite build",
|
|
42
75
|
"test": "vitest run",
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @object-ui/plugin-dashboard@3.3.0 build /home/runner/work/objectui/objectui/packages/plugin-dashboard
|
|
3
|
-
> vite build
|
|
4
|
-
|
|
5
|
-
[36mvite v8.0.8 [32mbuilding client environment for production...[36m[39m
|
|
6
|
-
[2K
|
|
7
|
-
rendering chunks...
|
|
8
|
-
[32m
|
|
9
|
-
[96msrc/DashboardGridLayout.tsx[0m:[93m3[0m:[93m8[0m - [91merror[0m[90m TS2882: [0mCannot find module or type declarations for side-effect import of 'react-grid-layout/css/styles.css'.
|
|
10
|
-
|
|
11
|
-
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
12
|
-
[7m3[0m import 'react-grid-layout/css/styles.css';
|
|
13
|
-
[7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
14
|
-
[96msrc/ObjectDataTable.tsx[0m:[93m47[0m:[93m3[0m - [91merror[0m[90m TS2322: [0mType 'Record<string, any>[]' is not assignable to type 'NormalizedColumn[]'.
|
|
15
|
-
Type 'Record<string, any>' is missing the following properties from type 'NormalizedColumn': header, accessorKey
|
|
16
|
-
|
|
17
|
-
[7m47[0m return columns.map((col) => {
|
|
18
|
-
[7m [0m [91m ~~~~~~[0m
|
|
19
|
-
|
|
20
|
-
[32m[36m[vite:dts][32m Declaration files built in 29662ms.
|
|
21
|
-
[39m
|
|
22
|
-
computing gzip size...
|
|
23
|
-
dist/index.css 2.32 kB │ gzip: 0.57 kB
|
|
24
|
-
dist/index.js 161.81 kB │ gzip: 39.97 kB
|
|
25
|
-
|
|
26
|
-
[33m[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugins. Here is a breakdown:
|
|
27
|
-
- vite:dts (93%)
|
|
28
|
-
- vite:css (7%)
|
|
29
|
-
See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
30
|
-
[39m
|
|
31
|
-
[2K
|
|
32
|
-
rendering chunks...
|
|
33
|
-
computing gzip size...
|
|
34
|
-
dist/index.css 2.32 kB │ gzip: 0.57 kB
|
|
35
|
-
dist/index.umd.cjs 121.27 kB │ gzip: 34.65 kB
|
|
36
|
-
|
|
37
|
-
[33m[33m[MISSING_GLOBAL_NAME] Warning:[0m No name was provided for external module "lucide-react" in "output.globals" – guessing "lucide_react".
|
|
38
|
-
[39m
|
|
39
|
-
[33m[33m[MISSING_GLOBAL_NAME] Warning:[0m No name was provided for external module "clsx" in "output.globals" – guessing "clsx".
|
|
40
|
-
[39m
|
|
41
|
-
[32m✓ built in 32.80s[39m
|
|
@@ -1,164 +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
|
-
import React, { useState } from 'react';
|
|
10
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
11
|
-
import { WidgetConfigPanel } from './WidgetConfigPanel';
|
|
12
|
-
import { DashboardWithConfig } from './DashboardWithConfig';
|
|
13
|
-
import type { DashboardSchema } from '@object-ui/types';
|
|
14
|
-
|
|
15
|
-
// ─── WidgetConfigPanel Stories ──────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
const widgetMeta = {
|
|
18
|
-
title: 'Plugins/DashboardConfigPanel',
|
|
19
|
-
parameters: {
|
|
20
|
-
layout: 'padded',
|
|
21
|
-
},
|
|
22
|
-
tags: ['autodocs'],
|
|
23
|
-
} satisfies Meta;
|
|
24
|
-
|
|
25
|
-
export default widgetMeta;
|
|
26
|
-
type Story = StoryObj<typeof widgetMeta>;
|
|
27
|
-
|
|
28
|
-
// --- WidgetConfigPanel ---
|
|
29
|
-
|
|
30
|
-
const widgetConfig = {
|
|
31
|
-
title: 'Revenue Chart',
|
|
32
|
-
description: 'Monthly revenue by region',
|
|
33
|
-
type: 'bar',
|
|
34
|
-
object: 'orders',
|
|
35
|
-
categoryField: 'region',
|
|
36
|
-
valueField: 'amount',
|
|
37
|
-
aggregate: 'sum',
|
|
38
|
-
colorVariant: 'blue',
|
|
39
|
-
actionUrl: '',
|
|
40
|
-
layoutW: 2,
|
|
41
|
-
layoutH: 1,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
function WidgetConfigStory() {
|
|
45
|
-
const [config, setConfig] = useState(widgetConfig);
|
|
46
|
-
return (
|
|
47
|
-
<div style={{ position: 'relative', height: 600, width: 320, border: '1px solid #e5e7eb', borderRadius: 8, overflow: 'hidden' }}>
|
|
48
|
-
<WidgetConfigPanel
|
|
49
|
-
open={true}
|
|
50
|
-
onClose={() => alert('Close clicked')}
|
|
51
|
-
config={config}
|
|
52
|
-
onSave={(newConfig) => {
|
|
53
|
-
setConfig(newConfig as typeof widgetConfig);
|
|
54
|
-
alert('Saved: ' + JSON.stringify(newConfig, null, 2));
|
|
55
|
-
}}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const WidgetConfig: Story = {
|
|
62
|
-
render: () => <WidgetConfigStory />,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// --- DashboardWithConfig ---
|
|
66
|
-
|
|
67
|
-
const dashboardSchema: DashboardSchema = {
|
|
68
|
-
type: 'dashboard',
|
|
69
|
-
title: 'Sales Dashboard',
|
|
70
|
-
columns: 3,
|
|
71
|
-
gap: 4,
|
|
72
|
-
widgets: [
|
|
73
|
-
{
|
|
74
|
-
id: 'mc-1',
|
|
75
|
-
component: {
|
|
76
|
-
type: 'metric-card',
|
|
77
|
-
title: 'Total Revenue',
|
|
78
|
-
value: '$128,430',
|
|
79
|
-
icon: 'DollarSign',
|
|
80
|
-
trend: 'up',
|
|
81
|
-
trendValue: '+14.2%',
|
|
82
|
-
},
|
|
83
|
-
layout: { x: 0, y: 0, w: 1, h: 1 },
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: 'mc-2',
|
|
87
|
-
component: {
|
|
88
|
-
type: 'metric-card',
|
|
89
|
-
title: 'Active Users',
|
|
90
|
-
value: '3,842',
|
|
91
|
-
icon: 'Users',
|
|
92
|
-
trend: 'up',
|
|
93
|
-
trendValue: '+8.1%',
|
|
94
|
-
},
|
|
95
|
-
layout: { x: 1, y: 0, w: 1, h: 1 },
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: 'mc-3',
|
|
99
|
-
component: {
|
|
100
|
-
type: 'metric-card',
|
|
101
|
-
title: 'Churn Rate',
|
|
102
|
-
value: '1.8%',
|
|
103
|
-
icon: 'TrendingDown',
|
|
104
|
-
trend: 'down',
|
|
105
|
-
trendValue: '-0.3%',
|
|
106
|
-
},
|
|
107
|
-
layout: { x: 2, y: 0, w: 1, h: 1 },
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
header: {
|
|
111
|
-
showTitle: true,
|
|
112
|
-
showDescription: true,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const dashboardConfig = {
|
|
117
|
-
columns: 3,
|
|
118
|
-
gap: 4,
|
|
119
|
-
rowHeight: '120',
|
|
120
|
-
refreshInterval: '0',
|
|
121
|
-
title: 'Sales Dashboard',
|
|
122
|
-
showDescription: true,
|
|
123
|
-
theme: 'auto',
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
function DashboardWithConfigStory() {
|
|
127
|
-
const [config, setConfig] = useState(dashboardConfig);
|
|
128
|
-
return (
|
|
129
|
-
<div style={{ height: 600, width: '100%', border: '1px solid #e5e7eb', borderRadius: 8, overflow: 'hidden' }}>
|
|
130
|
-
<DashboardWithConfig
|
|
131
|
-
schema={dashboardSchema}
|
|
132
|
-
config={config}
|
|
133
|
-
onConfigSave={(newConfig) => {
|
|
134
|
-
setConfig(newConfig as typeof dashboardConfig);
|
|
135
|
-
}}
|
|
136
|
-
defaultConfigOpen={true}
|
|
137
|
-
/>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export const DashboardWithConfigPanel: Story = {
|
|
143
|
-
render: () => <DashboardWithConfigStory />,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
function DashboardWithConfigClosedStory() {
|
|
147
|
-
const [config, setConfig] = useState(dashboardConfig);
|
|
148
|
-
return (
|
|
149
|
-
<div style={{ height: 600, width: '100%', border: '1px solid #e5e7eb', borderRadius: 8, overflow: 'hidden' }}>
|
|
150
|
-
<DashboardWithConfig
|
|
151
|
-
schema={dashboardSchema}
|
|
152
|
-
config={config}
|
|
153
|
-
onConfigSave={(newConfig) => {
|
|
154
|
-
setConfig(newConfig as typeof dashboardConfig);
|
|
155
|
-
}}
|
|
156
|
-
defaultConfigOpen={false}
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export const DashboardWithConfigClosed: Story = {
|
|
163
|
-
render: () => <DashboardWithConfigClosedStory />,
|
|
164
|
-
};
|
|
@@ -1,158 +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
|
-
import * as React from 'react';
|
|
10
|
-
import {
|
|
11
|
-
ConfigPanelRenderer,
|
|
12
|
-
useConfigDraft,
|
|
13
|
-
} from '@object-ui/components';
|
|
14
|
-
import type { ConfigPanelSchema } from '@object-ui/components';
|
|
15
|
-
|
|
16
|
-
// ---------------------------------------------------------------------------
|
|
17
|
-
// Schema — describes the full DashboardConfigPanel structure
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
|
-
|
|
20
|
-
const dashboardSchema: ConfigPanelSchema = {
|
|
21
|
-
breadcrumb: ['Dashboard', 'Configuration'],
|
|
22
|
-
sections: [
|
|
23
|
-
{
|
|
24
|
-
key: 'layout',
|
|
25
|
-
title: 'Layout',
|
|
26
|
-
fields: [
|
|
27
|
-
{
|
|
28
|
-
key: 'columns',
|
|
29
|
-
label: 'Columns',
|
|
30
|
-
type: 'slider',
|
|
31
|
-
defaultValue: 3,
|
|
32
|
-
min: 1,
|
|
33
|
-
max: 12,
|
|
34
|
-
step: 1,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: 'gap',
|
|
38
|
-
label: 'Gap',
|
|
39
|
-
type: 'slider',
|
|
40
|
-
defaultValue: 4,
|
|
41
|
-
min: 0,
|
|
42
|
-
max: 16,
|
|
43
|
-
step: 1,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
key: 'rowHeight',
|
|
47
|
-
label: 'Row height',
|
|
48
|
-
type: 'input',
|
|
49
|
-
defaultValue: '120',
|
|
50
|
-
placeholder: 'e.g. 120',
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: 'data',
|
|
56
|
-
title: 'Data',
|
|
57
|
-
collapsible: true,
|
|
58
|
-
fields: [
|
|
59
|
-
{
|
|
60
|
-
key: 'refreshInterval',
|
|
61
|
-
label: 'Refresh interval',
|
|
62
|
-
type: 'select',
|
|
63
|
-
defaultValue: '0',
|
|
64
|
-
options: [
|
|
65
|
-
{ value: '0', label: 'Manual' },
|
|
66
|
-
{ value: '30', label: '30s' },
|
|
67
|
-
{ value: '60', label: '1 min' },
|
|
68
|
-
{ value: '300', label: '5 min' },
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
key: 'appearance',
|
|
75
|
-
title: 'Appearance',
|
|
76
|
-
collapsible: true,
|
|
77
|
-
defaultCollapsed: true,
|
|
78
|
-
fields: [
|
|
79
|
-
{
|
|
80
|
-
key: 'title',
|
|
81
|
-
label: 'Title',
|
|
82
|
-
type: 'input',
|
|
83
|
-
placeholder: 'Dashboard title',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
key: 'showDescription',
|
|
87
|
-
label: 'Show description',
|
|
88
|
-
type: 'switch',
|
|
89
|
-
defaultValue: true,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
key: 'theme',
|
|
93
|
-
label: 'Theme',
|
|
94
|
-
type: 'select',
|
|
95
|
-
defaultValue: 'auto',
|
|
96
|
-
options: [
|
|
97
|
-
{ value: 'light', label: 'Light' },
|
|
98
|
-
{ value: 'dark', label: 'Dark' },
|
|
99
|
-
{ value: 'auto', label: 'Auto' },
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// ---------------------------------------------------------------------------
|
|
108
|
-
// Props
|
|
109
|
-
// ---------------------------------------------------------------------------
|
|
110
|
-
|
|
111
|
-
export interface DashboardConfigPanelProps {
|
|
112
|
-
/** Whether the panel is open */
|
|
113
|
-
open: boolean;
|
|
114
|
-
/** Close handler */
|
|
115
|
-
onClose: () => void;
|
|
116
|
-
/** Initial / committed dashboard configuration */
|
|
117
|
-
config: Record<string, any>;
|
|
118
|
-
/** Persist the updated config */
|
|
119
|
-
onSave: (config: Record<string, any>) => void;
|
|
120
|
-
/** Optional live-update callback */
|
|
121
|
-
onFieldChange?: (field: string, value: any) => void;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// ---------------------------------------------------------------------------
|
|
125
|
-
// Component
|
|
126
|
-
// ---------------------------------------------------------------------------
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* DashboardConfigPanel — Schema-driven configuration panel for dashboards.
|
|
130
|
-
*
|
|
131
|
-
* Built entirely on the generic ConfigPanelRenderer + useConfigDraft,
|
|
132
|
-
* demonstrating that a full config panel can be expressed in ~60 lines
|
|
133
|
-
* of declarative schema rather than 1500+ lines of imperative code.
|
|
134
|
-
*/
|
|
135
|
-
export function DashboardConfigPanel({
|
|
136
|
-
open,
|
|
137
|
-
onClose,
|
|
138
|
-
config,
|
|
139
|
-
onSave,
|
|
140
|
-
onFieldChange,
|
|
141
|
-
}: DashboardConfigPanelProps) {
|
|
142
|
-
const { draft, isDirty, updateField, discard } = useConfigDraft(config, {
|
|
143
|
-
onUpdate: onFieldChange,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<ConfigPanelRenderer
|
|
148
|
-
open={open}
|
|
149
|
-
onClose={onClose}
|
|
150
|
-
schema={dashboardSchema}
|
|
151
|
-
draft={draft}
|
|
152
|
-
isDirty={isDirty}
|
|
153
|
-
onFieldChange={updateField}
|
|
154
|
-
onSave={() => onSave(draft)}
|
|
155
|
-
onDiscard={discard}
|
|
156
|
-
/>
|
|
157
|
-
);
|
|
158
|
-
}
|