bkui-vue 0.0.2-table-refactor.8 → 0.0.3-beta.1

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 (394) hide show
  1. package/dist/index.cjs.js +135 -161
  2. package/dist/index.esm.js +17059 -19431
  3. package/dist/index.umd.js +135 -161
  4. package/dist/locale/en.esm.js +1 -1
  5. package/dist/locale/en.esm.js.map +1 -1
  6. package/dist/locale/en.umd.js +1 -1
  7. package/dist/locale/en.umd.js.map +1 -1
  8. package/dist/locale/zh-cn.esm.js +1 -1
  9. package/dist/locale/zh-cn.esm.js.map +1 -1
  10. package/dist/locale/zh-cn.umd.js +1 -1
  11. package/dist/locale/zh-cn.umd.js.map +1 -1
  12. package/dist/style.css +1 -1
  13. package/dist/style.variable.css +1 -1
  14. package/lib/affix/affix.variable.css +6 -2
  15. package/lib/affix/index.js +321 -1
  16. package/lib/alert/alert.variable.css +6 -2
  17. package/lib/alert/index.js +214 -1
  18. package/lib/animate-number/index.js +155 -1
  19. package/lib/backtop/backtop.variable.css +6 -2
  20. package/lib/backtop/index.js +188 -1
  21. package/lib/badge/badge.css +8 -2
  22. package/lib/badge/badge.less +8 -4
  23. package/lib/badge/badge.variable.css +14 -4
  24. package/lib/badge/index.js +235 -1
  25. package/lib/breadcrumb/breadcrumb.variable.css +6 -2
  26. package/lib/breadcrumb/index.js +309 -1
  27. package/lib/button/button-group.d.ts +2 -2
  28. package/lib/button/button.css +10 -7
  29. package/lib/button/button.d.ts +1 -1
  30. package/lib/button/button.less +98 -93
  31. package/lib/button/button.variable.css +24 -17
  32. package/lib/button/index.d.ts +5 -5
  33. package/lib/button/index.js +321 -1
  34. package/lib/card/card.css +7 -7
  35. package/lib/card/card.less +7 -7
  36. package/lib/card/card.variable.css +13 -9
  37. package/lib/card/index.js +285 -1
  38. package/lib/cascader/cascader-panel.d.ts +1 -0
  39. package/lib/cascader/cascader.css +3 -3
  40. package/lib/cascader/cascader.d.ts +1 -0
  41. package/lib/cascader/cascader.less +4 -6
  42. package/lib/cascader/cascader.variable.css +9 -5
  43. package/lib/cascader/index.d.ts +4 -0
  44. package/lib/cascader/index.js +2053 -2
  45. package/lib/checkbox/checkbox.css +13 -1
  46. package/lib/checkbox/checkbox.d.ts +13 -10
  47. package/lib/checkbox/checkbox.less +15 -1
  48. package/lib/checkbox/checkbox.variable.css +19 -3
  49. package/lib/checkbox/common.d.ts +1 -0
  50. package/lib/checkbox/index.d.ts +28 -19
  51. package/lib/checkbox/index.js +569 -1
  52. package/lib/code-diff/code-diff.variable.css +6 -2
  53. package/lib/code-diff/index.js +5501 -1
  54. package/lib/collapse/collapse.variable.css +6 -2
  55. package/lib/collapse/index.js +570 -1
  56. package/lib/collapse-transition/collapse-transition.variable.css +6 -2
  57. package/lib/collapse-transition/index.js +177 -1
  58. package/lib/color-picker/color-picker.variable.css +6 -2
  59. package/lib/color-picker/index.js +2665 -1
  60. package/lib/components.js +530 -1
  61. package/lib/config-provider/config-provider.d.ts +18 -0
  62. package/lib/config-provider/config-provider.variable.css +6 -2
  63. package/lib/config-provider/index.d.ts +24 -0
  64. package/lib/config-provider/index.js +365 -1
  65. package/lib/config-provider/token.d.ts +6 -0
  66. package/lib/container/container.variable.css +6 -2
  67. package/lib/container/index.js +391 -1
  68. package/lib/date-picker/common.d.ts +2 -0
  69. package/lib/date-picker/date-picker.d.ts +3 -1
  70. package/lib/date-picker/date-picker.variable.css +6 -2
  71. package/lib/date-picker/index.d.ts +9 -3
  72. package/lib/date-picker/index.js +5629 -1
  73. package/lib/date-picker/panel/date.d.ts +2 -2
  74. package/lib/date-picker/panel/time-range.d.ts +17 -0
  75. package/lib/date-picker/panel/time.d.ts +17 -1
  76. package/lib/date-picker/time-picker.d.ts +3 -1
  77. package/lib/dialog/dialog.css +7 -6
  78. package/lib/dialog/dialog.less +7 -6
  79. package/lib/dialog/dialog.variable.css +13 -8
  80. package/lib/dialog/index.js +971 -2
  81. package/lib/directives/index.js +1387 -2
  82. package/lib/dist.index.js +87 -1
  83. package/lib/divider/divider.variable.css +6 -2
  84. package/lib/divider/index.js +169 -1
  85. package/lib/dropdown/dropdown.css +1 -1
  86. package/lib/dropdown/dropdown.variable.css +7 -3
  87. package/lib/dropdown/index.js +369 -1
  88. package/lib/exception/exception.variable.css +6 -2
  89. package/lib/exception/index.js +385 -1
  90. package/lib/fixed-navbar/fixed-navbar.variable.css +6 -2
  91. package/lib/fixed-navbar/index.js +154 -1
  92. package/lib/form/form.css +2 -1
  93. package/lib/form/form.less +3 -2
  94. package/lib/form/form.variable.css +8 -3
  95. package/lib/form/index.js +952 -1
  96. package/lib/hooks.js +73 -1
  97. package/lib/icon/angle-double-down-line.js +191 -1
  98. package/lib/icon/angle-double-left-line.js +191 -1
  99. package/lib/icon/angle-double-left.js +191 -1
  100. package/lib/icon/angle-double-right-line.js +191 -1
  101. package/lib/icon/angle-double-right.js +191 -1
  102. package/lib/icon/angle-double-up-line.js +191 -1
  103. package/lib/icon/angle-down-fill.js +191 -1
  104. package/lib/icon/angle-down-line.js +191 -1
  105. package/lib/icon/angle-down.js +191 -1
  106. package/lib/icon/angle-left.js +191 -1
  107. package/lib/icon/angle-right.js +191 -1
  108. package/lib/icon/angle-up-fill.js +191 -1
  109. package/lib/icon/angle-up.js +191 -1
  110. package/lib/icon/archive-fill.js +191 -1
  111. package/lib/icon/arrows-left.js +191 -1
  112. package/lib/icon/arrows-right.js +191 -1
  113. package/lib/icon/assistant.js +191 -1
  114. package/lib/icon/audio-fill.js +191 -1
  115. package/lib/icon/bk.js +191 -1
  116. package/lib/icon/circle.js +191 -1
  117. package/lib/icon/close-line.js +191 -1
  118. package/lib/icon/close.js +191 -1
  119. package/lib/icon/code.js +191 -1
  120. package/lib/icon/cog-shape.js +191 -1
  121. package/lib/icon/collapse-left.js +191 -1
  122. package/lib/icon/copy-shape.js +191 -1
  123. package/lib/icon/copy.js +191 -1
  124. package/lib/icon/data-shape.js +191 -1
  125. package/lib/icon/del.js +191 -1
  126. package/lib/icon/doc-fill.js +191 -1
  127. package/lib/icon/done.js +191 -1
  128. package/lib/icon/down-shape.js +191 -1
  129. package/lib/icon/down-small.js +191 -1
  130. package/lib/icon/edit-line.js +191 -1
  131. package/lib/icon/ellipsis.js +191 -1
  132. package/lib/icon/enlarge-line.js +191 -1
  133. package/lib/icon/error.js +191 -1
  134. package/lib/icon/excel-fill.js +191 -1
  135. package/lib/icon/exclamation-circle-shape.js +191 -1
  136. package/lib/icon/eye.js +191 -1
  137. package/lib/icon/filliscreen-line.js +191 -1
  138. package/lib/icon/fix-line.js +191 -1
  139. package/lib/icon/fix-shape.js +191 -1
  140. package/lib/icon/folder-open.js +191 -1
  141. package/lib/icon/folder-shape-open.js +191 -1
  142. package/lib/icon/folder-shape.js +191 -1
  143. package/lib/icon/folder.js +191 -1
  144. package/lib/icon/funnel.js +191 -1
  145. package/lib/icon/help-document-fill.js +191 -1
  146. package/lib/icon/help-fill.js +191 -1
  147. package/lib/icon/help.js +191 -1
  148. package/lib/icon/image-fill.js +276 -1
  149. package/lib/icon/img-error.js +276 -1
  150. package/lib/icon/img-placehoulder.js +276 -1
  151. package/lib/icon/index.d.ts +1 -0
  152. package/lib/icon/index.js +2432 -1
  153. package/lib/icon/info-line.js +276 -1
  154. package/lib/icon/info.js +276 -1
  155. package/lib/icon/left-shape.js +276 -1
  156. package/lib/icon/left-turn-line.js +276 -1
  157. package/lib/icon/loading.d.ts +4 -0
  158. package/lib/icon/loading.js +276 -0
  159. package/lib/icon/narrow-line.js +276 -1
  160. package/lib/icon/original.js +276 -1
  161. package/lib/icon/pdf-fill.js +276 -1
  162. package/lib/icon/play-shape.js +276 -1
  163. package/lib/icon/plus.js +276 -1
  164. package/lib/icon/ppt-fill.js +276 -1
  165. package/lib/icon/qq.js +276 -1
  166. package/lib/icon/right-shape.js +276 -1
  167. package/lib/icon/right-turn-line.js +276 -1
  168. package/lib/icon/search.js +276 -1
  169. package/lib/icon/share.js +276 -1
  170. package/lib/icon/spinner.js +276 -1
  171. package/lib/icon/success.js +276 -1
  172. package/lib/icon/switcher-loading.js +276 -1
  173. package/lib/icon/text-file.js +276 -1
  174. package/lib/icon/text-fill.js +276 -1
  175. package/lib/icon/transfer.js +276 -1
  176. package/lib/icon/tree-application-shape.js +276 -1
  177. package/lib/icon/unfull-screen.js +276 -1
  178. package/lib/icon/unvisible.js +276 -1
  179. package/lib/icon/up-shape.js +276 -1
  180. package/lib/icon/upload.js +276 -1
  181. package/lib/icon/video-fill.js +276 -1
  182. package/lib/icon/warn.js +276 -1
  183. package/lib/icon/weixin-pro.js +276 -1
  184. package/lib/icon/weixin.js +276 -1
  185. package/lib/image/image-viewer.variable.css +6 -2
  186. package/lib/image/image.variable.css +6 -2
  187. package/lib/image/index.js +641 -1
  188. package/lib/index.js +97 -1
  189. package/lib/info-box/index.js +1161 -2
  190. package/lib/info-box/info-box.d.ts +4 -0
  191. package/lib/info-box/info-box.variable.css +6 -2
  192. package/lib/input/index.d.ts +4 -4
  193. package/lib/input/index.js +1233 -2
  194. package/lib/input/input.css +21 -5
  195. package/lib/input/input.d.ts +3 -3
  196. package/lib/input/input.less +19 -0
  197. package/lib/input/input.variable.css +27 -7
  198. package/lib/link/index.js +160 -1
  199. package/lib/link/link.variable.css +6 -2
  200. package/lib/loading/index.d.ts +3 -3
  201. package/lib/loading/index.js +381 -1
  202. package/lib/loading/loading.css +9 -9
  203. package/lib/loading/loading.d.ts +1 -1
  204. package/lib/loading/loading.less +14 -9
  205. package/lib/loading/loading.variable.css +15 -11
  206. package/lib/locale/index.js +477 -1
  207. package/lib/locale/lang/en.d.ts +6 -0
  208. package/lib/menu/index.js +724 -1
  209. package/lib/menu/menu.variable.css +6 -2
  210. package/lib/menu/submenu.variable.css +6 -2
  211. package/lib/message/index.js +1795 -2
  212. package/lib/message/message.variable.css +6 -2
  213. package/lib/modal/index.js +396 -1
  214. package/lib/modal/modal.variable.css +6 -2
  215. package/lib/navigation/index.js +367 -1
  216. package/lib/navigation/navigation.variable.css +6 -2
  217. package/lib/notify/index.js +397 -1
  218. package/lib/notify/notify.css +6 -6
  219. package/lib/notify/notify.less +6 -6
  220. package/lib/notify/notify.variable.css +12 -8
  221. package/lib/overflow-title/components/overflow-title.d.ts +0 -1
  222. package/lib/overflow-title/index.js +285 -1
  223. package/lib/pagination/index.d.ts +4 -4
  224. package/lib/pagination/index.js +880 -1
  225. package/lib/pagination/pagination.css +1 -0
  226. package/lib/pagination/pagination.d.ts +3 -3
  227. package/lib/pagination/pagination.less +1 -0
  228. package/lib/pagination/pagination.variable.css +7 -2
  229. package/lib/plugin-popover/index.js +3833 -1
  230. package/lib/plugins/index.js +63 -1
  231. package/lib/pop-confirm/index.d.ts +42 -3
  232. package/lib/pop-confirm/index.js +281 -1
  233. package/lib/pop-confirm/pop-confirm.css +4 -4
  234. package/lib/pop-confirm/pop-confirm.d.ts +14 -1
  235. package/lib/pop-confirm/pop-confirm.less +4 -4
  236. package/lib/pop-confirm/pop-confirm.variable.css +10 -6
  237. package/lib/popover/index.js +3841 -1
  238. package/lib/popover/popover.css +1 -1
  239. package/lib/popover/popover.less +1 -1
  240. package/lib/popover/popover.variable.css +7 -3
  241. package/lib/popover2/index.js +107 -1
  242. package/lib/preset.d.ts +12 -0
  243. package/lib/preset.js +93 -1
  244. package/lib/process/index.js +759 -2
  245. package/lib/process/process.variable.css +6 -2
  246. package/lib/progress/index.d.ts +4 -4
  247. package/lib/progress/index.js +431 -1
  248. package/lib/progress/progress.css +7 -3
  249. package/lib/progress/progress.d.ts +3 -3
  250. package/lib/progress/progress.less +8 -3
  251. package/lib/progress/progress.variable.css +13 -5
  252. package/lib/radio/common.d.ts +1 -0
  253. package/lib/radio/index.d.ts +8 -2
  254. package/lib/radio/index.js +635 -1
  255. package/lib/radio/radio-button.d.ts +4 -3
  256. package/lib/radio/radio-group.d.ts +3 -0
  257. package/lib/radio/radio.css +26 -12
  258. package/lib/radio/radio.d.ts +1 -0
  259. package/lib/radio/radio.less +42 -8
  260. package/lib/radio/radio.variable.css +26 -8
  261. package/lib/rate/index.d.ts +4 -4
  262. package/lib/rate/index.js +354 -1
  263. package/lib/rate/rate.d.ts +2 -2
  264. package/lib/rate/rate.variable.css +6 -2
  265. package/lib/rate/star.css +3 -0
  266. package/lib/rate/star.less +3 -0
  267. package/lib/rate/star.variable.css +9 -2
  268. package/lib/resize-layout/index.js +429 -1
  269. package/lib/resize-layout/resize-layout.css +2 -2
  270. package/lib/resize-layout/resize-layout.less +2 -2
  271. package/lib/resize-layout/resize-layout.variable.css +8 -4
  272. package/lib/search-select/index.js +2729 -2
  273. package/lib/search-select/search-select.css +2 -4
  274. package/lib/search-select/search-select.less +10 -12
  275. package/lib/search-select/search-select.variable.css +8 -6
  276. package/lib/select/common.d.ts +3 -1
  277. package/lib/select/index.d.ts +96 -30
  278. package/lib/select/index.js +2384 -2
  279. package/lib/select/option.d.ts +1 -0
  280. package/lib/select/select.css +3 -0
  281. package/lib/select/select.d.ts +40 -14
  282. package/lib/select/select.less +3 -0
  283. package/lib/select/select.variable.css +9 -2
  284. package/lib/select/selectTagInput.d.ts +2 -0
  285. package/lib/select/type.d.ts +3 -0
  286. package/lib/shared/index.js +2690 -1
  287. package/lib/shared/vue-types.d.ts +1 -1
  288. package/lib/sideslider/index.js +704 -2
  289. package/lib/sideslider/sideslider.variable.css +6 -2
  290. package/lib/slider/index.js +1297 -2
  291. package/lib/slider/slider.css +2 -0
  292. package/lib/slider/slider.less +2 -0
  293. package/lib/slider/slider.variable.css +8 -2
  294. package/lib/steps/index.d.ts +4 -4
  295. package/lib/steps/index.js +825 -2
  296. package/lib/steps/steps.css +18 -6
  297. package/lib/steps/steps.d.ts +3 -3
  298. package/lib/steps/steps.less +26 -5
  299. package/lib/steps/steps.variable.css +24 -8
  300. package/lib/styles/index.d.ts +1 -0
  301. package/lib/styles/mixins/animate.variable.css +6 -2
  302. package/lib/styles/mixins/popper.variable.css +6 -2
  303. package/lib/styles/mixins/scroll.variable.css +6 -2
  304. package/lib/styles/reset.variable.css +6 -2
  305. package/lib/styles/themes/themes.less +7 -3
  306. package/lib/swiper/index.js +336 -1
  307. package/lib/swiper/swiper.variable.css +6 -2
  308. package/lib/switcher/index.d.ts +4 -4
  309. package/lib/switcher/index.js +277 -1
  310. package/lib/switcher/switcher.d.ts +3 -3
  311. package/lib/switcher/switcher.variable.css +6 -2
  312. package/lib/tab/index.js +914 -1
  313. package/lib/tab/tab.variable.css +6 -2
  314. package/lib/table/components/table-column.d.ts +6 -5
  315. package/lib/table/index.d.ts +57 -7
  316. package/lib/table/index.js +6510 -1
  317. package/lib/table/plugins/body-empty.d.ts +1 -1
  318. package/lib/table/plugins/head-filter.css +1 -28
  319. package/lib/table/plugins/head-filter.less +2 -34
  320. package/lib/table/plugins/head-filter.variable.css +7 -30
  321. package/lib/table/plugins/head-sort.variable.css +6 -2
  322. package/lib/table/plugins/settings.d.ts +0 -7
  323. package/lib/table/plugins/settings.variable.css +6 -2
  324. package/lib/table/plugins/use-column-resize.d.ts +1 -1
  325. package/lib/table/plugins/use-head-cell.d.ts +7 -0
  326. package/lib/table/plugins/use-pagination.d.ts +2 -1
  327. package/lib/table/props.d.ts +2 -1
  328. package/lib/table/table.css +51 -59
  329. package/lib/table/table.d.ts +1 -1
  330. package/lib/table/table.less +28 -22
  331. package/lib/table/table.variable.css +57 -61
  332. package/lib/table/use-attributes.d.ts +5 -1
  333. package/lib/table/use-column.d.ts +87 -0
  334. package/lib/table/use-common.d.ts +0 -1
  335. package/lib/table/use-render.d.ts +1 -1
  336. package/lib/table/utils.d.ts +6 -4
  337. package/lib/table-column/index.d.ts +160 -10
  338. package/lib/table-column/index.js +775 -1
  339. package/lib/tag/index.d.ts +4 -21
  340. package/lib/tag/index.js +229 -1
  341. package/lib/tag/tag.css +14 -10
  342. package/lib/tag/tag.d.ts +2 -12
  343. package/lib/tag/tag.less +31 -27
  344. package/lib/tag/tag.variable.css +20 -12
  345. package/lib/tag-input/index.d.ts +3 -0
  346. package/lib/tag-input/index.js +1674 -1
  347. package/lib/tag-input/list-tag-render.d.ts +11 -0
  348. package/lib/tag-input/tag-input.d.ts +1 -0
  349. package/lib/tag-input/tag-input.variable.css +6 -2
  350. package/lib/time-picker/index.d.ts +9 -3
  351. package/lib/time-picker/index.js +71 -1
  352. package/lib/time-picker/time-picker.css +4 -3
  353. package/lib/time-picker/time-picker.less +5 -9
  354. package/lib/time-picker/time-picker.variable.css +10 -5
  355. package/lib/timeline/index.js +241 -1
  356. package/lib/timeline/timeline.variable.css +6 -2
  357. package/lib/transfer/index.js +673 -1
  358. package/lib/transfer/transfer.css +2 -2
  359. package/lib/transfer/transfer.less +2 -2
  360. package/lib/transfer/transfer.variable.css +8 -4
  361. package/lib/tree/index.d.ts +21 -33
  362. package/lib/tree/index.js +2584 -1
  363. package/lib/tree/props.d.ts +4 -8
  364. package/lib/tree/tree.css +13 -1
  365. package/lib/tree/tree.d.ts +15 -19
  366. package/lib/tree/tree.variable.css +19 -3
  367. package/lib/tree/use-empty.d.ts +1 -3
  368. package/lib/tree/util.d.ts +1 -0
  369. package/lib/upload/index.js +2874 -2
  370. package/lib/upload/upload.type.d.ts +1 -1
  371. package/lib/upload/upload.variable.css +6 -2
  372. package/lib/upload/use-file-handler.d.ts +2 -2
  373. package/lib/virtual-render/index.js +901 -1
  374. package/lib/virtual-render/use-fix-top.d.ts +18 -0
  375. package/lib/virtual-render/v-virtual-render.d.ts +6 -1
  376. package/lib/virtual-render/virtual-render.variable.css +6 -2
  377. package/package.json +17 -4
  378. package/lib/cascader/index.js.LICENSE.txt +0 -1
  379. package/lib/dialog/index.js.LICENSE.txt +0 -1
  380. package/lib/directives/index.js.LICENSE.txt +0 -14
  381. package/lib/info-box/index.js.LICENSE.txt +0 -1
  382. package/lib/input/index.js.LICENSE.txt +0 -1
  383. package/lib/message/index.js.LICENSE.txt +0 -6
  384. package/lib/process/index.js.LICENSE.txt +0 -1
  385. package/lib/search-select/index.js.LICENSE.txt +0 -1
  386. package/lib/select/index.js.LICENSE.txt +0 -1
  387. package/lib/sideslider/index.js.LICENSE.txt +0 -1
  388. package/lib/slider/index.js.LICENSE.txt +0 -1
  389. package/lib/steps/index.js.LICENSE.txt +0 -1
  390. package/lib/table/render.d.ts +0 -130
  391. package/lib/upload/index.js.LICENSE.txt +0 -1
  392. /package/lib/overflow-title/{overflow.css → overflow-title.css} +0 -0
  393. /package/lib/overflow-title/{overflow.less → overflow-title.less} +0 -0
  394. /package/lib/overflow-title/{overflow.variable.css → overflow-title.variable.css} +0 -0
package/lib/form/index.js CHANGED
@@ -1 +1,952 @@
1
- import*as e from"../shared";import*as r from"vue";import*as t from"../config-provider";import*as o from"lodash";import*as n from"../directives";import*as s from"../icon";var a={d:(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)},i={};a.d(i,{kq:()=>d,ZD:()=>I,a_:()=>F,ZP:()=>k,xE:()=>l.formItemKey,vh:()=>l.formKey,A9:()=>l.useFormItem});const l=(c={PropTypes:()=>e.PropTypes,classes:()=>e.classes,formItemKey:()=>e.formItemKey,formKey:()=>e.formKey,useForm:()=>e.useForm,useFormItem:()=>e.useFormItem,withInstallProps:()=>e.withInstallProps},u={},a.d(u,c),u);var c,u;const p=(e=>{var r={};return a.d(r,e),r})({computed:()=>r.computed,createVNode:()=>r.createVNode,defineComponent:()=>r.defineComponent,getCurrentInstance:()=>r.getCurrentInstance,h:()=>r.h,onBeforeUnmount:()=>r.onBeforeUnmount,onMounted:()=>r.onMounted,provide:()=>r.provide,reactive:()=>r.reactive,resolveDirective:()=>r.resolveDirective,toRefs:()=>r.toRefs,withDirectives:()=>r.withDirectives}),m=(e=>{var r={};return a.d(r,e),r})({useLocale:()=>t.useLocale,usePrefix:()=>t.usePrefix});var f=function(e){return e.__v_isVNode};const d=(0,p.defineComponent)({name:"ComposeFormItem",props:{headBackgroundColor:{type:String,default:"#FAFBFD"},tailBackgroundColor:String},setup:function(){return{resolveClassName:(0,m.usePrefix)().resolveClassName}},render:function(){if(!this.$slots.default)return null;var e=this.$slots.default();if(e.length>1){for(var r=e.length,t=0,o=null;t<r;){if(f(e[t])){o=e[t];break}t+=1}for(var n=r-1,s=null;n>=0&&n>t;){if(f(e[n])){s=e[n];break}n-=1}if(o&&s){o.props||(o.props={});var a="".concat(this.resolveClassName("compose-form-item-head"));o.props.class&&(a+=" ".concat(o.props.class)),this.headBackgroundColor&&(o.props.style=Object.assign(o.props.style||{},{"background-color":this.headBackgroundColor})),o.props.class=a,s.props||(s.props={});var i="".concat(this.resolveClassName("compose-form-item-tail"));s.props.class&&(i+=" ".concat(s.props.class)),this.tailBackgroundColor&&(s.props.style=Object.assign(s.props.style||{},{"background-color":this.tailBackgroundColor})),s.props.class=i}}return(0,p.h)("div",{class:"".concat(this.resolveClassName("compose-form-item"))},e)}});function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e,r,t){return(r=function(e){var r=function(e,r){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===v(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const y=(e=>{var r={};return a.d(r,e),r})({default:()=>o.default,get:()=>o.get,isBoolean:()=>o.isBoolean,isFunction:()=>o.isFunction,isString:()=>o.isString});var h={formType:l.PropTypes.oneOf(["default","vertical"]).def("default"),labelWidth:l.PropTypes.oneOfType([Number,String]).def(150),labelPosition:l.PropTypes.oneOf(["left","center","right"]),model:l.PropTypes.object,rules:l.PropTypes.object},b={submit:null,validate:function(e,r,t){return(0,y.isString)(e)&&(0,y.isBoolean)(r)&&(0,y.isString)(t)}};const P=(0,p.defineComponent)({name:"Form",props:h,emits:b,setup:function(e,r){var t=[];return(0,p.provide)(l.formKey,{props:e,emit:r.emit,register:function(e){t.push(e)},unregister:function(e){t=t.reduce((function(r,t){return t!==e&&r.push(t),r}),[])}}),{handleSubmit:function(e){e.preventDefault(),r.emit("submit")},validate:function(r){var o={};return o=r?("string"==typeof r?[r]:r).reduce((function(e,r){return Object.assign(Object.assign({},e),g({},r,!0))}),{}):t.reduce((function(e,r){return r.property?Object.assign(Object.assign({},e),g({},r.property,!0)):e}),{}),Promise.all(t.reduce((function(e,r){return o[r.property]&&e.push(r.validate()),e}),[])).then((function(){return Promise.resolve(e.model)}))},getValidateResult:function(){return Promise.all(t.map((function(e){return e.validate(void 0,!1)}))).then((function(){return!0})).catch((function(){return!1}))},clearValidate:function(e){var r={};r=e?("string"==typeof e?[e]:e).reduce((function(e,r){return Object.assign(Object.assign({},e),g({},r,!0))}),{}):t.reduce((function(e,r){return Object.assign(Object.assign({},e),g({},r.property,!0))}),{}),t.forEach((function(e){return r[e.property]&&e.clearValidate()}))},resolveClassName:(0,m.usePrefix)().resolveClassName}},render:function(){var e,r,t,o=(0,l.classes)((g(e={},"".concat(this.resolveClassName("form")),!0),g(e,"".concat(this.resolveClassName("form--".concat(this.formType))),!0),e));return(0,p.createVNode)("form",{class:o,onSubmit:this.handleSubmit},[null===(t=(r=this.$slots).default)||void 0===t?void 0:t.call(r)])}});function C(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}function x(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return C(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?C(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const N=(e=>{var r={};return a.d(r,e),r})({bkTooltips:()=>n.bkTooltips}),T=(e=>{var r={};return a.d(r,e),r})({ExclamationCircleShape:()=>s.ExclamationCircleShape}),S={required:function(e){return!("number"!=typeof e&&"boolean"!=typeof e&&!y.default.isDate(e)&&y.default.isEmpty(e))},min:function(e,r){return e>=r},max:function(e,r){return r>=e},email:function(e){return/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(e)},maxlength:function(e,r){return e.length<=r},pattern:function(e,r){return r.test(e)}};var j={label:l.PropTypes.string,labelWidth:l.PropTypes.oneOfType([Number,String]),labelPosition:l.PropTypes.oneOf(["left","center","right"]),property:l.PropTypes.string.def(""),required:l.PropTypes.bool.def(!1),email:l.PropTypes.bool.def(!1),max:l.PropTypes.number,min:l.PropTypes.number,maxlength:l.PropTypes.number,rules:l.PropTypes.array,autoCheck:l.PropTypes.bool.def(!1),description:l.PropTypes.string,errorDisplayType:l.PropTypes.oneOf(["tooltips","normal"]).def("normal")},O=function(e){return void 0!==e};const F=(0,p.defineComponent)({name:"FormItem",directives:{bkTooltips:N.bkTooltips},props:j,setup:function(e,r){var t=(0,m.useLocale)("form"),o=(0,l.useForm)(),n=Boolean(o),s=(0,l.useFormItem)(),a=Boolean(s),i=(0,p.getCurrentInstance)(),c=(0,p.reactive)({isError:!1,errorMessage:""}),u=(0,p.computed)((function(){return!!n&&"vertical"===o.props.formType})),f=(0,p.computed)((function(){return!(!e.label&&!r.slots.label)})),d=(0,p.computed)((function(){var r={width:"",paddingRight:"",textAlign:""},t=e.labelPosition||n&&o.props.labelPosition;if(t&&(r["text-align"]=t),"vertical"===o.props.formType||!e.label&&a)return r;var s=O(e.labelWidth)?e.labelWidth:n&&o.props.labelWidth;return O(s)&&(r.width="".concat(s,"px"),r.paddingRight=s?"":"0px"),r})),v=(0,p.computed)((function(){return g({},"margin-left",d.value.width)})),h=function(r){var s=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e.property||n&&!o.props.model)return Promise.resolve(!0);var a,i,l=[];n&&o.props.rules&&(a=o.props.rules,i=e.property,Object.prototype.hasOwnProperty.call(a,i))&&(l=o.props.rules[e.property]),e.rules&&(l=e.rules),l=function(e,r){return r.reduce((function(r,t){return t.trigger&&e?((Array.isArray(t.trigger)?t.trigger:[t.trigger]).includes(e)&&r.push(t),r):(r.push(t),r)}),[])}(r,function(e,r,t){var o=!1,n=!1,s=e.reduce((function(e,r){var s;if(r.required)s=(0,y.isFunction)(r.validator)?r.validator:S.required,o=!0;else if(r.email)s=(0,y.isFunction)(r.validator)?r.validator:S.email,n=!0;else if(Number(r.max)>-1)s=function(e){return S.max(e,r.max)};else if(Number(r.min)>-1)s=function(e){return S.min(e,r.max)};else if(Number(r.maxlength)>-1)s=function(e){return S.min(e,r.max)};else if("[object RegExp]"===Object.prototype.toString.call(r.pattern))s=function(e){return S.pattern(e,r.pattern)};else{if(!(0,y.isFunction)(r.validator))return e;s=r.validator}return e.push({validator:s,message:r.message||t.value.verifyError,trigger:r.trigger||"blur"}),e}),[]),a=r.reduce((function(e,r){return r.required&&o||r.email&&n||e.push(r),e}),[]);return[].concat(x(a),x(s))}(l,function(e,r){var t=[],o=e.label||"";return e.required&&t.push({required:!0,validator:S.required,message:"".concat(o).concat(r.value.notBeEmpty),trigger:"change"}),e.email&&t.push({email:!0,validator:S.email,message:"".concat(o).concat(r.value.incorrectFormat),trigger:"change"}),Number(e.max)>-1&&t.push({validator:function(r){return S.max(r,e.max)},message:"".concat(o).concat(r.value.max," ").concat(e.max),trigger:"change"}),Number(e.min)>-1&&t.push({validator:function(r){return S.min(r,e.min)},message:"".concat(o).concat(r.value.min," ").concat(e.min),trigger:"change"}),Number(e.maxlength)>-1&&t.push({validator:function(r){return S.maxlength(r,e.maxlength)},message:"".concat(o).concat(r.value.maxLen," ").concat(e.maxlength),trigger:"change"}),t}(e,t),t)),l.length>0&&s&&(c.isError=!1,c.errorMessage="");var u,p=(0,y.get)(o.props.model,e.property),m=(u=-1,function(){if((u+=1)>=l.length)return o.emit("validate",e.property,!0,""),Promise.resolve(!0);var r=l[u];return Promise.resolve().then((function(){var t=r.validator(p),n=function(e){return"function"==typeof e.message?e.message():e.message}(r);return"boolean"!=typeof t&&"function"==typeof t.then?t.then((function(e){if(!1===e)return Promise.reject(n)})).then((function(){return m()}),(function(){return s&&(c.isError=!0,c.errorMessage=n),o.emit("validate",e.property,!1,n),Promise.reject(c.errorMessage)})):t?m():(s&&(c.isError=!0,c.errorMessage="string"==typeof t?t:n),o.emit("validate",e.property,!1,n),Promise.reject(c.errorMessage))}))});return m()},b=function(){c.isError=!1,c.errorMessage=""};(0,p.provide)(l.formItemKey,Object.assign(Object.assign({},e),{validate:h,clearValidate:b})),(0,p.onMounted)((function(){n&&o.register(i.proxy)})),(0,p.onBeforeUnmount)((function(){n&&o.unregister(i.proxy)}));var P=(0,m.usePrefix)().resolveClassName;return Object.assign(Object.assign({},(0,p.toRefs)(c)),{isShowLabel:f,labelStyles:d,contentStyles:v,isFormTypeVertical:u,validate:h,clearValidate:b,resolveClassName:P})},render:function(){var e,r,t,o,n,s=this,a=(0,l.classes)((g(e={},"".concat(this.resolveClassName("form-item")),!0),g(e,"is-error",this.isError),g(e,"is-required",this.required),e));return(0,p.createVNode)("div",{class:a},[this.isShowLabel&&(0,p.createVNode)("div",{class:"".concat(this.resolveClassName("form-label")),style:this.labelStyles},[s.$slots.label?(0,p.createVNode)("span",null,[s.$slots.label()]):s.description?(0,p.withDirectives)((0,p.createVNode)("span",{class:g({},"".concat(s.resolveClassName("form-label-description")),Boolean(s.description))},[s.label]),[[(0,p.resolveDirective)("bk-tooltips"),s.description]]):(0,p.createVNode)("span",null,[s.label]),this.isFormTypeVertical&&(null===(t=(r=this.$slots).labelAppend)||void 0===t?void 0:t.call(r))]),(0,p.createVNode)("div",{class:"".concat(this.resolveClassName("form-content")),style:this.contentStyles},[null===(n=(o=this.$slots).default)||void 0===n?void 0:n.call(o),s.isError?"tooltips"===s.errorDisplayType?(0,p.withDirectives)((0,p.createVNode)("div",{class:"".concat(s.resolveClassName("form-error-tips"))},[(0,p.createVNode)(T.ExclamationCircleShape,null,null)]),[[(0,p.resolveDirective)("bk-tooltips"),s.errorMessage]]):(0,p.createVNode)("div",{class:"".concat(s.resolveClassName("form-error"))},[s.$slots.error?s.$slots.error(s.errorMessage):s.errorMessage]):null])])}});var I=(0,l.withInstallProps)(P,{FormItem:F,ComposeFormItem:d});const k=I;var w=i.kq,B=i.ZD,V=i.a_,E=i.ZP,A=i.xE,D=i.vh,M=i.A9;export{w as BkComposeFormItem,B as BkForm,V as BkFormItem,E as default,A as formItemKey,D as formKey,M as useFormItem};
1
+ import * as __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__ from "../shared";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__ from "../config-provider";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_isBoolean_dcb66997__ from "lodash/isBoolean";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_isString_e6fa8a5b__ from "lodash/isString";
6
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_get_9427f899__ from "lodash/get";
7
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_isFunction_f90b20d6__ from "lodash/isFunction";
8
+ import * as __WEBPACK_EXTERNAL_MODULE__directives_9cc9ba10__ from "../directives";
9
+ import * as __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__ from "../icon";
10
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_isDate_b457317b__ from "lodash/isDate";
11
+ import * as __WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_e109fd6b__ from "lodash/isEmpty";
12
+ /******/ // The require scope
13
+ /******/ var __webpack_require__ = {};
14
+ /******/
15
+ /************************************************************************/
16
+ /******/ /* webpack/runtime/define property getters */
17
+ /******/ (() => {
18
+ /******/ // define getter functions for harmony exports
19
+ /******/ __webpack_require__.d = (exports, definition) => {
20
+ /******/ for(var key in definition) {
21
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
22
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
23
+ /******/ }
24
+ /******/ }
25
+ /******/ };
26
+ /******/ })();
27
+ /******/
28
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
29
+ /******/ (() => {
30
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
31
+ /******/ })();
32
+ /******/
33
+ /************************************************************************/
34
+ var __webpack_exports__ = {};
35
+
36
+ // EXPORTS
37
+ __webpack_require__.d(__webpack_exports__, {
38
+ kq: () => (/* reexport */ compose_form_item),
39
+ ZD: () => (/* binding */ BkForm),
40
+ a_: () => (/* reexport */ form_item),
41
+ ZP: () => (/* binding */ src),
42
+ xE: () => (/* reexport */ external_shared_namespaceObject.formItemKey),
43
+ vh: () => (/* reexport */ external_shared_namespaceObject.formKey),
44
+ A9: () => (/* reexport */ external_shared_namespaceObject.useFormItem)
45
+ });
46
+
47
+ ;// CONCATENATED MODULE: external "../shared"
48
+ var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
49
+ var y = x => () => x
50
+ const external_shared_namespaceObject = x({ ["PropTypes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.PropTypes, ["classes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.classes, ["formItemKey"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.formItemKey, ["formKey"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.formKey, ["useForm"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.useForm, ["useFormItem"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.useFormItem, ["withInstallProps"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.withInstallProps });
51
+ ;// CONCATENATED MODULE: external "vue"
52
+ var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
53
+ var external_vue_y = x => () => x
54
+ const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["getCurrentInstance"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.getCurrentInstance, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["resolveDirective"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective, ["toRefs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRefs, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
55
+ ;// CONCATENATED MODULE: external "../config-provider"
56
+ var external_config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
57
+ var external_config_provider_y = x => () => x
58
+ const external_config_provider_namespaceObject = external_config_provider_x({ ["useLocale"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.useLocale, ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.usePrefix });
59
+ ;// CONCATENATED MODULE: ../../packages/form/src/compose-form-item.tsx
60
+ /*
61
+ * Tencent is pleased to support the open source community by making
62
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
63
+ *
64
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
65
+ *
66
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
67
+ *
68
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
69
+ *
70
+ * ---------------------------------------------------
71
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
72
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
73
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
74
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
75
+ *
76
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
77
+ * the Software.
78
+ *
79
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
80
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
81
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
82
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
83
+ * IN THE SOFTWARE.
84
+ */
85
+
86
+
87
+ var isCustomComponent = function isCustomComponent(node) {
88
+ return node.__v_isVNode;
89
+ };
90
+ /* harmony default export */ const compose_form_item = ((0,external_vue_namespaceObject.defineComponent)({
91
+ name: 'ComposeFormItem',
92
+ props: {
93
+ headBackgroundColor: {
94
+ type: String,
95
+ "default": '#FAFBFD'
96
+ },
97
+ tailBackgroundColor: String
98
+ },
99
+ setup: function setup() {
100
+ var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
101
+ resolveClassName = _usePrefix.resolveClassName;
102
+ return {
103
+ resolveClassName: resolveClassName
104
+ };
105
+ },
106
+ render: function render() {
107
+ if (!this.$slots["default"]) {
108
+ return null;
109
+ }
110
+ var childrenArr = this.$slots["default"]();
111
+ if (childrenArr.length > 1) {
112
+ var childrenLength = childrenArr.length;
113
+ var startIndex = 0;
114
+ var headChildren = null;
115
+ while (startIndex < childrenLength) {
116
+ if (isCustomComponent(childrenArr[startIndex])) {
117
+ headChildren = childrenArr[startIndex];
118
+ break;
119
+ }
120
+ startIndex = startIndex + 1;
121
+ }
122
+ var tailIndex = childrenLength - 1;
123
+ var tailChildren = null;
124
+ while (tailIndex >= 0 && tailIndex > startIndex) {
125
+ if (isCustomComponent(childrenArr[tailIndex])) {
126
+ tailChildren = childrenArr[tailIndex];
127
+ break;
128
+ }
129
+ tailIndex = tailIndex - 1;
130
+ }
131
+ if (headChildren && tailChildren) {
132
+ if (!headChildren.props) {
133
+ headChildren.props = {};
134
+ }
135
+ var headChildClass = "".concat(this.resolveClassName('compose-form-item-head'));
136
+ if (headChildren.props["class"]) {
137
+ headChildClass += " ".concat(headChildren.props["class"]);
138
+ }
139
+ if (this.headBackgroundColor) {
140
+ headChildren.props.style = Object.assign(headChildren.props.style || {}, {
141
+ 'background-color': this.headBackgroundColor
142
+ });
143
+ }
144
+ headChildren.props["class"] = headChildClass;
145
+ if (!tailChildren.props) {
146
+ tailChildren.props = {};
147
+ }
148
+ var tailChildStaticClass = "".concat(this.resolveClassName('compose-form-item-tail'));
149
+ if (tailChildren.props["class"]) {
150
+ tailChildStaticClass += " ".concat(tailChildren.props["class"]);
151
+ }
152
+ if (this.tailBackgroundColor) {
153
+ tailChildren.props.style = Object.assign(tailChildren.props.style || {}, {
154
+ 'background-color': this.tailBackgroundColor
155
+ });
156
+ }
157
+ tailChildren.props["class"] = tailChildStaticClass;
158
+ }
159
+ }
160
+ return (0,external_vue_namespaceObject.h)('div', {
161
+ "class": "".concat(this.resolveClassName('compose-form-item'))
162
+ }, childrenArr);
163
+ }
164
+ }));
165
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
166
+ function _typeof(obj) {
167
+ "@babel/helpers - typeof";
168
+
169
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
170
+ return typeof obj;
171
+ } : function (obj) {
172
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
173
+ }, _typeof(obj);
174
+ }
175
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
176
+
177
+ function _toPrimitive(input, hint) {
178
+ if (_typeof(input) !== "object" || input === null) return input;
179
+ var prim = input[Symbol.toPrimitive];
180
+ if (prim !== undefined) {
181
+ var res = prim.call(input, hint || "default");
182
+ if (_typeof(res) !== "object") return res;
183
+ throw new TypeError("@@toPrimitive must return a primitive value.");
184
+ }
185
+ return (hint === "string" ? String : Number)(input);
186
+ }
187
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
188
+
189
+
190
+ function _toPropertyKey(arg) {
191
+ var key = _toPrimitive(arg, "string");
192
+ return _typeof(key) === "symbol" ? key : String(key);
193
+ }
194
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
195
+
196
+ function _defineProperty(obj, key, value) {
197
+ key = _toPropertyKey(key);
198
+ if (key in obj) {
199
+ Object.defineProperty(obj, key, {
200
+ value: value,
201
+ enumerable: true,
202
+ configurable: true,
203
+ writable: true
204
+ });
205
+ } else {
206
+ obj[key] = value;
207
+ }
208
+ return obj;
209
+ }
210
+ ;// CONCATENATED MODULE: external "lodash/isBoolean"
211
+ var isBoolean_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
212
+ var isBoolean_y = x => () => x
213
+ const isBoolean_namespaceObject = isBoolean_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isBoolean_dcb66997__["default"] });
214
+ ;// CONCATENATED MODULE: external "lodash/isString"
215
+ var isString_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
216
+ var isString_y = x => () => x
217
+ const isString_namespaceObject = isString_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isString_e6fa8a5b__["default"] });
218
+ ;// CONCATENATED MODULE: ../../packages/form/src/form.tsx
219
+
220
+
221
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
222
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
223
+ /*
224
+ * Tencent is pleased to support the open source community by making
225
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
226
+ *
227
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
228
+ *
229
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
230
+ *
231
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
232
+ *
233
+ * ---------------------------------------------------
234
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
235
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
236
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
237
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
238
+ *
239
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
240
+ * the Software.
241
+ *
242
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
243
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
244
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
245
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
246
+ * IN THE SOFTWARE.
247
+ */
248
+
249
+
250
+
251
+
252
+
253
+ var formProps = {
254
+ formType: external_shared_namespaceObject.PropTypes.oneOf(['default', 'vertical']).def('default'),
255
+ labelWidth: external_shared_namespaceObject.PropTypes.oneOfType([Number, String]).def(150),
256
+ labelPosition: external_shared_namespaceObject.PropTypes.oneOf(['left', 'center', 'right']),
257
+ model: external_shared_namespaceObject.PropTypes.object,
258
+ rules: external_shared_namespaceObject.PropTypes.object
259
+ };
260
+ var formEvents = {
261
+ submit: null,
262
+ validate: function validate(property, result, message) {
263
+ return (0,isString_namespaceObject["default"])(property) && (0,isBoolean_namespaceObject["default"])(result) && (0,isString_namespaceObject["default"])(message);
264
+ }
265
+ };
266
+ /* harmony default export */ const src_form = ((0,external_vue_namespaceObject.defineComponent)({
267
+ // eslint-disable-next-line vue/no-reserved-component-names
268
+ name: 'Form',
269
+ props: formProps,
270
+ emits: formEvents,
271
+ setup: function setup(props, context) {
272
+ // form-item 列表
273
+ var formItemInstanceList = [];
274
+ /**
275
+ * @desc 注册 form-item
276
+ * @param { IFormItemContext } formItemInstance
277
+ */
278
+ var register = function register(formItemInstance) {
279
+ formItemInstanceList.push(formItemInstance);
280
+ };
281
+ /**
282
+ * @desc 卸载 form-item
283
+ * @param { IFormItemContext } formItemInstance
284
+ */
285
+ var unregister = function unregister(formItemInstance) {
286
+ formItemInstanceList = formItemInstanceList.reduce(function (result, item) {
287
+ if (item !== formItemInstance) {
288
+ result.push(item);
289
+ }
290
+ return result;
291
+ }, []);
292
+ };
293
+ (0,external_vue_namespaceObject.provide)(external_shared_namespaceObject.formKey, {
294
+ props: props,
295
+ emit: context.emit,
296
+ register: register,
297
+ unregister: unregister
298
+ });
299
+ var handleSubmit = function handleSubmit(event) {
300
+ event.preventDefault();
301
+ context.emit('submit');
302
+ };
303
+ /**
304
+ * @desc 验证表单
305
+ * @param { string | Array<string> } fields 指定表单字段
306
+ * @returns { Promise<[]> }
307
+ */
308
+ var validate = function validate(fields) {
309
+ var fieldMap = {};
310
+ if (fields) {
311
+ var fieldList = typeof fields === 'string' ? [fields] : fields;
312
+ fieldMap = fieldList.reduce(function (result, item) {
313
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item, true));
314
+ }, {});
315
+ } else {
316
+ fieldMap = formItemInstanceList.reduce(function (result, item) {
317
+ if (item.property) {
318
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item.property, true));
319
+ }
320
+ return result;
321
+ }, {});
322
+ }
323
+ return Promise.all(formItemInstanceList.reduce(function (result, formItem) {
324
+ if (fieldMap[formItem.property]) {
325
+ result.push(formItem.validate());
326
+ }
327
+ return result;
328
+ }, [])).then(function () {
329
+ return Promise.resolve(props.model);
330
+ });
331
+ };
332
+ /**
333
+ * @desc 获取表单的验证的结果(所有表单项验证成功返回 true)
334
+ * @returns { Promise<Boolean> }
335
+ */
336
+ var getValidateResult = function getValidateResult() {
337
+ return Promise.all(formItemInstanceList.map(function (formItem) {
338
+ return formItem.validate(undefined, false);
339
+ })).then(function () {
340
+ return true;
341
+ })["catch"](function () {
342
+ return false;
343
+ });
344
+ };
345
+ /**
346
+ * @desc 清除表单验证错误信息
347
+ * @param { string | Array<string> } fields 指定表单字段
348
+ */
349
+ var clearValidate = function clearValidate(fields) {
350
+ var fieldMap = {};
351
+ if (fields) {
352
+ var fieldList = typeof fields === 'string' ? [fields] : fields;
353
+ fieldMap = fieldList.reduce(function (result, item) {
354
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item, true));
355
+ }, {});
356
+ } else {
357
+ fieldMap = formItemInstanceList.reduce(function (result, item) {
358
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item.property, true));
359
+ }, {});
360
+ }
361
+ formItemInstanceList.forEach(function (formItem) {
362
+ return fieldMap[formItem.property] && formItem.clearValidate();
363
+ });
364
+ };
365
+ var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
366
+ resolveClassName = _usePrefix.resolveClassName;
367
+ return {
368
+ handleSubmit: handleSubmit,
369
+ validate: validate,
370
+ getValidateResult: getValidateResult,
371
+ clearValidate: clearValidate,
372
+ resolveClassName: resolveClassName
373
+ };
374
+ },
375
+ render: function render() {
376
+ var _classes, _this$$slots$default, _this$$slots;
377
+ var formClasses = (0,external_shared_namespaceObject.classes)((_classes = {}, _defineProperty(_classes, "".concat(this.resolveClassName('form')), true), _defineProperty(_classes, "".concat(this.resolveClassName("form--".concat(this.formType))), true), _classes));
378
+ return (0,external_vue_namespaceObject.createVNode)("form", {
379
+ "class": formClasses,
380
+ "onSubmit": this.handleSubmit
381
+ }, [(_this$$slots$default = (_this$$slots = this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)]);
382
+ }
383
+ }));
384
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
385
+ function _arrayLikeToArray(arr, len) {
386
+ if (len == null || len > arr.length) len = arr.length;
387
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
388
+ return arr2;
389
+ }
390
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
391
+
392
+ function _arrayWithoutHoles(arr) {
393
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
394
+ }
395
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
396
+ function _iterableToArray(iter) {
397
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
398
+ }
399
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
400
+
401
+ function _unsupportedIterableToArray(o, minLen) {
402
+ if (!o) return;
403
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
404
+ var n = Object.prototype.toString.call(o).slice(8, -1);
405
+ if (n === "Object" && o.constructor) n = o.constructor.name;
406
+ if (n === "Map" || n === "Set") return Array.from(o);
407
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
408
+ }
409
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
410
+ function _nonIterableSpread() {
411
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
412
+ }
413
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
414
+
415
+
416
+
417
+
418
+ function _toConsumableArray(arr) {
419
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
420
+ }
421
+ ;// CONCATENATED MODULE: external "lodash/get"
422
+ var get_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
423
+ var get_y = x => () => x
424
+ const get_namespaceObject = get_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_get_9427f899__["default"] });
425
+ ;// CONCATENATED MODULE: external "lodash/isFunction"
426
+ var isFunction_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
427
+ var isFunction_y = x => () => x
428
+ const isFunction_namespaceObject = isFunction_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isFunction_f90b20d6__["default"] });
429
+ ;// CONCATENATED MODULE: external "../directives"
430
+ var external_directives_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
431
+ var external_directives_y = x => () => x
432
+ const external_directives_namespaceObject = external_directives_x({ ["bkTooltips"]: () => __WEBPACK_EXTERNAL_MODULE__directives_9cc9ba10__.bkTooltips });
433
+ ;// CONCATENATED MODULE: external "../icon"
434
+ var external_icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
435
+ var external_icon_y = x => () => x
436
+ const external_icon_namespaceObject = external_icon_x({ ["ExclamationCircleShape"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.ExclamationCircleShape });
437
+ ;// CONCATENATED MODULE: ../../packages/form/src/utils.ts
438
+ /*
439
+ * Tencent is pleased to support the open source community by making
440
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
441
+ *
442
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
443
+ *
444
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
445
+ *
446
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
447
+ *
448
+ * ---------------------------------------------------
449
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
450
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
451
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
452
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
453
+ *
454
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
455
+ * the Software.
456
+ *
457
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
458
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
459
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
460
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
461
+ * IN THE SOFTWARE.
462
+ */
463
+ var getRuleMessage = function getRuleMessage(rule) {
464
+ if (typeof rule.message === 'function') {
465
+ return rule.message();
466
+ }
467
+ return rule.message;
468
+ };
469
+ ;// CONCATENATED MODULE: external "lodash/isDate"
470
+ var isDate_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
471
+ var isDate_y = x => () => x
472
+ const isDate_namespaceObject = isDate_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isDate_b457317b__["default"] });
473
+ ;// CONCATENATED MODULE: external "lodash/isEmpty"
474
+ var isEmpty_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
475
+ var isEmpty_y = x => () => x
476
+ const isEmpty_namespaceObject = isEmpty_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_e109fd6b__["default"] });
477
+ ;// CONCATENATED MODULE: ../../packages/form/src/validator.ts
478
+ /*
479
+ * Tencent is pleased to support the open source community by making
480
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
481
+ *
482
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
483
+ *
484
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
485
+ *
486
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
487
+ *
488
+ * ---------------------------------------------------
489
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
490
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
491
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
492
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
493
+ *
494
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
495
+ * the Software.
496
+ *
497
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
498
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
499
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
500
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
501
+ * IN THE SOFTWARE.
502
+ */
503
+
504
+
505
+ /* harmony default export */ const src_validator = ({
506
+ required: function required(value) {
507
+ if (typeof value === 'number' || typeof value === 'boolean' || (0,isDate_namespaceObject["default"])(value)) {
508
+ return true;
509
+ }
510
+ return !(0,isEmpty_namespaceObject["default"])(value);
511
+ },
512
+ min: function min(value, _min) {
513
+ return value >= _min;
514
+ },
515
+ max: function max(value, _max) {
516
+ return _max >= value;
517
+ },
518
+ email: function email(value) {
519
+ return /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(value);
520
+ },
521
+ maxlength: function maxlength(value, _maxlength) {
522
+ return value.length <= _maxlength;
523
+ },
524
+ pattern: function pattern(value, _pattern) {
525
+ return _pattern.test(value);
526
+ }
527
+ });
528
+ ;// CONCATENATED MODULE: ../../packages/form/src/form-item.tsx
529
+
530
+
531
+
532
+ function form_item_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
533
+ function form_item_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? form_item_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : form_item_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
534
+ /*
535
+ * Tencent is pleased to support the open source community by making
536
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
537
+ *
538
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
539
+ *
540
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
541
+ *
542
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
543
+ *
544
+ * ---------------------------------------------------
545
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
546
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
547
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
548
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
549
+ *
550
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
551
+ * the Software.
552
+ *
553
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
554
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
555
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
556
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
557
+ * IN THE SOFTWARE.
558
+ */
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+ var formItemProps = {
569
+ label: external_shared_namespaceObject.PropTypes.string,
570
+ labelWidth: external_shared_namespaceObject.PropTypes.oneOfType([Number, String]),
571
+ labelPosition: external_shared_namespaceObject.PropTypes.oneOf(['left', 'center', 'right']),
572
+ property: external_shared_namespaceObject.PropTypes.string.def(''),
573
+ required: external_shared_namespaceObject.PropTypes.bool.def(false),
574
+ email: external_shared_namespaceObject.PropTypes.bool.def(false),
575
+ max: external_shared_namespaceObject.PropTypes.number,
576
+ min: external_shared_namespaceObject.PropTypes.number,
577
+ maxlength: external_shared_namespaceObject.PropTypes.number,
578
+ rules: external_shared_namespaceObject.PropTypes.array,
579
+ autoCheck: external_shared_namespaceObject.PropTypes.bool.def(false),
580
+ description: external_shared_namespaceObject.PropTypes.string,
581
+ errorDisplayType: external_shared_namespaceObject.PropTypes.oneOf(['tooltips', 'normal']).def('normal')
582
+ };
583
+ var hasOwn = function hasOwn(obj, key) {
584
+ return Object.prototype.hasOwnProperty.call(obj, key);
585
+ };
586
+ var getRulesFromProps = function getRulesFromProps(props, t) {
587
+ var rules = [];
588
+ var label = props.label || '';
589
+ if (props.required) {
590
+ rules.push({
591
+ required: true,
592
+ validator: src_validator.required,
593
+ message: "".concat(label).concat(t.value.notBeEmpty),
594
+ trigger: 'change'
595
+ });
596
+ }
597
+ if (props.email) {
598
+ rules.push({
599
+ email: true,
600
+ validator: src_validator.email,
601
+ message: "".concat(label).concat(t.value.incorrectFormat),
602
+ trigger: 'change'
603
+ });
604
+ }
605
+ if (Number(props.max) > -1) {
606
+ rules.push({
607
+ validator: function validator(value) {
608
+ return src_validator.max(value, props.max);
609
+ },
610
+ message: "".concat(label).concat(t.value.max, " ").concat(props.max),
611
+ trigger: 'change'
612
+ });
613
+ }
614
+ if (Number(props.min) > -1) {
615
+ rules.push({
616
+ validator: function validator(value) {
617
+ return src_validator.min(value, props.min);
618
+ },
619
+ message: "".concat(label).concat(t.value.min, " ").concat(props.min),
620
+ trigger: 'change'
621
+ });
622
+ }
623
+ if (Number(props.maxlength) > -1) {
624
+ rules.push({
625
+ validator: function validator(value) {
626
+ return src_validator.maxlength(value, props.maxlength);
627
+ },
628
+ message: "".concat(label).concat(t.value.maxLen, " ").concat(props.maxlength),
629
+ trigger: 'change'
630
+ });
631
+ }
632
+ return rules;
633
+ };
634
+ var mergeRules = function mergeRules(configRules, propRules, t) {
635
+ var customRequired = false;
636
+ var customEmail = false;
637
+ var formatConfigRules = configRules.reduce(function (result, rule) {
638
+ var rulevalidator;
639
+ if (rule.required) {
640
+ rulevalidator = (0,isFunction_namespaceObject["default"])(rule.validator) ? rule.validator : src_validator.required;
641
+ customRequired = true;
642
+ } else if (rule.email) {
643
+ rulevalidator = (0,isFunction_namespaceObject["default"])(rule.validator) ? rule.validator : src_validator.email;
644
+ customEmail = true;
645
+ } else if (Number(rule.max) > -1) {
646
+ rulevalidator = function rulevalidator(value) {
647
+ return src_validator.max(value, rule.max);
648
+ };
649
+ } else if (Number(rule.min) > -1) {
650
+ rulevalidator = function rulevalidator(value) {
651
+ return src_validator.min(value, rule.max);
652
+ };
653
+ } else if (Number(rule.maxlength) > -1) {
654
+ rulevalidator = function rulevalidator(value) {
655
+ return src_validator.min(value, rule.max);
656
+ };
657
+ } else if (Object.prototype.toString.call(rule.pattern) === '[object RegExp]') {
658
+ rulevalidator = function rulevalidator(value) {
659
+ return src_validator.pattern(value, rule.pattern);
660
+ };
661
+ } else if ((0,isFunction_namespaceObject["default"])(rule.validator)) {
662
+ rulevalidator = rule.validator;
663
+ } else {
664
+ // 不支持的配置规则
665
+ return result;
666
+ }
667
+ result.push({
668
+ validator: rulevalidator,
669
+ message: rule.message || t.value.verifyError,
670
+ trigger: rule.trigger || 'blur'
671
+ });
672
+ return result;
673
+ }, []);
674
+ // 自定义配置验证规则覆盖内置验证规则
675
+ var filterPropRules = propRules.reduce(function (result, ruleItem) {
676
+ if (ruleItem.required && customRequired) {
677
+ return result;
678
+ }
679
+ if (ruleItem.email && customEmail) {
680
+ return result;
681
+ }
682
+ result.push(ruleItem);
683
+ return result;
684
+ }, []);
685
+ return [].concat(_toConsumableArray(filterPropRules), _toConsumableArray(formatConfigRules));
686
+ };
687
+ var getTriggerRules = function getTriggerRules(trigger, rules) {
688
+ return rules.reduce(function (result, rule) {
689
+ if (!rule.trigger || !trigger) {
690
+ result.push(rule);
691
+ return result;
692
+ }
693
+ var ruleTriggerList = Array.isArray(rule.trigger) ? rule.trigger : [rule.trigger];
694
+ if (ruleTriggerList.includes(trigger)) {
695
+ result.push(rule);
696
+ }
697
+ return result;
698
+ }, []);
699
+ };
700
+ var isValid = function isValid(value) {
701
+ return value !== undefined;
702
+ };
703
+ /* harmony default export */ const form_item = ((0,external_vue_namespaceObject.defineComponent)({
704
+ name: 'FormItem',
705
+ directives: {
706
+ bkTooltips: external_directives_namespaceObject.bkTooltips
707
+ },
708
+ props: formItemProps,
709
+ setup: function setup(props, context) {
710
+ var t = (0,external_config_provider_namespaceObject.useLocale)('form');
711
+ var form = (0,external_shared_namespaceObject.useForm)();
712
+ var isForm = Boolean(form);
713
+ var parentFormItem = (0,external_shared_namespaceObject.useFormItem)();
714
+ var isNested = Boolean(parentFormItem);
715
+ var currentInstance = (0,external_vue_namespaceObject.getCurrentInstance)();
716
+ var state = (0,external_vue_namespaceObject.reactive)({
717
+ isError: false,
718
+ errorMessage: ''
719
+ });
720
+ var isFormTypeVertical = (0,external_vue_namespaceObject.computed)(function () {
721
+ if (!isForm) {
722
+ return false;
723
+ }
724
+ return form.props.formType === 'vertical';
725
+ });
726
+ var isShowLabel = (0,external_vue_namespaceObject.computed)(function () {
727
+ if (props.label || context.slots.label) {
728
+ return true;
729
+ }
730
+ return false;
731
+ });
732
+ var labelStyles = (0,external_vue_namespaceObject.computed)(function () {
733
+ var styles = {
734
+ width: '',
735
+ paddingRight: '',
736
+ textAlign: ''
737
+ };
738
+ var labelPosition = props.labelPosition || isForm && form.props.labelPosition;
739
+ if (labelPosition) {
740
+ styles['text-align'] = labelPosition;
741
+ }
742
+ if (form.props.formType === 'vertical' || !props.label && isNested) {
743
+ return styles;
744
+ }
745
+ var labelWidth = isValid(props.labelWidth) ? props.labelWidth : isForm && form.props.labelWidth;
746
+ if (isValid(labelWidth)) {
747
+ styles.width = "".concat(labelWidth, "px");
748
+ styles.paddingRight = labelWidth ? '' : '0px';
749
+ }
750
+ return styles;
751
+ });
752
+ var contentStyles = (0,external_vue_namespaceObject.computed)(function () {
753
+ return _defineProperty({}, 'margin-left', labelStyles.value.width);
754
+ });
755
+ /**
756
+ * @desc 验证字段
757
+ *
758
+ * @param { undefined | string } trigger 验证触发方式
759
+ * @param { boolean } showError 是否展示错误信息
760
+ */
761
+ var validate = function validate(trigger) {
762
+ var showError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
763
+ // 没有设置 property 不进行验证
764
+ if (!props.property || isForm && !form.props.model) {
765
+ return Promise.resolve(true);
766
+ }
767
+ var rules = [];
768
+ // 继承 form 的验证规则
769
+ if (isForm && form.props.rules && hasOwn(form.props.rules, props.property)) {
770
+ rules = form.props.rules[props.property];
771
+ }
772
+ // form-item 自己的 rules 规则优先级更高
773
+ if (props.rules) {
774
+ rules = props.rules;
775
+ }
776
+ // 合并规则属性配置
777
+ rules = getTriggerRules(trigger, mergeRules(rules, getRulesFromProps(props, t), t));
778
+ // 重新触发验证重置上次的验证状态
779
+ if (rules.length > 0 && showError) {
780
+ state.isError = false;
781
+ state.errorMessage = '';
782
+ }
783
+ var value = (0,get_namespaceObject["default"])(form.props.model, props.property);
784
+ var doValidate = function () {
785
+ var stepIndex = -1;
786
+ return function () {
787
+ stepIndex = stepIndex + 1;
788
+ // form-item 验证通过
789
+ if (stepIndex >= rules.length) {
790
+ form.emit('validate', props.property, true, '');
791
+ return Promise.resolve(true);
792
+ }
793
+ var rule = rules[stepIndex];
794
+ return Promise.resolve().then(function () {
795
+ var result = rule.validator(value);
796
+ var errorMessage = getRuleMessage(rule);
797
+ // 异步验证(validator 返回一个 Promise)
798
+ if (typeof result !== 'boolean' && typeof result.then === 'function') {
799
+ return result.then(function (data) {
800
+ // 异步验证结果为 false
801
+ if (data === false) {
802
+ return Promise.reject(errorMessage);
803
+ }
804
+ }).then(function () {
805
+ return doValidate();
806
+ }, function () {
807
+ if (showError) {
808
+ state.isError = true;
809
+ state.errorMessage = errorMessage;
810
+ }
811
+ form.emit('validate', props.property, false, errorMessage);
812
+ return Promise.reject(state.errorMessage);
813
+ });
814
+ }
815
+ // 同步验证失败
816
+ if (!result) {
817
+ if (showError) {
818
+ state.isError = true;
819
+ // 验证结果返回的是 String 表示验证失败,返回结果作为错误信息
820
+ state.errorMessage = typeof result === 'string' ? result : errorMessage;
821
+ }
822
+ form.emit('validate', props.property, false, errorMessage);
823
+ return Promise.reject(state.errorMessage);
824
+ }
825
+ // 下一步
826
+ return doValidate();
827
+ });
828
+ };
829
+ }();
830
+ return doValidate();
831
+ };
832
+ /**
833
+ * @desc 清除验证状态
834
+ */
835
+ var clearValidate = function clearValidate() {
836
+ state.isError = false;
837
+ state.errorMessage = '';
838
+ };
839
+ (0,external_vue_namespaceObject.provide)(external_shared_namespaceObject.formItemKey, form_item_objectSpread(form_item_objectSpread({}, props), {}, {
840
+ validate: validate,
841
+ clearValidate: clearValidate
842
+ }));
843
+ (0,external_vue_namespaceObject.onMounted)(function () {
844
+ if (isForm) {
845
+ form.register(currentInstance.proxy);
846
+ }
847
+ });
848
+ (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
849
+ if (isForm) {
850
+ form.unregister(currentInstance.proxy);
851
+ }
852
+ });
853
+ var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
854
+ resolveClassName = _usePrefix.resolveClassName;
855
+ return form_item_objectSpread(form_item_objectSpread({}, (0,external_vue_namespaceObject.toRefs)(state)), {}, {
856
+ isShowLabel: isShowLabel,
857
+ labelStyles: labelStyles,
858
+ contentStyles: contentStyles,
859
+ isFormTypeVertical: isFormTypeVertical,
860
+ validate: validate,
861
+ clearValidate: clearValidate,
862
+ resolveClassName: resolveClassName
863
+ });
864
+ },
865
+ render: function render() {
866
+ var _classes,
867
+ _this = this,
868
+ _this$$slots$labelApp,
869
+ _this$$slots,
870
+ _this$$slots$default,
871
+ _this$$slots2;
872
+ var itemClassees = (0,external_shared_namespaceObject.classes)((_classes = {}, _defineProperty(_classes, "".concat(this.resolveClassName('form-item')), true), _defineProperty(_classes, 'is-error', this.isError), _defineProperty(_classes, 'is-required', this.required), _classes));
873
+ var renderLabel = function renderLabel() {
874
+ if (_this.$slots.label) {
875
+ return (0,external_vue_namespaceObject.createVNode)("span", null, [_this.$slots.label()]);
876
+ }
877
+ if (_this.description) {
878
+ return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("span", {
879
+ "class": _defineProperty({}, "".concat(_this.resolveClassName('form-label-description')), Boolean(_this.description))
880
+ }, [_this.label]), [[(0,external_vue_namespaceObject.resolveDirective)("bk-tooltips"), _this.description]]);
881
+ }
882
+ return (0,external_vue_namespaceObject.createVNode)("span", null, [_this.label]);
883
+ };
884
+ var renderError = function renderError() {
885
+ if (!_this.isError) {
886
+ return null;
887
+ }
888
+ if (_this.errorDisplayType === 'tooltips') {
889
+ return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("div", {
890
+ "class": "".concat(_this.resolveClassName('form-error-tips'))
891
+ }, [(0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.ExclamationCircleShape, null, null)]), [[(0,external_vue_namespaceObject.resolveDirective)("bk-tooltips"), _this.errorMessage]]);
892
+ }
893
+ return (0,external_vue_namespaceObject.createVNode)("div", {
894
+ "class": "".concat(_this.resolveClassName('form-error'))
895
+ }, [_this.$slots.error ? _this.$slots.error(_this.errorMessage) : _this.errorMessage]);
896
+ };
897
+ return (0,external_vue_namespaceObject.createVNode)("div", {
898
+ "class": itemClassees
899
+ }, [this.isShowLabel && (0,external_vue_namespaceObject.createVNode)("div", {
900
+ "class": "".concat(this.resolveClassName('form-label')),
901
+ "style": this.labelStyles
902
+ }, [renderLabel(), this.isFormTypeVertical && ((_this$$slots$labelApp = (_this$$slots = this.$slots).labelAppend) === null || _this$$slots$labelApp === void 0 ? void 0 : _this$$slots$labelApp.call(_this$$slots))]), (0,external_vue_namespaceObject.createVNode)("div", {
903
+ "class": "".concat(this.resolveClassName('form-content')),
904
+ "style": this.contentStyles
905
+ }, [(_this$$slots$default = (_this$$slots2 = this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots2), renderError()])]);
906
+ }
907
+ }));
908
+ ;// CONCATENATED MODULE: ../../packages/form/src/index.ts
909
+ /*
910
+ * Tencent is pleased to support the open source community by making
911
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
912
+ *
913
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
914
+ *
915
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
916
+ *
917
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
918
+ *
919
+ * ---------------------------------------------------
920
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
921
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
922
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
923
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
924
+ *
925
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
926
+ * the Software.
927
+ *
928
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
929
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
930
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
931
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
932
+ * IN THE SOFTWARE.
933
+ */
934
+
935
+
936
+
937
+
938
+
939
+ var BkForm = (0,external_shared_namespaceObject.withInstallProps)(src_form, {
940
+ FormItem: form_item,
941
+ ComposeFormItem: compose_form_item
942
+ });
943
+ /* harmony default export */ const src = (BkForm);
944
+
945
+ var __webpack_exports__BkComposeFormItem = __webpack_exports__.kq;
946
+ var __webpack_exports__BkForm = __webpack_exports__.ZD;
947
+ var __webpack_exports__BkFormItem = __webpack_exports__.a_;
948
+ var __webpack_exports__default = __webpack_exports__.ZP;
949
+ var __webpack_exports__formItemKey = __webpack_exports__.xE;
950
+ var __webpack_exports__formKey = __webpack_exports__.vh;
951
+ var __webpack_exports__useFormItem = __webpack_exports__.A9;
952
+ export { __webpack_exports__BkComposeFormItem as BkComposeFormItem, __webpack_exports__BkForm as BkForm, __webpack_exports__BkFormItem as BkFormItem, __webpack_exports__default as default, __webpack_exports__formItemKey as formItemKey, __webpack_exports__formKey as formKey, __webpack_exports__useFormItem as useFormItem };