@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The footer's page-size control used to import SvGridDropdown statically.
|
|
3
|
+
* That pulled a ~22 KB component into the base bundle to pick one of four
|
|
4
|
+
* numbers, and worse, it gave the bundler a static path to a module that
|
|
5
|
+
* SvGrid.svelte deliberately loads with `import()` as a cell editor. The lazy
|
|
6
|
+
* boundary silently stopped existing: the dropdown shipped in base and the
|
|
7
|
+
* dynamic import resolved to the already-bundled copy.
|
|
8
|
+
*
|
|
9
|
+
* The footer now renders the dropdown's closed trigger as plain markup and
|
|
10
|
+
* fetches the real component on first open. These tests pin the two things
|
|
11
|
+
* that regression would break: the trigger must look and read the same before
|
|
12
|
+
* any load, and clicking it must actually open the list rather than requiring
|
|
13
|
+
* a second click once the chunk arrives.
|
|
14
|
+
*/
|
|
15
|
+
import { describe, expect, it } from 'vitest'
|
|
16
|
+
import { mount, unmount } from 'svelte'
|
|
17
|
+
import SvGrid from './SvGrid.svelte'
|
|
18
|
+
import { createCoreRowModel, rowPaginationFeature, tableFeatures } from './index'
|
|
19
|
+
import type { ColumnDef } from './index'
|
|
20
|
+
|
|
21
|
+
type Row = { id: number; name: string }
|
|
22
|
+
const features = tableFeatures({ rowPaginationFeature })
|
|
23
|
+
const rows: Row[] = Array.from({ length: 40 }, (_, i) => ({ id: i + 1, name: `Row ${i + 1}` }))
|
|
24
|
+
const cols: ColumnDef<typeof features, Row>[] = [{ field: 'name', header: 'Name', width: 160 }]
|
|
25
|
+
|
|
26
|
+
const tick = () => new Promise<void>((r) => setTimeout(r))
|
|
27
|
+
|
|
28
|
+
function mountGrid(target: HTMLElement) {
|
|
29
|
+
return mount(SvGrid<typeof features, Row>, {
|
|
30
|
+
target,
|
|
31
|
+
props: {
|
|
32
|
+
data: rows,
|
|
33
|
+
columns: cols,
|
|
34
|
+
features,
|
|
35
|
+
showPagination: true,
|
|
36
|
+
pageSize: 10,
|
|
37
|
+
getCoreRowModel: createCoreRowModel(),
|
|
38
|
+
} as never,
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const trigger = (host: HTMLElement) =>
|
|
43
|
+
host.querySelector<HTMLButtonElement>(
|
|
44
|
+
'.sv-grid-pagination-pagesize-dd .sv-grid-dropdown-trigger',
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
describe('footer page-size control', () => {
|
|
48
|
+
it('renders a dropdown trigger without loading SvGridDropdown', async () => {
|
|
49
|
+
const host = document.createElement('div')
|
|
50
|
+
document.body.appendChild(host)
|
|
51
|
+
const app = mountGrid(host)
|
|
52
|
+
await tick()
|
|
53
|
+
|
|
54
|
+
const btn = trigger(host)
|
|
55
|
+
expect(btn).not.toBeNull()
|
|
56
|
+
// Same classes and ARIA as the real component's closed state, so swapping
|
|
57
|
+
// it in causes no visual change and no layout shift.
|
|
58
|
+
expect(btn!.getAttribute('aria-haspopup')).toBe('listbox')
|
|
59
|
+
expect(btn!.getAttribute('aria-expanded')).toBe('false')
|
|
60
|
+
expect(btn!.querySelector('.sv-grid-dropdown-label')?.textContent?.trim()).toBe('10')
|
|
61
|
+
expect(btn!.querySelector('.sv-grid-dropdown-caret')).not.toBeNull()
|
|
62
|
+
// Nothing is open until the user asks for it.
|
|
63
|
+
expect(host.querySelector('[role="listbox"]')).toBeNull()
|
|
64
|
+
|
|
65
|
+
unmount(app)
|
|
66
|
+
host.remove()
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('opens on the first click, without needing a second one', async () => {
|
|
70
|
+
const host = document.createElement('div')
|
|
71
|
+
document.body.appendChild(host)
|
|
72
|
+
const app = mountGrid(host)
|
|
73
|
+
await tick()
|
|
74
|
+
|
|
75
|
+
trigger(host)!.click()
|
|
76
|
+
// The component is fetched here; give the dynamic import a turn to settle.
|
|
77
|
+
for (let i = 0; i < 10 && !document.querySelector('[role="listbox"]'); i++) await tick()
|
|
78
|
+
|
|
79
|
+
// autoOpen carries the originating click through to an open panel.
|
|
80
|
+
expect(document.querySelector('[role="listbox"]')).not.toBeNull()
|
|
81
|
+
expect(trigger(host)!.getAttribute('aria-expanded')).toBe('true')
|
|
82
|
+
|
|
83
|
+
unmount(app)
|
|
84
|
+
host.remove()
|
|
85
|
+
})
|
|
86
|
+
})
|