@object-ui/plugin-aggrid 3.3.0 → 3.3.2

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 (96) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +20 -0
  3. package/dist/AddressField-CP-8JJvR.js +98 -0
  4. package/dist/{AgGridImpl-DBqxIsko.js → AgGridImpl-DJWnS8p3.js} +1 -1
  5. package/dist/AutoNumberField-DCL2eUJj.js +14 -0
  6. package/dist/{AvatarField-C5b9biGa.js → AvatarField-CpFxJRdO.js} +4 -3
  7. package/dist/{BooleanField-DRzAZhSq.js → BooleanField-Chphr8cB.js} +2 -1
  8. package/dist/CodeField-BWngVIw1.js +23 -0
  9. package/dist/ColorField-GygyYArR.js +38 -0
  10. package/dist/CurrencyField-O8Pn59RO.js +49 -0
  11. package/dist/DateField-u6U8wmvI.js +22 -0
  12. package/dist/DateTimeField-D1z1Ovvy.js +30 -0
  13. package/dist/EmailField-IOcDmGjJ.js +26 -0
  14. package/dist/FileField-D3mZIrJ1.js +158 -0
  15. package/dist/FormulaField-MuyWzQx0.js +17 -0
  16. package/dist/GeolocationField-BfhC7QLw.js +161 -0
  17. package/dist/GridField-gN34gk4b.js +49 -0
  18. package/dist/ImageField-BZfSFwmJ.js +75 -0
  19. package/dist/LocationField-B-zwfw3h.js +36 -0
  20. package/dist/{LookupField-DoOmbbZF.js → LookupField-Cms1Cu_l.js} +347 -349
  21. package/dist/{MasterDetailField-BnSPGAtS.js → MasterDetailField-DGUmvg2f.js} +5 -4
  22. package/dist/NumberField-BV5sKwZ7.js +27 -0
  23. package/dist/{ObjectAgGridImpl-DrI0aa8t.js → ObjectAgGridImpl-yiHlXYgp.js} +5804 -5804
  24. package/dist/ObjectField-DJ5s3ciA.js +50 -0
  25. package/dist/{PasswordField-k5JeKk9f.js → PasswordField-BJboeBJY.js} +3 -2
  26. package/dist/PercentField-DO3be_bL.js +61 -0
  27. package/dist/PhoneField-CT6XcO6O.js +26 -0
  28. package/dist/{QRCodeField-BIrSW1Zr.js → QRCodeField-COLyc5iQ.js} +31 -30
  29. package/dist/{RatingField-5iMhn2GL.js → RatingField-B2momIna.js} +3 -2
  30. package/dist/RichTextField-C7qzDPJy.js +33 -0
  31. package/dist/SelectField-oo6vnNhQ.js +36 -0
  32. package/dist/{SignatureField-BAMvNrE6.js → SignatureField-DUgoK09r.js} +3 -2
  33. package/dist/{SliderField-C9IhmjbF.js → SliderField-DrggtBSX.js} +2 -1
  34. package/dist/SummaryField-DuMsFoY5.js +22 -0
  35. package/dist/TextAreaField-CLzzmPce.js +37 -0
  36. package/dist/TextField-CZE7SzK4.js +30 -0
  37. package/dist/TimeField-Bha4cayv.js +22 -0
  38. package/dist/UrlField-Dff4WLlN.js +31 -0
  39. package/dist/UserField-eT5njHwQ.js +77 -0
  40. package/dist/VectorField-BHe8lDOH.js +34 -0
  41. package/dist/{image-DlUdeTgT.js → image-DmzU2ETO.js} +1 -1
  42. package/dist/index.js +2 -2
  43. package/dist/index.umd.cjs +77 -77
  44. package/dist/{jsx-runtime-CGDkM_Jn.js → jsx-runtime-CXSCp6pT.js} +30 -39
  45. package/dist/{plus-BwEV_Q5_.js → plus-bvZ2f9T_.js} +1 -1
  46. package/dist/rolldown-runtime-CkxV0rQ3.js +14 -0
  47. package/dist/{upload-DPiohvXv.js → upload-BdzwEMeV.js} +1 -1
  48. package/dist/{useFieldTranslation-C69OtouR.js → useFieldTranslation-CfXaJRC4.js} +2 -2
  49. package/dist/{x-BFq2GeQ5.js → x-98xe-fYG.js} +1 -1
  50. package/package.json +34 -11
  51. package/.turbo/turbo-build.log +0 -71
  52. package/OBJECT_AGGRID_CN.md +0 -483
  53. package/QUICKSTART.md +0 -186
  54. package/dist/AddressField-DKqaE9pD.js +0 -93
  55. package/dist/AutoNumberField-0RU2dNKe.js +0 -13
  56. package/dist/CodeField-RWhnDMyL.js +0 -22
  57. package/dist/ColorField-B-YAFXdz.js +0 -37
  58. package/dist/CurrencyField-Bu80a-sI.js +0 -51
  59. package/dist/DateField-CV-NpLbM.js +0 -21
  60. package/dist/DateTimeField--YTsgTjw.js +0 -32
  61. package/dist/EmailField-B-3fWJsH.js +0 -28
  62. package/dist/FileField-BcGMvBnI.js +0 -160
  63. package/dist/FormulaField-MQXJZOep.js +0 -13
  64. package/dist/GeolocationField-D3BrmwqV.js +0 -156
  65. package/dist/GridField-DHsGo9l2.js +0 -51
  66. package/dist/ImageField-BBqwJEkk.js +0 -77
  67. package/dist/LocationField-DSvhU9Dz.js +0 -35
  68. package/dist/LookupField-KfYQlgUd.js +0 -2
  69. package/dist/NumberField-Kz4_o5DE.js +0 -26
  70. package/dist/ObjectField-C1qkl6s4.js +0 -52
  71. package/dist/PercentField-Dmipqv0I.js +0 -63
  72. package/dist/PhoneField-Dn4h6V9H.js +0 -28
  73. package/dist/RichTextField-CN5BRd_7.js +0 -32
  74. package/dist/SelectField-Bjk_S2zT.js +0 -31
  75. package/dist/SelectField-CcWvzp9g.js +0 -2
  76. package/dist/SummaryField-R9RENAZv.js +0 -18
  77. package/dist/TextAreaField-BY63Nr6-.js +0 -36
  78. package/dist/TextField-SIw8aMzf.js +0 -29
  79. package/dist/TimeField-xxziHPjE.js +0 -21
  80. package/dist/UrlField-Ihk3_ff5.js +0 -33
  81. package/dist/UserField-BHl6mmIH.js +0 -79
  82. package/dist/VectorField-Ci167cxr.js +0 -35
  83. package/src/AgGridImpl.tsx +0 -405
  84. package/src/ObjectAgGridImpl.tsx +0 -509
  85. package/src/VirtualScrolling.ts +0 -74
  86. package/src/ag-grid.d.ts +0 -10
  87. package/src/field-renderers.test.tsx +0 -383
  88. package/src/field-renderers.tsx +0 -224
  89. package/src/index.test.ts +0 -139
  90. package/src/index.tsx +0 -514
  91. package/src/object-aggrid.test.ts +0 -99
  92. package/src/object-aggrid.types.ts +0 -123
  93. package/src/types.ts +0 -184
  94. package/tsconfig.json +0 -17
  95. package/vite.config.ts +0 -64
  96. /package/dist/{createLucideIcon-BjfZYZey.js → createLucideIcon-C_5JZ35b.js} +0 -0
@@ -1,99 +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, vi, beforeEach } from 'vitest';
10
- import { ObjectAgGridRenderer } from './index';
11
- import type { DataSource } from '@object-ui/types';
12
-
13
- describe('ObjectAgGridRenderer', () => {
14
- let mockDataSource: DataSource;
15
-
16
- beforeEach(() => {
17
- mockDataSource = {
18
- find: vi.fn().mockResolvedValue({
19
- data: [
20
- { id: '1', name: 'Test 1', email: 'test1@example.com' },
21
- { id: '2', name: 'Test 2', email: 'test2@example.com' }
22
- ],
23
- total: 2,
24
- page: 1,
25
- pageSize: 10,
26
- hasMore: false
27
- }),
28
- findOne: vi.fn(),
29
- create: vi.fn(),
30
- update: vi.fn(),
31
- delete: vi.fn(),
32
- bulk: vi.fn(),
33
- getObjectSchema: vi.fn().mockResolvedValue({
34
- name: 'contacts',
35
- label: 'Contacts',
36
- fields: {
37
- name: {
38
- name: 'name',
39
- label: 'Name',
40
- type: 'text',
41
- sortable: true,
42
- filterable: true
43
- },
44
- email: {
45
- name: 'email',
46
- label: 'Email',
47
- type: 'email',
48
- sortable: true,
49
- filterable: true
50
- }
51
- }
52
- })
53
- } as any;
54
- });
55
-
56
- it('should be defined', () => {
57
- expect(ObjectAgGridRenderer).toBeDefined();
58
- });
59
-
60
- it('should accept schema with objectName and dataSource', () => {
61
- const schema = {
62
- type: 'object-aggrid',
63
- objectName: 'contacts',
64
- dataSource: mockDataSource
65
- };
66
-
67
- expect(() => {
68
- ObjectAgGridRenderer({ schema });
69
- }).not.toThrow();
70
- });
71
-
72
- it('should accept optional pagination settings', () => {
73
- const schema = {
74
- type: 'object-aggrid',
75
- objectName: 'contacts',
76
- dataSource: mockDataSource,
77
- pagination: true,
78
- pageSize: 20
79
- };
80
-
81
- expect(() => {
82
- ObjectAgGridRenderer({ schema });
83
- }).not.toThrow();
84
- });
85
-
86
- it('should accept optional filters and sorting', () => {
87
- const schema = {
88
- type: 'object-aggrid',
89
- objectName: 'contacts',
90
- dataSource: mockDataSource,
91
- filters: { status: 'active' },
92
- sort: { name: 'asc' as const }
93
- };
94
-
95
- expect(() => {
96
- ObjectAgGridRenderer({ schema });
97
- }).not.toThrow();
98
- });
99
- });
@@ -1,123 +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 type { ColDef } from 'ag-grid-community';
10
- import type { DataSource } from '@object-ui/types';
11
- import type { FieldMetadata } from '@object-ui/types';
12
- import type { AgGridCallbacks, ExportConfig, StatusBarConfig, ColumnConfig, ContextMenuConfig } from './types';
13
-
14
- /**
15
- * Object AgGrid schema for metadata-driven grid
16
- */
17
- export interface ObjectAgGridSchema {
18
- type: 'object-aggrid';
19
- id?: string;
20
- className?: string;
21
-
22
- // Object metadata
23
- objectName: string;
24
- dataSource: DataSource; // Required for metadata-driven grid
25
-
26
- // Optional field configuration override
27
- fields?: FieldMetadata[];
28
- fieldNames?: string[]; // Show only specific fields
29
-
30
- // Query parameters
31
- filters?: Record<string, any>;
32
- sort?: Record<string, 'asc' | 'desc'>;
33
- pageSize?: number;
34
-
35
- // Grid configuration (same as aggrid)
36
- pagination?: boolean;
37
- domLayout?: 'normal' | 'autoHeight' | 'print';
38
- animateRows?: boolean;
39
- rowSelection?: 'single' | 'multiple';
40
-
41
- // Editing
42
- editable?: boolean;
43
- editType?: 'fullRow';
44
- singleClickEdit?: boolean;
45
- stopEditingWhenCellsLoseFocus?: boolean;
46
-
47
- // Export
48
- exportConfig?: ExportConfig;
49
-
50
- // Status bar
51
- statusBar?: StatusBarConfig;
52
-
53
- // Column features
54
- columnConfig?: ColumnConfig;
55
- enableRangeSelection?: boolean;
56
- enableCharts?: boolean;
57
-
58
- // Context menu
59
- contextMenu?: ContextMenuConfig;
60
-
61
- // Event callbacks
62
- callbacks?: AgGridCallbacks & {
63
- onDataLoaded?: (data: any[]) => void;
64
- onDataError?: (error: Error) => void;
65
- };
66
-
67
- // Styling
68
- theme?: 'alpine' | 'balham' | 'material' | 'quartz';
69
- height?: number | string;
70
- }
71
-
72
- /**
73
- * Props for ObjectAgGridImpl component
74
- */
75
- export interface ObjectAgGridImplProps {
76
- objectName: string;
77
- dataSource?: DataSource; // Optional in props, but required for functionality
78
- fields?: FieldMetadata[];
79
- fieldNames?: string[];
80
- filters?: Record<string, any>;
81
- sort?: Record<string, 'asc' | 'desc'>;
82
- pageSize?: number;
83
- pagination?: boolean;
84
- domLayout?: 'normal' | 'autoHeight' | 'print';
85
- animateRows?: boolean;
86
- rowSelection?: 'single' | 'multiple';
87
- theme?: 'alpine' | 'balham' | 'material' | 'quartz';
88
- height?: number | string;
89
- className?: string;
90
- editable?: boolean;
91
- editType?: 'fullRow';
92
- singleClickEdit?: boolean;
93
- stopEditingWhenCellsLoseFocus?: boolean;
94
- exportConfig?: ExportConfig;
95
- statusBar?: StatusBarConfig;
96
- callbacks?: AgGridCallbacks & {
97
- onDataLoaded?: (data: any[]) => void;
98
- onDataError?: (error: Error) => void;
99
- };
100
- columnConfig?: ColumnConfig;
101
- enableRangeSelection?: boolean;
102
- enableCharts?: boolean;
103
- contextMenu?: ContextMenuConfig;
104
- }
105
-
106
- /**
107
- * Field type to AG Grid filter type mapping
108
- */
109
- export const FIELD_TYPE_TO_FILTER_TYPE: Record<string, string | boolean> = {
110
- text: 'agTextColumnFilter',
111
- textarea: 'agTextColumnFilter',
112
- number: 'agNumberColumnFilter',
113
- currency: 'agNumberColumnFilter',
114
- percent: 'agNumberColumnFilter',
115
- boolean: 'agSetColumnFilter',
116
- date: 'agDateColumnFilter',
117
- datetime: 'agDateColumnFilter',
118
- time: 'agTextColumnFilter',
119
- email: 'agTextColumnFilter',
120
- phone: 'agTextColumnFilter',
121
- url: 'agTextColumnFilter',
122
- select: 'agSetColumnFilter',
123
- };
package/src/types.ts DELETED
@@ -1,184 +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 type { ColDef, GridOptions, CellClickedEvent, RowClickedEvent, SelectionChangedEvent, CellValueChangedEvent } from 'ag-grid-community';
10
-
11
- /**
12
- * Event callback types
13
- */
14
- export interface AgGridCallbacks {
15
- onCellClicked?: (event: CellClickedEvent) => void;
16
- onRowClicked?: (event: RowClickedEvent) => void;
17
- onSelectionChanged?: (event: SelectionChangedEvent) => void;
18
- onCellValueChanged?: (event: CellValueChangedEvent) => void;
19
- onExport?: (data: any[], format: 'csv' | 'excel') => void;
20
- onContextMenuAction?: (action: string, rowData: any) => void;
21
- }
22
-
23
- /**
24
- * Export configuration
25
- */
26
- export interface ExportConfig {
27
- enabled?: boolean;
28
- fileName?: string;
29
- skipColumnHeaders?: boolean;
30
- allColumns?: boolean;
31
- onlySelected?: boolean;
32
- format?: 'csv' | 'excel';
33
- }
34
-
35
- /**
36
- * Tree data configuration
37
- */
38
- export interface TreeDataConfig {
39
- enabled?: boolean;
40
- /** Field that contains the hierarchy path (array of strings) */
41
- pathField?: string;
42
- /** Field that contains parent ID for parent-child relationships */
43
- parentIdField?: string;
44
- /** Field that contains the unique ID */
45
- idField?: string;
46
- /** Whether to expand all rows by default */
47
- expandAll?: boolean;
48
- /** Depth to expand to by default */
49
- expandDepth?: number;
50
- }
51
-
52
- /**
53
- * Row grouping configuration
54
- */
55
- export interface RowGroupingConfig {
56
- enabled?: boolean;
57
- /** Fields to group by */
58
- groupByFields?: string[];
59
- /** Whether to show group row count */
60
- showRowCount?: boolean;
61
- /** Whether to allow user to change grouping */
62
- userGroupable?: boolean;
63
- /** Aggregation functions for grouped columns */
64
- aggregations?: Record<string, 'sum' | 'avg' | 'count' | 'min' | 'max' | 'first' | 'last'>;
65
- }
66
-
67
- /**
68
- * Excel export configuration
69
- */
70
- export interface ExcelExportConfig {
71
- enabled?: boolean;
72
- fileName?: string;
73
- sheetName?: string;
74
- includeHeaders?: boolean;
75
- includeGrouping?: boolean;
76
- onlySelected?: boolean;
77
- /** Custom column widths */
78
- columnWidths?: Record<string, number>;
79
- }
80
-
81
- /**
82
- * Status bar configuration
83
- */
84
- export interface StatusBarConfig {
85
- enabled?: boolean;
86
- aggregations?: ('sum' | 'avg' | 'count' | 'min' | 'max')[];
87
- }
88
-
89
- /**
90
- * Column configuration enhancements
91
- */
92
- export interface ColumnConfig {
93
- resizable?: boolean;
94
- sortable?: boolean;
95
- filterable?: boolean;
96
- }
97
-
98
- /**
99
- * Context menu configuration
100
- */
101
- export interface ContextMenuConfig {
102
- enabled?: boolean;
103
- items?: ('copy' | 'copyWithHeaders' | 'paste' | 'separator' | 'export' | 'autoSizeAll' | 'resetColumns' | string)[];
104
- customItems?: Array<{
105
- name: string;
106
- action: string;
107
- disabled?: boolean;
108
- }>;
109
- }
110
-
111
- /**
112
- * AG Grid schema for ObjectUI
113
- */
114
- export interface AgGridSchema {
115
- type: 'aggrid';
116
- id?: string;
117
- className?: string;
118
-
119
- // Data
120
- rowData?: any[];
121
-
122
- // Column definitions
123
- columnDefs?: ColDef[];
124
-
125
- // Grid configuration
126
- gridOptions?: GridOptions;
127
-
128
- // Common options
129
- pagination?: boolean;
130
- paginationPageSize?: number;
131
- domLayout?: 'normal' | 'autoHeight' | 'print';
132
- animateRows?: boolean;
133
- rowSelection?: 'single' | 'multiple';
134
-
135
- // Editing
136
- editable?: boolean;
137
- editType?: 'fullRow';
138
- singleClickEdit?: boolean;
139
- stopEditingWhenCellsLoseFocus?: boolean;
140
-
141
- // Export
142
- exportConfig?: ExportConfig;
143
-
144
- // Status bar
145
- statusBar?: StatusBarConfig;
146
-
147
- // Column features
148
- columnConfig?: ColumnConfig;
149
- enableRangeSelection?: boolean;
150
- enableCharts?: boolean;
151
-
152
- // Context menu
153
- contextMenu?: ContextMenuConfig;
154
-
155
- // Tree data
156
- treeData?: TreeDataConfig;
157
-
158
- // Row grouping
159
- rowGrouping?: RowGroupingConfig;
160
-
161
- // Excel export
162
- excelExport?: ExcelExportConfig;
163
-
164
- // Event callbacks
165
- callbacks?: AgGridCallbacks;
166
-
167
- // Styling
168
- theme?: 'alpine' | 'balham' | 'material' | 'quartz';
169
- height?: number | string;
170
- }
171
-
172
- /**
173
- * Column definition with simplified schema
174
- */
175
- export interface SimpleColumnDef {
176
- field: string;
177
- headerName?: string;
178
- width?: number;
179
- sortable?: boolean;
180
- filter?: boolean | 'text' | 'number' | 'date';
181
- editable?: boolean;
182
- cellRenderer?: string;
183
- valueFormatter?: (params: any) => string;
184
- }
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "jsx": "react-jsx",
6
- "baseUrl": ".",
7
- "paths": {
8
- "@/*": ["src/*"]
9
- },
10
- "noImplicitAny": true,
11
- "noEmit": false,
12
- "declaration": true,
13
- "composite": true,
14
- "skipLibCheck": true
15
- },
16
- "include": ["src"]
17
- }
package/vite.config.ts DELETED
@@ -1,64 +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 { defineConfig } from 'vite';
10
- import react from '@vitejs/plugin-react';
11
- import dts from 'vite-plugin-dts';
12
- import { resolve } from 'path';
13
-
14
- export default defineConfig({
15
- plugins: [
16
- react(),
17
- dts({
18
- insertTypesEntry: true,
19
- compilerOptions: { rootDir: resolve(__dirname, '../..') },
20
- include: ['src'],
21
- exclude: ['**/*.test.ts', '**/*.test.tsx', 'node_modules'],
22
- skipDiagnostics: true,
23
- }),
24
- ],
25
- resolve: {
26
- alias: {
27
- '@': resolve(__dirname, './src'),
28
- '@object-ui/core': resolve(__dirname, '../core/src'),
29
- '@object-ui/types': resolve(__dirname, '../types/src'),
30
- '@object-ui/react': resolve(__dirname, '../react/src'),
31
- '@object-ui/components': resolve(__dirname, '../components/src'),
32
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
33
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
34
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
35
- },
36
- },
37
- build: {
38
- lib: {
39
- entry: resolve(__dirname, 'src/index.tsx'),
40
- name: 'ObjectUIPluginAgGrid',
41
- fileName: 'index',
42
- },
43
- rollupOptions: {
44
- external: ['react', 'react-dom', '@object-ui/components', '@object-ui/core', '@object-ui/react', 'ag-grid-community', 'ag-grid-react'],
45
- output: {
46
- globals: {
47
- react: 'React',
48
- 'react-dom': 'ReactDOM',
49
- '@object-ui/components': 'ObjectUIComponents',
50
- '@object-ui/core': 'ObjectUICore',
51
- '@object-ui/react': 'ObjectUIReact',
52
- 'ag-grid-community': 'AgGridCommunity',
53
- 'ag-grid-react': 'AgGridReact',
54
- },
55
- },
56
- },
57
- },
58
- test: {
59
- globals: true,
60
- environment: 'happy-dom',
61
- setupFiles: ['../../vitest.setup.tsx'],
62
- passWithNoTests: true,
63
- },
64
- });