@vuecs/table 1.0.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.
- package/LICENSE +201 -0
- package/README.md +59 -0
- package/dist/components/Table.vue.d.ts +511 -0
- package/dist/components/Table.vue.d.ts.map +1 -0
- package/dist/components/TableBody.vue.d.ts +43 -0
- package/dist/components/TableBody.vue.d.ts.map +1 -0
- package/dist/components/TableCell.vue.d.ts +182 -0
- package/dist/components/TableCell.vue.d.ts.map +1 -0
- package/dist/components/TableEmpty.vue.d.ts +104 -0
- package/dist/components/TableEmpty.vue.d.ts.map +1 -0
- package/dist/components/TableFooter.vue.d.ts +40 -0
- package/dist/components/TableFooter.vue.d.ts.map +1 -0
- package/dist/components/TableHeadCell.vue.d.ts +267 -0
- package/dist/components/TableHeadCell.vue.d.ts.map +1 -0
- package/dist/components/TableHeader.vue.d.ts +40 -0
- package/dist/components/TableHeader.vue.d.ts.map +1 -0
- package/dist/components/TableLite.vue.d.ts +250 -0
- package/dist/components/TableLite.vue.d.ts.map +1 -0
- package/dist/components/TableLoading.vue.d.ts +88 -0
- package/dist/components/TableLoading.vue.d.ts.map +1 -0
- package/dist/components/TableRow.vue.d.ts +116 -0
- package/dist/components/TableRow.vue.d.ts.map +1 -0
- package/dist/components/TableSortIndicators.vue.d.ts +335 -0
- package/dist/components/TableSortIndicators.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +23 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/composables/context.d.ts +104 -0
- package/dist/composables/context.d.ts.map +1 -0
- package/dist/composables/define-table.d.ts +48 -0
- package/dist/composables/define-table.d.ts.map +1 -0
- package/dist/composables/index.d.ts +5 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/selection.d.ts +10 -0
- package/dist/composables/selection.d.ts.map +1 -0
- package/dist/composables/sort.d.ts +61 -0
- package/dist/composables/sort.d.ts.map +1 -0
- package/dist/defaults.d.ts +41 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +2081 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +145 -0
- package/dist/theme.d.ts +13 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/types.d.ts +248 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/auto-render.d.ts +31 -0
- package/dist/utils/auto-render.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/render-utils.d.ts +49 -0
- package/dist/utils/render-utils.d.ts.map +1 -0
- package/dist/utils/sort-rows.d.ts +29 -0
- package/dist/utils/sort-rows.d.ts.map +1 -0
- package/dist/vue.d.ts +27 -0
- package/dist/vue.d.ts.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import type { ExtractPublicPropTypes, PropType, SlotsType } from 'vue';
|
|
2
|
+
import type { SortDescriptor, TableColumn, TableSortIndicatorsThemeClasses, TableSortState } from '../types';
|
|
3
|
+
declare const tableSortIndicatorsProps: {
|
|
4
|
+
themeClass: {
|
|
5
|
+
type: PropType<import("@vuecs/core").ThemeClassesOverride<TableSortIndicatorsThemeClasses>>;
|
|
6
|
+
default: any;
|
|
7
|
+
};
|
|
8
|
+
themeVariant: {
|
|
9
|
+
type: PropType<import("@vuecs/core").VariantValues>;
|
|
10
|
+
default: any;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Sort state to render. Use `v-model:sort` for two-way binding.
|
|
14
|
+
* `null` is treated as "empty array" so consumers carrying
|
|
15
|
+
* migration-era `ref<TableSortState | null>(null)` don't crash.
|
|
16
|
+
* When BOTH `:sort` and `:columns` are omitted, the component
|
|
17
|
+
* falls back to `useTable()` context — note that with the
|
|
18
|
+
* default `<table>` rendering, slot children render INSIDE the
|
|
19
|
+
* `<table>`, so the v-model path is the recommended placement
|
|
20
|
+
* for chip rows above / below the table.
|
|
21
|
+
*/
|
|
22
|
+
sort: {
|
|
23
|
+
type: PropType<TableSortState | null>;
|
|
24
|
+
default: any;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Columns the sort can reference. Required when using v-model
|
|
28
|
+
* mode (to look up labels + filter the add-column dropdown).
|
|
29
|
+
* Falls back to `useTable()` context when omitted.
|
|
30
|
+
*/
|
|
31
|
+
columns: {
|
|
32
|
+
type: PropType<TableColumn[]>;
|
|
33
|
+
default: any;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Cap on the sort-state array length (mirrors `<VCTable
|
|
37
|
+
* :max-sort-keys>`). `0` = unlimited. When the cap is hit,
|
|
38
|
+
* adding via this component evicts the oldest descriptor.
|
|
39
|
+
* Falls back to `useTable().maxSortKeys` when omitted; defaults
|
|
40
|
+
* to `0` (unlimited) in stand-alone v-model mode without a
|
|
41
|
+
* context.
|
|
42
|
+
*/
|
|
43
|
+
maxSortKeys: {
|
|
44
|
+
type: NumberConstructor;
|
|
45
|
+
default: any;
|
|
46
|
+
};
|
|
47
|
+
/** Override the leading label text. Falls back to global defaults. */
|
|
48
|
+
label: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: any;
|
|
51
|
+
};
|
|
52
|
+
/** Override the empty-state copy. Falls back to global defaults. */
|
|
53
|
+
emptyContent: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
default: any;
|
|
56
|
+
};
|
|
57
|
+
/** Override the add-column trigger text. Falls back to global defaults. */
|
|
58
|
+
addLabel: {
|
|
59
|
+
type: StringConstructor;
|
|
60
|
+
default: any;
|
|
61
|
+
};
|
|
62
|
+
/** Override the clear-all trigger text. Falls back to global defaults. */
|
|
63
|
+
clearLabel: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: any;
|
|
66
|
+
};
|
|
67
|
+
/** Override the aria-label applied to per-chip remove buttons. */
|
|
68
|
+
removeAriaLabel: {
|
|
69
|
+
type: StringConstructor;
|
|
70
|
+
default: any;
|
|
71
|
+
};
|
|
72
|
+
/** Hide the add-column dropdown (consumer brings their own affordance). */
|
|
73
|
+
hideAdd: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
77
|
+
/** Hide the clear-all button. */
|
|
78
|
+
hideClear: {
|
|
79
|
+
type: BooleanConstructor;
|
|
80
|
+
default: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type TableSortIndicatorsProps = ExtractPublicPropTypes<typeof tableSortIndicatorsProps>;
|
|
84
|
+
export type TableSortIndicatorsChipSlotProps = {
|
|
85
|
+
descriptor: SortDescriptor;
|
|
86
|
+
/** 0-based index in the sort array. */
|
|
87
|
+
index: number;
|
|
88
|
+
/** 1-based position (`index + 1`). */
|
|
89
|
+
position: number;
|
|
90
|
+
column: TableColumn | undefined;
|
|
91
|
+
/** Toggle this descriptor's direction (asc ↔ desc). */
|
|
92
|
+
toggle: () => void;
|
|
93
|
+
/** Remove this descriptor from the sort. */
|
|
94
|
+
remove: () => void;
|
|
95
|
+
};
|
|
96
|
+
export type TableSortIndicatorsAddSlotProps = {
|
|
97
|
+
/** Columns that are `:sortable` but not currently in the sort array. */
|
|
98
|
+
options: TableColumn[];
|
|
99
|
+
/** Append a column to the sort with `asc` direction. */
|
|
100
|
+
add: (key: string) => void;
|
|
101
|
+
};
|
|
102
|
+
export type TableSortIndicatorsClearSlotProps = {
|
|
103
|
+
/** Clear the entire sort. */
|
|
104
|
+
clear: () => void;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Discoverable, modifier-key-free alternative to Shift-click for
|
|
108
|
+
* managing multi-column sort state. Renders a chip per active
|
|
109
|
+
* `SortDescriptor`, an add-column dropdown for unsorted sortable
|
|
110
|
+
* columns, and a clear-all action.
|
|
111
|
+
*
|
|
112
|
+
* Two wiring modes:
|
|
113
|
+
*
|
|
114
|
+
* 1. **v-model (recommended)** — pass `:sort` + `:columns` and bind
|
|
115
|
+
* `v-model:sort`. Place the chip row anywhere (above or below
|
|
116
|
+
* the table). This is the only mode that supports the natural
|
|
117
|
+
* "chip row above table" layout because `<VCTable>`'s default
|
|
118
|
+
* slot children render inside `<table>` and a `<div>` there is
|
|
119
|
+
* invalid HTML.
|
|
120
|
+
*
|
|
121
|
+
* ```vue
|
|
122
|
+
* <VCTableSortIndicators v-model:sort="sort" :columns="columns" />
|
|
123
|
+
* <VCTable v-model:sort="sort" :columns :data ... />
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* 2. **Context fallback** — mount inside a `<VCTable>` and omit
|
|
127
|
+
* `:sort` / `:columns`. The component reads from `useTable()`
|
|
128
|
+
* and calls `setSortState`. Only safe in custom layouts where
|
|
129
|
+
* a `<div>` is legal at the mount point.
|
|
130
|
+
*
|
|
131
|
+
* Slot customization:
|
|
132
|
+
* - `default` — replace the whole layout (slot props include all
|
|
133
|
+
* chip handlers + add + clear)
|
|
134
|
+
* - `#label` — replace the leading "Sort:" label
|
|
135
|
+
* - `#empty` — replace the empty-state hint
|
|
136
|
+
* - `#chip="{ descriptor, index, position, toggle, remove }"` —
|
|
137
|
+
* replace per-chip rendering
|
|
138
|
+
* - `#add="{ options, add }"` — replace the add-column trigger
|
|
139
|
+
* - `#clear="{ clear }"` — replace the clear-all trigger
|
|
140
|
+
*
|
|
141
|
+
* Text strings flow through `useComponentDefaults('tableSortIndicators', …)`
|
|
142
|
+
* so consumers can localize via
|
|
143
|
+
* `app.use(vuecs, { defaults: { tableSortIndicators: { … } } })`.
|
|
144
|
+
*/
|
|
145
|
+
declare const _default: typeof __VLS_export;
|
|
146
|
+
export default _default;
|
|
147
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
148
|
+
themeClass: {
|
|
149
|
+
type: PropType<import("@vuecs/core").ThemeClassesOverride<TableSortIndicatorsThemeClasses>>;
|
|
150
|
+
default: any;
|
|
151
|
+
};
|
|
152
|
+
themeVariant: {
|
|
153
|
+
type: PropType<import("@vuecs/core").VariantValues>;
|
|
154
|
+
default: any;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Sort state to render. Use `v-model:sort` for two-way binding.
|
|
158
|
+
* `null` is treated as "empty array" so consumers carrying
|
|
159
|
+
* migration-era `ref<TableSortState | null>(null)` don't crash.
|
|
160
|
+
* When BOTH `:sort` and `:columns` are omitted, the component
|
|
161
|
+
* falls back to `useTable()` context — note that with the
|
|
162
|
+
* default `<table>` rendering, slot children render INSIDE the
|
|
163
|
+
* `<table>`, so the v-model path is the recommended placement
|
|
164
|
+
* for chip rows above / below the table.
|
|
165
|
+
*/
|
|
166
|
+
sort: {
|
|
167
|
+
type: PropType<TableSortState | null>;
|
|
168
|
+
default: any;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Columns the sort can reference. Required when using v-model
|
|
172
|
+
* mode (to look up labels + filter the add-column dropdown).
|
|
173
|
+
* Falls back to `useTable()` context when omitted.
|
|
174
|
+
*/
|
|
175
|
+
columns: {
|
|
176
|
+
type: PropType<TableColumn[]>;
|
|
177
|
+
default: any;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Cap on the sort-state array length (mirrors `<VCTable
|
|
181
|
+
* :max-sort-keys>`). `0` = unlimited. When the cap is hit,
|
|
182
|
+
* adding via this component evicts the oldest descriptor.
|
|
183
|
+
* Falls back to `useTable().maxSortKeys` when omitted; defaults
|
|
184
|
+
* to `0` (unlimited) in stand-alone v-model mode without a
|
|
185
|
+
* context.
|
|
186
|
+
*/
|
|
187
|
+
maxSortKeys: {
|
|
188
|
+
type: NumberConstructor;
|
|
189
|
+
default: any;
|
|
190
|
+
};
|
|
191
|
+
/** Override the leading label text. Falls back to global defaults. */
|
|
192
|
+
label: {
|
|
193
|
+
type: StringConstructor;
|
|
194
|
+
default: any;
|
|
195
|
+
};
|
|
196
|
+
/** Override the empty-state copy. Falls back to global defaults. */
|
|
197
|
+
emptyContent: {
|
|
198
|
+
type: StringConstructor;
|
|
199
|
+
default: any;
|
|
200
|
+
};
|
|
201
|
+
/** Override the add-column trigger text. Falls back to global defaults. */
|
|
202
|
+
addLabel: {
|
|
203
|
+
type: StringConstructor;
|
|
204
|
+
default: any;
|
|
205
|
+
};
|
|
206
|
+
/** Override the clear-all trigger text. Falls back to global defaults. */
|
|
207
|
+
clearLabel: {
|
|
208
|
+
type: StringConstructor;
|
|
209
|
+
default: any;
|
|
210
|
+
};
|
|
211
|
+
/** Override the aria-label applied to per-chip remove buttons. */
|
|
212
|
+
removeAriaLabel: {
|
|
213
|
+
type: StringConstructor;
|
|
214
|
+
default: any;
|
|
215
|
+
};
|
|
216
|
+
/** Hide the add-column dropdown (consumer brings their own affordance). */
|
|
217
|
+
hideAdd: {
|
|
218
|
+
type: BooleanConstructor;
|
|
219
|
+
default: boolean;
|
|
220
|
+
};
|
|
221
|
+
/** Hide the clear-all button. */
|
|
222
|
+
hideClear: {
|
|
223
|
+
type: BooleanConstructor;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
227
|
+
[key: string]: any;
|
|
228
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ["update:sort"], "update:sort", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
229
|
+
themeClass: {
|
|
230
|
+
type: PropType<import("@vuecs/core").ThemeClassesOverride<TableSortIndicatorsThemeClasses>>;
|
|
231
|
+
default: any;
|
|
232
|
+
};
|
|
233
|
+
themeVariant: {
|
|
234
|
+
type: PropType<import("@vuecs/core").VariantValues>;
|
|
235
|
+
default: any;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Sort state to render. Use `v-model:sort` for two-way binding.
|
|
239
|
+
* `null` is treated as "empty array" so consumers carrying
|
|
240
|
+
* migration-era `ref<TableSortState | null>(null)` don't crash.
|
|
241
|
+
* When BOTH `:sort` and `:columns` are omitted, the component
|
|
242
|
+
* falls back to `useTable()` context — note that with the
|
|
243
|
+
* default `<table>` rendering, slot children render INSIDE the
|
|
244
|
+
* `<table>`, so the v-model path is the recommended placement
|
|
245
|
+
* for chip rows above / below the table.
|
|
246
|
+
*/
|
|
247
|
+
sort: {
|
|
248
|
+
type: PropType<TableSortState | null>;
|
|
249
|
+
default: any;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Columns the sort can reference. Required when using v-model
|
|
253
|
+
* mode (to look up labels + filter the add-column dropdown).
|
|
254
|
+
* Falls back to `useTable()` context when omitted.
|
|
255
|
+
*/
|
|
256
|
+
columns: {
|
|
257
|
+
type: PropType<TableColumn[]>;
|
|
258
|
+
default: any;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Cap on the sort-state array length (mirrors `<VCTable
|
|
262
|
+
* :max-sort-keys>`). `0` = unlimited. When the cap is hit,
|
|
263
|
+
* adding via this component evicts the oldest descriptor.
|
|
264
|
+
* Falls back to `useTable().maxSortKeys` when omitted; defaults
|
|
265
|
+
* to `0` (unlimited) in stand-alone v-model mode without a
|
|
266
|
+
* context.
|
|
267
|
+
*/
|
|
268
|
+
maxSortKeys: {
|
|
269
|
+
type: NumberConstructor;
|
|
270
|
+
default: any;
|
|
271
|
+
};
|
|
272
|
+
/** Override the leading label text. Falls back to global defaults. */
|
|
273
|
+
label: {
|
|
274
|
+
type: StringConstructor;
|
|
275
|
+
default: any;
|
|
276
|
+
};
|
|
277
|
+
/** Override the empty-state copy. Falls back to global defaults. */
|
|
278
|
+
emptyContent: {
|
|
279
|
+
type: StringConstructor;
|
|
280
|
+
default: any;
|
|
281
|
+
};
|
|
282
|
+
/** Override the add-column trigger text. Falls back to global defaults. */
|
|
283
|
+
addLabel: {
|
|
284
|
+
type: StringConstructor;
|
|
285
|
+
default: any;
|
|
286
|
+
};
|
|
287
|
+
/** Override the clear-all trigger text. Falls back to global defaults. */
|
|
288
|
+
clearLabel: {
|
|
289
|
+
type: StringConstructor;
|
|
290
|
+
default: any;
|
|
291
|
+
};
|
|
292
|
+
/** Override the aria-label applied to per-chip remove buttons. */
|
|
293
|
+
removeAriaLabel: {
|
|
294
|
+
type: StringConstructor;
|
|
295
|
+
default: any;
|
|
296
|
+
};
|
|
297
|
+
/** Hide the add-column dropdown (consumer brings their own affordance). */
|
|
298
|
+
hideAdd: {
|
|
299
|
+
type: BooleanConstructor;
|
|
300
|
+
default: boolean;
|
|
301
|
+
};
|
|
302
|
+
/** Hide the clear-all button. */
|
|
303
|
+
hideClear: {
|
|
304
|
+
type: BooleanConstructor;
|
|
305
|
+
default: boolean;
|
|
306
|
+
};
|
|
307
|
+
}>> & Readonly<{
|
|
308
|
+
"onUpdate:sort"?: (...args: any[]) => any;
|
|
309
|
+
}>, {
|
|
310
|
+
label: string;
|
|
311
|
+
columns: TableColumn<unknown, string>[];
|
|
312
|
+
maxSortKeys: number;
|
|
313
|
+
sort: TableSortState;
|
|
314
|
+
themeClass: import("@vuecs/core").ThemeClassesOverride<TableSortIndicatorsThemeClasses>;
|
|
315
|
+
themeVariant: import("@vuecs/core").VariantValues;
|
|
316
|
+
emptyContent: string;
|
|
317
|
+
addLabel: string;
|
|
318
|
+
clearLabel: string;
|
|
319
|
+
removeAriaLabel: string;
|
|
320
|
+
hideAdd: boolean;
|
|
321
|
+
hideClear: boolean;
|
|
322
|
+
}, SlotsType<{
|
|
323
|
+
default(props: {
|
|
324
|
+
sort: SortDescriptor[];
|
|
325
|
+
chips: TableSortIndicatorsChipSlotProps[];
|
|
326
|
+
add: TableSortIndicatorsAddSlotProps;
|
|
327
|
+
clear: TableSortIndicatorsClearSlotProps;
|
|
328
|
+
}): unknown;
|
|
329
|
+
label(): unknown;
|
|
330
|
+
empty(): unknown;
|
|
331
|
+
chip(props: TableSortIndicatorsChipSlotProps): unknown;
|
|
332
|
+
add(props: TableSortIndicatorsAddSlotProps): unknown;
|
|
333
|
+
clear(props: TableSortIndicatorsClearSlotProps): unknown;
|
|
334
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
335
|
+
//# sourceMappingURL=TableSortIndicators.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSortIndicators.vue.d.ts","sourceRoot":"","sources":["../../src/components/TableSortIndicators.vue"],"names":[],"mappings":"AAscA,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAQvE,OAAO,KAAK,EACR,cAAc,EACd,WAAW,EACX,+BAA+B,EAC/B,cAAc,EACjB,MAAM,UAAU,CAAC;AAiClB,QAAA,MAAM,wBAAwB;;;;;;;;;IAC1B;;;;;;;;;OASG;;cACoB,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC;;;IACtD;;;;OAIG;;cACuB,QAAQ,CAAC,WAAW,EAAE,CAAC;;;IACjD;;;;;;;OAOG;;;;;IAEH,sEAAsE;;;;;IAEtE,oEAAoE;;;;;IAEpE,2EAA2E;;;;;IAE3E,0EAA0E;;;;;IAE1E,kEAAkE;;;;;IAElE,2EAA2E;;;;;IAE3E,iCAAiC;;;;;CAGpC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,sBAAsB,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE/F,MAAM,MAAM,gCAAgC,GAAG;IAC3C,UAAU,EAAE,cAAc,CAAC;IAC3B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,uDAAuD;IACvD,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC1C,wEAAwE;IACxE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,wDAAwD;IACxD,GAA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{ default as VCTable } from './Table.vue';
|
|
2
|
+
export { default as VCTableLite } from './TableLite.vue';
|
|
3
|
+
export { default as VCTableHeader } from './TableHeader.vue';
|
|
4
|
+
export { default as VCTableBody } from './TableBody.vue';
|
|
5
|
+
export { default as VCTableFooter } from './TableFooter.vue';
|
|
6
|
+
export { default as VCTableRow } from './TableRow.vue';
|
|
7
|
+
export { default as VCTableCell } from './TableCell.vue';
|
|
8
|
+
export { default as VCTableHeadCell } from './TableHeadCell.vue';
|
|
9
|
+
export { default as VCTableEmpty } from './TableEmpty.vue';
|
|
10
|
+
export { default as VCTableLoading } from './TableLoading.vue';
|
|
11
|
+
export { default as VCTableSortIndicators } from './TableSortIndicators.vue';
|
|
12
|
+
export type { TableProps } from './Table.vue';
|
|
13
|
+
export type { TableLiteProps } from './TableLite.vue';
|
|
14
|
+
export type { TableHeaderProps } from './TableHeader.vue';
|
|
15
|
+
export type { TableBodyProps } from './TableBody.vue';
|
|
16
|
+
export type { TableFooterProps } from './TableFooter.vue';
|
|
17
|
+
export type { TableRowProps } from './TableRow.vue';
|
|
18
|
+
export type { TableCellProps } from './TableCell.vue';
|
|
19
|
+
export type { TableHeadCellProps } from './TableHeadCell.vue';
|
|
20
|
+
export type { TableEmptyProps } from './TableEmpty.vue';
|
|
21
|
+
export type { TableLoadingProps } from './TableLoading.vue';
|
|
22
|
+
export type { TableSortIndicatorsAddSlotProps, TableSortIndicatorsChipSlotProps, TableSortIndicatorsClearSlotProps, TableSortIndicatorsProps, } from './TableSortIndicators.vue';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,a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Direction, TableColumn, TableSortState } from '../types';
|
|
3
|
+
import type { RowSelectionKey, RowSelectionState } from './selection';
|
|
4
|
+
export type TableContext<Row = unknown> = {
|
|
5
|
+
data: Ref<Row[]>;
|
|
6
|
+
busy: Ref<boolean>;
|
|
7
|
+
columns: Ref<TableColumn<Row>[]>;
|
|
8
|
+
sort: Ref<TableSortState>;
|
|
9
|
+
/**
|
|
10
|
+
* Cycle the sort state for `key`. `opts.append` (Shift-click) adds
|
|
11
|
+
* the key as a secondary/tertiary descriptor instead of replacing.
|
|
12
|
+
* `opts.direction` jumps straight to a given direction.
|
|
13
|
+
*/
|
|
14
|
+
setSort: (key: string, opts?: {
|
|
15
|
+
append?: boolean;
|
|
16
|
+
direction?: SortDirection;
|
|
17
|
+
}) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Replace the entire sort state directly. Used by
|
|
20
|
+
* `<VCTableSortIndicators>` to remove / reorder / clear descriptors
|
|
21
|
+
* without invoking the per-key cycle logic.
|
|
22
|
+
*/
|
|
23
|
+
setSortState: (next: TableSortState) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Cap on the sort-state array length (`<VCTable :max-sort-keys>`).
|
|
26
|
+
* Exposed so descendants like `<VCTableSortIndicators>` can
|
|
27
|
+
* enforce the cap consistently — `setSortState` itself bypasses
|
|
28
|
+
* cycle logic, so the cap is enforced at the call site.
|
|
29
|
+
*/
|
|
30
|
+
maxSortKeys: Ref<number>;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the host table can actually mutate sort state.
|
|
33
|
+
* `<VCTable>` sets this to `true`; `<VCTableLite>` sets it to
|
|
34
|
+
* `false` (it ships no sort machine). Descendants like
|
|
35
|
+
* `<VCTableSortIndicators>` check this in their context-fallback
|
|
36
|
+
* path so they refuse to silently no-op when mounted inside Lite.
|
|
37
|
+
*/
|
|
38
|
+
supportsSortMutation: boolean;
|
|
39
|
+
/** Whether `<VCTable>` was passed `:rowClickable`. */
|
|
40
|
+
rowClickable: Ref<boolean>;
|
|
41
|
+
/** Currently focused row index (row keyboard nav). `null` when nothing focused. */
|
|
42
|
+
focusedRow: Ref<number | null>;
|
|
43
|
+
setFocusedRow: (index: number | null) => void;
|
|
44
|
+
/** Resolved colspan (Shape A: `columns.length`; Shape B: auto-counted from `<VCTableHeadCell>` siblings). */
|
|
45
|
+
colspan: Ref<number>;
|
|
46
|
+
/** Emit a `row-click` event from inside a body row. */
|
|
47
|
+
emitRowClick: (row: Row, index: number, event: Event) => void;
|
|
48
|
+
/**
|
|
49
|
+
* The positioned wrapper element that wraps the `<table>` in the DOM.
|
|
50
|
+
* `<VCTableLoading :overlay>` teleports here so its `<div>` isn't
|
|
51
|
+
* fostered out of the table by the HTML parser AND so it has a real
|
|
52
|
+
* positioning context for `position: absolute; inset: 0`.
|
|
53
|
+
*/
|
|
54
|
+
wrapperEl: Ref<globalThis.HTMLElement | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Row selection state (plan 033 v1.x-A). Always provided; reports
|
|
57
|
+
* mode `undefined` and `isSelected: () => false` when selection is
|
|
58
|
+
* disabled, so descendants don't need to null-check. `<VCTableRow>`
|
|
59
|
+
* calls `selection.toggle()` on activation and reads `isSelected`
|
|
60
|
+
* to render `aria-selected` + the `selected` theme variant.
|
|
61
|
+
*/
|
|
62
|
+
selection: RowSelectionState;
|
|
63
|
+
/** Resolve the selection key for a given row (function or index fallback). */
|
|
64
|
+
getRowKey: (row: Row, index: number) => RowSelectionKey;
|
|
65
|
+
/**
|
|
66
|
+
* Set of row indices that are currently interactive (focusable +
|
|
67
|
+
* keyboard-navigable). Each `<VCTableRow>` registers / unregisters
|
|
68
|
+
* itself based on its own `isInteractive` state. Used by:
|
|
69
|
+
*
|
|
70
|
+
* - Roving-tabindex fallback — when `focusedRow` is unset or stale,
|
|
71
|
+
* the FIRST interactive row gets `tabindex="0"` (so a disabled
|
|
72
|
+
* row 0 doesn't lock the grid out of Tab navigation).
|
|
73
|
+
* - Arrow / Home / End nav — skips disabled rows by walking the
|
|
74
|
+
* sorted registry rather than the raw data index.
|
|
75
|
+
*/
|
|
76
|
+
interactiveRows: Ref<Set<number>>;
|
|
77
|
+
registerInteractiveRow(index: number): void;
|
|
78
|
+
unregisterInteractiveRow(index: number): void;
|
|
79
|
+
};
|
|
80
|
+
export declare function provideTableContext<Row>(ctx: TableContext<Row>): void;
|
|
81
|
+
export declare function useTable<Row = unknown>(): TableContext<Row> | null;
|
|
82
|
+
export type TableRowContext<Row = unknown> = {
|
|
83
|
+
row: Ref<Row>;
|
|
84
|
+
index: Ref<number>;
|
|
85
|
+
/** Resolved row-level variant from `row._rowVariant`. */
|
|
86
|
+
rowVariant: Ref<string | null>;
|
|
87
|
+
/** Resolved per-cell variants from `row._cellVariants`. */
|
|
88
|
+
cellVariants: Ref<Record<string, string>>;
|
|
89
|
+
/** `true` when `useTable().focusedRow === index`. */
|
|
90
|
+
focused: Ref<boolean>;
|
|
91
|
+
/** Resolved selection key for this row (memoized per render). */
|
|
92
|
+
selectionKey: Ref<RowSelectionKey>;
|
|
93
|
+
/** `true` when the parent table's selection includes this row. */
|
|
94
|
+
selected: Ref<boolean>;
|
|
95
|
+
};
|
|
96
|
+
export declare function provideTableRowContext<Row>(ctx: TableRowContext<Row>): void;
|
|
97
|
+
export declare function useTableRow<Row = unknown>(): TableRowContext<Row> | null;
|
|
98
|
+
export type HeadCellCountContext = {
|
|
99
|
+
register: () => void;
|
|
100
|
+
unregister: () => void;
|
|
101
|
+
};
|
|
102
|
+
export declare function provideHeadCellCountContext(ctx: HeadCellCountContext): void;
|
|
103
|
+
export declare function useHeadCellCountContext(): HeadCellCountContext | null;
|
|
104
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/composables/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,GAAG,EAAE,MAAM,KAAK,CAAC;AAE7C,OAAO,KAAK,EACR,aAAa,EACb,WAAW,EAC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AAC,GAAG,CAAC,GAAG,IAAI,CAExE;AAOD,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAMF,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI,CAE3E;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,GAAG,IAAI,CAErE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { SortDirection, TableColumn, TableColumnRaw, TableSortState } from '../types';
|
|
3
|
+
export type DefineTableOptions<Row> = {
|
|
4
|
+
/** Initial data array. */
|
|
5
|
+
data?: Row[];
|
|
6
|
+
/** Initial column definitions (TableColumn or bare-string shorthand). */
|
|
7
|
+
columns?: TableColumnRaw<Row>[];
|
|
8
|
+
/** Initial busy flag. */
|
|
9
|
+
busy?: boolean;
|
|
10
|
+
/** Initial sort state (array of descriptors). Empty array means no sort. */
|
|
11
|
+
sort?: TableSortState;
|
|
12
|
+
/** Max sort keys retained in multi-sort mode. `0` = unlimited. Default `3`. */
|
|
13
|
+
maxSortKeys?: number;
|
|
14
|
+
/** When `true`, the sort cycle skips the `null` step. Mirrors `<VCTable :must-sort>`. */
|
|
15
|
+
mustSort?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type TableState<Row> = {
|
|
18
|
+
data: Ref<Row[]>;
|
|
19
|
+
columns: ComputedRef<TableColumn<Row>[]>;
|
|
20
|
+
rawColumns: Ref<TableColumnRaw<Row>[]>;
|
|
21
|
+
busy: Ref<boolean>;
|
|
22
|
+
mustSort: Ref<boolean>;
|
|
23
|
+
sort: Ref<TableSortState>;
|
|
24
|
+
setSort: (key: string, opts?: {
|
|
25
|
+
append?: boolean;
|
|
26
|
+
direction?: SortDirection;
|
|
27
|
+
}) => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Pinia-style factory mirroring `defineList()`. Returns reactive state
|
|
31
|
+
* containers + a `setSort` mutator. Useful when a consumer wants to share
|
|
32
|
+
* a table's state across multiple components without prop drilling, or
|
|
33
|
+
* when wiring a controlled table outside the SFC.
|
|
34
|
+
*
|
|
35
|
+
* const usersTable = defineTable<User>({
|
|
36
|
+
* columns: ['id', 'name', 'email'],
|
|
37
|
+
* data: [],
|
|
38
|
+
* busy: false,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* <VCTable :data="usersTable.data" :columns="usersTable.columns" ... />
|
|
42
|
+
*
|
|
43
|
+
* The sort cycle composes `useSortMachine` internally — same semantics
|
|
44
|
+
* as the `<VCTable>` SFC path (honors per-column `initialSortDirection`
|
|
45
|
+
* + `mustSort`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function defineTable<Row = unknown>(options?: DefineTableOptions<Row>): TableState<Row>;
|
|
48
|
+
//# sourceMappingURL=define-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-table.d.ts","sourceRoot":"","sources":["../../src/composables/define-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EACR,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACjB,MAAM,UAAU,CAAC;AAIlB,MAAM,MAAM,kBAAkB,CAAC,GAAG,IAAI;IAClC,0BAA0B;IAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,yEAAyE;IACzE,OAAO,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;IAChC,yBAAyB;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4EAA4E;IAC5E,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,GAAG,IAAI;IAC1B,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACnB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,aAAa,CAAA;KAAE,KAAK,IAAI,CAAC;CAC1F,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAG,OAAO,EACrC,OAAO,GAAE,kBAAkB,CAAC,GAAG,CAAM,GACtC,UAAU,CAAC,GAAG,CAAC,CAkCjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin re-export over `@vuecs/core`'s shared `useSelectionMachine` —
|
|
3
|
+
* the same composable powers `@vuecs/list` (ARIA listbox) and
|
|
4
|
+
* `@vuecs/table` (ARIA grid). Table-specific `RowSelection*` aliases
|
|
5
|
+
* are kept for back-compat with consumers who imported the older
|
|
6
|
+
* names; new code can import directly from `@vuecs/core`.
|
|
7
|
+
*/
|
|
8
|
+
export { useSelectionMachine as useRowSelectionMachine, } from '@vuecs/core';
|
|
9
|
+
export type { SelectionKey as RowSelectionKey, SelectionMode as RowSelectionMode, SelectionState as RowSelectionState, SelectionValue as RowSelectionValue, UseSelectionMachineArgs as UseRowSelectionMachineArgs, } from '@vuecs/core';
|
|
10
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/composables/selection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACH,mBAAmB,IAAI,sBAAsB,GAChD,MAAM,aAAa,CAAC;AACrB,YAAY,EACR,YAAY,IAAI,eAAe,EAC/B,aAAa,IAAI,gBAAgB,EACjC,cAAc,IAAI,iBAAiB,EACnC,cAAc,IAAI,iBAAiB,EACnC,uBAAuB,IAAI,0BAA0B,GACxD,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { SortDirection, TableColumn, TableSortState } from '../types';
|
|
3
|
+
export type UseSortMachineOptions<Row = unknown> = {
|
|
4
|
+
/** Reactive source-of-truth from the consumer's `v-model:sort`. May be `undefined`. */
|
|
5
|
+
source: Ref<TableSortState | undefined>;
|
|
6
|
+
/** Reactive column list — needed to resolve `initialSortDirection`. */
|
|
7
|
+
columns: Ref<TableColumn<Row>[]>;
|
|
8
|
+
/** When `true`, the cycle skips the `null` step → `null → asc → desc → asc`. */
|
|
9
|
+
mustSort: Ref<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum number of sort keys retained in multi-sort mode (plan 033
|
|
12
|
+
* v1.x-B). When adding a key past this cap, the oldest descriptor
|
|
13
|
+
* is dropped. Defaults to `3` in `<VCTable>`.
|
|
14
|
+
*/
|
|
15
|
+
maxSortKeys: Ref<number>;
|
|
16
|
+
/** Emit handler that propagates each change back to the consumer. */
|
|
17
|
+
emit: (next: TableSortState) => void;
|
|
18
|
+
};
|
|
19
|
+
export type SortMachine = {
|
|
20
|
+
state: ComputedRef<TableSortState>;
|
|
21
|
+
/**
|
|
22
|
+
* Cycle the sort state for `key`.
|
|
23
|
+
*
|
|
24
|
+
* - Plain call (no opts) — replace state with this key alone. Cycles
|
|
25
|
+
* through `initial → opposite → cleared` (or `→ initial` when
|
|
26
|
+
* `mustSort`).
|
|
27
|
+
* - `opts.append === true` (Shift-click) — add `key` as a secondary
|
|
28
|
+
* descriptor at the end of the array OR cycle its direction if
|
|
29
|
+
* already present. Cycling past clears just that key.
|
|
30
|
+
* - `opts.direction` — jump straight to that direction. Honors
|
|
31
|
+
* `append` for placement.
|
|
32
|
+
*/
|
|
33
|
+
setSort: (key: string, opts?: {
|
|
34
|
+
append?: boolean;
|
|
35
|
+
direction?: SortDirection;
|
|
36
|
+
}) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Replace the entire sort state directly. Bypasses cycle + multi-sort
|
|
39
|
+
* gating — used by the chip-row indicator UX which mutates the array
|
|
40
|
+
* declaratively (remove, reorder, clear).
|
|
41
|
+
*/
|
|
42
|
+
setState: (next: TableSortState) => void;
|
|
43
|
+
/** Direction for a key (regardless of sort position), or `null`. */
|
|
44
|
+
directionFor: (key: string) => SortDirection | null;
|
|
45
|
+
/** 1-based position of a key within the sort array, or `null`. */
|
|
46
|
+
positionFor: (key: string) => number | null;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Controlled sort machine. The consumer owns the sort state via
|
|
50
|
+
* `v-model:sort` — the table emits intent only. When `<VCTable
|
|
51
|
+
* :client-sort>` is set, the table additionally sorts data internally
|
|
52
|
+
* via `sortRows()` from `utils/sort-rows.ts`; the controlled v-model
|
|
53
|
+
* still emits, so consumers stay observable.
|
|
54
|
+
*
|
|
55
|
+
* State shape is `SortDescriptor[]` from v1.x-B onward — single-column
|
|
56
|
+
* sort is an array of length 0–1. Multi-key cycling lives entirely
|
|
57
|
+
* here; `<VCTableHeadCell>` reads `directionFor` / `positionFor` to
|
|
58
|
+
* paint the indicator + numeric badge.
|
|
59
|
+
*/
|
|
60
|
+
export declare function useSortMachine<Row = unknown>(options: UseSortMachineOptions<Row>): SortMachine;
|
|
61
|
+
//# sourceMappingURL=sort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/composables/sort.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAER,aAAa,EACb,WAAW,EACX,cAAc,EACjB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,qBAAqB,CAAC,GAAG,GAAG,OAAO,IAAI;IAC/C,uFAAuF;IACvF,MAAM,EAAE,GAAG,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACxC,uEAAuE;IACvE,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjC,gFAAgF;IAChF,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB;;;;OAIG;IACH,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,qEAAqE;IACrE,IAAI,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,aAAa,CAAA;KAAE,KAAK,IAAI,CAAC;IACvF;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,oEAAoE;IACpE,YAAY,EAAE,CAAC,GAAG,EAAE,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