virtua 0.52.4 → 0.52.6
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/README.md +1 -1
- package/lib/angular/VGrid.d.ts +3 -0
- package/lib/angular/index.js +214 -194
- package/lib/angular/index.js.map +1 -1
- package/lib/core/index.cjs +176 -161
- package/lib/core/index.cjs.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +171 -156
- package/lib/core/index.js.map +1 -1
- package/lib/index.cjs +407 -391
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +368 -353
- package/lib/index.js.map +1 -1
- package/lib/solid/index.cjs +459 -442
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.js +453 -438
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx +59 -43
- package/lib/solid/index.jsx.map +1 -1
- package/lib/svelte/VGrid.svelte +7 -20
- package/lib/svelte/utils.d.ts +5 -0
- package/lib/svelte/utils.js.map +1 -1
- package/lib/vue/index.cjs +406 -389
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.js +381 -366
- package/lib/vue/index.js.map +1 -1
- package/package.json +1 -1
package/lib/svelte/VGrid.svelte
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
createContainerGridDriver,
|
|
9
9
|
createGridLayout,
|
|
10
10
|
createGridPlan,
|
|
11
|
+
createGridSpanIndex,
|
|
11
12
|
createVirtualStore,
|
|
12
13
|
getAxisItem,
|
|
13
14
|
getAxisLength,
|
|
@@ -48,6 +49,9 @@
|
|
|
48
49
|
|
|
49
50
|
const rowLayout = createGridLayout(rows, rowHeight, gap);
|
|
50
51
|
const colLayout = createGridLayout(cols, colWidth, gap);
|
|
52
|
+
let rowSizes = $derived(rowLayout.$getSizes(rows, rowHeight));
|
|
53
|
+
let colSizes = $derived(colLayout.$getSizes(cols, colWidth));
|
|
54
|
+
let spanIndex = $derived(createGridSpanIndex(spans));
|
|
51
55
|
const rowStore = createVirtualStore(rowLayout);
|
|
52
56
|
const colStore = createVirtualStore(colLayout);
|
|
53
57
|
const driver = createContainerGridDriver(rowStore, colStore);
|
|
@@ -82,28 +86,11 @@
|
|
|
82
86
|
rowStore.$subscribe(UPDATE_SCROLL_END_EVENT, notifyScrollEnd);
|
|
83
87
|
colStore.$subscribe(UPDATE_SCROLL_END_EVENT, notifyScrollEnd);
|
|
84
88
|
|
|
85
|
-
// The sizes read from the items are tracked, so the items mutated in place are followed.
|
|
86
89
|
$effect.pre(() => {
|
|
87
|
-
updateGridAxis(
|
|
88
|
-
rowStore,
|
|
89
|
-
rowLayout,
|
|
90
|
-
rows,
|
|
91
|
-
rowHeight,
|
|
92
|
-
headerRows,
|
|
93
|
-
footerRows,
|
|
94
|
-
true,
|
|
95
|
-
);
|
|
90
|
+
updateGridAxis(rowStore, rowLayout, rows, rowSizes, headerRows, footerRows);
|
|
96
91
|
});
|
|
97
92
|
$effect.pre(() => {
|
|
98
|
-
updateGridAxis(
|
|
99
|
-
colStore,
|
|
100
|
-
colLayout,
|
|
101
|
-
cols,
|
|
102
|
-
colWidth,
|
|
103
|
-
headerCols,
|
|
104
|
-
footerCols,
|
|
105
|
-
true,
|
|
106
|
-
);
|
|
93
|
+
updateGridAxis(colStore, colLayout, cols, colSizes, headerCols, footerCols);
|
|
107
94
|
});
|
|
108
95
|
let rowCount = $derived(stateVersion && rowStore.$getItemsLength());
|
|
109
96
|
let colCount = $derived(stateVersion && colStore.$getItemsLength());
|
|
@@ -114,8 +101,8 @@
|
|
|
114
101
|
colLayout,
|
|
115
102
|
rowStore.$getRange(bufferSize),
|
|
116
103
|
colStore.$getRange(bufferSize),
|
|
104
|
+
spanIndex,
|
|
117
105
|
sectionRows,
|
|
118
|
-
spans,
|
|
119
106
|
keepMounted,
|
|
120
107
|
ariaSort,
|
|
121
108
|
);
|
package/lib/svelte/utils.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { ItemsRange } from '../core/index.js';
|
|
|
2
2
|
export declare const styleToString: (obj: Record<string, string | undefined>) => string;
|
|
3
3
|
export declare const isSameRange: (prev: ItemsRange, next: ItemsRange) => boolean;
|
|
4
4
|
export declare const defaultGetKey: (_data: unknown, i: number) => string;
|
|
5
|
+
export type ItemAttrs = {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
style?: Record<string, string | undefined>;
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
11
|
* A function that provides properties/attributes for item element
|
|
7
12
|
*/
|
package/lib/svelte/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/svelte/utils.ts"],"sourcesContent":["import type { ItemsRange } from \"../core/index.js\";\n\nexport const styleToString = (\n obj: Record<string, string | undefined>,\n): string => {\n return Object.keys(obj).reduce((acc, k) => {\n const value = obj[k];\n if (value == null) {\n return acc;\n }\n return acc + `${k}:${value};`;\n }, \"\");\n};\n\nexport const isSameRange = (prev: ItemsRange, next: ItemsRange): boolean => {\n return prev[0] === next[0] && prev[1] === next[1];\n};\n\nexport const defaultGetKey = (_data: unknown, i: number) => \"_\" + i;\n\
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/svelte/utils.ts"],"sourcesContent":["import type { ItemsRange } from \"../core/index.js\";\n\nexport const styleToString = (\n obj: Record<string, string | undefined>,\n): string => {\n return Object.keys(obj).reduce((acc, k) => {\n const value = obj[k];\n if (value == null) {\n return acc;\n }\n return acc + `${k}:${value};`;\n }, \"\");\n};\n\nexport const isSameRange = (prev: ItemsRange, next: ItemsRange): boolean => {\n return prev[0] === next[0] && prev[1] === next[1];\n};\n\nexport const defaultGetKey = (_data: unknown, i: number) => \"_\" + i;\n\nexport type ItemAttrs = {\n [key: string]: any;\n style?: Record<string, string | undefined>;\n class?: string;\n};\n\n/**\n * A function that provides properties/attributes for item element\n */\nexport type ItemProps<T = unknown> = (payload: {\n item: T;\n index: number;\n}) => ItemAttrs | undefined;\n"],"mappings":";AAEA,IAAa,iBACX,QACW;CACX,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,QAAQ,KAAK,MAAM;EACzC,MAAM,QAAQ,IAAI;EAClB,IAAI,SAAS,MACX,OAAO;EAET,OAAO,MAAM,GAAG,EAAE,GAAG,MAAM;CAC7B,GAAG,EAAE;AACP;AAEA,IAAa,eAAe,MAAkB,SAA8B;CAC1E,OAAO,KAAK,OAAO,KAAK,MAAM,KAAK,OAAO,KAAK;AACjD;AAEA,IAAa,iBAAiB,OAAgB,MAAc,MAAM"}
|