@sdata/web-vue 3.13.0 → 3.15.0

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 (300) hide show
  1. package/dist/sd.css +167 -114
  2. package/dist/sd.min.css +2 -2
  3. package/es/_components/input-label/input-label.d.ts +2 -0
  4. package/es/_components/input-label/input-label.js +4 -2
  5. package/es/_components/input-label/style/index.css +2 -2
  6. package/es/_components/picker/style/index.scss +8 -2
  7. package/es/_components/resize-observer.js +1 -1
  8. package/es/_components/resize-trigger.vue_vue_type_script_setup_true_lang.js +13 -3
  9. package/es/_components/select-view/select-view.d.ts +2 -0
  10. package/es/_components/select-view/select-view.js +7 -1
  11. package/es/_components/select-view/style/index.css +5 -5
  12. package/es/_hooks/use-focus-trap.d.ts +10 -0
  13. package/es/_hooks/use-focus-trap.js +115 -0
  14. package/es/_utils/dom.js +1 -10
  15. package/es/_utils/keyboard.d.ts +4 -0
  16. package/es/_utils/keyboard.js +21 -2
  17. package/es/alert/alert.vue.d.ts +2 -2
  18. package/es/alert/alert.vue_vue_type_script_setup_true_lang.js +16 -4
  19. package/es/alert/index.d.ts +5 -5
  20. package/es/alert/style/index.css +1 -1
  21. package/es/alert/style/index.scss +1 -1
  22. package/es/anchor/anchor-link.vue_vue_type_script_setup_true_lang.js +3 -1
  23. package/es/anchor/anchor.vue_vue_type_script_setup_true_lang.js +6 -1
  24. package/es/anchor/style/index.css +1 -1
  25. package/es/anchor/style/index.scss +3 -1
  26. package/es/auto-complete/auto-complete.js +8 -0
  27. package/es/avatar/avatar.vue_vue_type_script_setup_true_lang.js +8 -2
  28. package/es/avatar/style/index.css +2 -2
  29. package/es/avatar/style/index.scss +2 -2
  30. package/es/back-top/back-top.vue_vue_type_script_setup_true_lang.js +8 -1
  31. package/es/back-top/style/index.css +1 -1
  32. package/es/back-top/style/index.scss +2 -1
  33. package/es/badge/badge.js +4 -1
  34. package/es/badge/style/index.css +3 -3
  35. package/es/badge/style/index.scss +3 -3
  36. package/es/basic-crud-table/basic-crud-modal.js +5 -0
  37. package/es/basic-crud-table/basic-crud-modal.vue.d.ts +264 -0
  38. package/es/basic-crud-table/basic-crud-modal.vue_vue_type_script_setup_true_lang.js +139 -0
  39. package/es/basic-crud-table/basic-crud-table.js +5 -0
  40. package/es/basic-crud-table/basic-crud-table.vue.d.ts +935 -0
  41. package/es/basic-crud-table/basic-crud-table.vue_vue_type_script_setup_true_lang.js +510 -0
  42. package/es/basic-crud-table/index.d.ts +2722 -0
  43. package/es/basic-crud-table/index.js +9 -0
  44. package/es/basic-crud-table/style/css.js +2 -0
  45. package/es/basic-crud-table/style/index.css +42 -0
  46. package/es/basic-crud-table/style/index.d.ts +2 -0
  47. package/es/basic-crud-table/style/index.js +2 -0
  48. package/es/basic-crud-table/style/index.scss +33 -0
  49. package/es/basic-crud-table/style/token.scss +8 -0
  50. package/es/basic-crud-table/types.d.ts +69 -0
  51. package/es/breadcrumb/breadcrumb-item.js +4 -2
  52. package/es/breadcrumb/breadcrumb.js +3 -0
  53. package/es/button/button.vue_vue_type_script_setup_true_lang.js +10 -5
  54. package/es/button/style/index.css +15 -6
  55. package/es/button/style/index.scss +25 -7
  56. package/es/calendar/components/event.vue_vue_type_script_setup_true_lang.js +1 -1
  57. package/es/calendar/components/headings-bar.vue_vue_type_script_setup_true_lang.js +1 -1
  58. package/es/calendar/style/event.scss +2 -2
  59. package/es/calendar/style/index.css +2 -2
  60. package/es/card/style/index.css +3 -3
  61. package/es/card/style/index.scss +3 -3
  62. package/es/carousel/carousel-arrow.vue.d.ts +4 -4
  63. package/es/carousel/carousel-arrow.vue_vue_type_script_setup_true_lang.js +25 -5
  64. package/es/carousel/carousel-indicator.vue_vue_type_script_setup_true_lang.js +25 -4
  65. package/es/carousel/carousel-item.vue_vue_type_script_setup_true_lang.js +11 -2
  66. package/es/carousel/carousel.js +20 -1
  67. package/es/carousel/style/index.css +1 -1
  68. package/es/carousel/style/index.scss +1 -1
  69. package/es/cascader/cascader-option.js +1 -1
  70. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +13 -4
  71. package/es/cascader/style/index.css +2 -2
  72. package/es/cascader/style/index.scss +3 -1
  73. package/es/checkbox/checkbox-group.js +4 -1
  74. package/es/checkbox/checkbox.d.ts +9 -0
  75. package/es/checkbox/checkbox.js +14 -0
  76. package/es/checkbox/index.d.ts +15 -0
  77. package/es/checkbox/style/index.css +1 -1
  78. package/es/checkbox/style/index.scss +1 -1
  79. package/es/collapse/collapse-item.js +21 -3
  80. package/es/collapse/context.d.ts +1 -1
  81. package/es/color-picker/color-picker.js +6 -0
  82. package/es/color-picker/panel.js +5 -3
  83. package/es/components.d.ts +1 -0
  84. package/es/copy/copy.vue_vue_type_script_setup_true_lang.js +11 -3
  85. package/es/date-picker/hooks/use-provide-datepicker-transform.js +1 -1
  86. package/es/date-picker/panels/body.vue_vue_type_script_setup_true_lang.js +14 -1
  87. package/es/date-picker/panels/header.vue_vue_type_script_setup_true_lang.js +1 -1
  88. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +4 -3
  89. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +2 -2
  90. package/es/date-picker/style/index.css +5 -5
  91. package/es/date-picker/style/index.scss +4 -3
  92. package/es/drawer/drawer.vue.d.ts +1 -1
  93. package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +31 -9
  94. package/es/drawer/index.d.ts +3 -3
  95. package/es/dropdown/dropdown-button.vue_vue_type_script_setup_true_lang.js +1 -1
  96. package/es/dropdown/dropdown-option.vue_vue_type_script_setup_true_lang.js +5 -1
  97. package/es/dropdown/dropdown-panel.vue.d.ts +9 -0
  98. package/es/dropdown/dropdown-panel.vue_vue_type_script_setup_true_lang.js +76 -3
  99. package/es/dropdown/dropdown-submenu.vue_vue_type_script_setup_true_lang.js +6 -3
  100. package/es/dropdown/dropdown.vue_vue_type_script_setup_true_lang.js +4 -2
  101. package/es/dropdown/style/index.css +1 -1
  102. package/es/dropdown/style/index.scss +3 -1
  103. package/es/file-previewer/file-previewer.vue.d.ts +1 -1
  104. package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +18 -10
  105. package/es/file-previewer/index.d.ts +3 -3
  106. package/es/form/context.d.ts +1 -0
  107. package/es/form/form-item.vue_vue_type_script_setup_true_lang.js +7 -3
  108. package/es/form/index.js +1 -1
  109. package/es/form/style/index.css +2 -2
  110. package/es/form/style/index.scss +2 -2
  111. package/es/grid/grid-col.vue_vue_type_script_setup_true_lang.js +1 -1
  112. package/es/grid/grid-item.vue_vue_type_script_setup_true_lang.js +1 -1
  113. package/es/grid/grid-row.vue_vue_type_script_setup_true_lang.js +1 -1
  114. package/es/grid/grid.vue_vue_type_script_setup_true_lang.js +1 -1
  115. package/es/image/image.vue_vue_type_script_setup_true_lang.js +1 -1
  116. package/es/image/preview-arrow.vue_vue_type_script_setup_true_lang.js +1 -1
  117. package/es/image/preview.vue.d.ts +1 -1
  118. package/es/image/preview.vue_vue_type_script_setup_true_lang.js +2 -2
  119. package/es/index.css +167 -114
  120. package/es/index.d.ts +2 -0
  121. package/es/index.js +55 -54
  122. package/es/index.scss +1 -0
  123. package/es/input/input.js +18 -2
  124. package/es/input/style/index.css +2 -2
  125. package/es/input/style/input.scss +4 -4
  126. package/es/input-number/input-number.js +9 -3
  127. package/es/input-number/style/index.css +3 -3
  128. package/es/input-number/style/index.scss +5 -1
  129. package/es/input-tag/index.d.ts +3 -0
  130. package/es/input-tag/input-tag.d.ts +2 -0
  131. package/es/input-tag/input-tag.js +34 -30
  132. package/es/input-tag/style/index.css +8 -8
  133. package/es/input-tag/style/index.scss +11 -5
  134. package/es/json-form/style/index.css +0 -3
  135. package/es/json-form/style/index.scss +4 -3
  136. package/es/json-form/utils.js +4 -4
  137. package/es/layout/sider.vue_vue_type_script_setup_true_lang.js +34 -7
  138. package/es/layout/style/index.css +2 -2
  139. package/es/layout/style/index.scss +4 -2
  140. package/es/link/link.vue_vue_type_script_setup_true_lang.js +1 -1
  141. package/es/link/style/index.css +1 -1
  142. package/es/link/style/index.scss +3 -1
  143. package/es/list/list.js +1 -1
  144. package/es/locale/interface.d.ts +39 -0
  145. package/es/locale/lang/ar-eg.js +38 -0
  146. package/es/locale/lang/de-de.js +38 -0
  147. package/es/locale/lang/en-us.js +38 -0
  148. package/es/locale/lang/es-es.js +38 -0
  149. package/es/locale/lang/fr-fr.js +38 -0
  150. package/es/locale/lang/id-id.js +38 -0
  151. package/es/locale/lang/it-it.js +38 -0
  152. package/es/locale/lang/ja-jp.js +38 -0
  153. package/es/locale/lang/km-kh.js +38 -0
  154. package/es/locale/lang/ko-kr.js +38 -0
  155. package/es/locale/lang/ms-my.js +38 -0
  156. package/es/locale/lang/nl-nl.js +38 -0
  157. package/es/locale/lang/pt-pt.js +38 -0
  158. package/es/locale/lang/ru-ru.js +38 -0
  159. package/es/locale/lang/th-th.js +38 -0
  160. package/es/locale/lang/vi-vn.js +38 -0
  161. package/es/locale/lang/zh-cn.js +38 -0
  162. package/es/locale/lang/zh-tw.js +38 -0
  163. package/es/mention/mention.js +8 -0
  164. package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +29 -3
  165. package/es/menu/item.d.ts +1 -1
  166. package/es/menu/item.js +14 -1
  167. package/es/menu/style/index.css +6 -6
  168. package/es/menu/style/index.scss +5 -3
  169. package/es/message/style/index.css +3 -3
  170. package/es/message/style/index.scss +5 -3
  171. package/es/modal/index.d.ts +3 -3
  172. package/es/modal/modal.vue.d.ts +1 -1
  173. package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +31 -15
  174. package/es/modal/style/index.css +2 -2
  175. package/es/modal/style/index.scss +3 -2
  176. package/es/notification/style/index.css +3 -3
  177. package/es/notification/style/index.scss +11 -3
  178. package/es/overflow-list/overflow-list.js +1 -1
  179. package/es/page-header/page-header.vue.d.ts +6 -6
  180. package/es/page-header/page-header.vue_vue_type_script_setup_true_lang.js +19 -2
  181. package/es/pagination/page-item-ellipsis.vue_vue_type_script_setup_true_lang.js +15 -2
  182. package/es/pagination/page-item-step.vue.d.ts +2 -2
  183. package/es/pagination/page-item-step.vue_vue_type_script_setup_true_lang.js +23 -4
  184. package/es/pagination/page-item.vue.d.ts +2 -2
  185. package/es/pagination/page-item.vue_vue_type_script_setup_true_lang.js +21 -3
  186. package/es/pagination/pagination.js +5 -1
  187. package/es/pagination/style/index.css +6 -1
  188. package/es/pagination/style/index.scss +9 -3
  189. package/es/popconfirm/popconfirm.vue_vue_type_script_setup_true_lang.js +3 -1
  190. package/es/popover/popover.vue_vue_type_script_setup_true_lang.js +2 -0
  191. package/es/progress/style/index.css +2 -2
  192. package/es/progress/style/index.scss +5 -3
  193. package/es/qr-code/qr-code-status.vue_vue_type_script_setup_true_lang.js +5 -1
  194. package/es/qr-code/qr-code.vue_vue_type_script_setup_true_lang.js +13 -6
  195. package/es/radio/context.d.ts +1 -0
  196. package/es/radio/radio-group.js +6 -2
  197. package/es/radio/radio.js +1 -0
  198. package/es/radio/style/index.css +2 -2
  199. package/es/radio/style/index.scss +4 -2
  200. package/es/rate/rate.js +27 -1
  201. package/es/resize-box/resize-box.vue.d.ts +4 -4
  202. package/es/resize-box/resize-box.vue_vue_type_script_setup_true_lang.js +30 -1
  203. package/es/result/result.vue_vue_type_script_setup_true_lang.js +7 -4
  204. package/es/sd-vue.js +54 -52
  205. package/es/secret/secret.vue_vue_type_script_setup_true_lang.js +3 -1
  206. package/es/select/index.d.ts +124 -0
  207. package/es/select/select-dropdown.vue_vue_type_script_setup_true_lang.js +4 -1
  208. package/es/select/select.d.ts +62 -0
  209. package/es/select/select.js +20 -4
  210. package/es/select/style/index.css +1 -1
  211. package/es/select/style/index.scss +3 -1
  212. package/es/selectable-card/style/index.css +2 -2
  213. package/es/selectable-card/style/index.scss +5 -5
  214. package/es/skeleton/skeleton.vue_vue_type_script_setup_true_lang.js +5 -1
  215. package/es/slider/slider-button.vue.d.ts +2 -0
  216. package/es/slider/slider-button.vue_vue_type_script_setup_true_lang.js +7 -2
  217. package/es/slider/slider.vue_vue_type_script_setup_true_lang.js +23 -2
  218. package/es/slider/style/index.css +1 -1
  219. package/es/slider/style/index.scss +3 -1
  220. package/es/spin/spin.js +7 -2
  221. package/es/spin/style/index.css +1 -1
  222. package/es/spin/style/index.scss +1 -1
  223. package/es/split/split.vue.d.ts +4 -4
  224. package/es/split/split.vue_vue_type_script_setup_true_lang.js +27 -3
  225. package/es/statistic/statistic.vue_vue_type_script_setup_true_lang.js +1 -1
  226. package/es/steps/context.d.ts +1 -0
  227. package/es/steps/step.vue_vue_type_script_setup_true_lang.js +15 -2
  228. package/es/steps/steps.vue_vue_type_script_setup_true_lang.js +10 -2
  229. package/es/steps/style/index.css +1 -1
  230. package/es/steps/style/index.scss +1 -1
  231. package/es/style/animation/index.scss +1 -0
  232. package/es/style/animation/reduced-motion.scss +22 -0
  233. package/es/style/animation/zoom.scss +7 -6
  234. package/es/style/icon.scss +9 -1
  235. package/es/switch/style/index.css +1 -1
  236. package/es/switch/style/index.scss +4 -1
  237. package/es/switch/switch.vue_vue_type_script_setup_true_lang.js +6 -1
  238. package/es/table/index.d.ts +4 -4
  239. package/es/table/style/index.css +8 -8
  240. package/es/table/style/index.scss +11 -8
  241. package/es/table/table-operation-td.d.ts +15 -0
  242. package/es/table/table-operation-td.js +3 -3
  243. package/es/table/table-operation-th.js +1 -1
  244. package/es/table/table-tbody.js +4 -1
  245. package/es/table/table-td.js +2 -1
  246. package/es/table/table-th.d.ts +1 -1
  247. package/es/table/table-th.js +7 -5
  248. package/es/table/table-thead.js +4 -1
  249. package/es/table/table-tr.js +4 -1
  250. package/es/table/table.d.ts +1 -1
  251. package/es/table/table.js +8 -4
  252. package/es/tabs/context.d.ts +1 -0
  253. package/es/tabs/style/index.css +5 -5
  254. package/es/tabs/style/index.scss +7 -7
  255. package/es/tabs/tab-pane.vue_vue_type_script_setup_true_lang.js +21 -2
  256. package/es/tabs/tabs-button.js +1 -1
  257. package/es/tabs/tabs-nav.js +34 -1
  258. package/es/tabs/tabs-tab.vue_vue_type_script_setup_true_lang.js +27 -4
  259. package/es/tabs/tabs.js +4 -2
  260. package/es/tag/index.d.ts +5 -5
  261. package/es/tag/style/index.css +1 -1
  262. package/es/tag/style/index.scss +3 -1
  263. package/es/tag/tag.vue.d.ts +2 -2
  264. package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +27 -4
  265. package/es/tag-group/tag-group.vue_vue_type_script_setup_true_lang.js +2 -2
  266. package/es/textarea/style/index.css +2 -2
  267. package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +18 -3
  268. package/es/time-picker/time-column.vue_vue_type_script_setup_true_lang.js +11 -3
  269. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +6 -3
  270. package/es/toolbar/index.d.ts +3 -3
  271. package/es/toolbar/toolbar.vue.d.ts +2 -2
  272. package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +5 -5
  273. package/es/tooltip/tooltip.vue_vue_type_script_setup_true_lang.js +1 -0
  274. package/es/transfer/style/index.css +1 -1
  275. package/es/transfer/style/index.scss +1 -1
  276. package/es/transfer/transfer-list-item.js +18 -2
  277. package/es/transfer/transfer.vue_vue_type_script_setup_true_lang.js +7 -5
  278. package/es/tree/base-node.vue_vue_type_script_setup_true_lang.js +28 -8
  279. package/es/tree/context.d.ts +2 -0
  280. package/es/tree/node-switcher.vue_vue_type_script_lang.js +1 -1
  281. package/es/tree/style/index.css +1 -1
  282. package/es/tree/style/index.scss +1 -1
  283. package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +81 -2
  284. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +10 -1
  285. package/es/trigger/index.d.ts +45 -0
  286. package/es/trigger/trigger.d.ts +27 -0
  287. package/es/trigger/trigger.js +47 -5
  288. package/es/typography/edit-content.vue_vue_type_script_setup_true_lang.js +17 -8
  289. package/es/typography/operations.vue_vue_type_script_setup_true_lang.js +38 -6
  290. package/es/typography/style/index.css +2 -2
  291. package/es/typography/style/index.scss +2 -2
  292. package/es/upload/style/index.css +9 -9
  293. package/es/upload/style/index.scss +15 -9
  294. package/es/upload/upload-list-item.js +18 -5
  295. package/es/upload/upload-picture-item.js +27 -3
  296. package/es/verification-code/verification-code.js +8 -1
  297. package/json/vetur-attributes.json +15 -0
  298. package/json/vetur-tags.json +9 -2
  299. package/json/web-types.json +39 -1
  300. package/package.json +1 -1
@@ -0,0 +1,510 @@
1
+ import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/objectSpread2.js";
2
+ import { getPrefixCls } from "../_utils/global-config.js";
3
+ import { isPromise } from "../_utils/is.js";
4
+ import { _asyncToGenerator } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/asyncToGenerator.js";
5
+ import Button from "../button/index.js";
6
+ import Spin from "../spin/index.js";
7
+ import Link from "../link/index.js";
8
+ import Popconfirm from "../popconfirm/index.js";
9
+ import Space from "../space/index.js";
10
+ import Table from "../table/index.js";
11
+ import Toolbar from "../toolbar/index.js";
12
+ import basic_crud_modal_default from "./basic-crud-modal.js";
13
+ import { computed, createBlock, createCommentVNode, createElementBlock, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, unref, useModel, useSlots, withCtx } from "vue";
14
+ import { isFunction, isNil, isString, omitBy } from "es-toolkit";
15
+ //#region components/basic-crud-table/basic-crud-table.vue?vue&type=script&setup=true&lang.ts
16
+ var _hoisted_1 = ["aria-busy"];
17
+ var basic_crud_table_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, {
18
+ name: "BasicCrudTable",
19
+ inheritAttrs: false
20
+ }), {}, {
21
+ __name: "basic-crud-table",
22
+ props: /*@__PURE__*/ mergeModels({
23
+ title: {},
24
+ columns: {},
25
+ tableProps: { default: () => ({}) },
26
+ toolbarProps: { default: () => ({}) },
27
+ modalProps: { default: () => ({}) },
28
+ modalFormProps: { default: () => ({ schemas: [] }) },
29
+ showCreate: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ openCreateModal: {
34
+ type: Boolean,
35
+ default: true
36
+ },
37
+ showEdit: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ showDelete: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ showToolbar: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ showHeader: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ showTitle: {
54
+ type: Boolean,
55
+ default: true
56
+ },
57
+ showActionColumn: {
58
+ type: Boolean,
59
+ default: true
60
+ },
61
+ fetchExcludeEmptyValues: {
62
+ type: Boolean,
63
+ default: false
64
+ },
65
+ fetchTableOnMounted: {
66
+ type: Boolean,
67
+ default: true
68
+ },
69
+ actionWidth: { default: 120 },
70
+ fetchTableApi: { type: Function },
71
+ tableDataTransformer: { type: Function },
72
+ createApi: { type: Function },
73
+ updateApi: { type: Function },
74
+ detailApi: { type: Function },
75
+ valueTransformer: { type: Function },
76
+ beforeModalSubmit: { type: Function },
77
+ deleteContent: { type: [String, Function] },
78
+ deleteApi: { type: Function },
79
+ beforeDelete: { type: Function },
80
+ deleteNameKey: {}
81
+ }, {
82
+ "loading": _objectSpread2({ type: Boolean }, { default: false }),
83
+ "loadingModifiers": {},
84
+ "toolbarModel": { default: () => ({}) },
85
+ "toolbarModelModifiers": {},
86
+ "tableData": { default: () => [] },
87
+ "tableDataModifiers": {},
88
+ "modalModel": { default: () => ({}) },
89
+ "modalModelModifiers": {},
90
+ "modalVisible": _objectSpread2({ type: Boolean }, { default: false }),
91
+ "modalVisibleModifiers": {}
92
+ }),
93
+ emits: /*@__PURE__*/ mergeModels([
94
+ "create",
95
+ "edit",
96
+ "delete",
97
+ "reset",
98
+ "search",
99
+ "tableFetched",
100
+ "modalSuccess",
101
+ "modalClose",
102
+ "error"
103
+ ], [
104
+ "update:loading",
105
+ "update:toolbarModel",
106
+ "update:tableData",
107
+ "update:modalModel",
108
+ "update:modalVisible"
109
+ ]),
110
+ setup(__props, { expose: __expose, emit: __emit }) {
111
+ const emit = __emit;
112
+ const loading = useModel(__props, "loading");
113
+ const toolbarModel = useModel(__props, "toolbarModel");
114
+ const tableData = useModel(__props, "tableData");
115
+ const modalModel = useModel(__props, "modalModel");
116
+ const modalVisible = useModel(__props, "modalVisible");
117
+ const slots = useSlots();
118
+ const toolbarRef = shallowRef();
119
+ const modalRef = shallowRef();
120
+ const current = shallowRef(resolvePaginationNumber("current", "defaultCurrent", 1));
121
+ const pageSize = shallowRef(resolvePaginationNumber("pageSize", "defaultPageSize", 10));
122
+ const total = shallowRef(0);
123
+ const sorter = shallowRef({});
124
+ const fetchData = shallowRef();
125
+ const prefixCls = getPrefixCls("basic-crud-table");
126
+ const cls = computed(() => [prefixCls, { [`${prefixCls}-loading`]: loading.value }]);
127
+ const toolbarSlotNames = computed(() => getForwardedSlotNames("toolbar__", [
128
+ "default",
129
+ "action_prepend",
130
+ "action_append"
131
+ ]));
132
+ const tableSlotNames = computed(() => getForwardedSlotNames("table__", ["action_prepend", "action_append"]));
133
+ const modalSlotNames = computed(() => getForwardedSlotNames("modal__"));
134
+ const resolvedColumns = computed(() => __props.showActionColumn ? [...__props.columns, {
135
+ title: "操作",
136
+ dataIndex: "__basic_crud_action__",
137
+ slotName: "basic-crud-action",
138
+ width: __props.actionWidth,
139
+ fixed: "right"
140
+ }] : __props.columns);
141
+ const resolvedPagination = computed(() => __props.tableProps.pagination === false ? false : _objectSpread2(_objectSpread2({}, typeof __props.tableProps.pagination === "object" ? __props.tableProps.pagination : {}), {}, {
142
+ current: current.value,
143
+ pageSize: pageSize.value,
144
+ total: total.value
145
+ }));
146
+ const params = computed(() => _objectSpread2(_objectSpread2({
147
+ current: current.value,
148
+ pageSize: pageSize.value
149
+ }, sorter.value), toolbarModel.value));
150
+ onMounted(() => {
151
+ if (__props.fetchTableOnMounted) handleFetchData();
152
+ });
153
+ function getForwardedSlotNames(prefix, excluded = []) {
154
+ return Object.keys(slots).filter((name) => name.startsWith(prefix)).map((name) => name.slice(prefix.length)).filter((name) => !excluded.includes(name));
155
+ }
156
+ function resolvePaginationNumber(controlled, initial, fallback) {
157
+ var _ref, _pagination$controlle;
158
+ const pagination = __props.tableProps.pagination;
159
+ return typeof pagination === "object" ? Number((_ref = (_pagination$controlle = pagination[controlled]) !== null && _pagination$controlle !== void 0 ? _pagination$controlle : pagination[initial]) !== null && _ref !== void 0 ? _ref : fallback) : fallback;
160
+ }
161
+ function isObjectResult(value) {
162
+ return !!value && typeof value === "object" && Array.isArray(value.data);
163
+ }
164
+ function handleFetchData() {
165
+ return _handleFetchData.apply(this, arguments);
166
+ }
167
+ function _handleFetchData() {
168
+ _handleFetchData = _asyncToGenerator(function* (fetchParams = params.value) {
169
+ if (isNil(__props.fetchTableApi)) return;
170
+ loading.value = true;
171
+ try {
172
+ const requestParams = __props.fetchExcludeEmptyValues ? omitBy(fetchParams, (value) => value === "" || value === null || value === void 0) : fetchParams;
173
+ const response = yield __props.fetchTableApi(requestParams);
174
+ fetchData.value = response;
175
+ const result = isFunction(__props.tableDataTransformer) ? yield __props.tableDataTransformer(response) : response;
176
+ if (Array.isArray(result)) {
177
+ tableData.value = result;
178
+ total.value = result.length;
179
+ } else if (isObjectResult(result)) {
180
+ var _ref2, _result$total;
181
+ tableData.value = result.data;
182
+ total.value = (_ref2 = (_result$total = result.total) !== null && _result$total !== void 0 ? _result$total : result.count) !== null && _ref2 !== void 0 ? _ref2 : result.data.length;
183
+ } else return;
184
+ emit("tableFetched", tableData.value, result);
185
+ } catch (error) {
186
+ emit("error", error);
187
+ } finally {
188
+ loading.value = false;
189
+ }
190
+ });
191
+ return _handleFetchData.apply(this, arguments);
192
+ }
193
+ function handleSearch() {
194
+ return _handleSearch.apply(this, arguments);
195
+ }
196
+ function _handleSearch() {
197
+ _handleSearch = _asyncToGenerator(function* () {
198
+ current.value = 1;
199
+ yield handleFetchData();
200
+ emit("search", toolbarModel.value);
201
+ });
202
+ return _handleSearch.apply(this, arguments);
203
+ }
204
+ function handleReset() {
205
+ return _handleReset.apply(this, arguments);
206
+ }
207
+ function _handleReset() {
208
+ _handleReset = _asyncToGenerator(function* () {
209
+ current.value = 1;
210
+ sorter.value = {};
211
+ yield nextTick();
212
+ yield handleFetchData();
213
+ emit("reset");
214
+ });
215
+ return _handleReset.apply(this, arguments);
216
+ }
217
+ /** 仅重置工具栏筛选项,不触发列表请求。 */
218
+ function resetToolbar() {
219
+ var _toolbarRef$value;
220
+ (_toolbarRef$value = toolbarRef.value) === null || _toolbarRef$value === void 0 || _toolbarRef$value.reset(false);
221
+ }
222
+ /** 重置工具栏筛选、分页与排序,并重新请求列表。 */
223
+ function reset() {
224
+ return _reset.apply(this, arguments);
225
+ }
226
+ function _reset() {
227
+ _reset = _asyncToGenerator(function* () {
228
+ resetToolbar();
229
+ yield handleReset();
230
+ });
231
+ return _reset.apply(this, arguments);
232
+ }
233
+ function handleCreate() {
234
+ var _modalRef$value;
235
+ if (__props.openCreateModal) (_modalRef$value = modalRef.value) === null || _modalRef$value === void 0 || _modalRef$value.open();
236
+ emit("create");
237
+ }
238
+ function handleEdit(_x, _x2) {
239
+ return _handleEdit.apply(this, arguments);
240
+ }
241
+ function _handleEdit() {
242
+ _handleEdit = _asyncToGenerator(function* (row, context) {
243
+ var _modalRef$value2;
244
+ yield (_modalRef$value2 = modalRef.value) === null || _modalRef$value2 === void 0 ? void 0 : _modalRef$value2.open(row);
245
+ emit("edit", row, context);
246
+ });
247
+ return _handleEdit.apply(this, arguments);
248
+ }
249
+ const deleteConfirmContent = ref("确定要删除此条记录吗?");
250
+ const pendingDeleteRow = shallowRef();
251
+ function resolveDeleteContent(row) {
252
+ if (isString(__props.deleteContent)) return __props.deleteContent;
253
+ if (isFunction(__props.deleteContent)) return __props.deleteContent(row);
254
+ const name = __props.deleteNameKey ? row[__props.deleteNameKey] : void 0;
255
+ return name ? `确定删除【${String(name)}】吗?` : "确定要删除此条记录吗?";
256
+ }
257
+ function handleDeletePopupChange(visible, row) {
258
+ if (!visible) return;
259
+ pendingDeleteRow.value = row;
260
+ const resolved = resolveDeleteContent(row);
261
+ if (isPromise(resolved)) resolved.then((content) => {
262
+ if (pendingDeleteRow.value === row) deleteConfirmContent.value = content;
263
+ });
264
+ else deleteConfirmContent.value = resolved;
265
+ }
266
+ function executeDelete(_x3, _x4) {
267
+ return _executeDelete.apply(this, arguments);
268
+ }
269
+ function _executeDelete() {
270
+ _executeDelete = _asyncToGenerator(function* (row, context) {
271
+ if (__props.beforeDelete && (yield __props.beforeDelete(row)) === false) return false;
272
+ emit("delete", row, context);
273
+ try {
274
+ if (__props.deleteApi) yield __props.deleteApi(row);
275
+ yield handleFetchData();
276
+ return true;
277
+ } catch (error) {
278
+ emit("error", error);
279
+ return false;
280
+ }
281
+ });
282
+ return _executeDelete.apply(this, arguments);
283
+ }
284
+ function handleDeleteConfirm() {
285
+ const row = pendingDeleteRow.value;
286
+ if (!row) return Promise.resolve(false);
287
+ return executeDelete(row);
288
+ }
289
+ function handleModalSuccess(_x5, _x6) {
290
+ return _handleModalSuccess.apply(this, arguments);
291
+ }
292
+ function _handleModalSuccess() {
293
+ _handleModalSuccess = _asyncToGenerator(function* (result, context) {
294
+ yield handleFetchData();
295
+ emit("modalSuccess", result, context);
296
+ });
297
+ return _handleModalSuccess.apply(this, arguments);
298
+ }
299
+ function handlePageChange(_x7) {
300
+ return _handlePageChange.apply(this, arguments);
301
+ }
302
+ function _handlePageChange() {
303
+ _handlePageChange = _asyncToGenerator(function* (value) {
304
+ current.value = value;
305
+ yield handleFetchData();
306
+ });
307
+ return _handlePageChange.apply(this, arguments);
308
+ }
309
+ function handlePageSizeChange(_x8) {
310
+ return _handlePageSizeChange.apply(this, arguments);
311
+ }
312
+ function _handlePageSizeChange() {
313
+ _handlePageSizeChange = _asyncToGenerator(function* (value) {
314
+ pageSize.value = value;
315
+ current.value = 1;
316
+ yield handleFetchData();
317
+ });
318
+ return _handlePageSizeChange.apply(this, arguments);
319
+ }
320
+ function handleTableChange(_x9, _x10) {
321
+ return _handleTableChange.apply(this, arguments);
322
+ }
323
+ function _handleTableChange() {
324
+ _handleTableChange = _asyncToGenerator(function* (_data, extra) {
325
+ var _extra$sorter;
326
+ if (extra.type !== "sorter") return;
327
+ sorter.value = ((_extra$sorter = extra.sorter) === null || _extra$sorter === void 0 ? void 0 : _extra$sorter.field) && extra.sorter.direction ? { sort_by: extra.sorter.direction === "descend" ? `-${extra.sorter.field}` : extra.sorter.field } : {};
328
+ current.value = 1;
329
+ yield handleFetchData();
330
+ });
331
+ return _handleTableChange.apply(this, arguments);
332
+ }
333
+ __expose({
334
+ fetchTableData: handleFetchData,
335
+ search: handleSearch,
336
+ /** 重置工具栏筛选 + 分页/排序并刷新(全量重置)。 */
337
+ reset,
338
+ /** 仅重置工具栏筛选项,不刷新。 */
339
+ resetToolbar,
340
+ /** 仅重置分页/排序并刷新,不动工具栏。 */
341
+ resetTable: handleReset,
342
+ create: handleCreate,
343
+ edit: handleEdit,
344
+ delete: executeDelete,
345
+ tableData: computed(() => tableData.value),
346
+ fetchData: computed(() => fetchData.value),
347
+ isCreate: computed(() => {
348
+ var _modalRef$value3;
349
+ return ((_modalRef$value3 = modalRef.value) === null || _modalRef$value3 === void 0 ? void 0 : _modalRef$value3.type) === "create";
350
+ }),
351
+ modalRef
352
+ });
353
+ return (_ctx, _cache) => {
354
+ return openBlock(), createElementBlock("section", {
355
+ class: normalizeClass(cls.value),
356
+ "aria-busy": loading.value
357
+ }, [
358
+ __props.showHeader ? (openBlock(), createElementBlock("header", {
359
+ key: 0,
360
+ class: normalizeClass(`${unref(prefixCls)}-header`)
361
+ }, [
362
+ renderSlot(_ctx.$slots, "header__title", { title: __props.title }, () => [__props.showTitle && __props.title ? (openBlock(), createElementBlock("h3", {
363
+ key: 0,
364
+ class: normalizeClass(`${unref(prefixCls)}-title`)
365
+ }, toDisplayString(__props.title), 3)) : createCommentVNode("", true)]),
366
+ renderSlot(_ctx.$slots, "header__extra"),
367
+ !__props.showToolbar && __props.showCreate ? (openBlock(), createElementBlock("div", {
368
+ key: 0,
369
+ class: normalizeClass(`${unref(prefixCls)}-header-actions`)
370
+ }, [createVNode(unref(Button), {
371
+ type: "primary",
372
+ onClick: handleCreate
373
+ }, {
374
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("新建", -1)])]),
375
+ _: 1
376
+ })], 2)) : createCommentVNode("", true),
377
+ __props.showToolbar ? (openBlock(), createBlock(unref(Toolbar), mergeProps({
378
+ key: 1,
379
+ ref_key: "toolbarRef",
380
+ ref: toolbarRef,
381
+ modelValue: toolbarModel.value,
382
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => toolbarModel.value = $event)
383
+ }, __props.toolbarProps, {
384
+ loading: loading.value,
385
+ onSearch: handleSearch,
386
+ onReset: handleReset
387
+ }), createSlots({
388
+ "action-append": withCtx(() => [renderSlot(_ctx.$slots, "toolbar__action_append"), __props.showCreate ? (openBlock(), createBlock(unref(Button), {
389
+ key: 0,
390
+ type: "primary",
391
+ onClick: handleCreate
392
+ }, {
393
+ default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("新建", -1)])]),
394
+ _: 1
395
+ })) : createCommentVNode("", true)]),
396
+ _: 2
397
+ }, [
398
+ _ctx.$slots.toolbar__default ? {
399
+ name: "default",
400
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "toolbar__default")]),
401
+ key: "0"
402
+ } : void 0,
403
+ _ctx.$slots.toolbar__action_prepend ? {
404
+ name: "action-prepend",
405
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "toolbar__action_prepend")]),
406
+ key: "1"
407
+ } : void 0,
408
+ renderList(toolbarSlotNames.value, (name) => {
409
+ return {
410
+ name,
411
+ fn: withCtx((data) => [renderSlot(_ctx.$slots, `toolbar__${name}`, normalizeProps(guardReactiveProps(data)))])
412
+ };
413
+ })
414
+ ]), 1040, ["modelValue", "loading"])) : createCommentVNode("", true)
415
+ ], 2)) : createCommentVNode("", true),
416
+ createVNode(unref(Spin), {
417
+ loading: loading.value,
418
+ class: normalizeClass(`${unref(prefixCls)}-body`)
419
+ }, {
420
+ default: withCtx(() => [createVNode(unref(Table), mergeProps(__props.tableProps, {
421
+ columns: resolvedColumns.value,
422
+ data: tableData.value,
423
+ pagination: resolvedPagination.value,
424
+ onPageChange: handlePageChange,
425
+ onPageSizeChange: handlePageSizeChange,
426
+ onChange: handleTableChange
427
+ }), createSlots({
428
+ "basic-crud-action": withCtx((data) => [createVNode(unref(Space), null, {
429
+ default: withCtx(() => [
430
+ renderSlot(_ctx.$slots, "table__action_prepend", normalizeProps(guardReactiveProps(data))),
431
+ __props.showEdit ? (openBlock(), createBlock(unref(Link), {
432
+ key: 0,
433
+ ellipsis: false,
434
+ onClick: ($event) => handleEdit(data.record, data)
435
+ }, {
436
+ default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode(" 编辑 ", -1)])]),
437
+ _: 1
438
+ }, 8, ["onClick"])) : createCommentVNode("", true),
439
+ __props.showDelete ? (openBlock(), createBlock(unref(Popconfirm), {
440
+ key: 1,
441
+ content: deleteConfirmContent.value,
442
+ type: "warning",
443
+ "on-before-ok": handleDeleteConfirm,
444
+ onPopupVisibleChange: (visible) => handleDeletePopupChange(visible, data.record)
445
+ }, {
446
+ default: withCtx(() => [createVNode(unref(Link), {
447
+ ellipsis: false,
448
+ status: "danger"
449
+ }, {
450
+ default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("删除", -1)])]),
451
+ _: 1
452
+ })]),
453
+ _: 1
454
+ }, 8, ["content", "onPopupVisibleChange"])) : createCommentVNode("", true),
455
+ renderSlot(_ctx.$slots, "table__action_append", normalizeProps(guardReactiveProps(data)))
456
+ ]),
457
+ _: 2
458
+ }, 1024)]),
459
+ _: 2
460
+ }, [renderList(tableSlotNames.value, (name) => {
461
+ return {
462
+ name,
463
+ fn: withCtx((data) => [renderSlot(_ctx.$slots, `table__${name}`, normalizeProps(guardReactiveProps(data)))])
464
+ };
465
+ })]), 1040, [
466
+ "columns",
467
+ "data",
468
+ "pagination"
469
+ ])]),
470
+ _: 3
471
+ }, 8, ["loading", "class"]),
472
+ createVNode(basic_crud_modal_default, {
473
+ ref_key: "modalRef",
474
+ ref: modalRef,
475
+ visible: modalVisible.value,
476
+ "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => modalVisible.value = $event),
477
+ model: modalModel.value,
478
+ "onUpdate:model": _cache[2] || (_cache[2] = ($event) => modalModel.value = $event),
479
+ "modal-props": __props.modalProps,
480
+ "modal-form-props": __props.modalFormProps,
481
+ "create-api": __props.createApi,
482
+ "update-api": __props.updateApi,
483
+ "detail-api": __props.detailApi,
484
+ "value-transformer": __props.valueTransformer,
485
+ "before-submit": __props.beforeModalSubmit,
486
+ onSuccess: handleModalSuccess,
487
+ onClose: _cache[3] || (_cache[3] = ($event) => emit("modalClose")),
488
+ onError: _cache[4] || (_cache[4] = ($event) => emit("error", $event))
489
+ }, createSlots({ _: 2 }, [renderList(modalSlotNames.value, (name) => {
490
+ return {
491
+ name,
492
+ fn: withCtx((data) => [renderSlot(_ctx.$slots, `modal__${name}`, normalizeProps(guardReactiveProps(data)))])
493
+ };
494
+ })]), 1032, [
495
+ "visible",
496
+ "model",
497
+ "modal-props",
498
+ "modal-form-props",
499
+ "create-api",
500
+ "update-api",
501
+ "detail-api",
502
+ "value-transformer",
503
+ "before-submit"
504
+ ])
505
+ ], 10, _hoisted_1);
506
+ };
507
+ }
508
+ }));
509
+ //#endregion
510
+ export { basic_crud_table_vue_vue_type_script_setup_true_lang_default as default };