@atscript/vue-table 0.1.58
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 +21 -0
- package/README.md +24 -0
- package/dist/as-action-form-dialog.cjs +221 -0
- package/dist/as-action-form-dialog.d.cts +6 -0
- package/dist/as-action-form-dialog.d.mts +7 -0
- package/dist/as-action-form-dialog.mjs +221 -0
- package/dist/as-action-menu-content-CXsdPn42.mjs +104 -0
- package/dist/as-action-menu-content-CyUfBrWH.cjs +109 -0
- package/dist/as-cell-array-CXeZzZqt.cjs +69 -0
- package/dist/as-cell-array-DOQKR6t5.mjs +64 -0
- package/dist/as-cell-array.cjs +3 -0
- package/dist/as-cell-array.d.cts +2 -0
- package/dist/as-cell-array.d.mts +2 -0
- package/dist/as-cell-array.mjs +3 -0
- package/dist/as-cell-array.vue-DZGM2VHh.d.mts +12 -0
- package/dist/as-cell-array.vue-pFs5GcCR.d.cts +12 -0
- package/dist/as-cell-date-CTrvxS1h.cjs +78 -0
- package/dist/as-cell-date-Cq49RHmL.mjs +73 -0
- package/dist/as-cell-date.cjs +3 -0
- package/dist/as-cell-date.d.cts +2 -0
- package/dist/as-cell-date.d.mts +2 -0
- package/dist/as-cell-date.mjs +3 -0
- package/dist/as-cell-date.vue-BBSps2B2.d.cts +12 -0
- package/dist/as-cell-date.vue-Zlt4mHWb.d.mts +12 -0
- package/dist/as-cell-json-BynWIs1d.mjs +37 -0
- package/dist/as-cell-json-DvHvQ6IL.cjs +42 -0
- package/dist/as-cell-json-popover-BWdNs1YU.cjs +70 -0
- package/dist/as-cell-json-popover-DUq25I0L.mjs +65 -0
- package/dist/as-cell-json.cjs +3 -0
- package/dist/as-cell-json.d.cts +2 -0
- package/dist/as-cell-json.d.mts +2 -0
- package/dist/as-cell-json.mjs +3 -0
- package/dist/as-cell-json.vue-C6wg4ARZ.d.cts +12 -0
- package/dist/as-cell-json.vue-CESWuCer.d.mts +12 -0
- package/dist/as-cell-number-0_WrSCzu.cjs +76 -0
- package/dist/as-cell-number-Bc1C97Vg.mjs +71 -0
- package/dist/as-cell-number.cjs +3 -0
- package/dist/as-cell-number.d.cts +2 -0
- package/dist/as-cell-number.d.mts +2 -0
- package/dist/as-cell-number.mjs +3 -0
- package/dist/as-cell-number.vue-1Oq7nVI3.d.mts +12 -0
- package/dist/as-cell-number.vue-CJ2K5zeM.d.cts +12 -0
- package/dist/as-cell-union-C1w3B38J.mjs +88 -0
- package/dist/as-cell-union-CFAI0utz.cjs +93 -0
- package/dist/as-cell-union.cjs +4 -0
- package/dist/as-cell-union.d.cts +2 -0
- package/dist/as-cell-union.d.mts +2 -0
- package/dist/as-cell-union.mjs +4 -0
- package/dist/as-cell-union.vue-CslPM_c2.d.cts +12 -0
- package/dist/as-cell-union.vue-NnDmQZOA.d.mts +12 -0
- package/dist/as-column-menu-CH9Htz0Q.cjs +220 -0
- package/dist/as-column-menu-DCfhorMP.mjs +215 -0
- package/dist/as-column-menu.cjs +2 -0
- package/dist/as-column-menu.d.cts +2 -0
- package/dist/as-column-menu.d.mts +2 -0
- package/dist/as-column-menu.mjs +2 -0
- package/dist/as-column-menu.vue-C9e6wJ3z.d.mts +47 -0
- package/dist/as-column-menu.vue-o0qFdzoL.d.cts +47 -0
- package/dist/as-config-dialog-d2k7_l0U.cjs +699 -0
- package/dist/as-config-dialog-vRklaKbi.mjs +688 -0
- package/dist/as-config-dialog.cjs +3 -0
- package/dist/as-config-dialog.d.cts +2 -0
- package/dist/as-config-dialog.d.mts +2 -0
- package/dist/as-config-dialog.mjs +3 -0
- package/dist/as-config-dialog.vue-C6Q62xF5.d.mts +7 -0
- package/dist/as-config-dialog.vue-DvvJi3xx.d.cts +7 -0
- package/dist/as-confirm-dialog-BLh3Ju4-.mjs +52 -0
- package/dist/as-confirm-dialog-BgpIEE2z.cjs +57 -0
- package/dist/as-confirm-dialog.cjs +3 -0
- package/dist/as-confirm-dialog.d.cts +2 -0
- package/dist/as-confirm-dialog.d.mts +2 -0
- package/dist/as-confirm-dialog.mjs +3 -0
- package/dist/as-confirm-dialog.vue-CXxLpzbu.d.cts +7 -0
- package/dist/as-confirm-dialog.vue-pas8jGhv.d.mts +7 -0
- package/dist/as-filter-dialog-C0HMpUPT.mjs +610 -0
- package/dist/as-filter-dialog-DcGvIV3h.cjs +621 -0
- package/dist/as-filter-dialog.cjs +15 -0
- package/dist/as-filter-dialog.d.cts +2 -0
- package/dist/as-filter-dialog.d.mts +2 -0
- package/dist/as-filter-dialog.mjs +15 -0
- package/dist/as-filter-dialog.vue-BV2J8PgZ.d.cts +7 -0
- package/dist/as-filter-dialog.vue-RDZjp4gJ.d.mts +7 -0
- package/dist/as-filter-field-B_tYzvvl.cjs +984 -0
- package/dist/as-filter-field-Bqvu2ASN.mjs +943 -0
- package/dist/as-filter-field.cjs +9 -0
- package/dist/as-filter-field.d.cts +2 -0
- package/dist/as-filter-field.d.mts +2 -0
- package/dist/as-filter-field.mjs +9 -0
- package/dist/as-filter-field.vue-ByQ8xIGq.d.cts +11 -0
- package/dist/as-filter-field.vue-QY8wi5S5.d.mts +11 -0
- package/dist/as-filter-input--nr72iwX.cjs +106 -0
- package/dist/as-filter-input-P1i0CW2-.mjs +101 -0
- package/dist/as-filter-input.cjs +2 -0
- package/dist/as-filter-input.d.cts +2 -0
- package/dist/as-filter-input.d.mts +2 -0
- package/dist/as-filter-input.mjs +2 -0
- package/dist/as-filter-input.vue-CBQ71eNg.d.mts +18 -0
- package/dist/as-filter-input.vue-CS4nOk_Q.d.cts +18 -0
- package/dist/as-filters-Bxa9ZEMm.mjs +44 -0
- package/dist/as-filters-xRT2qv56.cjs +49 -0
- package/dist/as-filters.cjs +10 -0
- package/dist/as-filters.d.cts +2 -0
- package/dist/as-filters.d.mts +2 -0
- package/dist/as-filters.mjs +10 -0
- package/dist/as-filters.vue-BsMgYUcX.d.mts +10 -0
- package/dist/as-filters.vue-fv-tRL2H.d.cts +10 -0
- package/dist/as-preset-dialog-BaTfwMnh.cjs +569 -0
- package/dist/as-preset-dialog-BdDRgwf_.mjs +564 -0
- package/dist/as-preset-dialog.cjs +4 -0
- package/dist/as-preset-dialog.d.cts +2 -0
- package/dist/as-preset-dialog.d.mts +2 -0
- package/dist/as-preset-dialog.mjs +4 -0
- package/dist/as-preset-dialog.vue-Bzv-ON9W.d.mts +7 -0
- package/dist/as-preset-dialog.vue-DP9fy00Y.d.cts +7 -0
- package/dist/as-preset-picker-BQbNEiy9.mjs +427 -0
- package/dist/as-preset-picker-Ce3crTQy.cjs +432 -0
- package/dist/as-preset-picker.cjs +4 -0
- package/dist/as-preset-picker.d.cts +2 -0
- package/dist/as-preset-picker.d.mts +2 -0
- package/dist/as-preset-picker.mjs +4 -0
- package/dist/as-preset-picker.vue-CTBk6leV.d.mts +7 -0
- package/dist/as-preset-picker.vue-DfXS3pGl.d.cts +7 -0
- package/dist/as-row-actions-B6Kob6gt.cjs +120 -0
- package/dist/as-row-actions-CeWBBGqh.mjs +115 -0
- package/dist/as-row-actions.cjs +4 -0
- package/dist/as-row-actions.d.cts +2 -0
- package/dist/as-row-actions.d.mts +2 -0
- package/dist/as-row-actions.mjs +4 -0
- package/dist/as-row-actions.vue-BPaQfGev.d.mts +11 -0
- package/dist/as-row-actions.vue-Bvcc2tUN.d.cts +11 -0
- package/dist/as-table-Cnw2fOqZ.mjs +204 -0
- package/dist/as-table-DlDFxdXI.cjs +209 -0
- package/dist/as-table-actions-BK1Thy2G.cjs +142 -0
- package/dist/as-table-actions-BpMiNFni.mjs +137 -0
- package/dist/as-table-actions.cjs +4 -0
- package/dist/as-table-actions.d.cts +2 -0
- package/dist/as-table-actions.d.mts +2 -0
- package/dist/as-table-actions.mjs +4 -0
- package/dist/as-table-actions.vue-B7Q-JA3z.d.cts +47 -0
- package/dist/as-table-actions.vue-Bs1Jl1ep.d.mts +47 -0
- package/dist/as-table-base-D0k4k7k_.mjs +646 -0
- package/dist/as-table-base-VIz-B_6_.cjs +651 -0
- package/dist/as-table-cell-value-B1CiJYFn.mjs +26 -0
- package/dist/as-table-cell-value-CuxRtFn9.cjs +31 -0
- package/dist/as-table-cell-value.cjs +3 -0
- package/dist/as-table-cell-value.d.cts +2 -0
- package/dist/as-table-cell-value.d.mts +2 -0
- package/dist/as-table-cell-value.mjs +3 -0
- package/dist/as-table-cell-value.vue-BgFDv2JQ.d.cts +12 -0
- package/dist/as-table-cell-value.vue-BuPCQ8YA.d.mts +12 -0
- package/dist/as-table-header-cell-C3zeZUZo.cjs +117 -0
- package/dist/as-table-header-cell-CBn_ioCe.mjs +112 -0
- package/dist/as-table-header-cell.cjs +3 -0
- package/dist/as-table-header-cell.d.cts +2 -0
- package/dist/as-table-header-cell.d.mts +2 -0
- package/dist/as-table-header-cell.mjs +3 -0
- package/dist/as-table-header-cell.vue-Bc_DSsGY.d.cts +31 -0
- package/dist/as-table-header-cell.vue-DNMOHfek.d.mts +31 -0
- package/dist/as-table-root-Br6WcGRo.cjs +263 -0
- package/dist/as-table-root-gG7pTIdD.mjs +258 -0
- package/dist/as-table-root.cjs +28 -0
- package/dist/as-table-root.d.cts +2 -0
- package/dist/as-table-root.d.mts +2 -0
- package/dist/as-table-root.mjs +28 -0
- package/dist/as-table-root.vue-5_OhVwse.d.mts +2258 -0
- package/dist/as-table-root.vue-CSqEtIll.d.cts +2258 -0
- package/dist/as-table-status-BjRGGuhC.mjs +683 -0
- package/dist/as-table-status-DWYoJIMC.cjs +724 -0
- package/dist/as-table.cjs +10 -0
- package/dist/as-table.d.cts +2 -0
- package/dist/as-table.d.mts +2 -0
- package/dist/as-table.mjs +10 -0
- package/dist/as-table.vue-BTYg-e3Z.d.mts +81 -0
- package/dist/as-table.vue-wdRARLIe.d.cts +81 -0
- package/dist/as-window-table-CKIfo3M_.mjs +709 -0
- package/dist/as-window-table-DE7_NyEP.cjs +714 -0
- package/dist/as-window-table.cjs +9 -0
- package/dist/as-window-table.d.cts +2 -0
- package/dist/as-window-table.d.mts +2 -0
- package/dist/as-window-table.mjs +9 -0
- package/dist/as-window-table.vue-Bf8xGC9M.d.mts +86 -0
- package/dist/as-window-table.vue-CA8qsrz4.d.cts +86 -0
- package/dist/format-cell-B2xMDYO9.mjs +27 -0
- package/dist/format-cell-D4mqaN0E.cjs +32 -0
- package/dist/get-cell-value-CZSVfDLg.cjs +19 -0
- package/dist/get-cell-value-DiH84HKL.mjs +14 -0
- package/dist/index.cjs +598 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +505 -0
- package/dist/preset-aspect-display-BYeiSgcc.mjs +43 -0
- package/dist/preset-aspect-display-y8aal_EF.cjs +72 -0
- package/dist/types-BvvXN72P.d.mts +531 -0
- package/dist/types-CNMmF6W2.d.cts +531 -0
- package/dist/use-cell-locale-1uQaFTLQ.mjs +23 -0
- package/dist/use-cell-locale-B480_QYK.cjs +34 -0
- package/dist/use-table-column-handlers-CGYAY2xH.cjs +65 -0
- package/dist/use-table-column-handlers-t6xi1yCE.mjs +54 -0
- package/dist/use-table-state-C4JbonEZ.mjs +1822 -0
- package/dist/use-table-state-MU-vuzui.cjs +1917 -0
- package/package.json +195 -0
- package/styles.d.ts +2 -0
|
@@ -0,0 +1,2258 @@
|
|
|
1
|
+
import { _ as TableNavBridge, c as NavKeyOptions, d as ReactiveTableState, g as TableActionsState, h as TVueTableActionInfo, i as ConfirmOptions, l as PresetConfig, m as TAsTableControls, p as TAsCellTypeComponents, t as ActionResult } from "./types-CNMmF6W2.cjs";
|
|
2
|
+
import * as vue from "vue";
|
|
3
|
+
import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, InjectionKey, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef, UnwrapRef, VNode, VNodeProps, WritableComputedRef } from "vue";
|
|
4
|
+
import { Client, PageResult, TDbActionInfo } from "@atscript/db-client";
|
|
5
|
+
import * as _atscript_ui0 from "@atscript/ui";
|
|
6
|
+
import { ClientFactory, ClientFactory as ClientFactory$1, ColumnDef, SortControl, TableDef, getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "@atscript/ui";
|
|
7
|
+
import * as _atscript_ui_table0 from "@atscript/ui-table";
|
|
8
|
+
import { AppConfData, AppConfData as AppConfData$1, AsPresetEntryRow, AsPresetEntryRow as AsPresetEntryRow$1, ColumnWidthsMap, FilterCondition, PRESET_ASPECTS, PresetAspect, PresetAspect as PresetAspect$1, PresetCapabilities, PresetCapabilities as PresetCapabilities$1, PresetData, PresetDraft, PresetSnapshot, PresetSnapshot as PresetSnapshot$1, PresetSnapshotWire, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, SelectionMode, SystemPreset, SystemPreset as SystemPreset$1, SystemPresetInput, SystemPresetInput as SystemPresetInput$1, UrlQuerySync, UrlQuerySync as UrlQuerySync$1, UserConfData, isSystemPresetId, resolveSystemPresets } from "@atscript/ui-table";
|
|
9
|
+
import { TAsTypeComponents } from "@atscript/vue-form";
|
|
10
|
+
import { FilterExpr, Uniquery } from "@uniqu/core";
|
|
11
|
+
|
|
12
|
+
//#region src/composables/state/create-selection.d.ts
|
|
13
|
+
type Row = Record<string, unknown>;
|
|
14
|
+
interface SelectionApiOptions {
|
|
15
|
+
/** Extract a unique value from a row for selection tracking. */
|
|
16
|
+
rowValueFn?: (row: Row) => unknown;
|
|
17
|
+
/**
|
|
18
|
+
* External ref to back `selectedRows`. When provided the framework reads
|
|
19
|
+
* from and writes to this ref directly (identity preserved); otherwise a
|
|
20
|
+
* local `shallowRef([])` is created.
|
|
21
|
+
*/
|
|
22
|
+
selectedRows?: Ref<unknown[]>;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/composables/use-local-draft.d.ts
|
|
26
|
+
interface UseLocalDraftOptions {
|
|
27
|
+
app: string;
|
|
28
|
+
tableKey: string;
|
|
29
|
+
/** Reactive on/off toggle (`<AsTableRoot :persist-local-drafts>`). */
|
|
30
|
+
enabled: Ref<boolean> | boolean;
|
|
31
|
+
/** Persisted-aspect gate — drafts only persist aspects in this set. */
|
|
32
|
+
availableAspects: readonly PresetAspect[];
|
|
33
|
+
/** Optional debounce override (default 300ms). */
|
|
34
|
+
debounceMs?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Optional storage backend. Defaults to `globalThis.localStorage`. Tests
|
|
37
|
+
* supply an in-memory mock; SSR contexts pass `null` to disable.
|
|
38
|
+
*/
|
|
39
|
+
storage?: StorageLike | null;
|
|
40
|
+
}
|
|
41
|
+
/** Subset of `Storage` we depend on. Avoids type coupling to DOM lib. */
|
|
42
|
+
interface StorageLike {
|
|
43
|
+
getItem(key: string): string | null;
|
|
44
|
+
setItem(key: string, value: string): void;
|
|
45
|
+
removeItem(key: string): void;
|
|
46
|
+
}
|
|
47
|
+
interface UseLocalDraftReturn {
|
|
48
|
+
/**
|
|
49
|
+
* Layer the persisted draft (if any) on top of `applied` and return the
|
|
50
|
+
* merged snapshot. Aspects not in `availableAspects` are skipped silently
|
|
51
|
+
* (forward-compat for deploys that toggle aspect availability).
|
|
52
|
+
*/
|
|
53
|
+
hydrate(applied: PresetSnapshot): PresetSnapshot;
|
|
54
|
+
/**
|
|
55
|
+
* Wire a debounced watcher that mirrors persisted aspects of `current`
|
|
56
|
+
* to localStorage on each change. When `current` matches the active
|
|
57
|
+
* preset's persisted-aspect subset, the entry is removed instead.
|
|
58
|
+
*
|
|
59
|
+
* Returns the unwatch handle so callers can dispose explicitly; if not
|
|
60
|
+
* called, the watcher lives until the host component unmounts.
|
|
61
|
+
*/
|
|
62
|
+
watchAndPersist(currentSnapshot: () => PresetSnapshot, activePresetSnapshot: () => PresetSnapshot): () => void;
|
|
63
|
+
/** Drop the localStorage entry. Used by sign-out / explicit preset switch. */
|
|
64
|
+
clear(): void;
|
|
65
|
+
/** Read the raw draft from storage; `null` when absent or corrupted. */
|
|
66
|
+
readDraft(): PresetDraft | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* localStorage overlay manager for table presets. One overlay per
|
|
70
|
+
* `(app, tableKey)`; switching presets clears it (caller's responsibility
|
|
71
|
+
* — this composable only tracks state, not which preset is active).
|
|
72
|
+
*/
|
|
73
|
+
declare function useLocalDraft(opts: UseLocalDraftOptions): UseLocalDraftReturn;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/composables/use-presets.d.ts
|
|
76
|
+
interface UsePresetsOptions {
|
|
77
|
+
/** App namespace; defaults to `inject(AS_PRESETS_APP)`. */
|
|
78
|
+
app?: string;
|
|
79
|
+
/** Per-table identifier. Required. */
|
|
80
|
+
tableKey: string;
|
|
81
|
+
/** Presets controller URL, e.g. `"/db/_presets"`. */
|
|
82
|
+
url: string;
|
|
83
|
+
/** Custom client factory (auth-configured). */
|
|
84
|
+
clientFactory?: ClientFactory;
|
|
85
|
+
/** Consumer-defined synthetic presets (`sys:*` namespace). */
|
|
86
|
+
systemPresets?: SystemPresetInput[];
|
|
87
|
+
/** Auto-load on setup. Default `true`. */
|
|
88
|
+
autoLoad?: boolean;
|
|
89
|
+
}
|
|
90
|
+
type ActivePresetView = {
|
|
91
|
+
kind: "system";
|
|
92
|
+
entry: SystemPreset;
|
|
93
|
+
} | {
|
|
94
|
+
kind: "stored";
|
|
95
|
+
entry: AsPresetEntryRow;
|
|
96
|
+
};
|
|
97
|
+
interface UsePresetsReturn {
|
|
98
|
+
presets: ShallowRef<AsPresetEntryRow[]>;
|
|
99
|
+
presetsById: ComputedRef<Map<string, AsPresetEntryRow>>;
|
|
100
|
+
userConf: ShallowRef<AsPresetEntryRow | null>;
|
|
101
|
+
capabilities: Ref<PresetCapabilities | null>;
|
|
102
|
+
systemPresets: ComputedRef<SystemPreset[]>;
|
|
103
|
+
systemPresetsById: ComputedRef<Map<string, SystemPreset>>;
|
|
104
|
+
/** False on 401/403 from initial load — UI hides itself. */
|
|
105
|
+
available: ComputedRef<boolean>;
|
|
106
|
+
loading: Ref<boolean>;
|
|
107
|
+
error: Ref<unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* Authoritative current-user id. `capabilities.userId` when caps are
|
|
110
|
+
* loaded, else best-effort derivation from any private row.
|
|
111
|
+
*/
|
|
112
|
+
currentUser: ComputedRef<string | null>;
|
|
113
|
+
/** Currently applied preset id (`sys:*` for system or stored row id). */
|
|
114
|
+
activePresetId: Ref<string | null>;
|
|
115
|
+
/** Resolved view of the active preset (system / stored / null). */
|
|
116
|
+
activePreset: ComputedRef<ActivePresetView | null>;
|
|
117
|
+
/**
|
|
118
|
+
* "Owned by current user" predicate for stored rows. Used by canSave /
|
|
119
|
+
* delete / public-toggle gating. Returns false for system presets.
|
|
120
|
+
*/
|
|
121
|
+
isOwned(id: string): boolean;
|
|
122
|
+
reload(): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Run `fn` with the trailing `reload()` of every mutator (save / saveAs /
|
|
125
|
+
* rename / delete / togglePublic / setDefault / setFavorites / toggleFav)
|
|
126
|
+
* deferred until `fn` resolves. One coalesced reload fires at the end —
|
|
127
|
+
* collapses N round-trips into 1 for batched UI flows like the manage
|
|
128
|
+
* dialog's Save button. Re-entrant; outer batch wins.
|
|
129
|
+
*/
|
|
130
|
+
batch<T>(fn: () => Promise<T>): Promise<T>;
|
|
131
|
+
/**
|
|
132
|
+
* Overwrite the active preset's content. The caller supplies the
|
|
133
|
+
* snapshot — the table-state composable uses `state.captureSnapshot()`
|
|
134
|
+
* here. Throws when the active preset is a system preset (never saveable).
|
|
135
|
+
*/
|
|
136
|
+
savePreset(snapshot: PresetSnapshot): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Create a new preset row. Returns the new id; sets `activePresetId` to
|
|
139
|
+
* it so the picker switches to the new preset.
|
|
140
|
+
*/
|
|
141
|
+
savePresetAs(label: string, snapshot: PresetSnapshot, opts?: {
|
|
142
|
+
public?: boolean;
|
|
143
|
+
}): Promise<string>;
|
|
144
|
+
renamePreset(id: string, label: string): Promise<void>;
|
|
145
|
+
deletePreset(id: string): Promise<void>;
|
|
146
|
+
togglePublic(id: string): Promise<void>;
|
|
147
|
+
/** Pin a preset as default for this `(user, app, tableKey)`. */
|
|
148
|
+
setDefault(id: string | null): Promise<void>;
|
|
149
|
+
/** Toggle a preset's pinned-as-favorite state. */
|
|
150
|
+
toggleFav(id: string): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Replace the full favorites list in one upsert. Lets a batched UI
|
|
153
|
+
* (e.g. the manage dialog's "Save" button) commit a whole new set instead
|
|
154
|
+
* of N round-trips through {@link toggleFav}.
|
|
155
|
+
*/
|
|
156
|
+
setFavorites(ids: string[]): Promise<void>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Public dev-facing composable for table presets. Powers `<AsPresetPicker>`
|
|
160
|
+
* internally and is exported for devs who want to wire bespoke surfaces.
|
|
161
|
+
*
|
|
162
|
+
* Stateful: holds reactive `presets` / `userConf` / `capabilities` and
|
|
163
|
+
* supports optimistic mutators that re-list after each successful write.
|
|
164
|
+
*
|
|
165
|
+
* Active-preset selection (`activePresetId`) is **owned by the caller** —
|
|
166
|
+
* the composable provides the ref but doesn't auto-resolve it on mount;
|
|
167
|
+
* that's the table-state's responsibility (Slice 4) since it depends on
|
|
168
|
+
* `userConf.defaultPresetId` resolution + Standard fallback.
|
|
169
|
+
*/
|
|
170
|
+
declare function usePresets(opts: UsePresetsOptions): UsePresetsReturn;
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/composables/use-table-state.d.ts
|
|
173
|
+
/** Everything provided by as-table-root to its subtree. */
|
|
174
|
+
interface TableContext {
|
|
175
|
+
state: ReactiveTableState;
|
|
176
|
+
client: Client;
|
|
177
|
+
/** Skin-slot overrides for table chrome (header cells, filter dialog, etc.). */
|
|
178
|
+
controls: TAsTableControls;
|
|
179
|
+
/** Cell-type → component dispatch map. */
|
|
180
|
+
types?: TAsCellTypeComponents;
|
|
181
|
+
/** Named cell-component overrides — looked up by `@ui.table.component "name"`. */
|
|
182
|
+
components?: Record<string, Component$1>;
|
|
183
|
+
/** Form-type → component dispatch map for the action-form dialog. */
|
|
184
|
+
formTypes?: TAsTypeComponents;
|
|
185
|
+
/** Named form-component overrides for the action-form dialog. */
|
|
186
|
+
formComponents?: Record<string, Component$1>;
|
|
187
|
+
}
|
|
188
|
+
type QueryFn = (query: Uniquery, page: number, size: number) => Promise<PageResult<Record<string, unknown>>>;
|
|
189
|
+
/** External refs the consumer wires up via `defineModel` (or otherwise). */
|
|
190
|
+
interface TableModelRefs {
|
|
191
|
+
filterFields?: Ref<string[]>;
|
|
192
|
+
columnNames?: Ref<string[]>;
|
|
193
|
+
columnWidths?: Ref<ColumnWidthsMap>;
|
|
194
|
+
sorters?: Ref<SortControl[]>;
|
|
195
|
+
}
|
|
196
|
+
type TableSelectionOptions = SelectionApiOptions;
|
|
197
|
+
interface TableQueryOptions {
|
|
198
|
+
/** Override the default query function. */
|
|
199
|
+
fn?: QueryFn;
|
|
200
|
+
/** Always-applied Uniquery filter expression (AND'd with user filters). */
|
|
201
|
+
forceFilters?: FilterExpr;
|
|
202
|
+
/** Always-applied sorters (prepended before user sorters). */
|
|
203
|
+
forceSorters?: SortControl[];
|
|
204
|
+
/** When true, all triggers (query/queryNext/loadRange) early-return. */
|
|
205
|
+
blockQuery?: boolean;
|
|
206
|
+
/** Auto-query when metadata loads (default: true). */
|
|
207
|
+
queryOnMount?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Gate the initial `scheduleQuery("initial")` until this ref flips to
|
|
210
|
+
* `true`. Used by `<AsTableRoot>` when `v-model:urlQuery` is bound, to
|
|
211
|
+
* defer the first fetch until URL hydration has run so the table fires one
|
|
212
|
+
* composed query on mount instead of two. Implicitly open when omitted.
|
|
213
|
+
*/
|
|
214
|
+
urlQueryReady?: Ref<boolean>;
|
|
215
|
+
/**
|
|
216
|
+
* Called when a state mutation produces a new URL query string. Self-emits
|
|
217
|
+
* are echo-suppressed by `lastEmittedUrl` so `applyUrlQuery(s)` followed
|
|
218
|
+
* by mutations that re-encode to the same `s` will not re-fire this
|
|
219
|
+
* callback. Opt-in: omitting disables the URL emitter entirely.
|
|
220
|
+
*/
|
|
221
|
+
onUrlQueryChange?: (urlString: string) => void;
|
|
222
|
+
/**
|
|
223
|
+
* Per-aspect opt-in/out for the URL bridge. Defaults to full sync (current
|
|
224
|
+
* behaviour). Static — captured at setup; to change sync, re-mount.
|
|
225
|
+
*/
|
|
226
|
+
urlQuerySync?: UrlQuerySync;
|
|
227
|
+
}
|
|
228
|
+
interface TableWindowOptions {
|
|
229
|
+
/** Page-alignment unit for `loadRange` and the `queryNext` extension. */
|
|
230
|
+
blockSize?: number;
|
|
231
|
+
/** Debounce window for the topIndex/viewportRowCount watcher. */
|
|
232
|
+
dragReleaseDebounceMs?: number;
|
|
233
|
+
}
|
|
234
|
+
interface TableActionsOptions {
|
|
235
|
+
/** Refetch policy: when `true` (default), successful backend / __remove invocations call `state.query()`. */
|
|
236
|
+
refreshOnAction?: () => boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Bridge for `<AsTableRoot>`'s `@action` emit. Called once per settled
|
|
239
|
+
* `invoke` (success, error, custom). `ids` is the level-derived list:
|
|
240
|
+
* `'row'` → `[pk]`, `'rows'` → `pk` if array else `[pk]`, `'table'` → `[]`.
|
|
241
|
+
*/
|
|
242
|
+
onResolved?: (action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: KeyboardEvent | MouseEvent) => void;
|
|
243
|
+
}
|
|
244
|
+
interface TablePresetOptions {
|
|
245
|
+
/** `usePresets` handle. When omitted, the preset surface degrades to a
|
|
246
|
+
* permanently-unavailable shape (`state.preset.available=false`). */
|
|
247
|
+
presetsHandle?: UsePresetsReturn | null;
|
|
248
|
+
/** `useLocalDraft` handle for opt-in localStorage persistence. */
|
|
249
|
+
draftHandle?: UseLocalDraftReturn | null;
|
|
250
|
+
/** App-declared aspect set; default `['columns','filters','filterOps','sorters']`. */
|
|
251
|
+
availableAspects?: PresetAspect[];
|
|
252
|
+
/** Static fallback for system presets when no `presetsHandle` is wired. */
|
|
253
|
+
fallbackSystemPresets?: SystemPreset[];
|
|
254
|
+
/** Whether localStorage drafts should be hydrated + persisted on bootstrap. */
|
|
255
|
+
persistDrafts?: boolean;
|
|
256
|
+
}
|
|
257
|
+
interface CreateTableStateOptions {
|
|
258
|
+
/** Data-layer client used for `client.pages` calls. */
|
|
259
|
+
client: Client;
|
|
260
|
+
/** Default page size (`pagination.itemsPerPage`). */
|
|
261
|
+
limit?: number;
|
|
262
|
+
/** External refs from `defineModel`. */
|
|
263
|
+
model?: TableModelRefs;
|
|
264
|
+
/** Selection settings. */
|
|
265
|
+
selection?: TableSelectionOptions;
|
|
266
|
+
/** Query/fetch settings. */
|
|
267
|
+
query?: TableQueryOptions;
|
|
268
|
+
/** Windowed-mode (virtualized) settings. */
|
|
269
|
+
window?: TableWindowOptions;
|
|
270
|
+
/** Action settings (built-in row delete + refetch policy). */
|
|
271
|
+
actions?: TableActionsOptions;
|
|
272
|
+
/** Preset settings. */
|
|
273
|
+
preset?: TablePresetOptions;
|
|
274
|
+
}
|
|
275
|
+
/** Internal handles returned alongside the public state. */
|
|
276
|
+
interface TableStateInternals {
|
|
277
|
+
/** Initialize state from a loaded table definition. */
|
|
278
|
+
init(def: TableDef): void;
|
|
279
|
+
/** Reset pagination to page 1 (suppresses the pagination watcher). */
|
|
280
|
+
resetPagination(): void;
|
|
281
|
+
}
|
|
282
|
+
declare function createTableState(opts: CreateTableStateOptions): {
|
|
283
|
+
state: ReactiveTableState;
|
|
284
|
+
internals: TableStateInternals;
|
|
285
|
+
};
|
|
286
|
+
interface CreateStaticTableStateOptions {
|
|
287
|
+
/** All rows in the dataset. Sorting/searching is applied locally. */
|
|
288
|
+
rows: Record<string, unknown>[];
|
|
289
|
+
/** Columns to render. Used to synthesize a minimal `TableDef`. */
|
|
290
|
+
columns: ColumnDef[];
|
|
291
|
+
/** Field paths matched (substring, case-insensitive) by `searchTerm`. */
|
|
292
|
+
searchPaths?: string[];
|
|
293
|
+
/** Selection settings. */
|
|
294
|
+
selection?: TableSelectionOptions;
|
|
295
|
+
/** Default page size (`pagination.itemsPerPage`). */
|
|
296
|
+
limit?: number;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Build a `ReactiveTableState` backed by an in-memory row list. Used by the
|
|
300
|
+
* enum value-help branch (`column.options`) where there's no client and no
|
|
301
|
+
* metadata fetch — sorting/searching/pagination run locally against `rows`.
|
|
302
|
+
*/
|
|
303
|
+
declare function createStaticTableState(opts: CreateStaticTableStateOptions): {
|
|
304
|
+
state: ReactiveTableState;
|
|
305
|
+
internals: TableStateInternals;
|
|
306
|
+
};
|
|
307
|
+
/** Inject the full table context (throws if used outside as-table-root). */
|
|
308
|
+
declare function useTableContext(): TableContext;
|
|
309
|
+
/**
|
|
310
|
+
* Inject the table context if present; return undefined when no
|
|
311
|
+
* `<as-table-root>` ancestor provided one. Use from components that may mount
|
|
312
|
+
* inside or outside a table subtree (`<AsTableBase>` in combobox/listbox modes,
|
|
313
|
+
* external composables that probe for context).
|
|
314
|
+
*/
|
|
315
|
+
declare function useTableContextOptional(): TableContext | undefined;
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/composables/use-table-selection.d.ts
|
|
318
|
+
type SelectionPersistence = "clear" | "trim" | "persist";
|
|
319
|
+
/**
|
|
320
|
+
* Wire up selection reconciliation on results change.
|
|
321
|
+
*
|
|
322
|
+
* The watcher distinguishes results-replacement (query / invalidate /
|
|
323
|
+
* pagination jump) from results-extension in EITHER direction (queryNext /
|
|
324
|
+
* forward-merging loadRange / backward-merging loadRange) and only runs the
|
|
325
|
+
* reconciliation logic on replacement. Backward extension prepends rows AND
|
|
326
|
+
* decrements `resultsStart` — caught via the last-row reference identity
|
|
327
|
+
* check, so scrolling upward doesn't silently mutate selection.
|
|
328
|
+
*
|
|
329
|
+
* Mode semantics on results-replacement:
|
|
330
|
+
* - `"persist"` — no-op; the consumer's ref is untouched.
|
|
331
|
+
* - `"trim"` (default) — keep the subset of selected PKs still present in the new results.
|
|
332
|
+
* - `"clear"` — drop everything.
|
|
333
|
+
*/
|
|
334
|
+
declare function useTableSelection(state: ReactiveTableState, opts?: {
|
|
335
|
+
mode?: SelectionPersistence;
|
|
336
|
+
}): void;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/composables/use-table.d.ts
|
|
339
|
+
/** Thin alias over `resetMetaCache` — retained so existing test code keeps working. */
|
|
340
|
+
declare function clearTableCache(): void;
|
|
341
|
+
/**
|
|
342
|
+
* Public composable options. Flat shape for Vue-template ergonomics
|
|
343
|
+
* (`<AsTableRoot :limit="50">`). Internally translated into the grouped
|
|
344
|
+
* `CreateTableStateOptions` before reaching `createTableState`.
|
|
345
|
+
*
|
|
346
|
+
* The data-engine `client` is resolved internally from the URL via
|
|
347
|
+
* `getMetaEntry`; callers don't and can't pass it.
|
|
348
|
+
*/
|
|
349
|
+
interface UseTableOptions {
|
|
350
|
+
/** Default page size. */
|
|
351
|
+
limit?: number;
|
|
352
|
+
/** Extract unique value from a row for selection tracking. */
|
|
353
|
+
rowValueFn?: (row: Record<string, unknown>) => unknown;
|
|
354
|
+
/**
|
|
355
|
+
* Selection write policy applied on every results-replacement.
|
|
356
|
+
* - `"clear"` — drop everything on refresh.
|
|
357
|
+
* - `"trim"` (default) — keep the subset of PKs that still exist in the new results.
|
|
358
|
+
* - `"persist"` — never write to `selectedRows`; full consumer ownership.
|
|
359
|
+
*/
|
|
360
|
+
selectionPersistence?: SelectionPersistence;
|
|
361
|
+
/** External ref for filter field names (from defineModel). */
|
|
362
|
+
filterFields?: Ref<string[]>;
|
|
363
|
+
/** External ref for visible column names (from defineModel). */
|
|
364
|
+
columnNames?: Ref<string[]>;
|
|
365
|
+
/** External ref for per-column widths (from defineModel). */
|
|
366
|
+
columnWidths?: Ref<ColumnWidthsMap>;
|
|
367
|
+
/** External ref for sorters (from defineModel). */
|
|
368
|
+
sorters?: Ref<SortControl[]>;
|
|
369
|
+
/**
|
|
370
|
+
* External ref for selected rows (from `defineModel`/v-model or any external
|
|
371
|
+
* source). Identity is preserved — the framework reads from and writes to
|
|
372
|
+
* this ref directly.
|
|
373
|
+
*/
|
|
374
|
+
selectedRows?: Ref<unknown[]>;
|
|
375
|
+
/** Always-applied Uniquery filter expression (AND'd with user filters). */
|
|
376
|
+
forceFilters?: FilterExpr;
|
|
377
|
+
/** Always-applied sorters (prepended before user sorters). */
|
|
378
|
+
forceSorters?: SortControl[];
|
|
379
|
+
/** Override the default query function. */
|
|
380
|
+
queryFn?: QueryFn;
|
|
381
|
+
/** Auto-query when metadata loads (default: true). */
|
|
382
|
+
queryOnMount?: boolean;
|
|
383
|
+
/** When true, all triggers (query/queryNext/loadRange) early-return. */
|
|
384
|
+
blockQuery?: boolean;
|
|
385
|
+
/** Page-alignment unit for `loadRange` and the `queryNext` extension. */
|
|
386
|
+
blockSize?: number;
|
|
387
|
+
/** Debounce window for the topIndex/viewportRowCount watcher. */
|
|
388
|
+
dragReleaseDebounceMs?: number;
|
|
389
|
+
/** Factory to create a client from a URL. Only honored on the first `useTable`/`resolveValueHelp` call per URL — subsequent callers reuse the cached client. */
|
|
390
|
+
clientFactory?: ClientFactory;
|
|
391
|
+
/** Skin-slot overrides for table chrome (header cells, filter dialog, column menu, etc.). */
|
|
392
|
+
controls?: TAsTableControls;
|
|
393
|
+
/** Cell-type → component dispatch map. Use {@link createDefaultCellTypes} to seed defaults. */
|
|
394
|
+
types?: TAsCellTypeComponents;
|
|
395
|
+
/** Named cell-component overrides — looked up by `@ui.table.component "name"`. */
|
|
396
|
+
components?: Record<string, Component$1>;
|
|
397
|
+
/**
|
|
398
|
+
* Form-type → component dispatch map for the action-form dialog. Defaults to
|
|
399
|
+
* `createDefaultTypes()` from `@atscript/vue-form`.
|
|
400
|
+
*/
|
|
401
|
+
formTypes?: TAsTypeComponents;
|
|
402
|
+
/** Named form-component overrides for the action-form dialog. */
|
|
403
|
+
formComponents?: Record<string, Component$1>;
|
|
404
|
+
/** Whether to provide table context to the subtree (default: true). */
|
|
405
|
+
provideContext?: boolean;
|
|
406
|
+
/**
|
|
407
|
+
* Refetch policy for `state.actions.invoke`. When `true` (default),
|
|
408
|
+
* successful `'backend'` / `'__remove'` invocations call `state.query()`.
|
|
409
|
+
*/
|
|
410
|
+
refreshOnAction?: () => boolean;
|
|
411
|
+
/** Bridge for `<AsTableRoot>`'s `@action` emit; see `TableActionsOptions.onResolved`. */
|
|
412
|
+
onActionResolved?: (action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: KeyboardEvent | MouseEvent) => void;
|
|
413
|
+
/**
|
|
414
|
+
* Gate the initial `scheduleQuery("initial")` until this ref is `true`.
|
|
415
|
+
* `<AsTableRoot>` sets it `false` while it hydrates from `v-model:urlQuery`
|
|
416
|
+
* so the first fetch composes URL + defaults into one request. Omit when
|
|
417
|
+
* not using the URL bridge — the gate stays implicitly open.
|
|
418
|
+
*/
|
|
419
|
+
urlQueryReady?: Ref<boolean>;
|
|
420
|
+
/**
|
|
421
|
+
* Called whenever a state mutation produces a new URL query string.
|
|
422
|
+
* Omitting it disables the URL emitter — the feature is opt-in.
|
|
423
|
+
*/
|
|
424
|
+
onUrlQueryChange?: (urlString: string) => void;
|
|
425
|
+
/**
|
|
426
|
+
* Per-aspect opt-in/out for the URL bridge — gate filters / sorters /
|
|
427
|
+
* search / pagination independently. Static; captured once at setup.
|
|
428
|
+
* Default (omitted): full sync.
|
|
429
|
+
*/
|
|
430
|
+
urlQuerySync?: UrlQuerySync;
|
|
431
|
+
/**
|
|
432
|
+
* Preset feature config — opt-in. Omit to disable presets entirely
|
|
433
|
+
* (`<AsPresetPicker>` / `<AsPresetDialog>` render nothing). When set,
|
|
434
|
+
* `url` and `tableKey` are required.
|
|
435
|
+
*/
|
|
436
|
+
preset?: PresetConfig;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Main entry composable for table setup.
|
|
440
|
+
*
|
|
441
|
+
* @param url — Table endpoint URL (e.g. "/db/tables/products")
|
|
442
|
+
*/
|
|
443
|
+
declare function useTable(url: string, opts?: UseTableOptions): ReactiveTableState;
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/composables/use-table-nav-bridge.d.ts
|
|
446
|
+
interface UseTableNavBridgeOptions extends Omit<NavKeyOptions, "mode"> {
|
|
447
|
+
/**
|
|
448
|
+
* Selection mode source. Pass a function (`() => selectMode.value`) so
|
|
449
|
+
* the bridge re-reads on every dispatch — Enter semantics depend on mode,
|
|
450
|
+
* but selection mode lives on the renderer's `:select` prop, not state.
|
|
451
|
+
* Default `"none"` (Enter only fires main-action).
|
|
452
|
+
*/
|
|
453
|
+
mode?: SelectionMode | (() => SelectionMode);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Construct a keyboard-bridge for an external `<input>` to drive table nav
|
|
457
|
+
* without losing focus. Without args, injects the nearest `<as-table-root>`
|
|
458
|
+
* context's state. With an explicit `state`, binds to that state. With
|
|
459
|
+
* `opts.enterAction`, the returned bridge's `onKeydown` defaults to that
|
|
460
|
+
* enter-action (per-call options still win).
|
|
461
|
+
*
|
|
462
|
+
* Each call returns a fresh bridge object — callers that need stable
|
|
463
|
+
* identity should bind once at setup and reuse the binding.
|
|
464
|
+
*/
|
|
465
|
+
declare function useTableNavBridge(state?: ReactiveTableState, opts?: UseTableNavBridgeOptions): TableNavBridge;
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/composables/use-table-filter.d.ts
|
|
468
|
+
/**
|
|
469
|
+
* Per-field filter state composable.
|
|
470
|
+
*
|
|
471
|
+
* Creates a working copy of filter conditions (cancel-safe dialog model).
|
|
472
|
+
* Call `apply()` to commit, `reset()` to revert, `clear()` to remove.
|
|
473
|
+
*
|
|
474
|
+
* Accepts `state` directly rather than injecting — safe to call outside `setup`.
|
|
475
|
+
*/
|
|
476
|
+
declare function useTableFilter(column: ColumnDef, state: ReactiveTableState): {
|
|
477
|
+
filterType: _atscript_ui_table0.ColumnFilterType;
|
|
478
|
+
availableConditions: readonly _atscript_ui_table0.FilterConditionType[];
|
|
479
|
+
defaultCondition: _atscript_ui_table0.FilterConditionType;
|
|
480
|
+
conditions: vue.Ref<{
|
|
481
|
+
type: _atscript_ui_table0.FilterConditionType;
|
|
482
|
+
value: (string | number | boolean)[];
|
|
483
|
+
}[], FilterCondition[] | {
|
|
484
|
+
type: _atscript_ui_table0.FilterConditionType;
|
|
485
|
+
value: (string | number | boolean)[];
|
|
486
|
+
}[]>;
|
|
487
|
+
filledCount: vue.ComputedRef<number>;
|
|
488
|
+
addCondition: () => void;
|
|
489
|
+
removeCondition: (index: number) => void;
|
|
490
|
+
updateCondition: (index: number, update: Partial<FilterCondition>) => void;
|
|
491
|
+
apply: () => void;
|
|
492
|
+
clear: () => void;
|
|
493
|
+
reset: () => void;
|
|
494
|
+
};
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/composables/use-table-search.d.ts
|
|
497
|
+
/**
|
|
498
|
+
* Convenience composable for wiring a search input to the table.
|
|
499
|
+
* Must be called inside an `<AsTableRoot>` subtree.
|
|
500
|
+
*
|
|
501
|
+
* Returns the reactive `searchTerm` ref and an `onSearchInput` handler.
|
|
502
|
+
* The central filter/search watcher debounces the auto-query.
|
|
503
|
+
*/
|
|
504
|
+
declare function useTableSearch(): {
|
|
505
|
+
searchTerm: vue.Ref<string, string>;
|
|
506
|
+
onSearchInput: (event: Event) => void;
|
|
507
|
+
};
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/composables/use-table-actions.d.ts
|
|
510
|
+
/**
|
|
511
|
+
* Inject the table-actions namespace from the closest `<AsTableRoot>` ancestor.
|
|
512
|
+
* Returns `state.actions` directly — no wrapping. Throws when called outside
|
|
513
|
+
* the provider tree (delegated to `useTableContext`).
|
|
514
|
+
*
|
|
515
|
+
* Useful for consumers that want the model without the chrome (custom
|
|
516
|
+
* toolbars, headless action buttons, programmatic invoke).
|
|
517
|
+
*/
|
|
518
|
+
declare function useTableActions(): TableActionsState;
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region ../../node_modules/.pnpm/vue-router@4.6.4_vue@3.5.30_typescript@5.9.3_/node_modules/vue-router/dist/router-CWoNjPRp.d.mts
|
|
521
|
+
//#region src/query.d.ts
|
|
522
|
+
/**
|
|
523
|
+
* Possible values in normalized {@link LocationQuery}. `null` renders the query
|
|
524
|
+
* param but without an `=`.
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* ```
|
|
528
|
+
* ?isNull&isEmpty=&other=other
|
|
529
|
+
* gives
|
|
530
|
+
* `{ isNull: null, isEmpty: '', other: 'other' }`.
|
|
531
|
+
* ```
|
|
532
|
+
*
|
|
533
|
+
* @internal
|
|
534
|
+
*/
|
|
535
|
+
type LocationQueryValue = string | null;
|
|
536
|
+
/**
|
|
537
|
+
* Possible values when defining a query. `undefined` allows to remove a value.
|
|
538
|
+
*
|
|
539
|
+
* @internal
|
|
540
|
+
*/
|
|
541
|
+
type LocationQueryValueRaw = LocationQueryValue | number | undefined;
|
|
542
|
+
/**
|
|
543
|
+
* Normalized query object that appears in {@link RouteLocationNormalized}
|
|
544
|
+
*
|
|
545
|
+
* @public
|
|
546
|
+
*/
|
|
547
|
+
type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
|
|
548
|
+
/**
|
|
549
|
+
* Loose {@link LocationQuery} object that can be passed to functions like
|
|
550
|
+
* {@link Router.push} and {@link Router.replace} or anywhere when creating a
|
|
551
|
+
* {@link RouteLocationRaw}
|
|
552
|
+
*
|
|
553
|
+
* @public
|
|
554
|
+
*/
|
|
555
|
+
type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
|
|
556
|
+
/**
|
|
557
|
+
* Transforms a queryString into a {@link LocationQuery} object. Accept both, a
|
|
558
|
+
* version with the leading `?` and without Should work as URLSearchParams
|
|
559
|
+
|
|
560
|
+
* @internal
|
|
561
|
+
*
|
|
562
|
+
* @param search - search string to parse
|
|
563
|
+
* @returns a query object
|
|
564
|
+
*/
|
|
565
|
+
declare function parseQuery(search: string): LocationQuery;
|
|
566
|
+
/**
|
|
567
|
+
* Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
|
|
568
|
+
* doesn't prepend a `?`
|
|
569
|
+
*
|
|
570
|
+
* @internal
|
|
571
|
+
*
|
|
572
|
+
* @param query - query object to stringify
|
|
573
|
+
* @returns string version of the query without the leading `?`
|
|
574
|
+
*/
|
|
575
|
+
declare function stringifyQuery(query: LocationQueryRaw | undefined): string; //#endregion
|
|
576
|
+
//#region src/config.d.ts
|
|
577
|
+
/**
|
|
578
|
+
* Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
|
|
579
|
+
*
|
|
580
|
+
* - `$router` - the router instance
|
|
581
|
+
* - `$route` - the current route location
|
|
582
|
+
* - `beforeRouteEnter` - Page component option
|
|
583
|
+
* - `beforeRouteUpdate` - Page component option
|
|
584
|
+
* - `beforeRouteLeave` - Page component option
|
|
585
|
+
* - `RouterLink` - RouterLink Component
|
|
586
|
+
* - `RouterView` - RouterView Component
|
|
587
|
+
*
|
|
588
|
+
* @internal
|
|
589
|
+
*/
|
|
590
|
+
interface TypesConfig {} //#endregion
|
|
591
|
+
//#region src/typed-routes/route-map.d.ts
|
|
592
|
+
/**
|
|
593
|
+
* Helper type to define a Typed `RouteRecord`
|
|
594
|
+
* @see {@link RouteRecord}
|
|
595
|
+
*/
|
|
596
|
+
interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params extends RouteParamsGeneric = RouteParamsGeneric, ChildrenNames extends string | symbol = never> {
|
|
597
|
+
name: Name;
|
|
598
|
+
path: Path;
|
|
599
|
+
paramsRaw: ParamsRaw;
|
|
600
|
+
params: Params;
|
|
601
|
+
childrenNames: ChildrenNames;
|
|
602
|
+
}
|
|
603
|
+
type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
|
|
604
|
+
/**
|
|
605
|
+
* Convenience type to get the typed RouteMap or a generic one if not provided. It is extracted from the {@link TypesConfig} if it exists, it becomes {@link RouteMapGeneric} otherwise.
|
|
606
|
+
*/
|
|
607
|
+
type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
|
|
608
|
+
/**
|
|
609
|
+
* Generic version of the `RouteMap`.
|
|
610
|
+
*/
|
|
611
|
+
type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>; //#endregion
|
|
612
|
+
//#region src/typed-routes/params.d.ts
|
|
613
|
+
/**
|
|
614
|
+
* Utility type for raw and non raw params like :id+
|
|
615
|
+
*
|
|
616
|
+
*/
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/types/utils.d.ts
|
|
619
|
+
/**
|
|
620
|
+
* Creates a union type that still allows autocompletion for strings.
|
|
621
|
+
* @internal
|
|
622
|
+
*/
|
|
623
|
+
type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
|
|
624
|
+
/**
|
|
625
|
+
* Maybe a promise maybe not
|
|
626
|
+
* @internal
|
|
627
|
+
*/
|
|
628
|
+
type _Awaitable<T> = T | PromiseLike<T>;
|
|
629
|
+
/**
|
|
630
|
+
* @internal
|
|
631
|
+
*/
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/typed-routes/route-records.d.ts
|
|
634
|
+
/**
|
|
635
|
+
* @internal
|
|
636
|
+
*/
|
|
637
|
+
type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation, from: RouteLocationNormalizedLoaded) => RouteLocationRaw);
|
|
638
|
+
/**
|
|
639
|
+
* Generic version of {@link RouteRecordName}.
|
|
640
|
+
*/
|
|
641
|
+
type RouteRecordNameGeneric = string | symbol | undefined;
|
|
642
|
+
/**
|
|
643
|
+
* Possible values for a route record **after normalization**
|
|
644
|
+
*
|
|
645
|
+
* NOTE: since `RouteRecordName` is a type, it evaluates too early and it's often the generic version {@link RouteRecordNameGeneric}. If you need a typed version of all of the names of routes, use {@link RouteMap | `keyof RouteMap`}
|
|
646
|
+
*/
|
|
647
|
+
/**
|
|
648
|
+
* @internal
|
|
649
|
+
*/
|
|
650
|
+
type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>); //#endregion
|
|
651
|
+
//#region src/typed-routes/route-location.d.ts
|
|
652
|
+
/**
|
|
653
|
+
* Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
|
|
654
|
+
*/
|
|
655
|
+
interface RouteLocationGeneric extends _RouteLocationBase, RouteLocationOptions {
|
|
656
|
+
/**
|
|
657
|
+
* Array of {@link RouteRecord} containing components as they were
|
|
658
|
+
* passed when adding records. It can also contain redirect records. This
|
|
659
|
+
* can't be used directly. **This property is non-enumerable**.
|
|
660
|
+
*/
|
|
661
|
+
matched: RouteRecord[];
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Helper to generate a type safe version of the {@link RouteLocation} type.
|
|
665
|
+
*/
|
|
666
|
+
interface RouteLocationTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationGeneric {
|
|
667
|
+
name: Extract<Name, string | symbol>;
|
|
668
|
+
params: RouteMap$1[Name]['params'];
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* List of all possible {@link RouteLocation} indexed by the route name.
|
|
672
|
+
* @internal
|
|
673
|
+
*/
|
|
674
|
+
type RouteLocationTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationTyped<RouteMap$1, N> };
|
|
675
|
+
/**
|
|
676
|
+
* Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
|
|
677
|
+
*/
|
|
678
|
+
interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
|
|
679
|
+
name: RouteRecordNameGeneric;
|
|
680
|
+
/**
|
|
681
|
+
* Array of {@link RouteRecordNormalized}
|
|
682
|
+
*/
|
|
683
|
+
matched: RouteRecordNormalized[];
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
|
|
687
|
+
*/
|
|
688
|
+
interface RouteLocationNormalizedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedGeneric {
|
|
689
|
+
name: Extract<Name, string | symbol>;
|
|
690
|
+
params: RouteMap$1[Name]['params'];
|
|
691
|
+
/**
|
|
692
|
+
* Array of {@link RouteRecordNormalized}
|
|
693
|
+
*/
|
|
694
|
+
matched: RouteRecordNormalized[];
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* List of all possible {@link RouteLocationNormalized} indexed by the route name.
|
|
698
|
+
* @internal
|
|
699
|
+
*/
|
|
700
|
+
type RouteLocationNormalizedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedTyped<RouteMap$1, N> };
|
|
701
|
+
/**
|
|
702
|
+
* Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
|
|
703
|
+
*/
|
|
704
|
+
interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
|
|
705
|
+
/**
|
|
706
|
+
* Array of {@link RouteLocationMatched} containing only plain components (any
|
|
707
|
+
* lazy-loaded components have been loaded and were replaced inside the
|
|
708
|
+
* `components` object) so it can be directly used to display routes. It
|
|
709
|
+
* cannot contain redirect records either. **This property is non-enumerable**.
|
|
710
|
+
*/
|
|
711
|
+
matched: RouteLocationMatched[];
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
|
|
715
|
+
*/
|
|
716
|
+
interface RouteLocationNormalizedLoadedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedLoadedGeneric {
|
|
717
|
+
name: Extract<Name, string | symbol>;
|
|
718
|
+
params: RouteMap$1[Name]['params'];
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
|
|
722
|
+
* @internal
|
|
723
|
+
*/
|
|
724
|
+
type RouteLocationNormalizedLoadedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedLoadedTyped<RouteMap$1, N> };
|
|
725
|
+
/**
|
|
726
|
+
* Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
|
|
727
|
+
*/
|
|
728
|
+
interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
729
|
+
name?: RouteRecordNameGeneric;
|
|
730
|
+
params?: RouteParamsRawGeneric;
|
|
731
|
+
/**
|
|
732
|
+
* A relative path to the current location. This property should be removed
|
|
733
|
+
*/
|
|
734
|
+
path?: undefined;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
|
|
738
|
+
*/
|
|
739
|
+
interface RouteLocationAsRelativeTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsRelativeGeneric {
|
|
740
|
+
name?: Extract<Name, string | symbol>;
|
|
741
|
+
params?: RouteMap$1[Name]['paramsRaw'];
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* List of all possible {@link RouteLocationAsRelative} indexed by the route name.
|
|
745
|
+
* @internal
|
|
746
|
+
*/
|
|
747
|
+
type RouteLocationAsRelativeTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsRelativeTyped<RouteMap$1, N> };
|
|
748
|
+
/**
|
|
749
|
+
* Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
|
|
750
|
+
*/
|
|
751
|
+
interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
|
|
752
|
+
/**
|
|
753
|
+
* Percentage encoded pathname section of the URL.
|
|
754
|
+
*/
|
|
755
|
+
path: string;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
|
|
759
|
+
*/
|
|
760
|
+
interface RouteLocationAsPathTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsPathGeneric {
|
|
761
|
+
path: _LiteralUnion<RouteMap$1[Name]['path']>;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* List of all possible {@link RouteLocationAsPath} indexed by the route name.
|
|
765
|
+
* @internal
|
|
766
|
+
*/
|
|
767
|
+
type RouteLocationAsPathTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsPathTyped<RouteMap$1, N> };
|
|
768
|
+
/**
|
|
769
|
+
* Helper to generate a type safe version of the {@link RouteLocationAsString} type.
|
|
770
|
+
*/
|
|
771
|
+
type RouteLocationAsStringTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> = RouteMap$1[Name]['path'];
|
|
772
|
+
/**
|
|
773
|
+
* List of all possible {@link RouteLocationAsString} indexed by the route name.
|
|
774
|
+
* @internal
|
|
775
|
+
*/
|
|
776
|
+
type RouteLocationAsStringTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsStringTyped<RouteMap$1, N> };
|
|
777
|
+
/**
|
|
778
|
+
* Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
|
|
779
|
+
*/
|
|
780
|
+
interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
|
|
781
|
+
/**
|
|
782
|
+
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
783
|
+
*/
|
|
784
|
+
href: string;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Helper to generate a type safe version of the {@link RouteLocationResolved} type.
|
|
788
|
+
*/
|
|
789
|
+
interface RouteLocationResolvedTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationTyped<RouteMap$1, Name> {
|
|
790
|
+
/**
|
|
791
|
+
* Resolved `href` for the route location that will be set on the `<a href="...">`.
|
|
792
|
+
*/
|
|
793
|
+
href: string;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* List of all possible {@link RouteLocationResolved} indexed by the route name.
|
|
797
|
+
* @internal
|
|
798
|
+
*/
|
|
799
|
+
type RouteLocationResolvedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationResolvedTyped<RouteMap$1, N> };
|
|
800
|
+
/**
|
|
801
|
+
* Type safe versions of types that are exposed by vue-router. We have to use a generic check to allow for names to be `undefined` when no `RouteMap` is provided.
|
|
802
|
+
*/
|
|
803
|
+
/**
|
|
804
|
+
* {@link RouteLocationRaw} resolved using the matcher
|
|
805
|
+
*/
|
|
806
|
+
type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
|
|
807
|
+
/**
|
|
808
|
+
* Similar to {@link RouteLocation} but its
|
|
809
|
+
* {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
|
|
810
|
+
*/
|
|
811
|
+
type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
|
|
812
|
+
/**
|
|
813
|
+
* Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
|
|
814
|
+
* In other words, it's ready to be rendered by `<RouterView>`.
|
|
815
|
+
*/
|
|
816
|
+
type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
|
|
817
|
+
/**
|
|
818
|
+
* Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
|
|
819
|
+
* `hash` to conveniently change them.
|
|
820
|
+
*/
|
|
821
|
+
type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
|
|
822
|
+
/**
|
|
823
|
+
* Route location resolved with {@link Router | `router.resolve()`}.
|
|
824
|
+
*/
|
|
825
|
+
type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
|
|
826
|
+
/**
|
|
827
|
+
* Same as {@link RouteLocationAsPath} but as a string literal.
|
|
828
|
+
*/
|
|
829
|
+
type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
|
|
830
|
+
/**
|
|
831
|
+
* Route location as an object with a `path` property.
|
|
832
|
+
*/
|
|
833
|
+
type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
|
|
834
|
+
/**
|
|
835
|
+
* Route location that can be passed to `router.push()` and other user-facing APIs.
|
|
836
|
+
*/
|
|
837
|
+
type RouteLocationRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsString | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string> | RouteLocationAsRelativeTypedList<RouteMap>[Name] | RouteLocationAsPathTypedList<RouteMap>[Name]; //#endregion
|
|
838
|
+
//#region src/typed-routes/navigation-guards.d.ts
|
|
839
|
+
/**
|
|
840
|
+
* Return types for a Navigation Guard. Based on `TypesConfig`
|
|
841
|
+
*
|
|
842
|
+
* @see {@link TypesConfig}
|
|
843
|
+
*/
|
|
844
|
+
type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
|
|
845
|
+
/**
|
|
846
|
+
* Navigation Guard with a type parameter for `this`.
|
|
847
|
+
* @see {@link TypesConfig}
|
|
848
|
+
*/
|
|
849
|
+
interface NavigationGuardWithThis<T> {
|
|
850
|
+
(this: T, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Navigation Guard.
|
|
854
|
+
*/
|
|
855
|
+
interface NavigationGuard {
|
|
856
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Navigation hook triggered after a navigation is settled.
|
|
860
|
+
*/
|
|
861
|
+
interface NavigationHookAfter {
|
|
862
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* `next()` callback passed to navigation guards.
|
|
866
|
+
*/
|
|
867
|
+
interface NavigationGuardNext {
|
|
868
|
+
(): void;
|
|
869
|
+
(error: Error): void;
|
|
870
|
+
(location: RouteLocationRaw): void;
|
|
871
|
+
(valid: boolean | undefined): void;
|
|
872
|
+
(cb: NavigationGuardNextCallback): void;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
|
|
876
|
+
*/
|
|
877
|
+
type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown; //#endregion
|
|
878
|
+
//#region src/matcher/types.d.ts
|
|
879
|
+
/**
|
|
880
|
+
* Normalized version of a {@link RouteRecord | route record}.
|
|
881
|
+
*/
|
|
882
|
+
interface RouteRecordNormalized {
|
|
883
|
+
/**
|
|
884
|
+
* {@inheritDoc _RouteRecordBase.path}
|
|
885
|
+
*/
|
|
886
|
+
path: _RouteRecordBase['path'];
|
|
887
|
+
/**
|
|
888
|
+
* {@inheritDoc _RouteRecordBase.redirect}
|
|
889
|
+
*/
|
|
890
|
+
redirect: _RouteRecordBase['redirect'] | undefined;
|
|
891
|
+
/**
|
|
892
|
+
* {@inheritDoc _RouteRecordBase.name}
|
|
893
|
+
*/
|
|
894
|
+
name: _RouteRecordBase['name'];
|
|
895
|
+
/**
|
|
896
|
+
* {@inheritDoc RouteRecordMultipleViews.components}
|
|
897
|
+
*/
|
|
898
|
+
components: RouteRecordMultipleViews['components'] | null | undefined;
|
|
899
|
+
/**
|
|
900
|
+
* Contains the original modules for lazy loaded components.
|
|
901
|
+
* @internal
|
|
902
|
+
*/
|
|
903
|
+
mods: Record<string, unknown>;
|
|
904
|
+
/**
|
|
905
|
+
* Nested route records.
|
|
906
|
+
*/
|
|
907
|
+
children: RouteRecordRaw[];
|
|
908
|
+
/**
|
|
909
|
+
* {@inheritDoc _RouteRecordBase.meta}
|
|
910
|
+
*/
|
|
911
|
+
meta: Exclude<_RouteRecordBase['meta'], void>;
|
|
912
|
+
/**
|
|
913
|
+
* {@inheritDoc RouteRecordMultipleViews.props}
|
|
914
|
+
*/
|
|
915
|
+
props: Record<string, _RouteRecordProps>;
|
|
916
|
+
/**
|
|
917
|
+
* Registered beforeEnter guards
|
|
918
|
+
*/
|
|
919
|
+
beforeEnter: _RouteRecordBase['beforeEnter'];
|
|
920
|
+
/**
|
|
921
|
+
* Registered leave guards
|
|
922
|
+
*
|
|
923
|
+
* @internal
|
|
924
|
+
*/
|
|
925
|
+
leaveGuards: Set<NavigationGuard>;
|
|
926
|
+
/**
|
|
927
|
+
* Registered update guards
|
|
928
|
+
*
|
|
929
|
+
* @internal
|
|
930
|
+
*/
|
|
931
|
+
updateGuards: Set<NavigationGuard>;
|
|
932
|
+
/**
|
|
933
|
+
* Registered beforeRouteEnter callbacks passed to `next` or returned in guards
|
|
934
|
+
*
|
|
935
|
+
* @internal
|
|
936
|
+
*/
|
|
937
|
+
enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
|
|
938
|
+
/**
|
|
939
|
+
* Mounted route component instances
|
|
940
|
+
* Having the instances on the record mean beforeRouteUpdate and
|
|
941
|
+
* beforeRouteLeave guards can only be invoked with the latest mounted app
|
|
942
|
+
* instance if there are multiple application instances rendering the same
|
|
943
|
+
* view, basically duplicating the content on the page, which shouldn't happen
|
|
944
|
+
* in practice. It will work if multiple apps are rendering different named
|
|
945
|
+
* views.
|
|
946
|
+
*/
|
|
947
|
+
instances: Record<string, ComponentPublicInstance | undefined | null>;
|
|
948
|
+
/**
|
|
949
|
+
* Defines if this record is the alias of another one. This property is
|
|
950
|
+
* `undefined` if the record is the original one.
|
|
951
|
+
*/
|
|
952
|
+
aliasOf: RouteRecordNormalized | undefined;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* {@inheritDoc RouteRecordNormalized}
|
|
956
|
+
*/
|
|
957
|
+
type RouteRecord = RouteRecordNormalized; //#endregion
|
|
958
|
+
//#region src/matcher/pathParserRanker.d.ts
|
|
959
|
+
/**
|
|
960
|
+
* @internal
|
|
961
|
+
*/
|
|
962
|
+
interface _PathParserOptions {
|
|
963
|
+
/**
|
|
964
|
+
* Makes the RegExp case-sensitive.
|
|
965
|
+
*
|
|
966
|
+
* @defaultValue `false`
|
|
967
|
+
*/
|
|
968
|
+
sensitive?: boolean;
|
|
969
|
+
/**
|
|
970
|
+
* Whether to disallow a trailing slash or not.
|
|
971
|
+
*
|
|
972
|
+
* @defaultValue `false`
|
|
973
|
+
*/
|
|
974
|
+
strict?: boolean;
|
|
975
|
+
/**
|
|
976
|
+
* Should the RegExp match from the beginning by prepending a `^` to it.
|
|
977
|
+
* @internal
|
|
978
|
+
*
|
|
979
|
+
* @defaultValue `true`
|
|
980
|
+
*/
|
|
981
|
+
start?: boolean;
|
|
982
|
+
/**
|
|
983
|
+
* Should the RegExp match until the end by appending a `$` to it.
|
|
984
|
+
*
|
|
985
|
+
* @deprecated this option will alsways be `true` in the future. Open a discussion in vuejs/router if you need this to be `false`
|
|
986
|
+
*
|
|
987
|
+
* @defaultValue `true`
|
|
988
|
+
*/
|
|
989
|
+
end?: boolean;
|
|
990
|
+
}
|
|
991
|
+
type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>; //#endregion
|
|
992
|
+
//#region src/matcher/pathMatcher.d.ts
|
|
993
|
+
//#endregion
|
|
994
|
+
//#region src/history/common.d.ts
|
|
995
|
+
type HistoryLocation = string;
|
|
996
|
+
/**
|
|
997
|
+
* Allowed variables in HTML5 history state. Note that pushState clones the state
|
|
998
|
+
* passed and does not accept everything: e.g.: it doesn't accept symbols, nor
|
|
999
|
+
* functions as values. It also ignores Symbols as keys.
|
|
1000
|
+
*
|
|
1001
|
+
* @internal
|
|
1002
|
+
*/
|
|
1003
|
+
type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
|
|
1004
|
+
/**
|
|
1005
|
+
* Allowed HTML history.state
|
|
1006
|
+
*/
|
|
1007
|
+
interface HistoryState {
|
|
1008
|
+
[x: number]: HistoryStateValue;
|
|
1009
|
+
[x: string]: HistoryStateValue;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Allowed arrays for history.state.
|
|
1013
|
+
*
|
|
1014
|
+
* @internal
|
|
1015
|
+
*/
|
|
1016
|
+
interface HistoryStateArray extends Array<HistoryStateValue> {}
|
|
1017
|
+
declare enum NavigationType {
|
|
1018
|
+
pop = "pop",
|
|
1019
|
+
push = "push"
|
|
1020
|
+
}
|
|
1021
|
+
declare enum NavigationDirection {
|
|
1022
|
+
back = "back",
|
|
1023
|
+
forward = "forward",
|
|
1024
|
+
unknown = ""
|
|
1025
|
+
}
|
|
1026
|
+
interface NavigationInformation {
|
|
1027
|
+
type: NavigationType;
|
|
1028
|
+
direction: NavigationDirection;
|
|
1029
|
+
delta: number;
|
|
1030
|
+
}
|
|
1031
|
+
interface NavigationCallback {
|
|
1032
|
+
(to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Interface implemented by History implementations that can be passed to the
|
|
1036
|
+
* router as {@link Router.history}
|
|
1037
|
+
*
|
|
1038
|
+
* @alpha
|
|
1039
|
+
*/
|
|
1040
|
+
interface RouterHistory {
|
|
1041
|
+
/**
|
|
1042
|
+
* Base path that is prepended to every url. This allows hosting an SPA at a
|
|
1043
|
+
* sub-folder of a domain like `example.com/sub-folder` by having a `base` of
|
|
1044
|
+
* `/sub-folder`
|
|
1045
|
+
*/
|
|
1046
|
+
readonly base: string;
|
|
1047
|
+
/**
|
|
1048
|
+
* Current History location
|
|
1049
|
+
*/
|
|
1050
|
+
readonly location: HistoryLocation;
|
|
1051
|
+
/**
|
|
1052
|
+
* Current History state
|
|
1053
|
+
*/
|
|
1054
|
+
readonly state: HistoryState;
|
|
1055
|
+
/**
|
|
1056
|
+
* Navigates to a location. In the case of an HTML5 History implementation,
|
|
1057
|
+
* this will call `history.pushState` to effectively change the URL.
|
|
1058
|
+
*
|
|
1059
|
+
* @param to - location to push
|
|
1060
|
+
* @param data - optional {@link HistoryState} to be associated with the
|
|
1061
|
+
* navigation entry
|
|
1062
|
+
*/
|
|
1063
|
+
push(to: HistoryLocation, data?: HistoryState): void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Same as {@link RouterHistory.push} but performs a `history.replaceState`
|
|
1066
|
+
* instead of `history.pushState`
|
|
1067
|
+
*
|
|
1068
|
+
* @param to - location to set
|
|
1069
|
+
* @param data - optional {@link HistoryState} to be associated with the
|
|
1070
|
+
* navigation entry
|
|
1071
|
+
*/
|
|
1072
|
+
replace(to: HistoryLocation, data?: HistoryState): void;
|
|
1073
|
+
/**
|
|
1074
|
+
* Traverses history in a given direction.
|
|
1075
|
+
*
|
|
1076
|
+
* @example
|
|
1077
|
+
* ```js
|
|
1078
|
+
* myHistory.go(-1) // equivalent to window.history.back()
|
|
1079
|
+
* myHistory.go(1) // equivalent to window.history.forward()
|
|
1080
|
+
* ```
|
|
1081
|
+
*
|
|
1082
|
+
* @param delta - distance to travel. If delta is \< 0, it will go back,
|
|
1083
|
+
* if it's \> 0, it will go forward by that amount of entries.
|
|
1084
|
+
* @param triggerListeners - whether this should trigger listeners attached to
|
|
1085
|
+
* the history
|
|
1086
|
+
*/
|
|
1087
|
+
go(delta: number, triggerListeners?: boolean): void;
|
|
1088
|
+
/**
|
|
1089
|
+
* Attach a listener to the History implementation that is triggered when the
|
|
1090
|
+
* navigation is triggered from outside (like the Browser back and forward
|
|
1091
|
+
* buttons) or when passing `true` to {@link RouterHistory.back} and
|
|
1092
|
+
* {@link RouterHistory.forward}
|
|
1093
|
+
*
|
|
1094
|
+
* @param callback - listener to attach
|
|
1095
|
+
* @returns a callback to remove the listener
|
|
1096
|
+
*/
|
|
1097
|
+
listen(callback: NavigationCallback): () => void;
|
|
1098
|
+
/**
|
|
1099
|
+
* Generates the corresponding href to be used in an anchor tag.
|
|
1100
|
+
*
|
|
1101
|
+
* @param location - history location that should create an href
|
|
1102
|
+
*/
|
|
1103
|
+
createHref(location: HistoryLocation): string;
|
|
1104
|
+
/**
|
|
1105
|
+
* Clears any event listener attached by the history implementation.
|
|
1106
|
+
*/
|
|
1107
|
+
destroy(): void;
|
|
1108
|
+
} //#endregion
|
|
1109
|
+
//#region src/types/index.d.ts
|
|
1110
|
+
type Lazy<T> = () => Promise<T>;
|
|
1111
|
+
/**
|
|
1112
|
+
* @internal
|
|
1113
|
+
*/
|
|
1114
|
+
type RouteParamValue = string;
|
|
1115
|
+
/**
|
|
1116
|
+
* @internal
|
|
1117
|
+
*/
|
|
1118
|
+
type RouteParamValueRaw = RouteParamValue | number | null | undefined;
|
|
1119
|
+
type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
|
|
1120
|
+
type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
|
|
1121
|
+
/**
|
|
1122
|
+
* @internal
|
|
1123
|
+
*/
|
|
1124
|
+
interface RouteQueryAndHash {
|
|
1125
|
+
query?: LocationQueryRaw;
|
|
1126
|
+
hash?: string;
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* @internal
|
|
1130
|
+
*/
|
|
1131
|
+
/**
|
|
1132
|
+
* Common options for all navigation methods.
|
|
1133
|
+
*/
|
|
1134
|
+
interface RouteLocationOptions {
|
|
1135
|
+
/**
|
|
1136
|
+
* Replace the entry in the history instead of pushing a new entry
|
|
1137
|
+
*/
|
|
1138
|
+
replace?: boolean;
|
|
1139
|
+
/**
|
|
1140
|
+
* Triggers the navigation even if the location is the same as the current one.
|
|
1141
|
+
* Note this will also add a new entry to the history unless `replace: true`
|
|
1142
|
+
* is passed.
|
|
1143
|
+
*/
|
|
1144
|
+
force?: boolean;
|
|
1145
|
+
/**
|
|
1146
|
+
* State to save using the History API. This cannot contain any reactive
|
|
1147
|
+
* values and some primitives like Symbols are forbidden. More info at
|
|
1148
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/History/state
|
|
1149
|
+
*/
|
|
1150
|
+
state?: HistoryState;
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Route Location that can infer the necessary params based on the name.
|
|
1154
|
+
*
|
|
1155
|
+
* @internal
|
|
1156
|
+
*/
|
|
1157
|
+
interface RouteLocationMatched extends RouteRecordNormalized {
|
|
1158
|
+
components: Record<string, RouteComponent> | null | undefined;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Base properties for a normalized route location.
|
|
1162
|
+
*
|
|
1163
|
+
* @internal
|
|
1164
|
+
*/
|
|
1165
|
+
interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
|
|
1166
|
+
/**
|
|
1167
|
+
* The whole location including the `search` and `hash`. This string is
|
|
1168
|
+
* percentage encoded.
|
|
1169
|
+
*/
|
|
1170
|
+
fullPath: string;
|
|
1171
|
+
/**
|
|
1172
|
+
* Object representation of the `search` property of the current location.
|
|
1173
|
+
*/
|
|
1174
|
+
query: LocationQuery;
|
|
1175
|
+
/**
|
|
1176
|
+
* Hash of the current location. If present, starts with a `#`.
|
|
1177
|
+
*/
|
|
1178
|
+
hash: string;
|
|
1179
|
+
/**
|
|
1180
|
+
* Contains the location we were initially trying to access before ending up
|
|
1181
|
+
* on the current location.
|
|
1182
|
+
*/
|
|
1183
|
+
redirectedFrom: RouteLocation | undefined;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Allowed Component in {@link RouteLocationMatched}
|
|
1187
|
+
*/
|
|
1188
|
+
type RouteComponent = Component$1 | DefineComponent;
|
|
1189
|
+
/**
|
|
1190
|
+
* Allowed Component definitions in route records provided by the user
|
|
1191
|
+
*/
|
|
1192
|
+
type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
1195
|
+
*/
|
|
1196
|
+
interface _RouteRecordBase extends PathParserOptions {
|
|
1197
|
+
/**
|
|
1198
|
+
* Path of the record. Should start with `/` unless the record is the child of
|
|
1199
|
+
* another record.
|
|
1200
|
+
*
|
|
1201
|
+
* @example `/users/:id` matches `/users/1` as well as `/users/posva`.
|
|
1202
|
+
*/
|
|
1203
|
+
path: string;
|
|
1204
|
+
/**
|
|
1205
|
+
* Where to redirect if the route is directly matched. The redirection happens
|
|
1206
|
+
* before any navigation guard and triggers a new navigation with the new
|
|
1207
|
+
* target location.
|
|
1208
|
+
*/
|
|
1209
|
+
redirect?: RouteRecordRedirectOption;
|
|
1210
|
+
/**
|
|
1211
|
+
* Aliases for the record. Allows defining extra paths that will behave like a
|
|
1212
|
+
* copy of the record. Allows having paths shorthands like `/users/:id` and
|
|
1213
|
+
* `/u/:id`. All `alias` and `path` values must share the same params.
|
|
1214
|
+
*/
|
|
1215
|
+
alias?: string | string[];
|
|
1216
|
+
/**
|
|
1217
|
+
* Name for the route record. Must be unique.
|
|
1218
|
+
*/
|
|
1219
|
+
name?: RouteRecordNameGeneric;
|
|
1220
|
+
/**
|
|
1221
|
+
* Before Enter guard specific to this record. Note `beforeEnter` has no
|
|
1222
|
+
* effect if the record has a `redirect` property.
|
|
1223
|
+
*/
|
|
1224
|
+
beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
|
|
1225
|
+
/**
|
|
1226
|
+
* Arbitrary data attached to the record.
|
|
1227
|
+
*/
|
|
1228
|
+
meta?: RouteMeta;
|
|
1229
|
+
/**
|
|
1230
|
+
* Array of nested routes.
|
|
1231
|
+
*/
|
|
1232
|
+
children?: RouteRecordRaw[];
|
|
1233
|
+
/**
|
|
1234
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
1235
|
+
*/
|
|
1236
|
+
props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Interface to type `meta` fields in route records.
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
*
|
|
1243
|
+
* ```ts
|
|
1244
|
+
* // typings.d.ts or router.ts
|
|
1245
|
+
* import 'vue-router';
|
|
1246
|
+
*
|
|
1247
|
+
* declare module 'vue-router' {
|
|
1248
|
+
* interface RouteMeta {
|
|
1249
|
+
* requiresAuth?: boolean
|
|
1250
|
+
* }
|
|
1251
|
+
* }
|
|
1252
|
+
* ```
|
|
1253
|
+
*/
|
|
1254
|
+
interface RouteMeta extends Record<PropertyKey, unknown> {}
|
|
1255
|
+
/**
|
|
1256
|
+
* Route Record defining one single component with the `component` option.
|
|
1257
|
+
*/
|
|
1258
|
+
interface RouteRecordSingleView extends _RouteRecordBase {
|
|
1259
|
+
/**
|
|
1260
|
+
* Component to display when the URL matches this route.
|
|
1261
|
+
*/
|
|
1262
|
+
component: RawRouteComponent;
|
|
1263
|
+
components?: never;
|
|
1264
|
+
children?: never;
|
|
1265
|
+
redirect?: never;
|
|
1266
|
+
/**
|
|
1267
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
1268
|
+
*/
|
|
1269
|
+
props?: _RouteRecordProps;
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Route Record defining one single component with a nested view. Differently
|
|
1273
|
+
* from {@link RouteRecordSingleView}, this record has children and allows a
|
|
1274
|
+
* `redirect` option.
|
|
1275
|
+
*/
|
|
1276
|
+
interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
|
|
1277
|
+
/**
|
|
1278
|
+
* Component to display when the URL matches this route.
|
|
1279
|
+
*/
|
|
1280
|
+
component?: RawRouteComponent | null | undefined;
|
|
1281
|
+
components?: never;
|
|
1282
|
+
children: RouteRecordRaw[];
|
|
1283
|
+
/**
|
|
1284
|
+
* Allow passing down params as props to the component rendered by `router-view`.
|
|
1285
|
+
*/
|
|
1286
|
+
props?: _RouteRecordProps;
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Route Record defining multiple named components with the `components` option.
|
|
1290
|
+
*/
|
|
1291
|
+
interface RouteRecordMultipleViews extends _RouteRecordBase {
|
|
1292
|
+
/**
|
|
1293
|
+
* Components to display when the URL matches this route. Allow using named views.
|
|
1294
|
+
*/
|
|
1295
|
+
components: Record<string, RawRouteComponent>;
|
|
1296
|
+
component?: never;
|
|
1297
|
+
children?: never;
|
|
1298
|
+
redirect?: never;
|
|
1299
|
+
/**
|
|
1300
|
+
* Allow passing down params as props to the component rendered by
|
|
1301
|
+
* `router-view`. Should be an object with the same keys as `components` or a
|
|
1302
|
+
* boolean to be applied to every component.
|
|
1303
|
+
*/
|
|
1304
|
+
props?: Record<string, _RouteRecordProps> | boolean;
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Route Record defining multiple named components with the `components` option and children.
|
|
1308
|
+
*/
|
|
1309
|
+
interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
|
|
1310
|
+
/**
|
|
1311
|
+
* Components to display when the URL matches this route. Allow using named views.
|
|
1312
|
+
*/
|
|
1313
|
+
components?: Record<string, RawRouteComponent> | null | undefined;
|
|
1314
|
+
component?: never;
|
|
1315
|
+
children: RouteRecordRaw[];
|
|
1316
|
+
/**
|
|
1317
|
+
* Allow passing down params as props to the component rendered by
|
|
1318
|
+
* `router-view`. Should be an object with the same keys as `components` or a
|
|
1319
|
+
* boolean to be applied to every component.
|
|
1320
|
+
*/
|
|
1321
|
+
props?: Record<string, _RouteRecordProps> | boolean;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Route Record that defines a redirect. Cannot have `component` or `components`
|
|
1325
|
+
* as it is never rendered.
|
|
1326
|
+
*/
|
|
1327
|
+
interface RouteRecordRedirect extends _RouteRecordBase {
|
|
1328
|
+
redirect: RouteRecordRedirectOption;
|
|
1329
|
+
component?: never;
|
|
1330
|
+
components?: never;
|
|
1331
|
+
props?: never;
|
|
1332
|
+
}
|
|
1333
|
+
type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
|
|
1334
|
+
/**
|
|
1335
|
+
* Route location that can be passed to the matcher.
|
|
1336
|
+
*/
|
|
1337
|
+
/**
|
|
1338
|
+
* Normalized/resolved Route location that returned by the matcher.
|
|
1339
|
+
*/
|
|
1340
|
+
interface MatcherLocation {
|
|
1341
|
+
/**
|
|
1342
|
+
* Name of the matched record
|
|
1343
|
+
*/
|
|
1344
|
+
name: RouteRecordNameGeneric | null | undefined;
|
|
1345
|
+
/**
|
|
1346
|
+
* Percentage encoded pathname section of the URL.
|
|
1347
|
+
*/
|
|
1348
|
+
path: string;
|
|
1349
|
+
/**
|
|
1350
|
+
* Object of decoded params extracted from the `path`.
|
|
1351
|
+
*/
|
|
1352
|
+
params: RouteParamsGeneric;
|
|
1353
|
+
/**
|
|
1354
|
+
* Merged `meta` properties from all the matched route records.
|
|
1355
|
+
*/
|
|
1356
|
+
meta: RouteMeta;
|
|
1357
|
+
/**
|
|
1358
|
+
* Array of {@link RouteRecord} containing components as they were
|
|
1359
|
+
* passed when adding records. It can also contain redirect records. This
|
|
1360
|
+
* can't be used directly
|
|
1361
|
+
*/
|
|
1362
|
+
matched: RouteRecord[];
|
|
1363
|
+
} //#endregion
|
|
1364
|
+
//#region src/errors.d.ts
|
|
1365
|
+
/**
|
|
1366
|
+
* Flags so we can combine them when checking for multiple errors. This is the internal version of
|
|
1367
|
+
* {@link NavigationFailureType}.
|
|
1368
|
+
*
|
|
1369
|
+
* @internal
|
|
1370
|
+
*/
|
|
1371
|
+
declare const enum ErrorTypes {
|
|
1372
|
+
MATCHER_NOT_FOUND = 1,
|
|
1373
|
+
NAVIGATION_GUARD_REDIRECT = 2,
|
|
1374
|
+
NAVIGATION_ABORTED = 4,
|
|
1375
|
+
NAVIGATION_CANCELLED = 8,
|
|
1376
|
+
NAVIGATION_DUPLICATED = 16
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Enumeration with all possible types for navigation failures. Can be passed to
|
|
1380
|
+
* {@link isNavigationFailure} to check for specific failures.
|
|
1381
|
+
*/
|
|
1382
|
+
/**
|
|
1383
|
+
* Extended Error that contains extra information regarding a failed navigation.
|
|
1384
|
+
*/
|
|
1385
|
+
interface NavigationFailure extends Error {
|
|
1386
|
+
/**
|
|
1387
|
+
* Type of the navigation. One of {@link NavigationFailureType}
|
|
1388
|
+
*/
|
|
1389
|
+
type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
|
|
1390
|
+
/**
|
|
1391
|
+
* Route location we were navigating from
|
|
1392
|
+
*/
|
|
1393
|
+
from: RouteLocationNormalized;
|
|
1394
|
+
/**
|
|
1395
|
+
* Route location we were navigating to
|
|
1396
|
+
*/
|
|
1397
|
+
to: RouteLocationNormalized;
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Internal error used to detect a redirection.
|
|
1401
|
+
*
|
|
1402
|
+
* @internal
|
|
1403
|
+
*/
|
|
1404
|
+
/**
|
|
1405
|
+
* Internal type to define an ErrorHandler
|
|
1406
|
+
*
|
|
1407
|
+
* @param error - error thrown
|
|
1408
|
+
* @param to - location we were navigating to when the error happened
|
|
1409
|
+
* @param from - location we were navigating from when the error happened
|
|
1410
|
+
* @internal
|
|
1411
|
+
*/
|
|
1412
|
+
interface _ErrorListener {
|
|
1413
|
+
(error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
|
|
1414
|
+
} //#endregion
|
|
1415
|
+
//#region src/scrollBehavior.d.ts
|
|
1416
|
+
/**
|
|
1417
|
+
* Scroll position similar to
|
|
1418
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
|
|
1419
|
+
* Note that not all browsers support `behavior`.
|
|
1420
|
+
*/
|
|
1421
|
+
type ScrollPositionCoordinates = {
|
|
1422
|
+
behavior?: ScrollOptions['behavior'];
|
|
1423
|
+
left?: number;
|
|
1424
|
+
top?: number;
|
|
1425
|
+
};
|
|
1426
|
+
/**
|
|
1427
|
+
* Internal normalized version of {@link ScrollPositionCoordinates} that always
|
|
1428
|
+
* has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
|
|
1429
|
+
*
|
|
1430
|
+
* @internal
|
|
1431
|
+
*/
|
|
1432
|
+
type _ScrollPositionNormalized = {
|
|
1433
|
+
behavior?: ScrollOptions['behavior'];
|
|
1434
|
+
left: number;
|
|
1435
|
+
top: number;
|
|
1436
|
+
};
|
|
1437
|
+
/**
|
|
1438
|
+
* Type of the `scrollBehavior` option that can be passed to `createRouter`.
|
|
1439
|
+
*/
|
|
1440
|
+
interface RouterScrollBehavior {
|
|
1441
|
+
/**
|
|
1442
|
+
* @param to - Route location where we are navigating to
|
|
1443
|
+
* @param from - Route location where we are navigating from
|
|
1444
|
+
* @param savedPosition - saved position if it exists, `null` otherwise
|
|
1445
|
+
*/
|
|
1446
|
+
(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
|
|
1447
|
+
}
|
|
1448
|
+
interface ScrollPositionElement extends ScrollToOptions {
|
|
1449
|
+
/**
|
|
1450
|
+
* A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
|
|
1451
|
+
* @example
|
|
1452
|
+
* Here are a few examples:
|
|
1453
|
+
*
|
|
1454
|
+
* - `.title`
|
|
1455
|
+
* - `.content:first-child`
|
|
1456
|
+
* - `#marker`
|
|
1457
|
+
* - `#marker\~with\~symbols`
|
|
1458
|
+
* - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
|
|
1459
|
+
*
|
|
1460
|
+
*/
|
|
1461
|
+
el: string | Element;
|
|
1462
|
+
}
|
|
1463
|
+
type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
|
|
1464
|
+
type Awaitable<T> = T | PromiseLike<T>; //#endregion
|
|
1465
|
+
//#region src/experimental/route-resolver/matchers/param-parsers/types.d.ts
|
|
1466
|
+
/**
|
|
1467
|
+
* Defines a parser that can read a param from the url (string-based) and
|
|
1468
|
+
* transform it into a more complex type, or vice versa.
|
|
1469
|
+
*
|
|
1470
|
+
* @see MatcherPattern
|
|
1471
|
+
*/
|
|
1472
|
+
//#endregion
|
|
1473
|
+
//#region src/experimental/router.d.ts
|
|
1474
|
+
/**
|
|
1475
|
+
* Options to initialize a {@link Router} instance.
|
|
1476
|
+
*/
|
|
1477
|
+
interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
|
|
1478
|
+
/**
|
|
1479
|
+
* History implementation used by the router. Most web applications should use
|
|
1480
|
+
* `createWebHistory` but it requires the server to be properly configured.
|
|
1481
|
+
* You can also use a _hash_ based history with `createWebHashHistory` that
|
|
1482
|
+
* does not require any configuration on the server but isn't handled at all
|
|
1483
|
+
* by search engines and does poorly on SEO.
|
|
1484
|
+
*
|
|
1485
|
+
* @example
|
|
1486
|
+
* ```js
|
|
1487
|
+
* createRouter({
|
|
1488
|
+
* history: createWebHistory(),
|
|
1489
|
+
* // other options...
|
|
1490
|
+
* })
|
|
1491
|
+
* ```
|
|
1492
|
+
*/
|
|
1493
|
+
history: RouterHistory;
|
|
1494
|
+
/**
|
|
1495
|
+
* Function to control scrolling when navigating between pages. Can return a
|
|
1496
|
+
* Promise to delay scrolling.
|
|
1497
|
+
*
|
|
1498
|
+
* @see {@link RouterScrollBehavior}.
|
|
1499
|
+
*
|
|
1500
|
+
* @example
|
|
1501
|
+
* ```js
|
|
1502
|
+
* function scrollBehavior(to, from, savedPosition) {
|
|
1503
|
+
* // `to` and `from` are both route locations
|
|
1504
|
+
* // `savedPosition` can be null if there isn't one
|
|
1505
|
+
* }
|
|
1506
|
+
* ```
|
|
1507
|
+
*/
|
|
1508
|
+
scrollBehavior?: RouterScrollBehavior;
|
|
1509
|
+
/**
|
|
1510
|
+
* Custom implementation to parse a query. See its counterpart,
|
|
1511
|
+
* {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
|
|
1512
|
+
*
|
|
1513
|
+
* @example
|
|
1514
|
+
* Let's say you want to use the [qs package](https://github.com/ljharb/qs)
|
|
1515
|
+
* to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
|
|
1516
|
+
* ```js
|
|
1517
|
+
* import qs from 'qs'
|
|
1518
|
+
*
|
|
1519
|
+
* createRouter({
|
|
1520
|
+
* // other options...
|
|
1521
|
+
* parseQuery: qs.parse,
|
|
1522
|
+
* stringifyQuery: qs.stringify,
|
|
1523
|
+
* })
|
|
1524
|
+
* ```
|
|
1525
|
+
*/
|
|
1526
|
+
parseQuery?: typeof parseQuery;
|
|
1527
|
+
/**
|
|
1528
|
+
* Custom implementation to stringify a query object. Should not prepend a leading `?`.
|
|
1529
|
+
* {@link parseQuery} counterpart to handle query parsing.
|
|
1530
|
+
*/
|
|
1531
|
+
stringifyQuery?: typeof stringifyQuery;
|
|
1532
|
+
/**
|
|
1533
|
+
* Default class applied to active {@link RouterLink}. If none is provided,
|
|
1534
|
+
* `router-link-active` will be applied.
|
|
1535
|
+
*/
|
|
1536
|
+
linkActiveClass?: string;
|
|
1537
|
+
/**
|
|
1538
|
+
* Default class applied to exact active {@link RouterLink}. If none is provided,
|
|
1539
|
+
* `router-link-exact-active` will be applied.
|
|
1540
|
+
*/
|
|
1541
|
+
linkExactActiveClass?: string;
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Internal type for common properties among all kind of {@link RouteRecordRaw}.
|
|
1545
|
+
*/
|
|
1546
|
+
/**
|
|
1547
|
+
* Router base instance.
|
|
1548
|
+
*
|
|
1549
|
+
* @experimental This version is not stable, it's meant to replace {@link Router} in the future.
|
|
1550
|
+
*/
|
|
1551
|
+
interface EXPERIMENTAL_Router_Base<TRecord> {
|
|
1552
|
+
/**
|
|
1553
|
+
* Current {@link RouteLocationNormalized}
|
|
1554
|
+
*/
|
|
1555
|
+
readonly currentRoute: ShallowRef<RouteLocationNormalizedLoaded>;
|
|
1556
|
+
/**
|
|
1557
|
+
* Allows turning off the listening of history events. This is a low level api for micro-frontend.
|
|
1558
|
+
*/
|
|
1559
|
+
listening: boolean;
|
|
1560
|
+
/**
|
|
1561
|
+
* Checks if a route with a given name exists
|
|
1562
|
+
*
|
|
1563
|
+
* @param name - Name of the route to check
|
|
1564
|
+
*/
|
|
1565
|
+
hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
|
|
1566
|
+
/**
|
|
1567
|
+
* Get a full list of all the {@link RouteRecord | route records}.
|
|
1568
|
+
*/
|
|
1569
|
+
getRoutes(): TRecord[];
|
|
1570
|
+
/**
|
|
1571
|
+
* Returns the {@link RouteLocation | normalized version} of a
|
|
1572
|
+
* {@link RouteLocationRaw | route location}. Also includes an `href` property
|
|
1573
|
+
* that includes any existing `base`. By default, the `currentLocation` used is
|
|
1574
|
+
* `router.currentRoute` and should only be overridden in advanced use cases.
|
|
1575
|
+
*
|
|
1576
|
+
* @param to - Raw route location to resolve
|
|
1577
|
+
* @param currentLocation - Optional current location to resolve against
|
|
1578
|
+
*/
|
|
1579
|
+
resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
|
|
1580
|
+
resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
|
|
1581
|
+
/**
|
|
1582
|
+
* Programmatically navigate to a new URL by pushing an entry in the history
|
|
1583
|
+
* stack.
|
|
1584
|
+
*
|
|
1585
|
+
* @param to - Route location to navigate to
|
|
1586
|
+
*/
|
|
1587
|
+
push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
1588
|
+
/**
|
|
1589
|
+
* Programmatically navigate to a new URL by replacing the current entry in
|
|
1590
|
+
* the history stack.
|
|
1591
|
+
*
|
|
1592
|
+
* @param to - Route location to navigate to
|
|
1593
|
+
*/
|
|
1594
|
+
replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
1595
|
+
/**
|
|
1596
|
+
* Go back in history if possible by calling `history.back()`. Equivalent to
|
|
1597
|
+
* `router.go(-1)`.
|
|
1598
|
+
*/
|
|
1599
|
+
back(): void;
|
|
1600
|
+
/**
|
|
1601
|
+
* Go forward in history if possible by calling `history.forward()`.
|
|
1602
|
+
* Equivalent to `router.go(1)`.
|
|
1603
|
+
*/
|
|
1604
|
+
forward(): void;
|
|
1605
|
+
/**
|
|
1606
|
+
* Allows you to move forward or backward through the history. Calls
|
|
1607
|
+
* `history.go()`.
|
|
1608
|
+
*
|
|
1609
|
+
* @param delta - The position in the history to which you want to move,
|
|
1610
|
+
* relative to the current page
|
|
1611
|
+
*/
|
|
1612
|
+
go(delta: number): void;
|
|
1613
|
+
/**
|
|
1614
|
+
* Add a navigation guard that executes before any navigation. Returns a
|
|
1615
|
+
* function that removes the registered guard.
|
|
1616
|
+
*
|
|
1617
|
+
* @param guard - navigation guard to add
|
|
1618
|
+
*/
|
|
1619
|
+
beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
1620
|
+
/**
|
|
1621
|
+
* Add a navigation guard that executes before navigation is about to be
|
|
1622
|
+
* resolved. At this state all component have been fetched and other
|
|
1623
|
+
* navigation guards have been successful. Returns a function that removes the
|
|
1624
|
+
* registered guard.
|
|
1625
|
+
*
|
|
1626
|
+
* @param guard - navigation guard to add
|
|
1627
|
+
* @returns a function that removes the registered guard
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```js
|
|
1631
|
+
* router.beforeResolve(to => {
|
|
1632
|
+
* if (to.meta.requiresAuth && !isAuthenticated) return false
|
|
1633
|
+
* })
|
|
1634
|
+
* ```
|
|
1635
|
+
*
|
|
1636
|
+
*/
|
|
1637
|
+
beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
|
|
1638
|
+
/**
|
|
1639
|
+
* Add a navigation hook that is executed after every navigation. Returns a
|
|
1640
|
+
* function that removes the registered hook.
|
|
1641
|
+
*
|
|
1642
|
+
* @param guard - navigation hook to add
|
|
1643
|
+
* @returns a function that removes the registered hook
|
|
1644
|
+
*
|
|
1645
|
+
* @example
|
|
1646
|
+
* ```js
|
|
1647
|
+
* router.afterEach((to, from, failure) => {
|
|
1648
|
+
* if (isNavigationFailure(failure)) {
|
|
1649
|
+
* console.log('failed navigation', failure)
|
|
1650
|
+
* }
|
|
1651
|
+
* })
|
|
1652
|
+
* ```
|
|
1653
|
+
*/
|
|
1654
|
+
afterEach(guard: NavigationHookAfter): () => void;
|
|
1655
|
+
/**
|
|
1656
|
+
* Adds an error handler that is called every time a non caught error happens
|
|
1657
|
+
* during navigation. This includes errors thrown synchronously and
|
|
1658
|
+
* asynchronously, errors returned or passed to `next` in any navigation
|
|
1659
|
+
* guard, and errors occurred when trying to resolve an async component that
|
|
1660
|
+
* is required to render a route.
|
|
1661
|
+
*
|
|
1662
|
+
* @param handler - error handler to register
|
|
1663
|
+
*/
|
|
1664
|
+
onError(handler: _ErrorListener): () => void;
|
|
1665
|
+
/**
|
|
1666
|
+
* Returns a Promise that resolves when the router has completed the initial
|
|
1667
|
+
* navigation, which means it has resolved all async enter hooks and async
|
|
1668
|
+
* components that are associated with the initial route. If the initial
|
|
1669
|
+
* navigation already happened, the promise resolves immediately.
|
|
1670
|
+
*
|
|
1671
|
+
* This is useful in server-side rendering to ensure consistent output on both
|
|
1672
|
+
* the server and the client. Note that on server side, you need to manually
|
|
1673
|
+
* push the initial location while on client side, the router automatically
|
|
1674
|
+
* picks it up from the URL.
|
|
1675
|
+
*/
|
|
1676
|
+
isReady(): Promise<void>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Called automatically by `app.use(router)`. Should not be called manually by
|
|
1679
|
+
* the user. This will trigger the initial navigation when on client side.
|
|
1680
|
+
*
|
|
1681
|
+
* @internal
|
|
1682
|
+
* @param app - Application that uses the router
|
|
1683
|
+
*/
|
|
1684
|
+
install(app: App): void;
|
|
1685
|
+
}
|
|
1686
|
+
//#endregion
|
|
1687
|
+
//#region ../../node_modules/.pnpm/vue-router@4.6.4_vue@3.5.30_typescript@5.9.3_/node_modules/vue-router/dist/vue-router.d.mts
|
|
1688
|
+
//#endregion
|
|
1689
|
+
//#region src/router.d.ts
|
|
1690
|
+
/**
|
|
1691
|
+
* Options to initialize a {@link Router} instance.
|
|
1692
|
+
*/
|
|
1693
|
+
interface RouterOptions extends EXPERIMENTAL_RouterOptions_Base {
|
|
1694
|
+
/**
|
|
1695
|
+
* Initial list of routes that should be added to the router.
|
|
1696
|
+
*/
|
|
1697
|
+
routes: Readonly<RouteRecordRaw[]>;
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* Router instance.
|
|
1701
|
+
*/
|
|
1702
|
+
interface Router extends EXPERIMENTAL_Router_Base<RouteRecordNormalized> {
|
|
1703
|
+
/**
|
|
1704
|
+
* Original options object passed to create the Router
|
|
1705
|
+
*/
|
|
1706
|
+
readonly options: RouterOptions;
|
|
1707
|
+
/**
|
|
1708
|
+
* Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
|
|
1709
|
+
*
|
|
1710
|
+
* @param parentName - Parent Route Record where `route` should be appended at
|
|
1711
|
+
* @param route - Route Record to add
|
|
1712
|
+
*/
|
|
1713
|
+
addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
|
|
1714
|
+
/**
|
|
1715
|
+
* Add a new {@link RouteRecordRaw | route record} to the router.
|
|
1716
|
+
*
|
|
1717
|
+
* @param route - Route Record to add
|
|
1718
|
+
*/
|
|
1719
|
+
addRoute(route: RouteRecordRaw): () => void;
|
|
1720
|
+
/**
|
|
1721
|
+
* Remove an existing route by its name.
|
|
1722
|
+
*
|
|
1723
|
+
* @param name - Name of the route to remove
|
|
1724
|
+
*/
|
|
1725
|
+
removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
|
|
1726
|
+
/**
|
|
1727
|
+
* Delete all routes from the router.
|
|
1728
|
+
*/
|
|
1729
|
+
clearRoutes(): void;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Creates a Router instance that can be used by a Vue app.
|
|
1733
|
+
*
|
|
1734
|
+
* @param options - {@link RouterOptions}
|
|
1735
|
+
*/
|
|
1736
|
+
//#endregion
|
|
1737
|
+
//#region src/RouterLink.d.ts
|
|
1738
|
+
interface RouterLinkOptions {
|
|
1739
|
+
/**
|
|
1740
|
+
* Route Location the link should navigate to when clicked on.
|
|
1741
|
+
*/
|
|
1742
|
+
to: RouteLocationRaw;
|
|
1743
|
+
/**
|
|
1744
|
+
* Calls `router.replace` instead of `router.push`.
|
|
1745
|
+
*/
|
|
1746
|
+
replace?: boolean;
|
|
1747
|
+
}
|
|
1748
|
+
interface RouterLinkProps extends RouterLinkOptions {
|
|
1749
|
+
/**
|
|
1750
|
+
* Whether RouterLink should not wrap its content in an `a` tag. Useful when
|
|
1751
|
+
* using `v-slot` to create a custom RouterLink
|
|
1752
|
+
*/
|
|
1753
|
+
custom?: boolean;
|
|
1754
|
+
/**
|
|
1755
|
+
* Class to apply when the link is active
|
|
1756
|
+
*/
|
|
1757
|
+
activeClass?: string;
|
|
1758
|
+
/**
|
|
1759
|
+
* Class to apply when the link is exact active
|
|
1760
|
+
*/
|
|
1761
|
+
exactActiveClass?: string;
|
|
1762
|
+
/**
|
|
1763
|
+
* Value passed to the attribute `aria-current` when the link is exact active.
|
|
1764
|
+
*
|
|
1765
|
+
* @defaultValue `'page'`
|
|
1766
|
+
*/
|
|
1767
|
+
ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
1768
|
+
/**
|
|
1769
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
1770
|
+
*/
|
|
1771
|
+
viewTransition?: boolean;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Options passed to {@link useLink}.
|
|
1775
|
+
*/
|
|
1776
|
+
interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
|
|
1777
|
+
to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
|
|
1778
|
+
replace?: MaybeRef<boolean | undefined>;
|
|
1779
|
+
/**
|
|
1780
|
+
* Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
|
|
1781
|
+
*/
|
|
1782
|
+
viewTransition?: boolean;
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Return type of {@link useLink}.
|
|
1786
|
+
* @internal
|
|
1787
|
+
*/
|
|
1788
|
+
interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
|
|
1789
|
+
route: ComputedRef<RouteLocationResolved<Name>>;
|
|
1790
|
+
href: ComputedRef<string>;
|
|
1791
|
+
isActive: ComputedRef<boolean>;
|
|
1792
|
+
isExactActive: ComputedRef<boolean>;
|
|
1793
|
+
navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Returns the internal behavior of a {@link RouterLink} without the rendering part.
|
|
1797
|
+
*
|
|
1798
|
+
* @param props - a `to` location and an optional `replace` flag
|
|
1799
|
+
*/
|
|
1800
|
+
declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
|
|
1801
|
+
/**
|
|
1802
|
+
* Component to render a link that triggers a navigation on click.
|
|
1803
|
+
*/
|
|
1804
|
+
declare const RouterLink: _RouterLinkI;
|
|
1805
|
+
/**
|
|
1806
|
+
* @internal
|
|
1807
|
+
*/
|
|
1808
|
+
type _RouterLinkPropsTypedBase = AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
|
|
1809
|
+
/**
|
|
1810
|
+
* @internal
|
|
1811
|
+
*/
|
|
1812
|
+
type RouterLinkPropsTyped<Custom extends boolean | undefined> = Custom extends true ? _RouterLinkPropsTypedBase & {
|
|
1813
|
+
custom: true;
|
|
1814
|
+
} : _RouterLinkPropsTypedBase & {
|
|
1815
|
+
custom?: false | undefined;
|
|
1816
|
+
} & Omit<AnchorHTMLAttributes, 'href'>;
|
|
1817
|
+
/**
|
|
1818
|
+
* Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
|
|
1819
|
+
* automatically for JSX.
|
|
1820
|
+
*
|
|
1821
|
+
* @internal
|
|
1822
|
+
*/
|
|
1823
|
+
interface _RouterLinkI {
|
|
1824
|
+
new <Custom extends boolean | undefined = boolean | undefined>(): {
|
|
1825
|
+
$props: RouterLinkPropsTyped<Custom>;
|
|
1826
|
+
$slots: {
|
|
1827
|
+
default?: ({
|
|
1828
|
+
route,
|
|
1829
|
+
href,
|
|
1830
|
+
isActive,
|
|
1831
|
+
isExactActive,
|
|
1832
|
+
navigate
|
|
1833
|
+
}: UnwrapRef<UseLinkReturn>) => VNode[];
|
|
1834
|
+
};
|
|
1835
|
+
};
|
|
1836
|
+
/**
|
|
1837
|
+
* Access to `useLink()` without depending on using vue-router
|
|
1838
|
+
*
|
|
1839
|
+
* @internal
|
|
1840
|
+
*/
|
|
1841
|
+
useLink: typeof useLink;
|
|
1842
|
+
} //#endregion
|
|
1843
|
+
//#region src/RouterView.d.ts
|
|
1844
|
+
interface RouterViewProps {
|
|
1845
|
+
name?: string;
|
|
1846
|
+
route?: RouteLocationNormalized;
|
|
1847
|
+
}
|
|
1848
|
+
/**
|
|
1849
|
+
* Component to display the current route the user is at.
|
|
1850
|
+
*/
|
|
1851
|
+
declare const RouterView: {
|
|
1852
|
+
new (): {
|
|
1853
|
+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
|
|
1854
|
+
$slots: {
|
|
1855
|
+
default?: ({
|
|
1856
|
+
Component,
|
|
1857
|
+
route
|
|
1858
|
+
}: {
|
|
1859
|
+
Component: VNode;
|
|
1860
|
+
route: RouteLocationNormalizedLoaded;
|
|
1861
|
+
}) => VNode[];
|
|
1862
|
+
};
|
|
1863
|
+
};
|
|
1864
|
+
}; //#endregion
|
|
1865
|
+
//#region src/useApi.d.ts
|
|
1866
|
+
/**
|
|
1867
|
+
* Returns the router instance. Equivalent to using `$router` inside
|
|
1868
|
+
* templates.
|
|
1869
|
+
*/
|
|
1870
|
+
//#endregion
|
|
1871
|
+
//#region src/index.d.ts
|
|
1872
|
+
declare module 'vue' {
|
|
1873
|
+
interface ComponentCustomOptions {
|
|
1874
|
+
/**
|
|
1875
|
+
* Guard called when the router is navigating to the route that is rendering
|
|
1876
|
+
* this component from a different route. Differently from `beforeRouteUpdate`
|
|
1877
|
+
* and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
|
|
1878
|
+
* component instance through `this` because it triggers before the component
|
|
1879
|
+
* is even mounted.
|
|
1880
|
+
*
|
|
1881
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
1882
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
1883
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
1884
|
+
* navigation
|
|
1885
|
+
*/
|
|
1886
|
+
beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
|
|
1887
|
+
/**
|
|
1888
|
+
* Guard called whenever the route that renders this component has changed, but
|
|
1889
|
+
* it is reused for the new route. This allows you to guard for changes in
|
|
1890
|
+
* params, the query or the hash.
|
|
1891
|
+
*
|
|
1892
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
1893
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
1894
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
1895
|
+
* navigation
|
|
1896
|
+
*/
|
|
1897
|
+
beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
|
|
1898
|
+
/**
|
|
1899
|
+
* Guard called when the router is navigating away from the current route that
|
|
1900
|
+
* is rendering this component.
|
|
1901
|
+
*
|
|
1902
|
+
* @param to - RouteLocationRaw we are navigating to
|
|
1903
|
+
* @param from - RouteLocationRaw we are navigating from
|
|
1904
|
+
* @param next - function to validate, cancel or modify (by redirecting) the
|
|
1905
|
+
* navigation
|
|
1906
|
+
*/
|
|
1907
|
+
beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
|
|
1908
|
+
}
|
|
1909
|
+
interface ComponentCustomProperties {
|
|
1910
|
+
/**
|
|
1911
|
+
* Normalized current location. See {@link RouteLocationNormalizedLoaded}.
|
|
1912
|
+
*/
|
|
1913
|
+
$route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
|
|
1914
|
+
/**
|
|
1915
|
+
* {@link Router} instance used by the application.
|
|
1916
|
+
*/
|
|
1917
|
+
$router: TypesConfig extends Record<'$router', infer T> ? T : Router;
|
|
1918
|
+
}
|
|
1919
|
+
interface GlobalComponents {
|
|
1920
|
+
RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
|
|
1921
|
+
RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
|
|
1922
|
+
}
|
|
1923
|
+
} //#endregion
|
|
1924
|
+
//#endregion
|
|
1925
|
+
//#region src/composables/use-table-url-query.d.ts
|
|
1926
|
+
/** Options for {@link useTableUrlQuery}. */
|
|
1927
|
+
interface UseTableUrlQueryOptions {
|
|
1928
|
+
/**
|
|
1929
|
+
* Navigation mode for outbound writes.
|
|
1930
|
+
* - `"replace"` (default) — `router.replace`, no new history entry. Right
|
|
1931
|
+
* for tables that emit on every keystroke (search box) so back-button
|
|
1932
|
+
* doesn't step through 30 typing-induced URLs.
|
|
1933
|
+
* - `"push"` — `router.push`, every state change becomes a discrete
|
|
1934
|
+
* history entry. Choose when each filter/sort change should be
|
|
1935
|
+
* navigation-recoverable.
|
|
1936
|
+
*/
|
|
1937
|
+
mode?: "replace" | "push";
|
|
1938
|
+
}
|
|
1939
|
+
/**
|
|
1940
|
+
* Bridge `<AsTableRoot v-model:url-query>` to vue-router. Uses **type-only**
|
|
1941
|
+
* imports of `Router` and `RouteLocationNormalizedLoaded` — no runtime
|
|
1942
|
+
* dependency on `vue-router` is added to `@atscript/vue-table`. Consumers
|
|
1943
|
+
* pass in their already-resolved `useRoute()` and `useRouter()` instances.
|
|
1944
|
+
*
|
|
1945
|
+
* Scope: **owns the whole query string**. The getter returns the entire
|
|
1946
|
+
* `route.query` serialized; the setter replaces `route.query` wholesale.
|
|
1947
|
+
* Apps that need the table to coexist with non-table query params should
|
|
1948
|
+
* write their own `computed` instead — that pattern is small and keeps the
|
|
1949
|
+
* library's contract crisp.
|
|
1950
|
+
*
|
|
1951
|
+
* @example
|
|
1952
|
+
* ```vue
|
|
1953
|
+
* <script setup>
|
|
1954
|
+
* import { useRoute, useRouter } from 'vue-router';
|
|
1955
|
+
* import { useTableUrlQuery } from '@atscript/vue-table';
|
|
1956
|
+
* const urlQuery = useTableUrlQuery(useRoute(), useRouter());
|
|
1957
|
+
* </script>
|
|
1958
|
+
* <template>
|
|
1959
|
+
* <AsTableRoot v-model:url-query="urlQuery" url="/db/products" .../>
|
|
1960
|
+
* </template>
|
|
1961
|
+
* ```
|
|
1962
|
+
*/
|
|
1963
|
+
declare function useTableUrlQuery(route: RouteLocationNormalizedLoaded, router: Router, opts?: UseTableUrlQueryOptions): WritableComputedRef<string>;
|
|
1964
|
+
//#endregion
|
|
1965
|
+
//#region src/composables/as-presets-app.d.ts
|
|
1966
|
+
/**
|
|
1967
|
+
* App-wide injection key for the presets system. The host app calls
|
|
1968
|
+
* `app.provide(AS_PRESETS_APP, '<your-app>')` once at boot; every
|
|
1969
|
+
* `<AsTableRoot>`, `usePresets`, and `useAppPrefs` call below it pulls the
|
|
1970
|
+
* value via `inject(AS_PRESETS_APP)` unless an explicit `app` option
|
|
1971
|
+
* overrides it.
|
|
1972
|
+
*
|
|
1973
|
+
* The string identifies the application namespace on the server side —
|
|
1974
|
+
* one Moost backend can serve many apps; rows are scoped by `(app,
|
|
1975
|
+
* tableKey)`.
|
|
1976
|
+
*/
|
|
1977
|
+
declare const AS_PRESETS_APP: InjectionKey<string>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Resolve the app name with these precedence rules:
|
|
1980
|
+
*
|
|
1981
|
+
* 1. `explicit` argument (composable option) — wins.
|
|
1982
|
+
* 2. `inject(AS_PRESETS_APP)` from the Vue tree.
|
|
1983
|
+
* 3. Throws — composable can't run without an app namespace.
|
|
1984
|
+
*
|
|
1985
|
+
* Throws a clear error when neither is available so misconfiguration
|
|
1986
|
+
* surfaces at setup time, not when the first network round-trip fails.
|
|
1987
|
+
*/
|
|
1988
|
+
declare function injectPresetsApp(explicit?: string): string;
|
|
1989
|
+
//#endregion
|
|
1990
|
+
//#region src/composables/use-app-prefs.d.ts
|
|
1991
|
+
interface UseAppPrefsOptions {
|
|
1992
|
+
/** App namespace; defaults to `inject(AS_PRESETS_APP)`. */
|
|
1993
|
+
app?: string;
|
|
1994
|
+
/** Presets controller URL, e.g. `"/db/_presets"`. */
|
|
1995
|
+
url: string;
|
|
1996
|
+
/** Custom client factory (auth-configured). Defaults to `getDefaultClientFactory()`. */
|
|
1997
|
+
clientFactory?: ClientFactory;
|
|
1998
|
+
/** Auto-load on setup. Default `true`. */
|
|
1999
|
+
autoLoad?: boolean;
|
|
2000
|
+
/**
|
|
2001
|
+
* Cache the most recent prefs in `localStorage` keyed by app, so the
|
|
2002
|
+
* next mount paints from cache (no flash of defaults while the network
|
|
2003
|
+
* settles) and a failed/denied load still surfaces a usable theme.
|
|
2004
|
+
* Server responses always overwrite the cache, so when a different
|
|
2005
|
+
* user signs in, their state replaces the previous user's after one
|
|
2006
|
+
* round-trip. Default `true` — pass `false` to opt out (e.g. tests,
|
|
2007
|
+
* sensitive environments).
|
|
2008
|
+
*/
|
|
2009
|
+
cache?: boolean;
|
|
2010
|
+
}
|
|
2011
|
+
interface UseAppPrefsReturn {
|
|
2012
|
+
/**
|
|
2013
|
+
* Reactive prefs object. Always non-null — defaults to `{}` until the
|
|
2014
|
+
* first load resolves. Read-only at the surface; mutate via `save()`.
|
|
2015
|
+
*/
|
|
2016
|
+
prefs: WritableComputedRef<AppConfData>;
|
|
2017
|
+
loading: Ref<boolean>;
|
|
2018
|
+
/** Last non-auth error, or `null`. Auth errors flip `available` instead. */
|
|
2019
|
+
error: Ref<unknown>;
|
|
2020
|
+
/** False on 401/403 from initial load; UI should hide pref-bound controls. */
|
|
2021
|
+
available: ComputedRef<boolean>;
|
|
2022
|
+
reload(): Promise<void>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Optimistic shallow-merge save. The local `prefs` is updated immediately
|
|
2025
|
+
* for snappy UI; on server error the optimistic write is rolled back and
|
|
2026
|
+
* the error is re-thrown for the caller to surface.
|
|
2027
|
+
*/
|
|
2028
|
+
save(patch: Partial<AppConfData>): Promise<void>;
|
|
2029
|
+
/** Drop in-memory state. Useful from sign-out flows. */
|
|
2030
|
+
reset(): void;
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* Public dev-facing composable for app-wide user preferences. Independent
|
|
2034
|
+
* of presets / tables — devs can use it on any settings surface to read
|
|
2035
|
+
* and write `appearance`, `language`, `density`, `customJson` etc. for
|
|
2036
|
+
* `(currentUser, app)`.
|
|
2037
|
+
*
|
|
2038
|
+
* Multiple calls with the same `(app, url)` share one underlying instance,
|
|
2039
|
+
* so duplicate widgets (sidebar + page header + /preferences) make a single
|
|
2040
|
+
* `/query?type=appConf` request total.
|
|
2041
|
+
*
|
|
2042
|
+
* @example
|
|
2043
|
+
* ```ts
|
|
2044
|
+
* const { prefs, save } = useAppPrefs({ url: "/db/_presets" })
|
|
2045
|
+
* // prefs.value.appearance is reactive in templates
|
|
2046
|
+
* await save({ appearance: "dark" })
|
|
2047
|
+
* ```
|
|
2048
|
+
*/
|
|
2049
|
+
declare function useAppPrefs(opts: UseAppPrefsOptions): UseAppPrefsReturn;
|
|
2050
|
+
//#endregion
|
|
2051
|
+
//#region src/composables/use-table-component.d.ts
|
|
2052
|
+
/** Resolve a single skin-slot component from the injected `controls` map, falling back to the default. */
|
|
2053
|
+
declare function useTableComponent<K extends keyof TAsTableControls>(key: K, fallback: Component$1): Component$1;
|
|
2054
|
+
//#endregion
|
|
2055
|
+
//#region src/composables/create-default-controls.d.ts
|
|
2056
|
+
/**
|
|
2057
|
+
* Returns a fresh skin-slot map pre-filled with all built-in defaults.
|
|
2058
|
+
*
|
|
2059
|
+
* Spread or assign additional entries to override specific pieces:
|
|
2060
|
+
* ```ts
|
|
2061
|
+
* const controls = { ...createDefaultControls(), filterDialog: MyFilterDialog }
|
|
2062
|
+
* ```
|
|
2063
|
+
*
|
|
2064
|
+
* `actionFormDialog` is intentionally not seeded — the table root
|
|
2065
|
+
* lazy-mounts it only when an `@InputForm` action is detected. To override
|
|
2066
|
+
* or eager-load, import from `@atscript/vue-table/as-action-form-dialog`
|
|
2067
|
+
* and assign it as the `actionFormDialog` entry on this map.
|
|
2068
|
+
*/
|
|
2069
|
+
declare function createDefaultControls(): TAsTableControls;
|
|
2070
|
+
//#endregion
|
|
2071
|
+
//#region src/composables/create-default-cell-types.d.ts
|
|
2072
|
+
/**
|
|
2073
|
+
* Returns a fresh cell-type-to-component map pre-filled with the built-in
|
|
2074
|
+
* defaults. Spread to extend or override:
|
|
2075
|
+
* ```ts
|
|
2076
|
+
* const types = { ...createDefaultCellTypes(), status: StatusBadgeCell }
|
|
2077
|
+
* ```
|
|
2078
|
+
*/
|
|
2079
|
+
declare function createDefaultCellTypes(): TAsCellTypeComponents;
|
|
2080
|
+
//#endregion
|
|
2081
|
+
//#region src/composables/use-cell-locale.d.ts
|
|
2082
|
+
interface CellLocale {
|
|
2083
|
+
language?: string;
|
|
2084
|
+
timezone?: string;
|
|
2085
|
+
}
|
|
2086
|
+
declare function provideCellLocale(source: MaybeRefOrGetter<CellLocale | undefined>): void;
|
|
2087
|
+
declare function useCellLocale(): {
|
|
2088
|
+
locale: ComputedRef<string>;
|
|
2089
|
+
timezone: ComputedRef<string | undefined>;
|
|
2090
|
+
};
|
|
2091
|
+
//#endregion
|
|
2092
|
+
//#region src/utils/column-width.d.ts
|
|
2093
|
+
/** Returns column width from annotation or type-based default. */
|
|
2094
|
+
declare function getColumnWidth(column: ColumnDef): string;
|
|
2095
|
+
//#endregion
|
|
2096
|
+
//#region src/utils/get-cell-value.d.ts
|
|
2097
|
+
/** Gets a nested value from a row by dot-separated path. */
|
|
2098
|
+
declare function getCellValue(row: Record<string, unknown>, path: string): unknown;
|
|
2099
|
+
//#endregion
|
|
2100
|
+
//#region src/utils/format-cell.d.ts
|
|
2101
|
+
/** Format a cell value based on column type. */
|
|
2102
|
+
declare function formatCellValue(value: unknown, type: string): string;
|
|
2103
|
+
//#endregion
|
|
2104
|
+
//#region src/composables/state/intent-scope.d.ts
|
|
2105
|
+
/**
|
|
2106
|
+
* Build the identifier object to forward to `client.action` / `client.remove`.
|
|
2107
|
+
*
|
|
2108
|
+
* Per `@atscript/db-client` invariant #11, identifier bodies are object-only
|
|
2109
|
+
* — never bare scalars, even for single-field PK tables. This helper accepts:
|
|
2110
|
+
* - a row-shaped object (default `rowValueFn`) → picks `preferredId` fields;
|
|
2111
|
+
* - a scalar value when `preferredId` has exactly one field (consumers that
|
|
2112
|
+
* override `rowValueFn` to return the PK scalar) → wraps it.
|
|
2113
|
+
*
|
|
2114
|
+
* Returns `undefined` when no `preferredId` is declared, the source is
|
|
2115
|
+
* `null`/`undefined`, or a scalar can't be paired with a single-field
|
|
2116
|
+
* identifier.
|
|
2117
|
+
*/
|
|
2118
|
+
declare function extractIdentifier(source: unknown, preferredId: readonly string[]): Record<string, unknown> | undefined;
|
|
2119
|
+
//#endregion
|
|
2120
|
+
//#region src/components/as-table-root.vue.d.ts
|
|
2121
|
+
type __VLS_Props = {
|
|
2122
|
+
/** Table endpoint URL (e.g. "/db/tables/products"). */url: string; /** Factory to create a client from a URL. Falls back to the app-wide default set via `setDefaultClientFactory` (or the built-in `new Client(url)` factory if unset). */
|
|
2123
|
+
clientFactory?: ClientFactory; /** Skin-slot overrides for table chrome — header cells, filter dialog, column menu, etc. Use {@link createDefaultControls} to seed defaults. */
|
|
2124
|
+
controls?: TAsTableControls; /** Cell-type → component dispatch map. Use {@link createDefaultCellTypes} to seed defaults. */
|
|
2125
|
+
types?: TAsCellTypeComponents; /** Named cell-component overrides — looked up by `@ui.table.component "name"`. */
|
|
2126
|
+
components?: Record<string, Component$1>;
|
|
2127
|
+
/**
|
|
2128
|
+
* Form-type → component dispatch map for the built-in action-form dialog.
|
|
2129
|
+
* Defaults to `createDefaultTypes()` from `@atscript/vue-form`.
|
|
2130
|
+
*/
|
|
2131
|
+
formTypes?: TAsTypeComponents; /** Named form-component overrides for the action-form dialog. */
|
|
2132
|
+
formComponents?: Record<string, Component$1>;
|
|
2133
|
+
limit?: number;
|
|
2134
|
+
forceFilters?: FilterExpr;
|
|
2135
|
+
forceSorters?: SortControl[];
|
|
2136
|
+
queryOnMount?: boolean;
|
|
2137
|
+
queryFn?: (query: Uniquery, page: number, size: number) => Promise<PageResult<Record<string, unknown>>>;
|
|
2138
|
+
blockQuery?: boolean;
|
|
2139
|
+
rowValueFn?: (row: Record<string, unknown>) => unknown;
|
|
2140
|
+
/**
|
|
2141
|
+
* Selection write policy applied on every results-replacement.
|
|
2142
|
+
* - `"clear"` — drop everything.
|
|
2143
|
+
* - `"trim"` (default) — keep PKs that survive the new result set.
|
|
2144
|
+
* - `"persist"` — never write to `selectedRows`; full consumer ownership.
|
|
2145
|
+
*/
|
|
2146
|
+
selectionPersistence?: SelectionPersistence; /** Page-alignment unit for `loadRange` and `queryNext` extension. */
|
|
2147
|
+
blockSize?: number; /** Debounce window for the topIndex/viewportRowCount watcher. */
|
|
2148
|
+
dragReleaseDebounceMs?: number;
|
|
2149
|
+
/**
|
|
2150
|
+
* Refetch policy: when `true` (default), successful `'backend'` /
|
|
2151
|
+
* `'__remove'` invocations call `state.query()` after settling. Per-call
|
|
2152
|
+
* `state.actions.invoke(action, pk, { suppressRefresh: true })` overrides.
|
|
2153
|
+
*/
|
|
2154
|
+
refreshOnAction?: boolean;
|
|
2155
|
+
/**
|
|
2156
|
+
* Per-aspect opt-in/out for `v-model:url-query`. Default (omitted): full
|
|
2157
|
+
* sync — filters, sorters, `searchTerm`, and pagination all round-trip.
|
|
2158
|
+
* Set fields to `false`/`true`/`string[]` to gate. Has no effect unless
|
|
2159
|
+
* `v-model:url-query` is bound.
|
|
2160
|
+
*
|
|
2161
|
+
* @example
|
|
2162
|
+
* `:url-query-sync="{ pagination: false }"` — shareable filtered view,
|
|
2163
|
+
* recipients aren't pinned to your current page.
|
|
2164
|
+
* `:url-query-sync="{ filters: ['status'], sorters: false }"` — only
|
|
2165
|
+
* `status` filter participates; sorters stay private.
|
|
2166
|
+
*/
|
|
2167
|
+
urlQuerySync?: UrlQuerySync; /** See {@link PresetConfig}. Omit to disable presets. */
|
|
2168
|
+
preset?: PresetConfig;
|
|
2169
|
+
};
|
|
2170
|
+
type __VLS_ModelProps = {
|
|
2171
|
+
"filterFields"?: string[];
|
|
2172
|
+
"columnNames"?: string[];
|
|
2173
|
+
"columnWidths"?: ColumnWidthsMap;
|
|
2174
|
+
"sorters"?: SortControl[];
|
|
2175
|
+
"selectedRows"?: unknown[];
|
|
2176
|
+
/**
|
|
2177
|
+
* Bidirectional URL bridge bound via `v-model:url-query`. When unbound the
|
|
2178
|
+
* feature is off (zero overhead); when bound the first query is gated on
|
|
2179
|
+
* tableDef settle + URL hydration so the table fetches once.
|
|
2180
|
+
*/
|
|
2181
|
+
"urlQuery"?: string | undefined;
|
|
2182
|
+
};
|
|
2183
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
2184
|
+
declare var __VLS_1: {
|
|
2185
|
+
tableDef: _atscript_ui0.TableDef | null;
|
|
2186
|
+
loadingMetadata: boolean;
|
|
2187
|
+
allColumns: _atscript_ui0.ColumnDef[];
|
|
2188
|
+
columnNames: string[];
|
|
2189
|
+
columnWidths: ColumnWidthsMap;
|
|
2190
|
+
columns: _atscript_ui0.ColumnDef[];
|
|
2191
|
+
filterFields: string[];
|
|
2192
|
+
filters: _atscript_ui_table0.FieldFilters;
|
|
2193
|
+
sorters: SortControl[];
|
|
2194
|
+
results: Record<string, unknown>[];
|
|
2195
|
+
querying: boolean;
|
|
2196
|
+
queryingNext: boolean;
|
|
2197
|
+
totalCount: number;
|
|
2198
|
+
loadedCount: number;
|
|
2199
|
+
pagination: _atscript_ui0.PaginationControl;
|
|
2200
|
+
queryError: Error | null;
|
|
2201
|
+
metadataError: Error | null;
|
|
2202
|
+
mustRefresh: boolean;
|
|
2203
|
+
searchTerm: string;
|
|
2204
|
+
selectedRows: unknown[];
|
|
2205
|
+
selectedCount: number;
|
|
2206
|
+
navBridge: TableNavBridge;
|
|
2207
|
+
query: () => void;
|
|
2208
|
+
queryNext: () => void;
|
|
2209
|
+
resetFilters: () => void;
|
|
2210
|
+
showConfigDialog: (tab?: _atscript_ui_table0.ConfigTab) => void;
|
|
2211
|
+
openFilterDialog: (column: _atscript_ui0.ColumnDef) => void;
|
|
2212
|
+
closeFilterDialog: () => void;
|
|
2213
|
+
setFieldFilter: (path: string, conditions: _atscript_ui_table0.FilterCondition[]) => void;
|
|
2214
|
+
removeFieldFilter: (path: string) => void;
|
|
2215
|
+
addFilterField: (path: string) => void;
|
|
2216
|
+
removeFilterField: (path: string) => void;
|
|
2217
|
+
actions: TableActionsState;
|
|
2218
|
+
prompt: (message: string, opts?: ConfirmOptions) => Promise<boolean>;
|
|
2219
|
+
};
|
|
2220
|
+
type __VLS_Slots = {} & {
|
|
2221
|
+
default?: (props: typeof __VLS_1) => any;
|
|
2222
|
+
};
|
|
2223
|
+
declare const __VLS_base: vue.DefineComponent<__VLS_PublicProps, {
|
|
2224
|
+
state: ReactiveTableState;
|
|
2225
|
+
navBridge: TableNavBridge;
|
|
2226
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
2227
|
+
"update:filterFields": (value: string[]) => any;
|
|
2228
|
+
"update:columnNames": (value: string[]) => any;
|
|
2229
|
+
"update:columnWidths": (value: ColumnWidthsMap) => any;
|
|
2230
|
+
"update:sorters": (value: SortControl[]) => any;
|
|
2231
|
+
"update:selectedRows": (value: unknown[]) => any;
|
|
2232
|
+
"update:urlQuery": (value: string | undefined) => any;
|
|
2233
|
+
} & {
|
|
2234
|
+
action: (action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: KeyboardEvent | MouseEvent | undefined) => any;
|
|
2235
|
+
"main-action": (row: Record<string, unknown>, absIndex: number, event: KeyboardEvent | MouseEvent) => any;
|
|
2236
|
+
}, string, vue.PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
2237
|
+
onAction?: ((action: TVueTableActionInfo, ids: unknown[], result: ActionResult, event?: KeyboardEvent | MouseEvent | undefined) => any) | undefined;
|
|
2238
|
+
"onMain-action"?: ((row: Record<string, unknown>, absIndex: number, event: KeyboardEvent | MouseEvent) => any) | undefined;
|
|
2239
|
+
"onUpdate:filterFields"?: ((value: string[]) => any) | undefined;
|
|
2240
|
+
"onUpdate:columnNames"?: ((value: string[]) => any) | undefined;
|
|
2241
|
+
"onUpdate:columnWidths"?: ((value: ColumnWidthsMap) => any) | undefined;
|
|
2242
|
+
"onUpdate:sorters"?: ((value: SortControl[]) => any) | undefined;
|
|
2243
|
+
"onUpdate:selectedRows"?: ((value: unknown[]) => any) | undefined;
|
|
2244
|
+
"onUpdate:urlQuery"?: ((value: string | undefined) => any) | undefined;
|
|
2245
|
+
}>, {
|
|
2246
|
+
queryOnMount: boolean;
|
|
2247
|
+
selectionPersistence: SelectionPersistence;
|
|
2248
|
+
refreshOnAction: boolean;
|
|
2249
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
2250
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
2251
|
+
declare const _default: typeof __VLS_export;
|
|
2252
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
2253
|
+
new (): {
|
|
2254
|
+
$slots: S;
|
|
2255
|
+
};
|
|
2256
|
+
};
|
|
2257
|
+
//#endregion
|
|
2258
|
+
export { createTableState as $, createDefaultControls as A, useTableSearch as B, formatCellValue as C, provideCellLocale as D, CellLocale as E, AS_PRESETS_APP as F, useTable as G, useTableNavBridge as H, injectPresetsApp as I, CreateStaticTableStateOptions as J, SelectionPersistence as K, UseTableUrlQueryOptions as L, UseAppPrefsOptions as M, UseAppPrefsReturn as N, useCellLocale as O, useAppPrefs as P, createStaticTableState as Q, useTableUrlQuery as R, extractIdentifier as S, getColumnWidth as T, UseTableOptions as U, useTableFilter as V, clearTableCache as W, TableContext as X, CreateTableStateOptions as Y, TableStateInternals as Z, getDefaultClientFactory as _, PRESET_ASPECTS as a, usePresets as at, resolveSystemPresets as b, PresetData as c, UseLocalDraftReturn as ct, STANDARD_PRESET_ID as d, useTableContext as et, SYSTEM_PRESET_PREFIX as f, UserConfData as g, UrlQuerySync$1 as h, ClientFactory$1 as i, UsePresetsReturn as it, useTableComponent as j, createDefaultCellTypes as k, PresetSnapshot$1 as l, useLocalDraft as lt, SystemPresetInput$1 as m, AppConfData$1 as n, ActivePresetView as nt, PresetAspect$1 as o, StorageLike as ot, SystemPreset$1 as p, useTableSelection as q, AsPresetEntryRow$1 as r, UsePresetsOptions as rt, PresetCapabilities$1 as s, UseLocalDraftOptions as st, _default as t, useTableContextOptional as tt, PresetSnapshotWire as u, isSystemPresetId as v, getCellValue as w, setDefaultClientFactory as x, resetDefaultClientFactory as y, useTableActions as z };
|