@vuetify/v0 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +5 -0
- package/dist/adapter-B6IrPwib.d.mts +98 -0
- package/dist/adapter-BEJXp-ie.d.mts +11 -0
- package/dist/adapter-BFSJsyv7.mjs +481 -0
- package/dist/{adapter-DlX3FA3A.d.mts → adapter-BO75n0Cn.d.mts} +10 -14
- package/dist/adapter-BSKx9WQ7.mjs +4 -0
- package/dist/adapter-Chznb9Ju.mjs +4 -0
- package/dist/{index-CT5SCLzW.d.mts → adapter-CspReV3g.d.mts} +6 -9
- package/dist/adapter-D8zizQVP.mjs +4 -0
- package/dist/adapter-DDJHLC8K.d.mts +17 -0
- package/dist/adapters-4t-NhR11.mjs +5 -0
- package/dist/adapters-BcoA0zCS.mjs +4 -0
- package/dist/adapters-BjaPK635.mjs +2 -0
- package/dist/adapters-D64TORDu.mjs +2 -0
- package/dist/adapters-DvG-9z9q.mjs +3 -0
- package/dist/browser/index.js +2074 -561
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/{components-C4jI-78d.mjs → components-Dn4Kbi0i.mjs} +149 -101
- package/dist/composables/index.d.mts +20 -19
- package/dist/composables/index.mjs +31 -29
- package/dist/{consola-BdgyPEfx.d.mts → consola-CUNHyu8J.d.mts} +2 -2
- package/dist/{consola-Ceox8BWi.mjs → consola-DYvbPNbF.mjs} +3 -1
- package/dist/constants/index.d.mts +1 -1
- package/dist/constants/index.mjs +2 -2
- package/dist/{createDataTable-iODP6aKB.mjs → createDataTable-H-PuVigU.mjs} +216 -124
- package/dist/{createGroup-CGk6hY_Y.mjs → createGroup-aHt_kvtU.mjs} +3 -3
- package/dist/{createRegistry-BXzdXAjq.mjs → createRegistry-CWpvSbCe.mjs} +78 -41
- package/dist/{createSelection-B3HJEPNg.mjs → createSelection-MRyUZyW2.mjs} +3 -3
- package/dist/{createSingle-Dql8mRi-.mjs → createSingle-BSciC9EJ.mjs} +1 -1
- package/dist/{createTokens-DgFYsOrv.mjs → createTokens-CQ9C7GTV.mjs} +2 -2
- package/dist/data-table/adapters/client/index.d.mts +2 -2
- package/dist/data-table/adapters/client/index.mjs +2 -2
- package/dist/data-table/adapters/index.d.mts +5 -5
- package/dist/data-table/adapters/index.mjs +6 -6
- package/dist/data-table/adapters/server/index.d.mts +2 -2
- package/dist/data-table/adapters/server/index.mjs +2 -2
- package/dist/data-table/adapters/virtual/index.d.mts +2 -2
- package/dist/data-table/adapters/virtual/index.mjs +2 -2
- package/dist/data-table/index.d.mts +6 -6
- package/dist/data-table/index.mjs +6 -6
- package/dist/date/index.d.mts +3 -3
- package/dist/date/index.mjs +12 -5
- package/dist/features/adapters/flagsmith/index.d.mts +2 -2
- package/dist/features/adapters/flagsmith/index.mjs +2 -2
- package/dist/features/adapters/launchdarkly/index.d.mts +2 -2
- package/dist/features/adapters/launchdarkly/index.mjs +2 -2
- package/dist/features/adapters/posthog/index.d.mts +2 -2
- package/dist/features/adapters/posthog/index.mjs +2 -2
- package/dist/features/index.d.mts +3 -3
- package/dist/features/index.mjs +2 -1
- package/dist/{index-BzFHTW59.d.mts → flagsmith-Cd44vxff.d.mts} +4 -4
- package/dist/{flagsmith-Dbh1h8WF.mjs → flagsmith-Cu93hUIF.mjs} +6 -4
- package/dist/{globals-zEjWBKCr.mjs → globals-BRdxsC2M.mjs} +1 -1
- package/dist/{index-GOpjKzaJ.d.mts → index-BLaKZq0Y.d.mts} +25 -2
- package/dist/{index-BJGcVy7e.d.mts → index-BmEu85PI.d.mts} +126 -65
- package/dist/{index-DE3bWw11.d.mts → index-C0ewabdY.d.mts} +93 -215
- package/dist/index-C6NnIuDv.d.mts +4 -0
- package/dist/{index-DNDuacmH.d.mts → index-CJdG9yY1.d.mts} +116 -106
- package/dist/index-C_t6t0Z-.d.mts +170 -0
- package/dist/{index-B76iGRE3.d.mts → index-CyUCELZC.d.mts} +1149 -61
- package/dist/index.d.mts +24 -23
- package/dist/index.mjs +35 -33
- package/dist/json/attributes.json +1 -1
- package/dist/json/web-types.json +2 -2
- package/dist/{launchdarkly-BKtW-idu.mjs → launchdarkly-CLGtJCsI.mjs} +6 -4
- package/dist/launchdarkly-De701hkf.d.mts +13 -0
- package/dist/locale/adapters/index.d.mts +3 -3
- package/dist/locale/adapters/index.mjs +4 -3
- package/dist/locale/adapters/v0/index.d.mts +2 -2
- package/dist/locale/adapters/v0/index.mjs +2 -2
- package/dist/locale/adapters/vue-i18n/index.d.mts +3 -3
- package/dist/locale/adapters/vue-i18n/index.mjs +4 -2
- package/dist/locale/index.d.mts +4 -4
- package/dist/locale/index.mjs +4 -3
- package/dist/logger/adapters/consola/index.d.mts +1 -1
- package/dist/logger/adapters/consola/index.mjs +1 -1
- package/dist/logger/adapters/index.d.mts +5 -5
- package/dist/logger/adapters/index.mjs +6 -5
- package/dist/logger/adapters/pino/index.d.mts +1 -1
- package/dist/logger/adapters/pino/index.mjs +1 -1
- package/dist/logger/adapters/v0/index.d.mts +2 -2
- package/dist/logger/adapters/v0/index.mjs +2 -2
- package/dist/logger/index.d.mts +6 -6
- package/dist/logger/index.mjs +6 -5
- package/dist/{memory-oYBvtkgx.mjs → memory-BMpJcQjQ.mjs} +13 -3
- package/dist/{memory-CeSQE-QV.d.mts → memory-D-JbdKXg.d.mts} +9 -9
- package/dist/notifications/index.d.mts +30 -4
- package/dist/notifications/index.mjs +187 -126
- package/dist/palettes/ant/index.d.mts +1 -1
- package/dist/palettes/index.d.mts +3 -3
- package/dist/palettes/leonardo/generate/index.mjs +3 -0
- package/dist/palettes/material/index.d.mts +1 -1
- package/dist/palettes/md1/index.d.mts +1 -1
- package/dist/palettes/md2/index.d.mts +1 -1
- package/dist/palettes/radix/index.d.mts +1 -1
- package/dist/palettes/tailwind/index.d.mts +1 -1
- package/dist/permissions/adapters/index.d.mts +2 -2
- package/dist/permissions/adapters/index.mjs +3 -3
- package/dist/permissions/adapters/v0/index.d.mts +2 -2
- package/dist/permissions/adapters/v0/index.mjs +2 -2
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +3 -3
- package/dist/{pino-DNfCEb0p.d.mts → pino-BaYY_KIN.d.mts} +2 -2
- package/dist/{pino-9L79n6y6.mjs → pino-CIcYlW3u.mjs} +3 -1
- package/dist/{posthog-DmuyycaR.mjs → posthog-0umvvA48.mjs} +7 -5
- package/dist/posthog-CIrmvke4.d.mts +13 -0
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/{server-3ilWFwqe.d.mts → server-7vjHxjNc.d.mts} +5 -5
- package/dist/{server-y7zLSCSx.mjs → server-BNSiVoMe.mjs} +4 -3
- package/dist/storage/adapters/index.d.mts +3 -3
- package/dist/storage/adapters/index.mjs +2 -2
- package/dist/storage/adapters/memory/index.d.mts +2 -2
- package/dist/storage/adapters/memory/index.mjs +2 -2
- package/dist/storage/index.d.mts +4 -4
- package/dist/storage/index.mjs +3 -3
- package/dist/theme/adapters/index.d.mts +2 -2
- package/dist/theme/adapters/index.mjs +4 -4
- package/dist/theme/adapters/unhead/index.d.mts +1 -1
- package/dist/theme/adapters/unhead/index.mjs +1 -1
- package/dist/theme/adapters/v0/index.d.mts +1 -1
- package/dist/theme/adapters/v0/index.mjs +1 -1
- package/dist/theme/index.d.mts +1 -1
- package/dist/theme/index.mjs +3 -3
- package/dist/types/index.d.mts +1 -1
- package/dist/{unhead-B-I2OS6i.mjs → unhead-_cXZcx0j.mjs} +2 -2
- package/dist/{useClickOutside-CY4U2J9W.mjs → useClickOutside-DbOLg1uw.mjs} +1483 -182
- package/dist/{useFeatures-BPOke6iP.mjs → useFeatures-Dhnr-Lg2.mjs} +7 -10
- package/dist/{useLocale-BV8e3imF.mjs → useLocale-Sh-2sNiG.mjs} +6 -6
- package/dist/{useLogger-DvdRTrqC.mjs → useLogger-1_ZeBY12.mjs} +5 -5
- package/dist/{useNotifications-vSJE6z6t.mjs → useNotifications-CAVQ7hK6.mjs} +6 -6
- package/dist/{usePermissions-D3zPwKQc.mjs → usePermissions-D9Oituwy.mjs} +6 -6
- package/dist/{useRules-BT6cgoTj.mjs → useRules-DK4AeNeC.mjs} +4 -3
- package/dist/{useTheme-cUZb2A9O.mjs → useTheme-FMDQC81h.mjs} +5 -5
- package/dist/utilities/index.d.mts +2 -2
- package/dist/utilities/index.mjs +26 -2
- package/dist/{v0-CHZpnMeP.mjs → v0-C42ssNIy.mjs} +6 -4
- package/dist/{v0-Dq3zhexO.mjs → v0-CEfbyyp2.mjs} +3 -4
- package/dist/{v0-C49OI_wc.mjs → v0-Ch-O6YVd.mjs} +5 -3
- package/dist/{v0-gpExNexS.mjs → v0-D0imQlSD.mjs} +2 -2
- package/dist/{v0-DrOub-e1.d.mts → v0-DWZ_N2GG.d.mts} +4 -4
- package/dist/{v0-Bmow1q_x.mjs → v0-Dvu8fMl3.mjs} +3 -3
- package/dist/v0-QIjffi4E.d.mts +8 -0
- package/dist/{v0-D7Fm2C3Y.d.mts → v0-aYLq6qmT.d.mts} +3 -3
- package/dist/{virtual-C0yHf1DC.mjs → virtual-Cq5aRp7m.mjs} +3 -4
- package/dist/virtual-CrgGA-o6.d.mts +8 -0
- package/package.json +1 -1
- package/dist/adapter-58IvIfAZ.d.mts +0 -96
- package/dist/adapter-BvWEd9w-.d.mts +0 -17
- package/dist/adapter-Dhq68tz0.d.mts +0 -11
- package/dist/adapter-gQ2SNKZq.mjs +0 -238
- package/dist/adapters-BSiqsTZN.mjs +0 -3
- package/dist/adapters-C3QXhf4I.mjs +0 -2
- package/dist/adapters-CMJGA1k7.mjs +0 -2
- package/dist/adapters-Dse4bPxk.mjs +0 -5
- package/dist/adapters-_ZqxCD8f.mjs +0 -4
- package/dist/createPagination-CHF7SmmK.mjs +0 -247
- package/dist/index-1XdASTjp.d.mts +0 -13
- package/dist/index-C6rdXZ7j.d.mts +0 -11
- package/dist/index-Dp1HjBxJ.d.mts +0 -13
- package/dist/v0-CdusXjY_.d.mts +0 -8
- package/dist/virtual-D4fckewC.d.mts +0 -8
- /package/dist/{adapter-Be9zUc-n.mjs → adapter-oM18AdUc.mjs} +0 -0
- /package/dist/{htmlElements-D4oMQZPJ.mjs → htmlElements-CHXZfsZu.mjs} +0 -0
- /package/dist/{index-CFhUdAHM.d.mts → index-BOn0AAue.d.mts} +0 -0
- /package/dist/{index-CROz1VSV.d.mts → index-CKKoxA9V.d.mts} +0 -0
- /package/dist/{index-DuddF-NR.d.mts → index-CLR1QMM3.d.mts} +0 -0
- /package/dist/{index-DTvqw22G.d.mts → index-H_hl6-4b.d.mts} +0 -0
- /package/dist/{index-BgCkepP_.d.mts → index-PvkxPev3.d.mts} +0 -0
- /package/dist/{toArray-as9BWxBK.mjs → toArray-CD2-OxAz.mjs} +0 -0
package/README.md
CHANGED
|
@@ -168,7 +168,9 @@ Base data structures that most other composables build upon:
|
|
|
168
168
|
|
|
169
169
|
- [`createDataTable`](https://0.vuetifyjs.com/composables/data/create-data-table) - Data table with sort, filter, pagination, row selection, grouping, and adapter pattern
|
|
170
170
|
- [`createFilter`](https://0.vuetifyjs.com/composables/data/create-filter) - Reactive array filtering with multiple modes
|
|
171
|
+
- [`createKanban`](https://0.vuetifyjs.com/composables/data/create-kanban) - Two-level sortable orchestrator (columns + items)
|
|
171
172
|
- [`createPagination`](https://0.vuetifyjs.com/composables/data/create-pagination) - Lightweight page navigation
|
|
173
|
+
- [`createSortable`](https://0.vuetifyjs.com/composables/data/create-sortable) - Ordered-list state with `move` / `swap` / `reorder` and a `disabled` mutation gate
|
|
172
174
|
- [`createVirtual`](https://0.vuetifyjs.com/composables/data/create-virtual) - Virtual scrolling for large lists
|
|
173
175
|
|
|
174
176
|
#### Selection
|
|
@@ -187,6 +189,7 @@ Selection management composables built on `createRegistry`:
|
|
|
187
189
|
- [`createForm`](https://0.vuetifyjs.com/composables/forms/create-form) - Form validation and state management with async rules
|
|
188
190
|
- [`createInput`](https://0.vuetifyjs.com/composables/forms/create-input) - Shared form field state: validation, dirty/pristine, ARIA IDs
|
|
189
191
|
- [`createNumberField`](https://0.vuetifyjs.com/composables/forms/create-number-field) - Numeric input state with formatting, stepping, and validation
|
|
192
|
+
- [`createOtp`](https://0.vuetifyjs.com/composables/forms/create-otp) - OTP / verification code state with pattern-gated entry and decisional completion hook
|
|
190
193
|
- [`createValidation`](https://0.vuetifyjs.com/composables/forms/create-validation) - Field-level validation with sync/async rules
|
|
191
194
|
- [`createCombobox`](https://0.vuetifyjs.com/composables/forms/create-combobox) - Combobox state management with filtering and virtual focus
|
|
192
195
|
- [`createRating`](https://0.vuetifyjs.com/composables/forms/create-rating) - Bounded rating value with discrete items and half-step support
|
|
@@ -206,12 +209,14 @@ Selection management composables built on `createRegistry`:
|
|
|
206
209
|
|
|
207
210
|
- [`toArray`](https://0.vuetifyjs.com/composables/transformers/to-array) - Array transformation utilities
|
|
208
211
|
- [`toElement`](https://0.vuetifyjs.com/composables/transformers/to-element) - Normalize refs, selectors, and elements to DOM elements
|
|
212
|
+
- [`toHighlight`](https://0.vuetifyjs.com/composables/transformers/to-highlight) - Split text into matched and unmatched chunks for query highlighting
|
|
209
213
|
- [`toReactive`](https://0.vuetifyjs.com/composables/transformers/to-reactive) - Reactive object conversion
|
|
210
214
|
|
|
211
215
|
#### System
|
|
212
216
|
|
|
213
217
|
- [`useClickOutside`](https://0.vuetifyjs.com/composables/system/use-click-outside) - Click outside detection with cleanup
|
|
214
218
|
- [`useDelay`](https://0.vuetifyjs.com/composables/system/use-delay) - Schedule open and close transitions with configurable delays
|
|
219
|
+
- [`useDragDrop`](https://0.vuetifyjs.com/composables/system/use-drag-drop) - Headless drag-and-drop primitive with two registries, pluggable adapters, and accessibility-first defaults
|
|
215
220
|
- [`useEventListener`](https://0.vuetifyjs.com/composables/system/use-event-listener) - Lifecycle-managed event listeners
|
|
216
221
|
- [`useHotkey`](https://0.vuetifyjs.com/composables/system/use-hotkey) - Hotkey combinations and sequences
|
|
217
222
|
- [`useImage`](https://0.vuetifyjs.com/composables/system/use-image) - Image loading state machine with deferred loading and retry
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
|
|
3
|
+
//#region src/composables/useDate/adapters/adapter.d.ts
|
|
4
|
+
declare abstract class DateAdapter<T = Temporal.PlainDateTime> {
|
|
5
|
+
/** Current locale for formatting */
|
|
6
|
+
abstract get locale(): string;
|
|
7
|
+
/** First day of week. 0=Sunday, 1=Monday, ... 6=Saturday. Managed by the plugin. */
|
|
8
|
+
abstract get firstDayOfWeek(): number;
|
|
9
|
+
abstract set locale(value: string);
|
|
10
|
+
abstract set firstDayOfWeek(value: number);
|
|
11
|
+
/** Create a date from various input types */
|
|
12
|
+
abstract date(value?: unknown): T | null;
|
|
13
|
+
/** Convert to JavaScript Date object */
|
|
14
|
+
abstract toJsDate(value: T): Date;
|
|
15
|
+
/** Parse ISO 8601 string */
|
|
16
|
+
abstract parseISO(date: string): T;
|
|
17
|
+
/** Convert to ISO 8601 string */
|
|
18
|
+
abstract toISO(date: T): string;
|
|
19
|
+
/** Parse date string with custom format */
|
|
20
|
+
abstract parse(value: string, format: string): T | null;
|
|
21
|
+
/** Check if value is a valid date (type predicate for narrowing) */
|
|
22
|
+
abstract isValid(date: unknown): date is T;
|
|
23
|
+
/** Check if value is null (type predicate for narrowing) */
|
|
24
|
+
abstract isNullish(value: T | null): value is null;
|
|
25
|
+
/** Get current locale code */
|
|
26
|
+
abstract getCurrentLocaleCode(): string;
|
|
27
|
+
/** Check if current locale uses 12-hour cycle */
|
|
28
|
+
abstract is12HourCycleInCurrentLocale(): boolean;
|
|
29
|
+
/** Format date using preset format key */
|
|
30
|
+
abstract format(date: T, formatString: string): string;
|
|
31
|
+
/** Format date using custom format string */
|
|
32
|
+
abstract formatByString(date: T, formatString: string): string;
|
|
33
|
+
/** Get helper text for format string (e.g., "mm/dd/yyyy") */
|
|
34
|
+
abstract getFormatHelperText(format: string): string;
|
|
35
|
+
/** Format number according to locale */
|
|
36
|
+
abstract formatNumber(numberToFormat: string): string;
|
|
37
|
+
/** Get meridiem text (AM/PM) for locale */
|
|
38
|
+
abstract getMeridiemText(ampm: 'am' | 'pm'): string;
|
|
39
|
+
abstract startOfDay(date: T): T;
|
|
40
|
+
abstract endOfDay(date: T): T;
|
|
41
|
+
abstract startOfWeek(date: T): T;
|
|
42
|
+
abstract endOfWeek(date: T): T;
|
|
43
|
+
abstract startOfMonth(date: T): T;
|
|
44
|
+
abstract endOfMonth(date: T): T;
|
|
45
|
+
abstract startOfYear(date: T): T;
|
|
46
|
+
abstract endOfYear(date: T): T;
|
|
47
|
+
abstract addSeconds(date: T, amount: number): T;
|
|
48
|
+
abstract addMinutes(date: T, amount: number): T;
|
|
49
|
+
abstract addHours(date: T, amount: number): T;
|
|
50
|
+
abstract addDays(date: T, amount: number): T;
|
|
51
|
+
abstract addWeeks(date: T, amount: number): T;
|
|
52
|
+
abstract addMonths(date: T, amount: number): T;
|
|
53
|
+
abstract addYears(date: T, amount: number): T;
|
|
54
|
+
abstract isAfter(date: T, comparing: T): boolean;
|
|
55
|
+
abstract isAfterDay(date: T, comparing: T): boolean;
|
|
56
|
+
abstract isAfterMonth(date: T, comparing: T): boolean;
|
|
57
|
+
abstract isAfterYear(date: T, comparing: T): boolean;
|
|
58
|
+
abstract isBefore(date: T, comparing: T): boolean;
|
|
59
|
+
abstract isBeforeDay(date: T, comparing: T): boolean;
|
|
60
|
+
abstract isBeforeMonth(date: T, comparing: T): boolean;
|
|
61
|
+
abstract isBeforeYear(date: T, comparing: T): boolean;
|
|
62
|
+
abstract isEqual(date: T, comparing: T): boolean;
|
|
63
|
+
abstract isSameDay(date: T, comparing: T): boolean;
|
|
64
|
+
abstract isSameMonth(date: T, comparing: T): boolean;
|
|
65
|
+
abstract isSameYear(date: T, comparing: T): boolean;
|
|
66
|
+
abstract isSameHour(date: T, comparing: T): boolean;
|
|
67
|
+
abstract isWithinRange(date: T, range: [T, T]): boolean;
|
|
68
|
+
abstract getYear(date: T): number;
|
|
69
|
+
abstract getMonth(date: T): number;
|
|
70
|
+
abstract getDate(date: T): number;
|
|
71
|
+
abstract getHours(date: T): number;
|
|
72
|
+
abstract getMinutes(date: T): number;
|
|
73
|
+
abstract getSeconds(date: T): number;
|
|
74
|
+
/** @param comparing - Can be T or ISO string */
|
|
75
|
+
abstract getDiff(date: T, comparing: T | string, unit?: string): number;
|
|
76
|
+
/** @param minimalDays - Minimum days in first week for it to count as week 1 */
|
|
77
|
+
abstract getWeek(date: T, minimalDays?: number): number;
|
|
78
|
+
/** Get number of days in the month */
|
|
79
|
+
abstract getDaysInMonth(date: T): number;
|
|
80
|
+
abstract setYear(date: T, year: number): T;
|
|
81
|
+
abstract setMonth(date: T, month: number): T;
|
|
82
|
+
abstract setDate(date: T, day: number): T;
|
|
83
|
+
abstract setHours(date: T, hours: number): T;
|
|
84
|
+
abstract setMinutes(date: T, minutes: number): T;
|
|
85
|
+
abstract setSeconds(date: T, seconds: number): T;
|
|
86
|
+
abstract getWeekdays(weekdayFormat?: 'long' | 'short' | 'narrow'): string[];
|
|
87
|
+
abstract getWeekArray(date: T): T[][];
|
|
88
|
+
/** Get array of months in a year (12 dates, one for each month) */
|
|
89
|
+
abstract getMonthArray(date: T): T[];
|
|
90
|
+
/** Get array of years between start and end dates */
|
|
91
|
+
abstract getYearRange(start: T, end: T): T[];
|
|
92
|
+
abstract getNextMonth(date: T): T;
|
|
93
|
+
abstract getPreviousMonth(date: T): T;
|
|
94
|
+
/** Merge date from one value with time from another */
|
|
95
|
+
abstract mergeDateAndTime(date: T, time: T): T;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { DateAdapter as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/composables/useLogger/adapters/adapter.d.ts
|
|
2
|
+
declare abstract class LoggerAdapter {
|
|
3
|
+
abstract debug(message: string, ...args: unknown[]): void;
|
|
4
|
+
abstract info(message: string, ...args: unknown[]): void;
|
|
5
|
+
abstract warn(message: string, ...args: unknown[]): void;
|
|
6
|
+
abstract error(message: string, ...args: unknown[]): void;
|
|
7
|
+
trace?(message: string, ...args: unknown[]): void;
|
|
8
|
+
fatal?(message: string, ...args: unknown[]): void;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { LoggerAdapter as t };
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { clamp, isArray, isNaN, isNullOrUndefined, isNumber, isObject, isString, range } from "./utilities/index.mjs";
|
|
2
|
+
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
3
|
+
import { t as toArray } from "./toArray-CD2-OxAz.mjs";
|
|
4
|
+
import { computed, isRef, shallowRef, toRef, toValue } from "vue";
|
|
5
|
+
//#region src/composables/createFilter/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* @module createFilter
|
|
8
|
+
*
|
|
9
|
+
* @see https://0.vuetifyjs.com/composables/data/create-filter
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Reactive array filtering composable with multiple filter modes.
|
|
13
|
+
*
|
|
14
|
+
* Key features:
|
|
15
|
+
* - Four filter modes: some, every, union, intersection
|
|
16
|
+
* - Case-insensitive filtering
|
|
17
|
+
* - Custom filter functions
|
|
18
|
+
* - Reactive updates
|
|
19
|
+
* - Context-based DI support
|
|
20
|
+
* - Perfect for search, multi-criteria filtering
|
|
21
|
+
*
|
|
22
|
+
* Filters arrays based on query strings with configurable matching strategies.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { createFilter } from '@vuetify/v0'
|
|
27
|
+
*
|
|
28
|
+
* const filter = createFilter({ mode: 'some' })
|
|
29
|
+
* const { items } = filter.apply('an', ['apple', 'banana', 'cherry'])
|
|
30
|
+
* console.log(items.value) // ['banana']
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function defaultFilter(query, item, keys, mode = "some") {
|
|
34
|
+
const queries = (/* @__PURE__ */ toArray(query)).map((q) => String(q).toLowerCase());
|
|
35
|
+
const stringValues = (/* @__PURE__ */ isObject(item) ? keys?.length ? keys.map((k) => item[k]) : Object.values(item) : [item]).map((v) => String(v).toLowerCase());
|
|
36
|
+
if (mode === "some") return queries.some((q) => stringValues.some((val) => val.includes(q)));
|
|
37
|
+
if (mode === "every") return queries.every((q) => stringValues.every((val) => val.includes(q)));
|
|
38
|
+
const joined = stringValues.join("\0");
|
|
39
|
+
if (mode === "union") return queries.some((q) => joined.includes(q));
|
|
40
|
+
if (mode === "intersection") return queries.every((q) => joined.includes(q));
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a filter context with pre-configured options.
|
|
45
|
+
*
|
|
46
|
+
* @param options The filter options
|
|
47
|
+
* @template Z The type of the items
|
|
48
|
+
* @template E The type of the filter context
|
|
49
|
+
* @returns A filter context
|
|
50
|
+
*
|
|
51
|
+
* @see https://0.vuetifyjs.com/composables/data/create-filter
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { createFilter } from '@vuetify/v0'
|
|
56
|
+
*
|
|
57
|
+
* const filter = createFilter({
|
|
58
|
+
* mode: 'intersection',
|
|
59
|
+
* keys: ['name', 'email'],
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* const { items } = filter.apply(query, users)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
function createFilter(options = {}) {
|
|
66
|
+
const { customFilter, keys, mode = "some" } = options;
|
|
67
|
+
const filterFunction = customFilter ?? ((q, i) => defaultFilter(q, i, keys, mode));
|
|
68
|
+
const query = shallowRef("");
|
|
69
|
+
function apply(_query, items) {
|
|
70
|
+
return { items: computed(() => {
|
|
71
|
+
const q = toValue(_query);
|
|
72
|
+
query.value = q;
|
|
73
|
+
const queries = (/* @__PURE__ */ toArray(q)).filter((q) => String(q).trim());
|
|
74
|
+
if (queries.length === 0) return toValue(items);
|
|
75
|
+
const queryParam = queries.length === 1 ? queries[0] : queries;
|
|
76
|
+
return toValue(items).filter((item) => filterFunction(queryParam, item));
|
|
77
|
+
}) };
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
mode,
|
|
81
|
+
keys,
|
|
82
|
+
customFilter,
|
|
83
|
+
query,
|
|
84
|
+
apply
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Creates a filter context with dependency injection support.
|
|
89
|
+
*
|
|
90
|
+
* @param options The filter context options
|
|
91
|
+
* @template Z The type of the items
|
|
92
|
+
* @template E The type of the filter context
|
|
93
|
+
* @returns A trinity tuple: [useContext, provideContext, defaultContext]
|
|
94
|
+
*
|
|
95
|
+
* @see https://0.vuetifyjs.com/composables/data/create-filter
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* import { createFilterContext } from '@vuetify/v0'
|
|
100
|
+
*
|
|
101
|
+
* export const [useSearchFilter, provideSearchFilter, searchFilter] = createFilterContext({
|
|
102
|
+
* namespace: 'app:search',
|
|
103
|
+
* mode: 'union',
|
|
104
|
+
* keys: ['title', 'description'],
|
|
105
|
+
* })
|
|
106
|
+
*
|
|
107
|
+
* // In parent component
|
|
108
|
+
* provideSearchFilter()
|
|
109
|
+
*
|
|
110
|
+
* // In child component
|
|
111
|
+
* const filter = useSearchFilter()
|
|
112
|
+
* const { items } = filter.apply(query, products)
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
function createFilterContext(_options = {}) {
|
|
116
|
+
const { namespace = "v0:filter", ...options } = _options;
|
|
117
|
+
return createTrinity(namespace, createFilter(options));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Returns the current filter context from dependency injection.
|
|
121
|
+
*
|
|
122
|
+
* @param namespace The namespace for the filter context. Defaults to `'v0:filter'`.
|
|
123
|
+
* @template Z The type of the items.
|
|
124
|
+
* @template E The type of the filter context.
|
|
125
|
+
* @returns The current filter context.
|
|
126
|
+
*
|
|
127
|
+
* @see https://0.vuetifyjs.com/composables/data/create-filter
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```vue
|
|
131
|
+
* <script setup lang="ts">
|
|
132
|
+
* import { useFilter } from '@vuetify/v0'
|
|
133
|
+
*
|
|
134
|
+
* const filter = useFilter()
|
|
135
|
+
* const { items } = filter.apply(query, products)
|
|
136
|
+
* <\/script>
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
function useFilter(namespace = "v0:filter") {
|
|
140
|
+
return useContext(namespace);
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/composables/createPagination/index.ts
|
|
144
|
+
/**
|
|
145
|
+
* @module createPagination
|
|
146
|
+
*
|
|
147
|
+
* @see https://0.vuetifyjs.com/composables/data/create-pagination
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* Lightweight pagination composable for navigating through pages.
|
|
151
|
+
*
|
|
152
|
+
* Key features:
|
|
153
|
+
* - No registry overhead - just a bounded integer
|
|
154
|
+
* - Direct ref support for v-model compatibility
|
|
155
|
+
* - Navigation methods: next, prev, first, last
|
|
156
|
+
* - Computed visible items with ellipsis
|
|
157
|
+
* - Trinity pattern for dependency injection
|
|
158
|
+
*
|
|
159
|
+
* Unlike registry-based composables, pagination tracks a single number
|
|
160
|
+
* within a range, making it efficient for large page counts.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* import { createPagination } from '@vuetify/v0'
|
|
165
|
+
*
|
|
166
|
+
* const pagination = createPagination({ size: 100, itemsPerPage: 10 })
|
|
167
|
+
* pagination.next()
|
|
168
|
+
* console.log(pagination.page.value) // 2
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
/**
|
|
172
|
+
* Creates a pagination instance.
|
|
173
|
+
*
|
|
174
|
+
* @param options The options for the pagination instance.
|
|
175
|
+
* @returns A pagination context with navigation methods.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* import { createPagination } from '@vuetify/v0'
|
|
180
|
+
*
|
|
181
|
+
* // Basic usage
|
|
182
|
+
* const pagination = createPagination({ size: 100 })
|
|
183
|
+
* pagination.next()
|
|
184
|
+
* pagination.items.value // [{ type: 'page', value: 1 }, { type: 'page', value: 2 }, ...]
|
|
185
|
+
*
|
|
186
|
+
* // With v-model (pass a ref)
|
|
187
|
+
* const page = ref(1)
|
|
188
|
+
* const pagination = createPagination({ page, size: 100 })
|
|
189
|
+
* // Mutating pagination.page or the passed ref syncs both
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
function createPagination(_options = {}) {
|
|
193
|
+
const { page: _page = 1, itemsPerPage: _itemsPerPage = 10, size: _size = 0, visible: _visible = 7, ellipsis = "..." } = _options;
|
|
194
|
+
const _raw = isRef(_page) ? _page : shallowRef(_page);
|
|
195
|
+
const pages = computed(() => {
|
|
196
|
+
const size = toValue(_size);
|
|
197
|
+
const perPage = toValue(_itemsPerPage);
|
|
198
|
+
if (size <= 0 || /* @__PURE__ */ isNaN(size)) return 0;
|
|
199
|
+
return Math.ceil(size / perPage);
|
|
200
|
+
});
|
|
201
|
+
const page = computed({
|
|
202
|
+
get: () => {
|
|
203
|
+
const p = pages.value;
|
|
204
|
+
return p > 0 ? /* @__PURE__ */ clamp(_raw.value, 1, p) : _raw.value;
|
|
205
|
+
},
|
|
206
|
+
set: (v) => {
|
|
207
|
+
_raw.value = v;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
function first() {
|
|
211
|
+
page.value = 1;
|
|
212
|
+
}
|
|
213
|
+
function last() {
|
|
214
|
+
page.value = Math.max(1, pages.value);
|
|
215
|
+
}
|
|
216
|
+
function next() {
|
|
217
|
+
if (page.value < pages.value) page.value++;
|
|
218
|
+
}
|
|
219
|
+
function prev() {
|
|
220
|
+
if (page.value > 1) page.value--;
|
|
221
|
+
}
|
|
222
|
+
function select(value) {
|
|
223
|
+
if (value < 1) page.value = 1;
|
|
224
|
+
else if (value > pages.value) page.value = Math.max(1, pages.value);
|
|
225
|
+
else page.value = value;
|
|
226
|
+
}
|
|
227
|
+
const isFirst = toRef(() => page.value <= 1);
|
|
228
|
+
const isLast = toRef(() => page.value >= pages.value);
|
|
229
|
+
const pageStart = toRef(() => (page.value - 1) * toValue(_itemsPerPage));
|
|
230
|
+
const pageStop = toRef(() => Math.min(pageStart.value + toValue(_itemsPerPage), toValue(_size)));
|
|
231
|
+
function toPage(value) {
|
|
232
|
+
return {
|
|
233
|
+
type: "page",
|
|
234
|
+
value
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function toEllipsis() {
|
|
238
|
+
return ellipsis === false ? false : {
|
|
239
|
+
type: "ellipsis",
|
|
240
|
+
value: ellipsis
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function filter(array) {
|
|
244
|
+
return array.filter((item) => item !== false);
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
page,
|
|
248
|
+
ellipsis,
|
|
249
|
+
items: computed(() => {
|
|
250
|
+
const pageCount = pages.value;
|
|
251
|
+
const visible = toValue(_visible);
|
|
252
|
+
const current = page.value;
|
|
253
|
+
if (pageCount <= 0 || /* @__PURE__ */ isNaN(pageCount) || pageCount > Number.MAX_SAFE_INTEGER) return [];
|
|
254
|
+
if (visible <= 0) return [];
|
|
255
|
+
if (visible <= 2) return [toPage(current)];
|
|
256
|
+
if (pageCount <= visible) return (/* @__PURE__ */ range(pageCount, 1)).map(toPage);
|
|
257
|
+
if (visible === 3) {
|
|
258
|
+
const mid = current <= 1 ? 2 : current >= pageCount ? pageCount - 1 : current;
|
|
259
|
+
return [
|
|
260
|
+
toPage(1),
|
|
261
|
+
toPage(mid),
|
|
262
|
+
toPage(pageCount)
|
|
263
|
+
];
|
|
264
|
+
}
|
|
265
|
+
const boundary = visible - 2;
|
|
266
|
+
const middle = visible - 4;
|
|
267
|
+
if (middle <= 0) {
|
|
268
|
+
if (current <= boundary) return filter([
|
|
269
|
+
...(/* @__PURE__ */ range(boundary, 1)).map(toPage),
|
|
270
|
+
toEllipsis(),
|
|
271
|
+
toPage(pageCount)
|
|
272
|
+
]);
|
|
273
|
+
if (current > pageCount - boundary) return filter([
|
|
274
|
+
toPage(1),
|
|
275
|
+
toEllipsis(),
|
|
276
|
+
...(/* @__PURE__ */ range(boundary, pageCount - boundary + 1)).map(toPage)
|
|
277
|
+
]);
|
|
278
|
+
return current <= Math.ceil(pageCount / 2) ? filter([
|
|
279
|
+
toPage(1),
|
|
280
|
+
toPage(current),
|
|
281
|
+
toEllipsis(),
|
|
282
|
+
toPage(pageCount)
|
|
283
|
+
]) : filter([
|
|
284
|
+
toPage(1),
|
|
285
|
+
toEllipsis(),
|
|
286
|
+
toPage(current),
|
|
287
|
+
toPage(pageCount)
|
|
288
|
+
]);
|
|
289
|
+
}
|
|
290
|
+
const leftThreshold = boundary - 1;
|
|
291
|
+
const rightThreshold = pageCount - boundary + 2;
|
|
292
|
+
if (current <= leftThreshold) return filter([
|
|
293
|
+
...(/* @__PURE__ */ range(boundary, 1)).map(toPage),
|
|
294
|
+
toEllipsis(),
|
|
295
|
+
toPage(pageCount)
|
|
296
|
+
]);
|
|
297
|
+
else if (current >= rightThreshold) return filter([
|
|
298
|
+
toPage(1),
|
|
299
|
+
toEllipsis(),
|
|
300
|
+
...(/* @__PURE__ */ range(boundary, pageCount - boundary + 1)).map(toPage)
|
|
301
|
+
]);
|
|
302
|
+
else {
|
|
303
|
+
const start = current - Math.floor(middle / 2);
|
|
304
|
+
return filter([
|
|
305
|
+
toPage(1),
|
|
306
|
+
toEllipsis(),
|
|
307
|
+
...(/* @__PURE__ */ range(middle, start)).map(toPage),
|
|
308
|
+
toEllipsis(),
|
|
309
|
+
toPage(pageCount)
|
|
310
|
+
]);
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
pageStart,
|
|
314
|
+
pageStop,
|
|
315
|
+
isFirst,
|
|
316
|
+
isLast,
|
|
317
|
+
first,
|
|
318
|
+
last,
|
|
319
|
+
next,
|
|
320
|
+
prev,
|
|
321
|
+
select,
|
|
322
|
+
get itemsPerPage() {
|
|
323
|
+
return toValue(_itemsPerPage);
|
|
324
|
+
},
|
|
325
|
+
get size() {
|
|
326
|
+
return toValue(_size);
|
|
327
|
+
},
|
|
328
|
+
get pages() {
|
|
329
|
+
return pages.value;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Creates a pagination context for dependency injection.
|
|
335
|
+
*
|
|
336
|
+
* @param options The options including namespace.
|
|
337
|
+
* @returns A trinity: [usePagination, providePagination, defaultContext]
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```ts
|
|
341
|
+
* // With default namespace 'v0:pagination'
|
|
342
|
+
* const [usePagination, providePaginationContext] = createPaginationContext({ size: 50 })
|
|
343
|
+
*
|
|
344
|
+
* // Or with custom namespace
|
|
345
|
+
* const [usePagination, providePaginationContext] = createPaginationContext({
|
|
346
|
+
* namespace: 'my-pagination',
|
|
347
|
+
* size: 50,
|
|
348
|
+
* })
|
|
349
|
+
*
|
|
350
|
+
* // Parent component
|
|
351
|
+
* providePaginationContext()
|
|
352
|
+
*
|
|
353
|
+
* // Child component
|
|
354
|
+
* const pagination = usePagination()
|
|
355
|
+
* pagination.next()
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
function createPaginationContext(_options = {}) {
|
|
359
|
+
const { namespace = "v0:pagination", ...options } = _options;
|
|
360
|
+
return createTrinity(namespace, createPagination(options));
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns the current pagination instance from context.
|
|
364
|
+
*
|
|
365
|
+
* @param namespace The namespace. @default 'v0:pagination'
|
|
366
|
+
* @returns The pagination context.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```vue
|
|
370
|
+
* <script setup lang="ts">
|
|
371
|
+
* import { usePagination } from '@vuetify/v0'
|
|
372
|
+
*
|
|
373
|
+
* const pagination = usePagination()
|
|
374
|
+
* <\/script>
|
|
375
|
+
*
|
|
376
|
+
* <template>
|
|
377
|
+
* <button @click="pagination.prev()" :disabled="pagination.isFirst.value">Prev</button>
|
|
378
|
+
* <button @click="pagination.next()" :disabled="pagination.isLast.value">Next</button>
|
|
379
|
+
* </template>
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
function usePagination(namespace = "v0:pagination") {
|
|
383
|
+
return useContext(namespace);
|
|
384
|
+
}
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/composables/createDataTable/adapters/adapter.ts
|
|
387
|
+
/**
|
|
388
|
+
* @module createDataTable/adapters
|
|
389
|
+
*
|
|
390
|
+
* @remarks
|
|
391
|
+
* Defines the adapter interface and abstract base class for data table
|
|
392
|
+
* pipeline strategies. Adapters control how raw items are filtered, sorted,
|
|
393
|
+
* and sliced into visible items.
|
|
394
|
+
*
|
|
395
|
+
* The abstract DataTableAdapter provides shared filter and sort pipelines
|
|
396
|
+
* used by client-side adapters. Server adapters that delegate pipeline
|
|
397
|
+
* operations externally subclass DataTableAdapter directly.
|
|
398
|
+
*/
|
|
399
|
+
function getNestedValue(obj, parts) {
|
|
400
|
+
let result = obj;
|
|
401
|
+
for (const k of parts) {
|
|
402
|
+
if (/* @__PURE__ */ isNullOrUndefined(result)) return void 0;
|
|
403
|
+
result = result[k];
|
|
404
|
+
}
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
function compareValues(a, b, collator) {
|
|
408
|
+
if (a === b) return 0;
|
|
409
|
+
const aNil = /* @__PURE__ */ isNullOrUndefined(a);
|
|
410
|
+
const bNil = /* @__PURE__ */ isNullOrUndefined(b);
|
|
411
|
+
if (aNil && bNil) return 0;
|
|
412
|
+
if (aNil) return 1;
|
|
413
|
+
if (bNil) return -1;
|
|
414
|
+
if (/* @__PURE__ */ isString(a) && /* @__PURE__ */ isString(b)) return collator ? collator.compare(a, b) : a.localeCompare(b);
|
|
415
|
+
if (/* @__PURE__ */ isNumber(a) && /* @__PURE__ */ isNumber(b)) {
|
|
416
|
+
if (/* @__PURE__ */ isNaN(a)) return 1;
|
|
417
|
+
if (/* @__PURE__ */ isNaN(b)) return -1;
|
|
418
|
+
return a - b;
|
|
419
|
+
}
|
|
420
|
+
const sa = String(a);
|
|
421
|
+
const sb = String(b);
|
|
422
|
+
return collator ? collator.compare(sa, sb) : sa.localeCompare(sb);
|
|
423
|
+
}
|
|
424
|
+
var DataTableAdapter = class {
|
|
425
|
+
/** Create the filter pipeline stage */
|
|
426
|
+
filter(context) {
|
|
427
|
+
const filter = createFilter({
|
|
428
|
+
...context.filterOptions,
|
|
429
|
+
keys: [...toValue(context.filterableKeys)],
|
|
430
|
+
customFilter: context.filterOptions.customFilter ?? ((query, item) => {
|
|
431
|
+
const columnFilters = toValue(context.customColumnFilters);
|
|
432
|
+
const keys = toValue(context.filterableKeys);
|
|
433
|
+
if (!/* @__PURE__ */ isObject(item)) return false;
|
|
434
|
+
const q = String(/* @__PURE__ */ isArray(query) ? query[0] : query).toLowerCase();
|
|
435
|
+
if (!q) return true;
|
|
436
|
+
const obj = item;
|
|
437
|
+
for (const key of keys) {
|
|
438
|
+
const customFn = columnFilters[key];
|
|
439
|
+
if (customFn) {
|
|
440
|
+
if (customFn(obj[key], q)) return true;
|
|
441
|
+
} else {
|
|
442
|
+
const val = obj[key];
|
|
443
|
+
if (!/* @__PURE__ */ isNullOrUndefined(val) && String(val).toLowerCase().includes(q)) return true;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return false;
|
|
447
|
+
})
|
|
448
|
+
});
|
|
449
|
+
const allItems = toRef(() => toValue(context.items));
|
|
450
|
+
const { items: filteredItems } = filter.apply(context.search, allItems);
|
|
451
|
+
return {
|
|
452
|
+
allItems,
|
|
453
|
+
filteredItems
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/** Create the sort pipeline stage */
|
|
457
|
+
sort(filteredItems, sortBy, locale, customSorts) {
|
|
458
|
+
return computed(() => {
|
|
459
|
+
const entries = sortBy.value;
|
|
460
|
+
if (entries.length === 0) return filteredItems.value;
|
|
461
|
+
const sorts = toValue(customSorts) ?? {};
|
|
462
|
+
const collator = new Intl.Collator(locale?.value);
|
|
463
|
+
const resolved = entries.map(({ key, direction }) => ({
|
|
464
|
+
parts: key.split("."),
|
|
465
|
+
direction,
|
|
466
|
+
custom: sorts[key]
|
|
467
|
+
}));
|
|
468
|
+
return filteredItems.value.toSorted((a, b) => {
|
|
469
|
+
for (const { parts, direction, custom } of resolved) {
|
|
470
|
+
const aVal = parts.length === 1 ? a[parts[0]] : getNestedValue(a, parts);
|
|
471
|
+
const bVal = parts.length === 1 ? b[parts[0]] : getNestedValue(b, parts);
|
|
472
|
+
const cmp = custom ? custom(aVal, bVal) : compareValues(aVal, bVal, collator);
|
|
473
|
+
if (cmp !== 0) return direction === "desc" ? -cmp : cmp;
|
|
474
|
+
}
|
|
475
|
+
return 0;
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
//#endregion
|
|
481
|
+
export { createFilter as a, usePagination as i, createPagination as n, createFilterContext as o, createPaginationContext as r, useFilter as s, DataTableAdapter as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ContextTrinity } from "./index-
|
|
1
|
+
import { t as ContextTrinity } from "./index-H_hl6-4b.mjs";
|
|
2
2
|
import * as _$vue from "vue";
|
|
3
3
|
import { ComputedRef, MaybeRefOrGetter, Ref, ShallowRef, WritableComputedRef } from "vue";
|
|
4
4
|
|
|
@@ -249,8 +249,8 @@ interface DataTableAdapterContext<T extends Record<string, unknown>> {
|
|
|
249
249
|
items: MaybeRefOrGetter<T[]>;
|
|
250
250
|
/** Search query ref */
|
|
251
251
|
search: ShallowRef<string>;
|
|
252
|
-
/** Column
|
|
253
|
-
filterableKeys: readonly string[]
|
|
252
|
+
/** Column ids eligible for filtering (reactive — tracks the columns registry) */
|
|
253
|
+
filterableKeys: MaybeRefOrGetter<readonly string[]>;
|
|
254
254
|
/** Current sort state derived from sort controls */
|
|
255
255
|
sortBy: Readonly<Ref<SortEntry[]>>;
|
|
256
256
|
/** Locale for sorting (reactive, from useLocale or options) */
|
|
@@ -259,10 +259,10 @@ interface DataTableAdapterContext<T extends Record<string, unknown>> {
|
|
|
259
259
|
filterOptions: Omit<FilterOptions, 'keys'>;
|
|
260
260
|
/** Pagination options (size excluded, derived from pipeline) */
|
|
261
261
|
paginationOptions: Omit<PaginationOptions, 'size'>;
|
|
262
|
-
/** Per-column custom sort comparators */
|
|
263
|
-
customSorts: Partial<Record<
|
|
264
|
-
/** Per-column custom filter functions */
|
|
265
|
-
customColumnFilters: Partial<Record<
|
|
262
|
+
/** Per-column custom sort comparators (reactive — tracks the columns registry). Keys are column ids, which may be `keyof T` or derived strings. */
|
|
263
|
+
customSorts: MaybeRefOrGetter<Partial<Record<string, (a: unknown, b: unknown) => number>>>;
|
|
264
|
+
/** Per-column custom filter functions (reactive — tracks the columns registry). Keys are column ids, which may be `keyof T` or derived strings. */
|
|
265
|
+
customColumnFilters: MaybeRefOrGetter<Partial<Record<string, (value: unknown, query: string) => boolean>>>;
|
|
266
266
|
}
|
|
267
267
|
/** Outputs returned by the adapter to createDataTable */
|
|
268
268
|
interface DataTableAdapterResult<T extends Record<string, unknown>> {
|
|
@@ -283,19 +283,15 @@ interface DataTableAdapterResult<T extends Record<string, unknown>> {
|
|
|
283
283
|
/** Error state (optional, for async adapters) */
|
|
284
284
|
error?: Readonly<Ref<Error | null>>;
|
|
285
285
|
}
|
|
286
|
-
|
|
287
|
-
interface DataTableAdapterInterface<T extends Record<string, unknown>> {
|
|
288
|
-
setup: (context: DataTableAdapterContext<T>) => DataTableAdapterResult<T>;
|
|
289
|
-
}
|
|
290
|
-
declare abstract class DataTableAdapter<T extends Record<string, unknown>> implements DataTableAdapterInterface<T> {
|
|
286
|
+
declare abstract class DataTableAdapter<T extends Record<string, unknown>> {
|
|
291
287
|
/** Create the filter pipeline stage */
|
|
292
288
|
protected filter(context: DataTableAdapterContext<T>): {
|
|
293
289
|
allItems: Readonly<Ref<T[], T[]>>;
|
|
294
290
|
filteredItems: _$vue.ComputedRef<T[]>;
|
|
295
291
|
};
|
|
296
292
|
/** Create the sort pipeline stage */
|
|
297
|
-
protected sort(filteredItems: Readonly<Ref<readonly T[]>>, sortBy: Readonly<Ref<SortEntry[]>>, locale?: Readonly<Ref<string | undefined>>, customSorts?: Partial<Record<string, (a: unknown, b: unknown) => number
|
|
293
|
+
protected sort(filteredItems: Readonly<Ref<readonly T[]>>, sortBy: Readonly<Ref<SortEntry[]>>, locale?: Readonly<Ref<string | undefined>>, customSorts?: MaybeRefOrGetter<Partial<Record<string, (a: unknown, b: unknown) => number>>>): Readonly<Ref<readonly T[]>>;
|
|
298
294
|
abstract setup(context: DataTableAdapterContext<T>): DataTableAdapterResult<T>;
|
|
299
295
|
}
|
|
300
296
|
//#endregion
|
|
301
|
-
export {
|
|
297
|
+
export { createFilterContext as C, createFilter as S, FilterMode as _, SortEntry as a, FilterResult as b, PaginationOptions as c, createPaginationContext as d, usePagination as f, FilterItem as g, FilterFunction as h, SortDirection as i, PaginationTicket as l, FilterContextOptions as m, DataTableAdapterContext as n, PaginationContext as o, FilterContext as p, DataTableAdapterResult as r, PaginationContextOptions as s, DataTableAdapter as t, createPagination as u, FilterOptions as v, useFilter as w, Primitive as x, FilterQuery as y };
|