@oiij/naive-ui 0.0.73 → 0.0.75
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 +132 -4
- package/dist/components/config-providers/ConfigProviders.vue.d.ts +2 -2
- package/dist/components/copy-button/CopyButton.js +1 -1
- package/dist/components/copy-button/CopyButton.vue.d.ts +4 -4
- package/dist/components/data-table-plus/DataTablePlus.js +4 -4
- package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +18 -18
- package/dist/components/data-table-plus/index.d.ts +1 -1
- package/dist/components/loading-provider/LoadingProvider.vue.d.ts +2 -2
- package/dist/components/preset-form/PresetForm.js +11 -11
- package/dist/components/preset-form/PresetForm.vue.d.ts +17 -26
- package/dist/components/preset-input/PresetInput.vue.d.ts +3 -3
- package/dist/components/preset-picker/PresetPicker.vue.d.ts +4 -4
- package/dist/components/preset-select/PresetSelect.js +4 -4
- package/dist/components/preset-select/PresetSelect.vue.d.ts +9 -9
- package/dist/components/preset-select/index.d.ts +1 -1
- package/dist/components/remote-request/RemoteRequest.vue.d.ts +4 -4
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/search-input/SearchInput.vue.d.ts +4 -4
- package/dist/components/toggle-input/ToggleInput.vue.d.ts +4 -4
- package/dist/components/tooltip-button/TooltipButton.vue.d.ts +4 -4
- package/dist/components/transition/BaseTransition.vue.d.ts +2 -2
- package/dist/components/type-writer/TypeWriter.js +2 -2
- package/dist/components/type-writer/TypeWriter.vue.d.ts +4 -4
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-auto-menu.d.ts +74 -0
- package/dist/composables/use-auto-menu.js +129 -0
- package/dist/composables/use-data-request.d.ts +60 -30
- package/dist/composables/use-data-request.js +24 -1
- package/dist/composables/use-loading.d.ts +4 -0
- package/dist/composables/use-loading.js +8 -0
- package/dist/composables/use-naive-form.d.ts +42 -19
- package/dist/composables/use-naive-form.js +49 -5
- package/dist/composables/use-naive-theme.d.ts +33 -16
- package/dist/composables/use-naive-theme.js +16 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,12 +1,140 @@
|
|
|
1
|
-
# Naive-UI
|
|
1
|
+
# Naive-UI 🎨
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@oiij/naive-ui)
|
|
4
|
-
[](https://github.com/
|
|
4
|
+
[](https://github.com/oiij/use/blob/main/packages/naive-ui/LICENSE)
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 项目简介 📦
|
|
7
|
+
|
|
8
|
+
Use NaiveUI 是基于 Naive UI 的 Vue 3 组件库封装,提供了一套丰富的 UI 组件和组合式 API,帮助开发者快速构建现代化的 Web 应用。
|
|
9
|
+
|
|
10
|
+
## 功能特点 ✨
|
|
11
|
+
|
|
12
|
+
### 模块化设计 🧩
|
|
13
|
+
|
|
14
|
+
- 📁 采用模块化架构,每个组件独立封装
|
|
15
|
+
- 📦 支持按需导入,减小打包体积
|
|
16
|
+
- 🔧 清晰的文件结构,易于维护和扩展
|
|
17
|
+
|
|
18
|
+
### 类型安全 🔒
|
|
19
|
+
|
|
20
|
+
- 📝 完整的 TypeScript 类型定义
|
|
21
|
+
- 💡 提供准确的类型推断和代码提示
|
|
22
|
+
- 🎯 支持 Vue 3 的 Composition API 类型系统
|
|
23
|
+
|
|
24
|
+
### 轻量高效 ⚡
|
|
25
|
+
|
|
26
|
+
- 🚀 核心代码精简,基于 Naive UI 构建
|
|
27
|
+
- 🏃 优化的性能表现,最小化运行时开销
|
|
28
|
+
- 📦 支持 Tree Shaking,进一步减小打包体积
|
|
29
|
+
|
|
30
|
+
### 功能丰富 🎨
|
|
31
|
+
|
|
32
|
+
- 🧩 丰富的 UI 组件和组合式 API
|
|
33
|
+
- 🛠️ 提供开箱即用的解决方案
|
|
34
|
+
- 🔄 与 Vue 3 生态系统无缝集成
|
|
35
|
+
|
|
36
|
+
## 安装 📥
|
|
37
|
+
|
|
38
|
+
### 使用 pnpm 🐱
|
|
7
39
|
|
|
8
40
|
```bash
|
|
9
41
|
pnpm add @oiij/naive-ui
|
|
10
42
|
```
|
|
11
43
|
|
|
12
|
-
|
|
44
|
+
### 使用 npm 📦
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install @oiij/naive-ui
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 使用 yarn 🧶
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
yarn add @oiij/naive-ui
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 快速开始 🌟
|
|
57
|
+
|
|
58
|
+
### 基础使用
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<script setup>
|
|
62
|
+
import type { RouteRecordRaw } from 'vue-router'
|
|
63
|
+
import { useAutoMenu } from '@oiij/naive-ui'
|
|
64
|
+
|
|
65
|
+
// 模拟路由配置
|
|
66
|
+
const routes: RouteRecordRaw[] = [
|
|
67
|
+
{
|
|
68
|
+
path: '/',
|
|
69
|
+
name: 'Home',
|
|
70
|
+
meta: {
|
|
71
|
+
title: '首页'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
path: '/about',
|
|
76
|
+
name: 'About',
|
|
77
|
+
meta: {
|
|
78
|
+
title: '关于我们'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
const { menuOptions } = useAutoMenu(routes)
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<div>
|
|
88
|
+
<n-menu :options="menuOptions" />
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 功能模块 📋
|
|
94
|
+
|
|
95
|
+
### 组合式 API
|
|
96
|
+
|
|
97
|
+
- **use-auto-menu** 📋: 自动菜单生成
|
|
98
|
+
- **use-data-request** 📡: 数据请求管理
|
|
99
|
+
- **use-loading** ⏳: 加载状态管理
|
|
100
|
+
- **use-naive-form** 📝: 表单管理
|
|
101
|
+
- **use-naive-theme** 🎨: 主题管理
|
|
102
|
+
|
|
103
|
+
### 组件
|
|
104
|
+
|
|
105
|
+
- **config-providers** ⚙️: 全局配置
|
|
106
|
+
- **copy-button** 📋: 复制按钮
|
|
107
|
+
- **data-table-plus** 📊: 增强数据表格
|
|
108
|
+
- **loading-provider** ⏳: 加载状态提供者
|
|
109
|
+
- **preset-form** 📝: 预设表单
|
|
110
|
+
- **preset-input** 📱: 预设输入框
|
|
111
|
+
- **preset-picker** 📅: 预设选择器
|
|
112
|
+
- **preset-select** 🔽: 预设选择器
|
|
113
|
+
- **remote-request** 📡: 远程请求组件
|
|
114
|
+
- **search-input** 🔍: 搜索输入框
|
|
115
|
+
- **toggle-input** 🔄: 切换输入框
|
|
116
|
+
- **tooltip-button** 💬: 提示按钮
|
|
117
|
+
- **transition** 🔄: 过渡动画
|
|
118
|
+
- **type-writer** ⌨️: 打字机效果
|
|
119
|
+
|
|
120
|
+
## 在线文档 📚
|
|
121
|
+
|
|
122
|
+
[在线文档](https://oiij-use.vercel.app/naive-ui/naive-ui) 📖
|
|
123
|
+
|
|
124
|
+
## 贡献指南 🤝
|
|
125
|
+
|
|
126
|
+
欢迎贡献代码、报告问题或提出新功能建议!
|
|
127
|
+
|
|
128
|
+
1. Fork 本仓库 🍴
|
|
129
|
+
2. 创建您的特性分支 (`git checkout -b feature/amazing-feature`) 🌿
|
|
130
|
+
3. 提交您的更改 (`git commit -m 'Add some amazing feature'`) 💾
|
|
131
|
+
4. 推送到分支 (`git push origin feature/amazing-feature`) 🚀
|
|
132
|
+
5. 打开一个 Pull Request 📥
|
|
133
|
+
|
|
134
|
+
## 许可证 📄
|
|
135
|
+
|
|
136
|
+
本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情 📑
|
|
137
|
+
|
|
138
|
+
## 联系方式 📞
|
|
139
|
+
|
|
140
|
+
- GitHub: [https://github.com/oiij/use](https://github.com/oiij/use) 🌟
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ConfigProvidersProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue25 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/config-providers/ConfigProviders.vue.d.ts
|
|
5
5
|
declare var __VLS_44: {};
|
|
6
6
|
type __VLS_Slots = {} & {
|
|
7
7
|
default?: (props: typeof __VLS_44) => any;
|
|
8
8
|
};
|
|
9
|
-
declare const __VLS_base:
|
|
9
|
+
declare const __VLS_base: vue25.DefineComponent<ConfigProvidersProps, {}, {}, {}, {}, vue25.ComponentOptionsMixin, vue25.ComponentOptionsMixin, {}, string, vue25.PublicProps, Readonly<ConfigProvidersProps> & Readonly<{}>, {}, {}, {}, {}, string, vue25.ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
11
|
declare const _default: typeof __VLS_export;
|
|
12
12
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import MageCopyFill_default from "../icons/MageCopyFill.js";
|
|
2
|
-
import { useClipboard } from "@vueuse/core";
|
|
3
2
|
import { createBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
|
|
3
|
+
import { useClipboard } from "@vueuse/core";
|
|
4
4
|
import { NButton, NTooltip } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/copy-button/CopyButton.vue
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CopyButtonProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue44 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/copy-button/CopyButton.vue.d.ts
|
|
5
5
|
declare var __VLS_9: {}, __VLS_18: {}, __VLS_25: {};
|
|
@@ -10,11 +10,11 @@ type __VLS_Slots = {} & {
|
|
|
10
10
|
} & {
|
|
11
11
|
tooltip?: (props: typeof __VLS_25) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_base:
|
|
13
|
+
declare const __VLS_base: vue44.DefineComponent<CopyButtonProps, {}, {}, {}, {}, vue44.ComponentOptionsMixin, vue44.ComponentOptionsMixin, {} & {
|
|
14
14
|
copied: (v: string | undefined) => any;
|
|
15
|
-
}, string,
|
|
15
|
+
}, string, vue44.PublicProps, Readonly<CopyButtonProps> & Readonly<{
|
|
16
16
|
onCopied?: ((v: string | undefined) => any) | undefined;
|
|
17
|
-
}>, {}, {}, {}, {}, string,
|
|
17
|
+
}>, {}, {}, {}, {}, string, vue44.ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
19
|
declare const _default: typeof __VLS_export;
|
|
20
20
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -60,7 +60,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
60
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
61
61
|
const emit = __emit;
|
|
62
62
|
const columnsReactive = reactive(__props.columns ?? []);
|
|
63
|
-
const
|
|
63
|
+
const dataTableInst = useTemplateRef("data-table-ref");
|
|
64
64
|
const _fields = {
|
|
65
65
|
page: "page",
|
|
66
66
|
pageSize: "pageSize",
|
|
@@ -220,7 +220,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
function handleScrollTop() {
|
|
223
|
-
|
|
223
|
+
dataTableInst.value?.scrollTo({
|
|
224
224
|
left: 0,
|
|
225
225
|
top: 0,
|
|
226
226
|
behavior: "smooth"
|
|
@@ -248,7 +248,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
248
248
|
onFinally,
|
|
249
249
|
filters: filtersRef,
|
|
250
250
|
sorters: sortersRef,
|
|
251
|
-
|
|
251
|
+
dataTableInst
|
|
252
252
|
};
|
|
253
253
|
const templateBind = computed(() => {
|
|
254
254
|
return {
|
|
@@ -261,7 +261,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
261
261
|
paginationRef: toValue(paginationRef),
|
|
262
262
|
filters: toValue(filtersRef),
|
|
263
263
|
sorters: toValue(sortersRef),
|
|
264
|
-
|
|
264
|
+
dataTableInst: toValue(dataTableInst)
|
|
265
265
|
};
|
|
266
266
|
});
|
|
267
267
|
__expose(expose);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DataObject, UseDataRequestPagination } from "../../composables/use-data-request.js";
|
|
2
2
|
import { DataTablePlusEmits, DataTablePlusExpose, DataTablePlusProps } from "./index.js";
|
|
3
3
|
import "../../composables/index.js";
|
|
4
|
+
import * as vue65 from "vue";
|
|
4
5
|
import * as _vueuse_core31 from "@vueuse/core";
|
|
5
|
-
import * as vue69 from "vue";
|
|
6
6
|
import { DataTableBaseColumn, DataTableFilterState, DataTableInst, DataTableSortState } from "naive-ui";
|
|
7
7
|
|
|
8
8
|
//#region src/components/data-table-plus/DataTablePlus.vue.d.ts
|
|
9
9
|
declare const __VLS_export: <P extends DataObject, D extends DataObject, R extends DataObject>(__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<{
|
|
10
|
-
props:
|
|
10
|
+
props: vue65.PublicProps & __VLS_PrettifyLocal<DataTablePlusProps<P, D, R> & {
|
|
11
11
|
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
12
12
|
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
13
13
|
onLoad?: ((row: R) => any) | undefined;
|
|
@@ -29,7 +29,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
29
29
|
}> & (typeof globalThis extends {
|
|
30
30
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
31
31
|
} ? P_1 : {});
|
|
32
|
-
expose: (exposed:
|
|
32
|
+
expose: (exposed: vue65.ShallowUnwrapRef<DataTablePlusExpose<P, D, R>>) => void;
|
|
33
33
|
attrs: any;
|
|
34
34
|
slots: {
|
|
35
35
|
header?: (props: {
|
|
@@ -45,8 +45,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
45
45
|
};
|
|
46
46
|
filters: DataTableFilterState | undefined;
|
|
47
47
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
48
|
-
|
|
49
|
-
pagination:
|
|
48
|
+
dataTableInst: DataTableInst | null;
|
|
49
|
+
pagination: vue65.Ref<{
|
|
50
50
|
page: number;
|
|
51
51
|
pageSize: number;
|
|
52
52
|
itemCount: number;
|
|
@@ -85,8 +85,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
85
85
|
};
|
|
86
86
|
filters: DataTableFilterState | undefined;
|
|
87
87
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
88
|
-
|
|
89
|
-
pagination:
|
|
88
|
+
dataTableInst: DataTableInst | null;
|
|
89
|
+
pagination: vue65.Ref<{
|
|
90
90
|
page: number;
|
|
91
91
|
pageSize: number;
|
|
92
92
|
itemCount: number;
|
|
@@ -123,8 +123,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
123
123
|
};
|
|
124
124
|
filters: DataTableFilterState | undefined;
|
|
125
125
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
126
|
-
|
|
127
|
-
pagination:
|
|
126
|
+
dataTableInst: DataTableInst | null;
|
|
127
|
+
pagination: vue65.Ref<{
|
|
128
128
|
page: number;
|
|
129
129
|
pageSize: number;
|
|
130
130
|
itemCount: number;
|
|
@@ -161,8 +161,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
161
161
|
};
|
|
162
162
|
filters: DataTableFilterState | undefined;
|
|
163
163
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
164
|
-
|
|
165
|
-
pagination:
|
|
164
|
+
dataTableInst: DataTableInst | null;
|
|
165
|
+
pagination: vue65.Ref<{
|
|
166
166
|
page: number;
|
|
167
167
|
pageSize: number;
|
|
168
168
|
itemCount: number;
|
|
@@ -199,8 +199,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
199
199
|
};
|
|
200
200
|
filters: DataTableFilterState | undefined;
|
|
201
201
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
202
|
-
|
|
203
|
-
pagination:
|
|
202
|
+
dataTableInst: DataTableInst | null;
|
|
203
|
+
pagination: vue65.Ref<{
|
|
204
204
|
page: number;
|
|
205
205
|
pageSize: number;
|
|
206
206
|
itemCount: number;
|
|
@@ -237,8 +237,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
237
237
|
};
|
|
238
238
|
filters: DataTableFilterState | undefined;
|
|
239
239
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
240
|
-
|
|
241
|
-
pagination:
|
|
240
|
+
dataTableInst: DataTableInst | null;
|
|
241
|
+
pagination: vue65.Ref<{
|
|
242
242
|
page: number;
|
|
243
243
|
pageSize: number;
|
|
244
244
|
itemCount: number;
|
|
@@ -275,8 +275,8 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
275
275
|
};
|
|
276
276
|
filters: DataTableFilterState | undefined;
|
|
277
277
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
278
|
-
|
|
279
|
-
pagination:
|
|
278
|
+
dataTableInst: DataTableInst | null;
|
|
279
|
+
pagination: vue65.Ref<{
|
|
280
280
|
page: number;
|
|
281
281
|
pageSize: number;
|
|
282
282
|
itemCount: number;
|
|
@@ -301,7 +301,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
301
301
|
}) => any;
|
|
302
302
|
};
|
|
303
303
|
emit: DataTablePlusEmits<P, D, R>;
|
|
304
|
-
}>) =>
|
|
304
|
+
}>) => vue65.VNode & {
|
|
305
305
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
306
306
|
};
|
|
307
307
|
declare const _default: typeof __VLS_export;
|
|
@@ -15,7 +15,7 @@ type ClassStyle = {
|
|
|
15
15
|
type DataTablePlusExpose<P extends DataObject = DataObject, D extends DataObject = DataObject, R extends DataObject = DataObject> = UseDataRequestReturns<P, D, R> & {
|
|
16
16
|
filters: Ref<DataTableFilterState | undefined>;
|
|
17
17
|
sorters: Ref<Record<string, DataTableSortState> | undefined>;
|
|
18
|
-
|
|
18
|
+
dataTableInst: Readonly<ShallowRef<DataTableInst | null>>;
|
|
19
19
|
};
|
|
20
20
|
type DataTablePlusFields = DataRequestFields & {
|
|
21
21
|
filter?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LoadingProviderProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue52 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/loading-provider/LoadingProvider.vue.d.ts
|
|
5
5
|
declare var __VLS_26: {}, __VLS_29: {}, __VLS_31: {};
|
|
@@ -10,7 +10,7 @@ type __VLS_Slots = {} & {
|
|
|
10
10
|
} & {
|
|
11
11
|
default?: (props: typeof __VLS_31) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_base:
|
|
13
|
+
declare const __VLS_base: vue52.DefineComponent<LoadingProviderProps, {}, {}, {}, {}, vue52.ComponentOptionsMixin, vue52.ComponentOptionsMixin, {}, string, vue52.PublicProps, Readonly<LoadingProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, vue52.ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
15
15
|
declare const _default: typeof __VLS_export;
|
|
16
16
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -18,7 +18,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
18
|
emits: ["validated"],
|
|
19
19
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
20
20
|
const emit = __emit;
|
|
21
|
-
const {
|
|
21
|
+
const { formValue, formRules, formInst, formProps: _formProps, setValue, validate, resetValidation, resetForm, reset, clear, onValidated } = useNaiveForm(useTemplateRef("form-ref"), {
|
|
22
22
|
value: __props.value,
|
|
23
23
|
rules: __props.rules,
|
|
24
24
|
clearRules: __props.clearRules
|
|
@@ -37,9 +37,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
37
|
if (key) setValue({ [key]: val });
|
|
38
38
|
}
|
|
39
39
|
const expose = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
formInst,
|
|
41
|
+
formValue,
|
|
42
|
+
formRules,
|
|
43
43
|
formProps: _formProps,
|
|
44
44
|
setValue,
|
|
45
45
|
validate,
|
|
@@ -52,9 +52,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
52
|
const templateBind = computed(() => {
|
|
53
53
|
return {
|
|
54
54
|
...expose,
|
|
55
|
-
|
|
56
|
-
formValue: toValue(
|
|
57
|
-
formRules: toValue(
|
|
55
|
+
formInst: toValue(formInst),
|
|
56
|
+
formValue: toValue(formValue),
|
|
57
|
+
formRules: toValue(formRules),
|
|
58
58
|
formProps: toValue(_formProps)
|
|
59
59
|
};
|
|
60
60
|
});
|
|
@@ -62,8 +62,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
62
62
|
return (_ctx, _cache) => {
|
|
63
63
|
return openBlock(), createBlock(unref(NForm), mergeProps({
|
|
64
64
|
ref: "form-ref",
|
|
65
|
-
model: unref(
|
|
66
|
-
rules: unref(
|
|
65
|
+
model: unref(formValue),
|
|
66
|
+
rules: unref(formRules)
|
|
67
67
|
}, __props.formProps), {
|
|
68
68
|
default: withCtx(() => [
|
|
69
69
|
renderSlot(_ctx.$slots, "header", normalizeProps(guardReactiveProps(templateBind.value))),
|
|
@@ -92,7 +92,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
92
92
|
})), { key: 0 })) : (openBlock(), createBlock(unref(PresetInput_default), {
|
|
93
93
|
key: 1,
|
|
94
94
|
options: opt,
|
|
95
|
-
value: key ? unref(
|
|
95
|
+
value: key ? unref(formValue)[key] : void 0,
|
|
96
96
|
"onUpdate:value": (val) => onPresetInputUpdate(val, key)
|
|
97
97
|
}, null, 8, [
|
|
98
98
|
"options",
|
|
@@ -144,7 +144,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
144
144
|
})), { key: 0 })) : (openBlock(), createBlock(unref(PresetInput_default), {
|
|
145
145
|
key: 1,
|
|
146
146
|
options: opt,
|
|
147
|
-
value: key ? unref(
|
|
147
|
+
value: key ? unref(formValue)[key] : void 0,
|
|
148
148
|
"onUpdate:value": (val) => onPresetInputUpdate(val, key)
|
|
149
149
|
}, null, 8, [
|
|
150
150
|
"options",
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
import { DataObject } from "../../composables/use-data-request.js";
|
|
2
2
|
import { PresetFormExpose, PresetFormProps } from "./index.js";
|
|
3
|
+
import * as vue35 from "vue";
|
|
3
4
|
import * as _vueuse_core8 from "@vueuse/core";
|
|
4
|
-
import * as vue48 from "vue";
|
|
5
5
|
import * as naive_ui0 from "naive-ui";
|
|
6
|
-
import { FormInst } from "naive-ui";
|
|
6
|
+
import { FormInst, FormRules } from "naive-ui";
|
|
7
7
|
import * as async_validator0 from "async-validator";
|
|
8
8
|
|
|
9
9
|
//#region src/components/preset-form/PresetForm.vue.d.ts
|
|
10
10
|
declare const __VLS_export: <V extends DataObject>(__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<{
|
|
11
|
-
props:
|
|
11
|
+
props: vue35.PublicProps & __VLS_PrettifyLocal<PresetFormProps<V> & {
|
|
12
12
|
onValidated?: ((val: V) => any) | undefined;
|
|
13
13
|
}> & (typeof globalThis extends {
|
|
14
14
|
__VLS_PROPS_FALLBACK: infer P;
|
|
15
15
|
} ? P : {});
|
|
16
|
-
expose: (exposed:
|
|
16
|
+
expose: (exposed: vue35.ShallowUnwrapRef<PresetFormExpose<V>>) => void;
|
|
17
17
|
attrs: any;
|
|
18
18
|
slots: {
|
|
19
19
|
header?: (props: {
|
|
20
|
-
|
|
20
|
+
formInst: FormInst | null;
|
|
21
21
|
formValue: V;
|
|
22
|
-
formRules: Partial<Record<keyof V,
|
|
22
|
+
formRules: Partial<Record<keyof V, FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>;
|
|
23
23
|
formProps: {
|
|
24
|
-
model:
|
|
25
|
-
rules:
|
|
24
|
+
model: vue35.Reactive<V>;
|
|
25
|
+
rules: vue35.Reactive<Partial<Record<keyof V, FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
|
|
26
26
|
};
|
|
27
|
-
formInstRef: Readonly<vue48.ShallowRef<FormInst | null>>;
|
|
28
|
-
formValueRef: vue48.Ref<V, V>;
|
|
29
|
-
formRulesRef: vue48.Ref<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>, Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
|
|
30
27
|
setValue: (_value: Partial<V>) => void;
|
|
31
28
|
validate: () => Promise<{
|
|
32
29
|
warnings?: async_validator0.ValidateError[][];
|
|
@@ -39,16 +36,13 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
|
|
|
39
36
|
}) => any;
|
|
40
37
|
} & {
|
|
41
38
|
default?: (props: {
|
|
42
|
-
|
|
39
|
+
formInst: FormInst | null;
|
|
43
40
|
formValue: V;
|
|
44
|
-
formRules: Partial<Record<keyof V,
|
|
41
|
+
formRules: Partial<Record<keyof V, FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>;
|
|
45
42
|
formProps: {
|
|
46
|
-
model:
|
|
47
|
-
rules:
|
|
43
|
+
model: vue35.Reactive<V>;
|
|
44
|
+
rules: vue35.Reactive<Partial<Record<keyof V, FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
|
|
48
45
|
};
|
|
49
|
-
formInstRef: Readonly<vue48.ShallowRef<FormInst | null>>;
|
|
50
|
-
formValueRef: vue48.Ref<V, V>;
|
|
51
|
-
formRulesRef: vue48.Ref<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>, Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
|
|
52
46
|
setValue: (_value: Partial<V>) => void;
|
|
53
47
|
validate: () => Promise<{
|
|
54
48
|
warnings?: async_validator0.ValidateError[][];
|
|
@@ -61,16 +55,13 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
|
|
|
61
55
|
}) => any;
|
|
62
56
|
} & {
|
|
63
57
|
footer?: (props: {
|
|
64
|
-
|
|
58
|
+
formInst: FormInst | null;
|
|
65
59
|
formValue: V;
|
|
66
|
-
formRules: Partial<Record<keyof V,
|
|
60
|
+
formRules: Partial<Record<keyof V, FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>;
|
|
67
61
|
formProps: {
|
|
68
|
-
model:
|
|
69
|
-
rules:
|
|
62
|
+
model: vue35.Reactive<V>;
|
|
63
|
+
rules: vue35.Reactive<Partial<Record<keyof V, FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
|
|
70
64
|
};
|
|
71
|
-
formInstRef: Readonly<vue48.ShallowRef<FormInst | null>>;
|
|
72
|
-
formValueRef: vue48.Ref<V, V>;
|
|
73
|
-
formRulesRef: vue48.Ref<Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>, Partial<Record<keyof V, naive_ui0.FormRules | naive_ui0.FormItemRule | naive_ui0.FormItemRule[]>>>;
|
|
74
65
|
setValue: (_value: Partial<V>) => void;
|
|
75
66
|
validate: () => Promise<{
|
|
76
67
|
warnings?: async_validator0.ValidateError[][];
|
|
@@ -83,7 +74,7 @@ declare const __VLS_export: <V extends DataObject>(__VLS_props: NonNullable<Awai
|
|
|
83
74
|
}) => any;
|
|
84
75
|
};
|
|
85
76
|
emit: (e: "validated", val: V) => void;
|
|
86
|
-
}>) =>
|
|
77
|
+
}>) => vue35.VNode & {
|
|
87
78
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
88
79
|
};
|
|
89
80
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PresetInputProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue20 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/components/preset-input/PresetInput.vue.d.ts
|
|
5
5
|
declare const __VLS_export: <V>(__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
|
-
props:
|
|
6
|
+
props: vue20.PublicProps & __VLS_PrettifyLocal<PresetInputProps<V> & {
|
|
7
7
|
"onUpdate:value"?: ((val?: V | undefined) => any) | undefined;
|
|
8
8
|
}> & (typeof globalThis extends {
|
|
9
9
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -12,7 +12,7 @@ declare const __VLS_export: <V>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
12
12
|
attrs: any;
|
|
13
13
|
slots: {};
|
|
14
14
|
emit: (e: "update:value", val?: V) => void;
|
|
15
|
-
}>) =>
|
|
15
|
+
}>) => vue20.VNode & {
|
|
16
16
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
17
17
|
};
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DataObject } from "../../composables/use-data-request.js";
|
|
2
2
|
import { PresetPickerEmits, PresetPickerExpose, PresetPickerProps, PresetPickerValue } from "./index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as vue62 from "vue";
|
|
4
4
|
import { DataTableColumns } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/preset-picker/PresetPicker.vue.d.ts
|
|
7
7
|
declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(__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<{
|
|
8
|
-
props:
|
|
8
|
+
props: vue62.PublicProps & __VLS_PrettifyLocal<PresetPickerProps<V, R> & {
|
|
9
9
|
onClose?: (() => any) | undefined;
|
|
10
10
|
"onUpdate:value"?: ((val: V | null, raw: R | R[] | null) => any) | undefined;
|
|
11
11
|
onAfterEnter?: (() => any) | undefined;
|
|
@@ -18,7 +18,7 @@ declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(
|
|
|
18
18
|
}> & (typeof globalThis extends {
|
|
19
19
|
__VLS_PROPS_FALLBACK: infer P;
|
|
20
20
|
} ? P : {});
|
|
21
|
-
expose: (exposed:
|
|
21
|
+
expose: (exposed: vue62.ShallowUnwrapRef<PresetPickerExpose<R>>) => void;
|
|
22
22
|
attrs: any;
|
|
23
23
|
slots: {
|
|
24
24
|
'button-icon'?: (props: {}) => any;
|
|
@@ -54,7 +54,7 @@ declare const __VLS_export: <V extends PresetPickerValue, R extends DataObject>(
|
|
|
54
54
|
'modal-close'?: (props: {}) => any;
|
|
55
55
|
};
|
|
56
56
|
emit: PresetPickerEmits<V, R>;
|
|
57
|
-
}>) =>
|
|
57
|
+
}>) => vue62.VNode & {
|
|
58
58
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
59
59
|
};
|
|
60
60
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useDataRequest } from "../../composables/use-data-request.js";
|
|
2
|
-
import { useDebounceFn } from "@vueuse/core";
|
|
3
2
|
import { computed, createBlock, createCommentVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toRaw, toValue, unref, useTemplateRef, withCtx } from "vue";
|
|
3
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
4
4
|
import { NFlex, NPagination, NSelect } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/preset-select/PresetSelect.vue
|
|
@@ -49,7 +49,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
49
49
|
],
|
|
50
50
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
51
51
|
const emit = __emit;
|
|
52
|
-
const
|
|
52
|
+
const selectInstRef = useTemplateRef("select-ref");
|
|
53
53
|
const _fields = {
|
|
54
54
|
page: "page",
|
|
55
55
|
pageSize: "pageSize",
|
|
@@ -183,7 +183,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
183
183
|
onSuccess,
|
|
184
184
|
onError,
|
|
185
185
|
onFinally,
|
|
186
|
-
|
|
186
|
+
selectInst: selectInstRef
|
|
187
187
|
};
|
|
188
188
|
const templateBind = computed(() => {
|
|
189
189
|
return {
|
|
@@ -194,7 +194,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
194
194
|
params: toValue(params),
|
|
195
195
|
list: toValue(list),
|
|
196
196
|
pagination: toValue(paginationRef),
|
|
197
|
-
|
|
197
|
+
selectInst: toValue(selectInstRef)
|
|
198
198
|
};
|
|
199
199
|
});
|
|
200
200
|
__expose(expose);
|