@object-ui/plugin-aggrid 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 +12 -0
- package/README.md +20 -0
- package/dist/AddressField-CP-8JJvR.js +98 -0
- package/dist/{AgGridImpl-DBqxIsko.js → AgGridImpl-DJWnS8p3.js} +1 -1
- package/dist/AutoNumberField-DCL2eUJj.js +14 -0
- package/dist/{AvatarField-C5b9biGa.js → AvatarField-CpFxJRdO.js} +4 -3
- package/dist/{BooleanField-DRzAZhSq.js → BooleanField-Chphr8cB.js} +2 -1
- package/dist/CodeField-BWngVIw1.js +23 -0
- package/dist/ColorField-GygyYArR.js +38 -0
- package/dist/CurrencyField-O8Pn59RO.js +49 -0
- package/dist/DateField-u6U8wmvI.js +22 -0
- package/dist/DateTimeField-D1z1Ovvy.js +30 -0
- package/dist/EmailField-IOcDmGjJ.js +26 -0
- package/dist/FileField-D3mZIrJ1.js +158 -0
- package/dist/FormulaField-MuyWzQx0.js +17 -0
- package/dist/GeolocationField-BfhC7QLw.js +161 -0
- package/dist/GridField-gN34gk4b.js +49 -0
- package/dist/ImageField-BZfSFwmJ.js +75 -0
- package/dist/LocationField-B-zwfw3h.js +36 -0
- package/dist/{LookupField-DoOmbbZF.js → LookupField-Cms1Cu_l.js} +347 -349
- package/dist/{MasterDetailField-BnSPGAtS.js → MasterDetailField-DGUmvg2f.js} +5 -4
- package/dist/NumberField-BV5sKwZ7.js +27 -0
- package/dist/{ObjectAgGridImpl-DrI0aa8t.js → ObjectAgGridImpl-yiHlXYgp.js} +5804 -5804
- package/dist/ObjectField-DJ5s3ciA.js +50 -0
- package/dist/{PasswordField-k5JeKk9f.js → PasswordField-BJboeBJY.js} +3 -2
- package/dist/PercentField-DO3be_bL.js +61 -0
- package/dist/PhoneField-CT6XcO6O.js +26 -0
- package/dist/{QRCodeField-BIrSW1Zr.js → QRCodeField-COLyc5iQ.js} +31 -30
- package/dist/{RatingField-5iMhn2GL.js → RatingField-B2momIna.js} +3 -2
- package/dist/RichTextField-C7qzDPJy.js +33 -0
- package/dist/SelectField-oo6vnNhQ.js +36 -0
- package/dist/{SignatureField-BAMvNrE6.js → SignatureField-DUgoK09r.js} +3 -2
- package/dist/{SliderField-C9IhmjbF.js → SliderField-DrggtBSX.js} +2 -1
- package/dist/SummaryField-DuMsFoY5.js +22 -0
- package/dist/TextAreaField-CLzzmPce.js +37 -0
- package/dist/TextField-CZE7SzK4.js +30 -0
- package/dist/TimeField-Bha4cayv.js +22 -0
- package/dist/UrlField-Dff4WLlN.js +31 -0
- package/dist/UserField-eT5njHwQ.js +77 -0
- package/dist/VectorField-BHe8lDOH.js +34 -0
- package/dist/{image-DlUdeTgT.js → image-DmzU2ETO.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +77 -77
- package/dist/{jsx-runtime-CGDkM_Jn.js → jsx-runtime-CXSCp6pT.js} +30 -39
- package/dist/{plus-BwEV_Q5_.js → plus-bvZ2f9T_.js} +1 -1
- package/dist/rolldown-runtime-CkxV0rQ3.js +14 -0
- package/dist/{upload-DPiohvXv.js → upload-BdzwEMeV.js} +1 -1
- package/dist/{useFieldTranslation-C69OtouR.js → useFieldTranslation-CfXaJRC4.js} +2 -2
- package/dist/{x-BFq2GeQ5.js → x-98xe-fYG.js} +1 -1
- package/package.json +34 -11
- package/.turbo/turbo-build.log +0 -71
- package/OBJECT_AGGRID_CN.md +0 -483
- package/QUICKSTART.md +0 -186
- package/dist/AddressField-DKqaE9pD.js +0 -93
- package/dist/AutoNumberField-0RU2dNKe.js +0 -13
- package/dist/CodeField-RWhnDMyL.js +0 -22
- package/dist/ColorField-B-YAFXdz.js +0 -37
- package/dist/CurrencyField-Bu80a-sI.js +0 -51
- package/dist/DateField-CV-NpLbM.js +0 -21
- package/dist/DateTimeField--YTsgTjw.js +0 -32
- package/dist/EmailField-B-3fWJsH.js +0 -28
- package/dist/FileField-BcGMvBnI.js +0 -160
- package/dist/FormulaField-MQXJZOep.js +0 -13
- package/dist/GeolocationField-D3BrmwqV.js +0 -156
- package/dist/GridField-DHsGo9l2.js +0 -51
- package/dist/ImageField-BBqwJEkk.js +0 -77
- package/dist/LocationField-DSvhU9Dz.js +0 -35
- package/dist/LookupField-KfYQlgUd.js +0 -2
- package/dist/NumberField-Kz4_o5DE.js +0 -26
- package/dist/ObjectField-C1qkl6s4.js +0 -52
- package/dist/PercentField-Dmipqv0I.js +0 -63
- package/dist/PhoneField-Dn4h6V9H.js +0 -28
- package/dist/RichTextField-CN5BRd_7.js +0 -32
- package/dist/SelectField-Bjk_S2zT.js +0 -31
- package/dist/SelectField-CcWvzp9g.js +0 -2
- package/dist/SummaryField-R9RENAZv.js +0 -18
- package/dist/TextAreaField-BY63Nr6-.js +0 -36
- package/dist/TextField-SIw8aMzf.js +0 -29
- package/dist/TimeField-xxziHPjE.js +0 -21
- package/dist/UrlField-Ihk3_ff5.js +0 -33
- package/dist/UserField-BHl6mmIH.js +0 -79
- package/dist/VectorField-Ci167cxr.js +0 -35
- package/src/AgGridImpl.tsx +0 -405
- package/src/ObjectAgGridImpl.tsx +0 -509
- package/src/VirtualScrolling.ts +0 -74
- package/src/ag-grid.d.ts +0 -10
- package/src/field-renderers.test.tsx +0 -383
- package/src/field-renderers.tsx +0 -224
- package/src/index.test.ts +0 -139
- package/src/index.tsx +0 -514
- package/src/object-aggrid.test.ts +0 -99
- package/src/object-aggrid.types.ts +0 -123
- package/src/types.ts +0 -184
- package/tsconfig.json +0 -17
- package/vite.config.ts +0 -64
- /package/dist/{createLucideIcon-BjfZYZey.js → createLucideIcon-C_5JZ35b.js} +0 -0
package/src/index.test.ts
DELETED
|
@@ -1,139 +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 { describe, it, expect, beforeAll } from 'vitest';
|
|
10
|
-
import { ComponentRegistry } from '@object-ui/core';
|
|
11
|
-
|
|
12
|
-
describe('Plugin AgGrid', () => {
|
|
13
|
-
// Import all renderers to register them
|
|
14
|
-
beforeAll(async () => {
|
|
15
|
-
await import('./index');
|
|
16
|
-
}, 15000); // Increase timeout to 15 seconds for async import
|
|
17
|
-
|
|
18
|
-
describe('aggrid component', () => {
|
|
19
|
-
it('should be registered in ComponentRegistry', () => {
|
|
20
|
-
const aggridRenderer = ComponentRegistry.get('aggrid');
|
|
21
|
-
expect(aggridRenderer).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should have proper metadata', () => {
|
|
25
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
26
|
-
expect(config).toBeDefined();
|
|
27
|
-
expect(config?.label).toBe('AG Grid');
|
|
28
|
-
expect(config?.icon).toBe('Table');
|
|
29
|
-
expect(config?.category).toBe('plugin');
|
|
30
|
-
expect(config?.inputs).toBeDefined();
|
|
31
|
-
expect(config?.defaultProps).toBeDefined();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should have expected inputs', () => {
|
|
35
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
36
|
-
const inputNames = config?.inputs?.map((input: any) => input.name) || [];
|
|
37
|
-
|
|
38
|
-
// Original inputs
|
|
39
|
-
expect(inputNames).toContain('rowData');
|
|
40
|
-
expect(inputNames).toContain('columnDefs');
|
|
41
|
-
expect(inputNames).toContain('pagination');
|
|
42
|
-
expect(inputNames).toContain('paginationPageSize');
|
|
43
|
-
expect(inputNames).toContain('theme');
|
|
44
|
-
expect(inputNames).toContain('height');
|
|
45
|
-
expect(inputNames).toContain('rowSelection');
|
|
46
|
-
expect(inputNames).toContain('domLayout');
|
|
47
|
-
expect(inputNames).toContain('animateRows');
|
|
48
|
-
expect(inputNames).toContain('gridOptions');
|
|
49
|
-
expect(inputNames).toContain('className');
|
|
50
|
-
|
|
51
|
-
// New inputs for enterprise features
|
|
52
|
-
expect(inputNames).toContain('editable');
|
|
53
|
-
expect(inputNames).toContain('singleClickEdit');
|
|
54
|
-
expect(inputNames).toContain('exportConfig');
|
|
55
|
-
expect(inputNames).toContain('statusBar');
|
|
56
|
-
expect(inputNames).toContain('callbacks');
|
|
57
|
-
expect(inputNames).toContain('columnConfig');
|
|
58
|
-
expect(inputNames).toContain('enableRangeSelection');
|
|
59
|
-
expect(inputNames).toContain('enableCharts');
|
|
60
|
-
expect(inputNames).toContain('contextMenu');
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should have rowData and columnDefs as required inputs', () => {
|
|
64
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
65
|
-
const rowDataInput = config?.inputs?.find((input: any) => input.name === 'rowData');
|
|
66
|
-
const columnDefsInput = config?.inputs?.find((input: any) => input.name === 'columnDefs');
|
|
67
|
-
|
|
68
|
-
expect(rowDataInput).toBeDefined();
|
|
69
|
-
expect(rowDataInput?.required).toBe(true);
|
|
70
|
-
expect(rowDataInput?.type).toBe('array');
|
|
71
|
-
|
|
72
|
-
expect(columnDefsInput).toBeDefined();
|
|
73
|
-
expect(columnDefsInput?.required).toBe(true);
|
|
74
|
-
expect(columnDefsInput?.type).toBe('array');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should have theme as enum input', () => {
|
|
78
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
79
|
-
const themeInput = config?.inputs?.find((input: any) => input.name === 'theme');
|
|
80
|
-
|
|
81
|
-
expect(themeInput).toBeDefined();
|
|
82
|
-
expect(themeInput?.type).toBe('enum');
|
|
83
|
-
expect(themeInput?.enum).toBeDefined();
|
|
84
|
-
expect(Array.isArray(themeInput?.enum)).toBe(true);
|
|
85
|
-
|
|
86
|
-
const enumValues = themeInput?.enum?.map((e: any) => e.value) || [];
|
|
87
|
-
expect(enumValues).toContain('quartz');
|
|
88
|
-
expect(enumValues).toContain('alpine');
|
|
89
|
-
expect(enumValues).toContain('balham');
|
|
90
|
-
expect(enumValues).toContain('material');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should have sensible default props', () => {
|
|
94
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
95
|
-
const defaults = config?.defaultProps;
|
|
96
|
-
|
|
97
|
-
expect(defaults).toBeDefined();
|
|
98
|
-
expect(defaults?.pagination).toBe(true);
|
|
99
|
-
expect(defaults?.paginationPageSize).toBe(10);
|
|
100
|
-
expect(defaults?.theme).toBe('quartz');
|
|
101
|
-
expect(defaults?.height).toBe(500);
|
|
102
|
-
expect(defaults?.animateRows).toBe(true);
|
|
103
|
-
expect(defaults?.domLayout).toBe('normal');
|
|
104
|
-
expect(defaults?.rowData).toBeDefined();
|
|
105
|
-
expect(Array.isArray(defaults?.rowData)).toBe(true);
|
|
106
|
-
expect(defaults?.rowData.length).toBeGreaterThan(0);
|
|
107
|
-
expect(defaults?.columnDefs).toBeDefined();
|
|
108
|
-
expect(Array.isArray(defaults?.columnDefs)).toBe(true);
|
|
109
|
-
expect(defaults?.columnDefs.length).toBeGreaterThan(0);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('should have default columnDefs with proper structure', () => {
|
|
113
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
114
|
-
const defaults = config?.defaultProps;
|
|
115
|
-
const columnDefs = defaults?.columnDefs || [];
|
|
116
|
-
|
|
117
|
-
expect(columnDefs.length).toBeGreaterThan(0);
|
|
118
|
-
|
|
119
|
-
// Verify each column has required properties
|
|
120
|
-
columnDefs.forEach((col: any) => {
|
|
121
|
-
expect(col.field).toBeDefined();
|
|
122
|
-
expect(typeof col.field).toBe('string');
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('should have default rowData with proper structure', () => {
|
|
127
|
-
const config = ComponentRegistry.getConfig('aggrid');
|
|
128
|
-
const defaults = config?.defaultProps;
|
|
129
|
-
const rowData = defaults?.rowData || [];
|
|
130
|
-
|
|
131
|
-
expect(rowData.length).toBeGreaterThan(0);
|
|
132
|
-
|
|
133
|
-
// Verify first row has expected properties
|
|
134
|
-
const firstRow = rowData[0];
|
|
135
|
-
expect(firstRow).toBeDefined();
|
|
136
|
-
expect(typeof firstRow).toBe('object');
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
package/src/index.tsx
DELETED
|
@@ -1,514 +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, { Suspense } from 'react';
|
|
10
|
-
import { ComponentRegistry } from '@object-ui/core';
|
|
11
|
-
import { Skeleton } from '@object-ui/components';
|
|
12
|
-
|
|
13
|
-
// Import AG Grid CSS - These must be imported at the entry point for Next.js
|
|
14
|
-
// Importing them in the lazy-loaded component doesn't work properly
|
|
15
|
-
import 'ag-grid-community/styles/ag-grid.css';
|
|
16
|
-
import 'ag-grid-community/styles/ag-theme-quartz.css';
|
|
17
|
-
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|
18
|
-
import 'ag-grid-community/styles/ag-theme-balham.css';
|
|
19
|
-
import 'ag-grid-community/styles/ag-theme-material.css';
|
|
20
|
-
|
|
21
|
-
// Export types for external use
|
|
22
|
-
export type { AgGridSchema, SimpleColumnDef, AgGridCallbacks, ExportConfig, StatusBarConfig, ColumnConfig, ContextMenuConfig, TreeDataConfig, RowGroupingConfig, ExcelExportConfig } from './types';
|
|
23
|
-
export type { ObjectAgGridSchema } from './object-aggrid.types';
|
|
24
|
-
|
|
25
|
-
import type { AgGridCallbacks, ExportConfig, StatusBarConfig, ColumnConfig, ContextMenuConfig, TreeDataConfig, RowGroupingConfig, ExcelExportConfig } from './types';
|
|
26
|
-
import type { DataSource } from '@object-ui/types';
|
|
27
|
-
|
|
28
|
-
// 🚀 Lazy load the implementation file
|
|
29
|
-
// This ensures AG Grid is only loaded when the component is actually rendered
|
|
30
|
-
const LazyAgGrid = React.lazy(() => import('./AgGridImpl'));
|
|
31
|
-
const LazyObjectAgGrid = React.lazy(() => import('./ObjectAgGridImpl'));
|
|
32
|
-
|
|
33
|
-
export interface AgGridRendererProps {
|
|
34
|
-
schema: {
|
|
35
|
-
type: string;
|
|
36
|
-
id?: string;
|
|
37
|
-
className?: string;
|
|
38
|
-
rowData?: any[];
|
|
39
|
-
columnDefs?: any[];
|
|
40
|
-
gridOptions?: any;
|
|
41
|
-
pagination?: boolean;
|
|
42
|
-
paginationPageSize?: number;
|
|
43
|
-
domLayout?: 'normal' | 'autoHeight' | 'print';
|
|
44
|
-
animateRows?: boolean;
|
|
45
|
-
rowSelection?: 'single' | 'multiple';
|
|
46
|
-
theme?: 'alpine' | 'balham' | 'material' | 'quartz';
|
|
47
|
-
height?: number | string;
|
|
48
|
-
editable?: boolean;
|
|
49
|
-
editType?: 'fullRow';
|
|
50
|
-
singleClickEdit?: boolean;
|
|
51
|
-
stopEditingWhenCellsLoseFocus?: boolean;
|
|
52
|
-
exportConfig?: ExportConfig;
|
|
53
|
-
statusBar?: StatusBarConfig;
|
|
54
|
-
callbacks?: AgGridCallbacks;
|
|
55
|
-
columnConfig?: ColumnConfig;
|
|
56
|
-
enableRangeSelection?: boolean;
|
|
57
|
-
enableCharts?: boolean;
|
|
58
|
-
contextMenu?: ContextMenuConfig;
|
|
59
|
-
treeData?: TreeDataConfig;
|
|
60
|
-
rowGrouping?: RowGroupingConfig;
|
|
61
|
-
excelExport?: ExcelExportConfig;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* AgGridRenderer - The public API for the AG Grid component
|
|
67
|
-
* This wrapper handles lazy loading internally using React.Suspense
|
|
68
|
-
*/
|
|
69
|
-
export const AgGridRenderer: React.FC<AgGridRendererProps> = ({ schema }) => {
|
|
70
|
-
return (
|
|
71
|
-
<Suspense fallback={<Skeleton className="w-full h-[500px]" />}>
|
|
72
|
-
<LazyAgGrid
|
|
73
|
-
rowData={schema.rowData}
|
|
74
|
-
columnDefs={schema.columnDefs}
|
|
75
|
-
gridOptions={schema.gridOptions}
|
|
76
|
-
pagination={schema.pagination}
|
|
77
|
-
paginationPageSize={schema.paginationPageSize}
|
|
78
|
-
domLayout={schema.domLayout}
|
|
79
|
-
animateRows={schema.animateRows}
|
|
80
|
-
rowSelection={schema.rowSelection}
|
|
81
|
-
theme={schema.theme}
|
|
82
|
-
height={schema.height}
|
|
83
|
-
className={schema.className}
|
|
84
|
-
editable={schema.editable}
|
|
85
|
-
editType={schema.editType}
|
|
86
|
-
singleClickEdit={schema.singleClickEdit}
|
|
87
|
-
stopEditingWhenCellsLoseFocus={schema.stopEditingWhenCellsLoseFocus}
|
|
88
|
-
exportConfig={schema.exportConfig}
|
|
89
|
-
statusBar={schema.statusBar}
|
|
90
|
-
callbacks={schema.callbacks}
|
|
91
|
-
columnConfig={schema.columnConfig}
|
|
92
|
-
enableRangeSelection={schema.enableRangeSelection}
|
|
93
|
-
enableCharts={schema.enableCharts}
|
|
94
|
-
contextMenu={schema.contextMenu}
|
|
95
|
-
treeData={schema.treeData}
|
|
96
|
-
rowGrouping={schema.rowGrouping}
|
|
97
|
-
excelExport={schema.excelExport}
|
|
98
|
-
/>
|
|
99
|
-
</Suspense>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// Register the component with the ComponentRegistry
|
|
104
|
-
ComponentRegistry.register(
|
|
105
|
-
'aggrid',
|
|
106
|
-
AgGridRenderer,
|
|
107
|
-
{
|
|
108
|
-
namespace: 'plugin-aggrid',
|
|
109
|
-
label: 'AG Grid',
|
|
110
|
-
icon: 'Table',
|
|
111
|
-
category: 'plugin',
|
|
112
|
-
inputs: [
|
|
113
|
-
{
|
|
114
|
-
name: 'rowData',
|
|
115
|
-
type: 'array',
|
|
116
|
-
label: 'Row Data',
|
|
117
|
-
description: 'Array of objects to display in the grid',
|
|
118
|
-
required: true
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'columnDefs',
|
|
122
|
-
type: 'array',
|
|
123
|
-
label: 'Column Definitions',
|
|
124
|
-
description: 'Array of column definitions',
|
|
125
|
-
required: true
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'pagination',
|
|
129
|
-
type: 'boolean',
|
|
130
|
-
label: 'Enable Pagination',
|
|
131
|
-
defaultValue: false
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: 'paginationPageSize',
|
|
135
|
-
type: 'number',
|
|
136
|
-
label: 'Page Size',
|
|
137
|
-
defaultValue: 10,
|
|
138
|
-
description: 'Number of rows per page when pagination is enabled'
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: 'theme',
|
|
142
|
-
type: 'enum',
|
|
143
|
-
label: 'Theme',
|
|
144
|
-
enum: [
|
|
145
|
-
{ label: 'Quartz', value: 'quartz' },
|
|
146
|
-
{ label: 'Alpine', value: 'alpine' },
|
|
147
|
-
{ label: 'Balham', value: 'balham' },
|
|
148
|
-
{ label: 'Material', value: 'material' }
|
|
149
|
-
],
|
|
150
|
-
defaultValue: 'quartz'
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: 'rowSelection',
|
|
154
|
-
type: 'enum',
|
|
155
|
-
label: 'Row Selection',
|
|
156
|
-
enum: [
|
|
157
|
-
{ label: 'None', value: undefined },
|
|
158
|
-
{ label: 'Single', value: 'single' },
|
|
159
|
-
{ label: 'Multiple', value: 'multiple' }
|
|
160
|
-
],
|
|
161
|
-
defaultValue: undefined,
|
|
162
|
-
advanced: true
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
name: 'domLayout',
|
|
166
|
-
type: 'enum',
|
|
167
|
-
label: 'DOM Layout',
|
|
168
|
-
enum: [
|
|
169
|
-
{ label: 'Normal', value: 'normal' },
|
|
170
|
-
{ label: 'Auto Height', value: 'autoHeight' },
|
|
171
|
-
{ label: 'Print', value: 'print' }
|
|
172
|
-
],
|
|
173
|
-
defaultValue: 'normal',
|
|
174
|
-
advanced: true
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'animateRows',
|
|
178
|
-
type: 'boolean',
|
|
179
|
-
label: 'Animate Rows',
|
|
180
|
-
defaultValue: true,
|
|
181
|
-
advanced: true
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'height',
|
|
185
|
-
type: 'number',
|
|
186
|
-
label: 'Height (px)',
|
|
187
|
-
defaultValue: 500
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: 'editable',
|
|
191
|
-
type: 'boolean',
|
|
192
|
-
label: 'Enable Editing',
|
|
193
|
-
defaultValue: false,
|
|
194
|
-
description: 'Allow cells to be edited inline',
|
|
195
|
-
advanced: true
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: 'singleClickEdit',
|
|
199
|
-
type: 'boolean',
|
|
200
|
-
label: 'Single Click Edit',
|
|
201
|
-
defaultValue: false,
|
|
202
|
-
description: 'Start editing on single click instead of double click',
|
|
203
|
-
advanced: true
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: 'exportConfig',
|
|
207
|
-
type: 'code',
|
|
208
|
-
label: 'Export Config (JSON)',
|
|
209
|
-
description: 'Configure CSV export: { enabled: true, fileName: "data.csv" }',
|
|
210
|
-
advanced: true
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: 'statusBar',
|
|
214
|
-
type: 'code',
|
|
215
|
-
label: 'Status Bar Config (JSON)',
|
|
216
|
-
description: 'Configure status bar: { enabled: true, aggregations: ["count", "sum", "avg"] }',
|
|
217
|
-
advanced: true
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: 'callbacks',
|
|
221
|
-
type: 'code',
|
|
222
|
-
label: 'Event Callbacks (JSON)',
|
|
223
|
-
description: 'Event handlers for cell clicks, selection changes, etc.',
|
|
224
|
-
advanced: true
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
name: 'columnConfig',
|
|
228
|
-
type: 'code',
|
|
229
|
-
label: 'Column Config (JSON)',
|
|
230
|
-
description: 'Global column settings: { resizable: true, sortable: true, filterable: true }',
|
|
231
|
-
advanced: true
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: 'enableRangeSelection',
|
|
235
|
-
type: 'boolean',
|
|
236
|
-
label: 'Enable Range Selection',
|
|
237
|
-
defaultValue: false,
|
|
238
|
-
description: 'Allow selecting ranges of cells (like Excel)',
|
|
239
|
-
advanced: true
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: 'enableCharts',
|
|
243
|
-
type: 'boolean',
|
|
244
|
-
label: 'Enable Charts',
|
|
245
|
-
defaultValue: false,
|
|
246
|
-
description: 'Enable integrated charting (requires AG Grid Enterprise)',
|
|
247
|
-
advanced: true
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
name: 'contextMenu',
|
|
251
|
-
type: 'code',
|
|
252
|
-
label: 'Context Menu Config (JSON)',
|
|
253
|
-
description: 'Configure right-click menu: { enabled: true, items: ["copy", "export"] }',
|
|
254
|
-
advanced: true
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: 'treeData',
|
|
258
|
-
type: 'code',
|
|
259
|
-
label: 'Tree Data Config (JSON)',
|
|
260
|
-
description: 'Configure tree data: { enabled: true, pathField: "orgHierarchy" }',
|
|
261
|
-
advanced: true
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
name: 'rowGrouping',
|
|
265
|
-
type: 'code',
|
|
266
|
-
label: 'Row Grouping Config (JSON)',
|
|
267
|
-
description: 'Configure row grouping: { enabled: true, groupByFields: ["category"] }',
|
|
268
|
-
advanced: true
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: 'excelExport',
|
|
272
|
-
type: 'code',
|
|
273
|
-
label: 'Excel Export Config (JSON)',
|
|
274
|
-
description: 'Configure Excel export: { enabled: true, fileName: "data.xlsx" }',
|
|
275
|
-
advanced: true
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: 'gridOptions',
|
|
279
|
-
type: 'code',
|
|
280
|
-
label: 'Grid Options (JSON)',
|
|
281
|
-
description: 'Advanced AG Grid options',
|
|
282
|
-
advanced: true
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: 'className',
|
|
286
|
-
type: 'string',
|
|
287
|
-
label: 'CSS Class'
|
|
288
|
-
}
|
|
289
|
-
],
|
|
290
|
-
defaultProps: {
|
|
291
|
-
rowData: [
|
|
292
|
-
{ make: 'Tesla', model: 'Model Y', price: 64950, electric: true },
|
|
293
|
-
{ make: 'Ford', model: 'F-Series', price: 33850, electric: false },
|
|
294
|
-
{ make: 'Toyota', model: 'Corolla', price: 29600, electric: false },
|
|
295
|
-
{ make: 'Mercedes', model: 'EQA', price: 48890, electric: true },
|
|
296
|
-
{ make: 'Fiat', model: '500', price: 15774, electric: false },
|
|
297
|
-
{ make: 'Nissan', model: 'Juke', price: 20675, electric: false },
|
|
298
|
-
{ make: 'Vauxhall', model: 'Corsa', price: 18460, electric: false },
|
|
299
|
-
{ make: 'Volvo', model: 'XC90', price: 72835, electric: false },
|
|
300
|
-
{ make: 'Mercedes', model: 'GLA', price: 47825, electric: false },
|
|
301
|
-
{ make: 'Ford', model: 'Puma', price: 27420, electric: false },
|
|
302
|
-
{ make: 'Volkswagen', model: 'Golf', price: 28850, electric: false },
|
|
303
|
-
{ make: 'Kia', model: 'Sportage', price: 31095, electric: false }
|
|
304
|
-
],
|
|
305
|
-
columnDefs: [
|
|
306
|
-
{ field: 'make', headerName: 'Make', sortable: true, filter: true },
|
|
307
|
-
{ field: 'model', headerName: 'Model', sortable: true, filter: true },
|
|
308
|
-
{
|
|
309
|
-
field: 'price',
|
|
310
|
-
headerName: 'Price',
|
|
311
|
-
sortable: true,
|
|
312
|
-
filter: 'number',
|
|
313
|
-
valueFormatter: (params: any) => params.value != null ? '$' + params.value.toLocaleString() : ''
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
field: 'electric',
|
|
317
|
-
headerName: 'Electric',
|
|
318
|
-
sortable: true,
|
|
319
|
-
filter: true,
|
|
320
|
-
cellRenderer: (params: any) => params.value === true ? '⚡ Yes' : 'No'
|
|
321
|
-
}
|
|
322
|
-
],
|
|
323
|
-
pagination: true,
|
|
324
|
-
paginationPageSize: 10,
|
|
325
|
-
theme: 'quartz',
|
|
326
|
-
height: 500,
|
|
327
|
-
animateRows: true,
|
|
328
|
-
domLayout: 'normal'
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* ObjectAgGridRenderer - The public API for the metadata-driven AG Grid component
|
|
335
|
-
* This wrapper handles lazy loading internally using React.Suspense
|
|
336
|
-
*/
|
|
337
|
-
export interface ObjectAgGridRendererProps {
|
|
338
|
-
schema: {
|
|
339
|
-
type: string;
|
|
340
|
-
id?: string;
|
|
341
|
-
className?: string;
|
|
342
|
-
objectName: string;
|
|
343
|
-
dataSource?: DataSource;
|
|
344
|
-
fields?: any[];
|
|
345
|
-
fieldNames?: string[];
|
|
346
|
-
filters?: Record<string, any>;
|
|
347
|
-
sort?: Record<string, 'asc' | 'desc'>;
|
|
348
|
-
pageSize?: number;
|
|
349
|
-
pagination?: boolean;
|
|
350
|
-
domLayout?: 'normal' | 'autoHeight' | 'print';
|
|
351
|
-
animateRows?: boolean;
|
|
352
|
-
rowSelection?: 'single' | 'multiple';
|
|
353
|
-
theme?: 'alpine' | 'balham' | 'material' | 'quartz';
|
|
354
|
-
height?: number | string;
|
|
355
|
-
editable?: boolean;
|
|
356
|
-
editType?: 'fullRow';
|
|
357
|
-
singleClickEdit?: boolean;
|
|
358
|
-
stopEditingWhenCellsLoseFocus?: boolean;
|
|
359
|
-
exportConfig?: ExportConfig;
|
|
360
|
-
statusBar?: StatusBarConfig;
|
|
361
|
-
callbacks?: AgGridCallbacks & {
|
|
362
|
-
onDataLoaded?: (data: any[]) => void;
|
|
363
|
-
onDataError?: (error: Error) => void;
|
|
364
|
-
};
|
|
365
|
-
columnConfig?: ColumnConfig;
|
|
366
|
-
enableRangeSelection?: boolean;
|
|
367
|
-
enableCharts?: boolean;
|
|
368
|
-
contextMenu?: ContextMenuConfig;
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export const ObjectAgGridRenderer: React.FC<ObjectAgGridRendererProps> = ({ schema }) => {
|
|
373
|
-
return (
|
|
374
|
-
<Suspense fallback={<Skeleton className="w-full h-[500px]" />}>
|
|
375
|
-
<LazyObjectAgGrid
|
|
376
|
-
objectName={schema.objectName}
|
|
377
|
-
dataSource={schema.dataSource}
|
|
378
|
-
fields={schema.fields}
|
|
379
|
-
fieldNames={schema.fieldNames}
|
|
380
|
-
filters={schema.filters}
|
|
381
|
-
sort={schema.sort}
|
|
382
|
-
pageSize={schema.pageSize}
|
|
383
|
-
pagination={schema.pagination}
|
|
384
|
-
domLayout={schema.domLayout}
|
|
385
|
-
animateRows={schema.animateRows}
|
|
386
|
-
rowSelection={schema.rowSelection}
|
|
387
|
-
theme={schema.theme}
|
|
388
|
-
height={schema.height}
|
|
389
|
-
className={schema.className}
|
|
390
|
-
editable={schema.editable}
|
|
391
|
-
editType={schema.editType}
|
|
392
|
-
singleClickEdit={schema.singleClickEdit}
|
|
393
|
-
stopEditingWhenCellsLoseFocus={schema.stopEditingWhenCellsLoseFocus}
|
|
394
|
-
exportConfig={schema.exportConfig}
|
|
395
|
-
statusBar={schema.statusBar}
|
|
396
|
-
callbacks={schema.callbacks}
|
|
397
|
-
columnConfig={schema.columnConfig}
|
|
398
|
-
enableRangeSelection={schema.enableRangeSelection}
|
|
399
|
-
enableCharts={schema.enableCharts}
|
|
400
|
-
contextMenu={schema.contextMenu}
|
|
401
|
-
/>
|
|
402
|
-
</Suspense>
|
|
403
|
-
);
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
// Standard Export Protocol - for manual integration
|
|
407
|
-
export const aggridComponents = {
|
|
408
|
-
'aggrid': AgGridRenderer,
|
|
409
|
-
'object-aggrid': ObjectAgGridRenderer,
|
|
410
|
-
};
|
|
411
|
-
|
|
412
|
-
// Register the ObjectAgGrid component with the ComponentRegistry
|
|
413
|
-
ComponentRegistry.register(
|
|
414
|
-
'object-aggrid',
|
|
415
|
-
ObjectAgGridRenderer,
|
|
416
|
-
{
|
|
417
|
-
namespace: 'plugin-aggrid',
|
|
418
|
-
label: 'Object AG Grid',
|
|
419
|
-
icon: 'Table',
|
|
420
|
-
category: 'view',
|
|
421
|
-
inputs: [
|
|
422
|
-
{
|
|
423
|
-
name: 'objectName',
|
|
424
|
-
type: 'string',
|
|
425
|
-
label: 'Object Name',
|
|
426
|
-
description: 'Name of the object to fetch metadata and data from',
|
|
427
|
-
required: true
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
name: 'dataSource',
|
|
431
|
-
type: 'object',
|
|
432
|
-
label: 'Data Source',
|
|
433
|
-
description: 'ObjectStack data source adapter instance',
|
|
434
|
-
required: true
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
name: 'fieldNames',
|
|
438
|
-
type: 'array',
|
|
439
|
-
label: 'Field Names',
|
|
440
|
-
description: 'Optional: Specify which fields to show (defaults to all fields)',
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
name: 'filters',
|
|
444
|
-
type: 'object',
|
|
445
|
-
label: 'Filters',
|
|
446
|
-
description: 'Query filters to apply to the data',
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
name: 'sort',
|
|
450
|
-
type: 'object',
|
|
451
|
-
label: 'Sort',
|
|
452
|
-
description: 'Sorting configuration: { fieldName: "asc" | "desc" }',
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
name: 'pagination',
|
|
456
|
-
type: 'boolean',
|
|
457
|
-
label: 'Enable Pagination',
|
|
458
|
-
defaultValue: true
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
name: 'pageSize',
|
|
462
|
-
type: 'number',
|
|
463
|
-
label: 'Page Size',
|
|
464
|
-
defaultValue: 10,
|
|
465
|
-
description: 'Number of rows per page'
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
name: 'theme',
|
|
469
|
-
type: 'enum',
|
|
470
|
-
label: 'Theme',
|
|
471
|
-
enum: [
|
|
472
|
-
{ label: 'Quartz', value: 'quartz' },
|
|
473
|
-
{ label: 'Alpine', value: 'alpine' },
|
|
474
|
-
{ label: 'Balham', value: 'balham' },
|
|
475
|
-
{ label: 'Material', value: 'material' }
|
|
476
|
-
],
|
|
477
|
-
defaultValue: 'quartz'
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
name: 'height',
|
|
481
|
-
type: 'number',
|
|
482
|
-
label: 'Height (px)',
|
|
483
|
-
defaultValue: 500
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
name: 'editable',
|
|
487
|
-
type: 'boolean',
|
|
488
|
-
label: 'Enable Editing',
|
|
489
|
-
defaultValue: false,
|
|
490
|
-
description: 'Allow cells to be edited inline',
|
|
491
|
-
advanced: true
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
name: 'exportConfig',
|
|
495
|
-
type: 'code',
|
|
496
|
-
label: 'Export Config (JSON)',
|
|
497
|
-
description: 'Configure CSV export: { enabled: true, fileName: "data.csv" }',
|
|
498
|
-
advanced: true
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
name: 'columnConfig',
|
|
502
|
-
type: 'code',
|
|
503
|
-
label: 'Column Config (JSON)',
|
|
504
|
-
description: 'Global column settings: { resizable: true, sortable: true, filterable: true }',
|
|
505
|
-
advanced: true
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
name: 'className',
|
|
509
|
-
type: 'string',
|
|
510
|
-
label: 'CSS Class'
|
|
511
|
-
}
|
|
512
|
-
]
|
|
513
|
-
}
|
|
514
|
-
);
|