@oiij/naive-ui 0.0.76 → 0.0.77
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/dist/components/config-providers/ConfigProviders.vue.d.ts +2 -2
- package/dist/components/config-providers/index.d.ts +16 -7
- package/dist/components/copy-button/CopyButton.js +2 -2
- package/dist/components/copy-button/CopyButton.vue.d.ts +4 -4
- package/dist/components/copy-button/index.d.ts +6 -3
- package/dist/components/data-table-plus/DataTablePlus.js +74 -125
- package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +15 -80
- package/dist/components/data-table-plus/index.d.ts +52 -32
- package/dist/components/index.d.ts +2 -4
- package/dist/components/loading-provider/LoadingProvider.js +2 -2
- package/dist/components/loading-provider/LoadingProvider.vue.d.ts +2 -2
- package/dist/components/loading-provider/index.d.ts +19 -10
- package/dist/components/loading-provider/index.js +5 -2
- package/dist/components/preset-form/PresetForm.js +42 -21
- package/dist/components/preset-form/PresetForm.vue.d.ts +17 -17
- package/dist/components/preset-form/_utils.js +23 -8
- package/dist/components/preset-form/index.d.ts +32 -13
- package/dist/components/preset-input/PresetInput.vue.d.ts +3 -3
- package/dist/components/preset-input/index.d.ts +30 -20
- package/dist/components/preset-picker/PresetPicker.js +31 -34
- package/dist/components/preset-picker/PresetPicker.vue.d.ts +5 -10
- package/dist/components/preset-picker/index.d.ts +45 -31
- package/dist/components/preset-select/PresetSelect.js +23 -59
- package/dist/components/preset-select/PresetSelect.vue.d.ts +33 -37
- package/dist/components/preset-select/index.d.ts +56 -22
- package/dist/components/remote-request/RemoteRequest.js +7 -7
- package/dist/components/remote-request/RemoteRequest.vue.d.ts +6 -6
- package/dist/components/remote-request/index.d.ts +30 -8
- package/dist/components/search-input/SearchInput.vue.d.ts +4 -4
- package/dist/components/search-input/index.d.ts +10 -7
- 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/tooltip-button/index.d.ts +5 -2
- package/dist/components/transition/index.d.ts +4 -1
- package/dist/components.d.ts +2 -4
- package/dist/components.js +2 -3
- package/dist/composables/_helper.d.ts +7 -4
- package/dist/composables/_helper.js +47 -0
- package/dist/composables/use-data-request.d.ts +25 -18
- package/dist/composables/use-data-request.js +22 -3
- package/dist/composables/use-loading.d.ts +6 -0
- package/dist/composables/use-loading.js +8 -2
- package/dist/composables/use-naive-form.d.ts +21 -13
- package/dist/composables/use-naive-form.js +48 -39
- package/dist/composables/use-naive-menu.d.ts +5 -4
- package/dist/composables/use-naive-menu.js +2 -50
- package/dist/composables/use-naive-theme.d.ts +27 -14
- package/dist/composables/use-naive-theme.js +22 -4
- package/package.json +5 -7
- package/dist/components/_utils/prismjs.js +0 -16
- package/dist/components/icons/MageArrowUp.js +0 -29
- package/dist/components/type-writer/TypeWriter.js +0 -75
- package/dist/components/type-writer/TypeWriter.vue.d.ts +0 -22
- package/dist/components/type-writer/index.d.ts +0 -13
- package/dist/components/type-writer/type-writer.cssr.js +0 -27
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ConfigProvidersProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue23 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: vue23.DefineComponent<ConfigProvidersProps, {}, {}, {}, {}, vue23.ComponentOptionsMixin, vue23.ComponentOptionsMixin, {}, string, vue23.PublicProps, Readonly<ConfigProvidersProps> & Readonly<{}>, {}, {}, {}, {}, string, vue23.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 & {
|
|
@@ -6,23 +6,32 @@ import { _default } from "./ConfigProviders.vue.js";
|
|
|
6
6
|
import { ConfigProviderProps, DialogProviderInst, DialogProviderProps, LoadingBarProviderInst, LoadingBarProviderProps, MessageProviderInst, MessageProviderProps, ModalProviderInst, ModalProviderProps, NotificationProviderInst, NotificationProviderProps } from "naive-ui";
|
|
7
7
|
|
|
8
8
|
//#region src/components/config-providers/index.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* 配置提供者组件属性
|
|
11
|
+
*/
|
|
9
12
|
type ConfigProvidersProps = {
|
|
10
|
-
globalStyle?: boolean;
|
|
11
|
-
configProviderProps?: ConfigProviderProps & ClassStyle;
|
|
12
|
-
loadingBarProviderProps?: LoadingBarProviderProps & ClassStyle;
|
|
13
|
-
loadingProviderProps?: LoadingProviderProps & ClassStyle;
|
|
14
|
-
dialogProviderProps?: DialogProviderProps & ClassStyle;
|
|
15
|
-
modalProviderProps?: ModalProviderProps & ClassStyle;
|
|
16
|
-
notificationProviderProps?: NotificationProviderProps & ClassStyle;
|
|
13
|
+
/** 是否应用全局样式 */globalStyle?: boolean; /** 配置提供者属性 */
|
|
14
|
+
configProviderProps?: ConfigProviderProps & ClassStyle; /** 加载条提供者属性 */
|
|
15
|
+
loadingBarProviderProps?: LoadingBarProviderProps & ClassStyle; /** 加载提供者属性 */
|
|
16
|
+
loadingProviderProps?: LoadingProviderProps & ClassStyle; /** 对话框提供者属性 */
|
|
17
|
+
dialogProviderProps?: DialogProviderProps & ClassStyle; /** 模态框提供者属性 */
|
|
18
|
+
modalProviderProps?: ModalProviderProps & ClassStyle; /** 通知提供者属性 */
|
|
19
|
+
notificationProviderProps?: NotificationProviderProps & ClassStyle; /** 消息提供者属性 */
|
|
17
20
|
messageProviderProps?: MessageProviderProps & ClassStyle;
|
|
18
21
|
};
|
|
19
22
|
declare global {
|
|
20
23
|
interface Window {
|
|
24
|
+
/** 对话框实例 */
|
|
21
25
|
$dialog: DialogProviderInst;
|
|
26
|
+
/** 加载实例 */
|
|
22
27
|
$loading: ReturnType<typeof useLoading>;
|
|
28
|
+
/** 加载条实例 */
|
|
23
29
|
$loadingBar: LoadingBarProviderInst;
|
|
30
|
+
/** 消息实例 */
|
|
24
31
|
$message: MessageProviderInst;
|
|
32
|
+
/** 模态框实例 */
|
|
25
33
|
$modal: ModalProviderInst;
|
|
34
|
+
/** 通知实例 */
|
|
26
35
|
$notification: NotificationProviderInst;
|
|
27
36
|
}
|
|
28
37
|
}
|
|
@@ -22,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
22
|
watch(copied, () => {
|
|
23
23
|
if (copied.value) emit("copied", __props.value);
|
|
24
24
|
});
|
|
25
|
-
function
|
|
25
|
+
function handleClick(ev) {
|
|
26
26
|
ev.preventDefault();
|
|
27
27
|
copy();
|
|
28
28
|
}
|
|
@@ -30,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
return openBlock(), createBlock(unref(NTooltip), normalizeProps(guardReactiveProps(__props.tooltipProps)), {
|
|
31
31
|
trigger: withCtx(() => [createElementVNode("div", {
|
|
32
32
|
style: { cursor: "pointer" },
|
|
33
|
-
onClick
|
|
33
|
+
onClick: handleClick
|
|
34
34
|
}, [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(unref(NButton), mergeProps({
|
|
35
35
|
quaternary: "",
|
|
36
36
|
size: "tiny"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CopyButtonProps } from "./index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue35 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: vue35.DefineComponent<CopyButtonProps, {}, {}, {}, {}, vue35.ComponentOptionsMixin, vue35.ComponentOptionsMixin, {} & {
|
|
14
14
|
copied: (v: string | undefined) => any;
|
|
15
|
-
}, string,
|
|
15
|
+
}, string, vue35.PublicProps, Readonly<CopyButtonProps> & Readonly<{
|
|
16
16
|
onCopied?: ((v: string | undefined) => any) | undefined;
|
|
17
|
-
}>, {}, {}, {}, {}, string,
|
|
17
|
+
}>, {}, {}, {}, {}, string, vue35.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 & {
|
|
@@ -4,10 +4,13 @@ import { UseClipboardOptions } from "@vueuse/core";
|
|
|
4
4
|
import { ButtonProps, TooltipProps } from "naive-ui";
|
|
5
5
|
|
|
6
6
|
//#region src/components/copy-button/index.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 复制按钮组件属性
|
|
9
|
+
*/
|
|
7
10
|
type CopyButtonProps = {
|
|
8
|
-
value?: string;
|
|
9
|
-
config?: UseClipboardOptions<string | undefined>;
|
|
10
|
-
tooltipProps?: TooltipProps & ClassStyle;
|
|
11
|
+
/** 要复制的值 */value?: string; /** 剪贴板配置选项 */
|
|
12
|
+
config?: UseClipboardOptions<string | undefined>; /** 提示框属性 */
|
|
13
|
+
tooltipProps?: TooltipProps & ClassStyle; /** 按钮属性 */
|
|
11
14
|
buttonProps?: ButtonProps & ClassStyle;
|
|
12
15
|
};
|
|
13
16
|
//#endregion
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useDataRequest } from "../../composables/use-data-request.js";
|
|
2
|
-
import MageArrowUp_default from "../icons/MageArrowUp.js";
|
|
3
2
|
import SearchInput_default from "../search-input/SearchInput.js";
|
|
4
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toDisplayString, toRaw,
|
|
5
|
-
import {
|
|
3
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, reactive, ref, renderSlot, toDisplayString, toRaw, unref, useTemplateRef, watchEffect, withCtx } from "vue";
|
|
4
|
+
import { NDataTable, NFlex, NPagination } from "naive-ui";
|
|
6
5
|
|
|
7
6
|
//#region src/components/data-table-plus/DataTablePlus.vue
|
|
8
7
|
const _hoisted_1 = { style: {
|
|
@@ -28,11 +27,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
27
|
requestOptions: {},
|
|
29
28
|
requestPlugins: {},
|
|
30
29
|
title: {},
|
|
31
|
-
scrollTop: { type: [
|
|
32
|
-
Number,
|
|
33
|
-
Boolean,
|
|
34
|
-
Object
|
|
35
|
-
] },
|
|
36
30
|
columns: {},
|
|
37
31
|
search: { type: [Object, Boolean] },
|
|
38
32
|
pagination: { type: [Object, Boolean] },
|
|
@@ -47,15 +41,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
41
|
"finally",
|
|
48
42
|
"clickRow",
|
|
49
43
|
"contextMenuRow",
|
|
50
|
-
"load",
|
|
51
|
-
"scroll",
|
|
52
|
-
"scrollBottom",
|
|
53
44
|
"update:checkedRowKeys",
|
|
54
|
-
"update:expandedRowKeys",
|
|
55
45
|
"update:filters",
|
|
56
46
|
"update:sorter",
|
|
57
47
|
"update:page",
|
|
58
|
-
"update:pageSize"
|
|
48
|
+
"update:pageSize",
|
|
49
|
+
"loadedRows"
|
|
59
50
|
],
|
|
60
51
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
61
52
|
const emit = __emit;
|
|
@@ -82,27 +73,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
82
73
|
30
|
|
83
74
|
],
|
|
84
75
|
pageSlot: 5,
|
|
85
|
-
prefix: (info) => {
|
|
86
|
-
return `共${info.itemCount}条数据`;
|
|
87
|
-
},
|
|
76
|
+
prefix: (info) => `共${info.itemCount}条数据`,
|
|
88
77
|
...__props.pagination && typeof __props.pagination === "boolean" ? {} : __props.pagination
|
|
89
78
|
});
|
|
90
|
-
const scrollTopProps = { ...typeof __props.scrollTop === "boolean" ? {
|
|
91
|
-
top: 180,
|
|
92
|
-
buttonProps: void 0
|
|
93
|
-
} : typeof __props.scrollTop === "number" ? {
|
|
94
|
-
top: __props.scrollTop,
|
|
95
|
-
buttonProps: void 0
|
|
96
|
-
} : typeof __props.scrollTop === "object" ? {
|
|
97
|
-
top: __props.scrollTop.top ?? 180,
|
|
98
|
-
buttonProps: __props.scrollTop.buttonProps ?? {}
|
|
99
|
-
} : {
|
|
100
|
-
top: 180,
|
|
101
|
-
buttonProps: void 0
|
|
102
|
-
} };
|
|
103
79
|
const filtersRef = ref();
|
|
104
80
|
const sortersRef = ref();
|
|
105
|
-
const _dataCache = [];
|
|
106
81
|
const { loading, data, error, params, list, pagination: paginationRef, run, runAsync, refresh, refreshAsync, cancel, mutate, setParams, runParams, runParamsAsync, onBefore, onSuccess, onError, onFinally } = useDataRequest(__props.api, {
|
|
107
82
|
defaultParams: {
|
|
108
83
|
[_fields.search]: null,
|
|
@@ -118,7 +93,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
118
93
|
});
|
|
119
94
|
onSuccess((data, params) => {
|
|
120
95
|
emit("success", data, params);
|
|
121
|
-
|
|
96
|
+
updateColumnFiltersAndSorters();
|
|
122
97
|
});
|
|
123
98
|
onError((err, params) => {
|
|
124
99
|
emit("error", err, params);
|
|
@@ -126,47 +101,52 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
126
101
|
onFinally((params, data, err) => {
|
|
127
102
|
emit("finally", params, data, err);
|
|
128
103
|
});
|
|
104
|
+
function getRawList() {
|
|
105
|
+
return toRaw(list.value);
|
|
106
|
+
}
|
|
107
|
+
watchEffect(() => {
|
|
108
|
+
emit("loadedRows", getRawList());
|
|
109
|
+
});
|
|
129
110
|
const scrollX = computed(() => {
|
|
130
|
-
|
|
131
|
-
return
|
|
132
|
-
}
|
|
111
|
+
function nanAble(val) {
|
|
112
|
+
return Number.isNaN(Number(val)) ? 0 : Number(val);
|
|
113
|
+
}
|
|
114
|
+
return __props.columns?.reduce((sum, column) => sum + nanAble(column.width ?? 100), 0) ?? 0;
|
|
133
115
|
});
|
|
134
|
-
function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
116
|
+
function isBaseColumnWithKey(column) {
|
|
117
|
+
return column && "key" in column;
|
|
118
|
+
}
|
|
119
|
+
function updateColumnFilters(column) {
|
|
120
|
+
if (!filtersRef.value || !isBaseColumnWithKey(column) || !("filter" in column) || !column.filter) return;
|
|
121
|
+
const filterValues = filtersRef.value[column.key];
|
|
122
|
+
if (!filterValues) return;
|
|
123
|
+
if (column.filterMultiple) column.filterOptionValues = Array.isArray(filterValues) ? filterValues : [filterValues];
|
|
124
|
+
else column.filterOptionValue = Array.isArray(filterValues) ? filterValues[0] : filterValues;
|
|
125
|
+
}
|
|
126
|
+
function updateColumnSorter(column) {
|
|
127
|
+
if (!sortersRef.value || !isBaseColumnWithKey(column) || !("sorter" in column) || !column.sorter) return;
|
|
128
|
+
const sorterValue = sortersRef.value[column.key];
|
|
129
|
+
if (sorterValue) column.sortOrder = sorterValue.order;
|
|
130
|
+
}
|
|
131
|
+
function updateColumnFiltersAndSorters() {
|
|
132
|
+
if (!columnsReactive) return;
|
|
133
|
+
for (const item of columnsReactive) {
|
|
134
|
+
if (!isBaseColumnWithKey(item)) continue;
|
|
135
|
+
if ("sorter" in item && typeof item.sorter === "boolean") item.sortOrder = false;
|
|
136
|
+
updateColumnFilters(item);
|
|
137
|
+
updateColumnSorter(item);
|
|
155
138
|
}
|
|
156
139
|
}
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
onUpdatePage: (page) => {
|
|
140
|
+
const eventHandlers = {
|
|
141
|
+
handlePageUpdate: (page) => {
|
|
160
142
|
emit("update:page", page);
|
|
161
|
-
if (loading.value)
|
|
162
|
-
runParams({ [_fields.page]: page });
|
|
143
|
+
if (!loading.value) runParams({ [_fields.page]: page });
|
|
163
144
|
},
|
|
164
|
-
|
|
145
|
+
handlePageSizeUpdate: (pageSize) => {
|
|
165
146
|
emit("update:pageSize", pageSize);
|
|
166
|
-
if (loading.value)
|
|
167
|
-
runParams({ [_fields.pageSize]: pageSize });
|
|
147
|
+
if (!loading.value) runParams({ [_fields.pageSize]: pageSize });
|
|
168
148
|
},
|
|
169
|
-
|
|
149
|
+
handleFiltersUpdate: (filters, initiatorColumn) => {
|
|
170
150
|
emit("update:filters", filters, initiatorColumn);
|
|
171
151
|
filtersRef.value = filters;
|
|
172
152
|
runParams({
|
|
@@ -174,10 +154,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
174
154
|
...__props.columnsFilterOptions ? __props.columnsFilterOptions(filters) : { [_fields.filter]: filters }
|
|
175
155
|
});
|
|
176
156
|
},
|
|
177
|
-
|
|
157
|
+
handleSorterUpdate: (options) => {
|
|
178
158
|
emit("update:sorter", options);
|
|
179
159
|
const sorter = {};
|
|
180
|
-
if (Array.isArray(options))
|
|
160
|
+
if (Array.isArray(options)) options.forEach((item) => {
|
|
161
|
+
sorter[item.columnKey] = item;
|
|
162
|
+
});
|
|
181
163
|
else if (options) sorter[options.columnKey] = options;
|
|
182
164
|
sortersRef.value = sorter;
|
|
183
165
|
runParams({
|
|
@@ -185,47 +167,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
185
167
|
...__props.columnsSorterOptions ? __props.columnsSorterOptions(sorter) : { [_fields.sorter]: sorter }
|
|
186
168
|
});
|
|
187
169
|
},
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
onScroll: (ev) => {
|
|
192
|
-
if (__props.scrollTop && ev.target && "scrollTop" in ev.target && typeof ev.target.scrollTop === "number") _scrollTop.value = ev.target.scrollTop;
|
|
193
|
-
emit("scroll", ev);
|
|
194
|
-
},
|
|
195
|
-
onUpdateCheckedRowKeys: (keys, _rows, meta) => {
|
|
196
|
-
emit("update:checkedRowKeys", keys, keys.map((m) => _dataCache.find((f) => f?.[_fields.rowKey] === m)), {
|
|
197
|
-
row: toRaw(meta.row),
|
|
170
|
+
handleCheckedRowKeysUpdate: (keys, rows, meta) => {
|
|
171
|
+
emit("update:checkedRowKeys", keys, rows, {
|
|
172
|
+
row: meta.row,
|
|
198
173
|
action: meta.action
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
onUpdateExpandedRowKeys: (keys) => {
|
|
202
|
-
emit("update:expandedRowKeys", keys, toRaw(list.value));
|
|
174
|
+
}, getRawList());
|
|
203
175
|
}
|
|
204
176
|
};
|
|
205
177
|
function rowProps(row, index) {
|
|
178
|
+
const rawRow = toRaw(row);
|
|
179
|
+
const rawList = getRawList();
|
|
206
180
|
return {
|
|
207
181
|
onClick: (event) => {
|
|
208
|
-
emit("clickRow",
|
|
182
|
+
emit("clickRow", rawRow, index, event, rawList);
|
|
209
183
|
},
|
|
210
184
|
onContextmenu: (event) => {
|
|
211
|
-
emit("contextMenuRow",
|
|
185
|
+
emit("contextMenuRow", rawRow, index, event, rawList);
|
|
212
186
|
}
|
|
213
187
|
};
|
|
214
188
|
}
|
|
215
|
-
function
|
|
189
|
+
function handleSearch(val) {
|
|
216
190
|
if (loading.value) return;
|
|
217
191
|
runParams({
|
|
218
192
|
[_fields.page]: 1,
|
|
219
193
|
[_fields.search]: val
|
|
220
194
|
});
|
|
221
195
|
}
|
|
222
|
-
function handleScrollTop() {
|
|
223
|
-
dataTableInst.value?.scrollTo({
|
|
224
|
-
left: 0,
|
|
225
|
-
top: 0,
|
|
226
|
-
behavior: "smooth"
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
196
|
const expose = {
|
|
230
197
|
loading,
|
|
231
198
|
data,
|
|
@@ -253,15 +220,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
253
220
|
const templateBind = computed(() => {
|
|
254
221
|
return {
|
|
255
222
|
...expose,
|
|
256
|
-
loading:
|
|
257
|
-
data:
|
|
258
|
-
error:
|
|
259
|
-
params:
|
|
260
|
-
list:
|
|
261
|
-
|
|
262
|
-
filters:
|
|
263
|
-
sorters:
|
|
264
|
-
dataTableInst:
|
|
223
|
+
loading: loading.value,
|
|
224
|
+
data: data.value,
|
|
225
|
+
error: error.value,
|
|
226
|
+
params: params.value,
|
|
227
|
+
list: list.value,
|
|
228
|
+
pagination: paginationRef.value,
|
|
229
|
+
filters: filtersRef.value,
|
|
230
|
+
sorters: sortersRef.value,
|
|
231
|
+
dataTableInst: dataTableInst.value
|
|
265
232
|
};
|
|
266
233
|
});
|
|
267
234
|
__expose(expose);
|
|
@@ -285,7 +252,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
285
252
|
},
|
|
286
253
|
value: unref(params)?.[0]?.[_fields.search],
|
|
287
254
|
loading: unref(loading)
|
|
288
|
-
}, searchProps, { "onUpdate:value": _cache[0] || (_cache[0] = (val) =>
|
|
255
|
+
}, searchProps, { "onUpdate:value": _cache[0] || (_cache[0] = (val) => handleSearch(val)) }), null, 16, ["value", "loading"])) : createCommentVNode("v-if", true),
|
|
289
256
|
renderSlot(_ctx.$slots, "header-extra", normalizeProps(guardReactiveProps(templateBind.value)))
|
|
290
257
|
]),
|
|
291
258
|
_: 3
|
|
@@ -308,12 +275,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
308
275
|
data: unref(list),
|
|
309
276
|
"row-props": rowProps
|
|
310
277
|
}, __props.dataTableProps, {
|
|
311
|
-
"onUpdate:filters":
|
|
312
|
-
"onUpdate:sorter":
|
|
313
|
-
|
|
314
|
-
onScroll: vOn.onScroll,
|
|
315
|
-
"onUpdate:checkedRowKeys": vOn.onUpdateCheckedRowKeys,
|
|
316
|
-
"onUpdate:expandedRowKeys": vOn.onUpdateExpandedRowKeys
|
|
278
|
+
"onUpdate:filters": eventHandlers.handleFiltersUpdate,
|
|
279
|
+
"onUpdate:sorter": eventHandlers.handleSorterUpdate,
|
|
280
|
+
"onUpdate:checkedRowKeys": eventHandlers.handleCheckedRowKeysUpdate
|
|
317
281
|
}), {
|
|
318
282
|
empty: withCtx(() => [renderSlot(_ctx.$slots, "empty", normalizeProps(guardReactiveProps(templateBind.value)))]),
|
|
319
283
|
loading: withCtx(() => [renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(templateBind.value)))]),
|
|
@@ -327,23 +291,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
327
291
|
"data",
|
|
328
292
|
"onUpdate:filters",
|
|
329
293
|
"onUpdate:sorter",
|
|
330
|
-
"
|
|
331
|
-
|
|
332
|
-
"onUpdate:checkedRowKeys",
|
|
333
|
-
"onUpdate:expandedRowKeys"
|
|
334
|
-
]), __props.scrollTop && _scrollTop.value > scrollTopProps.top ? (openBlock(), createBlock(unref(NButton), mergeProps({
|
|
335
|
-
key: 0,
|
|
336
|
-
secondary: "",
|
|
337
|
-
circle: "",
|
|
338
|
-
style: {
|
|
339
|
-
position: "absolute",
|
|
340
|
-
right: "20px",
|
|
341
|
-
bottom: "20px"
|
|
342
|
-
}
|
|
343
|
-
}, scrollTopProps.buttonProps, { onClick: handleScrollTop }), {
|
|
344
|
-
icon: withCtx(() => [createVNode(MageArrowUp_default)]),
|
|
345
|
-
_: 1
|
|
346
|
-
}, 16)) : createCommentVNode("v-if", true)]),
|
|
294
|
+
"onUpdate:checkedRowKeys"
|
|
295
|
+
])]),
|
|
347
296
|
renderSlot(_ctx.$slots, "footer", normalizeProps(guardReactiveProps(templateBind.value)), () => [createVNode(unref(NFlex), null, {
|
|
348
297
|
default: withCtx(() => [renderSlot(_ctx.$slots, "footer-extra", normalizeProps(guardReactiveProps(templateBind.value))), __props.pagination ? (openBlock(), createBlock(unref(NPagination), mergeProps({
|
|
349
298
|
key: 0,
|
|
@@ -353,8 +302,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
353
302
|
...paginationProps,
|
|
354
303
|
...unref(paginationRef)
|
|
355
304
|
}, {
|
|
356
|
-
"onUpdate:page":
|
|
357
|
-
"onUpdate:pageSize":
|
|
305
|
+
"onUpdate:page": eventHandlers.handlePageUpdate,
|
|
306
|
+
"onUpdate:pageSize": eventHandlers.handlePageSizeUpdate
|
|
358
307
|
}), null, 16, [
|
|
359
308
|
"disabled",
|
|
360
309
|
"onUpdate:page",
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import { DataObject
|
|
1
|
+
import { DataObject } from "../../composables/use-data-request.js";
|
|
2
2
|
import { DataTablePlusEmits, DataTablePlusExpose, DataTablePlusProps } from "./index.js";
|
|
3
3
|
import "../../composables/index.js";
|
|
4
4
|
import * as _vueuse_core31 from "@vueuse/core";
|
|
5
|
-
import * as
|
|
5
|
+
import * as vue60 from "vue";
|
|
6
6
|
import { DataTableBaseColumn, DataTableFilterState, DataTableInst, DataTableSortState } from "naive-ui";
|
|
7
|
+
import { RowKey } from "naive-ui/es/data-table/src/interface";
|
|
7
8
|
|
|
8
9
|
//#region src/components/data-table-plus/DataTablePlus.vue.d.ts
|
|
9
10
|
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:
|
|
11
|
+
props: vue60.PublicProps & __VLS_PrettifyLocal<DataTablePlusProps<P, D, R> & {
|
|
11
12
|
onError?: ((err: Error, params: P[]) => any) | undefined;
|
|
12
13
|
onSuccess?: ((data: D, params: P[]) => any) | undefined;
|
|
13
|
-
onLoad?: ((row: R) => any) | undefined;
|
|
14
|
-
onScroll?: ((ev: Event) => any) | undefined;
|
|
15
14
|
onFinally?: ((params: P[], data?: D | undefined, err?: Error | undefined) => any) | undefined;
|
|
16
15
|
onBefore?: ((params: P[]) => any) | undefined;
|
|
17
16
|
"onUpdate:page"?: ((page: number) => any) | undefined;
|
|
18
17
|
"onUpdate:pageSize"?: ((pageSize: number) => any) | undefined;
|
|
19
18
|
onClickRow?: ((row: R, index: number, event: MouseEvent, currentData: R[]) => any) | undefined;
|
|
20
19
|
onContextMenuRow?: ((row: R, index: number, event: MouseEvent, currentData: R[]) => any) | undefined;
|
|
21
|
-
|
|
22
|
-
"onUpdate:checkedRowKeys"?: ((keys: (string | number)[], rows: (R | undefined)[], meta: {
|
|
20
|
+
"onUpdate:checkedRowKeys"?: ((keys: RowKey[], rows: R[], meta: {
|
|
23
21
|
row: R | undefined;
|
|
24
22
|
action: "check" | "uncheck" | "checkAll" | "uncheckAll";
|
|
25
23
|
}, currentData: R[]) => any) | undefined;
|
|
26
|
-
"onUpdate:expandedRowKeys"?: ((keys: (string | number)[], currentData: R[]) => any) | undefined;
|
|
27
24
|
"onUpdate:filters"?: ((filterState: DataTableFilterState, sourceColumn: DataTableBaseColumn) => any) | undefined;
|
|
28
25
|
"onUpdate:sorter"?: ((options: DataTableSortState | DataTableSortState[] | null) => any) | undefined;
|
|
26
|
+
onLoadedRows?: ((data: R[]) => any) | undefined;
|
|
29
27
|
}> & (typeof globalThis extends {
|
|
30
28
|
__VLS_PROPS_FALLBACK: infer P_1;
|
|
31
29
|
} ? P_1 : {});
|
|
32
|
-
expose: (exposed:
|
|
30
|
+
expose: (exposed: vue60.ShallowUnwrapRef<DataTablePlusExpose<P, D, R>>) => void;
|
|
33
31
|
attrs: any;
|
|
34
32
|
slots: {
|
|
35
33
|
header?: (props: {
|
|
@@ -38,7 +36,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
38
36
|
error: Error | undefined;
|
|
39
37
|
params: [] | P[];
|
|
40
38
|
list: R[];
|
|
41
|
-
|
|
39
|
+
pagination: {
|
|
42
40
|
page: number;
|
|
43
41
|
pageSize: number;
|
|
44
42
|
itemCount: number;
|
|
@@ -46,15 +44,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
46
44
|
filters: DataTableFilterState | undefined;
|
|
47
45
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
48
46
|
dataTableInst: DataTableInst | null;
|
|
49
|
-
pagination: vue70.Ref<{
|
|
50
|
-
page: number;
|
|
51
|
-
pageSize: number;
|
|
52
|
-
itemCount: number;
|
|
53
|
-
}, UseDataRequestPagination | {
|
|
54
|
-
page: number;
|
|
55
|
-
pageSize: number;
|
|
56
|
-
itemCount: number;
|
|
57
|
-
}>;
|
|
58
47
|
run: (...params: P[]) => void;
|
|
59
48
|
runAsync: (...params: P[]) => Promise<D>;
|
|
60
49
|
refresh: () => void;
|
|
@@ -78,7 +67,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
78
67
|
error: Error | undefined;
|
|
79
68
|
params: [] | P[];
|
|
80
69
|
list: R[];
|
|
81
|
-
|
|
70
|
+
pagination: {
|
|
82
71
|
page: number;
|
|
83
72
|
pageSize: number;
|
|
84
73
|
itemCount: number;
|
|
@@ -86,15 +75,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
86
75
|
filters: DataTableFilterState | undefined;
|
|
87
76
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
88
77
|
dataTableInst: DataTableInst | null;
|
|
89
|
-
pagination: vue70.Ref<{
|
|
90
|
-
page: number;
|
|
91
|
-
pageSize: number;
|
|
92
|
-
itemCount: number;
|
|
93
|
-
}, UseDataRequestPagination | {
|
|
94
|
-
page: number;
|
|
95
|
-
pageSize: number;
|
|
96
|
-
itemCount: number;
|
|
97
|
-
}>;
|
|
98
78
|
run: (...params: P[]) => void;
|
|
99
79
|
runAsync: (...params: P[]) => Promise<D>;
|
|
100
80
|
refresh: () => void;
|
|
@@ -116,7 +96,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
116
96
|
error: Error | undefined;
|
|
117
97
|
params: [] | P[];
|
|
118
98
|
list: R[];
|
|
119
|
-
|
|
99
|
+
pagination: {
|
|
120
100
|
page: number;
|
|
121
101
|
pageSize: number;
|
|
122
102
|
itemCount: number;
|
|
@@ -124,15 +104,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
124
104
|
filters: DataTableFilterState | undefined;
|
|
125
105
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
126
106
|
dataTableInst: DataTableInst | null;
|
|
127
|
-
pagination: vue70.Ref<{
|
|
128
|
-
page: number;
|
|
129
|
-
pageSize: number;
|
|
130
|
-
itemCount: number;
|
|
131
|
-
}, UseDataRequestPagination | {
|
|
132
|
-
page: number;
|
|
133
|
-
pageSize: number;
|
|
134
|
-
itemCount: number;
|
|
135
|
-
}>;
|
|
136
107
|
run: (...params: P[]) => void;
|
|
137
108
|
runAsync: (...params: P[]) => Promise<D>;
|
|
138
109
|
refresh: () => void;
|
|
@@ -154,7 +125,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
154
125
|
error: Error | undefined;
|
|
155
126
|
params: [] | P[];
|
|
156
127
|
list: R[];
|
|
157
|
-
|
|
128
|
+
pagination: {
|
|
158
129
|
page: number;
|
|
159
130
|
pageSize: number;
|
|
160
131
|
itemCount: number;
|
|
@@ -162,15 +133,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
162
133
|
filters: DataTableFilterState | undefined;
|
|
163
134
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
164
135
|
dataTableInst: DataTableInst | null;
|
|
165
|
-
pagination: vue70.Ref<{
|
|
166
|
-
page: number;
|
|
167
|
-
pageSize: number;
|
|
168
|
-
itemCount: number;
|
|
169
|
-
}, UseDataRequestPagination | {
|
|
170
|
-
page: number;
|
|
171
|
-
pageSize: number;
|
|
172
|
-
itemCount: number;
|
|
173
|
-
}>;
|
|
174
136
|
run: (...params: P[]) => void;
|
|
175
137
|
runAsync: (...params: P[]) => Promise<D>;
|
|
176
138
|
refresh: () => void;
|
|
@@ -192,7 +154,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
192
154
|
error: Error | undefined;
|
|
193
155
|
params: [] | P[];
|
|
194
156
|
list: R[];
|
|
195
|
-
|
|
157
|
+
pagination: {
|
|
196
158
|
page: number;
|
|
197
159
|
pageSize: number;
|
|
198
160
|
itemCount: number;
|
|
@@ -200,15 +162,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
200
162
|
filters: DataTableFilterState | undefined;
|
|
201
163
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
202
164
|
dataTableInst: DataTableInst | null;
|
|
203
|
-
pagination: vue70.Ref<{
|
|
204
|
-
page: number;
|
|
205
|
-
pageSize: number;
|
|
206
|
-
itemCount: number;
|
|
207
|
-
}, UseDataRequestPagination | {
|
|
208
|
-
page: number;
|
|
209
|
-
pageSize: number;
|
|
210
|
-
itemCount: number;
|
|
211
|
-
}>;
|
|
212
165
|
run: (...params: P[]) => void;
|
|
213
166
|
runAsync: (...params: P[]) => Promise<D>;
|
|
214
167
|
refresh: () => void;
|
|
@@ -230,7 +183,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
230
183
|
error: Error | undefined;
|
|
231
184
|
params: [] | P[];
|
|
232
185
|
list: R[];
|
|
233
|
-
|
|
186
|
+
pagination: {
|
|
234
187
|
page: number;
|
|
235
188
|
pageSize: number;
|
|
236
189
|
itemCount: number;
|
|
@@ -238,15 +191,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
238
191
|
filters: DataTableFilterState | undefined;
|
|
239
192
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
240
193
|
dataTableInst: DataTableInst | null;
|
|
241
|
-
pagination: vue70.Ref<{
|
|
242
|
-
page: number;
|
|
243
|
-
pageSize: number;
|
|
244
|
-
itemCount: number;
|
|
245
|
-
}, UseDataRequestPagination | {
|
|
246
|
-
page: number;
|
|
247
|
-
pageSize: number;
|
|
248
|
-
itemCount: number;
|
|
249
|
-
}>;
|
|
250
194
|
run: (...params: P[]) => void;
|
|
251
195
|
runAsync: (...params: P[]) => Promise<D>;
|
|
252
196
|
refresh: () => void;
|
|
@@ -268,7 +212,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
268
212
|
error: Error | undefined;
|
|
269
213
|
params: [] | P[];
|
|
270
214
|
list: R[];
|
|
271
|
-
|
|
215
|
+
pagination: {
|
|
272
216
|
page: number;
|
|
273
217
|
pageSize: number;
|
|
274
218
|
itemCount: number;
|
|
@@ -276,15 +220,6 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
276
220
|
filters: DataTableFilterState | undefined;
|
|
277
221
|
sorters: Record<string, DataTableSortState> | undefined;
|
|
278
222
|
dataTableInst: DataTableInst | null;
|
|
279
|
-
pagination: vue70.Ref<{
|
|
280
|
-
page: number;
|
|
281
|
-
pageSize: number;
|
|
282
|
-
itemCount: number;
|
|
283
|
-
}, UseDataRequestPagination | {
|
|
284
|
-
page: number;
|
|
285
|
-
pageSize: number;
|
|
286
|
-
itemCount: number;
|
|
287
|
-
}>;
|
|
288
223
|
run: (...params: P[]) => void;
|
|
289
224
|
runAsync: (...params: P[]) => Promise<D>;
|
|
290
225
|
refresh: () => void;
|
|
@@ -301,7 +236,7 @@ declare const __VLS_export: <P extends DataObject, D extends DataObject, R exten
|
|
|
301
236
|
}) => any;
|
|
302
237
|
};
|
|
303
238
|
emit: DataTablePlusEmits<P, D, R>;
|
|
304
|
-
}>) =>
|
|
239
|
+
}>) => vue60.VNode & {
|
|
305
240
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
306
241
|
};
|
|
307
242
|
declare const _default: typeof __VLS_export;
|