@svgrid/grid 2.2.32 → 2.2.33
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/dist/DockNodeView.svelte +1 -1
- package/dist/GridFooter.svelte +0 -40
- package/dist/GridMenus.svelte +0 -77
- package/dist/SvDateRangeInput.svelte +1 -1
- package/dist/SvGrid.svelte +2 -25
- package/dist/SvGridChart.svelte +2 -10
- package/dist/SvGridSelect.svelte +0 -2
- package/dist/SvKbd.svelte +1 -1
- package/dist/SvList.svelte +1 -1
- package/dist/SvMenubar.svelte +1 -1
- package/dist/SvMultiSelect.svelte +0 -1
- package/dist/SvOtpInput.svelte +1 -1
- package/dist/SvRichText.svelte +4 -0
- package/dist/SvTour.svelte +4 -0
- package/dist/SvTreeSelect.svelte +0 -2
- package/dist/cdn/{GridMenus-C6ixSGWW.js → GridMenus-B7XhhqdN.js} +2 -4
- package/dist/cdn/{GridMenus-Cyk3qpJ7.js → GridMenus-BxmIvCJh.js} +4 -6
- package/dist/cdn/{SvDateTimePicker-CdqaP61H.js → SvDateTimePicker-o94wfSUa.js} +1 -1
- package/dist/cdn/{SvGridChart-BcLCYvw9.js → SvGridChart-Cr_90pPD.js} +1 -1
- package/dist/cdn/{SvGridChartPanel-DvjwxLvK.js → SvGridChartPanel-ICbxiUvK.js} +4 -4
- package/dist/cdn/{SvGridChartView-PwqI4s02.js → SvGridChartView-Bx42PMvf.js} +2 -2
- package/dist/cdn/{SvGridDropdown-Dh-2ej8j.js → SvGridDropdown-CUOdm7YA.js} +1 -1
- package/dist/cdn/{disclose-version-DoD9AFD_.js → disclose-version-DljhZohK.js} +45 -45
- package/dist/cdn/{src-CgD-wiuS.js → src-erjBRYfX.js} +14 -31
- package/dist/cdn/{src-BgHjWF0Q.js → src-ktbQVOk-.js} +7 -24
- package/dist/cdn/svgrid.js +5 -5
- package/dist/cdn/svgrid.svelte-external.js +1 -1
- package/dist/chart.d.ts +2 -0
- package/dist/chart.js +1 -4
- package/dist/createMenu.svelte.js +0 -1
- package/dist/createPopoverSelect.svelte.d.ts +2 -2
- package/dist/editing.js +1 -1
- package/dist/export-format.js +3 -0
- package/dist/selection.js +0 -1
- package/package.json +3 -2
- package/src/DockNodeView.svelte +1 -1
- package/src/GridFooter.svelte +0 -40
- package/src/GridMenus.svelte +0 -77
- package/src/SvCalendar.test.ts +1 -1
- package/src/SvDateRangeInput.svelte +1 -1
- package/src/SvGrid.controller.svelte.ts +0 -5
- package/src/SvGrid.svelte +2 -25
- package/src/SvGrid.types.ts +0 -1
- package/src/SvGridChart.svelte +2 -10
- package/src/SvGridSelect.svelte +0 -2
- package/src/SvKbd.svelte +1 -1
- package/src/SvList.svelte +1 -1
- package/src/SvMenubar.svelte +1 -1
- package/src/SvMultiSelect.svelte +0 -1
- package/src/SvOtpInput.svelte +1 -1
- package/src/SvRichText.svelte +4 -0
- package/src/SvTour.svelte +4 -0
- package/src/SvTreeSelect.svelte +0 -2
- package/src/ai.test.ts +1 -1
- package/src/build-api.ts +0 -105
- package/src/cell-formatting.test.ts +1 -1
- package/src/cell-render.ts +0 -94
- package/src/chart.ts +1 -2
- package/src/clipboard.ts +0 -102
- package/src/columns.ts +0 -115
- package/src/createMenu.svelte.ts +0 -1
- package/src/editing.ts +2 -105
- package/src/editor-registry.grid.test.ts +0 -2
- package/src/export-format.ts +3 -0
- package/src/features.ts +0 -90
- package/src/keyboard-handlers.coverage.test.ts +1 -1
- package/src/keyboard-handlers.ts +0 -120
- package/src/menus.test.ts +0 -1
- package/src/menus.ts +0 -112
- package/src/new-features.test.ts +3 -1
- package/src/row-drag.test.ts +1 -1
- package/src/row-resize.test.ts +1 -2
- package/src/scroll-sync.test.ts +4 -7
- package/src/scroll-sync.ts +0 -122
- package/src/selection.ts +0 -109
- package/src/server-group-model.test.ts +2 -2
- package/src/summaries.ts +0 -112
- package/src/svgrid.behavior.test.ts +0 -1
- package/src/svgrid.column-reorder.test.ts +0 -8
- package/src/tree-row-model.test.ts +0 -1
package/src/editing.ts
CHANGED
|
@@ -2,126 +2,23 @@
|
|
|
2
2
|
// reading/writing controller state via the `ctx` handle; the reactive core
|
|
3
3
|
// ($state/$derived/$effect) stays in the controller.
|
|
4
4
|
import {
|
|
5
|
-
applyExcelFilter,
|
|
6
|
-
normalizeForFilter,
|
|
7
|
-
createColumnVirtualizer,
|
|
8
|
-
createCoreRowModel,
|
|
9
|
-
createExpandedRowModel,
|
|
10
|
-
createFilteredRowModel,
|
|
11
|
-
createGroupedRowModel,
|
|
12
|
-
createPaginatedRowModel,
|
|
13
|
-
createSvelteVirtualizer,
|
|
14
|
-
createSortedRowModel,
|
|
15
|
-
createSvGrid,
|
|
16
|
-
filterFns,
|
|
17
|
-
getGridCellA11yProps,
|
|
18
|
-
getGridCellDomId,
|
|
19
|
-
getGridHeaderA11yProps,
|
|
20
|
-
getGridRootA11yProps,
|
|
21
|
-
getGridRowA11yProps,
|
|
22
5
|
parseEditorValue,
|
|
23
|
-
normalizeEditorOptions,
|
|
24
|
-
sortFns,
|
|
25
|
-
tableFeatures,
|
|
26
|
-
rowSortingFeature,
|
|
27
|
-
columnFilteringFeature,
|
|
28
|
-
columnGroupingFeature,
|
|
29
6
|
type CellContext,
|
|
30
|
-
type EditorContext,
|
|
31
|
-
type CellEditorOption,
|
|
32
7
|
type CellEditorType,
|
|
33
|
-
type CellFormatter,
|
|
34
|
-
type CellFormatConfig,
|
|
35
8
|
type Column,
|
|
36
|
-
type ColumnDef,
|
|
37
9
|
type Row,
|
|
38
10
|
type RowData,
|
|
39
|
-
type SvGridApi,
|
|
40
11
|
type TableFeatures,
|
|
41
12
|
} from "./index";
|
|
42
13
|
import "./sv-grid-scrollbar";
|
|
43
|
-
import
|
|
44
|
-
import { getKeyboardIntent, getNextActiveCell } from "./keyboard";
|
|
14
|
+
import { getNextActiveCell } from "./keyboard";
|
|
45
15
|
import {
|
|
46
|
-
formatNumericWithConfig,
|
|
47
|
-
getDateFormatter,
|
|
48
|
-
resolveDatePattern,
|
|
49
|
-
} from "./cell-formatting";
|
|
50
|
-
import {
|
|
51
|
-
RenderSnippetConfig,
|
|
52
|
-
RenderComponentConfig,
|
|
53
|
-
} from "./render-component";
|
|
54
|
-
import { buildFillPattern } from "./fill-patterns";
|
|
55
|
-
import { buildSparkline, toSparklineValues } from "./sparkline";
|
|
56
|
-
import {
|
|
57
|
-
resolveCellFormat,
|
|
58
|
-
computeColumnStat,
|
|
59
|
-
formatsNeedingStats,
|
|
60
|
-
type ColumnStat,
|
|
61
|
-
type ResolvedCellFormat,
|
|
62
|
-
} from "./conditional-formatting";
|
|
63
|
-
import SvGridDropdown from "./SvGridDropdown.svelte";
|
|
64
|
-
import type {
|
|
65
|
-
Props,
|
|
66
|
-
SelectionPoint,
|
|
67
|
-
SelectionRange,
|
|
68
|
-
CellEditState,
|
|
69
|
-
FilterOperator,
|
|
70
|
-
FilterOption,
|
|
71
|
-
MenuPosition,
|
|
72
|
-
} from "./SvGrid.types";
|
|
73
|
-
import {
|
|
74
|
-
cfTextStyle,
|
|
75
|
-
fmtStat,
|
|
76
16
|
getCellKey,
|
|
77
|
-
resolveClassList,
|
|
78
|
-
toDateInputValue,
|
|
79
|
-
toDateTimeLocalInputValue,
|
|
80
|
-
getEditableInputValue,
|
|
81
|
-
getEditorInputType,
|
|
82
17
|
toValueArray,
|
|
83
|
-
getOptionLabel,
|
|
84
|
-
getOptionColor,
|
|
85
|
-
colorfulChipStyle,
|
|
86
|
-
getEditorClass,
|
|
87
|
-
asDate,
|
|
88
|
-
clampMenuX,
|
|
89
|
-
cssEscape,
|
|
90
|
-
rawToNumber,
|
|
91
|
-
formatFacetNumber,
|
|
92
|
-
formatFacetDate,
|
|
93
18
|
} from "./SvGrid.helpers";
|
|
94
|
-
import { createSelection } from "./selection";
|
|
95
|
-
import { createColumns } from "./columns";
|
|
96
|
-
import { createGridApi } from "./build-api";
|
|
97
|
-
import { createClipboard } from "./clipboard";
|
|
98
|
-
import {
|
|
99
|
-
filterOperatorOptions,
|
|
100
|
-
fallbackOperatorOption,
|
|
101
|
-
TEXT_OPERATORS,
|
|
102
|
-
NUMBER_OPERATORS,
|
|
103
|
-
DATE_OPERATORS,
|
|
104
|
-
CHECKBOX_OPERATORS,
|
|
105
|
-
operatorOption,
|
|
106
|
-
operatorsForColumn,
|
|
107
|
-
defaultOperatorFor,
|
|
108
|
-
operatorLabelFor,
|
|
109
|
-
} from "./filter-operators";
|
|
110
|
-
import {
|
|
111
|
-
type FacetBucket,
|
|
112
|
-
isBucketableColumn,
|
|
113
|
-
buildBuckets,
|
|
114
|
-
isInBucket,
|
|
115
|
-
} from "./facet-buckets";
|
|
116
19
|
import {
|
|
117
20
|
getColumnBaseValue,
|
|
118
21
|
isGroupRow,
|
|
119
|
-
toolPanelHeaderLabel,
|
|
120
|
-
formatSummaryNumeric,
|
|
121
|
-
getColumnAlign,
|
|
122
|
-
getPinnedCellValue,
|
|
123
|
-
getColumnAccessorValue,
|
|
124
|
-
columnDefMatchesId,
|
|
125
22
|
} from "./cell-values";
|
|
126
23
|
|
|
127
24
|
type HistoryStep = {
|
|
@@ -224,7 +121,7 @@ export function createEditing<
|
|
|
224
121
|
) {
|
|
225
122
|
return false;
|
|
226
123
|
}
|
|
227
|
-
if (editorType === "number" && !/[0-9
|
|
124
|
+
if (editorType === "number" && !/[0-9.+-]/.test(char)) return false;
|
|
228
125
|
ctx.editorSelectAll = false;
|
|
229
126
|
ctx.editingCell = {
|
|
230
127
|
rowId: row.id,
|
|
@@ -73,7 +73,6 @@ afterEach(() => {
|
|
|
73
73
|
|
|
74
74
|
describe('registry wiring in SvGrid', () => {
|
|
75
75
|
it('mounts a registered component when a custom-editorType cell edits', async () => {
|
|
76
|
-
let committed: unknown = undefined
|
|
77
76
|
registerCellEditor('stars', {
|
|
78
77
|
component: SvRating,
|
|
79
78
|
props: (ctx) => ({
|
|
@@ -90,7 +89,6 @@ describe('registry wiring in SvGrid', () => {
|
|
|
90
89
|
// The registered SvRating editor is mounted in the editing overlay.
|
|
91
90
|
const rating = target.querySelector('.sv-rating')
|
|
92
91
|
expect(rating).not.toBeNull()
|
|
93
|
-
void committed
|
|
94
92
|
} finally {
|
|
95
93
|
destroy()
|
|
96
94
|
}
|
package/src/export-format.ts
CHANGED
|
@@ -521,6 +521,9 @@ const XML_ESCAPE: Record<string, string> = {
|
|
|
521
521
|
}
|
|
522
522
|
function xmlText(value: unknown): string {
|
|
523
523
|
const s = value == null ? '' : value instanceof Date ? value.toISOString() : String(value)
|
|
524
|
+
// Stripping control characters is the point: XML 1.0 forbids them outright,
|
|
525
|
+
// so a stray \x00 from a data source would produce an unopenable file.
|
|
526
|
+
// eslint-disable-next-line no-control-regex
|
|
524
527
|
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, '').replace(/[&<>"']/g, (c) => XML_ESCAPE[c]!)
|
|
525
528
|
}
|
|
526
529
|
/** Coerce a field name into a valid XML element name. */
|
package/src/features.ts
CHANGED
|
@@ -2,104 +2,14 @@
|
|
|
2
2
|
// reading/writing controller state via the `ctx` handle; the reactive core
|
|
3
3
|
// ($state/$derived/$effect) stays in the controller.
|
|
4
4
|
import {
|
|
5
|
-
applyExcelFilter,
|
|
6
|
-
normalizeForFilter,
|
|
7
|
-
createColumnVirtualizer,
|
|
8
|
-
createCoreRowModel,
|
|
9
|
-
createExpandedRowModel,
|
|
10
|
-
createFilteredRowModel,
|
|
11
|
-
createGroupedRowModel,
|
|
12
|
-
createSvelteVirtualizer,
|
|
13
|
-
createSortedRowModel,
|
|
14
|
-
createSvGrid,
|
|
15
|
-
getGridCellDomId,
|
|
16
|
-
sortFns,
|
|
17
5
|
tableFeatures,
|
|
18
6
|
rowSortingFeature,
|
|
19
7
|
columnFilteringFeature,
|
|
20
8
|
columnGroupingFeature,
|
|
21
|
-
type CellEditorOption,
|
|
22
|
-
type Column,
|
|
23
|
-
type ColumnDef,
|
|
24
|
-
type Row,
|
|
25
9
|
type RowData,
|
|
26
10
|
type TableFeatures,
|
|
27
11
|
} from "./index";
|
|
28
12
|
import "./sv-grid-scrollbar";
|
|
29
|
-
import {
|
|
30
|
-
computeColumnStat,
|
|
31
|
-
formatsNeedingStats,
|
|
32
|
-
type ColumnStat,
|
|
33
|
-
} from "./conditional-formatting";
|
|
34
|
-
import SvGridDropdown from "./SvGridDropdown.svelte";
|
|
35
|
-
import type {
|
|
36
|
-
Props,
|
|
37
|
-
SelectionRange,
|
|
38
|
-
CellEditState,
|
|
39
|
-
FilterOperator,
|
|
40
|
-
MenuPosition,
|
|
41
|
-
} from "./SvGrid.types";
|
|
42
|
-
import {
|
|
43
|
-
rawToNumber,
|
|
44
|
-
} from "./SvGrid.helpers";
|
|
45
|
-
import {
|
|
46
|
-
createScrollSync,
|
|
47
|
-
} from "./scroll-sync";
|
|
48
|
-
import {
|
|
49
|
-
createKeyboard,
|
|
50
|
-
} from "./keyboard-handlers";
|
|
51
|
-
import {
|
|
52
|
-
createSummaries,
|
|
53
|
-
} from "./summaries";
|
|
54
|
-
import {
|
|
55
|
-
createMenus,
|
|
56
|
-
} from "./menus";
|
|
57
|
-
import {
|
|
58
|
-
createCellRender,
|
|
59
|
-
} from "./cell-render";
|
|
60
|
-
import {
|
|
61
|
-
createEditing,
|
|
62
|
-
} from "./editing";
|
|
63
|
-
import {
|
|
64
|
-
createSelection,
|
|
65
|
-
} from "./selection";
|
|
66
|
-
import {
|
|
67
|
-
createColumns,
|
|
68
|
-
} from "./columns";
|
|
69
|
-
import {
|
|
70
|
-
createGridApi,
|
|
71
|
-
} from "./build-api";
|
|
72
|
-
import {
|
|
73
|
-
createClipboard,
|
|
74
|
-
} from "./clipboard";
|
|
75
|
-
import {
|
|
76
|
-
filterOperatorOptions,
|
|
77
|
-
fallbackOperatorOption,
|
|
78
|
-
TEXT_OPERATORS,
|
|
79
|
-
NUMBER_OPERATORS,
|
|
80
|
-
DATE_OPERATORS,
|
|
81
|
-
CHECKBOX_OPERATORS,
|
|
82
|
-
operatorOption,
|
|
83
|
-
operatorsForColumn,
|
|
84
|
-
defaultOperatorFor,
|
|
85
|
-
operatorLabelFor,
|
|
86
|
-
} from "./filter-operators";
|
|
87
|
-
import {
|
|
88
|
-
type FacetBucket,
|
|
89
|
-
isBucketableColumn,
|
|
90
|
-
buildBuckets,
|
|
91
|
-
isInBucket,
|
|
92
|
-
} from "./facet-buckets";
|
|
93
|
-
import {
|
|
94
|
-
getColumnBaseValue,
|
|
95
|
-
isGroupRow,
|
|
96
|
-
toolPanelHeaderLabel,
|
|
97
|
-
formatSummaryNumeric,
|
|
98
|
-
getColumnAlign,
|
|
99
|
-
getPinnedCellValue,
|
|
100
|
-
getColumnAccessorValue,
|
|
101
|
-
columnDefMatchesId,
|
|
102
|
-
} from "./cell-values";
|
|
103
13
|
|
|
104
14
|
export function createFeatures<
|
|
105
15
|
TFeatures extends TableFeatures = TableFeatures,
|
package/src/keyboard-handlers.ts
CHANGED
|
@@ -2,130 +2,10 @@
|
|
|
2
2
|
// reading/writing controller state via the `ctx` handle; the reactive core
|
|
3
3
|
// ($state/$derived/$effect) stays in the controller.
|
|
4
4
|
import {
|
|
5
|
-
applyExcelFilter,
|
|
6
|
-
normalizeForFilter,
|
|
7
|
-
createColumnVirtualizer,
|
|
8
|
-
createCoreRowModel,
|
|
9
|
-
createExpandedRowModel,
|
|
10
|
-
createFilteredRowModel,
|
|
11
|
-
createGroupedRowModel,
|
|
12
|
-
createPaginatedRowModel,
|
|
13
|
-
createSvelteVirtualizer,
|
|
14
|
-
createSortedRowModel,
|
|
15
|
-
createSvGrid,
|
|
16
|
-
filterFns,
|
|
17
|
-
getGridCellA11yProps,
|
|
18
|
-
getGridCellDomId,
|
|
19
|
-
getGridHeaderA11yProps,
|
|
20
|
-
getGridRootA11yProps,
|
|
21
|
-
getGridRowA11yProps,
|
|
22
|
-
parseEditorValue,
|
|
23
|
-
normalizeEditorOptions,
|
|
24
|
-
sortFns,
|
|
25
|
-
tableFeatures,
|
|
26
|
-
rowSortingFeature,
|
|
27
|
-
columnFilteringFeature,
|
|
28
|
-
columnGroupingFeature,
|
|
29
|
-
type CellContext,
|
|
30
|
-
type EditorContext,
|
|
31
|
-
type CellEditorOption,
|
|
32
|
-
type CellEditorType,
|
|
33
|
-
type CellFormatter,
|
|
34
|
-
type CellFormatConfig,
|
|
35
|
-
type Column,
|
|
36
|
-
type ColumnDef,
|
|
37
|
-
type Row,
|
|
38
5
|
type RowData,
|
|
39
|
-
type SvGridApi,
|
|
40
6
|
type TableFeatures,
|
|
41
7
|
} from "./index";
|
|
42
8
|
import "./sv-grid-scrollbar";
|
|
43
|
-
import type { Snippet } from "svelte";
|
|
44
|
-
import {
|
|
45
|
-
formatNumericWithConfig,
|
|
46
|
-
getDateFormatter,
|
|
47
|
-
resolveDatePattern,
|
|
48
|
-
} from "./cell-formatting";
|
|
49
|
-
import {
|
|
50
|
-
RenderSnippetConfig,
|
|
51
|
-
RenderComponentConfig,
|
|
52
|
-
} from "./render-component";
|
|
53
|
-
import { buildFillPattern } from "./fill-patterns";
|
|
54
|
-
import { buildSparkline, toSparklineValues } from "./sparkline";
|
|
55
|
-
import {
|
|
56
|
-
resolveCellFormat,
|
|
57
|
-
computeColumnStat,
|
|
58
|
-
formatsNeedingStats,
|
|
59
|
-
type ColumnStat,
|
|
60
|
-
type ResolvedCellFormat,
|
|
61
|
-
} from "./conditional-formatting";
|
|
62
|
-
import SvGridDropdown from "./SvGridDropdown.svelte";
|
|
63
|
-
import type {
|
|
64
|
-
Props,
|
|
65
|
-
SelectionPoint,
|
|
66
|
-
SelectionRange,
|
|
67
|
-
CellEditState,
|
|
68
|
-
FilterOperator,
|
|
69
|
-
FilterOption,
|
|
70
|
-
MenuPosition,
|
|
71
|
-
} from "./SvGrid.types";
|
|
72
|
-
import {
|
|
73
|
-
cfTextStyle,
|
|
74
|
-
fmtStat,
|
|
75
|
-
getCellKey,
|
|
76
|
-
resolveClassList,
|
|
77
|
-
toDateInputValue,
|
|
78
|
-
toDateTimeLocalInputValue,
|
|
79
|
-
getEditableInputValue,
|
|
80
|
-
getEditorInputType,
|
|
81
|
-
toValueArray,
|
|
82
|
-
getOptionLabel,
|
|
83
|
-
getOptionColor,
|
|
84
|
-
colorfulChipStyle,
|
|
85
|
-
getEditorClass,
|
|
86
|
-
asDate,
|
|
87
|
-
clampMenuX,
|
|
88
|
-
cssEscape,
|
|
89
|
-
rawToNumber,
|
|
90
|
-
formatFacetNumber,
|
|
91
|
-
formatFacetDate,
|
|
92
|
-
} from "./SvGrid.helpers";
|
|
93
|
-
import { createSummaries } from "./summaries";
|
|
94
|
-
import { createMenus } from "./menus";
|
|
95
|
-
import { createCellRender } from "./cell-render";
|
|
96
|
-
import { createEditing } from "./editing";
|
|
97
|
-
import { createSelection } from "./selection";
|
|
98
|
-
import { createColumns } from "./columns";
|
|
99
|
-
import { createGridApi } from "./build-api";
|
|
100
|
-
import { createClipboard } from "./clipboard";
|
|
101
|
-
import {
|
|
102
|
-
filterOperatorOptions,
|
|
103
|
-
fallbackOperatorOption,
|
|
104
|
-
TEXT_OPERATORS,
|
|
105
|
-
NUMBER_OPERATORS,
|
|
106
|
-
DATE_OPERATORS,
|
|
107
|
-
CHECKBOX_OPERATORS,
|
|
108
|
-
operatorOption,
|
|
109
|
-
operatorsForColumn,
|
|
110
|
-
defaultOperatorFor,
|
|
111
|
-
operatorLabelFor,
|
|
112
|
-
} from "./filter-operators";
|
|
113
|
-
import {
|
|
114
|
-
type FacetBucket,
|
|
115
|
-
isBucketableColumn,
|
|
116
|
-
buildBuckets,
|
|
117
|
-
isInBucket,
|
|
118
|
-
} from "./facet-buckets";
|
|
119
|
-
import {
|
|
120
|
-
getColumnBaseValue,
|
|
121
|
-
isGroupRow,
|
|
122
|
-
toolPanelHeaderLabel,
|
|
123
|
-
formatSummaryNumeric,
|
|
124
|
-
getColumnAlign,
|
|
125
|
-
getPinnedCellValue,
|
|
126
|
-
getColumnAccessorValue,
|
|
127
|
-
columnDefMatchesId,
|
|
128
|
-
} from "./cell-values";
|
|
129
9
|
|
|
130
10
|
import { getKeyboardIntent, getNextActiveCell } from "./keyboard";
|
|
131
11
|
|
package/src/menus.test.ts
CHANGED
|
@@ -597,7 +597,6 @@ describe('createMenus - contextMenuItems', () => {
|
|
|
597
597
|
internalData: [rowA, rowB],
|
|
598
598
|
contextMenuFor: { rowIndex: 1, colIndex: 0, columnId: 'name', rowId: 'r1', row: rowB },
|
|
599
599
|
}))
|
|
600
|
-
const ctx2 = (m2 as any)
|
|
601
600
|
const removeItem = m2.contextMenuItems().find((i) => i.key === 'remove_row')!
|
|
602
601
|
removeItem.run!()
|
|
603
602
|
})
|
package/src/menus.ts
CHANGED
|
@@ -2,131 +2,19 @@
|
|
|
2
2
|
// reading/writing controller state via the `ctx` handle; the reactive core
|
|
3
3
|
// ($state/$derived/$effect) stays in the controller.
|
|
4
4
|
import {
|
|
5
|
-
applyExcelFilter,
|
|
6
|
-
normalizeForFilter,
|
|
7
|
-
createColumnVirtualizer,
|
|
8
|
-
createCoreRowModel,
|
|
9
|
-
createExpandedRowModel,
|
|
10
|
-
createFilteredRowModel,
|
|
11
|
-
createGroupedRowModel,
|
|
12
|
-
createPaginatedRowModel,
|
|
13
|
-
createSvelteVirtualizer,
|
|
14
|
-
createSortedRowModel,
|
|
15
|
-
createSvGrid,
|
|
16
|
-
filterFns,
|
|
17
|
-
getGridCellA11yProps,
|
|
18
|
-
getGridCellDomId,
|
|
19
|
-
getGridHeaderA11yProps,
|
|
20
|
-
getGridRootA11yProps,
|
|
21
|
-
getGridRowA11yProps,
|
|
22
|
-
parseEditorValue,
|
|
23
|
-
normalizeEditorOptions,
|
|
24
|
-
sortFns,
|
|
25
|
-
tableFeatures,
|
|
26
|
-
rowSortingFeature,
|
|
27
|
-
columnFilteringFeature,
|
|
28
|
-
columnGroupingFeature,
|
|
29
|
-
type CellContext,
|
|
30
|
-
type EditorContext,
|
|
31
|
-
type CellEditorOption,
|
|
32
|
-
type CellEditorType,
|
|
33
|
-
type CellFormatter,
|
|
34
|
-
type CellFormatConfig,
|
|
35
|
-
type Column,
|
|
36
|
-
type ColumnDef,
|
|
37
|
-
type Row,
|
|
38
5
|
type RowData,
|
|
39
|
-
type SvGridApi,
|
|
40
6
|
type TableFeatures,
|
|
41
7
|
} from "./index";
|
|
42
8
|
import "./sv-grid-scrollbar";
|
|
43
9
|
import { untrack } from "svelte";
|
|
44
|
-
import type { Snippet } from "svelte";
|
|
45
|
-
import { getKeyboardIntent, getNextActiveCell } from "./keyboard";
|
|
46
|
-
import {
|
|
47
|
-
formatNumericWithConfig,
|
|
48
|
-
getDateFormatter,
|
|
49
|
-
resolveDatePattern,
|
|
50
|
-
} from "./cell-formatting";
|
|
51
|
-
import {
|
|
52
|
-
RenderSnippetConfig,
|
|
53
|
-
RenderComponentConfig,
|
|
54
|
-
} from "./render-component";
|
|
55
|
-
import { buildFillPattern } from "./fill-patterns";
|
|
56
|
-
import { buildSparkline, toSparklineValues } from "./sparkline";
|
|
57
|
-
import {
|
|
58
|
-
resolveCellFormat,
|
|
59
|
-
computeColumnStat,
|
|
60
|
-
formatsNeedingStats,
|
|
61
|
-
type ColumnStat,
|
|
62
|
-
type ResolvedCellFormat,
|
|
63
|
-
} from "./conditional-formatting";
|
|
64
|
-
import SvGridDropdown from "./SvGridDropdown.svelte";
|
|
65
10
|
import type {
|
|
66
|
-
Props,
|
|
67
|
-
SelectionPoint,
|
|
68
|
-
SelectionRange,
|
|
69
|
-
CellEditState,
|
|
70
11
|
FilterOperator,
|
|
71
|
-
FilterOption,
|
|
72
|
-
MenuPosition,
|
|
73
12
|
} from "./SvGrid.types";
|
|
74
13
|
import {
|
|
75
|
-
cfTextStyle,
|
|
76
|
-
fmtStat,
|
|
77
|
-
getCellKey,
|
|
78
|
-
resolveClassList,
|
|
79
|
-
toDateInputValue,
|
|
80
|
-
toDateTimeLocalInputValue,
|
|
81
|
-
getEditableInputValue,
|
|
82
|
-
getEditorInputType,
|
|
83
|
-
toValueArray,
|
|
84
|
-
getOptionLabel,
|
|
85
|
-
getOptionColor,
|
|
86
|
-
colorfulChipStyle,
|
|
87
|
-
getEditorClass,
|
|
88
|
-
asDate,
|
|
89
14
|
clampMenuX,
|
|
90
15
|
cssEscape,
|
|
91
|
-
rawToNumber,
|
|
92
|
-
formatFacetNumber,
|
|
93
|
-
formatFacetDate,
|
|
94
16
|
} from "./SvGrid.helpers";
|
|
95
|
-
import { createCellRender } from "./cell-render";
|
|
96
|
-
import { createEditing } from "./editing";
|
|
97
|
-
import { createSelection } from "./selection";
|
|
98
|
-
import { createColumns } from "./columns";
|
|
99
|
-
import { createGridApi } from "./build-api";
|
|
100
|
-
import { createClipboard } from "./clipboard";
|
|
101
|
-
import {
|
|
102
|
-
filterOperatorOptions,
|
|
103
|
-
fallbackOperatorOption,
|
|
104
|
-
TEXT_OPERATORS,
|
|
105
|
-
NUMBER_OPERATORS,
|
|
106
|
-
DATE_OPERATORS,
|
|
107
|
-
CHECKBOX_OPERATORS,
|
|
108
|
-
operatorOption,
|
|
109
|
-
operatorsForColumn,
|
|
110
|
-
defaultOperatorFor,
|
|
111
|
-
operatorLabelFor,
|
|
112
|
-
} from "./filter-operators";
|
|
113
|
-
import {
|
|
114
|
-
type FacetBucket,
|
|
115
|
-
isBucketableColumn,
|
|
116
|
-
buildBuckets,
|
|
117
|
-
isInBucket,
|
|
118
|
-
} from "./facet-buckets";
|
|
119
17
|
import { splitInTokens, joinInTokens } from "./filtering/excel-filters";
|
|
120
|
-
import {
|
|
121
|
-
getColumnBaseValue,
|
|
122
|
-
isGroupRow,
|
|
123
|
-
toolPanelHeaderLabel,
|
|
124
|
-
formatSummaryNumeric,
|
|
125
|
-
getColumnAlign,
|
|
126
|
-
getPinnedCellValue,
|
|
127
|
-
getColumnAccessorValue,
|
|
128
|
-
columnDefMatchesId,
|
|
129
|
-
} from "./cell-values";
|
|
130
18
|
|
|
131
19
|
export function createMenus<
|
|
132
20
|
TFeatures extends TableFeatures = TableFeatures,
|
package/src/new-features.test.ts
CHANGED
|
@@ -58,7 +58,8 @@ describe('createSvGrid - getRowId', () => {
|
|
|
58
58
|
|
|
59
59
|
it('passes the row index to getRowId', () => {
|
|
60
60
|
const seen: Array<{ id: string; index: number }> = []
|
|
61
|
-
|
|
61
|
+
// The row model is lazy, so it has to be read for getRowId to run at all.
|
|
62
|
+
const rows = createSvGrid<typeof features, Row>({
|
|
62
63
|
_features: features,
|
|
63
64
|
_rowModels: { coreRowModel: createCoreRowModel<Row>() },
|
|
64
65
|
columns,
|
|
@@ -68,6 +69,7 @@ describe('createSvGrid - getRowId', () => {
|
|
|
68
69
|
return row.id
|
|
69
70
|
},
|
|
70
71
|
}).getRowModel().rows
|
|
72
|
+
expect(rows).toHaveLength(data.length)
|
|
71
73
|
expect(seen).toEqual([
|
|
72
74
|
{ id: 'ada', index: 0 },
|
|
73
75
|
{ id: 'linus', index: 1 },
|
package/src/row-drag.test.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Because the bus is shared, we can create TWO fake ctxs (two grids) and drive
|
|
7
7
|
* a genuine grid-to-grid move without mounting anything.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
10
10
|
import { createRowDrag, rowDropZone } from './row-drag'
|
|
11
11
|
|
|
12
12
|
type AnyCtx = Record<string, any>
|
package/src/row-resize.test.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import { rowResize } from './row-resize'
|
|
3
|
-
import type { RowResizeOptions } from './row-resize'
|
|
4
3
|
|
|
5
4
|
const STRIP_CLASS = 'sv-grid-row-resize-handle'
|
|
6
5
|
|
|
@@ -247,7 +246,7 @@ describe('rowResize - drag', () => {
|
|
|
247
246
|
})
|
|
248
247
|
|
|
249
248
|
it('ignores pointermove / pointerup when no drag is active', () => {
|
|
250
|
-
const { host
|
|
249
|
+
const { host } = buildGrid([{ rowIndex: 0 }])
|
|
251
250
|
track(host)
|
|
252
251
|
const onResize = vi.fn()
|
|
253
252
|
const onResizeMove = vi.fn()
|
package/src/scroll-sync.test.ts
CHANGED
|
@@ -102,7 +102,7 @@ describe('showTooltipFor / hideTooltip', () => {
|
|
|
102
102
|
})
|
|
103
103
|
|
|
104
104
|
it('clears a pending timer before scheduling a new tooltip', () => {
|
|
105
|
-
const {
|
|
105
|
+
const { ss } = syncFor()
|
|
106
106
|
const clearSpy = vi.spyOn(window, 'clearTimeout')
|
|
107
107
|
const el = anchorEl({ left: 10, right: 30, top: 10, bottom: 30 })
|
|
108
108
|
ss.showTooltipFor(el, 'first')
|
|
@@ -204,13 +204,10 @@ describe('scheduleScrollSync / flushScheduledScrollSync', () => {
|
|
|
204
204
|
})
|
|
205
205
|
|
|
206
206
|
describe('onBodyScroll', () => {
|
|
207
|
-
let rafCb: FrameRequestCallback | null = null
|
|
208
207
|
beforeEach(() => {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return 7
|
|
213
|
-
})
|
|
208
|
+
// These tests assert what happens BEFORE the frame runs, so the stub just
|
|
209
|
+
// hands back a handle and never invokes the callback.
|
|
210
|
+
vi.stubGlobal('requestAnimationFrame', () => 7)
|
|
214
211
|
})
|
|
215
212
|
afterEach(() => {
|
|
216
213
|
vi.unstubAllGlobals()
|