fast-element-plus 2.0.18 → 2.0.20

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 (130) hide show
  1. package/CHANGELOG.md +52 -19
  2. package/CONTRIBUTING.md +3 -4
  3. package/README.md +80 -27
  4. package/README.zh.md +66 -27
  5. package/dist/component.d.ts +123 -123
  6. package/dist/components/avatar/src/avatar.d.ts +26 -26
  7. package/dist/components/avatar/src/avatar.mjs +10 -10
  8. package/dist/components/avatar/src/avatar.mjs.map +1 -1
  9. package/dist/components/button/src/button.d.ts +32 -27
  10. package/dist/components/button/src/button.mjs +57 -36
  11. package/dist/components/button/src/button.mjs.map +1 -1
  12. package/dist/components/carNumber/src/carNumber.d.ts +8 -8
  13. package/dist/components/carNumber/src/carNumber.mjs +5 -5
  14. package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
  15. package/dist/components/contextMenu/src/contextMenu.d.ts +7 -7
  16. package/dist/components/contextMenu/src/contextMenu.mjs +7 -7
  17. package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
  18. package/dist/components/contextMenu/src/contextMenu.type.d.ts +7 -7
  19. package/dist/components/dialog/src/dialog.d.ts +76 -76
  20. package/dist/components/dialog/src/dialog.mjs +34 -34
  21. package/dist/components/dialog/src/dialog.mjs.map +1 -1
  22. package/dist/components/drawer/src/drawer.d.ts +59 -59
  23. package/dist/components/drawer/src/drawer.mjs +27 -27
  24. package/dist/components/drawer/src/drawer.mjs.map +1 -1
  25. package/dist/components/form/src/form.d.ts +30 -30
  26. package/dist/components/form/src/form.mjs +16 -16
  27. package/dist/components/form/src/form.mjs.map +1 -1
  28. package/dist/components/form/src/formItem.d.ts +30 -30
  29. package/dist/components/form/src/formItem.mjs +13 -13
  30. package/dist/components/form/src/formItem.mjs.map +1 -1
  31. package/dist/components/formItemTip/src/formItemTip.d.ts +9 -9
  32. package/dist/components/formItemTip/src/formItemTip.mjs +3 -3
  33. package/dist/components/formItemTip/src/formItemTip.mjs.map +1 -1
  34. package/dist/components/icon/src/icon.d.ts +10 -10
  35. package/dist/components/icon/src/icon.mjs +4 -4
  36. package/dist/components/icon/src/icon.mjs.map +1 -1
  37. package/dist/components/iconSelector/src/iconSelector.d.ts +6 -6
  38. package/dist/components/iconSelector/src/iconSelector.mjs +4 -4
  39. package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
  40. package/dist/components/image/src/image.d.ts +36 -36
  41. package/dist/components/image/src/image.mjs +11 -11
  42. package/dist/components/image/src/image.mjs.map +1 -1
  43. package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +37 -37
  44. package/dist/components/inputDialogPage/src/inputDialogPage.mjs +16 -16
  45. package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
  46. package/dist/components/layoutGrid/src/layoutGrid.d.ts +12 -12
  47. package/dist/components/layoutGrid/src/layoutGrid.mjs +6 -6
  48. package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
  49. package/dist/components/layoutGrid/src/layoutGridItem.d.ts +19 -19
  50. package/dist/components/layoutGrid/src/layoutGridItem.mjs +9 -9
  51. package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
  52. package/dist/components/select/src/select.d.ts +89 -89
  53. package/dist/components/select/src/select.mjs +30 -30
  54. package/dist/components/select/src/select.mjs.map +1 -1
  55. package/dist/components/select/src/selectOption.d.ts +13 -13
  56. package/dist/components/select/src/selectOption.mjs +6 -6
  57. package/dist/components/select/src/selectOption.mjs.map +1 -1
  58. package/dist/components/selectPage/src/selectPage.d.ts +76 -76
  59. package/dist/components/selectPage/src/selectPage.mjs +50 -36
  60. package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
  61. package/dist/components/selectV2/index.mjs +2 -1
  62. package/dist/components/selectV2/index.mjs.map +1 -1
  63. package/dist/components/selectV2/src/selectV2.d.ts +161 -852
  64. package/dist/components/selectV2/src/selectV2.mjs +32 -340
  65. package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
  66. package/dist/components/table/index.mjs +3 -2
  67. package/dist/components/table/index.mjs.map +1 -1
  68. package/dist/components/table/src/page.type.d.ts +1 -1
  69. package/dist/components/table/src/table.d.ts +211 -744
  70. package/dist/components/table/src/table.mjs +111 -307
  71. package/dist/components/table/src/table.mjs.map +1 -1
  72. package/dist/components/table/src/table.state.d.ts +3 -3
  73. package/dist/components/table/src/table.type.d.ts +1 -9
  74. package/dist/components/table/src/table.type.mjs.map +1 -1
  75. package/dist/components/table/src/tableColumn.d.ts +102 -399
  76. package/dist/components/table/src/tableColumn.mjs +28 -185
  77. package/dist/components/table/src/tableColumn.mjs.map +1 -1
  78. package/dist/components/table/src/tableColumnSettingDialog.d.ts +4 -4
  79. package/dist/components/table/src/tableColumnSettingDialog.mjs +3 -3
  80. package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
  81. package/dist/components/table/src/tablePagination.d.ts +4 -4
  82. package/dist/components/table/src/tablePagination.mjs +3 -3
  83. package/dist/components/table/src/tablePagination.mjs.map +1 -1
  84. package/dist/components/table/src/tableSearchForm.d.ts +12 -12
  85. package/dist/components/table/src/tableSearchForm.mjs +6 -6
  86. package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
  87. package/dist/components/table/src/tableSearchFormItem.d.ts +4 -4
  88. package/dist/components/table/src/tableSearchFormItem.mjs +2 -2
  89. package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
  90. package/dist/components/table/src/useTable.d.ts +1 -0
  91. package/dist/components/table/src/useTable.mjs +109 -65
  92. package/dist/components/table/src/useTable.mjs.map +1 -1
  93. package/dist/components/table/utils/table.d.ts +4 -4
  94. package/dist/components/table/utils/table.mjs +4 -4
  95. package/dist/components/table/utils/table.mjs.map +1 -1
  96. package/dist/components/tree/src/tree.d.ts +87 -87
  97. package/dist/components/tree/src/tree.mjs +48 -48
  98. package/dist/components/tree/src/tree.mjs.map +1 -1
  99. package/dist/components/treeSelect/src/treeSelect.d.ts +139 -133
  100. package/dist/components/treeSelect/src/treeSelect.mjs +57 -57
  101. package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
  102. package/dist/components/upload/src/upload.d.ts +36 -36
  103. package/dist/components/upload/src/upload.mjs +19 -19
  104. package/dist/components/upload/src/upload.mjs.map +1 -1
  105. package/dist/components/uploadImage/src/uploadImage.d.ts +47 -47
  106. package/dist/components/uploadImage/src/uploadImage.mjs +24 -28
  107. package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
  108. package/dist/components/uploadImages/src/uploadImages.d.ts +41 -41
  109. package/dist/components/uploadImages/src/uploadImages.mjs +21 -21
  110. package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
  111. package/dist/directives/click-debounce/index.mjs +19 -11
  112. package/dist/directives/click-debounce/index.mjs.map +1 -1
  113. package/dist/directives/click-throttle/index.d.ts +4 -2
  114. package/dist/directives/click-throttle/index.mjs +21 -11
  115. package/dist/directives/click-throttle/index.mjs.map +1 -1
  116. package/dist/index.css +1 -1
  117. package/dist/index.css.map +1 -1
  118. package/dist/index.global.min.js +3 -3
  119. package/dist/index.global.min.js.map +1 -1
  120. package/dist/index.mjs +3 -3
  121. package/dist/internal/props.d.ts +685 -0
  122. package/dist/internal/props.mjs +683 -0
  123. package/dist/internal/props.mjs.map +1 -0
  124. package/dist/utils/loading-tasks.d.ts +5 -0
  125. package/dist/utils/loading-tasks.mjs +32 -0
  126. package/dist/utils/loading-tasks.mjs.map +1 -0
  127. package/dist/version.d.ts +1 -1
  128. package/dist/version.mjs +1 -1
  129. package/dist/version.mjs.map +1 -1
  130. package/package.json +5 -10
@@ -6,6 +6,7 @@ import { useExpose } from "../../../utils/vue/expose.mjs";
6
6
  import { definePropType, useProps } from "../../../utils/vue/props.mjs";
7
7
  import { useRender } from "../../../utils/vue/render.mjs";
8
8
  import { makeSlots } from "../../../utils/vue/slots.mjs";
9
+ import { tableProps } from "../../../internal/props.mjs";
9
10
  import { tableUtil } from "../utils/table.mjs";
10
11
  import { getTableDefaultSlots } from "./table.type.mjs";
11
12
  import { useTable } from "./useTable.mjs";
@@ -14,237 +15,29 @@ import tableColumnSettingDialog_default from "./tableColumnSettingDialog.mjs";
14
15
  import tablePagination_default from "./tablePagination.mjs";
15
16
  import tableSearchForm_default from "./tableSearchForm.mjs";
16
17
  import { NotData } from "@fast-element-plus/icons-vue";
17
- import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, onActivated, onMounted, resolveDirective, shallowRef, watch, watchEffect, withDirectives } from "vue";
18
+ import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, onActivated, onBeforeUnmount, onMounted, resolveDirective, shallowRef, watch, watchEffect, withDirectives } from "vue";
18
19
  import { Eleme, More, Refresh, Search, Setting } from "@element-plus/icons-vue";
19
- import { ElButton, ElDatePicker, ElDropdown, ElDropdownItem, ElDropdownMenu, ElIcon, ElImageViewer, ElInput, ElPagination, ElTable, ElTableColumn, useSizeProp } from "element-plus";
20
+ import { ElButton, ElDatePicker, ElDropdown, ElDropdownItem, ElDropdownMenu, ElIcon, ElImageViewer, ElInput, ElPagination, ElTable, ElTableColumn } from "element-plus";
20
21
  //#region src/components/table/src/table.tsx
21
- /** Element Plus Table 的透传 Props 定义。 */
22
- const tableProps = {
23
- /**
24
- * @description table data
25
- */
26
- data: {
27
- type: Array,
28
- default: () => []
29
- },
30
- /**
31
- * @description size of Table
32
- */
33
- size: useSizeProp,
34
- width: [String, Number],
35
- /**
36
- * @description table's height. By default it has an `auto` height. If its value is a number, the height is measured in pixels; if its value is a string, the value will be assigned to element's style.height, the height is affected by external styles
37
- */
38
- height: [String, Number],
39
- /**
40
- * @description table's max-height. The legal value is a number or the height in px
41
- */
42
- maxHeight: [String, Number],
43
- /**
44
- * @description whether width of column automatically fits its container
45
- */
46
- fit: {
47
- type: Boolean,
48
- default: true
49
- },
50
- /**
51
- * @description whether Table is striped
52
- */
53
- stripe: Boolean,
54
- /**
55
- * @description whether Table has vertical border
56
- */
57
- border: Boolean,
58
- /**
59
- * @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used
60
- */
61
- rowKey: [String, Function],
62
- /**
63
- * @description whether Table header is visible
64
- */
65
- showHeader: {
66
- type: Boolean,
67
- default: true
68
- },
69
- /**
70
- * @description whether to display a summary row
71
- */
72
- showSummary: Boolean,
73
- /**
74
- * @description displayed text for the first column of summary row
75
- */
76
- sumText: String,
77
- /**
78
- * @description custom summary method
79
- */
80
- summaryMethod: Function,
81
- /**
82
- * @description function that returns custom class names for a row, or a string assigning class names for every row
83
- */
84
- rowClassName: [String, Function],
85
- /**
86
- * @description function that returns custom style for a row, or an object assigning custom style for every row
87
- */
88
- rowStyle: [Object, Function],
89
- /**
90
- * @description function that returns custom class names for a cell, or a string assigning class names for every cell
91
- */
92
- cellClassName: [String, Function],
93
- /**
94
- * @description function that returns custom style for a cell, or an object assigning custom style for every cell
95
- */
96
- cellStyle: [Object, Function],
97
- /**
98
- * @description function that returns custom class names for a row in table header, or a string assigning class names for every row in table header
99
- */
100
- headerRowClassName: [String, Function],
101
- /**
102
- * @description function that returns custom style for a row in table header, or an object assigning custom style for every row in table header
103
- */
104
- headerRowStyle: [Object, Function],
105
- /**
106
- * @description function that returns custom class names for a cell in table header, or a string assigning class names for every cell in table header
107
- */
108
- headerCellClassName: [String, Function],
109
- /**
110
- * @description function that returns custom style for a cell in table header, or an object assigning custom style for every cell in table header
111
- */
112
- headerCellStyle: [Object, Function],
113
- /**
114
- * @description whether current row is highlighted
115
- */
116
- highlightCurrentRow: Boolean,
117
- /**
118
- * @description key of current row, a set only prop
119
- */
120
- currentRowKey: [String, Number],
121
- /**
122
- * @description displayed text when data is empty. You can customize this area with `#empty`
123
- */
124
- emptyText: String,
125
- /**
126
- * @description set expanded rows by this prop, prop's value is the keys of expand rows, you should set row-key before using this prop
127
- */
128
- expandRowKeys: Array,
129
- /** @description controls whether a row can be expanded */
130
- rowExpandable: Function,
131
- /**
132
- * @description whether expand all rows by default, works when the table has a column type="expand" or contains tree structure data
133
- */
134
- defaultExpandAll: Boolean,
135
- /**
136
- * @description set the default sort column and order. property `prop` is used to set default sort column, property `order` is used to set default sort order
137
- */
138
- defaultSort: Object,
139
- /**
140
- * @description the `effect` of the overflow tooltip
141
- */
142
- tooltipEffect: String,
143
- /**
144
- * @description the options for the overflow tooltip, [see the following tooltip component](tooltip.html#attributes)
145
- */
146
- tooltipOptions: Object,
147
- /**
148
- * @description method that returns rowspan and colspan
149
- */
150
- spanMethod: Function,
151
- /**
152
- * @description controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected
153
- */
154
- selectOnIndeterminate: {
155
- type: Boolean,
156
- default: true
157
- },
158
- /**
159
- * @description horizontal indentation of tree data
160
- */
161
- indent: {
162
- type: Number,
163
- default: 16
164
- },
165
- /**
166
- * @description configuration for rendering nested data
167
- */
168
- treeProps: {
169
- type: Object,
170
- default: () => ({
171
- hasChildren: "hasChildren",
172
- children: "children",
173
- checkStrictly: false
174
- })
175
- },
176
- /**
177
- * @description whether to lazy loading data
178
- */
179
- lazy: Boolean,
180
- /**
181
- * @description method for loading child row data, only works when `lazy` is true
182
- */
183
- load: Function,
184
- style: {
185
- type: Object,
186
- default: () => ({})
187
- },
188
- className: {
189
- type: String,
190
- default: ""
191
- },
192
- /**
193
- * @description sets the algorithm used to lay out table cells, rows, and columns
194
- */
195
- tableLayout: {
196
- type: String,
197
- default: "fixed"
198
- },
199
- /**
200
- * @description always show scrollbar
201
- */
202
- scrollbarAlwaysOn: Boolean,
203
- /**
204
- * @description ensure main axis minimum-size doesn't follow the content
205
- */
206
- flexible: Boolean,
207
- /**
208
- * @description whether to hide extra content and show them in a tooltip when hovering on the cell.It will affect all the table columns
209
- */
210
- showOverflowTooltip: [Boolean, Object],
211
- /** @description formats overflow tooltip content */
212
- tooltipFormatter: Function,
213
- /** @description element to which the filter panel is appended */
214
- appendFilterPanelTo: String,
215
- scrollbarTabindex: {
216
- type: [Number, String],
217
- default: void 0
218
- },
219
- /** @description whether the last column can be resized */
220
- allowDragLastColumn: {
221
- type: Boolean,
222
- default: true
223
- },
224
- /** @description whether collapsed expanded-row content remains mounted */
225
- preserveExpandedContent: Boolean,
226
- /** @description whether to use native scrollbars */
227
- nativeScrollbar: Boolean
228
- };
229
- /** FaTable 的运行时 Props 定义。 */
22
+ /** FaTable 的运行时 Props 定义 */
230
23
  const faTableProps = {
231
24
  ...tableProps,
232
- /** @description whether Table has vertical border */
25
+ /** whether Table has vertical border */
233
26
  border: {
234
27
  type: Boolean,
235
28
  default: true
236
29
  },
237
- /** @description whether current row is highlighted */
30
+ /** whether current row is highlighted */
238
31
  highlightCurrentRow: {
239
32
  type: Boolean,
240
33
  default: true
241
34
  },
242
- /** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
35
+ /** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
243
36
  rowKey: {
244
37
  type: [String, Function],
245
38
  default: "id"
246
39
  },
247
- /** @description 组件封装,原生的已经失效 method that returns rowspan and colspan */
40
+ /** 组件封装,原生的已经失效 method that returns rowspan and colspan */
248
41
  spanMethod: {
249
42
  type: Function,
250
43
  validator: () => {
@@ -252,19 +45,19 @@ const faTableProps = {
252
45
  return false;
253
46
  }
254
47
  },
255
- /** @description 表格Key */
48
+ /** 表格Key */
256
49
  tableKey: {
257
50
  type: String,
258
51
  default: () => randomString(8)
259
52
  },
260
- /** @description 表格数据 */
53
+ /** 表格数据 */
261
54
  data: {
262
55
  type: definePropType(Array),
263
56
  default: () => []
264
57
  },
265
- /** @description 请求api */
58
+ /** 请求数据的函数 */
266
59
  requestApi: { type: definePropType(Function) },
267
- /** @description 接口请求数据回调 */
60
+ /** 接口请求数据回调 */
268
61
  dataCallback: { type: definePropType(Function) },
269
62
  /** 初始化参数 */
270
63
  initParam: definePropType([
@@ -272,14 +65,14 @@ const faTableProps = {
272
65
  Number,
273
66
  Object
274
67
  ]),
275
- /** @description 列配置 */
68
+ /** 列配置 */
276
69
  columns: {
277
70
  type: definePropType([Array, Boolean]),
278
71
  default: () => false
279
72
  },
280
- /** @description 表格列改变 */
73
+ /** 表格列改变 */
281
74
  columnsChange: { type: definePropType(Function) },
282
- /** @description 搜索表单 Grid布局列配置 */
75
+ /** 搜索表单 Grid布局列配置 */
283
76
  searchFormCols: {
284
77
  type: definePropType([
285
78
  String,
@@ -294,61 +87,61 @@ const faTableProps = {
294
87
  xl: 6
295
88
  })
296
89
  },
297
- /** @description 折叠搜素 */
90
+ /** 折叠搜索 */
298
91
  collapsedSearch: {
299
92
  type: Boolean,
300
93
  default: true
301
94
  },
302
- /** @description 高级搜素抽屉 */
95
+ /** 高级搜索抽屉 */
303
96
  advancedSearchDrawer: {
304
97
  type: Boolean,
305
98
  default: false
306
99
  },
307
- /** @description 搜索表单 */
100
+ /** 搜索表单 */
308
101
  searchForm: {
309
102
  type: Boolean,
310
103
  default: true
311
104
  },
312
- /** @description 头部卡片 */
105
+ /** 头部卡片 */
313
106
  headerCard: {
314
107
  type: Boolean,
315
108
  default: true
316
109
  },
317
- /** @description 刷新按钮 */
110
+ /** 刷新按钮 */
318
111
  refreshBtn: {
319
112
  type: Boolean,
320
113
  default: true
321
114
  },
322
- /** @description 搜索按钮 */
115
+ /** 搜索按钮 */
323
116
  searchBtn: {
324
117
  type: Boolean,
325
118
  default: true
326
119
  },
327
- /** @description 列配置按钮 */
120
+ /** 列配置按钮 */
328
121
  columnSettingBtn: {
329
122
  type: Boolean,
330
123
  default: false
331
124
  },
332
- /** @description 头部卡片右侧功能按钮 */
125
+ /** 头部卡片右侧功能按钮 */
333
126
  toolBtn: {
334
127
  type: Boolean,
335
128
  default: true
336
129
  },
337
- /** @description 隐藏搜索时间 */
130
+ /** 隐藏搜索时间 */
338
131
  hideSearchTime: Boolean,
339
- /** @description 未来搜索时间 */
132
+ /** 未来搜索时间 */
340
133
  futureSearchTime: Boolean,
341
- /** @description 搜索时间范围 */
134
+ /** 搜索时间范围 */
342
135
  dataSearchRange: {
343
136
  type: definePropType(String),
344
137
  default: "Past3D"
345
138
  },
346
- /** @description 分页 */
139
+ /** 分页 */
347
140
  pagination: {
348
141
  type: Boolean,
349
142
  default: true
350
143
  },
351
- /** @description 页码 */
144
+ /** 页码 */
352
145
  pageSizes: {
353
146
  type: definePropType(Array),
354
147
  default: [
@@ -358,15 +151,15 @@ const faTableProps = {
358
151
  100
359
152
  ]
360
153
  },
361
- /** @description 隐藏图片 */
154
+ /** 隐藏图片 */
362
155
  hideImage: Boolean,
363
- /** @description 单选 */
156
+ /** 单选 */
364
157
  single: Boolean,
365
- /** @description 行点击选择 */
158
+ /** 行点击选择 */
366
159
  rowClickSelection: Boolean,
367
- /** @description 将父级数据的 children 展开为表格行,并把父级字段合并到子项;Element Plus 树表无需启用 */
160
+ /** 将父级数据的 children 展开为表格行,并把父级字段合并到子项;Element Plus 树表无需启用 */
368
161
  treeData: Boolean,
369
- /** @description 配置选项 */
162
+ /** 配置选项 */
370
163
  props: {
371
164
  type: definePropType(Object),
372
165
  default: () => ({
@@ -374,66 +167,66 @@ const faTableProps = {
374
167
  children: "children"
375
168
  })
376
169
  },
377
- /** @description 自动刷新,当传入 data 时候,如果存在更改则自动刷新 */
170
+ /** 自动刷新,当传入 data 时候,如果存在更改则自动刷新 */
378
171
  autoRefresh: {
379
172
  type: Boolean,
380
173
  default: true
381
174
  },
382
175
  /**
383
176
  * 等价于 Table-Column 的 selectable
384
- * @description function that determines if a certain row can be selected, works when `type` is 'selection'
177
+ * function that determines if a certain row can be selected, works when `type` is 'selection'
385
178
  */
386
179
  rowSelectable: Function
387
180
  };
388
- /** FaTable 的运行时 Emits 定义。 */
181
+ /** FaTable 的运行时 Emits 定义 */
389
182
  const faTableEmits = {
390
- /** @description 当用户手动勾选数据行的 Checkbox 时触发的事件 */
183
+ /** 当用户手动勾选数据行的 Checkbox 时触发的事件 */
391
184
  select: (selection, row) => Array.isArray(selection) && typeof row === "object" && row !== null,
392
- /** @description 当用户手动勾选全选 Checkbox 时触发的事件 */
185
+ /** 当用户手动勾选全选 Checkbox 时触发的事件 */
393
186
  selectAll: (selection) => Array.isArray(selection),
394
- /** @description 当选择项发生变化时会触发该事件 */
187
+ /** 当选择项发生变化时会触发该事件 */
395
188
  selectionChange: (newSelection) => Array.isArray(newSelection),
396
- /** @description 当单元格 hover 进入时会触发该事件 */
189
+ /** 当单元格 hover 进入时会触发该事件 */
397
190
  cellMouseEnter: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
398
- /** @description 当单元格 hover 退出时会触发该事件 */
191
+ /** 当单元格 hover 退出时会触发该事件 */
399
192
  cellMouseLeave: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
400
- /** @description 当某个单元格被点击时会触发该事件 */
193
+ /** 当某个单元格被点击时会触发该事件 */
401
194
  cellClick: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
402
- /** @description 当某个单元格被双击击时会触发该事件 */
195
+ /** 当某个单元格被双击击时会触发该事件 */
403
196
  cellDblclick: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
404
- /** @description 当某个单元格被鼠标右键点击时会触发该事件 */
197
+ /** 当某个单元格被鼠标右键点击时会触发该事件 */
405
198
  cellContextmenu: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
406
- /** @description 当某一行被点击时会触发该事件 */
199
+ /** 当某一行被点击时会触发该事件 */
407
200
  rowClick: (row, column, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && event instanceof Event,
408
- /** @description 当某一行被鼠标右键点击时会触发该事件 */
201
+ /** 当某一行被鼠标右键点击时会触发该事件 */
409
202
  rowContextmenu: (row, column, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && event instanceof Event,
410
- /** @description 当某一行被双击时会触发该事件 */
203
+ /** 当某一行被双击时会触发该事件 */
411
204
  rowDblclick: (row, column, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && event instanceof Event,
412
- /** @description 当某一列的表头被点击时会触发该事件 */
205
+ /** 当某一列的表头被点击时会触发该事件 */
413
206
  headerClick: (column, event) => typeof column === "object" && column !== null && event instanceof Event,
414
- /** @description 当某一列的表头被鼠标右键点击时触发该事件 */
207
+ /** 当某一列的表头被鼠标右键点击时触发该事件 */
415
208
  headerContextmenu: (column, event) => typeof column === "object" && column !== null && event instanceof Event,
416
- /** @description 当表格的排序条件发生变化的时候会触发该事件 */
209
+ /** 当表格的排序条件发生变化的时候会触发该事件 */
417
210
  sortChange: (data) => typeof data === "object" && data !== null,
418
- /** @description column 的 key, 如果需要使用 filter-change 事件,则需要此属性标识是哪个 column 的筛选条件 */
211
+ /** column 的 key, 如果需要使用 filter-change 事件,则需要此属性标识是哪个 column 的筛选条件 */
419
212
  filterChange: (newFilters) => typeof newFilters === "object" && newFilters !== null,
420
- /** @description 当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性 */
213
+ /** 当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性 */
421
214
  currentChange: (currentRow, oldCurrentRow) => typeof currentRow === "object" && currentRow !== null && (oldCurrentRow === null || typeof oldCurrentRow === "object" && oldCurrentRow !== null),
422
- /** @description 当拖动表头改变了列的宽度的时候会触发该事件 */
215
+ /** 当拖动表头改变了列的宽度的时候会触发该事件 */
423
216
  headerDragend: (newWidth, oldWidth, column, event) => typeof newWidth === "number" && typeof oldWidth === "number" && typeof column === "object" && column !== null && event instanceof MouseEvent,
424
- /** @description 当用户对某一行展开或者关闭的时候会触发该事件(展开行时,回调的第二个参数为 expandedRows;树形表格时第二参数为 expanded) */
217
+ /** 当用户对某一行展开或者关闭的时候会触发该事件(展开行时,回调的第二个参数为 expandedRows;树形表格时第二参数为 expanded) */
425
218
  expandChange: (row, expanded) => typeof row === "object" && row !== null && (typeof expanded === "boolean" || Array.isArray(expanded)),
426
- /** @description 表格滚动时触发 */
219
+ /** 表格滚动时触发 */
427
220
  scroll: (data) => typeof data === "object" && data !== null,
428
- /** @description 表格刷新事件 */
221
+ /** 表格刷新事件 */
429
222
  refresh: (params) => typeof params === "object" && params !== null,
430
- /** @description 表格重置事件 */
223
+ /** 表格重置事件 */
431
224
  reset: (params) => typeof params === "object" && params !== null,
432
- /** @description 分页页码改变事件 */
225
+ /** 分页页码改变事件 */
433
226
  sizeChange: (pageSize) => typeof pageSize === "number",
434
- /** @description 分页改变事件 */
227
+ /** 分页改变事件 */
435
228
  paginationChange: (pageIndex, pageSize) => typeof pageIndex === "number" && typeof pageSize === "number",
436
- /** @description 自定义单元格点击事件 */
229
+ /** 自定义单元格点击事件 */
437
230
  customCellClick: (emitName, { row, column, $index }) => (emitName == null || typeof emitName === "string") && typeof row === "object" && row !== null && typeof column === "object" && column !== null && typeof $index === "number"
438
231
  };
439
232
  var table_default = defineComponent({
@@ -443,9 +236,15 @@ var table_default = defineComponent({
443
236
  slots: makeSlots(),
444
237
  setup(props, { slots, emit, expose }) {
445
238
  const columnSettingRef = shallowRef(null);
446
- const { globalSize, state, elementRef, tableRef, handleTableColumnAutoWidth, loadTableColumns, handleSizeChange, handlePaginationChange, defaultSearchTime, tableSearch, tableReset, doRender, doLoading, handleCustomCellClick } = useTable(props, slots, emit);
239
+ const { globalSize, state, elementRef, tableRef, handleTableColumnAutoWidth, loadTableColumns, handleSizeChange, handlePaginationChange, defaultSearchTime, tableSearch, tableReset, doRender, setManualLoading, doLoading, handleCustomCellClick } = useTable(props, slots, emit);
447
240
  const notifyColumnsChange = debounce(() => props.columnsChange?.(state.orgColumns), 500);
448
241
  const resizeTableColumns = debounce(handleTableColumnAutoWidth, 100);
242
+ const unmountedError = /* @__PURE__ */ new Error("FaTable 已卸载,列布局任务已取消。");
243
+ const reportColumnTask = (task) => {
244
+ task.catch((error) => {
245
+ if (error !== unmountedError) console.error("FaTable 列更新失败。", error);
246
+ });
247
+ };
449
248
  let lastRowIndex = 0;
450
249
  const getInitParam = () => {
451
250
  return typeof props.initParam === "object" && props.initParam !== null ? props.initParam : {};
@@ -586,7 +385,7 @@ var table_default = defineComponent({
586
385
  return "";
587
386
  };
588
387
  const handleSpanMethod = ({ column, rowIndex }) => {
589
- /** @description 原生的 span-method 会失效 */
388
+ /** 原生的 span-method 会失效 */
590
389
  const property = column.property;
591
390
  const columnKey = column.columnKey;
592
391
  const pKey = property ?? columnKey;
@@ -618,7 +417,7 @@ var table_default = defineComponent({
618
417
  }
619
418
  });
620
419
  emit("headerDragend", newWidth, oldWidth, column, event);
621
- if (props.columnsChange) notifyColumnsChange();
420
+ if (props.columnsChange) reportColumnTask(notifyColumnsChange());
622
421
  };
623
422
  const handleImagePreview = (url) => {
624
423
  state.previewList = [url];
@@ -651,7 +450,7 @@ var table_default = defineComponent({
651
450
  watch(() => props.data, () => {
652
451
  if (!props.requestApi && props.autoRefresh) return tableSearch();
653
452
  }, { deep: true });
654
- watchEffect(() => {
453
+ watchEffect((onCleanup) => {
655
454
  const element = elementRef.value;
656
455
  if (element) {
657
456
  const observer = new ResizeObserver((entries) => {
@@ -660,15 +459,17 @@ var table_default = defineComponent({
660
459
  const widthChanged = state.tableWidth !== width;
661
460
  state.tableWidth = width;
662
461
  state.tableHeight = height;
663
- if (widthChanged) resizeTableColumns();
462
+ if (widthChanged) reportColumnTask(resizeTableColumns());
664
463
  }
665
464
  });
666
465
  observer.observe(element);
667
- return () => {
668
- observer.disconnect();
669
- };
466
+ onCleanup(() => observer.disconnect());
670
467
  }
671
468
  });
469
+ onBeforeUnmount(() => {
470
+ notifyColumnsChange.cancel(unmountedError);
471
+ resizeTableColumns.cancel(unmountedError);
472
+ });
672
473
  onMounted(async () => {
673
474
  state.initParam = getInitParam();
674
475
  defaultSearchTime();
@@ -936,67 +737,70 @@ var table_default = defineComponent({
936
737
  }, null)
937
738
  ]));
938
739
  return useExpose(expose, {
939
- /** @description 用于多选表格,清空用户的选择 */
740
+ /** 用于多选表格,清空用户的选择 */
940
741
  clearSelection: computed(() => tableRef.value?.clearSelection),
941
- /** @description 返回当前选中的行 */
742
+ /** 返回当前选中的行 */
942
743
  getSelectionRows: computed(() => tableRef.value?.getSelectionRows),
943
- /** @description 返回当前半选中的行。 */
744
+ /** 返回当前半选中的行。 */
944
745
  getHalfSelectionRows: computed(() => tableRef.value?.getHalfSelectionRows),
945
- /** @description 用于多选表格,切换某一行的选中状态, 如果使用了第二个参数,则可直接设置这一行选中与否 */
746
+ /** 用于多选表格,切换某一行的选中状态, 如果使用了第二个参数,则可直接设置这一行选中与否 */
946
747
  toggleRowSelection: computed(() => tableRef.value?.toggleRowSelection),
947
- /** @description 用于多选表格,切换全选和全不选 */
748
+ /** 用于多选表格,切换全选和全不选 */
948
749
  toggleAllSelection: computed(() => tableRef.value?.toggleAllSelection),
949
- /** @description 用于可扩展的表格或树表格,如果某行被扩展,则切换。 使用第二个参数,您可以直接设置该行应该被扩展或折叠。 */
750
+ /** 用于可扩展的表格或树表格,如果某行被扩展,则切换。 使用第二个参数,您可以直接设置该行应该被扩展或折叠。 */
950
751
  toggleRowExpansion: computed(() => tableRef.value?.toggleRowExpansion),
951
- /** @description 用于单选表格,设定某一行为选中行, 如果调用时不加参数,则会取消目前高亮行的选中状态。 */
752
+ /** 用于单选表格,设定某一行为选中行, 如果调用时不加参数,则会取消目前高亮行的选中状态。 */
952
753
  setCurrentRow: computed(() => tableRef.value?.setCurrentRow),
953
- /** @description 用于清空排序条件,数据会恢复成未排序的状态 */
754
+ /** 用于清空排序条件,数据会恢复成未排序的状态 */
954
755
  clearSort: computed(() => tableRef.value?.clearSort),
955
- /** @description 传入由columnKey 组成的数组以清除指定列的过滤条件。 如果没有参数,清除所有过滤器 */
756
+ /** 传入由columnKey 组成的数组以清除指定列的过滤条件。 如果没有参数,清除所有过滤器 */
956
757
  clearFilter: computed(() => tableRef.value?.clearFilter),
957
- /** @description 对 Table 进行重新布局。 当表格可见性变化时,您可能需要调用此方法以获得正确的布局 */
758
+ /** 对 Table 进行重新布局。 当表格可见性变化时,您可能需要调用此方法以获得正确的布局 */
958
759
  doLayout: computed(() => tableRef.value?.doLayout),
959
- /** @description 手动排序表格。 参数 prop 属性指定排序列,order 指定排序顺序。 */
760
+ /** 手动排序表格。 参数 prop 属性指定排序列,order 指定排序顺序。 */
960
761
  sort: computed(() => tableRef.value?.sort),
961
- /** @description 滚动到一组特定坐标 */
762
+ /** 滚动到一组特定坐标 */
962
763
  scrollTo: computed(() => tableRef.value?.scrollTo),
963
- /** @description 设置垂直滚动位置 */
764
+ /** 设置垂直滚动位置 */
964
765
  setScrollTop: computed(() => tableRef.value?.setScrollTop),
965
- /** @description 设置水平滚动位置 */
766
+ /** 设置水平滚动位置 */
966
767
  setScrollLeft: computed(() => tableRef.value?.setScrollLeft),
967
- /** @description 获取表列的 context */
768
+ /** 获取表列的 context */
968
769
  columns: computed(() => tableRef.value?.columns),
969
- /** @description 适用于 lazy Table, 需要设置 rowKey, 更新 key children */
770
+ /** 适用于 lazy Table, 需要设置 rowKey, 更新 key children */
970
771
  updateKeyChildren: computed(() => tableRef.value?.updateKeyChildren),
971
- /** @description 加载状态 */
972
- loading: computed(() => state.loading),
973
- /** @description 表格数据 */
772
+ /** 聚合加载状态;手动关闭不能结束内部任务。 */
773
+ loading: computed({
774
+ get: () => state.loading,
775
+ set: setManualLoading
776
+ }),
777
+ /** 表格数据 */
974
778
  tableData: computed(() => state.tableData),
975
- /** @description 分页数据 */
779
+ /** 分页数据 */
976
780
  tablePagination: computed(() => state.tablePagination),
977
- /** @description 搜索参数 */
781
+ /** 搜索参数 */
978
782
  searchParam: computed(() => state.searchParam),
979
- /** @description 选中状态 */
783
+ /** 选中状态 */
980
784
  selected: computed(() => state.selected),
981
- /** @description 选中数据列表 */
785
+ /** 选中数据列表 */
982
786
  selectedList: computed(() => state.selectedList),
983
- /** @description 选中数据 rowKey 列表 */
787
+ /** 选中数据 rowKey 列表 */
984
788
  selectedListIds: computed(() => state.selectedListIds),
985
- /** @description 部分选中数据 rowKey 列表 */
789
+ /** 部分选中数据 rowKey 列表 */
986
790
  indeterminateSelectedListIds: computed(() => state.indeterminateSelectedListIds),
987
- /** @description 表格宽度 */
791
+ /** 表格宽度 */
988
792
  tableWidth: computed(() => state.tableWidth),
989
- /** @description 表格高度 */
793
+ /** 表格高度 */
990
794
  tableHeight: computed(() => state.tableHeight),
991
- /** @description 部分选中(样式不一样而已),用于多选表格,切换某一行的选中状态, 如果使用了第二个参数,则可直接设置这一行选中与否 */
795
+ /** 部分选中(样式不一样而已),用于多选表格,切换某一行的选中状态, 如果使用了第二个参数,则可直接设置这一行选中与否 */
992
796
  toggleRowIndeterminateSelection,
993
- /** @description 异步方法,刷新表格 */
797
+ /** 异步方法,刷新表格 */
994
798
  refresh: tableSearch,
995
- /** @description 异步方法,重置表格 */
799
+ /** 异步方法,重置表格 */
996
800
  reset: tableReset,
997
- /** @description 对 Table 进行重新渲染。当 TableKey 发生变化的时候可以通过此方法重新渲染表格 */
801
+ /** 对 Table 进行重新渲染。当 TableKey 发生变化的时候可以通过此方法重新渲染表格 */
998
802
  doRender,
999
- /** @description Table 加载 */
803
+ /** Table 加载 */
1000
804
  doLoading
1001
805
  });
1002
806
  }