@aplus-frontend/ui 0.3.8 → 0.3.10

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 (244) hide show
  1. package/es/src/ap-action/item/index.vue.d.ts +2 -1
  2. package/es/src/ap-action/item-dropdown/index.vue.d.ts +2 -1
  3. package/es/src/ap-action/item-modal/index.vue.d.ts +2 -1
  4. package/es/src/ap-action/item-popconfirm/index.vue.d.ts +2 -1
  5. package/es/src/ap-button/ap-action-button.vue.d.ts +4 -3
  6. package/es/src/ap-button/ap-action-button.vue.mjs +11 -11
  7. package/es/src/ap-button/ap-button.vue.d.ts +4 -3
  8. package/es/src/ap-button/ap-button.vue.mjs +36 -36
  9. package/es/src/ap-button/interface.d.ts +4 -0
  10. package/es/src/ap-descriptions/ap-descriptions.vue.d.ts +3 -2
  11. package/es/src/ap-descriptions/help-message/index.vue.d.ts +3 -5
  12. package/es/src/ap-download/ap-download.vue.d.ts +5 -3
  13. package/es/src/ap-field/date/index.vue.d.ts +2 -1
  14. package/es/src/ap-field/date-range/index.vue.d.ts +2 -1
  15. package/es/src/ap-field/number/index.vue.d.ts +2 -1
  16. package/es/src/ap-field/rate/index.vue.d.ts +2 -1
  17. package/es/src/ap-field/segmented/index.vue.d.ts +2 -1
  18. package/es/src/ap-field/select/index.vue.d.ts +2 -1
  19. package/es/src/ap-field/slider/index.vue.d.ts +2 -1
  20. package/es/src/ap-field/switch/index.vue.d.ts +2 -1
  21. package/es/src/ap-field/text/index.vue.d.ts +2 -1
  22. package/es/src/ap-field/text/password.vue.d.ts +2 -1
  23. package/es/src/ap-form/ap-form.vue.d.ts +6 -4
  24. package/es/src/ap-form/dependency/index.vue.d.ts +2 -1
  25. package/es/src/ap-form/drawer-form/index.vue.d.ts +3 -2
  26. package/es/src/ap-form/item/index.vue.d.ts +2 -1
  27. package/es/src/ap-form/item-group/index.vue.d.ts +2 -1
  28. package/es/src/ap-form/items/checkbox/index.vue.d.ts +2 -1
  29. package/es/src/ap-form/items/date/index.vue.d.ts +2 -1
  30. package/es/src/ap-form/items/date-range/index.vue.d.ts +2 -1
  31. package/es/src/ap-form/items/number/index.vue.d.ts +2 -1
  32. package/es/src/ap-form/items/radio/index.vue.d.ts +2 -1
  33. package/es/src/ap-form/items/select/index.vue.d.ts +2 -1
  34. package/es/src/ap-form/items/switch/index.vue.d.ts +2 -1
  35. package/es/src/ap-form/items/text/group.vue.d.ts +2 -1
  36. package/es/src/ap-form/items/text/index.vue.d.ts +2 -1
  37. package/es/src/ap-form/items/text/password.vue.d.ts +2 -1
  38. package/es/src/ap-form/items/text-area/index.vue.d.ts +2 -1
  39. package/es/src/ap-form/list/index.vue.d.ts +2 -1
  40. package/es/src/ap-form/modal-form/index.vue.d.ts +3 -2
  41. package/es/src/ap-form/modal-form/index.vue.mjs +61 -57
  42. package/es/src/ap-form/render/control.vue.d.ts +2 -1
  43. package/es/src/ap-form/render/item.vue.d.ts +2 -1
  44. package/es/src/ap-form/search-form/index.vue.d.ts +3 -2
  45. package/es/src/ap-form/set/index.vue.d.ts +2 -1
  46. package/es/src/ap-info-layout/ApInfoLayout.vue.d.ts +3 -2
  47. package/es/src/ap-info-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.d.ts +3 -2
  48. package/es/src/ap-info-layout/ap-info-layout-aplus/ap-info-layout.vue.d.ts +3 -2
  49. package/es/src/ap-list/index.vue.d.ts +3 -5
  50. package/es/src/ap-list/index.vue.mjs +37 -39
  51. package/es/src/ap-list/interface.d.ts +3 -3
  52. package/es/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +1 -1
  53. package/es/src/ap-scroll-bar/index.d.ts +1 -1
  54. package/es/src/ap-table/ap-table.vue.d.ts +3 -5
  55. package/es/src/ap-table/ap-table.vue2.mjs +75 -78
  56. package/es/src/ap-table/components/index/index.vue.d.ts +1 -1
  57. package/es/src/ap-table/components/paragraph-ellipsis/index.vue.d.ts +1 -1
  58. package/es/src/ap-table/components/setting/modal/index.vue.d.ts +2 -1
  59. package/es/src/ap-table/components/setting/select-group/index.vue.d.ts +1 -1
  60. package/es/src/ap-table/components/setting/sortable/index.vue.d.ts +1 -1
  61. package/es/src/ap-table/components/setting/sortable/item.vue.d.ts +1 -1
  62. package/es/src/ap-table/components/setting/sorter/index.vue.d.ts +1 -1
  63. package/es/src/ap-table/components/setting/tree-select/index.vue.d.ts +1 -1
  64. package/es/src/ap-table/constants.d.ts +1 -1
  65. package/es/src/ap-table/hooks/use-table-column-state.d.ts +4 -4
  66. package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +87 -0
  67. package/es/src/ap-table/hooks/use-table-paging-ng.mjs +209 -0
  68. package/es/src/ap-table/hooks/use-table-paging.d.ts +13 -3
  69. package/es/src/ap-table/hooks/use-table-paging.mjs +131 -126
  70. package/es/src/ap-table/interface.d.ts +4 -3
  71. package/es/src/ap-table/utils.d.ts +1 -0
  72. package/es/src/ap-table/utils.mjs +10 -5
  73. package/es/src/ap-tag/ap-tag-group.vue.d.ts +2 -1
  74. package/es/src/ap-tag/ap-tag.vue.d.ts +1 -1
  75. package/es/src/ap-upload/apUpload.vue.d.ts +3 -2
  76. package/es/src/ap-upload/components/MultipleFile.vue.d.ts +1 -1
  77. package/es/src/ap-upload/components/Picture.vue.d.ts +5 -9
  78. package/es/src/ap-upload/components/SingleFile.vue.d.ts +1 -1
  79. package/es/src/business/ap-appendix/ap-appendix.vue.d.ts +5 -3
  80. package/es/src/business/ap-appendix/icons/file-icon.vue.d.ts +1 -1
  81. package/es/src/business/ap-appendix/index.d.ts +1 -1
  82. package/es/src/business/ap-batch-action/ApBatchAction.vue.d.ts +3 -2
  83. package/es/src/business/ap-batch-action/index.d.ts +1 -1
  84. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +2 -1
  85. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +3 -4
  86. package/es/src/business/ap-batch-action-group/index.d.ts +887 -5
  87. package/es/src/business/ap-card/ApCard.vue.d.ts +3 -2
  88. package/es/src/business/ap-card/index.d.ts +1 -1
  89. package/es/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -5
  90. package/es/src/business/ap-expand-alert/index.d.ts +4 -6
  91. package/es/src/business/ap-group-search/ap-group-search.vue.d.ts +3 -2
  92. package/es/src/business/ap-group-search/extension-select/index.vue.d.ts +8 -346
  93. package/es/src/business/ap-group-search/images/icon-down.vue.d.ts +1 -1
  94. package/es/src/business/ap-group-search/images/icon-line-select.vue.d.ts +1 -1
  95. package/es/src/business/ap-group-search/index.d.ts +3 -3
  96. package/es/src/business/ap-group-search/popover-select/index.vue.d.ts +8 -346
  97. package/es/src/business/ap-image/ApImage.vue.d.ts +2 -1
  98. package/es/src/business/ap-input-radio/ApInputRadio.vue.d.ts +1 -1
  99. package/es/src/business/ap-input-radio/index.d.ts +1 -1
  100. package/es/src/business/ap-ladder/ApLadder.vue.d.ts +3 -2
  101. package/es/src/business/ap-ladder/index.d.ts +1 -1
  102. package/es/src/business/ap-select-layout/index.d.ts +3 -4
  103. package/es/src/business/ap-select-layout/interface.d.ts +1 -0
  104. package/es/src/business/ap-select-layout/select-layout.vue.d.ts +3 -5
  105. package/es/src/business/ap-select-layout/select-layout.vue2.mjs +58 -56
  106. package/es/src/business/ap-table-modal/modal-title.vue.d.ts +3 -2
  107. package/es/src/business/ap-table-modal/table-layout/index.vue.d.ts +8 -8
  108. package/es/src/business/ap-table-modal/table-modal.vue.d.ts +3 -2
  109. package/es/src/business/ap-title/ApTitle.vue.d.ts +3 -2
  110. package/es/src/business/ap-title/index.d.ts +1 -1
  111. package/es/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.d.ts +5 -3
  112. package/es/src/business/ap-upload-file/icon/delete-icon.vue.d.ts +1 -1
  113. package/es/src/business/ap-upload-file/icon/file-icon.vue.d.ts +1 -1
  114. package/es/src/business/batch-input-group/index.vue.d.ts +1 -1
  115. package/es/src/business/batch-input-group/popover-input/index.vue.d.ts +1 -1
  116. package/es/src/check-card/group.vue.d.ts +2 -1
  117. package/es/src/check-card/index.vue.d.ts +3 -2
  118. package/es/src/editable-table/form-item.vue.d.ts +3 -5
  119. package/es/src/editable-table/index.vue.d.ts +3 -5
  120. package/es/src/tests/wrapper.d.ts +4 -4
  121. package/es/src/work-order-modal/work-order-modal.vue.d.ts +1 -1
  122. package/lib/src/ap-action/item/index.vue.d.ts +2 -1
  123. package/lib/src/ap-action/item-dropdown/index.vue.d.ts +2 -1
  124. package/lib/src/ap-action/item-modal/index.vue.d.ts +2 -1
  125. package/lib/src/ap-action/item-popconfirm/index.vue.d.ts +2 -1
  126. package/lib/src/ap-button/ap-action-button.vue.d.ts +4 -3
  127. package/lib/src/ap-button/ap-action-button.vue.js +1 -1
  128. package/lib/src/ap-button/ap-button.vue.d.ts +4 -3
  129. package/lib/src/ap-button/ap-button.vue.js +1 -1
  130. package/lib/src/ap-button/interface.d.ts +4 -0
  131. package/lib/src/ap-descriptions/ap-descriptions.vue.d.ts +3 -2
  132. package/lib/src/ap-descriptions/help-message/index.vue.d.ts +3 -5
  133. package/lib/src/ap-download/ap-download.vue.d.ts +5 -3
  134. package/lib/src/ap-field/date/index.vue.d.ts +2 -1
  135. package/lib/src/ap-field/date-range/index.vue.d.ts +2 -1
  136. package/lib/src/ap-field/number/index.vue.d.ts +2 -1
  137. package/lib/src/ap-field/rate/index.vue.d.ts +2 -1
  138. package/lib/src/ap-field/segmented/index.vue.d.ts +2 -1
  139. package/lib/src/ap-field/select/index.vue.d.ts +2 -1
  140. package/lib/src/ap-field/slider/index.vue.d.ts +2 -1
  141. package/lib/src/ap-field/switch/index.vue.d.ts +2 -1
  142. package/lib/src/ap-field/text/index.vue.d.ts +2 -1
  143. package/lib/src/ap-field/text/password.vue.d.ts +2 -1
  144. package/lib/src/ap-form/ap-form.vue.d.ts +6 -4
  145. package/lib/src/ap-form/dependency/index.vue.d.ts +2 -1
  146. package/lib/src/ap-form/drawer-form/index.vue.d.ts +3 -2
  147. package/lib/src/ap-form/item/index.vue.d.ts +2 -1
  148. package/lib/src/ap-form/item-group/index.vue.d.ts +2 -1
  149. package/lib/src/ap-form/items/checkbox/index.vue.d.ts +2 -1
  150. package/lib/src/ap-form/items/date/index.vue.d.ts +2 -1
  151. package/lib/src/ap-form/items/date-range/index.vue.d.ts +2 -1
  152. package/lib/src/ap-form/items/number/index.vue.d.ts +2 -1
  153. package/lib/src/ap-form/items/radio/index.vue.d.ts +2 -1
  154. package/lib/src/ap-form/items/select/index.vue.d.ts +2 -1
  155. package/lib/src/ap-form/items/switch/index.vue.d.ts +2 -1
  156. package/lib/src/ap-form/items/text/group.vue.d.ts +2 -1
  157. package/lib/src/ap-form/items/text/index.vue.d.ts +2 -1
  158. package/lib/src/ap-form/items/text/password.vue.d.ts +2 -1
  159. package/lib/src/ap-form/items/text-area/index.vue.d.ts +2 -1
  160. package/lib/src/ap-form/list/index.vue.d.ts +2 -1
  161. package/lib/src/ap-form/modal-form/index.vue.d.ts +3 -2
  162. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  163. package/lib/src/ap-form/render/control.vue.d.ts +2 -1
  164. package/lib/src/ap-form/render/item.vue.d.ts +2 -1
  165. package/lib/src/ap-form/search-form/index.vue.d.ts +3 -2
  166. package/lib/src/ap-form/set/index.vue.d.ts +2 -1
  167. package/lib/src/ap-info-layout/ApInfoLayout.vue.d.ts +3 -2
  168. package/lib/src/ap-info-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.d.ts +3 -2
  169. package/lib/src/ap-info-layout/ap-info-layout-aplus/ap-info-layout.vue.d.ts +3 -2
  170. package/lib/src/ap-list/index.vue.d.ts +3 -5
  171. package/lib/src/ap-list/index.vue.js +1 -1
  172. package/lib/src/ap-list/interface.d.ts +3 -3
  173. package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +1 -1
  174. package/lib/src/ap-scroll-bar/index.d.ts +1 -1
  175. package/lib/src/ap-table/ap-table.vue.d.ts +3 -5
  176. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  177. package/lib/src/ap-table/components/index/index.vue.d.ts +1 -1
  178. package/lib/src/ap-table/components/paragraph-ellipsis/index.vue.d.ts +1 -1
  179. package/lib/src/ap-table/components/setting/modal/index.vue.d.ts +2 -1
  180. package/lib/src/ap-table/components/setting/select-group/index.vue.d.ts +1 -1
  181. package/lib/src/ap-table/components/setting/sortable/index.vue.d.ts +1 -1
  182. package/lib/src/ap-table/components/setting/sortable/item.vue.d.ts +1 -1
  183. package/lib/src/ap-table/components/setting/sorter/index.vue.d.ts +1 -1
  184. package/lib/src/ap-table/components/setting/tree-select/index.vue.d.ts +1 -1
  185. package/lib/src/ap-table/constants.d.ts +1 -1
  186. package/lib/src/ap-table/hooks/use-table-column-state.d.ts +4 -4
  187. package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +87 -0
  188. package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -0
  189. package/lib/src/ap-table/hooks/use-table-paging.d.ts +13 -3
  190. package/lib/src/ap-table/hooks/use-table-paging.js +1 -1
  191. package/lib/src/ap-table/interface.d.ts +4 -3
  192. package/lib/src/ap-table/utils.d.ts +1 -0
  193. package/lib/src/ap-table/utils.js +1 -1
  194. package/lib/src/ap-tag/ap-tag-group.vue.d.ts +2 -1
  195. package/lib/src/ap-tag/ap-tag.vue.d.ts +1 -1
  196. package/lib/src/ap-upload/apUpload.vue.d.ts +3 -2
  197. package/lib/src/ap-upload/components/MultipleFile.vue.d.ts +1 -1
  198. package/lib/src/ap-upload/components/Picture.vue.d.ts +5 -9
  199. package/lib/src/ap-upload/components/SingleFile.vue.d.ts +1 -1
  200. package/lib/src/business/ap-appendix/ap-appendix.vue.d.ts +5 -3
  201. package/lib/src/business/ap-appendix/icons/file-icon.vue.d.ts +1 -1
  202. package/lib/src/business/ap-appendix/index.d.ts +1 -1
  203. package/lib/src/business/ap-batch-action/ApBatchAction.vue.d.ts +3 -2
  204. package/lib/src/business/ap-batch-action/index.d.ts +1 -1
  205. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +2 -1
  206. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +3 -4
  207. package/lib/src/business/ap-batch-action-group/index.d.ts +887 -5
  208. package/lib/src/business/ap-card/ApCard.vue.d.ts +3 -2
  209. package/lib/src/business/ap-card/index.d.ts +1 -1
  210. package/lib/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -5
  211. package/lib/src/business/ap-expand-alert/index.d.ts +4 -6
  212. package/lib/src/business/ap-group-search/ap-group-search.vue.d.ts +3 -2
  213. package/lib/src/business/ap-group-search/extension-select/index.vue.d.ts +8 -346
  214. package/lib/src/business/ap-group-search/images/icon-down.vue.d.ts +1 -1
  215. package/lib/src/business/ap-group-search/images/icon-line-select.vue.d.ts +1 -1
  216. package/lib/src/business/ap-group-search/index.d.ts +3 -3
  217. package/lib/src/business/ap-group-search/popover-select/index.vue.d.ts +8 -346
  218. package/lib/src/business/ap-image/ApImage.vue.d.ts +2 -1
  219. package/lib/src/business/ap-input-radio/ApInputRadio.vue.d.ts +1 -1
  220. package/lib/src/business/ap-input-radio/index.d.ts +1 -1
  221. package/lib/src/business/ap-ladder/ApLadder.vue.d.ts +3 -2
  222. package/lib/src/business/ap-ladder/index.d.ts +1 -1
  223. package/lib/src/business/ap-select-layout/index.d.ts +3 -4
  224. package/lib/src/business/ap-select-layout/interface.d.ts +1 -0
  225. package/lib/src/business/ap-select-layout/select-layout.vue.d.ts +3 -5
  226. package/lib/src/business/ap-select-layout/select-layout.vue2.js +1 -1
  227. package/lib/src/business/ap-table-modal/modal-title.vue.d.ts +3 -2
  228. package/lib/src/business/ap-table-modal/table-layout/index.vue.d.ts +8 -8
  229. package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +3 -2
  230. package/lib/src/business/ap-title/ApTitle.vue.d.ts +3 -2
  231. package/lib/src/business/ap-title/index.d.ts +1 -1
  232. package/lib/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.d.ts +5 -3
  233. package/lib/src/business/ap-upload-file/icon/delete-icon.vue.d.ts +1 -1
  234. package/lib/src/business/ap-upload-file/icon/file-icon.vue.d.ts +1 -1
  235. package/lib/src/business/batch-input-group/index.vue.d.ts +1 -1
  236. package/lib/src/business/batch-input-group/popover-input/index.vue.d.ts +1 -1
  237. package/lib/src/check-card/group.vue.d.ts +2 -1
  238. package/lib/src/check-card/index.vue.d.ts +3 -2
  239. package/lib/src/editable-table/form-item.vue.d.ts +3 -5
  240. package/lib/src/editable-table/index.vue.d.ts +3 -5
  241. package/lib/src/tests/wrapper.d.ts +4 -4
  242. package/lib/src/work-order-modal/work-order-modal.vue.d.ts +1 -1
  243. package/package.json +1 -1
  244. package/index.ts +0 -19
@@ -4,18 +4,18 @@ export declare const useTableColumnState: (columnSetting: ApTableSettingType, in
4
4
  columnState: Ref<{
5
5
  key: string | number;
6
6
  show?: boolean | undefined;
7
- fixed?: ("left" | "right") | undefined;
7
+ fixed?: "left" | "right" | undefined;
8
8
  disabled?: boolean | undefined;
9
9
  label?: any;
10
- children?: any[] | undefined;
10
+ children?: /*elided*/ any[] | undefined;
11
11
  order?: number | undefined;
12
12
  }[], ApColumnState[] | {
13
13
  key: string | number;
14
14
  show?: boolean | undefined;
15
- fixed?: ("left" | "right") | undefined;
15
+ fixed?: "left" | "right" | undefined;
16
16
  disabled?: boolean | undefined;
17
17
  label?: any;
18
- children?: any[] | undefined;
18
+ children?: /*elided*/ any[] | undefined;
19
19
  order?: number | undefined;
20
20
  }[]>;
21
21
  selectAll: () => void;
@@ -0,0 +1,87 @@
1
+ import { DataIndex } from '@aplus-frontend/antdv/es/vc-table/interface';
2
+ import { Ref, ComputedRef } from 'vue';
3
+ import { ApTablePaginationConfig, RequestData } from '../interface';
4
+ import { Recordable } from '../../type';
5
+ import { ApFormSearchFormExpose } from '../../ap-form';
6
+ import { TablePaginationConfig } from '@aplus-frontend/antdv';
7
+ import { FilterValue, SorterResult, TableCurrentDataSource } from '@aplus-frontend/antdv/es/table/interface';
8
+ import { ApColumnType } from '..';
9
+ export type UseTablePagingParams<DataType, ParamsType> = {
10
+ request: (params: any) => Promise<RequestData<DataType>>;
11
+ /**
12
+ * 是否手动执行,页面初始化后不执行网络请求,需要手动触发
13
+ * @param params
14
+ * @returns
15
+ */
16
+ manual?: boolean;
17
+ /**
18
+ * 额外的默认请求参数
19
+ * @description 如果传入响应式数据,将会在数据改变后重新请求
20
+ */
21
+ defaultParams?: ParamsType | Ref<ParamsType>;
22
+ /**
23
+ * 默认的数据源(只生效一次)
24
+ */
25
+ defaultData?: DataType[];
26
+ /**
27
+ * 数据请求前格式化请求参数
28
+ * @param values
29
+ * @returns
30
+ */
31
+ formatParams?: (values: any) => any;
32
+ /**
33
+ * 特殊类型参数类型对照表(会根据该对照表运行默认的参数格式化)
34
+ */
35
+ paramsValueTypeMap?: Record<string, any>;
36
+ /**
37
+ * 重设表单需要忽略的字段
38
+ */
39
+ resetFieldsIgnores?: string[];
40
+ /**
41
+ * 需要后端筛选的字段列表
42
+ */
43
+ filterFields?: Ref<DataIndex[]>;
44
+ /**
45
+ * 需要后端筛选的排序字段列表
46
+ */
47
+ sortFields?: Ref<DataIndex[]>;
48
+ /**
49
+ * 分页相关
50
+ */
51
+ pagination?: boolean | ApTablePaginationConfig;
52
+ };
53
+ type InternalDataType<DataType = Recordable> = {
54
+ total: number;
55
+ records: DataType[];
56
+ loading: boolean;
57
+ };
58
+ export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, pagination }: UseTablePagingParams<DataType, ParamsType>) => {
59
+ formRef: Ref<ApFormSearchFormExpose | undefined, ApFormSearchFormExpose | undefined>;
60
+ submit: () => void;
61
+ reset: () => void;
62
+ refresh: () => void;
63
+ refreshByDelete: (n: number) => void;
64
+ data: InternalDataType<DataType>;
65
+ current: number | undefined;
66
+ pageSize: number | undefined;
67
+ handleTableChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
68
+ tableProps: ComputedRef<{
69
+ loading: boolean;
70
+ pagination: {
71
+ current: number;
72
+ pageSize: number;
73
+ total: number;
74
+ showSizeChanger: boolean;
75
+ showQuickJumper: boolean;
76
+ showLessItems: boolean | undefined;
77
+ size: string;
78
+ showTotal: ((total: number) => import("vue/jsx-runtime").JSX.Element) | undefined;
79
+ };
80
+ onChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
81
+ dataSource: DataType[];
82
+ }>;
83
+ dataSource: ComputedRef<DataType[]>;
84
+ setDataSource: (dataSource?: DataType[]) => void;
85
+ getColumnSFConfig: (column: ApColumnType) => Recordable;
86
+ };
87
+ export {};
@@ -0,0 +1,209 @@
1
+ import { ref as ee, reactive as q, unref as h, nextTick as te, onMounted as re, watch as oe, computed as A, createVNode as x } from "vue";
2
+ import { useTableSortedAndFiltered as ne } from "./use-sorted-filtered.mjs";
3
+ import "../../config-provider/index.mjs";
4
+ import { parseFieldValue as ae, dataIndexToStr as se, isEqualCustom as ce } from "../utils.mjs";
5
+ import { isArray as I, isEqualWith as ie } from "lodash-unified";
6
+ import { useLocale as le } from "../../config-provider/hooks/use-locale.mjs";
7
+ import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
8
+ const C = 1, N = 10;
9
+ function fe(g) {
10
+ const l = {};
11
+ return g && (g === !0 ? (l.current = C, l.pageSize = N) : (l.current = g.defaultCurrent || C, l.pageSize = g.defaultPageSize || N)), l;
12
+ }
13
+ const Te = ({
14
+ manual: g = !1,
15
+ request: l,
16
+ defaultParams: L = {},
17
+ defaultData: v = [],
18
+ formatParams: y,
19
+ paramsValueTypeMap: D,
20
+ resetFieldsIgnores: R,
21
+ filterFields: U,
22
+ sortFields: B,
23
+ pagination: p = {
24
+ defaultCurrent: 1,
25
+ defaultPageSize: 10,
26
+ showLessItems: !1,
27
+ showTotal: !0
28
+ }
29
+ }) => {
30
+ let b = 0, s = {};
31
+ const K = p ?? {}, M = (e) => y ? y(e) : e, S = ee(), c = q(fe(p)), {
32
+ getColumnSFConfig: $,
33
+ setSF: G,
34
+ clearAll: J
35
+ } = ne(), {
36
+ t: z
37
+ } = le(), {
38
+ b: T
39
+ } = ue("ap-table"), o = q({
40
+ total: v.length,
41
+ records: v,
42
+ loading: !1
43
+ }), P = () => {
44
+ var e, t;
45
+ return ((t = (e = S.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
46
+ }, V = async (e) => {
47
+ var n;
48
+ const t = M(e), r = Date.now();
49
+ b = r, o.loading = !0;
50
+ try {
51
+ const a = await l({
52
+ ...h(L),
53
+ ...t
54
+ });
55
+ b === r && (o.total = a.total || ((n = a.data) == null ? void 0 : n.length) || 0, o.records = [...a.data || []]);
56
+ } catch {
57
+ b === r && (o.records = [], o.total = 0);
58
+ } finally {
59
+ o.loading = !1;
60
+ }
61
+ }, O = (e) => {
62
+ const t = {};
63
+ return Object.entries(e).forEach(([r, n]) => {
64
+ if (t[r] = n, D && n) {
65
+ const a = D[r];
66
+ a && (t[r] = ae(a, n));
67
+ }
68
+ }), t;
69
+ }, Q = async (e) => {
70
+ var n, a, u, f, d;
71
+ const t = P(), r = {};
72
+ Object.entries(t).forEach(([m, w]) => {
73
+ R && R.indexOf(m) > -1 && (r[m] = w);
74
+ }), await ((a = (n = S.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = S.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), te(() => {
75
+ e == null || e();
76
+ });
77
+ }, F = (e) => {
78
+ s = e;
79
+ const t = O(e);
80
+ V(t);
81
+ }, W = (e) => {
82
+ F({
83
+ ...s,
84
+ ...e
85
+ });
86
+ }, E = () => {
87
+ const e = P();
88
+ p && (c.current = C), F({
89
+ ...e,
90
+ filter: s.filter,
91
+ sort: s.sort,
92
+ current: p ? C : void 0,
93
+ pageSize: p ? s.pageSize || c.pageSize : void 0
94
+ });
95
+ }, Z = () => {
96
+ J(), s.sort = {}, s.filter = {}, Q(E);
97
+ }, _ = () => {
98
+ F(s);
99
+ }, H = (e) => {
100
+ if (!p)
101
+ _();
102
+ else {
103
+ const {
104
+ current: t,
105
+ pageSize: r
106
+ } = c, n = o.total - e, a = Math.ceil(n / r), u = t > a ? a : t;
107
+ W({
108
+ current: u > 0 ? u : 1
109
+ });
110
+ }
111
+ }, j = (e, t, r) => {
112
+ var m, w;
113
+ const n = P();
114
+ c.current = e.current, c.pageSize = e.pageSize, G(t, r);
115
+ const a = I(r) ? [...r] : [r], u = {};
116
+ for (const i of a)
117
+ (m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[se(i.columnKey || i.field)] = i.order);
118
+ const f = {};
119
+ for (const i of Object.keys(t))
120
+ (w = h(U)) != null && w.includes(i) && t[i] && (f[i] = t[i]);
121
+ const d = {
122
+ ...n,
123
+ filter: f,
124
+ sort: u,
125
+ current: e.current,
126
+ pageSize: e.pageSize
127
+ };
128
+ ie(s, d, ce) || F(d);
129
+ };
130
+ re(() => {
131
+ const e = P(), {
132
+ current: t,
133
+ pageSize: r
134
+ } = c;
135
+ if (s = {
136
+ current: t,
137
+ pageSize: r,
138
+ filter: {},
139
+ sort: {},
140
+ ...e
141
+ }, !g) {
142
+ const n = O(s);
143
+ V(n);
144
+ }
145
+ }), oe(() => h(L), () => {
146
+ E();
147
+ }, {
148
+ deep: !0
149
+ });
150
+ const X = A(() => {
151
+ if (o.total === 0)
152
+ return "-";
153
+ const {
154
+ current: e,
155
+ pageSize: t
156
+ } = c;
157
+ return `${e}/${Math.ceil(o.total / t)}`;
158
+ });
159
+ function Y(e) {
160
+ I(e) && (o.records = e, o.total = e.length);
161
+ }
162
+ const k = A(() => {
163
+ const {
164
+ showLessItems: e,
165
+ showTotal: t
166
+ } = K;
167
+ return {
168
+ loading: o.loading,
169
+ pagination: {
170
+ current: c.current,
171
+ pageSize: c.pageSize,
172
+ total: o.total,
173
+ showSizeChanger: !e,
174
+ showQuickJumper: !e,
175
+ showLessItems: e,
176
+ size: "default",
177
+ showTotal: t ? (r) => x("span", {
178
+ class: T("pagination-total-wrapper")
179
+ }, [z("ap.apTable.pagination.totalLeftPrefix"), " ", x("span", {
180
+ class: T("pagination-count-text")
181
+ }, [r]), " ", z("ap.apTable.pagination.totalLeftSuffix"), x("span", {
182
+ class: T("pagination--total-right")
183
+ }, [z("ap.apTable.pagination.totalRightPrefix"), " ", x("span", {
184
+ class: T("pagination-count-text")
185
+ }, [h(X)]), " ", z("ap.apTable.pagination.totalRightSuffix")])]) : void 0
186
+ },
187
+ onChange: j,
188
+ dataSource: o.records
189
+ };
190
+ });
191
+ return {
192
+ formRef: S,
193
+ submit: E,
194
+ reset: Z,
195
+ refresh: _,
196
+ refreshByDelete: H,
197
+ data: o,
198
+ current: c.current,
199
+ pageSize: c.pageSize,
200
+ handleTableChange: j,
201
+ tableProps: k,
202
+ dataSource: A(() => o.records),
203
+ setDataSource: Y,
204
+ getColumnSFConfig: $
205
+ };
206
+ };
207
+ export {
208
+ Te as useTablePaging
209
+ };
@@ -62,8 +62,18 @@ export type UseTablePagingParams<DataType, ParamsType> = {
62
62
  * 用于显示数据总量和当前数据顺序
63
63
  */
64
64
  showTotal?: boolean;
65
+ /**
66
+ * 是否分页
67
+ */
68
+ pagination?: boolean;
65
69
  };
66
- export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, defaultCurrent, defaultPageSize, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, showLessItems, showTotal }: UseTablePagingParams<DataType, ParamsType>) => {
70
+ /**
71
+ * ApTable表格分页请求和管理数据实现
72
+ * @deprecated 已弃用,将在下一个次要版本移出,请自行实现
73
+ * @param param0
74
+ * @returns
75
+ */
76
+ export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, defaultCurrent, defaultPageSize, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, showLessItems, showTotal, pagination }: UseTablePagingParams<DataType, ParamsType>) => {
67
77
  formRef: Ref<ApFormSearchFormExpose | undefined, ApFormSearchFormExpose | undefined>;
68
78
  submit: () => void;
69
79
  reset: () => void;
@@ -78,8 +88,8 @@ export declare const useTablePaging: <DataType = any, ParamsType = Record<string
78
88
  records: DataType[];
79
89
  loading: boolean;
80
90
  }>;
81
- current: Ref<number, number>;
82
- pageSize: Ref<number, number>;
91
+ current: Ref<number | undefined, number | undefined>;
92
+ pageSize: Ref<number | undefined, number | undefined>;
83
93
  handleTableChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
84
94
  tableProps: ComputedRef<{
85
95
  loading: boolean;
@@ -1,171 +1,176 @@
1
- import { ref as P, nextTick as ae, unref as o, onMounted as oe, computed as V, createVNode as b } from "vue";
2
- import { parseFieldValue as re, dataIndexToStr as ne, isEqualCustom as se } from "../utils.mjs";
3
- import { isArray as q, isEqualWith as ie } from "lodash-unified";
1
+ import { ref as b, nextTick as re, unref as r, onMounted as oe, computed as y, createVNode as z } from "vue";
2
+ import { parseFieldValue as ne, dataIndexToStr as se, isEqualCustom as ie } from "../utils.mjs";
3
+ import { isArray as K, isEqualWith as le } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
- import { useTableSortedAndFiltered as le } from "./use-sorted-filtered.mjs";
6
- import { useLocale as ce } from "../../config-provider/hooks/use-locale.mjs";
7
- import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
5
+ import { useTableSortedAndFiltered as ce } from "./use-sorted-filtered.mjs";
6
+ import { useLocale as ue } from "../../config-provider/hooks/use-locale.mjs";
7
+ import { useNamespace as fe } from "../../config-provider/hooks/use-namespace.mjs";
8
8
  const Te = ({
9
- manual: B = !1,
10
- defaultCurrent: K = 1,
11
- defaultPageSize: y = 10,
12
- request: M,
13
- defaultParams: N = {},
14
- defaultData: $ = [],
15
- formatParams: w,
16
- paramsValueTypeMap: A,
17
- resetFieldsIgnores: D,
18
- filterFields: J,
19
- sortFields: L,
20
- showLessItems: z = !1,
21
- showTotal: Q = !0
9
+ manual: M = !1,
10
+ defaultCurrent: N = 1,
11
+ defaultPageSize: w = 10,
12
+ request: _,
13
+ defaultParams: $ = {},
14
+ defaultData: J = [],
15
+ formatParams: A,
16
+ paramsValueTypeMap: D,
17
+ resetFieldsIgnores: E,
18
+ filterFields: L,
19
+ sortFields: Q,
20
+ showLessItems: C = !1,
21
+ showTotal: W = !0,
22
+ pagination: p = !0
22
23
  }) => {
23
- let C = 0, s = {};
24
- const W = (e) => w ? w(e) : e, u = P(), c = P(K), p = P(y), {
25
- getColumnSFConfig: G,
26
- setSF: H,
27
- clearAll: U
28
- } = le(), {
29
- t: T
24
+ let V = 0, i = {};
25
+ const G = (e) => A ? A(e) : e, u = b(), f = b(p ? N : void 0), g = b(p ? w : void 0), {
26
+ getColumnSFConfig: H,
27
+ setSF: U,
28
+ clearAll: X
30
29
  } = ce(), {
30
+ t: T
31
+ } = ue(), {
31
32
  b: F
32
- } = ue("ap-table"), r = P({
33
+ } = fe("ap-table"), o = b({
33
34
  total: 0,
34
- records: $,
35
+ records: J,
35
36
  loading: !1
36
- }), E = async (e) => {
37
+ }), O = async (e) => {
37
38
  var n;
38
- const a = W(e), t = Date.now();
39
- C = t, r.value.loading = !0;
39
+ const t = G(e), a = Date.now();
40
+ V = a, o.value.loading = !0;
40
41
  try {
41
- const i = await M({
42
- ...N,
43
- ...a
42
+ const s = await _({
43
+ ...$,
44
+ ...t
44
45
  });
45
- C === t && (r.value.total = i.total || ((n = i.data) == null ? void 0 : n.length) || 0, r.value.records = [...i.data || []]);
46
+ V === a && (o.value.total = s.total || ((n = s.data) == null ? void 0 : n.length) || 0, o.value.records = [...s.data || []]);
46
47
  } catch {
47
- C === t && (r.value.records = [], r.value.total = 0);
48
+ V === a && (o.value.records = [], o.value.total = 0);
48
49
  } finally {
49
- r.value.loading = !1;
50
+ o.value.loading = !1;
50
51
  }
51
- }, O = (e) => {
52
- const a = {};
53
- return Object.entries(e).forEach(([t, n]) => {
54
- if (a[t] = n, A && n) {
55
- const i = A[t];
56
- i && (a[t] = re(i, n));
52
+ }, R = (e) => {
53
+ const t = {};
54
+ return Object.entries(e).forEach(([a, n]) => {
55
+ if (t[a] = n, D && n) {
56
+ const s = D[a];
57
+ s && (t[a] = ne(s, n));
57
58
  }
58
- }), a;
59
- }, X = async (e) => {
60
- var n, i, d, g, m, f, h;
61
- const a = ((i = (n = u.value) == null ? void 0 : n.apForm) == null ? void 0 : i.getFieldsValueTransformed(!0)) || {}, t = {};
62
- Object.entries(a).forEach(([v, x]) => {
63
- D && D.indexOf(v) > -1 && (t[v] = x);
64
- }), await ((g = (d = u.value) == null ? void 0 : d.apForm) == null ? void 0 : g.resetFields()), (h = (f = (m = u.value) == null ? void 0 : m.apForm) == null ? void 0 : f.setFieldsValue) == null || h.call(f, t), ae(() => {
59
+ }), t;
60
+ }, Y = async (e) => {
61
+ var n, s, c, m, h, d, v;
62
+ const t = ((s = (n = u.value) == null ? void 0 : n.apForm) == null ? void 0 : s.getFieldsValueTransformed(!0)) || {}, a = {};
63
+ Object.entries(t).forEach(([S, P]) => {
64
+ E && E.indexOf(S) > -1 && (a[S] = P);
65
+ }), await ((m = (c = u.value) == null ? void 0 : c.apForm) == null ? void 0 : m.resetFields()), (v = (d = (h = u.value) == null ? void 0 : h.apForm) == null ? void 0 : d.setFieldsValue) == null || v.call(d, a), re(() => {
65
66
  e == null || e();
66
67
  });
67
- }, S = (e) => {
68
- s = e;
69
- const a = O(e);
70
- E(a);
71
- }, Y = (e) => {
72
- S({
73
- ...s,
68
+ }, x = (e) => {
69
+ i = e;
70
+ const t = R(e);
71
+ O(t);
72
+ }, Z = (e) => {
73
+ x({
74
+ ...i,
74
75
  ...e
75
76
  });
76
- }, R = () => {
77
- var a, t;
78
- const e = ((t = (a = u.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
79
- c.value = 1, S({
77
+ }, j = () => {
78
+ var t, a;
79
+ const e = ((a = (t = u.value) == null ? void 0 : t.apForm) == null ? void 0 : a.getFieldsValueTransformed(!0)) || {};
80
+ p && (f.value = 1), x({
80
81
  ...e,
81
- filter: s.filter,
82
- sort: s.sort,
83
- current: 1,
84
- pageSize: s.pageSize || y
85
- });
86
- }, Z = () => {
87
- U(), s.sort = {}, s.filter = {}, X(R);
88
- }, _ = () => {
89
- S(s);
90
- }, I = (e) => {
91
- const a = o(r).total - e, t = Math.ceil(a / o(p)), n = o(c) > t ? t : o(c);
92
- Y({
93
- current: n > 0 ? n : 1
82
+ filter: i.filter,
83
+ sort: i.sort,
84
+ current: p ? 1 : void 0,
85
+ pageSize: p ? i.pageSize || w : void 0
94
86
  });
95
- }, j = (e, a, t) => {
96
- var f, h, v, x;
97
- const n = ((h = (f = u.value) == null ? void 0 : f.apForm) == null ? void 0 : h.getFieldsValueTransformed(!0)) || {};
98
- c.value = e.current, p.value = e.pageSize, H(a, t);
99
- const i = q(t) ? [...t] : [t], d = {};
100
- for (const l of i)
101
- (v = o(L)) != null && v.includes(l.columnKey || l.field) && l.order && (d[ne(l.columnKey || l.field)] = l.order);
102
- const g = {};
103
- for (const l of Object.keys(a))
104
- (x = o(J)) != null && x.includes(l) && a[l] && (g[l] = a[l]);
105
- const m = {
87
+ }, I = () => {
88
+ X(), i.sort = {}, i.filter = {}, Y(j);
89
+ }, q = () => {
90
+ x(i);
91
+ }, k = (e) => {
92
+ if (!p)
93
+ q();
94
+ else {
95
+ const t = r(f), a = r(g), n = r(o).total - e, s = Math.ceil(n / a), c = t > s ? s : t;
96
+ Z({
97
+ current: c > 0 ? c : 1
98
+ });
99
+ }
100
+ }, B = (e, t, a) => {
101
+ var d, v, S, P;
102
+ const n = ((v = (d = u.value) == null ? void 0 : d.apForm) == null ? void 0 : v.getFieldsValueTransformed(!0)) || {};
103
+ f.value = e.current, g.value = e.pageSize, U(t, a);
104
+ const s = K(a) ? [...a] : [a], c = {};
105
+ for (const l of s)
106
+ (S = r(Q)) != null && S.includes(l.columnKey || l.field) && l.order && (c[se(l.columnKey || l.field)] = l.order);
107
+ const m = {};
108
+ for (const l of Object.keys(t))
109
+ (P = r(L)) != null && P.includes(l) && t[l] && (m[l] = t[l]);
110
+ const h = {
106
111
  ...n,
107
- filter: g,
108
- sort: d,
112
+ filter: m,
113
+ sort: c,
109
114
  current: e.current,
110
115
  pageSize: e.pageSize
111
116
  };
112
- ie(s, m, se) || S(m);
117
+ le(i, h, ie) || x(h);
113
118
  };
114
119
  oe(() => {
115
- var a, t;
116
- const e = ((t = (a = u.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
117
- if (s = {
118
- current: o(c),
119
- pageSize: o(p),
120
+ var t, a;
121
+ const e = ((a = (t = u.value) == null ? void 0 : t.apForm) == null ? void 0 : a.getFieldsValueTransformed(!0)) || {};
122
+ if (i = {
123
+ current: r(f),
124
+ pageSize: r(g),
120
125
  filter: {},
121
126
  sort: {},
122
127
  ...e
123
- }, !B) {
124
- const n = O(s);
125
- E(n);
128
+ }, !M) {
129
+ const n = R(i);
130
+ O(n);
126
131
  }
127
132
  });
128
- const k = V(() => o(r).total === 0 ? "-" : `${o(c.value)}/${Math.ceil(o(r).total / o(p))}`);
129
- function ee(e) {
130
- q(e) && (r.value.records = e, r.value.total = e.length);
133
+ const ee = y(() => r(o).total === 0 ? "-" : `${r(f.value)}/${Math.ceil(r(o).total / r(g))}`);
134
+ function te(e) {
135
+ K(e) && (o.value.records = e, o.value.total = e.length);
131
136
  }
132
- const te = V(() => ({
133
- loading: o(r).loading,
137
+ const ae = y(() => ({
138
+ loading: r(o).loading,
134
139
  pagination: {
135
- current: o(c),
136
- pageSize: o(p),
137
- total: o(r).total,
138
- showSizeChanger: !z,
139
- showQuickJumper: !z,
140
- showLessItems: z,
140
+ current: r(f),
141
+ pageSize: r(g),
142
+ total: r(o).total,
143
+ showSizeChanger: !C,
144
+ showQuickJumper: !C,
145
+ showLessItems: C,
141
146
  size: "default",
142
- showTotal: Q ? (e) => b("span", {
147
+ showTotal: W ? (e) => z("span", {
143
148
  class: F("pagination-total-wrapper")
144
- }, [T("ap.apTable.pagination.totalLeftPrefix"), " ", b("span", {
149
+ }, [T("ap.apTable.pagination.totalLeftPrefix"), " ", z("span", {
145
150
  class: F("pagination-count-text")
146
- }, [e]), " ", T("ap.apTable.pagination.totalLeftSuffix"), b("span", {
151
+ }, [e]), " ", T("ap.apTable.pagination.totalLeftSuffix"), z("span", {
147
152
  class: F("pagination--total-right")
148
- }, [T("ap.apTable.pagination.totalRightPrefix"), " ", b("span", {
153
+ }, [T("ap.apTable.pagination.totalRightPrefix"), " ", z("span", {
149
154
  class: F("pagination-count-text")
150
- }, [o(k)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
155
+ }, [r(ee)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
151
156
  },
152
- onChange: j,
153
- dataSource: o(r).records
157
+ onChange: B,
158
+ dataSource: r(o).records
154
159
  }));
155
160
  return {
156
161
  formRef: u,
157
- submit: R,
158
- reset: Z,
159
- refresh: _,
160
- refreshByDelete: I,
161
- data: r,
162
- current: c,
163
- pageSize: p,
164
- handleTableChange: j,
165
- tableProps: te,
166
- dataSource: V(() => o(r).records),
167
- setDataSource: ee,
168
- getColumnSFConfig: G
162
+ submit: j,
163
+ reset: I,
164
+ refresh: q,
165
+ refreshByDelete: k,
166
+ data: o,
167
+ current: f,
168
+ pageSize: g,
169
+ handleTableChange: B,
170
+ tableProps: ae,
171
+ dataSource: y(() => r(o).records),
172
+ setDataSource: te,
173
+ getColumnSFConfig: H
169
174
  };
170
175
  };
171
176
  export {