@oiij/naive-ui 0.0.76 → 0.0.78
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 +46 -111
- 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 +21 -21
- 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 +35 -39
- 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 +13 -13
- 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/BaseTransition.vue.d.ts +2 -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/index.d.ts +1 -1
- 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 +20 -5
- package/dist/composables/use-naive-menu.js +19 -61
- package/dist/composables/use-naive-theme.d.ts +27 -14
- package/dist/composables/use-naive-theme.js +22 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- 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 vue15 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: vue15.DefineComponent<ConfigProvidersProps, {}, {}, {}, {}, vue15.ComponentOptionsMixin, vue15.ComponentOptionsMixin, {}, string, vue15.PublicProps, Readonly<ConfigProvidersProps> & Readonly<{}>, {}, {}, {}, {}, string, vue15.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 vue63 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: vue63.DefineComponent<CopyButtonProps, {}, {}, {}, {}, vue63.ComponentOptionsMixin, vue63.ComponentOptionsMixin, {} & {
|
|
14
14
|
copied: (v: string | undefined) => any;
|
|
15
|
-
}, string,
|
|
15
|
+
}, string, vue63.PublicProps, Readonly<CopyButtonProps> & Readonly<{
|
|
16
16
|
onCopied?: ((v: string | undefined) => any) | undefined;
|
|
17
|
-
}>, {}, {}, {}, {}, string,
|
|
17
|
+
}>, {}, {}, {}, {}, string, vue63.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",
|