@vuetify/v0 1.0.0-alpha.3 → 1.0.0-alpha.4
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 +3 -0
- package/dist/adapter-BSKx9WQ7.mjs +4 -0
- package/dist/{index-CT5SCLzW.d.mts → adapter-C6JmOyYo.d.mts} +6 -9
- package/dist/{adapter-gQ2SNKZq.mjs → adapter-C9cR4AcY.mjs} +248 -5
- package/dist/adapter-Chznb9Ju.mjs +4 -0
- package/dist/{adapter-DlX3FA3A.d.mts → adapter-Cr7Bl4la.d.mts} +3 -7
- package/dist/adapter-D8zizQVP.mjs +4 -0
- package/dist/adapter-DgBBe_BW.d.mts +17 -0
- package/dist/adapter-Dzyrlbz7.d.mts +98 -0
- package/dist/adapter-o8r-2vUn.d.mts +11 -0
- package/dist/adapters-B25KaYU4.mjs +2 -0
- package/dist/adapters-BcddLSNs.mjs +4 -0
- package/dist/adapters-D64TORDu.mjs +2 -0
- package/dist/adapters-Dv74Jk6A.mjs +5 -0
- package/dist/adapters-t6QC-zE8.mjs +3 -0
- package/dist/browser/index.js +1510 -388
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/{components-C4jI-78d.mjs → components-BWxMSWr7.mjs} +138 -90
- package/dist/composables/index.d.mts +19 -19
- package/dist/composables/index.mjs +31 -29
- package/dist/{consola-BdgyPEfx.d.mts → consola-Crr4qbeI.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-DDr2yY-A.mjs} +30 -29
- package/dist/{createGroup-CGk6hY_Y.mjs → createGroup-BSGtfBUE.mjs} +3 -3
- package/dist/{createRegistry-BXzdXAjq.mjs → createRegistry-Db_juawd.mjs} +78 -41
- package/dist/{createSelection-B3HJEPNg.mjs → createSelection-BeKZMxha.mjs} +3 -3
- package/dist/{createSingle-Dql8mRi-.mjs → createSingle-Dms2efxr.mjs} +1 -1
- package/dist/{createTokens-DgFYsOrv.mjs → createTokens-B1lwHZvO.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 +11 -4
- 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/{flagsmith-Dbh1h8WF.mjs → flagsmith-Cu93hUIF.mjs} +6 -4
- package/dist/{index-BzFHTW59.d.mts → flagsmith-ygKMImos.d.mts} +4 -4
- package/dist/{globals-zEjWBKCr.mjs → globals-BAe6tA_x.mjs} +1 -1
- package/dist/{index-GOpjKzaJ.d.mts → index-B3-FstpY.d.mts} +25 -2
- package/dist/{index-BJGcVy7e.d.mts → index-BA7YU2xY.d.mts} +5 -5
- package/dist/{index-B76iGRE3.d.mts → index-BfpLkDR_.d.mts} +949 -59
- package/dist/{index-DE3bWw11.d.mts → index-Cw04PFVO.d.mts} +92 -48
- package/dist/index-DewYtDsc.d.mts +4 -0
- package/dist/{index-DNDuacmH.d.mts → index-jQPkwo3G.d.mts} +15 -5
- package/dist/index.d.mts +23 -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-BJR4vbbV.d.mts +13 -0
- package/dist/{launchdarkly-BKtW-idu.mjs → launchdarkly-CLGtJCsI.mjs} +6 -4
- 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-CeSQE-QV.d.mts → memory-B0w39kno.d.mts} +9 -9
- package/dist/{memory-oYBvtkgx.mjs → memory-BMpJcQjQ.mjs} +13 -3
- 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-9L79n6y6.mjs → pino-CIcYlW3u.mjs} +3 -1
- package/dist/{pino-DNfCEb0p.d.mts → pino-NmR7X0s4.d.mts} +2 -2
- package/dist/{posthog-DmuyycaR.mjs → posthog-B3go2aCh.mjs} +7 -5
- package/dist/posthog-CQntUXFO.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-DQK305lc.d.mts} +5 -5
- package/dist/{server-y7zLSCSx.mjs → server-ZFXbgQoY.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-dPyVkgiJ.mjs} +2 -2
- package/dist/{useClickOutside-CY4U2J9W.mjs → useClickOutside-B8naChaQ.mjs} +1224 -228
- package/dist/{useFeatures-BPOke6iP.mjs → useFeatures-x2iKp0C8.mjs} +7 -10
- package/dist/{useLocale-BV8e3imF.mjs → useLocale-BUms59Bw.mjs} +6 -6
- package/dist/{useLogger-DvdRTrqC.mjs → useLogger-DPSSa-YR.mjs} +4 -4
- package/dist/{useNotifications-vSJE6z6t.mjs → useNotifications-BPTmZWQy.mjs} +4 -4
- package/dist/{usePermissions-D3zPwKQc.mjs → usePermissions-CTi-3pBk.mjs} +6 -6
- package/dist/{useRules-BT6cgoTj.mjs → useRules-DNhljkyO.mjs} +2 -2
- package/dist/{useTheme-cUZb2A9O.mjs → useTheme-3vW3kFNg.mjs} +5 -5
- package/dist/utilities/index.d.mts +2 -2
- package/dist/utilities/index.mjs +26 -2
- package/dist/{v0-DrOub-e1.d.mts → v0-CRGArJim.d.mts} +4 -4
- package/dist/{v0-C49OI_wc.mjs → v0-CotC1PiS.mjs} +5 -3
- package/dist/{v0-Dq3zhexO.mjs → v0-DAlKpCR8.mjs} +3 -4
- package/dist/{v0-D7Fm2C3Y.d.mts → v0-DDELiSI6.d.mts} +3 -3
- package/dist/v0-DYsCJPIu.d.mts +8 -0
- package/dist/{v0-gpExNexS.mjs → v0-DadOcxFI.mjs} +2 -2
- package/dist/{v0-Bmow1q_x.mjs → v0-Dvu8fMl3.mjs} +3 -3
- package/dist/{v0-CHZpnMeP.mjs → v0-YJQoTLsp.mjs} +6 -4
- package/dist/virtual-BqCRw0ly.d.mts +8 -0
- package/dist/{virtual-C0yHf1DC.mjs → virtual-Dnno49F8.mjs} +3 -4
- 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/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-CKKoxA9V.d.mts} +0 -0
- /package/dist/{index-DuddF-NR.d.mts → index-CLR1QMM3.d.mts} +0 -0
- /package/dist/{index-BgCkepP_.d.mts → index-DJQwYeyx.d.mts} +0 -0
- /package/dist/{index-CROz1VSV.d.mts → index-DWfPppPU.d.mts} +0 -0
- /package/dist/{index-DTvqw22G.d.mts → index-H_hl6-4b.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
|
|
@@ -212,6 +214,7 @@ Selection management composables built on `createRegistry`:
|
|
|
212
214
|
|
|
213
215
|
- [`useClickOutside`](https://0.vuetifyjs.com/composables/system/use-click-outside) - Click outside detection with cleanup
|
|
214
216
|
- [`useDelay`](https://0.vuetifyjs.com/composables/system/use-delay) - Schedule open and close transitions with configurable delays
|
|
217
|
+
- [`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
218
|
- [`useEventListener`](https://0.vuetifyjs.com/composables/system/use-event-listener) - Lifecycle-managed event listeners
|
|
216
219
|
- [`useHotkey`](https://0.vuetifyjs.com/composables/system/use-hotkey) - Hotkey combinations and sequences
|
|
217
220
|
- [`useImage`](https://0.vuetifyjs.com/composables/system/use-image) - Image loading state machine with deferred loading and retry
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as ID } from "./index-
|
|
1
|
+
import { a as ID } from "./index-CLR1QMM3.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/composables/useFeatures/adapters/
|
|
3
|
+
//#region src/composables/useFeatures/adapters/adapter.d.ts
|
|
4
4
|
type FeaturesAdapterValue = boolean | {
|
|
5
5
|
$value?: boolean;
|
|
6
6
|
$variation?: unknown;
|
|
7
7
|
};
|
|
8
8
|
type FeaturesAdapterFlags = Record<ID, FeaturesAdapterValue>;
|
|
9
|
-
|
|
9
|
+
declare abstract class FeaturesAdapter {
|
|
10
10
|
/**
|
|
11
11
|
* Initialize the adapter and return initial flags.
|
|
12
12
|
*
|
|
@@ -16,16 +16,13 @@ interface FeaturesAdapterInterface {
|
|
|
16
16
|
* @remarks Called during plugin setup. Sets up change listeners
|
|
17
17
|
* and returns the initial flag values.
|
|
18
18
|
*/
|
|
19
|
-
setup
|
|
19
|
+
abstract setup(onUpdate: (flags: FeaturesAdapterFlags) => void): FeaturesAdapterFlags;
|
|
20
20
|
/**
|
|
21
21
|
* Cleanup adapter resources.
|
|
22
22
|
*
|
|
23
23
|
* @remarks Called when the plugin is disposed.
|
|
24
24
|
*/
|
|
25
|
-
dispose
|
|
26
|
-
}
|
|
27
|
-
declare abstract class FeaturesAdapter implements FeaturesAdapterInterface {
|
|
28
|
-
abstract setup(onUpdate: (flags: FeaturesAdapterFlags) => void): FeaturesAdapterFlags;
|
|
25
|
+
dispose?(): void;
|
|
29
26
|
}
|
|
30
27
|
//#endregion
|
|
31
|
-
export {
|
|
28
|
+
export { FeaturesAdapterFlags as n, FeaturesAdapterValue as r, FeaturesAdapter as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isArray, isNaN, isNullOrUndefined, isNumber, isObject, isString } from "./utilities/index.mjs";
|
|
1
|
+
import { clamp, isArray, isNaN, isNullOrUndefined, isNumber, isObject, isString, range } from "./utilities/index.mjs";
|
|
2
2
|
import { i as useContext, t as createTrinity } from "./createTrinity-BTCs1pYx.mjs";
|
|
3
|
-
import { t as toArray } from "./toArray-
|
|
4
|
-
import { computed, shallowRef, toRef, toValue } from "vue";
|
|
3
|
+
import { t as toArray } from "./toArray-CD2-OxAz.mjs";
|
|
4
|
+
import { computed, isRef, shallowRef, toRef, toValue } from "vue";
|
|
5
5
|
//#region src/composables/createFilter/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* @module createFilter
|
|
@@ -140,6 +140,249 @@ function useFilter(namespace = "v0:filter") {
|
|
|
140
140
|
return useContext(namespace);
|
|
141
141
|
}
|
|
142
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
|
|
143
386
|
//#region src/composables/createDataTable/adapters/adapter.ts
|
|
144
387
|
/**
|
|
145
388
|
* @module createDataTable/adapters
|
|
@@ -151,7 +394,7 @@ function useFilter(namespace = "v0:filter") {
|
|
|
151
394
|
*
|
|
152
395
|
* The abstract DataTableAdapter provides shared filter and sort pipelines
|
|
153
396
|
* used by client-side adapters. Server adapters that delegate pipeline
|
|
154
|
-
* operations externally
|
|
397
|
+
* operations externally subclass DataTableAdapter directly.
|
|
155
398
|
*/
|
|
156
399
|
function getNestedValue(obj, parts) {
|
|
157
400
|
let result = obj;
|
|
@@ -235,4 +478,4 @@ var DataTableAdapter = class {
|
|
|
235
478
|
}
|
|
236
479
|
};
|
|
237
480
|
//#endregion
|
|
238
|
-
export {
|
|
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
|
|
|
@@ -283,11 +283,7 @@ 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[]>>;
|
|
@@ -298,4 +294,4 @@ declare abstract class DataTableAdapter<T extends Record<string, unknown>> imple
|
|
|
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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as ID } from "./index-CLR1QMM3.mjs";
|
|
2
|
+
import { c as TokenTicket, i as TokenContext } from "./index-Cw04PFVO.mjs";
|
|
3
|
+
import { Ref } from "vue";
|
|
4
|
+
|
|
5
|
+
//#region src/composables/useLocale/adapters/adapter.d.ts
|
|
6
|
+
interface LocaleAdapterContext {
|
|
7
|
+
tokens: TokenContext<TokenTicket>;
|
|
8
|
+
selectedId: Ref<ID | null | undefined>;
|
|
9
|
+
fallbackLocale: ID | undefined;
|
|
10
|
+
has: (id: ID) => boolean;
|
|
11
|
+
}
|
|
12
|
+
declare abstract class LocaleAdapter {
|
|
13
|
+
abstract t(key: string, ...params: unknown[]): string;
|
|
14
|
+
abstract n(value: number): string;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { LocaleAdapterContext as n, LocaleAdapter as t };
|
|
@@ -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 };
|