@king-one/antdv 1.1.9 → 1.1.11

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 (262) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/components/collapse-transtion/hooks/use-collapse-transtion.mjs +108 -41
  3. package/dist/es/components/collapse-transtion/index.mjs +7 -7
  4. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.mjs +2 -2
  5. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue2.mjs +24 -19
  6. package/dist/es/components/collapse-transtion/src/types.mjs +3 -3
  7. package/dist/es/components/cover-scroll-bar/hooks/use-has-scroll.mjs +25 -12
  8. package/dist/es/components/cover-scroll-bar/index.mjs +7 -7
  9. package/dist/es/components/cover-scroll-bar/src/cover-scroll-bar.mjs +198 -123
  10. package/dist/es/components/cover-scroll-bar/src/types.mjs +2 -2
  11. package/dist/es/components/form/component/form-item.vue.mjs +2 -2
  12. package/dist/es/components/form/component/form-item.vue2.mjs +58 -51
  13. package/dist/es/components/form/component/form.mjs +5 -4
  14. package/dist/es/components/form/component/form.vue.mjs +2 -2
  15. package/dist/es/components/form/component/form.vue2.mjs +21 -18
  16. package/dist/es/components/form/content/form-content.mjs +9 -9
  17. package/dist/es/components/form/index.mjs +11 -10
  18. package/dist/es/components/icon/index.mjs +5 -5
  19. package/dist/es/components/icon/src/icon.vue.mjs +2 -2
  20. package/dist/es/components/icon/src/icon.vue2.mjs +31 -21
  21. package/dist/es/components/icon/src/types.mjs +3 -3
  22. package/dist/es/components/index.mjs +35 -35
  23. package/dist/es/components/plus-upload/apis/plus-upload.api.mjs +8 -8
  24. package/dist/es/components/plus-upload/hook/useExtractPlusUpload.mjs +37 -28
  25. package/dist/es/components/plus-upload/hook/usePlusUpload.mjs +29 -18
  26. package/dist/es/components/plus-upload/images/pdf-icon.png.mjs +2 -2
  27. package/dist/es/components/plus-upload/images/word-icon.png.mjs +2 -2
  28. package/dist/es/components/plus-upload/images/xls-icon.png.mjs +2 -2
  29. package/dist/es/components/plus-upload/index.mjs +5 -5
  30. package/dist/es/components/plus-upload/src/plus-upload.vue.mjs +2 -2
  31. package/dist/es/components/plus-upload/src/plus-upload.vue2.mjs +180 -139
  32. package/dist/es/components/plus-upload/src/types.mjs +22 -10
  33. package/dist/es/components/pro-area/apis/pro-area.api.mjs +3 -3
  34. package/dist/es/components/pro-area/hooks/use-pro-area.mjs +9 -8
  35. package/dist/es/components/pro-area/index.mjs +9 -9
  36. package/dist/es/components/pro-area/src/ProArea.vue.mjs +2 -2
  37. package/dist/es/components/pro-area/src/ProArea.vue2.mjs +116 -82
  38. package/dist/es/components/pro-area/src/types.mjs +4 -3
  39. package/dist/es/components/pro-contract-view/apis/pro-contract-view.api.mjs +7 -7
  40. package/dist/es/components/pro-contract-view/hooks/use-contract-view.mjs +28 -22
  41. package/dist/es/components/pro-contract-view/index.mjs +7 -7
  42. package/dist/es/components/pro-contract-view/src/pro-contract-view.vue.mjs +2 -2
  43. package/dist/es/components/pro-contract-view/src/pro-contract-view.vue2.mjs +127 -103
  44. package/dist/es/components/pro-contract-view/src/types.mjs +6 -6
  45. package/dist/es/components/pro-loading/index.mjs +2 -2
  46. package/dist/es/components/pro-loading/src/pro-loading.mjs +48 -32
  47. package/dist/es/components/pro-modal/hooks/useProModal.mjs +38 -25
  48. package/dist/es/components/pro-modal/index.mjs +8 -8
  49. package/dist/es/components/pro-modal/src/ProModal.vue.mjs +2 -2
  50. package/dist/es/components/pro-modal/src/ProModal.vue2.mjs +111 -79
  51. package/dist/es/components/pro-modal/src/types.mjs +4 -4
  52. package/dist/es/components/pro-overlay/index.mjs +5 -5
  53. package/dist/es/components/pro-overlay/src/pro-overlay.vue.mjs +2 -2
  54. package/dist/es/components/pro-overlay/src/pro-overlay.vue2.mjs +36 -29
  55. package/dist/es/components/pro-picker/apis/pro-picker.api.mjs +6 -6
  56. package/dist/es/components/pro-picker/index.mjs +8 -8
  57. package/dist/es/components/pro-picker/src/ProPicker.vue.mjs +2 -2
  58. package/dist/es/components/pro-picker/src/ProPicker.vue2.mjs +90 -74
  59. package/dist/es/components/pro-picker/src/types.mjs +10 -4
  60. package/dist/es/components/pro-signature/index.mjs +7 -7
  61. package/dist/es/components/pro-signature/src/ProSignature.vue.mjs +2 -2
  62. package/dist/es/components/pro-signature/src/ProSignature.vue2.mjs +216 -103
  63. package/dist/es/components/pro-signature/src/types.mjs +4 -4
  64. package/dist/es/components/pro-table/hooks/use-pro-table.mjs +9 -8
  65. package/dist/es/components/pro-table/index.mjs +7 -7
  66. package/dist/es/components/pro-table/src/constants.mjs +8 -6
  67. package/dist/es/components/pro-table/src/field/field-date-range/field-date-range.vue.mjs +2 -2
  68. package/dist/es/components/pro-table/src/field/field-date-range/field-date-range.vue2.mjs +22 -17
  69. package/dist/es/components/pro-table/src/field/field-input/field-input.vue.mjs +2 -2
  70. package/dist/es/components/pro-table/src/field/field-input/field-input.vue2.mjs +22 -17
  71. package/dist/es/components/pro-table/src/field/field-radio/field-radio.vue.mjs +2 -2
  72. package/dist/es/components/pro-table/src/field/field-radio/field-radio.vue2.mjs +50 -43
  73. package/dist/es/components/pro-table/src/field/field-select/field-select.vue.mjs +2 -2
  74. package/dist/es/components/pro-table/src/field/field-select/field-select.vue2.mjs +50 -43
  75. package/dist/es/components/pro-table/src/field/field.css +3 -1
  76. package/dist/es/components/pro-table/src/field/field.vue.mjs +2 -2
  77. package/dist/es/components/pro-table/src/field/field.vue2.mjs +127 -102
  78. package/dist/es/components/pro-table/src/form-render.css +3 -1
  79. package/dist/es/components/pro-table/src/form-render.vue.mjs +2 -2
  80. package/dist/es/components/pro-table/src/form-render.vue2.mjs +148 -127
  81. package/dist/es/components/pro-table/src/hooks/use-form.mjs +20 -17
  82. package/dist/es/components/pro-table/src/hooks/use-table.mjs +47 -29
  83. package/dist/es/components/pro-table/src/pro-table.vue.mjs +2 -2
  84. package/dist/es/components/pro-table/src/pro-table.vue2.mjs +170 -155
  85. package/dist/es/components/pro-table/utils.mjs +10 -10
  86. package/dist/es/components/pro-tag/index.mjs +7 -7
  87. package/dist/es/components/pro-tag/src/ProTag.vue.mjs +2 -2
  88. package/dist/es/components/pro-tag/src/ProTag.vue2.mjs +28 -19
  89. package/dist/es/components/pro-tag/src/types.mjs +4 -3
  90. package/dist/es/components/pro-title/index.mjs +7 -7
  91. package/dist/es/components/pro-title/src/ProTitle.vue.mjs +2 -2
  92. package/dist/es/components/pro-title/src/ProTitle.vue2.mjs +47 -36
  93. package/dist/es/components/pro-title/src/types.mjs +4 -4
  94. package/dist/es/components/pro-upload/index.mjs +7 -7
  95. package/dist/es/components/pro-upload/src/assets/images/audio-icon.png.mjs +2 -2
  96. package/dist/es/components/pro-upload/src/assets/images/materials-icon.png.mjs +2 -2
  97. package/dist/es/components/pro-upload/src/assets/images/pdf-icon.png.mjs +2 -2
  98. package/dist/es/components/pro-upload/src/assets/images/ppt-icon.png.mjs +2 -2
  99. package/dist/es/components/pro-upload/src/assets/images/video-icon.png.mjs +2 -2
  100. package/dist/es/components/pro-upload/src/assets/images/word-icon.png.mjs +2 -2
  101. package/dist/es/components/pro-upload/src/assets/images/xls-icon.png.mjs +2 -2
  102. package/dist/es/components/pro-upload/src/assets/images/zip-icon.png.mjs +2 -2
  103. package/dist/es/components/pro-upload/src/data.mjs +18 -18
  104. package/dist/es/components/pro-upload/src/file-list.mjs +70 -55
  105. package/dist/es/components/pro-upload/src/gd-upload.mjs +163 -132
  106. package/dist/es/components/pro-upload/src/hooks/index.mjs +4 -4
  107. package/dist/es/components/pro-upload/src/hooks/useHttp.mjs +8 -8
  108. package/dist/es/components/pro-upload/src/hooks/useUpload.mjs +66 -36
  109. package/dist/es/components/pro-upload/src/props.mjs +6 -6
  110. package/dist/es/components/pro-upload/src/utils/index.mjs +38 -25
  111. package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue.mjs +2 -2
  112. package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +83 -69
  113. package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +176 -125
  114. package/dist/es/components/scale-virtual-list/index.mjs +5 -5
  115. package/dist/es/components/scroll-bar/index.mjs +7 -7
  116. package/dist/es/components/scroll-bar/src/scroll-bar.mjs +390 -240
  117. package/dist/es/components/scroll-bar/src/types.mjs +2 -2
  118. package/dist/es/components/utils/install.mjs +16 -14
  119. package/dist/es/hooks/index.mjs +3 -3
  120. package/dist/es/hooks/use-namespace/index.mjs +72 -41
  121. package/dist/es/hooks/useProForm.mjs +42 -27
  122. package/dist/es/index.mjs +73 -73
  123. package/dist/es/installer.mjs +8 -8
  124. package/dist/lib/components/base/style/index.js +2 -1
  125. package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.js +134 -1
  126. package/dist/lib/components/collapse-transtion/index.js +11 -1
  127. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.js +4 -1
  128. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue2.js +29 -1
  129. package/dist/lib/components/collapse-transtion/src/types.js +9 -1
  130. package/dist/lib/components/collapse-transtion/style/index.js +3 -1
  131. package/dist/lib/components/cover-scroll-bar/hooks/use-has-scroll.js +30 -1
  132. package/dist/lib/components/cover-scroll-bar/index.js +10 -1
  133. package/dist/lib/components/cover-scroll-bar/src/cover-scroll-bar.js +221 -1
  134. package/dist/lib/components/cover-scroll-bar/src/types.js +17 -1
  135. package/dist/lib/components/cover-scroll-bar/style/index.js +3 -1
  136. package/dist/lib/components/form/component/form-item.vue.js +4 -1
  137. package/dist/lib/components/form/component/form-item.vue2.js +63 -1
  138. package/dist/lib/components/form/component/form.js +14 -1
  139. package/dist/lib/components/form/component/form.vue.js +4 -1
  140. package/dist/lib/components/form/component/form.vue2.js +26 -1
  141. package/dist/lib/components/form/content/form-content.js +13 -1
  142. package/dist/lib/components/form/index.js +15 -1
  143. package/dist/lib/components/icon/index.js +9 -1
  144. package/dist/lib/components/icon/src/icon.vue.js +4 -1
  145. package/dist/lib/components/icon/src/icon.vue2.js +36 -1
  146. package/dist/lib/components/icon/src/types.js +17 -1
  147. package/dist/lib/components/icon/style/index.js +3 -1
  148. package/dist/lib/components/index.js +38 -1
  149. package/dist/lib/components/plus-upload/apis/plus-upload.api.js +21 -1
  150. package/dist/lib/components/plus-upload/hook/useExtractPlusUpload.js +64 -1
  151. package/dist/lib/components/plus-upload/hook/usePlusUpload.js +34 -1
  152. package/dist/lib/components/plus-upload/images/pdf-icon.png.js +4 -1
  153. package/dist/lib/components/plus-upload/images/word-icon.png.js +4 -1
  154. package/dist/lib/components/plus-upload/images/xls-icon.png.js +4 -1
  155. package/dist/lib/components/plus-upload/index.js +9 -1
  156. package/dist/lib/components/plus-upload/src/plus-upload.vue.js +4 -1
  157. package/dist/lib/components/plus-upload/src/plus-upload.vue2.js +199 -1
  158. package/dist/lib/components/plus-upload/src/types.js +37 -1
  159. package/dist/lib/components/plus-upload/style/index.js +3 -1
  160. package/dist/lib/components/pro-area/apis/pro-area.api.js +6 -1
  161. package/dist/lib/components/pro-area/hooks/use-pro-area.js +12 -1
  162. package/dist/lib/components/pro-area/index.js +13 -1
  163. package/dist/lib/components/pro-area/src/ProArea.vue.js +4 -1
  164. package/dist/lib/components/pro-area/src/ProArea.vue2.js +135 -1
  165. package/dist/lib/components/pro-area/src/types.js +22 -1
  166. package/dist/lib/components/pro-area/style/index.js +3 -1
  167. package/dist/lib/components/pro-contract-view/apis/pro-contract-view.api.js +10 -1
  168. package/dist/lib/components/pro-contract-view/hooks/use-contract-view.js +45 -1
  169. package/dist/lib/components/pro-contract-view/index.js +11 -1
  170. package/dist/lib/components/pro-contract-view/src/pro-contract-view.vue.js +4 -1
  171. package/dist/lib/components/pro-contract-view/src/pro-contract-view.vue2.js +152 -1
  172. package/dist/lib/components/pro-contract-view/src/types.js +24 -1
  173. package/dist/lib/components/pro-contract-view/style/index.js +3 -1
  174. package/dist/lib/components/pro-loading/index.js +5 -1
  175. package/dist/lib/components/pro-loading/src/pro-loading.js +75 -1
  176. package/dist/lib/components/pro-modal/hooks/useProModal.js +47 -1
  177. package/dist/lib/components/pro-modal/index.js +12 -1
  178. package/dist/lib/components/pro-modal/src/ProModal.vue.js +4 -1
  179. package/dist/lib/components/pro-modal/src/ProModal.vue2.js +122 -1
  180. package/dist/lib/components/pro-modal/src/types.js +16 -1
  181. package/dist/lib/components/pro-modal/style/index.js +3 -1
  182. package/dist/lib/components/pro-overlay/index.js +9 -1
  183. package/dist/lib/components/pro-overlay/src/pro-overlay.vue.js +4 -1
  184. package/dist/lib/components/pro-overlay/src/pro-overlay.vue2.js +41 -1
  185. package/dist/lib/components/pro-overlay/style/index.js +3 -1
  186. package/dist/lib/components/pro-picker/apis/pro-picker.api.js +9 -1
  187. package/dist/lib/components/pro-picker/index.js +11 -1
  188. package/dist/lib/components/pro-picker/src/ProPicker.vue.js +4 -1
  189. package/dist/lib/components/pro-picker/src/ProPicker.vue2.js +106 -1
  190. package/dist/lib/components/pro-picker/src/types.js +28 -1
  191. package/dist/lib/components/pro-signature/index.js +10 -1
  192. package/dist/lib/components/pro-signature/src/ProSignature.vue.js +4 -1
  193. package/dist/lib/components/pro-signature/src/ProSignature.vue2.js +258 -1
  194. package/dist/lib/components/pro-signature/src/types.js +40 -1
  195. package/dist/lib/components/pro-table/hooks/use-pro-table.js +12 -1
  196. package/dist/lib/components/pro-table/index.js +12 -1
  197. package/dist/lib/components/pro-table/src/constants.js +25 -1
  198. package/dist/lib/components/pro-table/src/field/field-date-range/field-date-range.vue.js +4 -1
  199. package/dist/lib/components/pro-table/src/field/field-date-range/field-date-range.vue2.js +31 -1
  200. package/dist/lib/components/pro-table/src/field/field-input/field-input.vue.js +4 -1
  201. package/dist/lib/components/pro-table/src/field/field-input/field-input.vue2.js +31 -1
  202. package/dist/lib/components/pro-table/src/field/field-radio/field-radio.vue.js +4 -1
  203. package/dist/lib/components/pro-table/src/field/field-radio/field-radio.vue2.js +59 -1
  204. package/dist/lib/components/pro-table/src/field/field-select/field-select.vue.js +4 -1
  205. package/dist/lib/components/pro-table/src/field/field-select/field-select.vue2.js +59 -1
  206. package/dist/lib/components/pro-table/src/field/field.css +3 -1
  207. package/dist/lib/components/pro-table/src/field/field.vue.js +5 -1
  208. package/dist/lib/components/pro-table/src/field/field.vue2.js +149 -1
  209. package/dist/lib/components/pro-table/src/form-render.css +3 -1
  210. package/dist/lib/components/pro-table/src/form-render.vue.js +5 -1
  211. package/dist/lib/components/pro-table/src/form-render.vue2.js +166 -1
  212. package/dist/lib/components/pro-table/src/hooks/use-form.js +25 -1
  213. package/dist/lib/components/pro-table/src/hooks/use-table.js +57 -1
  214. package/dist/lib/components/pro-table/src/pro-table.vue.js +4 -1
  215. package/dist/lib/components/pro-table/src/pro-table.vue2.js +203 -1
  216. package/dist/lib/components/pro-table/style/index.js +3 -1
  217. package/dist/lib/components/pro-table/utils.js +15 -1
  218. package/dist/lib/components/pro-tag/index.js +10 -1
  219. package/dist/lib/components/pro-tag/src/ProTag.vue.js +4 -1
  220. package/dist/lib/components/pro-tag/src/ProTag.vue2.js +46 -1
  221. package/dist/lib/components/pro-tag/src/types.js +10 -1
  222. package/dist/lib/components/pro-title/index.js +11 -1
  223. package/dist/lib/components/pro-title/src/ProTitle.vue.js +4 -1
  224. package/dist/lib/components/pro-title/src/ProTitle.vue2.js +52 -1
  225. package/dist/lib/components/pro-title/src/types.js +21 -1
  226. package/dist/lib/components/pro-title/style/index.js +3 -1
  227. package/dist/lib/components/pro-upload/index.js +11 -1
  228. package/dist/lib/components/pro-upload/src/assets/images/audio-icon.png.js +4 -1
  229. package/dist/lib/components/pro-upload/src/assets/images/materials-icon.png.js +4 -1
  230. package/dist/lib/components/pro-upload/src/assets/images/pdf-icon.png.js +4 -1
  231. package/dist/lib/components/pro-upload/src/assets/images/ppt-icon.png.js +4 -1
  232. package/dist/lib/components/pro-upload/src/assets/images/video-icon.png.js +4 -1
  233. package/dist/lib/components/pro-upload/src/assets/images/word-icon.png.js +4 -1
  234. package/dist/lib/components/pro-upload/src/assets/images/xls-icon.png.js +4 -1
  235. package/dist/lib/components/pro-upload/src/assets/images/zip-icon.png.js +4 -1
  236. package/dist/lib/components/pro-upload/src/data.js +49 -1
  237. package/dist/lib/components/pro-upload/src/file-list.js +160 -1
  238. package/dist/lib/components/pro-upload/src/gd-upload.js +211 -1
  239. package/dist/lib/components/pro-upload/src/hooks/index.js +6 -1
  240. package/dist/lib/components/pro-upload/src/hooks/useHttp.js +23 -1
  241. package/dist/lib/components/pro-upload/src/hooks/useUpload.js +85 -1
  242. package/dist/lib/components/pro-upload/src/props.js +50 -1
  243. package/dist/lib/components/pro-upload/src/utils/index.js +46 -1
  244. package/dist/lib/components/pro-upload/style/index.js +3 -1
  245. package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue.js +4 -1
  246. package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue2.js +93 -1
  247. package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +220 -1
  248. package/dist/lib/components/scale-virtual-list/index.js +10 -1
  249. package/dist/lib/components/scale-virtual-list/style/index.js +3 -1
  250. package/dist/lib/components/scroll-bar/index.js +10 -1
  251. package/dist/lib/components/scroll-bar/src/scroll-bar.js +424 -1
  252. package/dist/lib/components/scroll-bar/src/types.js +13 -1
  253. package/dist/lib/components/scroll-bar/style/index.js +3 -1
  254. package/dist/lib/components/utils/install.js +23 -1
  255. package/dist/lib/hooks/index.js +5 -1
  256. package/dist/lib/hooks/use-namespace/index.js +80 -1
  257. package/dist/lib/hooks/useProForm.js +50 -1
  258. package/dist/lib/index.js +77 -1
  259. package/dist/lib/installer.js +13 -1
  260. package/dist/theme-chalk/icon.css +1 -1
  261. package/dist/theme-chalk/index.css +1 -1
  262. package/package.json +9 -9
@@ -1,124 +1,149 @@
1
- import { defineComponent as T, inject as P, toRefs as C, computed as p, reactive as y, ref as I, watchEffect as N, readonly as S, provide as w, createElementBlock as v, openBlock as a, Fragment as c, createCommentVNode as u, createElementVNode as B, createBlock as m, resolveDynamicComponent as F, unref as D, normalizeProps as _, mergeProps as U, guardReactiveProps as $ } from "vue";
2
- import { TABLE_CONTEXT_PROVIDE_KEY as q, FIELD_CONTEXT_PROVIDE_KEY as A } from "../constants.mjs";
3
- import { getAvailableVNode as K, handleFn as j } from "../../utils.mjs";
1
+ import { defineComponent, inject, toRefs, computed, reactive, ref, watchEffect, readonly, provide, createElementBlock, openBlock, Fragment, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, unref, normalizeProps, mergeProps, guardReactiveProps } from "vue";
2
+ import { TABLE_CONTEXT_PROVIDE_KEY, FIELD_CONTEXT_PROVIDE_KEY } from "../constants.mjs";
3
+ import { getAvailableVNode, handleFn } from "../../utils.mjs";
4
4
  import "./field-input/field-input.vue.mjs";
5
5
  import "./field-select/field-select.vue.mjs";
6
6
  import "./field-radio/field-radio.vue.mjs";
7
7
  import "./field-date-range/field-date-range.vue.mjs";
8
- import L from "./field-input/field-input.vue2.mjs";
9
- import M from "./field-select/field-select.vue2.mjs";
10
- import X from "./field-radio/field-radio.vue2.mjs";
11
- import Y from "./field-date-range/field-date-range.vue2.mjs";
12
- const h = { class: "field" }, ne = /* @__PURE__ */ T({
8
+ import _sfc_main$1 from "./field-input/field-input.vue2.mjs";
9
+ import _sfc_main$2 from "./field-select/field-select.vue2.mjs";
10
+ import _sfc_main$3 from "./field-radio/field-radio.vue2.mjs";
11
+ import _sfc_main$4 from "./field-date-range/field-date-range.vue2.mjs";
12
+ const _hoisted_1 = { class: "field" };
13
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
14
  __name: "field",
14
15
  props: {
15
16
  column: {}
16
17
  },
17
- setup(k) {
18
- const { column: l } = k, V = P(q), { tableSlots: s } = V, { formState: d } = C(V), E = l.dataIndex, t = p({
18
+ setup(__props) {
19
+ const { column } = __props;
20
+ const tableContext = inject(TABLE_CONTEXT_PROVIDE_KEY);
21
+ const { tableSlots } = tableContext;
22
+ const { formState } = toRefs(tableContext);
23
+ const formStateKey = column.dataIndex;
24
+ const modelValue = computed({
19
25
  get() {
20
- return d.value[E];
26
+ return formState.value[formStateKey];
21
27
  },
22
- set(n) {
23
- d.value[E] = n;
28
+ set(val) {
29
+ formState.value[formStateKey] = val;
30
+ }
31
+ });
32
+ const slotProps = reactive({
33
+ column,
34
+ value: modelValue.value,
35
+ formState
36
+ });
37
+ const isShowFormItemSlot = computed(() => {
38
+ if (tableSlots.formField) {
39
+ return !!getAvailableVNode(tableSlots.formField(slotProps)).length;
40
+ }
41
+ return false;
42
+ });
43
+ const valueType = computed(
44
+ () => column.valueType || (column.valueEnum ? "select" : "text")
45
+ );
46
+ const fieldOptions = ref([]);
47
+ function handleOptionsInFirstTime() {
48
+ if (column.request) {
49
+ handleRequest();
50
+ } else {
51
+ handleValueEnum();
24
52
  }
25
- }), f = y({
26
- column: l,
27
- value: t.value,
28
- formState: d
29
- }), b = p(() => s.formField ? !!K(s.formField(f)).length : !1), r = p(
30
- () => l.valueType || (l.valueEnum ? "select" : "text")
31
- ), i = I([]);
32
- function R() {
33
- l.request ? x() : g();
34
53
  }
35
- R(), N(() => {
36
- l._fieldOptions = S(i.value);
54
+ handleOptionsInFirstTime();
55
+ watchEffect(() => {
56
+ column._fieldOptions = readonly(fieldOptions.value);
37
57
  });
38
- function g() {
39
- if (l.valueEnum) {
40
- const n = new Map(Object.entries(l.valueEnum));
41
- i.value = Array.from(n).map(([o, e]) => ({
42
- text: e.text,
43
- value: o,
44
- label: e.text,
45
- disabled: e.disabled
58
+ function handleValueEnum() {
59
+ if (column.valueEnum) {
60
+ const valueEnumMap = new Map(Object.entries(column.valueEnum));
61
+ fieldOptions.value = Array.from(valueEnumMap).map(([key, item]) => ({
62
+ text: item.text,
63
+ value: key,
64
+ label: item.text,
65
+ disabled: item.disabled
46
66
  }));
47
67
  }
48
68
  }
49
- async function x() {
50
- const n = await j(l.request, {});
51
- n && (i.value = n);
69
+ async function handleRequest() {
70
+ const res = await handleFn(column.request, {});
71
+ if (res) {
72
+ fieldOptions.value = res;
73
+ }
52
74
  }
53
- const O = y({
54
- fieldOptions: i,
55
- column: l
75
+ const context = reactive({
76
+ fieldOptions,
77
+ column
56
78
  });
57
- return w(
58
- A,
59
- O
60
- ), (n, o) => (a(), v(
61
- c,
62
- null,
63
- [
64
- u(" eslint-disable vue/component-name-in-template-casing "),
65
- B("div", h, [
66
- b.value ? (a(), m(
67
- F(D(s).formField),
68
- _(U({ key: 0 }, f)),
69
- null,
70
- 16
71
- /* FULL_PROPS */
72
- )) : n.column.customFormFieldRender ? (a(), v(
73
- c,
74
- { key: 1 },
75
- [
76
- u(' <column.customFormFieldRender v-bind="slotProps" /> '),
77
- (a(), m(
78
- F(n.column.customFormFieldRender),
79
- _($(f)),
80
- null,
81
- 16
82
- /* FULL_PROPS */
83
- ))
84
- ],
85
- 64
86
- /* STABLE_FRAGMENT */
87
- )) : (a(), v(
88
- c,
89
- { key: 2 },
90
- [
91
- r.value === "text" ? (a(), m(L, {
92
- key: 0,
93
- modelValue: t.value,
94
- "onUpdate:modelValue": o[0] || (o[0] = (e) => t.value = e)
95
- }, null, 8, ["modelValue"])) : u("v-if", !0),
96
- r.value === "select" ? (a(), m(M, {
97
- key: 1,
98
- modelValue: t.value,
99
- "onUpdate:modelValue": o[1] || (o[1] = (e) => t.value = e)
100
- }, null, 8, ["modelValue"])) : u("v-if", !0),
101
- r.value === "radio" ? (a(), m(X, {
102
- key: 2,
103
- modelValue: t.value,
104
- "onUpdate:modelValue": o[2] || (o[2] = (e) => t.value = e)
105
- }, null, 8, ["modelValue"])) : u("v-if", !0),
106
- r.value === "dateRange" ? (a(), m(Y, {
107
- key: 3,
108
- modelValue: t.value,
109
- "onUpdate:modelValue": o[3] || (o[3] = (e) => t.value = e)
110
- }, null, 8, ["modelValue"])) : u("v-if", !0)
111
- ],
112
- 64
113
- /* STABLE_FRAGMENT */
114
- ))
115
- ])
116
- ],
117
- 2112
118
- /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
119
- ));
79
+ provide(
80
+ FIELD_CONTEXT_PROVIDE_KEY,
81
+ context
82
+ );
83
+ return (_ctx, _cache) => {
84
+ return openBlock(), createElementBlock(
85
+ Fragment,
86
+ null,
87
+ [
88
+ createCommentVNode(" eslint-disable vue/component-name-in-template-casing "),
89
+ createElementVNode("div", _hoisted_1, [
90
+ isShowFormItemSlot.value ? (openBlock(), createBlock(
91
+ resolveDynamicComponent(unref(tableSlots).formField),
92
+ normalizeProps(mergeProps({ key: 0 }, slotProps)),
93
+ null,
94
+ 16
95
+ /* FULL_PROPS */
96
+ )) : _ctx.column.customFormFieldRender ? (openBlock(), createElementBlock(
97
+ Fragment,
98
+ { key: 1 },
99
+ [
100
+ createCommentVNode(' <column.customFormFieldRender v-bind="slotProps" /> '),
101
+ (openBlock(), createBlock(
102
+ resolveDynamicComponent(_ctx.column.customFormFieldRender),
103
+ normalizeProps(guardReactiveProps(slotProps)),
104
+ null,
105
+ 16
106
+ /* FULL_PROPS */
107
+ ))
108
+ ],
109
+ 64
110
+ /* STABLE_FRAGMENT */
111
+ )) : (openBlock(), createElementBlock(
112
+ Fragment,
113
+ { key: 2 },
114
+ [
115
+ valueType.value === "text" ? (openBlock(), createBlock(_sfc_main$1, {
116
+ key: 0,
117
+ modelValue: modelValue.value,
118
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
119
+ }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
120
+ valueType.value === "select" ? (openBlock(), createBlock(_sfc_main$2, {
121
+ key: 1,
122
+ modelValue: modelValue.value,
123
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue.value = $event)
124
+ }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
125
+ valueType.value === "radio" ? (openBlock(), createBlock(_sfc_main$3, {
126
+ key: 2,
127
+ modelValue: modelValue.value,
128
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => modelValue.value = $event)
129
+ }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
130
+ valueType.value === "dateRange" ? (openBlock(), createBlock(_sfc_main$4, {
131
+ key: 3,
132
+ modelValue: modelValue.value,
133
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => modelValue.value = $event)
134
+ }, null, 8, ["modelValue"])) : createCommentVNode("v-if", true)
135
+ ],
136
+ 64
137
+ /* STABLE_FRAGMENT */
138
+ ))
139
+ ])
140
+ ],
141
+ 2112
142
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
143
+ );
144
+ };
120
145
  }
121
146
  });
122
147
  export {
123
- ne as default
148
+ _sfc_main as default
124
149
  };
@@ -1 +1,3 @@
1
- .pro-table .pro-table-form .ant-form .ant-form-item{margin-bottom:0}
1
+ .pro-table .pro-table-form .ant-form .ant-form-item {
2
+ margin-bottom: 0;
3
+ }
@@ -1,5 +1,5 @@
1
- import o from "./form-render.vue2.mjs";
1
+ import _sfc_main from "./form-render.vue2.mjs";
2
2
  /* empty css */
3
3
  export {
4
- o as default
4
+ _sfc_main as default
5
5
  };
@@ -1,145 +1,166 @@
1
- import { defineComponent as L, inject as A, toRefs as P, ref as j, computed as m, createElementBlock as i, openBlock as l, createVNode as o, unref as e, mergeProps as d, withCtx as n, createCommentVNode as s, Fragment as k, renderList as q, createBlock as z, normalizeProps as K, guardReactiveProps as X, createTextVNode as y } from "vue";
2
- import { Form as Y, Row as $, Col as x, FormItem as b, Space as G, Button as F } from "ant-design-vue";
1
+ import { defineComponent, inject, toRefs, ref, computed, createElementBlock, openBlock, createVNode, unref, mergeProps, withCtx, createCommentVNode, Fragment, renderList, createBlock, normalizeProps, guardReactiveProps, createTextVNode } from "vue";
2
+ import { Form, Row, Col, FormItem, Space, Button } from "ant-design-vue";
3
3
  import "./field/field.vue.mjs";
4
- import { TABLE_CONTEXT_PROVIDE_KEY as H } from "./constants.mjs";
5
- import J from "./field/field.vue2.mjs";
6
- const M = { class: "pro-table-form" }, oe = /* @__PURE__ */ L({
4
+ import { TABLE_CONTEXT_PROVIDE_KEY } from "./constants.mjs";
5
+ import _sfc_main$1 from "./field/field.vue2.mjs";
6
+ const _hoisted_1 = { class: "pro-table-form" };
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
8
  __name: "form-render",
8
- setup(Q, { expose: I }) {
9
- const c = A(H), { columns: p, pageData: R, handleRequest: N } = c, { loading: T, antdFormProps: B, formColNum: u, formState: E, buttonCol: O } = P(c), a = j();
10
- function _(t) {
11
- return t.valueType !== "option" && !t.hideInForm;
9
+ setup(__props, { expose: __expose }) {
10
+ const tableContext = inject(TABLE_CONTEXT_PROVIDE_KEY);
11
+ const { columns, pageData, handleRequest } = tableContext;
12
+ const { loading, antdFormProps, formColNum, formState, buttonCol } = toRefs(tableContext);
13
+ const formRef = ref();
14
+ function isShowItem(col) {
15
+ return col.valueType !== "option" && !col.hideInForm;
12
16
  }
13
- const S = (t) => t.dataIndex;
14
- function v() {
15
- R.pageNum = 1, N();
17
+ const itemName = (col) => col.dataIndex;
18
+ function onFilter() {
19
+ pageData.pageNum = 1;
20
+ handleRequest();
16
21
  }
17
- function w() {
18
- a.value && a.value.validate().then(() => {
19
- v();
20
- }).catch(console.error);
22
+ function onSubmit() {
23
+ if (formRef.value) {
24
+ formRef.value.validate().then(() => {
25
+ onFilter();
26
+ }).catch(console.error);
27
+ }
21
28
  }
22
- function V() {
23
- a.value && (a.value.resetFields(), v());
29
+ function resetForm() {
30
+ if (formRef.value) {
31
+ formRef.value.resetFields();
32
+ onFilter();
33
+ }
24
34
  }
25
- const f = m(() => (u == null ? void 0 : u.value) || 0), g = m(() => 24 / f.value), D = m(() => {
26
- const t = p.filter(_).length;
27
- return (f.value - 1 - t % f.value) * g.value;
35
+ const colNum = computed(() => (formColNum == null ? void 0 : formColNum.value) || 0);
36
+ const colSpan = computed(() => 24 / colNum.value);
37
+ const buttonColOffset = computed(() => {
38
+ const displayedColLen = columns.filter(isShowItem).length;
39
+ return (colNum.value - 1 - displayedColLen % colNum.value) * colSpan.value;
28
40
  });
29
- function C(t, h = !1) {
30
- return t = {
31
- span: g.value,
41
+ function fieldCol(colProps, isButton = false) {
42
+ colProps = {
43
+ span: colSpan.value,
32
44
  // 4 列
33
- ...t || {}
34
- }, h && t.offset == null && (t.offset = D.value), t;
45
+ ...colProps || {}
46
+ };
47
+ if (isButton && colProps.offset == null) {
48
+ colProps.offset = buttonColOffset.value;
49
+ }
50
+ return colProps;
35
51
  }
36
- return I({
37
- formRef: a
38
- }), (t, h) => (l(), i("div", M, [
39
- o(e(Y), d({
40
- ref_key: "formRef",
41
- ref: a,
42
- autocomplete: "off",
43
- "label-col": { span: 5 }
44
- }, e(B), { model: e(E) }), {
45
- default: n(() => [
46
- o(e($), { gutter: [0, 24] }, {
47
- default: n(() => [
48
- s(" TODO 处理 key 的问题, 有的项没有 key, 有的项没有 dataIndex "),
49
- (l(!0), i(
50
- k,
51
- null,
52
- q(e(p), (r) => (l(), i(
53
- k,
52
+ __expose({
53
+ formRef
54
+ });
55
+ return (_ctx, _cache) => {
56
+ return openBlock(), createElementBlock("div", _hoisted_1, [
57
+ createVNode(unref(Form), mergeProps({
58
+ ref_key: "formRef",
59
+ ref: formRef,
60
+ autocomplete: "off",
61
+ "label-col": { span: 5 }
62
+ }, unref(antdFormProps), { model: unref(formState) }), {
63
+ default: withCtx(() => [
64
+ createVNode(unref(Row), { gutter: [0, 24] }, {
65
+ default: withCtx(() => [
66
+ createCommentVNode(" TODO 处理 key 的问题, 有的项没有 key, 有的项没有 dataIndex "),
67
+ (openBlock(true), createElementBlock(
68
+ Fragment,
54
69
  null,
55
- [
56
- _(r) ? (l(), z(
57
- e(x),
58
- d({
59
- key: r.key,
60
- ref_for: !0
61
- }, C(r.fieldCol)),
62
- {
63
- default: n(() => [
64
- o(e(b), d({
65
- label: r.title,
66
- name: S(r),
67
- ref_for: !0
68
- }, r.formItemProps), {
69
- default: n(() => [
70
- o(J, { column: r }, null, 8, ["column"])
70
+ renderList(unref(columns), (col) => {
71
+ return openBlock(), createElementBlock(
72
+ Fragment,
73
+ null,
74
+ [
75
+ isShowItem(col) ? (openBlock(), createBlock(
76
+ unref(Col),
77
+ mergeProps({
78
+ key: col.key,
79
+ ref_for: true
80
+ }, fieldCol(col.fieldCol)),
81
+ {
82
+ default: withCtx(() => [
83
+ createVNode(unref(FormItem), mergeProps({
84
+ label: col.title,
85
+ name: itemName(col),
86
+ ref_for: true
87
+ }, col.formItemProps), {
88
+ default: withCtx(() => [
89
+ createVNode(_sfc_main$1, { column: col }, null, 8, ["column"])
90
+ ]),
91
+ _: 2
92
+ /* DYNAMIC */
93
+ }, 1040, ["label", "name"])
71
94
  ]),
72
95
  _: 2
73
96
  /* DYNAMIC */
74
- }, 1040, ["label", "name"])
97
+ },
98
+ 1040
99
+ /* FULL_PROPS, DYNAMIC_SLOTS */
100
+ )) : createCommentVNode("v-if", true)
101
+ ],
102
+ 64
103
+ /* STABLE_FRAGMENT */
104
+ );
105
+ }),
106
+ 256
107
+ /* UNKEYED_FRAGMENT */
108
+ )),
109
+ createCommentVNode(" 重置查询按钮 "),
110
+ createVNode(
111
+ unref(Col),
112
+ normalizeProps(guardReactiveProps(fieldCol(unref(buttonCol), true))),
113
+ {
114
+ default: withCtx(() => [
115
+ createVNode(unref(FormItem), { "wrapper-col": { style: { textAlign: "right" } } }, {
116
+ default: withCtx(() => [
117
+ createVNode(unref(Space), null, {
118
+ default: withCtx(() => [
119
+ createVNode(unref(Button), { onClick: resetForm }, {
120
+ default: withCtx(() => [
121
+ createTextVNode(" 重置 ")
122
+ ]),
123
+ _: 1
124
+ /* STABLE */
125
+ }),
126
+ createVNode(unref(Button), {
127
+ type: "primary",
128
+ loading: unref(loading),
129
+ onClick: onSubmit
130
+ }, {
131
+ default: withCtx(() => [
132
+ createTextVNode(" 查询 ")
133
+ ]),
134
+ _: 1
135
+ /* STABLE */
136
+ }, 8, ["loading"])
137
+ ]),
138
+ _: 1
139
+ /* STABLE */
140
+ })
75
141
  ]),
76
- _: 2
77
- /* DYNAMIC */
78
- },
79
- 1040
80
- /* FULL_PROPS, DYNAMIC_SLOTS */
81
- )) : s("v-if", !0)
82
- ],
83
- 64
84
- /* STABLE_FRAGMENT */
85
- ))),
86
- 256
87
- /* UNKEYED_FRAGMENT */
88
- )),
89
- s(" 重置查询按钮 "),
90
- o(
91
- e(x),
92
- K(X(C(e(O), !0))),
93
- {
94
- default: n(() => [
95
- o(e(b), { "wrapper-col": { style: { textAlign: "right" } } }, {
96
- default: n(() => [
97
- o(e(G), null, {
98
- default: n(() => [
99
- o(e(F), { onClick: V }, {
100
- default: n(() => [
101
- y(" 重置 ")
102
- ]),
103
- _: 1
104
- /* STABLE */
105
- }),
106
- o(e(F), {
107
- type: "primary",
108
- loading: e(T),
109
- onClick: w
110
- }, {
111
- default: n(() => [
112
- y(" 查询 ")
113
- ]),
114
- _: 1
115
- /* STABLE */
116
- }, 8, ["loading"])
117
- ]),
118
- _: 1
119
- /* STABLE */
120
- })
121
- ]),
122
- _: 1
123
- /* STABLE */
124
- })
125
- ]),
126
- _: 1
127
- /* STABLE */
128
- },
129
- 16
130
- /* FULL_PROPS */
131
- )
132
- ]),
133
- _: 1
134
- /* STABLE */
135
- })
136
- ]),
137
- _: 1
138
- /* STABLE */
139
- }, 16, ["model"])
140
- ]));
142
+ _: 1
143
+ /* STABLE */
144
+ })
145
+ ]),
146
+ _: 1
147
+ /* STABLE */
148
+ },
149
+ 16
150
+ /* FULL_PROPS */
151
+ )
152
+ ]),
153
+ _: 1
154
+ /* STABLE */
155
+ })
156
+ ]),
157
+ _: 1
158
+ /* STABLE */
159
+ }, 16, ["model"])
160
+ ]);
161
+ };
141
162
  }
142
163
  });
143
164
  export {
144
- oe as default
165
+ _sfc_main as default
145
166
  };
@@ -1,22 +1,25 @@
1
- import { ref as o } from "vue";
2
- function m(n) {
3
- const { columns: r } = n, a = o({}), u = ["dateRange"];
1
+ import { ref } from "vue";
2
+ function useForm(props) {
3
+ const { columns } = props;
4
+ const formState = ref({});
5
+ const arrayValueTypes = ["dateRange"];
6
+ const genFormState = () => {
7
+ formState.value = columns.reduce(
8
+ (init, col) => {
9
+ if (col.dataIndex && !col.hideInForm) {
10
+ const initValue = col.valueType && arrayValueTypes.includes(col.valueType) ? [] : "";
11
+ init[col.dataIndex] = formState.value[col.dataIndex] || col.initialValue || initValue;
12
+ }
13
+ return init;
14
+ },
15
+ {}
16
+ );
17
+ };
4
18
  return {
5
- formState: a,
6
- genFormState: () => {
7
- a.value = r.reduce(
8
- (t, e) => {
9
- if (e.dataIndex && !e.hideInForm) {
10
- const d = e.valueType && u.includes(e.valueType) ? [] : "";
11
- t[e.dataIndex] = a.value[e.dataIndex] || e.initialValue || d;
12
- }
13
- return t;
14
- },
15
- {}
16
- );
17
- }
19
+ formState,
20
+ genFormState
18
21
  };
19
22
  }
20
23
  export {
21
- m as useForm
24
+ useForm
22
25
  };