@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.
Files changed (47) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +21 -1
  3. package/dist/index.js +869 -787
  4. package/dist/index.umd.cjs +4 -4
  5. package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts +5 -0
  6. package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
  7. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts +4 -1
  8. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +1 -1
  9. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts +2 -0
  10. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +1 -1
  11. package/dist/packages/plugin-dashboard/src/index.d.ts +1 -1
  12. package/package.json +40 -7
  13. package/.turbo/turbo-build.log +0 -41
  14. package/src/DashboardConfigPanel.stories.tsx +0 -164
  15. package/src/DashboardConfigPanel.tsx +0 -158
  16. package/src/DashboardGridLayout.tsx +0 -367
  17. package/src/DashboardRenderer.stories.tsx +0 -173
  18. package/src/DashboardRenderer.tsx +0 -479
  19. package/src/DashboardWithConfig.tsx +0 -211
  20. package/src/MetricCard.tsx +0 -102
  21. package/src/MetricWidget.tsx +0 -96
  22. package/src/ObjectDataTable.tsx +0 -226
  23. package/src/ObjectMetricWidget.tsx +0 -159
  24. package/src/ObjectPivotTable.tsx +0 -160
  25. package/src/PivotTable.tsx +0 -262
  26. package/src/WidgetConfigPanel.tsx +0 -540
  27. package/src/__tests__/DashboardConfigPanel.test.tsx +0 -206
  28. package/src/__tests__/DashboardGridLayout.test.tsx +0 -199
  29. package/src/__tests__/DashboardRenderer.autoRefresh.test.tsx +0 -124
  30. package/src/__tests__/DashboardRenderer.designMode.test.tsx +0 -386
  31. package/src/__tests__/DashboardRenderer.header.test.tsx +0 -114
  32. package/src/__tests__/DashboardRenderer.mobile.test.tsx +0 -214
  33. package/src/__tests__/DashboardRenderer.widgetData.test.tsx +0 -1411
  34. package/src/__tests__/DashboardWithConfig.test.tsx +0 -276
  35. package/src/__tests__/MetricCard.test.tsx +0 -107
  36. package/src/__tests__/ObjectDataTable.test.tsx +0 -211
  37. package/src/__tests__/ObjectMetricWidget.test.tsx +0 -196
  38. package/src/__tests__/ObjectPivotTable.test.tsx +0 -192
  39. package/src/__tests__/PivotTable.test.tsx +0 -162
  40. package/src/__tests__/WidgetConfigPanel.test.tsx +0 -492
  41. package/src/__tests__/ensureWidgetIds.test.tsx +0 -103
  42. package/src/index.tsx +0 -236
  43. package/src/utils.ts +0 -17
  44. package/tsconfig.json +0 -19
  45. package/vite.config.ts +0 -64
  46. package/vitest.config.ts +0 -9
  47. package/vitest.setup.tsx +0 -18
package/src/index.tsx DELETED
@@ -1,236 +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 { ComponentRegistry } from '@object-ui/core';
10
- import { DashboardRenderer } from './DashboardRenderer';
11
- import { DashboardGridLayout } from './DashboardGridLayout';
12
- import { MetricWidget } from './MetricWidget';
13
- import { MetricCard } from './MetricCard';
14
- import { ObjectMetricWidget } from './ObjectMetricWidget';
15
- import { PivotTable } from './PivotTable';
16
- import { ObjectPivotTable } from './ObjectPivotTable';
17
- import { ObjectDataTable } from './ObjectDataTable';
18
- import { DashboardConfigPanel } from './DashboardConfigPanel';
19
- import { WidgetConfigPanel } from './WidgetConfigPanel';
20
- import { DashboardWithConfig } from './DashboardWithConfig';
21
-
22
- export { DashboardRenderer, DashboardGridLayout, MetricWidget, MetricCard, ObjectMetricWidget, PivotTable, ObjectPivotTable, ObjectDataTable, DashboardConfigPanel, WidgetConfigPanel, DashboardWithConfig };
23
-
24
- // Register dashboard component
25
- ComponentRegistry.register(
26
- 'dashboard',
27
- DashboardRenderer,
28
- {
29
- namespace: 'view',
30
- label: 'Dashboard',
31
- category: 'Complex',
32
- icon: 'layout-dashboard',
33
- inputs: [
34
- { name: 'columns', type: 'number', label: 'Columns', defaultValue: 3 },
35
- { name: 'gap', type: 'number', label: 'Gap', defaultValue: 4 },
36
- { name: 'className', type: 'string', label: 'CSS Class' }
37
- ],
38
- defaultProps: {
39
- columns: 3,
40
- widgets: []
41
- }
42
- }
43
- );
44
-
45
- // Register metric widget (legacy)
46
- ComponentRegistry.register(
47
- 'metric',
48
- MetricWidget,
49
- {
50
- namespace: 'plugin-dashboard',
51
- label: 'Metric Widget',
52
- category: 'Dashboard',
53
- inputs: [
54
- { name: 'label', type: 'string', label: 'Label' },
55
- { name: 'value', type: 'string', label: 'Value' },
56
- ]
57
- }
58
- );
59
-
60
- // Register metric card (new standalone component)
61
- ComponentRegistry.register(
62
- 'metric-card',
63
- MetricCard,
64
- {
65
- namespace: 'plugin-dashboard',
66
- label: 'Metric Card',
67
- category: 'Dashboard',
68
- inputs: [
69
- { name: 'title', type: 'string', label: 'Title' },
70
- { name: 'value', type: 'string', label: 'Value', required: true },
71
- { name: 'icon', type: 'string', label: 'Icon (Lucide name)' },
72
- { name: 'trend', type: 'enum', label: 'Trend', enum: [
73
- { label: 'Up', value: 'up' },
74
- { label: 'Down', value: 'down' },
75
- { label: 'Neutral', value: 'neutral' }
76
- ]},
77
- { name: 'trendValue', type: 'string', label: 'Trend Value (e.g., +12%)' },
78
- { name: 'description', type: 'string', label: 'Description' },
79
- ],
80
- defaultProps: {
81
- title: 'Metric',
82
- value: '0'
83
- }
84
- }
85
- );
86
-
87
- // Register object-aware metric widget (async data loading with error states)
88
- ComponentRegistry.register(
89
- 'object-metric',
90
- ObjectMetricWidget,
91
- {
92
- namespace: 'plugin-dashboard',
93
- label: 'Object Metric',
94
- category: 'Dashboard',
95
- inputs: [
96
- { name: 'objectName', type: 'string', label: 'Object Name', required: true },
97
- { name: 'label', type: 'string', label: 'Label' },
98
- { name: 'aggregate', type: 'object', label: 'Aggregate', description: 'Aggregation config: { field, function, groupBy }' },
99
- { name: 'icon', type: 'string', label: 'Icon (Lucide name)' },
100
- ],
101
- defaultProps: {
102
- label: 'Metric',
103
- }
104
- }
105
- );
106
-
107
- // Register pivot table component
108
- ComponentRegistry.register(
109
- 'pivot',
110
- PivotTable,
111
- {
112
- namespace: 'plugin-dashboard',
113
- label: 'Pivot Table',
114
- category: 'Dashboard',
115
- icon: 'table-2',
116
- inputs: [
117
- { name: 'title', type: 'string', label: 'Title' },
118
- { name: 'rowField', type: 'string', label: 'Row Field', required: true },
119
- { name: 'columnField', type: 'string', label: 'Column Field', required: true },
120
- { name: 'valueField', type: 'string', label: 'Value Field', required: true },
121
- { name: 'aggregation', type: 'enum', label: 'Aggregation', enum: [
122
- { label: 'Sum', value: 'sum' },
123
- { label: 'Count', value: 'count' },
124
- { label: 'Average', value: 'avg' },
125
- { label: 'Min', value: 'min' },
126
- { label: 'Max', value: 'max' },
127
- ]},
128
- { name: 'showRowTotals', type: 'boolean', label: 'Show Row Totals' },
129
- { name: 'showColumnTotals', type: 'boolean', label: 'Show Column Totals' },
130
- { name: 'format', type: 'string', label: 'Number Format' },
131
- ],
132
- defaultProps: {
133
- rowField: '',
134
- columnField: '',
135
- valueField: '',
136
- aggregation: 'sum',
137
- data: [],
138
- }
139
- }
140
- );
141
-
142
- // Register object-aware pivot table (async data loading)
143
- ComponentRegistry.register(
144
- 'object-pivot',
145
- ObjectPivotTable,
146
- {
147
- namespace: 'plugin-dashboard',
148
- label: 'Object Pivot Table',
149
- category: 'Dashboard',
150
- icon: 'table-2',
151
- inputs: [
152
- { name: 'objectName', type: 'string', label: 'Object Name', required: true },
153
- { name: 'title', type: 'string', label: 'Title' },
154
- { name: 'rowField', type: 'string', label: 'Row Field', required: true },
155
- { name: 'columnField', type: 'string', label: 'Column Field', required: true },
156
- { name: 'valueField', type: 'string', label: 'Value Field', required: true },
157
- { name: 'aggregation', type: 'enum', label: 'Aggregation', enum: [
158
- { label: 'Sum', value: 'sum' },
159
- { label: 'Count', value: 'count' },
160
- { label: 'Average', value: 'avg' },
161
- { label: 'Min', value: 'min' },
162
- { label: 'Max', value: 'max' },
163
- ]},
164
- { name: 'showRowTotals', type: 'boolean', label: 'Show Row Totals' },
165
- { name: 'showColumnTotals', type: 'boolean', label: 'Show Column Totals' },
166
- { name: 'filter', type: 'array', label: 'Filter' },
167
- { name: 'format', type: 'string', label: 'Number Format' },
168
- ],
169
- defaultProps: {
170
- rowField: '',
171
- columnField: '',
172
- valueField: '',
173
- aggregation: 'sum',
174
- }
175
- }
176
- );
177
-
178
- // Register dashboard grid layout component
179
- ComponentRegistry.register(
180
- 'dashboard-grid',
181
- DashboardGridLayout,
182
- {
183
- namespace: 'plugin-dashboard',
184
- label: 'Dashboard Grid (Editable)',
185
- category: 'Complex',
186
- icon: 'layout-grid',
187
- inputs: [
188
- { name: 'title', type: 'string', label: 'Title' },
189
- { name: 'persistLayoutKey', type: 'string', label: 'Layout Storage Key', defaultValue: 'dashboard-layout' },
190
- { name: 'className', type: 'string', label: 'CSS Class' }
191
- ],
192
- defaultProps: {
193
- title: 'Dashboard',
194
- widgets: [],
195
- persistLayoutKey: 'dashboard-layout',
196
- }
197
- }
198
- );
199
-
200
- // Register object-aware data table (async data loading)
201
- ComponentRegistry.register(
202
- 'object-data-table',
203
- ObjectDataTable,
204
- {
205
- namespace: 'plugin-dashboard',
206
- label: 'Object Data Table',
207
- category: 'Dashboard',
208
- icon: 'table',
209
- inputs: [
210
- { name: 'objectName', type: 'string', label: 'Object Name', required: true },
211
- { name: 'columns', type: 'array', label: 'Columns' },
212
- { name: 'filter', type: 'array', label: 'Filter' },
213
- { name: 'searchable', type: 'boolean', label: 'Searchable' },
214
- { name: 'pagination', type: 'boolean', label: 'Pagination' },
215
- ],
216
- defaultProps: {
217
- searchable: false,
218
- pagination: false,
219
- }
220
- }
221
- );
222
-
223
- // Standard Export Protocol - for manual integration
224
- export const dashboardComponents = {
225
- DashboardRenderer,
226
- DashboardGridLayout,
227
- MetricWidget,
228
- MetricCard,
229
- ObjectMetricWidget,
230
- PivotTable,
231
- ObjectPivotTable,
232
- ObjectDataTable,
233
- DashboardConfigPanel,
234
- WidgetConfigPanel,
235
- DashboardWithConfig,
236
- };
package/src/utils.ts DELETED
@@ -1,17 +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
- /** Returns true when the widget data config uses provider: 'object' (async data source). */
10
- export function isObjectProvider(widgetData: unknown): widgetData is { provider: 'object'; object?: string; aggregate?: any; filter?: any } {
11
- return (
12
- widgetData != null &&
13
- typeof widgetData === 'object' &&
14
- !Array.isArray(widgetData) &&
15
- (widgetData as any).provider === 'object'
16
- );
17
- }
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "jsx": "react-jsx",
6
- "baseUrl": ".",
7
- "paths": {
8
- "@/*": ["src/*"]
9
- },
10
- // Removed explicit rootDir to prevent file not under rootDir errors when importing from workspace dependencies
11
- "noEmit": false,
12
- "declaration": true,
13
- "composite": true,
14
- "declarationMap": true,
15
- "skipLibCheck": true
16
- },
17
- "include": ["src"],
18
- "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
19
- }
package/vite.config.ts DELETED
@@ -1,64 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import react from '@vitejs/plugin-react';
3
- import dts from 'vite-plugin-dts';
4
- import { resolve } from 'path';
5
-
6
- export default defineConfig({
7
- plugins: [
8
- react(),
9
- dts({
10
- insertTypesEntry: true,
11
- compilerOptions: { rootDir: resolve(__dirname, '../..') },
12
- include: ['src'],
13
- exclude: ['**/*.test.ts', '**/*.test.tsx', 'node_modules'],
14
- skipDiagnostics: true,
15
- }),
16
- ],
17
- resolve: {
18
- alias: {
19
- '@': resolve(__dirname, './src'),
20
- '@object-ui/core': resolve(__dirname, '../core/src'),
21
- '@object-ui/types': resolve(__dirname, '../types/src'),
22
- '@object-ui/react': resolve(__dirname, '../react/src'),
23
- '@object-ui/components': resolve(__dirname, '../components/src'),
24
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
25
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
26
- },
27
- },
28
- build: {
29
- lib: {
30
- entry: resolve(__dirname, 'src/index.tsx'),
31
- name: 'ObjectUIPluginDashboard',
32
- fileName: 'index',
33
- },
34
- rollupOptions: {
35
- external: [
36
- 'react',
37
- 'react-dom',
38
- '@object-ui/components',
39
- '@object-ui/core',
40
- '@object-ui/react',
41
- '@object-ui/types',
42
- 'tailwind-merge',
43
- 'clsx',
44
- 'lucide-react'
45
- ],
46
- output: {
47
- globals: {
48
- react: 'React',
49
- 'react-dom': 'ReactDOM',
50
- '@object-ui/components': 'ObjectUIComponents',
51
- '@object-ui/core': 'ObjectUICore',
52
- '@object-ui/react': 'ObjectUIReact',
53
- '@object-ui/types': 'ObjectUITypes',
54
- },
55
- },
56
- },
57
- },
58
- test: {
59
- globals: true,
60
- environment: 'happy-dom',
61
- setupFiles: ['./vitest.setup.tsx'],
62
- passWithNoTests: true,
63
- },
64
- });
package/vitest.config.ts DELETED
@@ -1,9 +0,0 @@
1
- import { mergeConfig } from 'vitest/config';
2
- import rootConfig from '../../vitest.config.mts';
3
- import viteConfig from './vite.config';
4
-
5
- export default mergeConfig(rootConfig, mergeConfig(viteConfig, {
6
- test: {
7
- environment: 'jsdom',
8
- },
9
- }));
package/vitest.setup.tsx DELETED
@@ -1,18 +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 { expect, afterEach } from 'vitest';
10
- import { cleanup } from '@testing-library/react';
11
- import * as matchers from '@testing-library/jest-dom/matchers';
12
- import '@testing-library/jest-dom';
13
-
14
- expect.extend(matchers);
15
-
16
- afterEach(() => {
17
- cleanup();
18
- });