@movk/nuxt 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -2
- package/dist/runtime/components/ColorChooser.d.vue.ts +2 -2
- package/dist/runtime/components/ColorChooser.vue.d.ts +2 -2
- package/dist/runtime/components/DataTable.d.vue.ts +2 -2
- package/dist/runtime/components/DataTable.vue +38 -10
- package/dist/runtime/components/DataTable.vue.d.ts +2 -2
- package/dist/runtime/components/DatePicker.d.vue.ts +3 -3
- package/dist/runtime/components/DatePicker.vue +1 -1
- package/dist/runtime/components/DatePicker.vue.d.ts +3 -3
- package/dist/runtime/components/PillGroup.d.vue.ts +1 -1
- package/dist/runtime/components/PillGroup.vue.d.ts +1 -1
- package/dist/runtime/components/SearchForm.d.vue.ts +3 -3
- package/dist/runtime/components/SearchForm.vue +14 -5
- package/dist/runtime/components/SearchForm.vue.d.ts +3 -3
- package/dist/runtime/components/StarRating.d.vue.ts +2 -2
- package/dist/runtime/components/StarRating.vue.d.ts +2 -2
- package/dist/runtime/components/Tree.d.vue.ts +44 -0
- package/dist/runtime/components/Tree.vue +332 -0
- package/dist/runtime/components/Tree.vue.d.ts +44 -0
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +6 -5
- package/dist/runtime/composables/useDownloadWithProgress.js +4 -16
- package/dist/runtime/composables/useUploadWithProgress.d.ts +6 -5
- package/dist/runtime/composables/useUploadWithProgress.js +4 -16
- package/dist/runtime/domains/auto-form/controls.d.ts +16 -16
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +1 -1
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +1 -1
- package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +43 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.vue +76 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +43 -0
- package/dist/runtime/domains/tree/resolve-tree.d.ts +14 -0
- package/dist/runtime/domains/tree/resolve-tree.js +16 -0
- package/dist/runtime/domains/tree/tree-lazy.d.ts +20 -0
- package/dist/runtime/domains/tree/tree-lazy.js +19 -0
- package/dist/runtime/domains/tree/tree-search.d.ts +6 -0
- package/dist/runtime/domains/tree/tree-search.js +5 -0
- package/dist/runtime/types/auto-form/search-form.d.ts +3 -3
- package/dist/runtime/types/components/index.d.ts +1 -0
- package/dist/runtime/types/components/message-box.d.ts +3 -3
- package/dist/runtime/types/components/tree.d.ts +134 -0
- package/dist/runtime/types/components/tree.js +0 -0
- package/dist/runtime/types/data-table/columns.d.ts +1 -17
- package/dist/runtime/types/data-table/component.d.ts +5 -0
- package/dist/runtime/types/shared.d.ts +13 -0
- package/dist/runtime/utils/extend-theme.d.ts +2 -2
- package/dist/runtime/utils/tree-expand.d.ts +22 -0
- package/dist/runtime/utils/tree-expand.js +18 -0
- package/dist/runtime/utils/tree-selection.d.ts +37 -0
- package/dist/runtime/utils/tree-selection.js +59 -0
- package/dist/shared/{nuxt.DfBEyjld.mjs → nuxt.CXM2nhP4.mjs} +76 -4
- package/dist/unplugin.d.mts +4 -2
- package/dist/unplugin.mjs +1 -35
- package/dist/vite.mjs +1 -1
- package/package.json +9 -8
- package/dist/runtime/domains/data-table/tree-selection.d.ts +0 -9
- package/dist/runtime/domains/data-table/tree-selection.js +0 -76
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Movk Nuxt 是构建在 Nuxt UI 之上的 UI 工程套件,提供两种使用方
|
|
|
20
20
|
|
|
21
21
|
- **AutoForm — Schema 驱动表单**(✅ Nuxt | ✅ Vue + Vite)- 基于 Zod v4 的「定义即渲染」,一份 Schema 同时声明数据结构、验证规则和 UI 配置,自动生成完整表单界面。
|
|
22
22
|
- **DataTable — 数据表格**(✅ Nuxt | ✅ Vue + Vite)- 基于 TanStack Table 封装,覆盖数据列、特殊列(选择/索引/展开/操作)、树形数据、行交互、外观定制、分页与加载更多。
|
|
23
|
-
- **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、StarRating、PillGroup、SearchForm、WithCopy、ThemePicker 等通用 UI 组件,无需依赖 AutoForm 即可独立使用。
|
|
23
|
+
- **独立组件库**(✅ Nuxt | ✅ Vue + Vite)- DatePicker、StarRating、PillGroup、SearchForm、Tree、WithCopy、ThemePicker 等通用 UI 组件,无需依赖 AutoForm 即可独立使用。
|
|
24
24
|
- **主题与 Composables**(✅ Nuxt | ✅ Vue + Vite)- useTheme(主题读写与导出)、useMessageBox(命令式弹窗)、useDateFormatter(国际化日期)等非服务端组合式函数。
|
|
25
25
|
- **API 集成系统**(✅ Nuxt | ❌ Vue + Vite)- useApiFetch / useLazyApiFetch / useClientApiFetch 三件套 + useUploadWithProgress / useDownloadWithProgress,提供多端点、自动认证、业务状态码检查、数据解包、Toast 提示和进度监控;**依赖 Nuxt 服务端运行时,仅 Nuxt 模式可用**。
|
|
26
26
|
- **类型安全** - 完整的 TypeScript 类型推断,从 Schema 到表单数据,组件 prop 回调与事件处理类型可索引访问派生。
|
|
@@ -274,7 +274,7 @@ Movk Nuxt 采用清晰的分层架构:
|
|
|
274
274
|
|
|
275
275
|
- **Core Systems** - AutoForm(Schema 驱动表单)、DataTable(数据表格)
|
|
276
276
|
- **API System** - useApiFetch / useLazyApiFetch / useClientApiFetch、useUploadWithProgress、useDownloadWithProgress,提供完整的 API 请求方案
|
|
277
|
-
- **Standalone Components** - DatePicker、StarRating、PillGroup、SearchForm、WithCopy、ThemePicker 等独立 UI 组件
|
|
277
|
+
- **Standalone Components** - DatePicker、StarRating、PillGroup、SearchForm、Tree、WithCopy、ThemePicker 等独立 UI 组件
|
|
278
278
|
- **Composables** - useDateFormatter、useTheme、useMessageBox、useAutoForm 等通用组合式函数
|
|
279
279
|
- **Foundation** - 基于 [Nuxt UI](https://ui.nuxt.com)、[Zod v4](https://zod.dev)、[VueUse](https://vueuse.org)、[TanStack Table](https://tanstack.com/table)
|
|
280
280
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addPlugin, defineNuxtModule, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
import defu, { defu as defu$1 } from 'defu';
|
|
3
|
-
import { a as addTemplates } from './shared/nuxt.
|
|
3
|
+
import { U as UI_COMPONENTS, a as addTemplates } from './shared/nuxt.CXM2nhP4.mjs';
|
|
4
4
|
import { getPackageJsonMetadata } from '../dist/runtime/utils/meta.js';
|
|
5
5
|
import { kebabCase } from 'scule';
|
|
6
6
|
import { updateSiteConfig } from 'nuxt-site-config/kit';
|
|
@@ -9,7 +9,7 @@ export * from '../dist/runtime/types/index.js';
|
|
|
9
9
|
import 'node:url';
|
|
10
10
|
|
|
11
11
|
const name = "@movk/nuxt";
|
|
12
|
-
const version = "1.
|
|
12
|
+
const version = "1.4.0";
|
|
13
13
|
|
|
14
14
|
function getDefaultApiConfig(apiConfig) {
|
|
15
15
|
const publicEndpoints = {};
|
|
@@ -133,6 +133,16 @@ const module$1 = defineNuxtModule({
|
|
|
133
133
|
nuxt.options.alias["#movk"] = resolve("./runtime");
|
|
134
134
|
nuxt.options.css = nuxt.options.css || [];
|
|
135
135
|
nuxt.options.css.push(resolve("runtime/index.css"));
|
|
136
|
+
const movkUiDeps = UI_COMPONENTS.map((name2) => name2.slice(1));
|
|
137
|
+
const uiOptions = nuxt.options;
|
|
138
|
+
const ui = uiOptions.ui ??= {};
|
|
139
|
+
const experimental = ui.experimental ??= {};
|
|
140
|
+
const detection = experimental.componentDetection;
|
|
141
|
+
if (detection === true) {
|
|
142
|
+
experimental.componentDetection = movkUiDeps;
|
|
143
|
+
} else if (Array.isArray(detection)) {
|
|
144
|
+
experimental.componentDetection = [.../* @__PURE__ */ new Set([...detection, ...movkUiDeps])];
|
|
145
|
+
}
|
|
136
146
|
const componentIgnore = [];
|
|
137
147
|
if (options.theme?.enabled === false) {
|
|
138
148
|
componentIgnore.push("theme-picker/**");
|
|
@@ -14,8 +14,8 @@ declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullab
|
|
|
14
14
|
onClear?: (() => any) | undefined;
|
|
15
15
|
onChange?: ((value: string | undefined) => any) | undefined;
|
|
16
16
|
onCopy?: ((value: string) => any) | undefined;
|
|
17
|
-
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
18
17
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
18
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
19
19
|
"onFormat-change"?: ((format: ColorFormat) => any) | undefined;
|
|
20
20
|
}> & (typeof globalThis extends {
|
|
21
21
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -23,7 +23,7 @@ declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullab
|
|
|
23
23
|
expose: (exposed: {}) => void;
|
|
24
24
|
attrs: any;
|
|
25
25
|
slots: ColorChooserSlots;
|
|
26
|
-
emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:
|
|
26
|
+
emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: string | undefined) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "format-change", format: ColorFormat) => void)) & ((event: "update:modelValue", value: string | undefined) => void);
|
|
27
27
|
}>) => import("vue").VNode & {
|
|
28
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
29
|
};
|
|
@@ -14,8 +14,8 @@ declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullab
|
|
|
14
14
|
onClear?: (() => any) | undefined;
|
|
15
15
|
onChange?: ((value: string | undefined) => any) | undefined;
|
|
16
16
|
onCopy?: ((value: string) => any) | undefined;
|
|
17
|
-
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
18
17
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
18
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
19
19
|
"onFormat-change"?: ((format: ColorFormat) => any) | undefined;
|
|
20
20
|
}> & (typeof globalThis extends {
|
|
21
21
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -23,7 +23,7 @@ declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullab
|
|
|
23
23
|
expose: (exposed: {}) => void;
|
|
24
24
|
attrs: any;
|
|
25
25
|
slots: ColorChooserSlots;
|
|
26
|
-
emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:
|
|
26
|
+
emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: string | undefined) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "format-change", format: ColorFormat) => void)) & ((event: "update:modelValue", value: string | undefined) => void);
|
|
27
27
|
}>) => import("vue").VNode & {
|
|
28
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
29
|
};
|
|
@@ -5,11 +5,11 @@ import type { DataTablePaginationUi } from '../types/data-table/pagination';
|
|
|
5
5
|
declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
6
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DataTableProps<T> & {
|
|
7
7
|
ui?: {
|
|
8
|
-
[x: string]: import("
|
|
8
|
+
[x: string]: import("@nuxt/ui").SlotClass;
|
|
9
9
|
};
|
|
10
10
|
paginationUi?: DataTablePaginationUi & {
|
|
11
11
|
ui?: {
|
|
12
|
-
[x: string]: import("
|
|
12
|
+
[x: string]: import("@nuxt/ui").SlotClass;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
} & {
|
|
@@ -3,10 +3,12 @@ import { getPaginationRowModel } from "@tanstack/vue-table";
|
|
|
3
3
|
import { UTable } from "#components";
|
|
4
4
|
import { useAppConfig } from "#imports";
|
|
5
5
|
import { computed, onMounted, ref, useAttrs, useTemplateRef, watch } from "vue";
|
|
6
|
+
import { useResizeObserver, useScroll } from "@vueuse/core";
|
|
6
7
|
import { useExtendedTv } from "../utils/extend-theme";
|
|
7
8
|
import { resolveColumns } from "../domains/data-table/columns/resolve-columns";
|
|
8
9
|
import { resolveCallbackValue } from "../domains/data-table/columns/utils";
|
|
9
|
-
import {
|
|
10
|
+
import { computeTreeSelection } from "../utils/tree-selection";
|
|
11
|
+
import { resolveDefaultExpandedKeys } from "../utils/tree-expand";
|
|
10
12
|
import { resolveMaxIndentPx } from "../domains/data-table/indent";
|
|
11
13
|
import { Tree, useInfiniteScrollBinding, separate } from "@movk/core";
|
|
12
14
|
import theme from "#build/movk-ui/data-table";
|
|
@@ -42,6 +44,7 @@ const props = defineProps({
|
|
|
42
44
|
rowSelectionOptions: { type: Object, required: false },
|
|
43
45
|
childrenKey: { type: [String, Object], required: false },
|
|
44
46
|
indentSize: { type: [Number, String, Function], required: false, default: "1rem" },
|
|
47
|
+
defaultExpanded: { type: [Boolean, Number, Function], required: false },
|
|
45
48
|
expandedOptions: { type: Object, required: false },
|
|
46
49
|
expandOnRowClick: { type: Boolean, required: false },
|
|
47
50
|
selectOnRowClick: { type: Boolean, required: false },
|
|
@@ -119,16 +122,16 @@ function areSameKeys(a, b) {
|
|
|
119
122
|
for (const key of b) if (!set.has(String(key))) return false;
|
|
120
123
|
return true;
|
|
121
124
|
}
|
|
122
|
-
function useEffectiveModel(model, getDefault, syncBack) {
|
|
125
|
+
function useEffectiveModel(model, getDefault, syncBack, isUnset = (value) => value === void 0) {
|
|
123
126
|
const effective = computed({
|
|
124
|
-
get: () => model.value
|
|
127
|
+
get: () => isUnset(model.value) ? getDefault() : model.value,
|
|
125
128
|
set: (value) => {
|
|
126
129
|
model.value = value;
|
|
127
130
|
}
|
|
128
131
|
});
|
|
129
132
|
if (syncBack !== void 0) {
|
|
130
133
|
onMounted(() => {
|
|
131
|
-
if (model.value
|
|
134
|
+
if (!isUnset(model.value)) return;
|
|
132
135
|
const defaults = getDefault();
|
|
133
136
|
if (syncBack(defaults)) model.value = defaults;
|
|
134
137
|
});
|
|
@@ -186,10 +189,23 @@ const effectiveRowSelection = useEffectiveModel(
|
|
|
186
189
|
() => rowSelectionKeysState.value !== void 0 ? keysToRowSelection(rowSelectionKeysState.value) : {},
|
|
187
190
|
hasEntries
|
|
188
191
|
);
|
|
192
|
+
const defaultExpandedRecord = computed(() => {
|
|
193
|
+
if (!props.childrenKey || !props.defaultExpanded) return {};
|
|
194
|
+
const data = attrs.data ?? [];
|
|
195
|
+
const childrenKey = props.childrenKey;
|
|
196
|
+
const rowKey = props.rowKey;
|
|
197
|
+
const keys = resolveDefaultExpandedKeys(data, props.defaultExpanded, {
|
|
198
|
+
getChildren: (row) => row[childrenKey],
|
|
199
|
+
getKey: (row, { index, parentKey }) => rowKey !== void 0 ? String(row[rowKey]) : parentKey !== void 0 ? `${parentKey}.${index}` : `${index}`
|
|
200
|
+
});
|
|
201
|
+
return keysToExpanded(keys);
|
|
202
|
+
});
|
|
189
203
|
const effectiveExpanded = useEffectiveModel(
|
|
190
204
|
expandedState,
|
|
191
|
-
() => expandedKeysState.value !== void 0 ? keysToExpanded(expandedKeysState.value) :
|
|
192
|
-
hasEntries
|
|
205
|
+
() => expandedKeysState.value !== void 0 ? keysToExpanded(expandedKeysState.value) : defaultExpandedRecord.value,
|
|
206
|
+
hasEntries,
|
|
207
|
+
// 运行时 Vue 把未绑定的布尔型 expanded 模型降级为 false,类型层不体现,故断言比较
|
|
208
|
+
(value) => value === void 0 || value === false
|
|
193
209
|
);
|
|
194
210
|
useSyncKeys(
|
|
195
211
|
columnVisibilityKeysState,
|
|
@@ -219,6 +235,11 @@ defineOptions({ inheritAttrs: false });
|
|
|
219
235
|
const attrs = useAttrs();
|
|
220
236
|
const appConfig = useAppConfig();
|
|
221
237
|
const tableRef = useTemplateRef("tableRef");
|
|
238
|
+
const scrollTarget = () => tableRef.value?.$el ?? null;
|
|
239
|
+
const { arrivedState, measure } = useScroll(scrollTarget, { offset: { left: 1, right: 1 } });
|
|
240
|
+
const pinStart = computed(() => !arrivedState.left);
|
|
241
|
+
const pinEnd = computed(() => !arrivedState.right);
|
|
242
|
+
useResizeObserver(scrollTarget, () => measure());
|
|
222
243
|
const internalLoading = ref(false);
|
|
223
244
|
async function invokeLoadMore() {
|
|
224
245
|
if (!props.loadMore) return;
|
|
@@ -455,9 +476,11 @@ const showPagination = computed(() => paginationView.value?.show ?? false);
|
|
|
455
476
|
const treeSelection = computed(() => {
|
|
456
477
|
const data = attrs.data ?? [];
|
|
457
478
|
const keys = rowSelectionKeysState.value ?? Object.keys(effectiveRowSelection.value).filter((k) => effectiveRowSelection.value[k]);
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
479
|
+
const rowKey = props.rowKey ?? "id";
|
|
480
|
+
const childrenKey = props.childrenKey;
|
|
481
|
+
return computeTreeSelection(data, keys, {
|
|
482
|
+
getKey: (row) => String(row[rowKey]),
|
|
483
|
+
getChildren: childrenKey ? (row) => row[childrenKey] : () => void 0,
|
|
461
484
|
strategy: resolved.value.selectionStrategy
|
|
462
485
|
});
|
|
463
486
|
});
|
|
@@ -512,7 +535,12 @@ defineExpose({
|
|
|
512
535
|
</script>
|
|
513
536
|
|
|
514
537
|
<template>
|
|
515
|
-
<div
|
|
538
|
+
<div
|
|
539
|
+
:class="extraUi.wrapper"
|
|
540
|
+
data-slot="wrapper"
|
|
541
|
+
:data-pin-start="pinStart || void 0"
|
|
542
|
+
:data-pin-end="pinEnd || void 0"
|
|
543
|
+
>
|
|
516
544
|
<UTable
|
|
517
545
|
:key="tableResetKey"
|
|
518
546
|
ref="tableRef"
|
|
@@ -5,11 +5,11 @@ import type { DataTablePaginationUi } from '../types/data-table/pagination';
|
|
|
5
5
|
declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
6
6
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(DataTableProps<T> & {
|
|
7
7
|
ui?: {
|
|
8
|
-
[x: string]: import("
|
|
8
|
+
[x: string]: import("@nuxt/ui").SlotClass;
|
|
9
9
|
};
|
|
10
10
|
paginationUi?: DataTablePaginationUi & {
|
|
11
11
|
ui?: {
|
|
12
|
-
[x: string]: import("
|
|
12
|
+
[x: string]: import("@nuxt/ui").SlotClass;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
} & {
|
|
@@ -11,19 +11,19 @@ declare const __VLS_export: <R extends boolean, M extends boolean, P extends "cl
|
|
|
11
11
|
} & {
|
|
12
12
|
modelValue?: FormattedValue<R, M, V>;
|
|
13
13
|
}) & {
|
|
14
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
15
14
|
"onUpdate:modelValue"?: ((value: FormattedValue<R, M, V> | undefined) => any) | undefined;
|
|
16
|
-
"onUpdate:placeholder"?: ((
|
|
15
|
+
"onUpdate:placeholder"?: ((date: DateValue) => any) | undefined;
|
|
17
16
|
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
18
17
|
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
19
18
|
"onClose:prevent"?: (() => any) | undefined;
|
|
19
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
20
20
|
}> & (typeof globalThis extends {
|
|
21
21
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
22
22
|
} ? P_1 : {});
|
|
23
23
|
expose: (exposed: {}) => void;
|
|
24
24
|
attrs: any;
|
|
25
25
|
slots: DatePickerSlots<P>;
|
|
26
|
-
emit: (((evt: "update:
|
|
26
|
+
emit: (((evt: "update:modelValue", value: FormattedValue<R, M, V>) => void) & ((evt: "update:placeholder", date: DateValue) => void) & ((evt: "update:validModelValue", date: import("reka-ui").DateRange) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void) & ((evt: "close:prevent") => void) & ((evt: "update:open", value: boolean) => void)) & ((event: "update:modelValue", value: FormattedValue<R, M, V> | undefined) => void);
|
|
27
27
|
}>) => import("vue").VNode & {
|
|
28
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
29
|
};
|
|
@@ -22,7 +22,7 @@ const props = defineProps({
|
|
|
22
22
|
formatOptions: { type: null, required: false },
|
|
23
23
|
timeZone: { type: String, required: false }
|
|
24
24
|
});
|
|
25
|
-
const emits = defineEmits(["close:prevent", "update:open", "update:placeholder", "update:
|
|
25
|
+
const emits = defineEmits(["close:prevent", "update:open", "update:placeholder", "update:startValue", "update:validModelValue", "update:modelValue"]);
|
|
26
26
|
defineSlots();
|
|
27
27
|
defineOptions({ inheritAttrs: false });
|
|
28
28
|
const attrs = useAttrs();
|
|
@@ -11,19 +11,19 @@ declare const __VLS_export: <R extends boolean, M extends boolean, P extends "cl
|
|
|
11
11
|
} & {
|
|
12
12
|
modelValue?: FormattedValue<R, M, V>;
|
|
13
13
|
}) & {
|
|
14
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
15
14
|
"onUpdate:modelValue"?: ((value: FormattedValue<R, M, V> | undefined) => any) | undefined;
|
|
16
|
-
"onUpdate:placeholder"?: ((
|
|
15
|
+
"onUpdate:placeholder"?: ((date: DateValue) => any) | undefined;
|
|
17
16
|
"onUpdate:validModelValue"?: ((date: import("reka-ui").DateRange) => any) | undefined;
|
|
18
17
|
"onUpdate:startValue"?: ((date: DateValue | undefined) => any) | undefined;
|
|
19
18
|
"onClose:prevent"?: (() => any) | undefined;
|
|
19
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
20
20
|
}> & (typeof globalThis extends {
|
|
21
21
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
22
22
|
} ? P_1 : {});
|
|
23
23
|
expose: (exposed: {}) => void;
|
|
24
24
|
attrs: any;
|
|
25
25
|
slots: DatePickerSlots<P>;
|
|
26
|
-
emit: (((evt: "update:
|
|
26
|
+
emit: (((evt: "update:modelValue", value: FormattedValue<R, M, V>) => void) & ((evt: "update:placeholder", date: DateValue) => void) & ((evt: "update:validModelValue", date: import("reka-ui").DateRange) => void) & ((evt: "update:startValue", date: DateValue | undefined) => void) & ((evt: "close:prevent") => void) & ((evt: "update:open", value: boolean) => void)) & ((event: "update:modelValue", value: FormattedValue<R, M, V> | undefined) => void);
|
|
27
27
|
}>) => import("vue").VNode & {
|
|
28
28
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
29
|
};
|
|
@@ -4,7 +4,7 @@ declare const __VLS_export: <T extends PillItem, VK extends GetItemKeys<T> | und
|
|
|
4
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(PillGroupProps<T, VK, M> & {
|
|
5
5
|
orientation?: string | number | symbol;
|
|
6
6
|
ui?: {
|
|
7
|
-
[x: string]: import("
|
|
7
|
+
[x: string]: import("@nuxt/ui").SlotClass;
|
|
8
8
|
};
|
|
9
9
|
} & {
|
|
10
10
|
modelValue?: GetModelValue<T, VK, M>;
|
|
@@ -4,7 +4,7 @@ declare const __VLS_export: <T extends PillItem, VK extends GetItemKeys<T> | und
|
|
|
4
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(PillGroupProps<T, VK, M> & {
|
|
5
5
|
orientation?: string | number | symbol;
|
|
6
6
|
ui?: {
|
|
7
|
-
[x: string]: import("
|
|
7
|
+
[x: string]: import("@nuxt/ui").SlotClass;
|
|
8
8
|
};
|
|
9
9
|
} & {
|
|
10
10
|
modelValue?: GetModelValue<T, VK, M>;
|
|
@@ -11,8 +11,8 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
|
|
|
11
11
|
expanded?: boolean;
|
|
12
12
|
}) & {
|
|
13
13
|
onError?: ((event: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
|
|
14
|
-
onClear?: (() => any) | undefined;
|
|
15
|
-
onReset?: (() => any) | undefined;
|
|
14
|
+
onClear?: ((state: Partial<InferInput<S>>) => any) | undefined;
|
|
15
|
+
onReset?: ((state: Partial<InferInput<S>>) => any) | undefined;
|
|
16
16
|
"onUpdate:modelValue"?: ((value: Partial<InferInput<S>>) => any) | undefined;
|
|
17
17
|
onExpand?: ((expanded: boolean) => any) | undefined;
|
|
18
18
|
"onUpdate:expanded"?: ((value: boolean | undefined) => any) | undefined;
|
|
@@ -30,7 +30,7 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
|
|
|
30
30
|
}>) => void;
|
|
31
31
|
attrs: any;
|
|
32
32
|
slots: SearchFormSlots<S>;
|
|
33
|
-
emit: (((evt: "error", event: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear") => void) & ((evt: "reset") => void) & ((evt: "expand", expanded: boolean) => void) & ((evt: "update:expanded", expanded: boolean) => void)) & (((event: "update:modelValue", value: Partial<InferInput<S>>) => void) & ((event: "update:expanded", value: boolean | undefined) => void));
|
|
33
|
+
emit: (((evt: "error", event: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear", state: Partial<InferInput<S>>) => void) & ((evt: "reset", state: Partial<InferInput<S>>) => void) & ((evt: "expand", expanded: boolean) => void) & ((evt: "update:expanded", expanded: boolean) => void)) & (((event: "update:modelValue", value: Partial<InferInput<S>>) => void) & ((event: "update:expanded", value: boolean | undefined) => void));
|
|
34
34
|
}>) => import("vue").VNode & {
|
|
35
35
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
36
36
|
};
|
|
@@ -131,16 +131,25 @@ function toggle() {
|
|
|
131
131
|
function submit() {
|
|
132
132
|
formRef.value?.submit();
|
|
133
133
|
}
|
|
134
|
+
function buildFieldPayload(state) {
|
|
135
|
+
const keys = Object.keys(props.schema.shape);
|
|
136
|
+
return keys.reduce((acc, key) => {
|
|
137
|
+
acc[key] = state[key];
|
|
138
|
+
return acc;
|
|
139
|
+
}, {});
|
|
140
|
+
}
|
|
134
141
|
function clear() {
|
|
135
|
-
|
|
142
|
+
const next = {};
|
|
143
|
+
modelValue.value = next;
|
|
136
144
|
formRef.value?.clear();
|
|
137
|
-
emits("clear");
|
|
145
|
+
emits("clear", buildFieldPayload(next));
|
|
138
146
|
}
|
|
139
147
|
function reset() {
|
|
140
|
-
|
|
141
|
-
applyFieldDefaults(fields.value,
|
|
148
|
+
const next = deepClone(baseline);
|
|
149
|
+
applyFieldDefaults(fields.value, next);
|
|
150
|
+
modelValue.value = next;
|
|
142
151
|
formRef.value?.clear();
|
|
143
|
-
emits("reset");
|
|
152
|
+
emits("reset", buildFieldPayload(next));
|
|
144
153
|
}
|
|
145
154
|
function setBaseline(value) {
|
|
146
155
|
baseline = deepClone(toRaw(value ?? modelValue.value));
|
|
@@ -11,8 +11,8 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
|
|
|
11
11
|
expanded?: boolean;
|
|
12
12
|
}) & {
|
|
13
13
|
onError?: ((event: import("@nuxt/ui").FormErrorEvent) => any) | undefined;
|
|
14
|
-
onClear?: (() => any) | undefined;
|
|
15
|
-
onReset?: (() => any) | undefined;
|
|
14
|
+
onClear?: ((state: Partial<InferInput<S>>) => any) | undefined;
|
|
15
|
+
onReset?: ((state: Partial<InferInput<S>>) => any) | undefined;
|
|
16
16
|
"onUpdate:modelValue"?: ((value: Partial<InferInput<S>>) => any) | undefined;
|
|
17
17
|
onExpand?: ((expanded: boolean) => any) | undefined;
|
|
18
18
|
"onUpdate:expanded"?: ((value: boolean | undefined) => any) | undefined;
|
|
@@ -30,7 +30,7 @@ declare const __VLS_export: <S extends z.ZodObject>(__VLS_props: NonNullable<Awa
|
|
|
30
30
|
}>) => void;
|
|
31
31
|
attrs: any;
|
|
32
32
|
slots: SearchFormSlots<S>;
|
|
33
|
-
emit: (((evt: "error", event: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear") => void) & ((evt: "reset") => void) & ((evt: "expand", expanded: boolean) => void) & ((evt: "update:expanded", expanded: boolean) => void)) & (((event: "update:modelValue", value: Partial<InferInput<S>>) => void) & ((event: "update:expanded", value: boolean | undefined) => void));
|
|
33
|
+
emit: (((evt: "error", event: import("@nuxt/ui").FormErrorEvent) => void) & ((evt: "clear", state: Partial<InferInput<S>>) => void) & ((evt: "reset", state: Partial<InferInput<S>>) => void) & ((evt: "expand", expanded: boolean) => void) & ((evt: "update:expanded", expanded: boolean) => void)) & (((event: "update:modelValue", value: Partial<InferInput<S>>) => void) & ((event: "update:expanded", value: boolean | undefined) => void));
|
|
34
34
|
}>) => import("vue").VNode & {
|
|
35
35
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
36
36
|
};
|
|
@@ -29,12 +29,12 @@ type __VLS_Slots = {} & {
|
|
|
29
29
|
};
|
|
30
30
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
31
|
change: (value: number) => any;
|
|
32
|
-
hover: (value: number | null) => any;
|
|
33
32
|
"update:modelValue": (value: number) => any;
|
|
33
|
+
hover: (value: number | null) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
35
|
onChange?: ((value: number) => any) | undefined;
|
|
36
|
-
onHover?: ((value: number | null) => any) | undefined;
|
|
37
36
|
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
37
|
+
onHover?: ((value: number | null) => any) | undefined;
|
|
38
38
|
}>, {
|
|
39
39
|
max: number;
|
|
40
40
|
showBadge: boolean;
|
|
@@ -29,12 +29,12 @@ type __VLS_Slots = {} & {
|
|
|
29
29
|
};
|
|
30
30
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
31
|
change: (value: number) => any;
|
|
32
|
-
hover: (value: number | null) => any;
|
|
33
32
|
"update:modelValue": (value: number) => any;
|
|
33
|
+
hover: (value: number | null) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
35
|
onChange?: ((value: number) => any) | undefined;
|
|
36
|
-
onHover?: ((value: number | null) => any) | undefined;
|
|
37
36
|
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
37
|
+
onHover?: ((value: number | null) => any) | undefined;
|
|
38
38
|
}>, {
|
|
39
39
|
max: number;
|
|
40
40
|
showBadge: boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AppConfig } from 'nuxt/schema';
|
|
2
|
+
import type { ComponentConfig, TreeItem } from '@nuxt/ui';
|
|
3
|
+
import treeTheme from '#build/ui/tree';
|
|
4
|
+
import theme from '#build/movk-ui/tree';
|
|
5
|
+
import type { TreeExposed, TreeProps, TreeSlots } from '../types/components/tree';
|
|
6
|
+
declare const __VLS_export: <T extends TreeItem[] = TreeItem[], M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
7
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(TreeProps<T, M> & {
|
|
8
|
+
ui?: ComponentConfig<typeof treeTheme & typeof theme, AppConfig, "tree">["slots"];
|
|
9
|
+
} & {
|
|
10
|
+
modelValue?: (M extends true ? T[number][] : T[number]) | undefined;
|
|
11
|
+
selectedKeys?: string[];
|
|
12
|
+
search?: string;
|
|
13
|
+
expanded?: string[];
|
|
14
|
+
}) & {
|
|
15
|
+
onChange?: ((payload: {
|
|
16
|
+
value: (M extends true ? T[number][] : T[number]) | undefined;
|
|
17
|
+
keys: string[];
|
|
18
|
+
selection: import("../types").TreeSelectionResult<T[number]>;
|
|
19
|
+
}) => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: (M extends true ? T[number][] : T[number]) | undefined) => any) | undefined;
|
|
21
|
+
"onUpdate:expanded"?: ((val: string[]) => any) | undefined;
|
|
22
|
+
"onUpdate:search"?: ((value: string) => any) | undefined;
|
|
23
|
+
"onUpdate:selectedKeys"?: ((value: string[] | undefined) => any) | undefined;
|
|
24
|
+
}> & (typeof globalThis extends {
|
|
25
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
26
|
+
} ? P : {});
|
|
27
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<TreeExposed<T>>) => void;
|
|
28
|
+
attrs: any;
|
|
29
|
+
slots: TreeSlots<T>;
|
|
30
|
+
emit: (((evt: "change", payload: {
|
|
31
|
+
value: (M extends true ? T[number][] : T[number]) | undefined;
|
|
32
|
+
keys: string[];
|
|
33
|
+
selection: import("../types").TreeSelectionResult<T[number]>;
|
|
34
|
+
}) => void) & ((evt: "update:modelValue", val: M extends true ? T[number][] : T[number]) => void) & ((evt: "update:expanded", val: string[]) => void) & ((evt: "update:search", value: string) => void)) & (((event: "update:modelValue", value: (M extends true ? T[number][] : T[number]) | undefined) => void) & ((event: "update:expanded", value: string[]) => void) & ((event: "update:search", value: string) => void) & ((event: "update:selectedKeys", value: string[] | undefined) => void));
|
|
35
|
+
}>) => import("vue").VNode & {
|
|
36
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
37
|
+
};
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
41
|
+
[K in keyof T]: T[K];
|
|
42
|
+
} : {
|
|
43
|
+
[K in keyof T as K]: T[K];
|
|
44
|
+
}) & {};
|