@object-ui/plugin-grid 0.5.0 → 3.0.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 (35) hide show
  1. package/.turbo/turbo-build.log +51 -6
  2. package/CHANGELOG.md +37 -0
  3. package/README.md +97 -0
  4. package/dist/index.js +994 -584
  5. package/dist/index.umd.cjs +3 -3
  6. package/dist/packages/plugin-grid/src/InlineEditing.d.ts +28 -0
  7. package/dist/packages/plugin-grid/src/ListColumnExtensions.test.d.ts +0 -0
  8. package/dist/packages/plugin-grid/src/ListColumnSchema.test.d.ts +1 -0
  9. package/dist/packages/plugin-grid/src/ObjectGrid.EdgeCases.stories.d.ts +25 -0
  10. package/dist/packages/plugin-grid/src/ObjectGrid.d.ts +7 -1
  11. package/dist/packages/plugin-grid/src/ObjectGrid.stories.d.ts +33 -0
  12. package/dist/packages/plugin-grid/src/__tests__/InlineEditing.test.d.ts +0 -0
  13. package/dist/packages/plugin-grid/src/__tests__/VirtualGrid.test.d.ts +0 -0
  14. package/dist/packages/plugin-grid/src/__tests__/accessibility.test.d.ts +0 -0
  15. package/dist/packages/plugin-grid/src/__tests__/performance-benchmark.test.d.ts +0 -0
  16. package/dist/packages/plugin-grid/src/__tests__/view-states.test.d.ts +0 -0
  17. package/dist/packages/plugin-grid/src/index.d.ts +5 -0
  18. package/dist/packages/plugin-grid/src/useGroupedData.d.ts +30 -0
  19. package/dist/packages/plugin-grid/src/useRowColor.d.ts +8 -0
  20. package/package.json +11 -10
  21. package/src/InlineEditing.tsx +235 -0
  22. package/src/ListColumnExtensions.test.tsx +374 -0
  23. package/src/ListColumnSchema.test.ts +88 -0
  24. package/src/ObjectGrid.EdgeCases.stories.tsx +147 -0
  25. package/src/ObjectGrid.msw.test.tsx +24 -1
  26. package/src/ObjectGrid.stories.tsx +139 -0
  27. package/src/ObjectGrid.tsx +409 -113
  28. package/src/__tests__/InlineEditing.test.tsx +360 -0
  29. package/src/__tests__/VirtualGrid.test.tsx +438 -0
  30. package/src/__tests__/accessibility.test.tsx +254 -0
  31. package/src/__tests__/performance-benchmark.test.tsx +182 -0
  32. package/src/__tests__/view-states.test.tsx +203 -0
  33. package/src/index.tsx +17 -2
  34. package/src/useGroupedData.ts +122 -0
  35. package/src/useRowColor.ts +74 -0
@@ -1,21 +1,66 @@
1
1
 
2
- > @object-ui/plugin-grid@0.5.0 build /home/runner/work/objectui/objectui/packages/plugin-grid
2
+ > @object-ui/plugin-grid@3.0.0 build /home/runner/work/objectui/objectui/packages/plugin-grid
3
3
  > vite build
4
4
 
5
5
  vite v7.3.1 building client environment for production...
6
6
  transforming...
7
- ✓ 15 modules transformed.
7
+ ✓ 31 modules transformed.
8
8
  rendering chunks...
9
9
  
10
10
  [vite:dts] Start generate declaration files...
11
+ ../../examples/crm/src/objects/contact.object.ts:3:14 - error TS2742: The inferred type of 'ContactObject' cannot be named without a reference to 'examples/crm/node_modules/@objectstack/spec/dist/state-machine.zod-DoC0JvQb'. This is likely not portable. A type annotation is necessary.
12
+
13
+ 3 export const ContactObject = ObjectSchema.create({
14
+    ~~~~~~~~~~~~~
15
+ src/ObjectGrid.EdgeCases.stories.tsx:4:43 - error TS2307: Cannot find module '@storybook-config/datasource' or its corresponding type declarations.
16
+
17
+ 4 import { createStorybookDataSource } from '@storybook-config/datasource';
18
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19
+ src/ObjectGrid.stories.tsx:4:43 - error TS2307: Cannot find module '@storybook-config/datasource' or its corresponding type declarations.
20
+
21
+ 4 import { createStorybookDataSource } from '@storybook-config/datasource';
22
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
+ src/__tests__/VirtualGrid.test.tsx:23:11 - error TS7034: Variable 'items' implicitly has type 'any[]' in some locations where its type cannot be determined.
24
+
25
+ 23 const items = [];
26
+    ~~~~~
27
+ src/__tests__/VirtualGrid.test.tsx:28:30 - error TS7005: Variable 'items' implicitly has an 'any[]' type.
28
+
29
+ 28 getVirtualItems: () => items,
30
+    ~~~~~
31
+ src/__tests__/accessibility.test.tsx:28:11 - error TS7034: Variable 'items' implicitly has type 'any[]' in some locations where its type cannot be determined.
32
+
33
+ 28 const items = [];
34
+    ~~~~~
35
+ src/__tests__/accessibility.test.tsx:33:30 - error TS7005: Variable 'items' implicitly has an 'any[]' type.
36
+
37
+ 33 getVirtualItems: () => items,
38
+    ~~~~~
39
+ src/__tests__/performance-benchmark.test.tsx:27:11 - error TS7034: Variable 'items' implicitly has type 'any[]' in some locations where its type cannot be determined.
40
+
41
+ 27 const items = [];
42
+    ~~~~~
43
+ src/__tests__/performance-benchmark.test.tsx:32:30 - error TS7005: Variable 'items' implicitly has an 'any[]' type.
44
+
45
+ 32 getVirtualItems: () => items,
46
+    ~~~~~
47
+ src/__tests__/view-states.test.tsx:27:11 - error TS7034: Variable 'items' implicitly has type 'any[]' in some locations where its type cannot be determined.
48
+
49
+ 27 const items = [];
50
+    ~~~~~
51
+ src/__tests__/view-states.test.tsx:32:30 - error TS7005: Variable 'items' implicitly has an 'any[]' type.
52
+
53
+ 32 getVirtualItems: () => items,
54
+    ~~~~~
55
+
11
56
  computing gzip size...
12
- dist/index.js 41.83 kB │ gzip: 11.61 kB
13
- [vite:dts] Declaration files built in 14001ms.
57
+ dist/index.js 58.40 kB │ gzip: 15.71 kB
58
+ [vite:dts] Declaration files built in 21545ms.
14
59
  
15
60
  No name was provided for external module "@object-ui/core" in "output.globals" – guessing "core".
16
61
  No name was provided for external module "@object-ui/react" in "output.globals" – guessing "react".
17
62
  No name was provided for external module "@object-ui/fields" in "output.globals" – guessing "fields".
18
63
  No name was provided for external module "@object-ui/components" in "output.globals" – guessing "components".
19
64
  No name was provided for external module "lucide-react" in "output.globals" – guessing "lucideReact".
20
- dist/index.umd.cjs 29.43 kB │ gzip: 10.19 kB
21
- ✓ built in 14.99s
65
+ dist/index.umd.cjs 40.64 kB │ gzip: 13.64 kB
66
+ ✓ built in 22.79s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @object-ui/plugin-grid
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 87979c3: Upgrade to @objectstack v3.0.0 and console bundle optimization
8
+ - Upgraded all @objectstack/\* packages from ^2.0.7 to ^3.0.0
9
+ - Breaking change migrations: Hub → Cloud namespace, definePlugin removed, PaginatedResult.value → .records, PaginatedResult.count → .total, client.meta.getObject() → client.meta.getItem()
10
+ - Console bundle optimization: split monolithic 3.7 MB chunk into 17 granular cacheable chunks (95% main entry reduction)
11
+ - Added gzip + brotli pre-compression via vite-plugin-compression2
12
+ - Lazy MSW loading for build:server (~150 KB gzip saved)
13
+ - Added bundle analysis with rollup-plugin-visualizer
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [87979c3]
18
+ - @object-ui/types@3.0.0
19
+ - @object-ui/core@3.0.0
20
+ - @object-ui/react@3.0.0
21
+ - @object-ui/components@3.0.0
22
+ - @object-ui/fields@3.0.0
23
+ - @object-ui/mobile@3.0.0
24
+
25
+ ## 2.0.0
26
+
27
+ ### Major Changes
28
+
29
+ - b859617: Release v1.0.0 — unify all package versions to 1.0.0
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [b859617]
34
+ - @object-ui/types@2.0.0
35
+ - @object-ui/core@2.0.0
36
+ - @object-ui/react@2.0.0
37
+ - @object-ui/components@2.0.0
38
+ - @object-ui/fields@2.0.0
39
+
3
40
  ## 0.3.1
4
41
 
5
42
  ### Patch Changes
package/README.md CHANGED
@@ -244,6 +244,103 @@ const schema = {
244
244
  };
245
245
  ```
246
246
 
247
+ ### Inline Editing
248
+
249
+ Enable inline cell editing for quick updates:
250
+
251
+ ```typescript
252
+ const schema = {
253
+ type: 'object-grid',
254
+ objectName: 'users',
255
+ columns: [
256
+ { header: 'ID', accessorKey: 'id', editable: false }, // Read-only column
257
+ { header: 'Name', accessorKey: 'name' }, // Editable
258
+ { header: 'Email', accessorKey: 'email' }, // Editable
259
+ { header: 'Status', accessorKey: 'status' } // Editable
260
+ ],
261
+ editable: true, // Enable editing globally
262
+ onCellChange: (rowIndex, columnKey, newValue, row) => {
263
+ console.log(`Cell at row ${rowIndex}, column ${columnKey} changed to:`, newValue);
264
+ console.log('Full row data:', row);
265
+ // Update your data source here
266
+ // Example: await dataSource.update(row.id, { [columnKey]: newValue });
267
+ }
268
+ };
269
+ ```
270
+
271
+ **Inline Editing Features:**
272
+ - **Double-click to edit**: Double-click any editable cell to enter edit mode
273
+ - **Keyboard shortcuts**:
274
+ - Press `Enter` on a focused cell to start editing
275
+ - Press `Enter` while editing to save changes
276
+ - Press `Escape` to cancel editing
277
+ - **Column-level control**: Set `editable: false` on specific columns to prevent editing
278
+ - **Visual feedback**: Editable cells show hover state to indicate they can be edited
279
+ - **Automatic focus**: Input field is automatically focused and selected when entering edit mode
280
+
281
+ **Use Cases:**
282
+ - Quick data corrections
283
+ - Batch data entry
284
+ - Spreadsheet-like editing experience
285
+ - Real-time updates with backend synchronization
286
+
287
+ ### Batch Editing & Multi-Row Save
288
+
289
+ Edit multiple cells across multiple rows and save them individually or all at once:
290
+
291
+ ```typescript
292
+ const schema = {
293
+ type: 'object-grid',
294
+ objectName: 'products',
295
+ columns: [
296
+ { header: 'SKU', accessorKey: 'sku', editable: false },
297
+ { header: 'Name', accessorKey: 'name' },
298
+ { header: 'Price', accessorKey: 'price' },
299
+ { header: 'Stock', accessorKey: 'stock' }
300
+ ],
301
+ editable: true,
302
+ rowActions: true, // Show row-level save/cancel buttons
303
+ onRowSave: async (rowIndex, changes, row) => {
304
+ // Save a single row
305
+ console.log('Saving row:', rowIndex, changes);
306
+ await dataSource.update(row.id, changes);
307
+ },
308
+ onBatchSave: async (allChanges) => {
309
+ // Save all modified rows at once
310
+ console.log('Batch saving:', allChanges);
311
+ await Promise.all(
312
+ allChanges.map(({ row, changes }) =>
313
+ dataSource.update(row.id, changes)
314
+ )
315
+ );
316
+ }
317
+ };
318
+ ```
319
+
320
+ **Batch Editing Features:**
321
+ - **Pending changes tracking**: Edit multiple cells across multiple rows before saving
322
+ - **Visual indicators**:
323
+ - Modified rows are highlighted with amber background
324
+ - Modified cells are shown in bold with amber text
325
+ - Toolbar shows count of modified rows
326
+ - **Row-level actions**: Save or cancel changes for individual rows
327
+ - **Batch operations**:
328
+ - "Save All" button to save all modified rows at once
329
+ - "Cancel All" button to discard all pending changes
330
+ - **Flexible callbacks**:
331
+ - `onRowSave`: Called when saving a single row
332
+ - `onBatchSave`: Called when saving multiple rows at once
333
+ - `onCellChange`: Still called for immediate cell updates (legacy support)
334
+
335
+ **Example Workflow:**
336
+ 1. User edits multiple cells across different rows
337
+ 2. Modified rows are visually highlighted
338
+ 3. Toolbar shows "X rows modified" with Save All/Cancel All buttons
339
+ 4. User can:
340
+ - Save individual rows using row-level save button
341
+ - Save all changes at once using "Save All" button
342
+ - Cancel individual row changes or all changes
343
+
247
344
  ## TypeScript Support
248
345
 
249
346
  ```typescript