@svgrid/grid 2.2.32 → 2.2.34
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 +46 -47
- package/dist/GridMenus.svelte +0 -77
- package/dist/SvDateRangeInput.svelte +1 -1
- package/dist/SvGrid.css +10 -0
- 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-Cyk3qpJ7.js → GridMenus-T-bZNprc.js} +153 -152
- package/dist/cdn/{GridMenus-C6ixSGWW.js → GridMenus-oQYElQll.js} +5 -7
- package/dist/cdn/{SvDateTimePicker-ClqtVIj3.js → SvDateTimePicker-CHnUkWcH.js} +163 -163
- package/dist/cdn/{SvDateTimePicker-CdqaP61H.js → SvDateTimePicker-CRQH_U7E.js} +570 -553
- package/dist/cdn/{SvGridChart-BhnFdLd0.js → SvGridChart-BEJmNNx9.js} +1 -1
- package/dist/cdn/{SvGridChart-BcLCYvw9.js → SvGridChart-BwVos976.js} +27 -20
- package/dist/cdn/{SvGridChartPanel-Cmx9DHAS.js → SvGridChartPanel-BOknOkrP.js} +2 -2
- package/dist/cdn/{SvGridChartPanel-DvjwxLvK.js → SvGridChartPanel-D2PjII4O.js} +22 -14
- package/dist/cdn/{SvGridChartView-PwqI4s02.js → SvGridChartView-00LPUHL1.js} +3 -3
- package/dist/cdn/{SvGridChartView-B40DTJSX.js → SvGridChartView-BhUEJ5ki.js} +2 -2
- package/dist/cdn/{SvGridDropdown-Dh-2ej8j.js → SvGridDropdown-D13MtJ2j.js} +5 -4
- package/dist/cdn/{chart-T1usDN0o.js → chart-i4XcXyHJ.js} +12 -10
- package/dist/cdn/disclose-version-Dr7rEVv-.js +2866 -0
- package/dist/cdn/{export-format-JT5pWVT8.js → export-format-Cv1Dll6k.js} +66 -245
- package/dist/cdn/{src-BgHjWF0Q.js → src-72QTH8lh.js} +9006 -8811
- package/dist/cdn/{src-CgD-wiuS.js → src-Cm7C_WOZ.js} +9206 -8927
- package/dist/cdn/svgrid.js +9 -9
- package/dist/cdn/svgrid.svelte-external.js +8 -8
- package/dist/chart.d.ts +2 -0
- package/dist/chart.js +1 -4
- package/dist/columns.js +9 -2
- 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 +46 -47
- 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.css +10 -0
- 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 +7 -117
- 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/svgrid.footer-pagesize.svelte.test.ts +86 -0
- package/src/tree-row-model.test.ts +0 -1
- package/dist/cdn/disclose-version-DoD9AFD_.js +0 -2958
package/src/chart.ts
CHANGED
|
@@ -38,7 +38,6 @@ export type SeriesOverlay = 'linear' | `sma:${number}` | `ema:${number}`
|
|
|
38
38
|
export type SeriesPattern = 'solid' | 'stripe' | 'crosshatch' | 'dots' | 'diagonal'
|
|
39
39
|
/** Cycle used when `ChartSpec.patternFallback` is true and a series has no
|
|
40
40
|
* explicit `pattern` set. Skips `'solid'` so every series gets a texture. */
|
|
41
|
-
const PATTERN_CYCLE: SeriesPattern[] = ['stripe', 'crosshatch', 'dots', 'diagonal']
|
|
42
41
|
|
|
43
42
|
export type ChartSeries = {
|
|
44
43
|
label: string
|
|
@@ -2254,7 +2253,7 @@ export function rowsToChartSpec<T extends Record<string, unknown>>(
|
|
|
2254
2253
|
entries.reduce((sum, e) => sum + (Number.isFinite(e.values[i]!) ? e.values[i]! : 0), 0),
|
|
2255
2254
|
)
|
|
2256
2255
|
const sort = opts.sort ?? (opts.topN ? 'value-desc' : 'none')
|
|
2257
|
-
|
|
2256
|
+
const order = categories.map((_, i) => i)
|
|
2258
2257
|
if (sort === 'value-desc') order.sort((a, b) => totals[b]! - totals[a]!)
|
|
2259
2258
|
else if (sort === 'value-asc') order.sort((a, b) => totals[a]! - totals[b]!)
|
|
2260
2259
|
else if (sort === 'category') order.sort((a, b) => categories[a]!.localeCompare(categories[b]!))
|
package/src/clipboard.ts
CHANGED
|
@@ -2,122 +2,20 @@
|
|
|
2
2
|
// that read/write 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
|
-
type CellContext,
|
|
30
|
-
type EditorContext,
|
|
31
|
-
type CellEditorOption,
|
|
32
6
|
type CellEditorType,
|
|
33
|
-
type CellFormatter,
|
|
34
|
-
type CellFormatConfig,
|
|
35
|
-
type Column,
|
|
36
|
-
type ColumnDef,
|
|
37
|
-
type Row,
|
|
38
7
|
type RowData,
|
|
39
|
-
type SvGridApi,
|
|
40
8
|
type TableFeatures,
|
|
41
9
|
} from "./index";
|
|
42
10
|
import "./sv-grid-scrollbar";
|
|
43
|
-
import type { Snippet } from "svelte";
|
|
44
|
-
import { getKeyboardIntent, getNextActiveCell } from "./keyboard";
|
|
45
|
-
import {
|
|
46
|
-
formatNumericWithConfig,
|
|
47
|
-
getDateFormatter,
|
|
48
|
-
resolveDatePattern,
|
|
49
|
-
} from "./cell-formatting";
|
|
50
|
-
import {
|
|
51
|
-
RenderSnippetConfig,
|
|
52
|
-
RenderComponentConfig,
|
|
53
|
-
} from "./render-component";
|
|
54
11
|
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
12
|
import {
|
|
74
|
-
cfTextStyle,
|
|
75
|
-
fmtStat,
|
|
76
13
|
getCellKey,
|
|
77
|
-
resolveClassList,
|
|
78
|
-
toDateInputValue,
|
|
79
|
-
toDateTimeLocalInputValue,
|
|
80
|
-
getEditableInputValue,
|
|
81
|
-
getEditorInputType,
|
|
82
|
-
toValueArray,
|
|
83
|
-
getOptionLabel,
|
|
84
|
-
getOptionColor,
|
|
85
|
-
colorfulChipStyle,
|
|
86
|
-
getEditorClass,
|
|
87
|
-
asDate,
|
|
88
|
-
clampMenuX,
|
|
89
|
-
cssEscape,
|
|
90
|
-
rawToNumber,
|
|
91
|
-
formatFacetNumber,
|
|
92
|
-
formatFacetDate,
|
|
93
14
|
} from "./SvGrid.helpers";
|
|
94
|
-
import {
|
|
95
|
-
filterOperatorOptions,
|
|
96
|
-
fallbackOperatorOption,
|
|
97
|
-
TEXT_OPERATORS,
|
|
98
|
-
NUMBER_OPERATORS,
|
|
99
|
-
DATE_OPERATORS,
|
|
100
|
-
CHECKBOX_OPERATORS,
|
|
101
|
-
operatorOption,
|
|
102
|
-
operatorsForColumn,
|
|
103
|
-
defaultOperatorFor,
|
|
104
|
-
operatorLabelFor,
|
|
105
|
-
} from "./filter-operators";
|
|
106
|
-
import {
|
|
107
|
-
type FacetBucket,
|
|
108
|
-
isBucketableColumn,
|
|
109
|
-
buildBuckets,
|
|
110
|
-
isInBucket,
|
|
111
|
-
} from "./facet-buckets";
|
|
112
15
|
import {
|
|
113
16
|
getColumnBaseValue,
|
|
114
17
|
isGroupRow,
|
|
115
18
|
toolPanelHeaderLabel,
|
|
116
|
-
formatSummaryNumeric,
|
|
117
|
-
getColumnAlign,
|
|
118
|
-
getPinnedCellValue,
|
|
119
|
-
getColumnAccessorValue,
|
|
120
|
-
columnDefMatchesId,
|
|
121
19
|
} from "./cell-values";
|
|
122
20
|
|
|
123
21
|
export function createClipboard<
|
package/src/columns.ts
CHANGED
|
@@ -2,125 +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 { getKeyboardIntent, getNextActiveCell } from "./keyboard";
|
|
45
|
-
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
|
-
getCellKey,
|
|
77
|
-
resolveClassList,
|
|
78
|
-
toDateInputValue,
|
|
79
|
-
toDateTimeLocalInputValue,
|
|
80
|
-
getEditableInputValue,
|
|
81
|
-
getEditorInputType,
|
|
82
|
-
toValueArray,
|
|
83
|
-
getOptionLabel,
|
|
84
|
-
getOptionColor,
|
|
85
|
-
colorfulChipStyle,
|
|
86
|
-
getEditorClass,
|
|
87
|
-
asDate,
|
|
88
|
-
clampMenuX,
|
|
89
|
-
cssEscape,
|
|
90
|
-
rawToNumber,
|
|
91
|
-
formatFacetNumber,
|
|
92
|
-
formatFacetDate,
|
|
93
|
-
} from "./SvGrid.helpers";
|
|
94
|
-
import { createGridApi } from "./build-api";
|
|
95
|
-
import { createClipboard } from "./clipboard";
|
|
96
|
-
import {
|
|
97
|
-
filterOperatorOptions,
|
|
98
|
-
fallbackOperatorOption,
|
|
99
|
-
TEXT_OPERATORS,
|
|
100
|
-
NUMBER_OPERATORS,
|
|
101
|
-
DATE_OPERATORS,
|
|
102
|
-
CHECKBOX_OPERATORS,
|
|
103
|
-
operatorOption,
|
|
104
|
-
operatorsForColumn,
|
|
105
|
-
defaultOperatorFor,
|
|
106
|
-
operatorLabelFor,
|
|
107
|
-
} from "./filter-operators";
|
|
108
|
-
import {
|
|
109
|
-
type FacetBucket,
|
|
110
|
-
isBucketableColumn,
|
|
111
|
-
buildBuckets,
|
|
112
|
-
isInBucket,
|
|
113
|
-
} from "./facet-buckets";
|
|
114
|
-
import {
|
|
115
|
-
getColumnBaseValue,
|
|
116
|
-
isGroupRow,
|
|
117
|
-
toolPanelHeaderLabel,
|
|
118
|
-
formatSummaryNumeric,
|
|
119
|
-
getColumnAlign,
|
|
120
|
-
getPinnedCellValue,
|
|
121
|
-
getColumnAccessorValue,
|
|
122
|
-
columnDefMatchesId,
|
|
123
|
-
} from "./cell-values";
|
|
124
9
|
|
|
125
10
|
export function createColumns<
|
|
126
11
|
TFeatures extends TableFeatures = TableFeatures,
|
|
@@ -186,13 +71,18 @@ export function createColumns<
|
|
|
186
71
|
if (!(ctx.props.enableColumnReorder ?? false)) return;
|
|
187
72
|
ctx.colDragId = columnId;
|
|
188
73
|
e.dataTransfer?.setData("text/plain", columnId);
|
|
189
|
-
|
|
74
|
+
// Guarded, not asserted: `dataTransfer` is non-null in a real browser drag
|
|
75
|
+
// but null on a synthetic DragEvent. The `!` threw there, and because the
|
|
76
|
+
// throw landed after `colDragId` was set but before `colDropSide` was, the
|
|
77
|
+
// drop then silently no-op'd instead of surfacing the error. Matches the
|
|
78
|
+
// pattern row-drag.ts already uses.
|
|
79
|
+
if (e.dataTransfer) e.dataTransfer.effectAllowed = "move";
|
|
190
80
|
}
|
|
191
81
|
|
|
192
82
|
function onColumnHeaderDragOver(e: DragEvent, columnId: string) {
|
|
193
83
|
if (!ctx.colDragId || ctx.colDragId === columnId) return;
|
|
194
84
|
e.preventDefault();
|
|
195
|
-
e.dataTransfer
|
|
85
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
196
86
|
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
|
197
87
|
ctx.colDropSide = e.clientX < rect.left + rect.width / 2 ? "before" : "after";
|
|
198
88
|
ctx.colDropOnId = columnId;
|
package/src/createMenu.svelte.ts
CHANGED
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
|
})
|