@svgrid/grid 2.2.0 → 2.2.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 (114) hide show
  1. package/dist/FlexRender.svelte +96 -96
  2. package/dist/GridFooter.svelte +178 -178
  3. package/dist/SvCarousel.svelte +141 -141
  4. package/dist/SvColorInput.svelte +187 -187
  5. package/dist/SvContextMenu.svelte +116 -116
  6. package/dist/SvDrawer.svelte +250 -250
  7. package/dist/SvGrid.svelte +3131 -3131
  8. package/dist/SvGridBoard.svelte +2339 -2339
  9. package/dist/SvGridChart.svelte +1724 -1724
  10. package/dist/SvGridChartPanel.svelte +485 -485
  11. package/dist/SvGridDropdown.svelte +689 -689
  12. package/dist/SvGroupCell.svelte +109 -109
  13. package/dist/SvMenu.svelte +124 -124
  14. package/dist/SvMenuList.svelte +117 -117
  15. package/dist/SvNumberInput.svelte +131 -131
  16. package/dist/SvOtpInput.svelte +158 -158
  17. package/dist/SvPopover.svelte +139 -139
  18. package/dist/SvRowGroupPanel.svelte +170 -170
  19. package/dist/SvScrollArea.svelte +61 -61
  20. package/dist/SvTooltip.svelte +127 -127
  21. package/dist/SvTour.svelte +204 -204
  22. package/dist/SvTree.svelte +377 -377
  23. package/dist/SvTreeSelect.svelte +230 -230
  24. package/dist/cdn/svgrid.js +8 -8
  25. package/dist/cdn/svgrid.svelte-external.js +8 -8
  26. package/dist/chart-export.js +8 -8
  27. package/package.json +10 -10
  28. package/src/FlexRender.svelte +96 -96
  29. package/src/GridFooter.svelte +178 -178
  30. package/src/SvCarousel.svelte +141 -141
  31. package/src/SvColorInput.svelte +187 -187
  32. package/src/SvContextMenu.svelte +116 -116
  33. package/src/SvDrawer.svelte +250 -250
  34. package/src/SvGrid.controller.svelte.ts +3158 -3158
  35. package/src/SvGrid.svelte +3131 -3131
  36. package/src/SvGrid.types.ts +1489 -1489
  37. package/src/SvGridBoard.svelte +2339 -2339
  38. package/src/SvGridChart.svelte +1724 -1724
  39. package/src/SvGridChartPanel.svelte +485 -485
  40. package/src/SvGridDropdown.svelte +689 -689
  41. package/src/SvGroupCell.svelte +109 -109
  42. package/src/SvMenu.svelte +124 -124
  43. package/src/SvMenu.test.ts +97 -97
  44. package/src/SvMenuList.svelte +117 -117
  45. package/src/SvNumberInput.svelte +131 -131
  46. package/src/SvOtpInput.svelte +158 -158
  47. package/src/SvPopover.svelte +139 -139
  48. package/src/SvRowGroupPanel.svelte +170 -170
  49. package/src/SvScrollArea.svelte +61 -61
  50. package/src/SvTooltip.svelte +127 -127
  51. package/src/SvTour.svelte +204 -204
  52. package/src/SvTree.svelte +377 -377
  53. package/src/SvTreeSelect.svelte +230 -230
  54. package/src/a11y.contract.test.ts +49 -49
  55. package/src/a11y.test.ts +59 -59
  56. package/src/a11y.ts +61 -61
  57. package/src/build-api.ts +870 -870
  58. package/src/cell-formatting.ts +169 -169
  59. package/src/cell-render.ts +469 -469
  60. package/src/chart-export.ts +201 -201
  61. package/src/chart.ts +2296 -2296
  62. package/src/collaboration.test.ts +104 -104
  63. package/src/collaboration.ts +167 -167
  64. package/src/core.performance.test.ts +30 -30
  65. package/src/core.ts +1111 -1111
  66. package/src/createAutocomplete.svelte.ts +132 -132
  67. package/src/createCombobox.svelte.ts +179 -179
  68. package/src/createCountryInput.svelte.ts +157 -157
  69. package/src/createDropdownList.svelte.ts +162 -162
  70. package/src/createGrid.svelte.ts +42 -42
  71. package/src/createGrid.test.ts +10 -10
  72. package/src/createGridState.svelte.ts +17 -17
  73. package/src/createMenu.svelte.ts +202 -202
  74. package/src/createPopoverSelect.svelte.ts +206 -206
  75. package/src/createTree.svelte.ts +319 -319
  76. package/src/editing.test.ts +859 -859
  77. package/src/editing.ts +675 -675
  78. package/src/export-data-api.test.ts +126 -126
  79. package/src/export-format.test.ts +107 -107
  80. package/src/export-format.ts +598 -598
  81. package/src/flex-render.ts +3 -3
  82. package/src/index.ts +623 -623
  83. package/src/keyboard.test.ts +59 -59
  84. package/src/keyboard.ts +97 -97
  85. package/src/list-nav.test.ts +49 -49
  86. package/src/list-nav.ts +29 -29
  87. package/src/menus.ts +639 -639
  88. package/src/merge-objects.ts +48 -48
  89. package/src/overlays.test.ts +90 -90
  90. package/src/render-component.ts +28 -28
  91. package/src/selection.test.ts +754 -754
  92. package/src/selection.ts +600 -600
  93. package/src/server-data-source.test.ts +289 -289
  94. package/src/server-data-source.ts +413 -413
  95. package/src/sparkline.test.ts +68 -68
  96. package/src/sparkline.ts +169 -169
  97. package/src/spreadsheet.test.ts +489 -489
  98. package/src/spreadsheet.ts +312 -312
  99. package/src/static-functions.ts +11 -11
  100. package/src/subscribe.ts +38 -38
  101. package/src/svgrid-wrapper.types.ts +501 -501
  102. package/src/svgrid.behavior.test.ts +706 -706
  103. package/src/svgrid.charting.test.ts +527 -527
  104. package/src/svgrid.features.test.ts +157 -157
  105. package/src/svgrid.new-features.wrapper.test.ts +251 -251
  106. package/src/svgrid.wrapper.test.ts +40 -40
  107. package/src/test-setup.ts +62 -62
  108. package/src/themes/index.ts +159 -159
  109. package/src/virtualization/column-virtualizer.test.ts +27 -27
  110. package/src/virtualization/column-virtualizer.ts +30 -30
  111. package/src/virtualization/svelte-virtualizer.svelte.ts +26 -26
  112. package/src/virtualization/types.ts +30 -30
  113. package/src/virtualization/virtualizer.test.ts +47 -47
  114. package/src/virtualization/virtualizer.ts +296 -296
@@ -1,157 +1,157 @@
1
- import { describe, expect, it } from 'vitest'
2
- import {
3
- columnFilteringFeature,
4
- columnGroupingFeature,
5
- createCoreRowModel,
6
- createExpandedRowModel,
7
- createFilteredRowModel,
8
- createGroupedRowModel,
9
- createPaginatedRowModel,
10
- createSortedRowModel,
11
- createSvGrid,
12
- rowExpandingFeature,
13
- rowSelectionFeature,
14
- rowSortingFeature,
15
- sortFns,
16
- subscribeSvGrid,
17
- tableFeatures,
18
- } from './index'
19
- import type { ColumnDef } from './index'
20
-
21
- type Person = { firstName: string; age: number; status?: string }
22
-
23
- describe('SvGrid features', () => {
24
- it('supports sorting and pagination row model pipeline', () => {
25
- const _features = tableFeatures({
26
- columnFilteringFeature,
27
- columnGroupingFeature,
28
- rowExpandingFeature,
29
- rowSelectionFeature,
30
- rowSortingFeature,
31
- })
32
- const columns: Array<ColumnDef<typeof _features, Person>> = [
33
- { field: 'firstName' },
34
- { field: 'age' },
35
- ]
36
- const data: Array<Person> = [
37
- { firstName: 'John', age: 40, status: 'pending' },
38
- { firstName: 'Amy', age: 22, status: 'active' },
39
- { firstName: 'Kate', age: 31, status: 'active' },
40
- ]
41
-
42
- const grid = createSvGrid({
43
- _features,
44
- _rowModels: {
45
- coreRowModel: createCoreRowModel(),
46
- filteredRowModel: createFilteredRowModel(),
47
- sortedRowModel: createSortedRowModel(sortFns),
48
- groupedRowModel: createGroupedRowModel(),
49
- expandedRowModel: createExpandedRowModel(),
50
- paginatedRowModel: createPaginatedRowModel(),
51
- },
52
- columns,
53
- data,
54
- state: {
55
- columnFilters: [{ id: 'firstName', value: 'a', fn: 'includesString' }],
56
- grouping: ['status'],
57
- expanded: { group_status_active: true },
58
- sorting: [{ id: 'age', desc: false }],
59
- pagination: { pageIndex: 0, pageSize: 2 },
60
- },
61
- })
62
-
63
- const rows = grid.getRowModel().rows
64
- expect(rows).toHaveLength(1)
65
- expect(rows[0]?.id).toContain('group_status_')
66
- })
67
-
68
- it('supports row selection and expansion toggles', () => {
69
- const _features = tableFeatures({
70
- rowExpandingFeature,
71
- rowSelectionFeature,
72
- })
73
- const columns: Array<ColumnDef<typeof _features, Person>> = [
74
- { field: 'firstName' },
75
- ]
76
- const data: Array<Person> = [
77
- { firstName: 'Amy', age: 22 },
78
- ]
79
- const grid = createSvGrid({
80
- _features,
81
- _rowModels: {
82
- coreRowModel: createCoreRowModel(),
83
- },
84
- columns,
85
- data,
86
- })
87
- const row = grid.getRowModel().rows[0]
88
- expect(row).toBeDefined()
89
- row?.toggleSelected()
90
- row?.toggleExpanded()
91
- expect(row?.getIsSelected()).toBe(true)
92
- expect(row?.getIsExpanded()).toBe(true)
93
- })
94
-
95
- it('supports selector subscriptions with stable shape', () => {
96
- const _features = tableFeatures({ rowSortingFeature })
97
- const grid = createSvGrid({
98
- _features,
99
- _rowModels: {
100
- coreRowModel: createCoreRowModel(),
101
- },
102
- columns: [{ field: 'firstName' }],
103
- data: [{ firstName: 'Amy', age: 22 }],
104
- })
105
- const selected = subscribeSvGrid(grid, (state) => ({
106
- sorting: state.sorting,
107
- pageIndex: state.pagination?.pageIndex ?? 0,
108
- }))
109
- expect(selected.current.pageIndex).toBe(0)
110
- })
111
-
112
- it('supports active cell movement primitives', () => {
113
- const _features = tableFeatures({ rowSortingFeature })
114
- const grid = createSvGrid({
115
- _features,
116
- _rowModels: { coreRowModel: createCoreRowModel() },
117
- columns: [
118
- { field: 'firstName' },
119
- { field: 'age' },
120
- ],
121
- data: [
122
- { firstName: 'Amy', age: 22 },
123
- { firstName: 'John', age: 40 },
124
- ],
125
- })
126
-
127
- grid.moveActiveCell({ rowDelta: 1, colDelta: 1 })
128
- expect(grid.getState().activeCell.rowIndex).toBe(1)
129
- expect(grid.getState().activeCell.colIndex).toBe(1)
130
- })
131
-
132
- it('supports multi-column sorting clauses', () => {
133
- const _features = tableFeatures({ rowSortingFeature })
134
- const grid = createSvGrid({
135
- _features,
136
- _rowModels: {
137
- coreRowModel: createCoreRowModel(),
138
- sortedRowModel: createSortedRowModel(sortFns),
139
- },
140
- columns: [
141
- { field: 'firstName' },
142
- { field: 'age', editorType: 'number' },
143
- ],
144
- data: [
145
- { firstName: 'Amy', age: 20 },
146
- { firstName: 'Amy', age: 30 },
147
- { firstName: 'Bob', age: 10 },
148
- ],
149
- state: { sorting: [{ id: 'firstName', desc: false }, { id: 'age', desc: true }] },
150
- })
151
-
152
- const rows = grid.getRowModel().rows
153
- expect(rows[0]?.original.firstName).toBe('Amy')
154
- expect(rows[0]?.original.age).toBe(30)
155
- expect(rows[1]?.original.age).toBe(20)
156
- })
157
- })
1
+ import { describe, expect, it } from 'vitest'
2
+ import {
3
+ columnFilteringFeature,
4
+ columnGroupingFeature,
5
+ createCoreRowModel,
6
+ createExpandedRowModel,
7
+ createFilteredRowModel,
8
+ createGroupedRowModel,
9
+ createPaginatedRowModel,
10
+ createSortedRowModel,
11
+ createSvGrid,
12
+ rowExpandingFeature,
13
+ rowSelectionFeature,
14
+ rowSortingFeature,
15
+ sortFns,
16
+ subscribeSvGrid,
17
+ tableFeatures,
18
+ } from './index'
19
+ import type { ColumnDef } from './index'
20
+
21
+ type Person = { firstName: string; age: number; status?: string }
22
+
23
+ describe('SvGrid features', () => {
24
+ it('supports sorting and pagination row model pipeline', () => {
25
+ const _features = tableFeatures({
26
+ columnFilteringFeature,
27
+ columnGroupingFeature,
28
+ rowExpandingFeature,
29
+ rowSelectionFeature,
30
+ rowSortingFeature,
31
+ })
32
+ const columns: Array<ColumnDef<typeof _features, Person>> = [
33
+ { field: 'firstName' },
34
+ { field: 'age' },
35
+ ]
36
+ const data: Array<Person> = [
37
+ { firstName: 'John', age: 40, status: 'pending' },
38
+ { firstName: 'Amy', age: 22, status: 'active' },
39
+ { firstName: 'Kate', age: 31, status: 'active' },
40
+ ]
41
+
42
+ const grid = createSvGrid({
43
+ _features,
44
+ _rowModels: {
45
+ coreRowModel: createCoreRowModel(),
46
+ filteredRowModel: createFilteredRowModel(),
47
+ sortedRowModel: createSortedRowModel(sortFns),
48
+ groupedRowModel: createGroupedRowModel(),
49
+ expandedRowModel: createExpandedRowModel(),
50
+ paginatedRowModel: createPaginatedRowModel(),
51
+ },
52
+ columns,
53
+ data,
54
+ state: {
55
+ columnFilters: [{ id: 'firstName', value: 'a', fn: 'includesString' }],
56
+ grouping: ['status'],
57
+ expanded: { group_status_active: true },
58
+ sorting: [{ id: 'age', desc: false }],
59
+ pagination: { pageIndex: 0, pageSize: 2 },
60
+ },
61
+ })
62
+
63
+ const rows = grid.getRowModel().rows
64
+ expect(rows).toHaveLength(1)
65
+ expect(rows[0]?.id).toContain('group_status_')
66
+ })
67
+
68
+ it('supports row selection and expansion toggles', () => {
69
+ const _features = tableFeatures({
70
+ rowExpandingFeature,
71
+ rowSelectionFeature,
72
+ })
73
+ const columns: Array<ColumnDef<typeof _features, Person>> = [
74
+ { field: 'firstName' },
75
+ ]
76
+ const data: Array<Person> = [
77
+ { firstName: 'Amy', age: 22 },
78
+ ]
79
+ const grid = createSvGrid({
80
+ _features,
81
+ _rowModels: {
82
+ coreRowModel: createCoreRowModel(),
83
+ },
84
+ columns,
85
+ data,
86
+ })
87
+ const row = grid.getRowModel().rows[0]
88
+ expect(row).toBeDefined()
89
+ row?.toggleSelected()
90
+ row?.toggleExpanded()
91
+ expect(row?.getIsSelected()).toBe(true)
92
+ expect(row?.getIsExpanded()).toBe(true)
93
+ })
94
+
95
+ it('supports selector subscriptions with stable shape', () => {
96
+ const _features = tableFeatures({ rowSortingFeature })
97
+ const grid = createSvGrid({
98
+ _features,
99
+ _rowModels: {
100
+ coreRowModel: createCoreRowModel(),
101
+ },
102
+ columns: [{ field: 'firstName' }],
103
+ data: [{ firstName: 'Amy', age: 22 }],
104
+ })
105
+ const selected = subscribeSvGrid(grid, (state) => ({
106
+ sorting: state.sorting,
107
+ pageIndex: state.pagination?.pageIndex ?? 0,
108
+ }))
109
+ expect(selected.current.pageIndex).toBe(0)
110
+ })
111
+
112
+ it('supports active cell movement primitives', () => {
113
+ const _features = tableFeatures({ rowSortingFeature })
114
+ const grid = createSvGrid({
115
+ _features,
116
+ _rowModels: { coreRowModel: createCoreRowModel() },
117
+ columns: [
118
+ { field: 'firstName' },
119
+ { field: 'age' },
120
+ ],
121
+ data: [
122
+ { firstName: 'Amy', age: 22 },
123
+ { firstName: 'John', age: 40 },
124
+ ],
125
+ })
126
+
127
+ grid.moveActiveCell({ rowDelta: 1, colDelta: 1 })
128
+ expect(grid.getState().activeCell.rowIndex).toBe(1)
129
+ expect(grid.getState().activeCell.colIndex).toBe(1)
130
+ })
131
+
132
+ it('supports multi-column sorting clauses', () => {
133
+ const _features = tableFeatures({ rowSortingFeature })
134
+ const grid = createSvGrid({
135
+ _features,
136
+ _rowModels: {
137
+ coreRowModel: createCoreRowModel(),
138
+ sortedRowModel: createSortedRowModel(sortFns),
139
+ },
140
+ columns: [
141
+ { field: 'firstName' },
142
+ { field: 'age', editorType: 'number' },
143
+ ],
144
+ data: [
145
+ { firstName: 'Amy', age: 20 },
146
+ { firstName: 'Amy', age: 30 },
147
+ { firstName: 'Bob', age: 10 },
148
+ ],
149
+ state: { sorting: [{ id: 'firstName', desc: false }, { id: 'age', desc: true }] },
150
+ })
151
+
152
+ const rows = grid.getRowModel().rows
153
+ expect(rows[0]?.original.firstName).toBe('Amy')
154
+ expect(rows[0]?.original.age).toBe(30)
155
+ expect(rows[1]?.original.age).toBe(20)
156
+ })
157
+ })