@oiij/naive-ui 0.0.75 → 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.
Files changed (62) hide show
  1. package/README.md +3 -3
  2. package/dist/components/config-providers/ConfigProviders.vue.d.ts +2 -2
  3. package/dist/components/config-providers/index.d.ts +16 -7
  4. package/dist/components/copy-button/CopyButton.js +3 -3
  5. package/dist/components/copy-button/CopyButton.vue.d.ts +4 -4
  6. package/dist/components/copy-button/index.d.ts +6 -3
  7. package/dist/components/data-table-plus/DataTablePlus.js +74 -125
  8. package/dist/components/data-table-plus/DataTablePlus.vue.d.ts +16 -81
  9. package/dist/components/data-table-plus/index.d.ts +52 -32
  10. package/dist/components/index.d.ts +2 -4
  11. package/dist/components/loading-provider/LoadingProvider.js +2 -2
  12. package/dist/components/loading-provider/LoadingProvider.vue.d.ts +2 -2
  13. package/dist/components/loading-provider/index.d.ts +19 -10
  14. package/dist/components/loading-provider/index.js +5 -2
  15. package/dist/components/preset-form/PresetForm.js +42 -21
  16. package/dist/components/preset-form/PresetForm.vue.d.ts +17 -17
  17. package/dist/components/preset-form/_utils.js +23 -8
  18. package/dist/components/preset-form/index.d.ts +32 -13
  19. package/dist/components/preset-input/PresetInput.vue.d.ts +3 -3
  20. package/dist/components/preset-input/index.d.ts +30 -20
  21. package/dist/components/preset-picker/PresetPicker.js +31 -34
  22. package/dist/components/preset-picker/PresetPicker.vue.d.ts +5 -10
  23. package/dist/components/preset-picker/index.d.ts +45 -31
  24. package/dist/components/preset-select/PresetSelect.js +23 -59
  25. package/dist/components/preset-select/PresetSelect.vue.d.ts +34 -38
  26. package/dist/components/preset-select/index.d.ts +56 -22
  27. package/dist/components/remote-request/RemoteRequest.js +7 -7
  28. package/dist/components/remote-request/RemoteRequest.vue.d.ts +7 -7
  29. package/dist/components/remote-request/index.d.ts +30 -8
  30. package/dist/components/search-input/SearchInput.js +1 -1
  31. package/dist/components/search-input/SearchInput.vue.d.ts +4 -4
  32. package/dist/components/search-input/index.d.ts +10 -7
  33. package/dist/components/toggle-input/ToggleInput.vue.d.ts +4 -4
  34. package/dist/components/tooltip-button/TooltipButton.vue.d.ts +4 -4
  35. package/dist/components/tooltip-button/index.d.ts +5 -2
  36. package/dist/components/transition/index.d.ts +4 -1
  37. package/dist/components.d.ts +2 -4
  38. package/dist/components.js +2 -3
  39. package/dist/composables/_helper.d.ts +7 -4
  40. package/dist/composables/_helper.js +47 -0
  41. package/dist/composables/index.d.ts +1 -1
  42. package/dist/composables/use-data-request.d.ts +27 -20
  43. package/dist/composables/use-data-request.js +23 -4
  44. package/dist/composables/use-loading.d.ts +6 -0
  45. package/dist/composables/use-loading.js +8 -2
  46. package/dist/composables/use-naive-form.d.ts +23 -15
  47. package/dist/composables/use-naive-form.js +49 -40
  48. package/dist/composables/use-naive-menu.d.ts +104 -0
  49. package/dist/composables/use-naive-menu.js +133 -0
  50. package/dist/composables/use-naive-theme.d.ts +27 -14
  51. package/dist/composables/use-naive-theme.js +22 -4
  52. package/dist/index.d.ts +2 -2
  53. package/dist/index.js +2 -2
  54. package/package.json +5 -7
  55. package/dist/components/_utils/prismjs.js +0 -16
  56. package/dist/components/icons/MageArrowUp.js +0 -29
  57. package/dist/components/type-writer/TypeWriter.js +0 -75
  58. package/dist/components/type-writer/TypeWriter.vue.d.ts +0 -22
  59. package/dist/components/type-writer/index.d.ts +0 -13
  60. package/dist/components/type-writer/type-writer.cssr.js +0 -27
  61. package/dist/composables/use-auto-menu.d.ts +0 -74
  62. package/dist/composables/use-auto-menu.js +0 -129
package/README.md CHANGED
@@ -60,7 +60,7 @@ yarn add @oiij/naive-ui
60
60
  ```vue
61
61
  <script setup>
62
62
  import type { RouteRecordRaw } from 'vue-router'
63
- import { useAutoMenu } from '@oiij/naive-ui'
63
+ import { useNaiveMenu } from '@oiij/naive-ui'
64
64
 
65
65
  // 模拟路由配置
66
66
  const routes: RouteRecordRaw[] = [
@@ -80,7 +80,7 @@ const routes: RouteRecordRaw[] = [
80
80
  }
81
81
  ]
82
82
 
83
- const { menuOptions } = useAutoMenu(routes)
83
+ const { menuOptions } = useNaiveMenu(routes)
84
84
  </script>
85
85
 
86
86
  <template>
@@ -94,7 +94,7 @@ const { menuOptions } = useAutoMenu(routes)
94
94
 
95
95
  ### 组合式 API
96
96
 
97
- - **use-auto-menu** 📋: 自动菜单生成
97
+ - **use-naive-menu** 📋: 自动菜单生成
98
98
  - **use-data-request** 📡: 数据请求管理
99
99
  - **use-loading** ⏳: 加载状态管理
100
100
  - **use-naive-form** 📝: 表单管理
@@ -1,12 +1,12 @@
1
1
  import { ConfigProvidersProps } from "./index.js";
2
- import * as vue25 from "vue";
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: vue25.DefineComponent<ConfigProvidersProps, {}, {}, {}, {}, vue25.ComponentOptionsMixin, vue25.ComponentOptionsMixin, {}, string, vue25.PublicProps, Readonly<ConfigProvidersProps> & Readonly<{}>, {}, {}, {}, {}, string, vue25.ComponentProvideOptions, false, {}, any>;
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
  }
@@ -1,6 +1,6 @@
1
1
  import MageCopyFill_default from "../icons/MageCopyFill.js";
2
- import { createBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
3
2
  import { useClipboard } from "@vueuse/core";
3
+ import { createBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
4
4
  import { NButton, NTooltip } from "naive-ui";
5
5
 
6
6
  //#region src/components/copy-button/CopyButton.vue
@@ -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 onClick(ev) {
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 vue44 from "vue";
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: vue44.DefineComponent<CopyButtonProps, {}, {}, {}, {}, vue44.ComponentOptionsMixin, vue44.ComponentOptionsMixin, {} & {
13
+ declare const __VLS_base: vue35.DefineComponent<CopyButtonProps, {}, {}, {}, {}, vue35.ComponentOptionsMixin, vue35.ComponentOptionsMixin, {} & {
14
14
  copied: (v: string | undefined) => any;
15
- }, string, vue44.PublicProps, Readonly<CopyButtonProps> & Readonly<{
15
+ }, string, vue35.PublicProps, Readonly<CopyButtonProps> & Readonly<{
16
16
  onCopied?: ((v: string | undefined) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, vue44.ComponentProvideOptions, false, {}, any>;
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, toValue, unref, useTemplateRef, withCtx } from "vue";
5
- import { NButton, NDataTable, NFlex, NPagination } from "naive-ui";
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
- onSuccessEffect(data, params);
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
- return __props.columns?.reduce((pre, cur) => {
131
- return pre + Number(cur.width ?? 100);
132
- }, 0);
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 onSuccessEffect(data, _params) {
135
- data[_fields.list]?.forEach((f) => {
136
- if (!_dataCache.some((s) => s?.[_fields.rowKey] === f?.[_fields.rowKey])) _dataCache.push(f);
137
- });
138
- if (columnsReactive) {
139
- for (const item of columnsReactive) if ("key" in item) {
140
- if (filtersRef.value && item.key in filtersRef.value) {
141
- const filterValues = filtersRef.value[item.key];
142
- if (filterValues && "filter" in item && item.filter) if (item.filterMultiple) if (Array.isArray(filterValues)) item.filterOptionValues = filterValues;
143
- else item.filterOptionValues = [filterValues];
144
- else if (Array.isArray(filterValues)) item.filterOptionValue = filterValues[0];
145
- else item.filterOptionValue = filterValues;
146
- }
147
- if ("sorter" in item) {
148
- if (typeof item.sorter === "boolean") item.sortOrder = false;
149
- }
150
- if (sortersRef.value && item.key in sortersRef.value) {
151
- const sorterValue = sortersRef.value[item.key];
152
- if (sorterValue && "sorter" in item && item.sorter) item.sortOrder = sorterValue.order;
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 _scrollTop = ref(0);
158
- const vOn = {
159
- onUpdatePage: (page) => {
140
+ const eventHandlers = {
141
+ handlePageUpdate: (page) => {
160
142
  emit("update:page", page);
161
- if (loading.value) return;
162
- runParams({ [_fields.page]: page });
143
+ if (!loading.value) runParams({ [_fields.page]: page });
163
144
  },
164
- onUpdatePageSize: (pageSize) => {
145
+ handlePageSizeUpdate: (pageSize) => {
165
146
  emit("update:pageSize", pageSize);
166
- if (loading.value) return;
167
- runParams({ [_fields.pageSize]: pageSize });
147
+ if (!loading.value) runParams({ [_fields.pageSize]: pageSize });
168
148
  },
169
- onUpdateFilters: (filters, initiatorColumn) => {
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
- onUpdateSorter: (options) => {
157
+ handleSorterUpdate: (options) => {
178
158
  emit("update:sorter", options);
179
159
  const sorter = {};
180
- if (Array.isArray(options)) for (const item of options) sorter[item.columnKey] = item;
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
- onLoad: (row) => {
189
- return emit("load", row);
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
- }, toRaw(list.value));
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", toRaw(row), index, event, toRaw(list.value));
182
+ emit("clickRow", rawRow, index, event, rawList);
209
183
  },
210
184
  onContextmenu: (event) => {
211
- emit("contextMenuRow", toRaw(row), index, event, toRaw(list.value));
185
+ emit("contextMenuRow", rawRow, index, event, rawList);
212
186
  }
213
187
  };
214
188
  }
215
- function onSearch(val) {
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: toValue(loading),
257
- data: toValue(data),
258
- error: toValue(error),
259
- params: toValue(params),
260
- list: toValue(list),
261
- paginationRef: toValue(paginationRef),
262
- filters: toValue(filtersRef),
263
- sorters: toValue(sortersRef),
264
- dataTableInst: toValue(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) => onSearch(val)) }), null, 16, ["value", "loading"])) : createCommentVNode("v-if", true),
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": vOn.onUpdateFilters,
312
- "onUpdate:sorter": vOn.onUpdateSorter,
313
- onLoad: vOn.onLoad,
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
- "onLoad",
331
- "onScroll",
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": vOn.onUpdatePage,
357
- "onUpdate:pageSize": vOn.onUpdatePageSize
305
+ "onUpdate:page": eventHandlers.handlePageUpdate,
306
+ "onUpdate:pageSize": eventHandlers.handlePageSizeUpdate
358
307
  }), null, 16, [
359
308
  "disabled",
360
309
  "onUpdate:page",