virtua 0.51.2 → 0.52.0

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 (46) hide show
  1. package/README.md +37 -13
  2. package/lib/angular/VGrid.d.ts +249 -0
  3. package/lib/angular/VList.d.ts +3 -3
  4. package/lib/angular/Virtualizer.d.ts +3 -3
  5. package/lib/angular/WindowVirtualizer.d.ts +3 -3
  6. package/lib/angular/index.d.ts +2 -0
  7. package/lib/angular/index.js +1150 -332
  8. package/lib/angular/index.js.map +1 -1
  9. package/lib/core/grid.d.ts +30 -0
  10. package/lib/core/index.cjs +480 -271
  11. package/lib/core/index.cjs.map +1 -1
  12. package/lib/core/index.d.ts +5 -3
  13. package/lib/core/index.js +436 -228
  14. package/lib/core/index.js.map +1 -1
  15. package/lib/core/layouts/grid.d.ts +21 -0
  16. package/lib/core/scroll-to.d.ts +50 -1
  17. package/lib/core/types.d.ts +0 -25
  18. package/lib/index.cjs +763 -565
  19. package/lib/index.cjs.map +1 -1
  20. package/lib/index.d.ts +2 -1
  21. package/lib/index.js +734 -518
  22. package/lib/index.js.map +1 -1
  23. package/lib/react/VGrid.d.ts +105 -80
  24. package/lib/react/index.d.ts +3 -2
  25. package/lib/solid/VGrid.d.ts +193 -0
  26. package/lib/solid/index.cjs +825 -301
  27. package/lib/solid/index.cjs.map +1 -1
  28. package/lib/solid/index.d.ts +3 -0
  29. package/lib/solid/index.js +797 -286
  30. package/lib/solid/index.js.map +1 -1
  31. package/lib/solid/index.jsx +760 -142
  32. package/lib/solid/index.jsx.map +1 -1
  33. package/lib/svelte/GridCell.svelte +44 -0
  34. package/lib/svelte/GridRow.svelte +42 -0
  35. package/lib/svelte/GridRowGroup.svelte +42 -0
  36. package/lib/svelte/VGrid.svelte +238 -0
  37. package/lib/svelte/VGrid.type.d.ts +185 -0
  38. package/lib/svelte/index.d.ts +3 -0
  39. package/lib/svelte/index.js +2 -1
  40. package/lib/vue/VGrid.d.ts +194 -0
  41. package/lib/vue/index.cjs +873 -368
  42. package/lib/vue/index.cjs.map +1 -1
  43. package/lib/vue/index.d.ts +3 -0
  44. package/lib/vue/index.js +861 -357
  45. package/lib/vue/index.js.map +1 -1
  46. package/package.json +4 -3
@@ -0,0 +1,194 @@
1
+ import { VNode, PublicProps } from 'vue';
2
+ import { VGridScrollToIndexOpts, VGridAxis, VGridCell, VGridSize, VGridSpan } from '../core/index.js';
3
+ /**
4
+ * Props of {@link VGrid}.
5
+ */
6
+ export interface VGridProps<R = number, C = number> extends PublicProps {
7
+ /**
8
+ * The rows of the grid. See {@link VGridAxis} for the accepted values.
9
+ */
10
+ rows: VGridAxis<R>;
11
+ /**
12
+ * The columns of the grid. See {@link VGridAxis} for the accepted values.
13
+ */
14
+ cols: VGridAxis<C>;
15
+ /**
16
+ * The heights of the rows. See {@link VGridSize} for the accepted values.
17
+ */
18
+ rowHeight: NoInfer<VGridSize<R>>;
19
+ /**
20
+ * The widths of the columns. See {@link VGridSize} for the accepted values.
21
+ */
22
+ colWidth: NoInfer<VGridSize<C>>;
23
+ /**
24
+ * The number of the leading rows pinned to the start, which are the column headers (`role="columnheader"`).
25
+ *
26
+ * **The pinned cells are rendered over the other cells, so give them an opaque background.**
27
+ * @defaultValue 0
28
+ */
29
+ headerRows?: number;
30
+ /**
31
+ * Indexes of the rows which start sections. A section lasts until the next section row or the footer rows, and its first row sticks below the header rows while the section is scrolled through.
32
+ *
33
+ * **The section rows are rendered over the other cells while they stick, so give them an opaque background.**
34
+ */
35
+ sectionRows?: readonly number[];
36
+ /**
37
+ * The number of the trailing rows pinned to the end.
38
+ *
39
+ * **The pinned cells are rendered over the other cells, so give them an opaque background.**
40
+ * @defaultValue 0
41
+ */
42
+ footerRows?: number;
43
+ /**
44
+ * The number of the leading columns pinned to the start, the last of which is the row header (`role="rowheader"`).
45
+ *
46
+ * **The pinned cells are rendered over the other cells, so give them an opaque background.**
47
+ * @defaultValue 0
48
+ */
49
+ headerCols?: number;
50
+ /**
51
+ * The number of the trailing columns pinned to the end.
52
+ *
53
+ * **The pinned cells are rendered over the other cells, so give them an opaque background.**
54
+ * @defaultValue 0
55
+ */
56
+ footerCols?: number;
57
+ /**
58
+ * Cells merged over multiple rows and/or columns. See {@link VGridSpan} for the accepted values.
59
+ *
60
+ * The cell at the origin is stretched over the merged area, and the other cells in it are not rendered. Spans must not overlap each other or cross the boundaries of the pinned rows/columns or the sections. A spanning cell is not measured for `"auto"` sizes on the axes it spans, and doesn't enlarge those tracks.
61
+ */
62
+ spans?: readonly VGridSpan[];
63
+ /**
64
+ * List of cells that should be always mounted, even when off screen.
65
+ */
66
+ keepMounted?: readonly VGridCell[];
67
+ /**
68
+ * Extra space in pixels to render before/after the viewport. The minimum value is 0. Lower value will give better performance but you can increase to avoid showing blank cells in fast scrolling.
69
+ * @defaultValue 200
70
+ */
71
+ bufferSize?: number;
72
+ /**
73
+ * The gap between the rows and the columns in pixels, which is not included in the sizes. Must not be changed after mount.
74
+ * @defaultValue 0
75
+ */
76
+ gap?: number;
77
+ /**
78
+ * The header cell of the sorted column or row, and the sort order (`aria-sort`).
79
+ */
80
+ ariaSort?: VGridCell & {
81
+ order: "ascending" | "descending" | "other";
82
+ };
83
+ /**
84
+ * Callback invoked whenever the vertical scroll offset changes.
85
+ * @param offset Current scrollTop.
86
+ */
87
+ onVerticalScroll?: (offset: number) => void;
88
+ /**
89
+ * Callback invoked whenever the horizontal scroll offset changes.
90
+ * @param offset Current scrollLeft. Always positive even in RTL.
91
+ */
92
+ onHorizontalScroll?: (offset: number) => void;
93
+ /**
94
+ * Callback invoked when scrolling stops.
95
+ */
96
+ onScrollEnd?: () => void;
97
+ }
98
+ /**
99
+ * Methods of {@link VGrid}.
100
+ */
101
+ export interface VGridHandle {
102
+ /**
103
+ * Get current scrollTop.
104
+ */
105
+ readonly verticalScrollOffset: number;
106
+ /**
107
+ * Get current scrollLeft. Always positive even in RTL.
108
+ */
109
+ readonly horizontalScrollOffset: number;
110
+ /**
111
+ * Get current scrollHeight.
112
+ */
113
+ readonly scrollHeight: number;
114
+ /**
115
+ * Get current scrollWidth.
116
+ */
117
+ readonly scrollWidth: number;
118
+ /**
119
+ * Get current clientHeight.
120
+ */
121
+ readonly viewportHeight: number;
122
+ /**
123
+ * Get current clientWidth.
124
+ */
125
+ readonly viewportWidth: number;
126
+ /**
127
+ * Find nearest row index from offset.
128
+ * @param offset offset in pixels from the top of the scroll container
129
+ */
130
+ findRowIndex(offset: number): number;
131
+ /**
132
+ * Find nearest column index from offset.
133
+ * @param offset offset in pixels from the start of the scroll container
134
+ */
135
+ findColIndex(offset: number): number;
136
+ /**
137
+ * Get offset of the row from the top.
138
+ * @param index index of row
139
+ */
140
+ getRowOffset(index: number): number;
141
+ /**
142
+ * Get offset of the column from the start.
143
+ * @param index index of column
144
+ */
145
+ getColOffset(index: number): number;
146
+ /**
147
+ * Get size of the row.
148
+ * @param index index of row
149
+ */
150
+ getRowSize(index: number): number;
151
+ /**
152
+ * Get size of the column.
153
+ * @param index index of column
154
+ */
155
+ getColSize(index: number): number;
156
+ /**
157
+ * Scroll to the cell specified by the indexes. The cell is not hidden behind the rows and the columns sticking over it.
158
+ * @param opts the indexes of the cell and the options. See {@link VGridScrollToIndexOpts}.
159
+ */
160
+ scrollToIndex(opts: VGridScrollToIndexOpts): void;
161
+ /**
162
+ * Scroll to the given offsets from the top/start of the scroll container.
163
+ * @param offset the offsets. The axis whose offset is omitted is not scrolled.
164
+ */
165
+ scrollTo(offset: {
166
+ vertical?: number;
167
+ horizontal?: number;
168
+ }): void;
169
+ /**
170
+ * Scroll by the given offsets from the current position.
171
+ * @param offset the offsets. The axis whose offset is omitted is not scrolled.
172
+ */
173
+ scrollBy(offset: {
174
+ vertical?: number;
175
+ horizontal?: number;
176
+ }): void;
177
+ }
178
+ interface VGridInstance<R = number, C = number> extends VGridHandle {
179
+ $props: VGridProps<R, C>;
180
+ $slots: {
181
+ default: (arg: {
182
+ row: R;
183
+ col: C;
184
+ cell: Readonly<VGridCell>;
185
+ }) => VNode[];
186
+ };
187
+ }
188
+ /**
189
+ * Virtualized grid component for tabular data. See {@link VGridProps} and {@link VGridHandle}.
190
+ */
191
+ export declare const VGrid: {
192
+ new <R = number, C = number>(props: VGridProps<R, C>): VGridInstance<R, C>;
193
+ };
194
+ export {};