@veltra/desktop 1.2.10 → 1.2.13

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 (449) hide show
  1. package/dist/components/action/action-group.js.map +1 -1
  2. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js +2 -2
  3. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/components/action/action.js +2 -2
  5. package/dist/components/action/action.js.map +1 -1
  6. package/dist/components/auto-complete/auto-complete.js +4 -4
  7. package/dist/components/auto-complete/auto-complete.js.map +1 -1
  8. package/dist/components/auto-complete/use-keyboard.js.map +1 -1
  9. package/dist/components/badge/badge.js +2 -2
  10. package/dist/components/badge/badge.js.map +1 -1
  11. package/dist/components/batch-edit/batch-edit-form.js +2 -2
  12. package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
  13. package/dist/components/batch-edit/batch-edit-list.js +2 -2
  14. package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
  15. package/dist/components/batch-edit/batch-edit.js +2 -2
  16. package/dist/components/batch-edit/batch-edit.js.map +1 -1
  17. package/dist/components/batch-edit/use-edit-state.js.map +1 -1
  18. package/dist/components/batch-edit/use-features.js.map +1 -1
  19. package/dist/components/batch-edit/use-handlers.js.map +1 -1
  20. package/dist/components/breadcrumb/breadcrumb.js +2 -2
  21. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  22. package/dist/components/button/button-group.js +2 -2
  23. package/dist/components/button/button-group.js.map +1 -1
  24. package/dist/components/button/button.js +2 -2
  25. package/dist/components/button/button.js.map +1 -1
  26. package/dist/components/calendar/calendar.js +3 -3
  27. package/dist/components/calendar/calendar.js.map +1 -1
  28. package/dist/components/calendar/utils.js.map +1 -1
  29. package/dist/components/card/card-action.js +2 -2
  30. package/dist/components/card/card-action.js.map +1 -1
  31. package/dist/components/card/card-content.js +2 -2
  32. package/dist/components/card/card-content.js.map +1 -1
  33. package/dist/components/card/card-cover.js +2 -2
  34. package/dist/components/card/card-cover.js.map +1 -1
  35. package/dist/components/card/card-header.js +2 -2
  36. package/dist/components/card/card-header.js.map +1 -1
  37. package/dist/components/card/card.js +2 -2
  38. package/dist/components/card/card.js.map +1 -1
  39. package/dist/components/cascade/cascade-panel-item.js +1 -1
  40. package/dist/components/cascade/cascade-panel-item.js.map +1 -1
  41. package/dist/components/cascade/cascade.js +7 -3
  42. package/dist/components/cascade/cascade.js.map +1 -1
  43. package/dist/components/cascade/cascade.vue.d.ts +8 -5
  44. package/dist/components/cascade/use-check.js +3 -1
  45. package/dist/components/cascade/use-check.js.map +1 -1
  46. package/dist/components/cascade/use-data-map.js.map +1 -1
  47. package/dist/components/cascade/use-select.js +30 -14
  48. package/dist/components/cascade/use-select.js.map +1 -1
  49. package/dist/components/check-tag/check-tag.js +2 -2
  50. package/dist/components/check-tag/check-tag.js.map +1 -1
  51. package/dist/components/checkbox/checkbox-button.js +4 -4
  52. package/dist/components/checkbox/checkbox-button.js.map +1 -1
  53. package/dist/components/checkbox/checkbox.js +4 -4
  54. package/dist/components/checkbox/checkbox.js.map +1 -1
  55. package/dist/components/checkbox-group/checkbox-group.js +4 -4
  56. package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
  57. package/dist/components/code-editor/basic-setup.js +44 -0
  58. package/dist/components/code-editor/basic-setup.js.map +1 -0
  59. package/dist/components/code-editor/code-editor.js +5 -5
  60. package/dist/components/code-editor/code-editor.js.map +1 -1
  61. package/dist/components/collapse/collapse-item.js +2 -2
  62. package/dist/components/collapse/collapse-item.js.map +1 -1
  63. package/dist/components/collapse/collapse.js +2 -2
  64. package/dist/components/collapse/collapse.js.map +1 -1
  65. package/dist/components/condition-editor/components/condition-group.js +2 -2
  66. package/dist/components/condition-editor/components/condition-group.js.map +1 -1
  67. package/dist/components/condition-editor/components/condition-row.js +2 -2
  68. package/dist/components/condition-editor/components/condition-row.js.map +1 -1
  69. package/dist/components/condition-editor/condition-editor.js +2 -2
  70. package/dist/components/condition-editor/condition-editor.js.map +1 -1
  71. package/dist/components/condition-editor/core/evaluator.js.map +1 -1
  72. package/dist/components/contextmenu/contextmenu-item.js +2 -2
  73. package/dist/components/contextmenu/contextmenu-item.js.map +1 -1
  74. package/dist/components/contextmenu/contextmenu-panel.js +2 -2
  75. package/dist/components/contextmenu/contextmenu-panel.js.map +1 -1
  76. package/dist/components/contextmenu/contextmenu-sub.js +2 -2
  77. package/dist/components/contextmenu/contextmenu-sub.js.map +1 -1
  78. package/dist/components/contextmenu/contextmenu.js +2 -2
  79. package/dist/components/contextmenu/contextmenu.js.map +1 -1
  80. package/dist/components/date-panel/date-panel.js +2 -2
  81. package/dist/components/date-panel/date-panel.js.map +1 -1
  82. package/dist/components/date-panel/headers/day.js +2 -2
  83. package/dist/components/date-panel/headers/day.js.map +1 -1
  84. package/dist/components/date-panel/headers/month.js +2 -2
  85. package/dist/components/date-panel/headers/month.js.map +1 -1
  86. package/dist/components/date-panel/headers/year.js +2 -2
  87. package/dist/components/date-panel/headers/year.js.map +1 -1
  88. package/dist/components/date-panel/panels/day.js +2 -2
  89. package/dist/components/date-panel/panels/day.js.map +1 -1
  90. package/dist/components/date-panel/panels/month.js +2 -2
  91. package/dist/components/date-panel/panels/month.js.map +1 -1
  92. package/dist/components/date-panel/panels/year.js +2 -2
  93. package/dist/components/date-panel/panels/year.js.map +1 -1
  94. package/dist/components/date-panel/use-panel-date.js.map +1 -1
  95. package/dist/components/date-picker/date-picker.js +2 -2
  96. package/dist/components/date-picker/date-picker.js.map +1 -1
  97. package/dist/components/date-range-picker/date-range-picker.js +2 -2
  98. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  99. package/dist/components/dialog/dialog.js +4 -4
  100. package/dist/components/dialog/dialog.js.map +1 -1
  101. package/dist/components/drawer/drawer.js +4 -4
  102. package/dist/components/drawer/drawer.js.map +1 -1
  103. package/dist/components/dropdown/dropdown.js +2 -2
  104. package/dist/components/dropdown/dropdown.js.map +1 -1
  105. package/dist/components/dual-nav/dual-nav-app.js +2 -2
  106. package/dist/components/dual-nav/dual-nav-app.js.map +1 -1
  107. package/dist/components/dual-nav/dual-nav.js +2 -2
  108. package/dist/components/dual-nav/dual-nav.js.map +1 -1
  109. package/dist/components/empty/empty.js +2 -2
  110. package/dist/components/empty/empty.js.map +1 -1
  111. package/dist/components/expression-editor/components/path-preview.js +2 -2
  112. package/dist/components/expression-editor/components/path-preview.js.map +1 -1
  113. package/dist/components/expression-editor/components/variable-picker.js +2 -2
  114. package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
  115. package/dist/components/expression-editor/core/editor.js.map +1 -1
  116. package/dist/components/expression-editor/core/model.js.map +1 -1
  117. package/dist/components/expression-editor/expression-editor.js +2 -2
  118. package/dist/components/expression-editor/expression-editor.js.map +1 -1
  119. package/dist/components/file-picker/file-picker.js +2 -2
  120. package/dist/components/file-picker/file-picker.js.map +1 -1
  121. package/dist/components/file-picker/helper.js.map +1 -1
  122. package/dist/components/file-viewer/file-viewer.js +4 -4
  123. package/dist/components/file-viewer/file-viewer.js.map +1 -1
  124. package/dist/components/file-viewer/helper.js.map +1 -1
  125. package/dist/components/file-viewer/previewers/docx-previewer.js +2 -2
  126. package/dist/components/file-viewer/previewers/docx-previewer.js.map +1 -1
  127. package/dist/components/file-viewer/previewers/image-previewer.js +2 -2
  128. package/dist/components/file-viewer/previewers/image-previewer.js.map +1 -1
  129. package/dist/components/file-viewer/previewers/pdf-previewer.js +2 -2
  130. package/dist/components/file-viewer/previewers/pdf-previewer.js.map +1 -1
  131. package/dist/components/file-viewer/previewers/pdf-viewport-scroll.js +2 -2
  132. package/dist/components/file-viewer/previewers/pdf-viewport-scroll.js.map +1 -1
  133. package/dist/components/file-viewer/previewers/pdf-zoom-bridge.js +2 -2
  134. package/dist/components/file-viewer/previewers/pdf-zoom-bridge.js.map +1 -1
  135. package/dist/components/file-viewer/previewers/sheet-previewer.js +2 -2
  136. package/dist/components/file-viewer/previewers/sheet-previewer.js.map +1 -1
  137. package/dist/components/file-viewer/previewers/text-previewer.js +2 -2
  138. package/dist/components/file-viewer/previewers/text-previewer.js.map +1 -1
  139. package/dist/components/file-viewer/previewers/video-previewer.js +2 -2
  140. package/dist/components/file-viewer/previewers/video-previewer.js.map +1 -1
  141. package/dist/components/file-viewer/sheet-parser.js.map +1 -1
  142. package/dist/components/float-button/float-button.js +2 -2
  143. package/dist/components/float-button/float-button.js.map +1 -1
  144. package/dist/components/form/form.js.map +1 -1
  145. package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js +1 -1
  146. package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js.map +1 -1
  147. package/dist/components/form/use-form-fields.js.map +1 -1
  148. package/dist/components/form/use-node-interceptor.js +1 -1
  149. package/dist/components/form/use-node-interceptor.js.map +1 -1
  150. package/dist/components/form-item/form-item.js.map +1 -1
  151. package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js +1 -1
  152. package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  153. package/dist/components/form-item/validate.js.map +1 -1
  154. package/dist/components/gantt-chart/gantt-chart.js +2 -2
  155. package/dist/components/gantt-chart/gantt-chart.js.map +1 -1
  156. package/dist/components/grid/breakpoint.js.map +1 -1
  157. package/dist/components/grid/grid-item.js +2 -2
  158. package/dist/components/grid/grid-item.js.map +1 -1
  159. package/dist/components/grid/grid.js +2 -2
  160. package/dist/components/grid/grid.js.map +1 -1
  161. package/dist/components/grid-input/grid-input.js +2 -2
  162. package/dist/components/grid-input/grid-input.js.map +1 -1
  163. package/dist/components/grid-input/grid-input.vue.d.ts +1 -1
  164. package/dist/components/group-input/group-input.js +2 -2
  165. package/dist/components/group-input/group-input.js.map +1 -1
  166. package/dist/components/icon/icon.js +2 -2
  167. package/dist/components/icon/icon.js.map +1 -1
  168. package/dist/components/input/input.js.map +1 -1
  169. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +1 -1
  170. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  171. package/dist/components/kbd/kbd.js +2 -2
  172. package/dist/components/kbd/kbd.js.map +1 -1
  173. package/dist/components/layout/layout-resizer.js +2 -2
  174. package/dist/components/layout/layout-resizer.js.map +1 -1
  175. package/dist/components/layout/layout.js +2 -2
  176. package/dist/components/layout/layout.js.map +1 -1
  177. package/dist/components/list/list-item.js +2 -2
  178. package/dist/components/list/list-item.js.map +1 -1
  179. package/dist/components/list/list.js +2 -2
  180. package/dist/components/list/list.js.map +1 -1
  181. package/dist/components/loading/directive.js.map +1 -1
  182. package/dist/components/loading/loading.js +2 -2
  183. package/dist/components/loading/loading.js.map +1 -1
  184. package/dist/components/message/message-box.js +2 -2
  185. package/dist/components/message/message-box.js.map +1 -1
  186. package/dist/components/message/message.js +2 -2
  187. package/dist/components/message/message.js.map +1 -1
  188. package/dist/components/message/message2.js.map +1 -1
  189. package/dist/components/message-confirm/message-confirm.js +2 -2
  190. package/dist/components/message-confirm/message-confirm.js.map +1 -1
  191. package/dist/components/multi-select/multi-select-option.js +2 -2
  192. package/dist/components/multi-select/multi-select-option.js.map +1 -1
  193. package/dist/components/multi-select/multi-select.js +4 -4
  194. package/dist/components/multi-select/multi-select.js.map +1 -1
  195. package/dist/components/multi-tree-select/multi-tree-select.js +4 -4
  196. package/dist/components/multi-tree-select/multi-tree-select.js.map +1 -1
  197. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +1 -1
  198. package/dist/components/nav/nav-icon.js +2 -2
  199. package/dist/components/nav/nav-icon.js.map +1 -1
  200. package/dist/components/nav/nav-item-collapsed.js +2 -2
  201. package/dist/components/nav/nav-item-collapsed.js.map +1 -1
  202. package/dist/components/nav/nav-item.js +2 -2
  203. package/dist/components/nav/nav-item.js.map +1 -1
  204. package/dist/components/nav/nav-sub-collapsed.js +2 -2
  205. package/dist/components/nav/nav-sub-collapsed.js.map +1 -1
  206. package/dist/components/nav/nav-sub.js +2 -2
  207. package/dist/components/nav/nav-sub.js.map +1 -1
  208. package/dist/components/nav/nav.js +2 -2
  209. package/dist/components/nav/nav.js.map +1 -1
  210. package/dist/components/notification/index.js.map +1 -1
  211. package/dist/components/notification/notification.js +2 -2
  212. package/dist/components/notification/notification.js.map +1 -1
  213. package/dist/components/number/number.js +2 -2
  214. package/dist/components/number/number.js.map +1 -1
  215. package/dist/components/number-input/number-input.js +4 -4
  216. package/dist/components/number-input/number-input.js.map +1 -1
  217. package/dist/components/number-range-input/number-range-input.js +4 -4
  218. package/dist/components/number-range-input/number-range-input.js.map +1 -1
  219. package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
  220. package/dist/components/paginator/paginator.js +4 -4
  221. package/dist/components/paginator/paginator.js.map +1 -1
  222. package/dist/components/palette/color-transform.js.map +1 -1
  223. package/dist/components/palette/palette-alpha.js +2 -2
  224. package/dist/components/palette/palette-alpha.js.map +1 -1
  225. package/dist/components/palette/palette-color-switch.js +1 -1
  226. package/dist/components/palette/palette-color-switch.js.map +1 -1
  227. package/dist/components/palette/palette-hue.js +2 -2
  228. package/dist/components/palette/palette-hue.js.map +1 -1
  229. package/dist/components/palette/palette-sv.js +2 -2
  230. package/dist/components/palette/palette-sv.js.map +1 -1
  231. package/dist/components/palette/palette.js +3 -3
  232. package/dist/components/palette/palette.js.map +1 -1
  233. package/dist/components/palette/use-hsv.js.map +1 -1
  234. package/dist/components/password-input/password-input.js +3 -3
  235. package/dist/components/password-input/password-input.js.map +1 -1
  236. package/dist/components/pop-confirm/pop-confirm.js +2 -2
  237. package/dist/components/pop-confirm/pop-confirm.js.map +1 -1
  238. package/dist/components/progress/progress.js +2 -2
  239. package/dist/components/progress/progress.js.map +1 -1
  240. package/dist/components/progress-nodes/progress-nodes.js +2 -2
  241. package/dist/components/progress-nodes/progress-nodes.js.map +1 -1
  242. package/dist/components/progress-nodes/progress-nodes.vue.d.ts +1 -1
  243. package/dist/components/radio/radio.js +4 -4
  244. package/dist/components/radio/radio.js.map +1 -1
  245. package/dist/components/radio-group/radio-group.js +4 -4
  246. package/dist/components/radio-group/radio-group.js.map +1 -1
  247. package/dist/components/rich-text-editor/rich-text-editor.js +2 -2
  248. package/dist/components/rich-text-editor/rich-text-editor.js.map +1 -1
  249. package/dist/components/rich-text-editor/toolbar.js +1 -1
  250. package/dist/components/rich-text-editor/toolbar.js.map +1 -1
  251. package/dist/components/scroll/scroll-bar.js +2 -2
  252. package/dist/components/scroll/scroll-bar.js.map +1 -1
  253. package/dist/components/scroll/scroll.js +2 -2
  254. package/dist/components/scroll/scroll.js.map +1 -1
  255. package/dist/components/select/select.js +4 -4
  256. package/dist/components/select/select.js.map +1 -1
  257. package/dist/components/select/use-keyboard.js.map +1 -1
  258. package/dist/components/select/use-options.js.map +1 -1
  259. package/dist/components/slider/slider-thumb.js +1 -1
  260. package/dist/components/slider/slider-thumb.js.map +1 -1
  261. package/dist/components/slider/slider.js +2 -2
  262. package/dist/components/slider/slider.js.map +1 -1
  263. package/dist/components/steps/steps.js +2 -2
  264. package/dist/components/steps/steps.js.map +1 -1
  265. package/dist/components/steps/steps.vue.d.ts +2 -2
  266. package/dist/components/switch/switch.js +4 -4
  267. package/dist/components/switch/switch.js.map +1 -1
  268. package/dist/components/table/table-body.js +2 -2
  269. package/dist/components/table/table-body.js.map +1 -1
  270. package/dist/components/table/table-cell.js +2 -2
  271. package/dist/components/table/table-cell.js.map +1 -1
  272. package/dist/components/table/table-foot.js +2 -2
  273. package/dist/components/table/table-foot.js.map +1 -1
  274. package/dist/components/table/table-head.js.map +1 -1
  275. package/dist/components/table/table-row.js.map +1 -1
  276. package/dist/components/table/table.js +2 -2
  277. package/dist/components/table/table.js.map +1 -1
  278. package/dist/components/table/use-check.js.map +1 -1
  279. package/dist/components/table/use-col-resize.js.map +1 -1
  280. package/dist/components/table/use-columns.js.map +1 -1
  281. package/dist/components/table/use-rows.js.map +1 -1
  282. package/dist/components/table/use-table.js.map +1 -1
  283. package/dist/components/table-editor/table-editor.js +2 -2
  284. package/dist/components/table-editor/table-editor.js.map +1 -1
  285. package/dist/components/tabs/tabs-horizontal.js +4 -4
  286. package/dist/components/tabs/tabs-horizontal.js.map +1 -1
  287. package/dist/components/tabs/tabs-horizontal.vue.d.ts +3 -3
  288. package/dist/components/tabs/tabs-vertical.js +4 -4
  289. package/dist/components/tabs/tabs-vertical.js.map +1 -1
  290. package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
  291. package/dist/components/tabs/tabs.js +4 -4
  292. package/dist/components/tabs/tabs.js.map +1 -1
  293. package/dist/components/tabs/tabs.vue.d.ts +3 -3
  294. package/dist/components/tag/tag.js +2 -2
  295. package/dist/components/tag/tag.js.map +1 -1
  296. package/dist/components/text/text.js +2 -2
  297. package/dist/components/text/text.js.map +1 -1
  298. package/dist/components/textarea/textarea.js +4 -4
  299. package/dist/components/textarea/textarea.js.map +1 -1
  300. package/dist/components/theme/theme.js +1 -1
  301. package/dist/components/theme/theme.js.map +1 -1
  302. package/dist/components/tip/tip.js +2 -2
  303. package/dist/components/tip/tip.js.map +1 -1
  304. package/dist/components/tip/use-nest.js.map +1 -1
  305. package/dist/components/tree/tree-node.js +2 -2
  306. package/dist/components/tree/tree-node.js.map +1 -1
  307. package/dist/components/tree/tree-node2.js.map +1 -1
  308. package/dist/components/tree/tree.js +2 -2
  309. package/dist/components/tree/tree.js.map +1 -1
  310. package/dist/components/tree/tree.vue.d.ts +1 -1
  311. package/dist/components/tree/use-check.js.map +1 -1
  312. package/dist/components/tree-select/tree-select.js +7 -6
  313. package/dist/components/tree-select/tree-select.js.map +1 -1
  314. package/dist/components/tree-select/tree-select.vue.d.ts +5 -4
  315. package/dist/components/watermark/watermark.js +2 -2
  316. package/dist/components/watermark/watermark.js.map +1 -1
  317. package/dist/types/cascade.d.ts +10 -6
  318. package/dist/types/tree-select.d.ts +2 -1
  319. package/package.json +24 -23
  320. package/src/components/action/action-group.vue +2 -2
  321. package/src/components/action/action.vue +1 -1
  322. package/src/components/auto-complete/auto-complete.vue +1 -1
  323. package/src/components/badge/badge.vue +1 -1
  324. package/src/components/batch-edit/batch-edit-form.vue +1 -1
  325. package/src/components/batch-edit/batch-edit-list.vue +1 -1
  326. package/src/components/batch-edit/batch-edit.vue +1 -1
  327. package/src/components/breadcrumb/breadcrumb.vue +1 -1
  328. package/src/components/button/button-group.vue +1 -1
  329. package/src/components/button/button.vue +1 -1
  330. package/src/components/calendar/calendar.vue +1 -1
  331. package/src/components/card/card-action.vue +1 -1
  332. package/src/components/card/card-content.vue +1 -1
  333. package/src/components/card/card-cover.vue +1 -1
  334. package/src/components/card/card-header.vue +1 -1
  335. package/src/components/card/card.vue +1 -1
  336. package/src/components/cascade/cascade.vue +3 -2
  337. package/src/components/cascade/use-check.ts +3 -1
  338. package/src/components/cascade/use-select.ts +43 -29
  339. package/src/components/check-tag/check-tag.vue +1 -1
  340. package/src/components/checkbox/checkbox-button.vue +1 -1
  341. package/src/components/checkbox/checkbox.vue +1 -1
  342. package/src/components/checkbox-group/checkbox-group.vue +1 -1
  343. package/src/components/code-editor/basic-setup.ts +63 -0
  344. package/src/components/code-editor/code-editor.vue +3 -3
  345. package/src/components/collapse/collapse-item.vue +1 -1
  346. package/src/components/collapse/collapse.vue +1 -1
  347. package/src/components/condition-editor/components/condition-group.vue +1 -1
  348. package/src/components/condition-editor/components/condition-row.vue +1 -1
  349. package/src/components/condition-editor/condition-editor.vue +1 -1
  350. package/src/components/contextmenu/contextmenu-item.vue +1 -1
  351. package/src/components/contextmenu/contextmenu-panel.vue +1 -1
  352. package/src/components/contextmenu/contextmenu-sub.vue +1 -1
  353. package/src/components/contextmenu/contextmenu.vue +1 -1
  354. package/src/components/date-panel/date-panel.vue +1 -1
  355. package/src/components/date-panel/headers/day.vue +1 -1
  356. package/src/components/date-panel/headers/month.vue +1 -1
  357. package/src/components/date-panel/headers/year.vue +1 -1
  358. package/src/components/date-panel/panels/day.vue +1 -1
  359. package/src/components/date-panel/panels/month.vue +1 -1
  360. package/src/components/date-panel/panels/year.vue +1 -1
  361. package/src/components/date-picker/date-picker.vue +1 -1
  362. package/src/components/date-range-picker/date-range-picker.vue +1 -1
  363. package/src/components/dialog/dialog.vue +1 -1
  364. package/src/components/drawer/drawer.vue +1 -1
  365. package/src/components/dropdown/dropdown.vue +1 -1
  366. package/src/components/dual-nav/dual-nav-app.vue +1 -1
  367. package/src/components/dual-nav/dual-nav.vue +1 -1
  368. package/src/components/empty/empty.vue +1 -1
  369. package/src/components/expression-editor/components/path-preview.vue +1 -1
  370. package/src/components/expression-editor/components/variable-picker.vue +1 -1
  371. package/src/components/expression-editor/expression-editor.vue +1 -1
  372. package/src/components/file-picker/file-picker.vue +1 -1
  373. package/src/components/file-viewer/file-viewer.vue +1 -1
  374. package/src/components/file-viewer/previewers/docx-previewer.vue +1 -1
  375. package/src/components/file-viewer/previewers/image-previewer.vue +1 -1
  376. package/src/components/file-viewer/previewers/pdf-previewer.vue +1 -1
  377. package/src/components/file-viewer/previewers/pdf-viewport-scroll.vue +1 -1
  378. package/src/components/file-viewer/previewers/pdf-zoom-bridge.vue +1 -1
  379. package/src/components/file-viewer/previewers/sheet-previewer.vue +1 -1
  380. package/src/components/file-viewer/previewers/text-previewer.vue +1 -1
  381. package/src/components/file-viewer/previewers/video-previewer.vue +1 -1
  382. package/src/components/float-button/float-button.vue +1 -1
  383. package/src/components/form/form.vue +1 -1
  384. package/src/components/form/use-node-interceptor.ts +2 -1
  385. package/src/components/form-item/form-item.vue +1 -1
  386. package/src/components/gantt-chart/gantt-chart.vue +1 -1
  387. package/src/components/grid/grid-item.vue +1 -1
  388. package/src/components/grid/grid.vue +1 -1
  389. package/src/components/grid-input/grid-input.vue +1 -1
  390. package/src/components/group-input/group-input.vue +1 -1
  391. package/src/components/icon/icon.vue +1 -1
  392. package/src/components/input/input.vue +1 -1
  393. package/src/components/kbd/kbd.vue +1 -1
  394. package/src/components/layout/layout-resizer.vue +1 -1
  395. package/src/components/layout/layout.vue +1 -1
  396. package/src/components/list/list-item.vue +1 -1
  397. package/src/components/list/list.vue +1 -1
  398. package/src/components/loading/loading.vue +1 -1
  399. package/src/components/message/message-box.vue +1 -1
  400. package/src/components/message/message.vue +1 -1
  401. package/src/components/message-confirm/message-confirm.vue +1 -1
  402. package/src/components/multi-select/multi-select-option.vue +1 -1
  403. package/src/components/multi-select/multi-select.vue +1 -1
  404. package/src/components/multi-tree-select/multi-tree-select.vue +1 -1
  405. package/src/components/nav/nav-icon.vue +1 -1
  406. package/src/components/nav/nav-item-collapsed.vue +1 -1
  407. package/src/components/nav/nav-item.vue +1 -1
  408. package/src/components/nav/nav-sub-collapsed.vue +1 -1
  409. package/src/components/nav/nav-sub.vue +1 -1
  410. package/src/components/nav/nav.vue +1 -1
  411. package/src/components/notification/notification.vue +1 -1
  412. package/src/components/number/number.vue +1 -1
  413. package/src/components/number-input/number-input.vue +1 -1
  414. package/src/components/number-range-input/number-range-input.vue +1 -1
  415. package/src/components/paginator/paginator.vue +1 -1
  416. package/src/components/palette/palette-alpha.vue +1 -1
  417. package/src/components/palette/palette-hue.vue +1 -1
  418. package/src/components/palette/palette-sv.vue +1 -1
  419. package/src/components/palette/palette.vue +1 -1
  420. package/src/components/password-input/password-input.vue +1 -1
  421. package/src/components/pop-confirm/pop-confirm.vue +1 -1
  422. package/src/components/progress/progress.vue +1 -1
  423. package/src/components/progress-nodes/progress-nodes.vue +1 -1
  424. package/src/components/radio/radio.vue +1 -1
  425. package/src/components/radio-group/radio-group.vue +1 -1
  426. package/src/components/scroll/scroll-bar.vue +1 -1
  427. package/src/components/scroll/scroll.vue +1 -1
  428. package/src/components/select/select.vue +1 -1
  429. package/src/components/slider/slider.vue +1 -1
  430. package/src/components/steps/steps.vue +1 -1
  431. package/src/components/switch/switch.vue +1 -1
  432. package/src/components/table/table-body.vue +1 -1
  433. package/src/components/table/table-cell.vue +1 -1
  434. package/src/components/table/table-foot.vue +1 -1
  435. package/src/components/table/table.vue +1 -1
  436. package/src/components/table-editor/table-editor.vue +1 -1
  437. package/src/components/tabs/tabs-horizontal.vue +1 -1
  438. package/src/components/tabs/tabs-vertical.vue +1 -1
  439. package/src/components/tabs/tabs.vue +1 -1
  440. package/src/components/tag/tag.vue +1 -1
  441. package/src/components/text/text.vue +1 -1
  442. package/src/components/textarea/textarea.vue +1 -1
  443. package/src/components/tip/tip.vue +1 -1
  444. package/src/components/tree/tree-node.vue +1 -1
  445. package/src/components/tree/tree.vue +1 -1
  446. package/src/components/tree-select/tree-select.vue +3 -3
  447. package/src/components/watermark/watermark.vue +1 -1
  448. package/src/types/cascade.ts +10 -6
  449. package/src/types/tree-select.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"form.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/form/form.vue"],"sourcesContent":["<template>\n <u-grid\n tag=\"form\"\n ref=\"grid\"\n @submit.prevent\n :cols=\"cols || breakpointCols\"\n :class=\"[cls.b, bem.is('readonly', readonly)]\"\n >\n <template\n v-for=\"{ node, isFormItem, formItemProps, field, modelValue } of getSlotsNodes()\"\n :key=\"node.key\"\n >\n <u-form-item v-if=\"!isFormItem && field\" v-bind=\"formItemProps\">\n <component\n :is=\"node\"\n :model-value=\"modelValue ?? o(model ?? {}).get(field)\"\n @update:model-value=\"handleUpdateValue(field, $event)\"\n />\n </u-form-item>\n\n <component v-else :is=\"node\" />\n </template>\n </u-grid>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { o } from '@cat-kit/core'\nimport { bem } from '@veltra/utils'\nimport { provideFormContext } from '@veltra/utils'\nimport { nextTick, toRef, useTemplateRef } from 'vue'\n\nimport type { BreakCols, FormProps, _FormExposed, FormEmits } from '../../types'\nimport { UFormItem } from '../form-item'\nimport { UGrid } from '../grid'\nimport { useFormFields } from './use-form-fields'\nimport { useNodeInterceptor } from './use-node-interceptor'\n\ndefineOptions({ name: 'Form' })\n\nconst props = defineProps<FormProps>()\n\nconst emit = defineEmits<FormEmits>()\n\ndefineSlots<{ default(props?: { data: Record<string, any> | undefined }): any }>()\n\nconst cls = bem('form')\nconst formItemCls = bem('form-item')\nconst gridRef = useTemplateRef('grid')\n\nconst breakpointCols: BreakCols = { xs: 1, md: 2, lg: 3, xl: 4, default: 4 }\n\nconst {\n validate: runValidate,\n clearValidate,\n reset,\n registerField,\n unregisterField,\n shouldValidate\n} = useFormFields({ props })\n\nasync function validate(keys?: string[]) {\n const valid = await runValidate(keys)\n if (!valid) {\n await nextTick()\n\n gridRef.value?.el\n ?.querySelector(`.${formItemCls.e('error-text')}`)\n ?.scrollIntoView({ block: 'center' })\n }\n return valid\n}\n\nfunction handleFieldChange(field: string, value: any) {\n emit('field:change', field, value)\n}\n\nprovideFormContext({\n formProps: props,\n registerField,\n unregisterField,\n validateFields: validate,\n shouldValidate,\n handleFieldChange\n})\n\nconst { getSlotsNodes } = useNodeInterceptor()\n\nfunction handleUpdateValue(field: string, value: any) {\n if (!props.model) return\n o(props.model).set(field, value)\n}\n\ndefineExpose<_FormExposed>({ el: toRef(() => gridRef.value?.el), validate, clearValidate, reset })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAIb,MAAM,MAAM,IAAI,MAAM;EACtB,MAAM,cAAc,IAAI,WAAW;EACnC,MAAM,UAAU,eAAe,MAAM;EAErC,MAAM,iBAA4B;GAAE,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,IAAI;GAAG,SAAS;EAAE;EAE3E,MAAM,EACJ,UAAU,aACV,eACA,OACA,eACA,iBACA,mBACE,cAAc,EAAE,MAAM,CAAC;EAE3B,eAAe,SAAS,MAAiB;GACvC,MAAM,QAAQ,MAAM,YAAY,IAAI;GACpC,IAAI,CAAC,OAAO;IACV,MAAM,SAAS;IAEf,QAAQ,OAAO,IACX,cAAc,IAAI,YAAY,EAAE,YAAY,GAAG,GAC/C,eAAe,EAAE,OAAO,SAAS,CAAC;GACxC;GACA,OAAO;EACT;EAEA,SAAS,kBAAkB,OAAe,OAAY;GACpD,KAAK,gBAAgB,OAAO,KAAK;EACnC;EAEA,mBAAmB;GACjB,WAAW;GACX;GACA;GACA,gBAAgB;GAChB;GACA;EACF,CAAC;EAED,MAAM,EAAE,kBAAkB,mBAAmB;EAE7C,SAAS,kBAAkB,OAAe,OAAY;GACpD,IAAI,CAAC,MAAM,OAAO;GAClB,EAAE,MAAM,KAAK,EAAE,IAAI,OAAO,KAAK;EACjC;EAEA,SAA2B;GAAE,IAAI,YAAY,QAAQ,OAAO,EAAE;GAAG;GAAU;GAAe;EAAM,CAAC;;uBA3F/F,YAqBS,MAAA,SAAA,GAAA;IApBP,KAAI;IACJ,KAAI;IACH,UAAM,OAAA,OAAA,OAAA,KAAA,oBAAP,CAAA,GAAe,CAAA,SAAA,CAAA;IACd,MAAM,QAAA,QAAQ;IACd,OAAK,eAAA,CAAG,MAAA,GAAA,EAAI,GAAG,MAAA,GAAA,EAAI,GAAE,YAAa,QAAA,QAAQ,CAAA,CAAA;;2BAGwC,EAAA,UAAA,IAAA,GADnF,mBAaW,UAAA,MAAA,WAZwD,MAAA,aAAA,EAAa,IAAA,EAArE,MAAM,YAAY,eAAe,OAAO,iBAAU;6DACrD,KAAK,IAAA,GAAA,CAAA,CAES,cAAc,SAAA,UAAA,GAAlC,YAMc,MAAA,iBAAA,GANd,WAMc;;;QANmC,aAAa,GAAA;6BAK1D,EAAA,UAAA,GAJF,YAIE,wBAHK,IAAI,GAAA;OACR,eAAa,cAAc,MAAA,CAAA,EAAE,QAAA,SAAK,CAAA,CAAA,EAAQ,IAAI,KAAK;OACnD,wBAAkB,WAAE,kBAAkB,OAAO,MAAM;;;+BAIxD,YAA+B,wBAAR,IAAI,GAAA,EAAA,KAAA,EAAA,CAAA,EAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"form.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/form/form.vue"],"sourcesContent":["<template>\n <u-grid\n tag=\"form\"\n ref=\"grid\"\n @submit.prevent\n :cols=\"cols || breakpointCols\"\n :class=\"[cls.b, bem.is('readonly', readonly)]\"\n >\n <template\n v-for=\"{ node, isFormItem, formItemProps, field, modelValue } of getSlotsNodes()\"\n :key=\"node.key\"\n >\n <u-form-item v-if=\"!isFormItem && field\" v-bind=\"formItemProps\">\n <component\n :is=\"node\"\n :model-value=\"modelValue ?? o(model ?? {}).get(field)\"\n @update:model-value=\"handleUpdateValue(field, $event)\"\n />\n </u-form-item>\n\n <component v-else :is=\"node\" />\n </template>\n </u-grid>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { o } from '@cat-kit/core'\nimport { bem } from '@veltra/utils'\nimport { provideFormContext } from '@veltra/utils'\nimport { nextTick, toRef, useTemplateRef } from 'vue'\n\nimport type { BreakCols, FormProps, _FormExposed, FormEmits } from '../../types'\nimport { UFormItem } from '../form-item'\nimport { UGrid } from '../grid'\nimport { useFormFields } from './use-form-fields'\nimport { useNodeInterceptor } from './use-node-interceptor'\n\ndefineOptions({ name: 'UForm' })\n\nconst props = defineProps<FormProps>()\n\nconst emit = defineEmits<FormEmits>()\n\ndefineSlots<{ default(props?: { data: Record<string, any> | undefined }): any }>()\n\nconst cls = bem('form')\nconst formItemCls = bem('form-item')\nconst gridRef = useTemplateRef('grid')\n\nconst breakpointCols: BreakCols = { xs: 1, md: 2, lg: 3, xl: 4, default: 4 }\n\nconst {\n validate: runValidate,\n clearValidate,\n reset,\n registerField,\n unregisterField,\n shouldValidate\n} = useFormFields({ props })\n\nasync function validate(keys?: string[]) {\n const valid = await runValidate(keys)\n if (!valid) {\n await nextTick()\n\n gridRef.value?.el\n ?.querySelector(`.${formItemCls.e('error-text')}`)\n ?.scrollIntoView({ block: 'center' })\n }\n return valid\n}\n\nfunction handleFieldChange(field: string, value: any) {\n emit('field:change', field, value)\n}\n\nprovideFormContext({\n formProps: props,\n registerField,\n unregisterField,\n validateFields: validate,\n shouldValidate,\n handleFieldChange\n})\n\nconst { getSlotsNodes } = useNodeInterceptor()\n\nfunction handleUpdateValue(field: string, value: any) {\n if (!props.model) return\n o(props.model).set(field, value)\n}\n\ndefineExpose<_FormEx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AAa,QAAA,QAAQ,CAAA,CAAA;;2BAGwC,EAAA,UAAA,IAAA,GADnF,mBAaW,UAAA,MAAA,WAZwD,MAAA,aAAA,CAAa,CAAA,IAAA,EAArE,MAAM,YAAY,eAAe,OAAO,iBAAU;6DACrD,KAAK,IAAA,GAAA,CAAA,CAES,cAAc,SAAA,UAAA,GAAlC,YAMc,MAAA,iBAAA,GANd,WAMc;;;QANmC,aAAa,GAAA;6BAK1D,EAAA,UAAA,GAJF,YAIE,wBAHK,IAAI,GAAA;OACR,eAAa,cAAc,MAAA,CAAA,CAAC,CAAC,QAAA,SAAK,CAAA,CAAA,CAAA,CAAQ,IAAI,KAAK;OACnD,wBAAkB,WAAE,kBAAkB,OAAO,MAAM;;;+BAIxD,YAA+B,wBAAR,IAAI,GAAA,EAAA,KAAA,EAAA,CAAA,EAAA,GAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-form-fields.js","names":[],"sources":["../../../src/components/form/use-form-fields.ts"],"sourcesContent":["import { o } from '@cat-kit/core'\nimport type { FormFieldItem } from '@veltra/utils'\nimport { nextTick, watch } from 'vue'\n\nimport type { FormProps } from '../../types/form'\n\ninterface Options {\n props: FormProps\n}\n\n/** 深拷贝 model,保留 undefined 等 o().copy() 会丢弃的值 */\nfunction snapshotModel(model: Record<string, any>): Record<string, any> {\n const result: Record<string, any> = {}\n\n for (const key of Object.keys(model)) {\n const value = model[key]\n if (Array.isArray(value)) {\n result[key] = value.map((item) =>\n item !== null && typeof item === 'object' ? snapshotModel(item) : item\n )\n } else if (value !== null && typeof value === 'object') {\n result[key] = snapshotModel(value)\n } else {\n result[key] = value\n }\n }\n\n return result\n}\n\n/** 按快照逐字段写回 model,支持 undefined 与嵌套对象 */\nfunction applySnapshot(target: Record<string, any>, source: Record<string, any>) {\n for (const key of Object.keys(source)) {\n const sourceValue = source[key]\n const targetValue = target[key]\n\n if (\n sourceValue !== null &&\n typeof sourceValue === 'object' &&\n !Array.isArray(sourceValue) &&\n targetValue !== null &&\n typeof targetValue === 'object' &&\n !Array.isArray(targetValue)\n ) {\n applySnapshot(targetValue, sourceValue)\n continue\n }\n\n if (Array.isArray(sourceValue)) {\n o(target).set(\n key,\n sourceValue.map((item) =>\n item !== null && typeof item === 'object' ? snapshotModel(item) : item\n )\n )\n continue\n }\n\n o(target).set(key, sourceValue)\n }\n}\n\nexport function useFormFields(options: Options) {\n const { props } = options\n const fields: Record<string, FormFieldItem> = {}\n\n let willValidate = true\n\n /** model 初始快照,供 reset 恢复 */\n let initialSnapshot: Record<string, any> | undefined\n\n function runWithoutChangeValidate(fn: () => void) {\n willValidate = false\n fn()\n nextTick(() => {\n willValidate = true\n })\n }\n\n function shouldValidate() {\n return willValidate\n }\n\n watch(\n () => props.model,\n (model) => {\n initialSnapshot = model ? snapshotModel(model) : undefined\n },\n { immediate: true, deep: false }\n )\n\n function registerField(field: string, item: FormFieldItem) {\n fields[field] = item\n }\n\n function unregisterField(field: string) {\n delete fields[field]\n }\n\n function clearValidate() {\n Object.values(fields).forEach((item) => item.clearValidate?.())\n }\n\n async function validate(keys?: string[]) {\n let validList: boolean[]\n if (keys) {\n validList = await Promise.all(\n keys.map((key) => fields[key]?.validate() ?? Promise.resolve(true))\n )\n } else {\n validList = await Promise.all(Object.values(fields).map((field) => field.validate()))\n }\n return validList.every((valid) => valid)\n }\n\n function reset() {\n if (!props.model || !initialSnapshot) return\n\n runWithoutChangeValidate(() => {\n applySnapshot(props.model!, initialSnapshot!)\n Object.values(fields).forEach((item) => item.clearValidate?.())\n })\n }\n\n return { fields, registerField, validate, unregisterField, clearValidate, reset, shouldValidate }\n}\n"],"mappings":";;;;AAWA,SAAS,cAAc,OAAiD;CACtE,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACpC,MAAM,QAAQ,MAAM;EACpB,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,OAAO,MAAM,KAAK,SACvB,SAAS,QAAQ,OAAO,SAAS,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AS,MAAiB;EACvC,IAAI;EACJ,IAAI,MACF,YAAY,MAAM,QAAQ,IACxB,KAAK,KAAK,QAAQ,OAAO,MAAM,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC,CACpE;OAEA,YAAY,MAAM,QAAQ,IAAI,OAAO,OAAO,MAAM,EAAE,KAAK,UAAU,MAAM,SAAS,CAAC,CAAC;EAEtF,OAAO,UAAU,OAAO,UAAU,KAAK;CACzC;CAEA,SAAS,QAAQ;EACf,IAAI,CAAC,MAAM,SAAS,CAAC,iBAAiB;EAEtC,+BAA+B;GAC7B,cAAc,MAAM,OAAQ,eAAgB;GAC5C,OAAO,OAAO,MAAM,EAAE,SAAS,SAAS,KAAK,gBAAgB,CAAC;EAChE,CAAC;CACH;CAEA,OAAO;EAAE;EAAQ;EAAe;EAAU;EAAiB;EAAe;EAAO;CAAe;AAClG"}
1
+ {"version":3,"file":"use-form-fields.js","names":[],"sources":["../../../src/components/form/use-form-fields.ts"],"sourcesContent":["import { o } from '@cat-kit/core'\nimport type { FormFieldItem } from '@veltra/utils'\nimport { nextTick, watch } from 'vue'\n\nimport type { FormProps } from '../../types/form'\n\ninterface Options {\n props: FormProps\n}\n\n/** 深拷贝 model,保留 undefined 等 o().copy() 会丢弃的值 */\nfunction snapshotModel(model: Record<string, any>): Record<string, any> {\n const result: Record<string, any> = {}\n\n for (const key of Object.keys(model)) {\n const value = model[key]\n if (Array.isArray(value)) {\n result[key] = value.map((item) =>\n item !== null && typeof item === 'object' ? snapshotModel(item) : item\n )\n } else if (value !== null && typeof value === 'object') {\n result[key] = snapshotModel(value)\n } else {\n result[key] = value\n }\n }\n\n return result\n}\n\n/** 按快照逐字段写回 model,支持 undefined 与嵌套对象 */\nfunction applySnapshot(target: Record<string, any>, source: Record<string, any>) {\n for (const key of Object.keys(source)) {\n const sourceValue = source[key]\n const targetValue = target[key]\n\n if (\n sourceValue !== null &&\n typeof sourceValue === 'object' &&\n !Array.isArray(sourceValue) &&\n targetValue !== null &&\n typeof targetValue === 'object' &&\n !Array.isArray(targetValue)\n ) {\n applySnapshot(targetValue, sourceValue)\n continue\n }\n\n if (Array.isArray(sourceValue)) {\n o(target).set(\n key,\n sourceValue.map((item) =>\n item !== null && typeof item === 'object' ? snapshotModel(item) : item\n )\n )\n continue\n }\n\n o(target).set(key, sourceValue)\n }\n}\n\nexport function useFormFields(options: Options) {\n const { props } = options\n const fields: Record<string, FormFieldItem> = {}\n\n let willValidate = true\n\n /** model 初始快照,供 reset 恢复 */\n let initialSnapshot: Record<string, any> | undefined\n\n function runWithoutChangeValidate(fn: () => void) {\n willValidate = false\n fn()\n nextTick(() => {\n willValidate = true\n })\n }\n\n function shouldValidate() {\n return willValidate\n }\n\n watch(\n () => props.model,\n (model) => {\n initialSnapshot = model ? snapshotModel(model) : undefined\n },\n { immediate: true, deep: false }\n )\n\n function registerField(field: string, item: FormFieldItem) {\n fields[field] = item\n }\n\n function unregisterField(field: string) {\n delete fields[field]\n }\n\n function clearValidate() {\n Object.values(fields).forEach((item) => item.clearValidate?.())\n }\n\n async function validate(keys?: string[]) {\n let validList: boolean[]\n if (keys) {\n validList = await Promise.all(\n keys.map((key) => fields[key]?.validate() ?? Promise.resolve(true))\n )\n } else {\n validList = await Promise.all(Object.values(fields).map((field) => field.validate()))\n }\n return validList.every((valid) => valid)\n }\n\n function reset() {\n if (!props.model || !initialSnapshot) return\n\n runWithoutChangeValidate(() => {\n applySnapshot(props.model!, initialSnapshot!)\n Object.values(fields).forEach((item) => item.clearValidate?.())\n })\n }\n\n return { fields, registerField, validate, unregisterField, clearValidate, reset, shouldValidate }\n}\n"],"mappings":";;;;AAWA,SAAS,cAAc,OAAiD;CACtE,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACpC,MAAM,QAAQ,MAAM;EACpB,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,OAAO,MAAM,KAAK,SACvB,SAAS,QAAQ,OAAO,SAAS,WAAW,cA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,eAAe,SAAS,MAAiB;EACvC,IAAI;EACJ,IAAI,MACF,YAAY,MAAM,QAAQ,IACxB,KAAK,KAAK,QAAQ,OAAO,IAAI,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC,CACpE;OAEA,YAAY,MAAM,QAAQ,IAAI,OAAO,OAAO,MAAM,CAAC,CAAC,KAAK,UAAU,MAAM,SAAS,CAAC,CAAC;EAEtF,OAAO,UAAU,OAAO,UAAU,KAAK;CACzC;CAEA,SAAS,QAAQ;EACf,IAAI,CAAC,MAAM,SAAS,CAAC,iBAAiB;EAEtC,+BAA+B;GAC7B,cAAc,MAAM,OAAQ,eAAgB;GAC5C,OAAO,OAAO,MAAM,CAAC,CAAC,SAAS,SAAS,KAAK,gBAAgB,CAAC;EAChE,CAAC;CACH;CAEA,OAAO;EAAE;EAAQ;EAAe;EAAU;EAAiB;EAAe;EAAO;CAAe;AAClG"}
@@ -19,7 +19,7 @@ function useNodeInterceptor() {
19
19
  i++;
20
20
  const { props, type } = node;
21
21
  const field = props?.field;
22
- const isFormItem = type?.name === "FormItem";
22
+ const isFormItem = type?.name === "UFormItem";
23
23
  const formItemProps = o(props ?? {}).pick([
24
24
  "label",
25
25
  "rules",
@@ -1 +1 @@
1
- {"version":3,"file":"use-node-interceptor.js","names":[],"sources":["../../../src/components/form/use-node-interceptor.ts"],"sourcesContent":["import { o } from '@cat-kit/core'\nimport { extractNormalVNodes } from '@veltra/utils'\nimport { useSlots, type VNode } from 'vue'\n\nexport type SlotRenderItem = {\n isFormItem: boolean\n formItemProps?: Record<string, any>\n node: VNode\n field?: string\n modelValue?: any\n}\n\n/**\n * 虚拟node拦截\n * @returns\n */\nexport function useNodeInterceptor(): { getSlotsNodes: () => SlotRenderItem[] | null } {\n const slots = useSlots()\n\n function getSlotsNodes() {\n const nodes = slots.default?.()\n if (!nodes?.length) return null\n\n const flattedNodes = extractNormalVNodes(nodes)\n\n const results: SlotRenderItem[] = []\n\n let i = 0\n while (i < flattedNodes.length) {\n const node = flattedNodes[i]!\n i++\n\n const { props, type } = node\n const field = props?.field as string | undefined\n const isFormItem = (type as any)?.name === 'FormItem'\n const formItemProps = o((props ?? {}) as Record<string, any>).pick([\n 'label',\n 'rules',\n 'span',\n 'tips',\n 'readonly',\n 'field'\n ]) as Record<string, any>\n\n results.push({\n isFormItem,\n formItemProps,\n node,\n field,\n modelValue: props?.['model-value'] ?? props?.modelValue\n })\n }\n\n return results\n }\n\n return { getSlotsNodes }\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,qBAAuE;CACrF,MAAM,QAAQ,SAAS;CAEvB,SAAS,gBAAgB;EACvB,MAAM,QAAQ,MAAM,UAAU;EAC9B,IAAI,CAAC,OAAO,QAAQ,OAAO;EAE3B,MAAM,eAAe,oBAAoB,KAAK;EAE9C,MAAM,UAA4B,CAAC;EAEnC,IAAI,IAAI;EACR,OAAO,IAAI,aAAa,QAAQ;GAC9B,MAAM,OAAO,aAAa;GAC1B;GAEA,MAAM,EAAE,OAAO,SAAS;GACxB,MAAM,QAAQ,OAAO;GACrB,MAAM,aAAc,MAAc,SAAS;GAC3C,MAAM,gBAAgB,EAAG,SAAS,CAAC,CAAyB,EAAE,KAAK;IACjE;IACA;IACA;IACA;IACA;IACA;GACF,CAAC;GAED,QAAQ,KAAK;IACX;IACA;IACA;IACA;IACA,YAAY,QAAQ,kBAAkB,OAAO;GAC/C,CAAC;EACH;EAEA,OAAO;CACT;CAEA,OAAO,EAAE,cAAc;AACzB"}
1
+ {"version":3,"file":"use-node-interceptor.js","names":[],"sources":["../../../src/components/form/use-node-interceptor.ts"],"sourcesContent":["import { o } from '@cat-kit/core'\nimport { extractNormalVNodes } from '@veltra/utils'\nimport { useSlots, type VNode } from 'vue'\n\nexport type SlotRenderItem = {\n isFormItem: boolean\n formItemProps?: Record<string, any>\n node: VNode\n field?: string\n modelValue?: any\n}\n\n/**\n * 虚拟node拦截\n * @returns\n */\nexport function useNodeInterceptor(): { getSlotsNodes: () => SlotRenderItem[] | null } {\n const slots = useSlots()\n\n function getSlotsNodes() {\n const nodes = slots.default?.()\n if (!nodes?.length) return null\n\n const flattedNodes = extractNormalVNodes(nodes)\n\n const results: SlotRenderItem[] = []\n\n let i = 0\n while (i < flattedNodes.length) {\n const node = flattedNodes[i]!\n i++\n\n const { props, type } = node\n const field = props?.field as string | undefined\n const isFormItem = (type as any)?.name === 'UFormItem'\n\n const formItemProps = o((props ?? {}) as Record<string, any>).pick([\n 'label',\n 'rules',\n 'span',\n 'tips',\n 'readonly',\n 'field'\n ]) as Record<string, any>\n\n results.push({\n isFormItem,\n formItemProps,\n node,\n field,\n modelValue: props?.['model-value'] ?? props?.modelValue\n })\n }\n\n return results\n }\n\n return { getSlotsNodes }\n}\n"],"mappings":";;;;;;;;AAgBA,SAAgB,qBAAuE;CACrF,MAAM,QAAQ,SAAS;CAEvB,SAAS,gBAAgB;EACvB,MAAM,QAAQ,MAAM,UAAU;EAC9B,IAAI,CAAC,OAAO,QAAQ,OAAO;EAE3B,MAAM,eAAe,oBAAoB,KAAK;EAE9C,MAAM,UAA4B,CAAC;EAEnC,IAAI,IAAI;EACR,OAAO,IAAI,aAAa,QAAQ;GAC9B,MAAM,OAAO,aAAa;GAC1B;GAEA,MAAM,EAAE,OAAO,SAAS;GACxB,MAAM,QAAQ,OAAO;GACrB,MAAM,aAAc,MAAc,SAAS;GAE3C,MAAM,gBAAgB,EAAG,SAAS,CAAC,CAAyB,CAAC,CAAC,KAAK;IACjE;IACA;IACA;IACA;IACA;IACA;GACF,CAAC;GAED,QAAQ,KAAK;IACX;IACA;IACA;IACA;IACA,YAAY,QAAQ,kBAAkB,OAAO;GAC/C,CAAC;EACH;EAEA,OAAO;CACT;CAEA,OAAO,EAAE,cAAc;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-item.js","names":[],"sources":["../../../src/components/form-item/form-item.vue"],"sourcesContent":["<template>\n <u-grid-item :span=\"span\" :class=\"className\">\n <label\n v-if=\"props.label || $slots.label\"\n :class=\"[cls.e('label'), bem.is('required', !!rules?.required)]\"\n :style=\"labelStyles\"\n >\n <u-tip v-if=\"tips\" :content=\"tips\" :class=\"cls.e('tips')\">\n <span :class=\"cls.e('tip-label')\">\n <slot name=\"label\">{{ label }}:</slot>\n </span>\n </u-tip>\n <template v-else>\n <slot name=\"label\">{{ label }}:</slot>\n </template>\n </label>\n\n <section :class=\"cls.e('wrapper')\">\n <div :class=\"cls.e('content')\">\n <slot></slot>\n </div>\n\n <!-- 只有表单控件处于非只读状态时,才显示错误提示 -->\n <section :class=\"cls.e('error')\" v-if=\"!readonly && !formProps?.noTips\">\n <transition name=\"form-item-tips\" mode=\"out-in\">\n <span :class=\"cls.e('error-text')\" v-if=\"!!errorTip\">\n {{ errorTip }}\n </span>\n </transition>\n </section>\n </section>\n </u-grid-item>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { o } from '@cat-kit/core'\nimport { useConfig, useFallbackProps } from '@veltra/compositions'\nimport { bem, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { type CSSProperties, computed, onBeforeUnmount, shallowRef, watch } from 'vue'\n\nimport type { FormItemProps, ComponentSize } from '../../types'\nimport { UGridItem } from '../grid'\nimport { UTip } from '../tip'\nimport { formItemCls as cls, defineField } from './helper'\nimport { validateField } from './validate'\n\ndefineOptions({ name: 'FormItem' })\n\nconst props = withDefaults(defineProps<FormItemProps>(), { readonly: undefined })\n\ndefineSlots<{\n /** 标签插槽 */\n label?: () => any\n default?: () => any\n}>()\n\n/** 表单组件上下文 */\nconst { formProps, registerField, unregisterField, shouldValidate, handleFieldChange } =\n injectFormContext()\n\nconst { config } = useConfig()\n\nconst { size, readonly } = useFallbackProps([formProps ?? {}, props], {\n size: 'default' as ComponentSize,\n readonly: false\n})\n\nconst errorTip = shallowRef<string>()\n/** 递增序号,丢弃过期的异步校验结果 */\nlet validateSeq = 0\n/** 最近一次 validate 的 Promise,供过期调用等待最新结果 */\nlet latestValidatePromise: Promise<boolean> = Promise.resolve(true)\n\nconst className = computed(() => {\n return [cls.b, cls.m(size.value), bem.is('error', !!errorTip.value)].join(' ')\n})\n\n/** label样式 */\nconst labelStyles = computed<CSSProperties>(() => {\n return {\n width: withUnit(props.labelWidth ?? formProps?.labelWidth ?? config.form.labelWidth, 'px')\n }\n})\n\nconst fieldItem = defineField({\n clearValidate() {\n errorTip.value = ''\n },\n async validate() {\n if (!props.field || !formProps?.model || !props.rules || !shouldValidate?.()) return true\n\n const seq = ++validateSeq\n\n latestValidatePromise = validateField(formProps.model!, props.field!, props.rules!).then(\n (tip) => {\n if (seq !== validateSeq) return latestValidatePromise\n\n errorTip.value = tip\n return !errorTip.value\n }\n )\n return latestValidatePromise\n }\n})\n\nwatch(\n () => props.field,\n (field, oldField) => {\n if (oldField) {\n unregisterField?.(oldField)\n }\n if (field) {\n registerField?.(field, fieldItem)\n }\n },\n { immediate: true }\n)\n\nlet stopWatchFieldValue: (() => void) | undefined\n\nwatch(\n [() => formProps?.model, () => props.field],\n ([model, field]) => {\n stopWatchFieldValue?.()\n\n if (!field || !model) return\n\n stopWatchFieldValue = watch(\n () => o(model).get(field),\n (value) => {\n handleFieldChange?.(field, value)\n fieldItem.validate()\n }\n )\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => {\n props.field && unregisterField?.(props.field)\n})\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"form-item.js","names":[],"sources":["../../../src/components/form-item/form-item.vue"],"sourcesContent":["<template>\n <u-grid-item :span=\"span\" :class=\"className\">\n <label\n v-if=\"props.label || $slots.label\"\n :class=\"[cls.e('label'), bem.is('required', !!rules?.required)]\"\n :style=\"labelStyles\"\n >\n <u-tip v-if=\"tips\" :content=\"tips\" :class=\"cls.e('tips')\">\n <span :class=\"cls.e('tip-label')\">\n <slot name=\"label\">{{ label }}:</slot>\n </span>\n </u-tip>\n <template v-else>\n <slot name=\"label\">{{ label }}:</slot>\n </template>\n </label>\n\n <section :class=\"cls.e('wrapper')\">\n <div :class=\"cls.e('content')\">\n <slot></slot>\n </div>\n\n <!-- 只有表单控件处于非只读状态时,才显示错误提示 -->\n <section :class=\"cls.e('error')\" v-if=\"!readonly && !formProps?.noTips\">\n <transition name=\"form-item-tips\" mode=\"out-in\">\n <span :class=\"cls.e('error-text')\" v-if=\"!!errorTip\">\n {{ errorTip }}\n </span>\n </transition>\n </section>\n </section>\n </u-grid-item>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { o } from '@cat-kit/core'\nimport { useConfig, useFallbackProps } from '@veltra/compositions'\nimport { bem, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { type CSSProperties, computed, onBeforeUnmount, shallowRef, watch } from 'vue'\n\nimport type { FormItemProps, ComponentSize } from '../../types'\nimport { UGridItem } from '../grid'\nimport { UTip } from '../tip'\nimport { formItemCls as cls, defineField } from './helper'\nimport { validateField } from './validate'\n\ndefineOptions({ name: 'UFormItem' })\n\nconst props = withDefaults(defineProps<FormItemProps>(), { readonly: undefined })\n\ndefineSlots<{\n /** 标签插槽 */\n label?: () => any\n default?: () => any\n}>()\n\n/** 表单组件上下文 */\nconst { formProps, registerField, unregisterField, shouldValidate, handleFieldChange } =\n injectFormContext()\n\nconst { config } = useConfig()\n\nconst { size, readonly } = useFallbackProps([formProps ?? {}, props], {\n size: 'default' as ComponentSize,\n readonly: false\n})\n\nconst errorTip = shallowRef<string>()\n/** 递增序号,丢弃过期的异步校验结果 */\nlet validateSeq = 0\n/** 最近一次 validate 的 Promise,供过期调用等待最新结果 */\nlet latestValidatePromise: Promise<boolean> = Promise.resolve(true)\n\nconst className = computed(() => {\n return [cls.b, cls.m(size.value), bem.is('error', !!errorTip.value)].join(' ')\n})\n\n/** label样式 */\nconst labelStyles = computed<CSSProperties>(() => {\n return {\n width: withUnit(props.labelWidth ?? formProps?.labelWidth ?? config.form.labelWidth, 'px')\n }\n})\n\nconst fieldItem = defineField({\n clearValidate() {\n errorTip.value = ''\n },\n async validate() {\n if (!props.field || !formProps?.model || !props.rules || !shouldValidate?.()) return true\n\n const seq = ++validateSeq\n\n latestValidatePromise = validateField(formProps.model!, props.field!, props.rules!).then(\n (tip) => {\n if (seq !== validateSeq) return latestValidatePromise\n\n errorTip.value = tip\n return !errorTip.value\n }\n )\n return latestValidatePromise\n }\n})\n\nwatch(\n () => props.field,\n (field, oldField) => {\n if (oldField) {\n unregisterField?.(oldField)\n }\n if (field) {\n registerField?.(field, fieldItem)\n }\n },\n { immediate: true }\n)\n\nlet stopWatchFieldValue: (() => void) | undefined\n\nwatch(\n [() => formProps?.model, () => props.field],\n ([model, field]) => {\n stopWatchFieldValue?.()\n\n if (!field || !model) return\n\n stopWatchFieldValue = watch(\n () => o(model).get(field),\n (value) => {\n handleFieldChange?.(field, value)\n fieldItem.validate()\n }\n )\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => {\n props.field && unregisterField?.(props.field)\n})\n</script>\n"],"mappings":""}
@@ -8,7 +8,7 @@ import { bem, injectFormContext, withUnit } from "@veltra/utils";
8
8
  import { o } from "@cat-kit/core";
9
9
  //#region src/components/form-item/form-item.vue?vue&type=script&setup=true&lang.tsx
10
10
  var form_item_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
11
- name: "FormItem",
11
+ name: "UFormItem",
12
12
  __name: "form-item",
13
13
  props: {
14
14
  labelWidth: {},
@@ -1 +1 @@
1
- {"version":3,"file":"form-item.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../src/components/form-item/form-item.vue"],"sourcesContent":["<template>\n <u-grid-item :span=\"span\" :class=\"className\">\n <label\n v-if=\"props.label || $slots.label\"\n :class=\"[cls.e('label'), bem.is('required', !!rules?.required)]\"\n :style=\"labelStyles\"\n >\n <u-tip v-if=\"tips\" :content=\"tips\" :class=\"cls.e('tips')\">\n <span :class=\"cls.e('tip-label')\">\n <slot name=\"label\">{{ label }}:</slot>\n </span>\n </u-tip>\n <template v-else>\n <slot name=\"label\">{{ label }}:</slot>\n </template>\n </label>\n\n <section :class=\"cls.e('wrapper')\">\n <div :class=\"cls.e('content')\">\n <slot></slot>\n </div>\n\n <!-- 只有表单控件处于非只读状态时,才显示错误提示 -->\n <section :class=\"cls.e('error')\" v-if=\"!readonly && !formProps?.noTips\">\n <transition name=\"form-item-tips\" mode=\"out-in\">\n <span :class=\"cls.e('error-text')\" v-if=\"!!errorTip\">\n {{ errorTip }}\n </span>\n </transition>\n </section>\n </section>\n </u-grid-item>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { o } from '@cat-kit/core'\nimport { useConfig, useFallbackProps } from '@veltra/compositions'\nimport { bem, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { type CSSProperties, computed, onBeforeUnmount, shallowRef, watch } from 'vue'\n\nimport type { FormItemProps, ComponentSize } from '../../types'\nimport { UGridItem } from '../grid'\nimport { UTip } from '../tip'\nimport { formItemCls as cls, defineField } from './helper'\nimport { validateField } from './validate'\n\ndefineOptions({ name: 'FormItem' })\n\nconst props = withDefaults(defineProps<FormItemProps>(), { readonly: undefined })\n\ndefineSlots<{\n /** 标签插槽 */\n label?: () => any\n default?: () => any\n}>()\n\n/** 表单组件上下文 */\nconst { formProps, registerField, unregisterField, shouldValidate, handleFieldChange } =\n injectFormContext()\n\nconst { config } = useConfig()\n\nconst { size, readonly } = useFallbackProps([formProps ?? {}, props], {\n size: 'default' as ComponentSize,\n readonly: false\n})\n\nconst errorTip = shallowRef<string>()\n/** 递增序号,丢弃过期的异步校验结果 */\nlet validateSeq = 0\n/** 最近一次 validate 的 Promise,供过期调用等待最新结果 */\nlet latestValidatePromise: Promise<boolean> = Promise.resolve(true)\n\nconst className = computed(() => {\n return [cls.b, cls.m(size.value), bem.is('error', !!errorTip.value)].join(' ')\n})\n\n/** label样式 */\nconst labelStyles = computed<CSSProperties>(() => {\n return {\n width: withUnit(props.labelWidth ?? formProps?.labelWidth ?? config.form.labelWidth, 'px')\n }\n})\n\nconst fieldItem = defineField({\n clearValidate() {\n errorTip.value = ''\n },\n async validate() {\n if (!props.field || !formProps?.model || !props.rules || !shouldValidate?.()) return true\n\n const seq = ++validateSeq\n\n latestValidatePromise = validateField(formProps.model!, props.field!, props.rules!).then(\n (tip) => {\n if (seq !== validateSeq) return latestValidatePromise\n\n errorTip.value = tip\n return !errorTip.value\n }\n )\n return latestValidatePromise\n }\n})\n\nwatch(\n () => props.field,\n (field, oldField) => {\n if (oldField) {\n unregisterField?.(oldField)\n }\n if (field) {\n registerField?.(field, fieldItem)\n }\n },\n { immediate: true }\n)\n\nlet stopWatchFieldValue: (() => void) | undefined\n\nwatch(\n [() => formProps?.model, () => props.field],\n ([model, field]) => {\n stopWatchFieldValue?.()\n\n if (!field || !model) return\n\n stopWatchFieldValue = watch(\n () => o(model).get(field),\n (value) => {\n handleFieldChange?.(field, value)\n fieldItem.validate()\n }\n )\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => {\n props.field && unregisterField?.(props.field)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDA,MAAM,QAAQ;;EASd,MAAM,EAAE,WAAW,eAAe,iBAAiB,gBAAgB,sBACjE,kBAAkB;EAEpB,MAAM,EAAE,WAAW,UAAU;EAE7B,MAAM,EAAE,MAAM,aAAa,iBAAiB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GACpE,MAAM;GACN,UAAU;EACZ,CAAC;EAED,MAAM,WAAW,WAAmB;;EAEpC,IAAI,cAAc;;EAElB,IAAI,wBAA0C,QAAQ,QAAQ,IAAI;EAElE,MAAM,YAAY,eAAe;GAC/B,OAAO;IAAC,YAAI;IAAG,YAAI,EAAE,KAAK,KAAK;IAAG,IAAI,GAAG,SAAS,CAAC,CAAC,SAAS,KAAK;GAAC,EAAE,KAAK,GAAG;EAC/E,CAAC;;EAGD,MAAM,cAAc,eAA8B;GAChD,OAAO,EACL,OAAO,SAAS,MAAM,cAAc,WAAW,cAAc,OAAO,KAAK,YAAY,IAAI,EAC3F;EACF,CA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YAIQ,MAAA,SAAA,GAAA;;KAJY,SAAS,QAAA;KAAO,OAAK,eAAE,MAAA,WAAA,EAAI,EAAC,MAAA,CAAA;;4BAGvC,CAFP,mBAEO,QAAA,EAFA,OAAK,eAAE,MAAA,WAAA,EAAI,EAAC,WAAA,CAAA,EAAA,GAAA,CACjB,WAAsC,KAAA,QAAA,SAAA,CAAA,SAAA,CAAA,gBAAA,gBAAhB,QAAA,KAAK,IAAG,KAAC,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;mCAIjC,WAAsC,KAAA,QAAA,SAAA,EAAA,KAAA,EAAA,SAAA,CAAA,gBAAA,gBAAhB,QAAA,KAAK,IAAG,KAAC,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,QAAA,IAAA,GAInC,mBAaU,WAAA,EAbA,OAAK,eAAE,MAAA,WAAA,EAAI,EAAC,SAAA,CAAA,EAAA,GAAA;KACpB,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,WAAA,EAAI,EAAC,SAAA,CAAA,EAAA,GAAA,CAChB,WAAa,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA;KAGf,mBAAA,0BAAA;MACwC,MAAA,QAAA,KAAQ,CAAK,MAAA,SAAA,GAAW,UAAA,UAAA,GAAhE,mBAMU,WAAA;;MANA,OAAK,eAAE,MAAA,WAAA,EAAI,EAAC,OAAA,CAAA;SACpB,YAIa,YAAA;MAJD,MAAK;MAAiB,MAAK;;6BAG9B,CAAA,CAAA,CAFoC,SAAA,SAAA,UAAA,GAA3C,mBAEO,QAAA;;OAFA,OAAK,eAAE,MAAA,WAAA,EAAI,EAAC,YAAA,CAAA;yBACd,SAAA,KAAQ,GAAA,CAAA,KAAA,mBAAA,QAAA,IAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"form-item.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../src/components/form-item/form-item.vue"],"sourcesContent":["<template>\n <u-grid-item :span=\"span\" :class=\"className\">\n <label\n v-if=\"props.label || $slots.label\"\n :class=\"[cls.e('label'), bem.is('required', !!rules?.required)]\"\n :style=\"labelStyles\"\n >\n <u-tip v-if=\"tips\" :content=\"tips\" :class=\"cls.e('tips')\">\n <span :class=\"cls.e('tip-label')\">\n <slot name=\"label\">{{ label }}:</slot>\n </span>\n </u-tip>\n <template v-else>\n <slot name=\"label\">{{ label }}:</slot>\n </template>\n </label>\n\n <section :class=\"cls.e('wrapper')\">\n <div :class=\"cls.e('content')\">\n <slot></slot>\n </div>\n\n <!-- 只有表单控件处于非只读状态时,才显示错误提示 -->\n <section :class=\"cls.e('error')\" v-if=\"!readonly && !formProps?.noTips\">\n <transition name=\"form-item-tips\" mode=\"out-in\">\n <span :class=\"cls.e('error-text')\" v-if=\"!!errorTip\">\n {{ errorTip }}\n </span>\n </transition>\n </section>\n </section>\n </u-grid-item>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { o } from '@cat-kit/core'\nimport { useConfig, useFallbackProps } from '@veltra/compositions'\nimport { bem, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { type CSSProperties, computed, onBeforeUnmount, shallowRef, watch } from 'vue'\n\nimport type { FormItemProps, ComponentSize } from '../../types'\nimport { UGridItem } from '../grid'\nimport { UTip } from '../tip'\nimport { formItemCls as cls, defineField } from './helper'\nimport { validateField } from './validate'\n\ndefineOptions({ name: 'UFormItem' })\n\nconst props = withDefaults(defineProps<FormItemProps>(), { readonly: undefined })\n\ndefineSlots<{\n /** 标签插槽 */\n label?: () => any\n default?: () => any\n}>()\n\n/** 表单组件上下文 */\nconst { formProps, registerField, unregisterField, shouldValidate, handleFieldChange } =\n injectFormContext()\n\nconst { config } = useConfig()\n\nconst { size, readonly } = useFallbackProps([formProps ?? {}, props], {\n size: 'default' as ComponentSize,\n readonly: false\n})\n\nconst errorTip = shallowRef<string>()\n/** 递增序号,丢弃过期的异步校验结果 */\nlet validateSeq = 0\n/** 最近一次 validate 的 Promise,供过期调用等待最新结果 */\nlet latestValidatePromise: Promise<boolean> = Promise.resolve(true)\n\nconst className = computed(() => {\n return [cls.b, cls.m(size.value), bem.is('error', !!errorTip.value)].join(' ')\n})\n\n/** label样式 */\nconst labelStyles = computed<CSSProperties>(() => {\n return {\n width: withUnit(props.labelWidth ?? formProps?.labelWidth ?? config.form.labelWidth, 'px')\n }\n})\n\nconst fieldItem = defineField({\n clearValidate() {\n errorTip.value = ''\n },\n async validate() {\n if (!props.field || !formProps?.model || !props.rules || !shouldValidate?.()) return true\n\n const seq = ++validateSeq\n\n latestValidatePromise = validateField(formProps.model!, props.field!, props.rules!).then(\n (tip) => {\n if (seq !== validateSeq) return latestValidatePromise\n\n errorTip.value = tip\n return !errorTip.value\n }\n )\n return latestValidatePromise\n }\n})\n\nwatch(\n () => props.field,\n (field, oldField) => {\n if (oldField) {\n unregisterField?.(oldField)\n }\n if (field) {\n registerField?.(field, fieldItem)\n }\n },\n { immediate: true }\n)\n\nlet stopWatchFieldValue: (() => void) | undefined\n\nwatch(\n [() => formProps?.model, () => props.field],\n ([model, field]) => {\n stopWatchFieldValue?.()\n\n if (!field || !model) return\n\n stopWatchFieldValue = watch(\n () => o(model).get(field),\n (value) => {\n handleFieldChange?.(field, value)\n fieldItem.validate()\n }\n )\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => {\n props.field && unregisterField?.(props.field)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDA,MAAM,QAAQ;;EASd,MAAM,EAAE,WAAW,eAAe,iBAAiB,gBAAgB,sBACjE,kBAAkB;EAEpB,MAAM,EAAE,WAAW,UAAU;EAE7B,MAAM,EAAE,MAAM,aAAa,iBAAiB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GACpE,MAAM;GACN,UAAU;EACZ,CAAC;EAED,MAAM,WAAW,WAAmB;;EAEpC,IAAI,cAAc;;EAElB,IAAI,wBAA0C,QAAQ,QAAQ,IAAI;EAElE,MAAM,YAAY,e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MAAiB,MAAK;;6BAG9B,CAAA,CAAA,CAFoC,SAAA,SAAA,UAAA,GAA3C,mBAEO,QAAA;;OAFA,OAAK,eAAE,MAAA,WAAA,CAAG,CAAC,EAAC,YAAA,CAAA;yBACd,SAAA,KAAQ,GAAA,CAAA,KAAA,mBAAA,QAAA,IAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":[],"sources":["../../../src/components/form-item/validate.ts"],"sourcesContent":["import { isEmpty, o } from '@cat-kit/core'\nimport type { PresetRule, Undef, ValidateRule } from '@veltra/utils'\n\nconst presetRules: Record<PresetRule, (value: string) => string | undefined> = {\n email(v) {\n const re = /^([\\w_-]+)@([\\w-]+[.]?)*[\\w]+\\.[a-zA-Z]{2,10}$/\n if (!re.test(v)) {\n return '邮箱格式不正确'\n }\n },\n phone(v) {\n const re = /^\\d{11}$/\n if (!re.test(v)) {\n return '手机号格式不正确'\n }\n },\n num(v) {\n const re = /^\\d+$/\n if (!re.test(v)) {\n return '数字格式不正确'\n }\n },\n url(v) {\n const re = /^(ftp|https?):\\/\\/([\\w_-]+)\\.([\\w-]+[.]?)*[\\w]+\\.[a-zA-Z]{2,10}(.*)/\n if (!re.test(v)) {\n return '链接格式不正确'\n }\n },\n\n idCard(v) {\n const re = /^(\\d{6})(\\d{4})(\\d{2})(\\d{2})(\\d{3})([0-9]|X)$/\n if (!re.test(v)) {\n return '身份证格式不正确'\n }\n }\n}\n\n/** 预设规则 */\nconst ruleTypes = {\n required(value: any, required: ValidateRule['required']): Undef<string> {\n if (required === false) return\n\n const errMsg = typeof required === 'string' ? required : '该项不能为空'\n if (isEmpty(value)) return errMsg\n\n if (Array.isArray(value) && !value.length) return errMsg\n if (typeof value === 'string' && !value) return errMsg\n },\n min(value: any, rule: ValidateRule['min']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项必须大于等于${_rule}`\n if (typeof value !== 'number') return `${value}不是一个数字`\n if (value < _rule) return errMsg\n },\n max(value: any, rule: ValidateRule['max']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项必须小于等于${_rule}`\n if (typeof value !== 'number') return `${value}不是一个数字`\n if (value > _rule) return errMsg\n },\n\n minLen(value: any, rule: ValidateRule['minLen']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项长度必须大于等于${_rule}`\n if (!Array.isArray(value) && typeof value !== 'string') return `${value}不是一个字符串或数组`\n if (value.length < _rule) return errMsg\n },\n maxLen(value: any, rule: ValidateRule['maxLen']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项长度必须小于等于:${_rule}`\n if (!Array.isArray(value) && typeof value !== 'string') return `${value}不是一个字符串或数组`\n if (value.length > _rule) return errMsg\n },\n match(value: any, rule: ValidateRule['match']): Undef<string> {\n if (isEmpty(value) || value === '') return\n if (typeof rule === 'string') {\n if (!rule) return\n rule = new RegExp(rule)\n }\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项不匹配正则:${_rule}`\n if (typeof value !== 'string') return `${value}不是一个字符串`\n if (!_rule.test(value)) return errMsg\n },\n preset(value: any, rule: ValidateRule['preset']): Undef<string> {\n if (isEmpty(value) || value === '' || !rule) return\n if (typeof value !== 'string') return `${value}不是一个字符串`\n const ruleValidator = presetRules[rule]\n return ruleValidator(value)\n }\n}\n\nexport async function validateField(\n formData: Record<string, any>,\n field: string,\n rules: ValidateRule\n): Promise<Undef<string>> {\n const value = o(formData).get(field)\n\n if (!rules) return\n\n const { validator, required, ...normalRules } = rules\n\n // 必填要先去校验\n if (required) {\n const err = ruleTypes.required(value, required)\n if (err) return err\n }\n\n // 校验规则\n for (const ruleKey in normalRules) {\n const validate = ruleTypes[ruleKey as keyof typeof ruleTypes]\n if (!validate) continue\n\n const err = validate(value, normalRules[ruleKey])\n\n if (err) return err\n }\n\n // 自定义校验最火校验\n if (validator) {\n const err = await validator(value, formData)\n if (err) return err\n }\n\n return\n}\n"],"mappings":";;AAGA,MAAM,cAAyE;CAC7E,MAAM,GAAG;EAEP,IAAI,CAAC,iDAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CACA,MAAM,GAAG;EAEP,IAAI,CAAC,WAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CACA,IAAI,GAAG;EAEL,IAAI,CAAC,QAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CACA,IAAI,GAAG;EAEL,IAAI,CAAC,sEAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CAEA,OAAO,GAAG;EAER,IAAI,CAAC,iDAAG,KAAK,CAAC,GACZ,OAAO;CAEX;AACF;;AAGA,MAAM,YAAY;CAChB,SAAS,OAAY,UAAmD;EACtE,IAAI,aAAa,OAAO;EAExB,MAAM,SAAS,OAAO,aAAa,WAAW,WAAW;EACzD,IAAI,QAAQ,KAAK,GAAG,OAAO;EAE3B,IAAI,MAAM,QAAQ,KAAK,KAAK,CAAC,MAAM,QAAQ,OAAO;EAClD,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,OAAO;CAClD;CACA,IAAI,OAAY,MAA0C;EACxD,IAAI,QAAQ,KAAK,GAAG;EACpB,IAAI,QAAQ,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK;EAC5C,IAAI,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,WAAW;EACxD,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;EAC/C,IAAI,QAAQ,OAAO,OAAO;CAC5B;CACA,IAAI,OAAY,MAA0C;EACxD,IAAI,QAAQ,KAAK,GAAG;EACpB,IAAI,QAAQ,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK;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U,UAAU,OAAO,GAAG,MAAM;EAC/C,MAAM,gBAAgB,YAAY;EAClC,OAAO,cAAc,KAAK;CAC5B;AACF;AAEA,eAAsB,cACpB,UACA,OACA,OACwB;CACxB,MAAM,QAAQ,EAAE,QAAQ,EAAE,IAAI,KAAK;CAEnC,IAAI,CAAC,OAAO;CAEZ,MAAM,EAAE,WAAW,UAAU,GAAG,gBAAgB;CAGhD,IAAI,UAAU;EACZ,MAAM,MAAM,UAAU,SAAS,OAAO,QAAQ;EAC9C,IAAI,KAAK,OAAO;CAClB;CAGA,KAAK,MAAM,WAAW,aAAa;EACjC,MAAM,WAAW,UAAU;EAC3B,IAAI,CAAC,UAAU;EAEf,MAAM,MAAM,SAAS,OAAO,YAAY,QAAQ;EAEhD,IAAI,KAAK,OAAO;CAClB;CAGA,IAAI,WAAW;EACb,MAAM,MAAM,MAAM,UAAU,OAAO,QAAQ;EAC3C,IAAI,KAAK,OAAO;CAClB;AAGF"}
1
+ {"version":3,"file":"validate.js","names":[],"sources":["../../../src/components/form-item/validate.ts"],"sourcesContent":["import { isEmpty, o } from '@cat-kit/core'\nimport type { PresetRule, Undef, ValidateRule } from '@veltra/utils'\n\nconst presetRules: Record<PresetRule, (value: string) => string | undefined> = {\n email(v) {\n const re = /^([\\w_-]+)@([\\w-]+[.]?)*[\\w]+\\.[a-zA-Z]{2,10}$/\n if (!re.test(v)) {\n return '邮箱格式不正确'\n }\n },\n phone(v) {\n const re = /^\\d{11}$/\n if (!re.test(v)) {\n return '手机号格式不正确'\n }\n },\n num(v) {\n const re = /^\\d+$/\n if (!re.test(v)) {\n return '数字格式不正确'\n }\n },\n url(v) {\n const re = /^(ftp|https?):\\/\\/([\\w_-]+)\\.([\\w-]+[.]?)*[\\w]+\\.[a-zA-Z]{2,10}(.*)/\n if (!re.test(v)) {\n return '链接格式不正确'\n }\n },\n\n idCard(v) {\n const re = /^(\\d{6})(\\d{4})(\\d{2})(\\d{2})(\\d{3})([0-9]|X)$/\n if (!re.test(v)) {\n return '身份证格式不正确'\n }\n }\n}\n\n/** 预设规则 */\nconst ruleTypes = {\n required(value: any, required: ValidateRule['required']): Undef<string> {\n if (required === false) return\n\n const errMsg = typeof required === 'string' ? required : '该项不能为空'\n if (isEmpty(value)) return errMsg\n\n if (Array.isArray(value) && !value.length) return errMsg\n if (typeof value === 'string' && !value) return errMsg\n },\n min(value: any, rule: ValidateRule['min']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项必须大于等于${_rule}`\n if (typeof value !== 'number') return `${value}不是一个数字`\n if (value < _rule) return errMsg\n },\n max(value: any, rule: ValidateRule['max']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项必须小于等于${_rule}`\n if (typeof value !== 'number') return `${value}不是一个数字`\n if (value > _rule) return errMsg\n },\n\n minLen(value: any, rule: ValidateRule['minLen']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项长度必须大于等于${_rule}`\n if (!Array.isArray(value) && typeof value !== 'string') return `${value}不是一个字符串或数组`\n if (value.length < _rule) return errMsg\n },\n maxLen(value: any, rule: ValidateRule['maxLen']): Undef<string> {\n if (isEmpty(value)) return\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项长度必须小于等于:${_rule}`\n if (!Array.isArray(value) && typeof value !== 'string') return `${value}不是一个字符串或数组`\n if (value.length > _rule) return errMsg\n },\n match(value: any, rule: ValidateRule['match']): Undef<string> {\n if (isEmpty(value) || value === '') return\n if (typeof rule === 'string') {\n if (!rule) return\n rule = new RegExp(rule)\n }\n let _rule = Array.isArray(rule) ? rule[0] : rule!\n let errMsg = Array.isArray(rule) ? rule[1] : `该项不匹配正则:${_rule}`\n if (typeof value !== 'string') return `${value}不是一个字符串`\n if (!_rule.test(value)) return errMsg\n },\n preset(value: any, rule: ValidateRule['preset']): Undef<string> {\n if (isEmpty(value) || value === '' || !rule) return\n if (typeof value !== 'string') return `${value}不是一个字符串`\n const ruleValidator = presetRules[rule]\n return ruleValidator(value)\n }\n}\n\nexport async function validateField(\n formData: Record<string, any>,\n field: string,\n rules: ValidateRule\n): Promise<Undef<string>> {\n const value = o(formData).get(field)\n\n if (!rules) return\n\n const { validator, required, ...normalRules } = rules\n\n // 必填要先去校验\n if (required) {\n const err = ruleTypes.required(value, required)\n if (err) return err\n }\n\n // 校验规则\n for (const ruleKey in normalRules) {\n const validate = ruleTypes[ruleKey as keyof typeof ruleTypes]\n if (!validate) continue\n\n const err = validate(value, normalRules[ruleKey])\n\n if (err) return err\n }\n\n // 自定义校验最火校验\n if (validator) {\n const err = await validator(value, formData)\n if (err) return err\n }\n\n return\n}\n"],"mappings":";;AAGA,MAAM,cAAyE;CAC7E,MAAM,GAAG;EAEP,IAAI,CAAC,iDAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CACA,MAAM,GAAG;EAEP,IAAI,CAAC,WAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CACA,IAAI,GAAG;EAEL,IAAI,CAAC,QAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CACA,IAAI,GAAG;EAEL,IAAI,CAAC,sEAAG,KAAK,CAAC,GACZ,OAAO;CAEX;CAEA,OAAO,GAAG;EAER,IAAI,CAAC,iDAAG,KAAK,CAAC,GACZ,OAAO;CAEX;AACF;;AAGA,MAAM,YAAY;CAChB,SAAS,OAAY,UAAmD;EACtE,IAAI,aAAa,OAAO;EAExB,MAAM,SAAS,OAAO,aAAa,WAAW,WAAW;EACzD,IAAI,QAAQ,KAAK,GAAG,OAAO;EAE3B,IAAI,MAAM,QAAQ,KAAK,KAAK,CAAC,MAAM,QAAQ,OAAO;EAClD,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,OAAO;CAClD;CACA,I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C,MAAM;GACX,OAAO,IAAI,OAAO,IAAI;EACxB;EACA,IAAI,QAAQ,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK;EAC5C,IAAI,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,WAAW;EACxD,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;EAC/C,IAAI,CAAC,MAAM,KAAK,KAAK,GAAG,OAAO;CACjC;CACA,OAAO,OAAY,MAA6C;EAC9D,IAAI,QAAQ,KAAK,KAAK,UAAU,MAAM,CAAC,MAAM;EAC7C,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;EAC/C,MAAM,gBAAgB,YAAY;EAClC,OAAO,cAAc,KAAK;CAC5B;AACF;AAEA,eAAsB,cACpB,UACA,OACA,OACwB;CACxB,MAAM,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,KAAK;CAEnC,IAAI,CAAC,OAAO;CAEZ,MAAM,EAAE,WAAW,UAAU,GAAG,gBAAgB;CAGhD,IAAI,UAAU;EACZ,MAAM,MAAM,UAAU,SAAS,OAAO,QAAQ;EAC9C,IAAI,KAAK,OAAO;CAClB;CAGA,KAAK,MAAM,WAAW,aAAa;EACjC,MAAM,WAAW,UAAU;EAC3B,IAAI,CAAC,UAAU;EAEf,MAAM,MAAM,SAAS,OAAO,YAAY,QAAQ;EAEhD,IAAI,KAAK,OAAO;CAClB;CAGA,IAAI,WAAW;EACb,MAAM,MAAM,MAAM,UAAU,OAAO,QAAQ;EAC3C,IAAI,KAAK,OAAO;CAClB;AAGF"}
@@ -1,8 +1,8 @@
1
1
  import { createElementBlock, defineComponent, normalizeClass, openBlock, unref } from "vue";
2
2
  import { bem } from "@veltra/utils";
3
3
  //#region src/components/gantt-chart/gantt-chart.vue
4
- const _sfc_main = /* @__PURE__ */ defineComponent({
5
- name: "GanttChart",
4
+ const _sfc_main = /*@__PURE__*/ defineComponent({
5
+ name: "UGanttChart",
6
6
  __name: "gantt-chart",
7
7
  props: { modelValue: {} },
8
8
  setup(__props) {
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-chart.js","names":[],"sources":["../../../src/components/gantt-chart/gantt-chart.vue"],"sourcesContent":["<template>\n <div :class=\"cls.b\"></div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\n\nimport type { GanttChartProps } from '../../types'\n\ndefineOptions({ name: 'GanttChart' })\n\ndefineProps<GanttChartProps>()\n\nconst cls = bem('gantt-chart')\n</script>\n"],"mappings":";;;;;;;;EAaA,MAAM,MAAM,IAAI,aAAa;;uBAZ3B,mBAA0B,OAAA,EAApB,OAAK,eAAE,MAAA,GAAA,EAAI,CAAC,EAAA,GAAA,MAAA,CAAA"}
1
+ {"version":3,"file":"gantt-chart.js","names":[],"sources":["../../../src/components/gantt-chart/gantt-chart.vue"],"sourcesContent":["<template>\n <div :class=\"cls.b\"></div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\n\nimport type { GanttChartProps } from '../../types'\n\ndefineOptions({ name: 'UGanttChart' })\n\ndefineProps<GanttChartProps>()\n\nconst cls = bem('gantt-chart')\n</script>\n"],"mappings":";;;;;;;;EAaA,MAAM,MAAM,IAAI,aAAa;;uBAZ3B,mBAA0B,OAAA,EAApB,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC,EAAA,GAAA,MAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoint.js","names":[],"sources":["../../../src/components/grid/breakpoint.ts"],"sourcesContent":["import type { BreakpointName, BreakCols, Breakpoint } from '../../types'\n\nexport const DEFAULT_COLS = 24\n\nconst points: [number, BreakpointName][] = [\n [578, 'xs'],\n [960, 'sm'],\n [1366, 'md'],\n [1920, 'lg'],\n [Infinity, 'xl']\n]\n\n/**\n * 获取容器断点\n * @param width\n */\nexport function getContainerBreakpoint(width: number): Breakpoint {\n for (let i = 0; i < points.length; i++) {\n const point = points[i]!\n if (width < point[0]) {\n return { name: point[1], level: i + 1 }\n }\n }\n return { name: 'xl', level: 5 }\n}\n\n/**\n * 获取断点对应的列数\n * @param colConf 断点配置\n * @param breakpoint 断点\n */\nexport function getBreakpointCols(colConf: BreakCols, breakpoint?: Breakpoint): number {\n if (!breakpoint) return DEFAULT_COLS\n const { name, level } = breakpoint\n const cols = colConf[name]\n if (cols !== undefined) return cols\n\n if (level === 5) return colConf.default ?? DEFAULT_COLS\n\n // 尝试寻找高级断点\n const highLevelPoints = points.slice(level - 1)\n for (let i = 0; i < highLevelPoints.length; i++) {\n const pointName = highLevelPoints[i]![1]\n if (colConf[pointName]) {\n return colConf[pointName]\n }\n }\n return DEFAULT_COLS\n}\n"],"mappings":"AAIA,MAAM,SAAqC;CACzC,CAAC,KAAK,IAAI;CACV,CAAC,KAAK,IAAI;CACV,CAAC,MAAM,IAAI;CACX,CAAC,MAAM,IAAI;CACX,CAAC,UAAU,IAAI;AACjB;;;;;AAMA,SAAgB,uBAAuB,OAA2B;CAChE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;EACtC,MAAM,QAAQ,OAAO;EACrB,IAAI,QAAQ,MAAM,IAChB,OAAO;GAAE,MAAM,MAAM;GAAI,OAAO,IAAI;EAAE;CAE1C;CACA,OAAO;EAAE,MAAM;EAAM,OAAO;CAAE;AAChC;;;;;;AAOA,SAAgB,kBAAkB,SAAoB,YAAiC;CACrF,IAAI,CAAC,YAAY,OAAA;CACjB,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAA,GAAW,OAAO;CAE/B,IAAI,UAAU,GAAG,OAAO,QAAQ,WAAA;CAGhC,MAAM,kBAAkB,OAAO,MAAM,QAAQ,CAAC;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;EAC/C,MAAM,YAAY,gBAAgB,GAAI;EACtC,IAAI,QAAQ,YACV,OAAO,QAAQ;CAEnB;CACA,OAAA;AACF"}
1
+ {"version":3,"file":"breakpoint.js","names":[],"sources":["../../../src/components/grid/breakpoint.ts"],"sourcesContent":["import type { BreakpointName, BreakCols, Breakpoint } from '../../types'\n\nexport const DEFAULT_COLS = 24\n\nconst points: [number, BreakpointName][] = [\n [578, 'xs'],\n [960, 'sm'],\n [1366, 'md'],\n [1920, 'lg'],\n [Infinity, 'xl']\n]\n\n/**\n * 获取容器断点\n * @param width\n */\nexport function getContainerBreakpoint(width: number): Breakpoint {\n for (let i = 0; i < points.length; i++) {\n const point = points[i]!\n if (width < point[0]) {\n return { name: point[1], level: i + 1 }\n }\n }\n return { name: 'xl', level: 5 }\n}\n\n/**\n * 获取断点对应的列数\n * @param colConf 断点配置\n * @param breakpoint 断点\n */\nexport function getBreakpointCols(colConf: BreakCols, breakpoint?: Breakpoint): number {\n if (!breakpoint) return DEFAULT_COLS\n const { name, level } = breakpoint\n const cols = colConf[name]\n if (cols !== undefined) return cols\n\n if (level === 5) return colConf.default ?? DEFAULT_COLS\n\n // 尝试寻找高级断点\n const highLevelPoints = points.slice(level - 1)\n for (let i = 0; i < highLevelPoints.length; i++) {\n const pointName = highLevelPoints[i]![1]\n if (colConf[pointName]) {\n return colConf[pointName]\n }\n }\n return DEFAULT_COLS\n}\n"],"mappings":"AAIA,MAAM,SAAqC;CACzC,CAAC,KAAK,IAAI;CACV,CAAC,KAAK,IAAI;CACV,CAAC,MAAM,IAAI;CACX,CAAC,MAAM,IAAI;CACX,CAAC,UAAU,IAAI;AACjB;;;;;AAMA,SAAgB,uBAAuB,OAA2B;CAChE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;EACtC,MAAM,QAAQ,OAAO;EACrB,IAAI,QAAQ,MAAM,IAChB,OAAO;GAAE,MAAM,MAAM;GAAI,OAAO,IAAI;EAAE;CAE1C;CACA,OAAO;EAAE,MAAM;EAAM,OAAO;CAAE;AAChC;;;;;;AAOA,SAAgB,kBAAkB,SAAoB,YAAiC;CACrF,IAAI,CAAC,YAAY,OAAA;CACjB,MAAM,EAAE,MAAM,UAAU;CACxB,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAA,GAAW,OAAO;CAE/B,IAAI,UAAU,GAAG,OAAO,QAAQ,WAAA;CAGhC,MAAM,kBAAkB,OAAO,MAAM,QAAQ,CAAC;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;EAC/C,MAAM,YAAY,gBAAgB,EAAE,CAAE;EACtC,IAAI,QAAQ,YACV,OAAO,QAAQ;CAEnB;CACA,OAAA;AACF"}
@@ -2,8 +2,8 @@ import { GridDIKey } from "./di.js";
2
2
  import { computed, createBlock, createCommentVNode, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, unref, watch, withCtx } from "vue";
3
3
  import { bem } from "@veltra/utils";
4
4
  //#region src/components/grid/grid-item.vue
5
- const _sfc_main = /* @__PURE__ */ defineComponent({
6
- name: "GridItem",
5
+ const _sfc_main = /*@__PURE__*/ defineComponent({
6
+ name: "UGridItem",
7
7
  __name: "grid-item",
8
8
  props: {
9
9
  span: {},
@@ -1 +1 @@
1
- {"version":3,"file":"grid-item.js","names":[],"sources":["../../../src/components/grid/grid-item.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :style=\"style\" :class=\"cls.b\" v-if=\"span !== 0\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed, inject, type CSSProperties, watch } from 'vue'\n\nimport type { GridItemProps } from '../../types'\nimport { GridDIKey } from './di'\n\ndefineOptions({ name: 'GridItem' })\n\nconst props = withDefaults(defineProps<GridItemProps>(), { tag: 'div' })\n\nconst cls = bem('grid-item')\n\nconst { currentBreakpoint, gridItemsProps } = inject(GridDIKey) ?? {}\n\nif (!currentBreakpoint) {\n console.error('GridItem组件仅能在Grid组件中使用')\n}\n\nconst span = computed<number | 'full'>(() => {\n let { span } = props\n if (span === undefined) return 1\n if (span === 'full') return 'full'\n\n if (typeof span === 'number') return span\n\n const breakpoint = currentBreakpoint?.value\n\n if (!breakpoint) return span.default\n return span[breakpoint.name] ?? span.default\n})\n\nconst style = computed<CSSProperties>(() => {\n return { gridColumn: span.value === 'full' ? '1 / -1' : `span ${span.value}` }\n})\n\nwatch(\n () => props.span,\n (span) => {\n if (typeof span === 'object') {\n gridItemsProps?.add(props)\n } else {\n gridItemsProps?.delete(props)\n }\n },\n { immediate: true }\n)\n</script>\n"],"mappings":";;;;;;;;;;;;EAeA,MAAM,QAAQ;EAEd,MAAM,MAAM,IAAI,WAAW;EAE3B,MAAM,EAAE,mBAAmB,mBAAmB,OAAO,SAAS,KAAK,CAAC;EAEpE,IAAI,CAAC,mBACH,QAAQ,MAAM,wBAAwB;EAGxC,MAAM,OAAO,eAAgC;GAC3C,IAAI,EAAE,SAAS;GACf,IAAI,SAAS,KAAA,GAAW,OAAO;GAC/B,IAAI,SAAS,QAAQ,OAAO;GAE5B,IAAI,OAAO,SAAS,UAAU,OAAO;GAErC,MAAM,aAAa,mBAAmB;GAEtC,IAAI,CAAC,YAAY,OAAO,KAAK;GAC7B,OAAO,KAAK,WAAW,SAAS,KAAK;EACvC,CAAC;EAED,MAAM,QAAQ,eAA8B;GAC1C,OAAO,EAAE,YAAY,KAAK,UAAU,SAAS,WAAW,QAAQ,KAAK,QAAQ;EAC/E,CAAC;EAED,YACQ,MAAM,OACX,SAAS;GACR,IAAI,OAAO,SAAS,UAClB,gBAAgB,IAAI,KAAK;QAEzB,gBAAgB,OAAO,KAAK;EAEhC,GACA,EAAE,WAAW,KAAK,CACpB;;UAnD2D,KAAA,UAAI,KAAA,UAAA,GAA7D,YAEY,wBAFI,QAAA,GAAG,GAAA;;IAAG,OAAK,eAAE,MAAA,KAAK;IAAG,OAAK,eAAE,MAAA,GAAA,EAAI,CAAC;;2BACvC,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"grid-item.js","names":[],"sources":["../../../src/components/grid/grid-item.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :style=\"style\" :class=\"cls.b\" v-if=\"span !== 0\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed, inject, type CSSProperties, watch } from 'vue'\n\nimport type { GridItemProps } from '../../types'\nimport { GridDIKey } from './di'\n\ndefineOptions({ name: 'UGridItem' })\n\nconst props = withDefaults(defineProps<GridItemProps>(), { tag: 'div' })\n\nconst cls = bem('grid-item')\n\nconst { currentBreakpoint, gridItemsProps } = inject(GridDIKey) ?? {}\n\nif (!currentBreakpoint) {\n console.error('GridItem组件仅能在Grid组件中使用')\n}\n\nconst span = computed<number | 'full'>(() => {\n let { span } = props\n if (span === undefined) return 1\n if (span === 'full') return 'full'\n\n if (typeof span === 'number') return span\n\n const breakpoint = currentBreakpoint?.value\n\n if (!breakpoint) return span.default\n return span[breakpoint.name] ?? span.default\n})\n\nconst style = computed<CSSProperties>(() => {\n return { gridColumn: span.value === 'full' ? '1 / -1' : `span ${span.value}` }\n})\n\nwatch(\n () => props.span,\n (span) => {\n if (typeof span === 'object') {\n gridItemsProps?.add(props)\n } else {\n gridItemsProps?.delete(props)\n }\n },\n { immediate: true }\n)\n</script>\n"],"mappings":";;;;;;;;;;;;EAeA,MAAM,QAAQ;EAEd,MAAM,MAAM,IAAI,WAAW;EAE3B,MAAM,EAAE,mBAAmB,mBAAmB,OAAO,SAAS,KAAK,CAAC;EAEpE,IAAI,CAAC,mBACH,QAAQ,MAAM,wBAAwB;EAGxC,MAAM,OAAO,eAAgC;GAC3C,IAAI,EAAE,SAAS;GACf,IAAI,SAAS,KAAA,GAAW,OAAO;GAC/B,IAAI,SAAS,QAAQ,OAAO;GAE5B,IAAI,OAAO,SAAS,UAAU,OAAO;GAErC,MAAM,aAAa,mBAAmB;GAEtC,IAAI,CAAC,YAAY,OAAO,KAAK;GAC7B,OAAO,KAAK,WAAW,SAAS,KAAK;EACvC,CAAC;EAED,MAAM,QAAQ,eAA8B;GAC1C,OAAO,EAAE,YAAY,KAAK,UAAU,SAAS,WAAW,QAAQ,KAAK,QAAQ;EAC/E,CAAC;EAED,YACQ,MAAM,OACX,SAAS;GACR,IAAI,OAAO,SAAS,UAClB,gBAAgB,IAAI,KAAK;QAEzB,gBAAgB,OAAO,KAAK;EAEhC,GACA,EAAE,WAAW,KAAK,CACpB;;UAnD2D,KAAA,UAAI,KAAA,UAAA,GAA7D,YAEY,wBAFI,QAAA,GAAG,GAAA;;IAAG,OAAK,eAAE,MAAA,KAAK;IAAG,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC;;2BACvC,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -4,8 +4,8 @@ import { useResponsive } from "./use-responsive.js";
4
4
  import { computed, createBlock, defineComponent, normalizeClass, openBlock, provide, renderSlot, resolveDynamicComponent, unref, useTemplateRef, watch, withCtx } from "vue";
5
5
  import { bem, removeStyles, setStyles, withUnit } from "@veltra/utils";
6
6
  //#region src/components/grid/grid.vue
7
- const _sfc_main = /* @__PURE__ */ defineComponent({
8
- name: "Grid",
7
+ const _sfc_main = /*@__PURE__*/ defineComponent({
8
+ name: "UGrid",
9
9
  __name: "grid",
10
10
  props: {
11
11
  cols: {},
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","names":[],"sources":["../../../src/components/grid/grid.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"cls.b\" ref=\"grid\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem, removeStyles, setStyles, withUnit } from '@veltra/utils'\nimport { type CSSProperties, provide, watch, useTemplateRef, computed } from 'vue'\n\nimport type { GridProps, GridEmits, _GridExposed } from '../../types'\nimport { getBreakpointCols } from './breakpoint'\nimport { GridDIKey } from './di'\nimport { useResponsive } from './use-responsive'\n\ndefineOptions({ name: 'Grid' })\n\nconst props = withDefaults(defineProps<GridProps>(), { tag: 'div' })\n\nconst emit = defineEmits<GridEmits>()\n\nconst cls = bem('grid')\n\nconst gridRef = useTemplateRef<HTMLElement>('grid')\n\nconst { currentBreakpoint, gridItemsProps } = useResponsive({ props, emit, gridRef })\n\nconst styles = computed(() => {\n const { gap, cols } = props\n const result: CSSProperties = {}\n\n // 间距\n if (typeof gap === 'number') {\n if (gap > 0) {\n result.rowGap = result.columnGap = gap + 'px'\n }\n } else if (typeof gap === 'string') {\n const [rowGap, columnGap] = gap.split(' ')\n result.columnGap = withUnit(columnGap || rowGap, 'px')\n result.rowGap = withUnit(rowGap, 'px')\n }\n\n const breakpoint = currentBreakpoint.value\n\n switch (typeof cols) {\n case 'number':\n result.gridTemplateColumns = `repeat(${cols}, minmax(0px, 1fr))`\n break\n case 'function':\n if (breakpoint) {\n result.gridTemplateColumns = `repeat(${cols(breakpoint)}, minmax(0px, 1fr))`\n }\n break\n case 'object':\n if (breakpoint) {\n const amount = getBreakpointCols(cols, breakpoint)\n result.gridTemplateColumns = `repeat(${amount}, minmax(0px, 1fr))`\n }\n }\n\n return result\n})\n\nwatch([styles, gridRef], ([styles, dom]) => {\n if (!dom) return\n\n // 重置并移除样式\n removeStyles(dom, ['gridTemplateColumns', 'columnGap', 'rowGap'])\n setStyles(dom, styles)\n})\n\nprovide(GridDIKey, { currentBreakpoint, gridItemsProps })\n\ndefineExpose<_GridExposed>({ el: gridRef })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EAiBA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,MAAM;EAEtB,MAAM,UAAU,eAA4B,MAAM;EAElD,MAAM,EAAE,mBAAmB,mBAAmB,cAAc;GAAE;GAAO;GAAM;EAAQ,CAAC;EAsCpF,MAAM,CApCS,eAAe;GAC5B,MAAM,EAAE,KAAK,SAAS;GACtB,MAAM,SAAwB,CAAC;GAG/B,IAAI,OAAO,QAAQ;QACb,MAAM,GACR,OAAO,SAAS,OAAO,YAAY,MAAM;GAAA,OAEtC,IAAI,OAAO,QAAQ,UAAU;IAClC,MAAM,CAAC,QAAQ,aAAa,IAAI,MAAM,GAAG;IACzC,OAAO,YAAY,SAAS,aAAa,QAAQ,IAAI;IACrD,OAAO,SAAS,SAAS,QAAQ,IAAI;GACvC;GAEA,MAAM,aAAa,kBAAkB;GAErC,QAAQ,OAAO,MAAf;IACE,KAAK;KACH,OAAO,sBAAsB,UAAU,KAAK;KAC5C;IACF,KAAK;KACH,IAAI,YACF,OAAO,sBAAsB,UAAU,KAAK,UAAU,EAAE;KAE1D;IACF,KAAK,UACH,IAAI,YAEF,OAAO,sBAAsB,UADd,kBAAkB,MAAM,UACA,EAAO;GAEpD;GAEA,OAAO;EACT,CAEO,GAAQ,OAAO,IAAI,CAAC,QAAQ,SAAS;GAC1C,IAAI,CAAC,KAAK;GAGV,aAAa,KAAK;IAAC;IAAuB;IAAa;GAAQ,CAAC;GAChE,UAAU,KAAK,MAAM;EACvB,CAAC;EAED,QAAQ,WAAW;GAAE;GAAmB;EAAe,CAAC;EAExD,SAA2B,EAAE,IAAI,QAAQ,CAAC;;uBAxExC,YAEY,wBAFI,QAAA,GAAG,GAAA;IAAG,OAAK,eAAE,MAAA,GAAA,EAAI,CAAC;IAAE,KAAI;;2BAC9B,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"grid.js","names":[],"sources":["../../../src/components/grid/grid.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"cls.b\" ref=\"grid\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem, removeStyles, setStyles, withUnit } from '@veltra/utils'\nimport { type CSSProperties, provide, watch, useTemplateRef, computed } from 'vue'\n\nimport type { GridProps, GridEmits, _GridExposed } from '../../types'\nimport { getBreakpointCols } from './breakpoint'\nimport { GridDIKey } from './di'\nimport { useResponsive } from './use-responsive'\n\ndefineOptions({ name: 'UGrid' })\n\nconst props = withDefaults(defineProps<GridProps>(), { tag: 'div' })\n\nconst emit = defineEmits<GridEmits>()\n\nconst cls = bem('grid')\n\nconst gridRef = useTemplateRef<HTMLElement>('grid')\n\nconst { currentBreakpoint, gridItemsProps } = useResponsive({ props, emit, gridRef })\n\nconst styles = computed(() => {\n const { gap, cols } = props\n const result: CSSProperties = {}\n\n // 间距\n if (typeof gap === 'number') {\n if (gap > 0) {\n result.rowGap = result.columnGap = gap + 'px'\n }\n } else if (typeof gap === 'string') {\n const [rowGap, columnGap] = gap.split(' ')\n result.columnGap = withUnit(columnGap || rowGap, 'px')\n result.rowGap = withUnit(rowGap, 'px')\n }\n\n const breakpoint = currentBreakpoint.value\n\n switch (typeof cols) {\n case 'number':\n result.gridTemplateColumns = `repeat(${cols}, minmax(0px, 1fr))`\n break\n case 'function':\n if (breakpoint) {\n result.gridTemplateColumns = `repeat(${cols(breakpoint)}, minmax(0px, 1fr))`\n }\n break\n case 'object':\n if (breakpoint) {\n const amount = getBreakpointCols(cols, breakpoint)\n result.gridTemplateColumns = `repeat(${amount}, minmax(0px, 1fr))`\n }\n }\n\n return result\n})\n\nwatch([styles, gridRef], ([styles, dom]) => {\n if (!dom) return\n\n // 重置并移除样式\n removeStyles(dom, ['gridTemplateColumns', 'columnGap', 'rowGap'])\n setStyles(dom, styles)\n})\n\nprovide(GridDIKey, { currentBreakpoint, gridItemsProps })\n\ndefineExpose<_GridExposed>({ el: gridRef })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EAiBA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,MAAM;EAEtB,MAAM,UAAU,eAA4B,MAAM;EAElD,MAAM,EAAE,mBAAmB,mBAAmB,cAAc;GAAE;GAAO;GAAM;EAAQ,CAAC;EAsCpF,MAAM,CApCS,eAAe;GAC5B,MAAM,EAAE,KAAK,SAAS;GACtB,MAAM,SAAwB,CAAC;GAG/B,IAAI,OAAO,QAAQ;QACb,MAAM,GACR,OAAO,SAAS,OAAO,YAAY,MAAM;GAAA,OAEtC,IAAI,OAAO,QAAQ,UAAU;IAClC,MAAM,CAAC,QAAQ,aAAa,IAAI,MAAM,GAAG;IACzC,OAAO,YAAY,SAAS,aAAa,QAAQ,IAAI;IACrD,OAAO,SAAS,SAAS,QAAQ,IAAI;GACvC;GAEA,MAAM,aAAa,kBAAkB;GAErC,QAAQ,OAAO,MAAf;IACE,KAAK;KACH,OAAO,sBAAsB,UAAU,KAAK;KAC5C;IACF,KAAK;KACH,IAAI,YACF,OAAO,sBAAsB,UAAU,KAAK,UAAU,EAAE;KAE1D;IACF,KAAK,UACH,IAAI,YAEF,OAAO,sBAAsB,UADd,kBAAkB,MAAM,UACA,EAAO;GAEpD;GAEA,OAAO;EACT,CAEO,GAAQ,OAAO,IAAI,CAAC,QAAQ,SAAS;GAC1C,IAAI,CAAC,KAAK;GAGV,aAAa,KAAK;IAAC;IAAuB;IAAa;GAAQ,CAAC;GAChE,UAAU,KAAK,MAAM;EACvB,CAAC;EAED,QAAQ,WAAW;GAAE;GAAmB;EAAe,CAAC;EAExD,SAA2B,EAAE,IAAI,QAAQ,CAAC;;uBAxExC,YAEY,wBAFI,QAAA,GAAG,GAAA;IAAG,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC;IAAE,KAAI;;2BAC9B,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -7,8 +7,8 @@ const _hoisted_1 = [
7
7
  "onFocus",
8
8
  "onBlur"
9
9
  ];
10
- const _sfc_main = /* @__PURE__ */ defineComponent({
11
- name: "GridInput",
10
+ const _sfc_main = /*@__PURE__*/ defineComponent({
11
+ name: "UGridInput",
12
12
  __name: "grid-input",
13
13
  props: {
14
14
  modelValue: {},
@@ -1 +1 @@
1
- {"version":3,"file":"grid-input.js","names":[],"sources":["../../../src/components/grid-input/grid-input.vue"],"sourcesContent":["<template>\n <ul :class=\"[cls.b, cls.m(size)]\">\n <li\n v-for=\"(_, index) in length\"\n :key=\"index\"\n tabindex=\"0\"\n @keydown=\"onKeydown($event, valueArray[index]!, index)\"\n @focus=\"focus(index)\"\n @blur=\"index === position && (blur = true)\"\n ref=\"items\"\n :class=\"[cls.e('item'), bem.is('focus', index === position && !blur)]\"\n >\n <span :class=\"cls.em('item', 'text')\" v-if=\"valueArray[index]\">\n {{ valueArray[index] }}\n </span>\n\n <span :class=\"cls.em('item', 'cursor')\" v-else-if=\"index === position\"></span>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { bem } from '@veltra/utils'\nimport { computed, ref, getCurrentInstance } from 'vue'\n\nimport type { GridInputProps, GridInputEmits, GridInputExposed } from '../../types'\n\ndefineOptions({ name: 'GridInput' })\n\nconst emit = defineEmits<GridInputEmits>()\n\nconst props = withDefaults(defineProps<GridInputProps>(), {\n length: 6,\n zero: false,\n separator: '-'\n})\n\nconst { size } = useFallbackProps([props], { size: 'default' })\n\nconst cls = bem('grid-input')\n\nconst _numberReg = computed(() => (props.zero ? /^[0-9]$/ : /^[1-9]$/))\n\nconst valueArray = ref<string[]>([])\n\nconst position = ref<number>(-1)\n\nconst blur = ref<boolean>(false)\n\nconst instance = getCurrentInstance()\n\nconst focus = async (index?: number) => {\n if (index === undefined) {\n focus(position.value)\n return\n }\n if (index !== 0 && index > valueArray.value.length) {\n index = valueArray.value.length\n }\n position.value = index\n const items = (instance?.refs as { items?: unknown })?.items as any\n let dom = items?.[index]\n dom?.focus()\n blur.value = false\n}\n\nconst changeValue = (value: string, index: number) => {\n if (position.value === props.length) return\n const currentValue = valueArray.value[index]\n\n if (currentValue) {\n valueArray.value.splice(index, 1, value)\n } else if (index === valueArray.value.length) {\n valueArray.value.push(value)\n } else {\n return\n }\n position.value++\n focus()\n\n emit('input', valueArray.value.filter((v) => v).join(props.separator))\n}\n\nconst baseOperation = {\n Backspace: (value: string, index: number) => {\n if (value) {\n valueArray.value.splice(index, 1)\n } else if (index - 1 >= 0) {\n valueArray.value.splice(index - 1, 1)\n }\n if (index !== 0) {\n focus(index - 1)\n }\n emit('input', valueArray.value.filter((v) => v).join(props.separator))\n },\n ArrowLeft: (value: string, index: number) => {\n if (index === 0) return\n focus(index - 1)\n },\n ArrowRight: (value: string, index: number) => {\n if (index === valueArray.value.length) return\n focus(index + 1)\n }\n}\n\nconst onKeydown = (e: any, value: string, index: number) => {\n if (_numberReg.value.test(e.key)) {\n changeValue(e.key, index)\n return\n }\n baseOperation[e.key](value, index)\n}\n\nconst clear = () => {\n while (valueArray.value.length) {\n valueArray.value.pop()\n }\n}\n\ndefineExpose<GridInputExposed>({ clear })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,OAAO;EAEb,MAAM,QAAQ;EAMd,MAAM,EAAE,SAAS,iBAAiB,CAAC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;EAE9D,MAAM,MAAM,IAAI,YAAY;EAE5B,MAAM,aAAa,eAAgB,MAAM,OAAO,YAAY,SAAU;EAEtE,MAAM,aAAa,IAAc,CAAC,CAAC;EAEnC,MAAM,WAAW,IAAY,EAAE;EAE/B,MAAM,OAAO,IAAa,KAAK;EAE/B,MAAM,WAAW,mBAAmB;EAEpC,MAAM,QAAQ,OAAO,UAAmB;GACtC,IAAI,UAAU,KAAA,GAAW;IACvB,MAAM,SAAS,KAAK;IACpB;GACF;GACA,IAAI,UAAU,KAAK,QAAQ,WAAW,MAAM,QAC1C,QAAQ,WAAW,MAAM;GAE3B,SAAS,QAAQ;GAGjB,GAFe,UAAU,OAA8B,SACrC,SACb,MAAM;GACX,KAAK,QAAQ;EACf;EAEA,MAAM,eAAe,OAAe,UAAkB;GACpD,IAAI,SAAS,UAAU,MAAM,QAAQ;GAGrC,IAFqB,WAAW,MAAM,QAGpC,WAAW,MAAM,OAAO,OAAO,GAAG,KAAK;QAClC,IAAI,UAAU,WAAW,MAAM,QACpC,WAAW,MAAM,KAAK,KAAK;QAE3B;GAEF,SAAS;GACT,MAAM;GAEN,KAAK,SAAS,WAAW,MAAM,QAAQ,MAAM,CAAC,EAAE,K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AA,GAAU,MAAA,GAAA,EAAI,GAAE,SAAU,UAAU,SAAA,SAAQ,CAAK,KAAA,KAAI,CAAA,CAAA;QAEvB,WAAA,MAAW,UAAA,UAAA,GAAvD,mBAEO,QAAA;;KAFA,OAAK,eAAE,MAAA,GAAA,EAAI,GAAE,QAAA,MAAA,CAAA;uBACf,WAAA,MAAW,MAAK,GAAA,CAAA,KAG8B,UAAU,SAAA,SAAA,UAAA,GAA7D,mBAA8E,QAAA;;KAAvE,OAAK,eAAE,MAAA,GAAA,EAAI,GAAE,QAAA,QAAA,CAAA"}
1
+ {"version":3,"file":"grid-input.js","names":[],"sources":["../../../src/components/grid-input/grid-input.vue"],"sourcesContent":["<template>\n <ul :class=\"[cls.b, cls.m(size)]\">\n <li\n v-for=\"(_, index) in length\"\n :key=\"index\"\n tabindex=\"0\"\n @keydown=\"onKeydown($event, valueArray[index]!, index)\"\n @focus=\"focus(index)\"\n @blur=\"index === position && (blur = true)\"\n ref=\"items\"\n :class=\"[cls.e('item'), bem.is('focus', index === position && !blur)]\"\n >\n <span :class=\"cls.em('item', 'text')\" v-if=\"valueArray[index]\">\n {{ valueArray[index] }}\n </span>\n\n <span :class=\"cls.em('item', 'cursor')\" v-else-if=\"index === position\"></span>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { bem } from '@veltra/utils'\nimport { computed, ref, getCurrentInstance } from 'vue'\n\nimport type { GridInputProps, GridInputEmits, GridInputExposed } from '../../types'\n\ndefineOptions({ name: 'UGridInput' })\n\nconst emit = defineEmits<GridInputEmits>()\n\nconst props = withDefaults(defineProps<GridInputProps>(), {\n length: 6,\n zero: false,\n separator: '-'\n})\n\nconst { size } = useFallbackProps([props], { size: 'default' })\n\nconst cls = bem('grid-input')\n\nconst _numberReg = computed(() => (props.zero ? /^[0-9]$/ : /^[1-9]$/))\n\nconst valueArray = ref<string[]>([])\n\nconst position = ref<number>(-1)\n\nconst blur = ref<boolean>(false)\n\nconst instance = getCurrentInstance()\n\nconst focus = async (index?: number) => {\n if (index === undefined) {\n focus(position.value)\n return\n }\n if (index !== 0 && index > valueArray.value.length) {\n index = valueArray.value.length\n }\n position.value = index\n const items = (instance?.refs as { items?: unknown })?.items as any\n let dom = items?.[index]\n dom?.focus()\n blur.value = false\n}\n\nconst changeValue = (value: string, index: number) => {\n if (position.value === props.length) return\n const currentValue = valueArray.value[index]\n\n if (currentValue) {\n valueArray.value.splice(index, 1, value)\n } else if (index === valueArray.value.length) {\n valueArray.value.push(value)\n } else {\n return\n }\n position.value++\n focus()\n\n emit('input', valueArray.value.filter((v) => v).join(props.separator))\n}\n\nconst baseOperation = {\n Backspace: (value: string, index: number) => {\n if (value) {\n valueArray.value.splice(index, 1)\n } else if (index - 1 >= 0) {\n valueArray.value.splice(index - 1, 1)\n }\n if (index !== 0) {\n focus(index - 1)\n }\n emit('input', valueArray.value.filter((v) => v).join(props.separator))\n },\n ArrowLeft: (value: string, index: number) => {\n if (index === 0) return\n focus(index - 1)\n },\n ArrowRight: (value: string, index: number) => {\n if (index === valueArray.value.length) return\n focus(index + 1)\n }\n}\n\nconst onKeydown = (e: any, value: string, index: number) => {\n if (_numberReg.value.test(e.key)) {\n changeValue(e.key, index)\n return\n }\n baseOperation[e.key](value, index)\n}\n\nconst clear = () => {\n while (valueArray.value.length) {\n valueArray.value.pop()\n }\n}\n\ndefineExpose<GridInputExposed>({ clear })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,OAAO;EAEb,MAAM,QAAQ;EAMd,MAAM,EAAE,SAAS,iBAAiB,CAAC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;EAE9D,MAAM,MAAM,IAAI,YAAY;EAE5B,MAAM,aAAa,eAAgB,MAAM,OAAO,YAAY,SAAU;EAEtE,MAAM,aAAa,IAAc,CAAC,CAAC;EAEnC,MAAM,WAAW,IAAY,EAAE;EAE/B,MAAM,OAAO,IAAa,KAAK;EAE/B,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EAAE,IAAI,CAAC,OAAO,KAAK;EACnC;EAEA,MAAM,cAAc;GAClB,OAAO,WAAW,MAAM,QACtB,WAAW,MAAM,IAAI;EAEzB;EAEA,SAA+B,EAAE,MAAM,CAAC;;uBAvHtC,mBAiBK,MAAA,EAjBA,OAAK,eAAA,CAAG,MAAA,GAAA,CAAG,CAAC,GAAG,MAAA,GAAA,CAAG,CAAC,EAAE,MAAA,IAAA,CAAI,CAAA,CAAA,EAAA,GAAA,EAAA,UAAA,IAAA,GAC5B,mBAeK,UAAA,MAAA,WAdkB,QAAA,SAAb,GAAG,UAAK;wBADlB,mBAeK,MAAA;KAbF,KAAK;KACN,UAAS;KACR,YAAO,WAAE,UAAU,QAAQ,WAAA,MAAW,QAAS,KAAK;KACpD,UAAK,WAAE,MAAM,KAAK;KAClB,SAAI,WAAE,UAAU,SAAA,UAAa,KAAA,QAAI;;KAClC,KAAI;KACH,OAAK,eAAA,CAAG,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,GAAU,MAAA,GAAA,CAAG,CAAC,GAAE,SAAU,UAAU,SAAA,SAAQ,CAAK,KAAA,KAAI,CAAA,CAAA;QAEvB,WAAA,MAAW,UAAA,UAAA,GAAvD,mBAEO,QAAA;;KAFA,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,GAAE,QAAA,MAAA,CAAA;uBACf,WAAA,MAAW,MAAK,GAAA,CAAA,KAG8B,UAAU,SAAA,SAAA,UAAA,GAA7D,mBAA8E,QAAA;;KAAvE,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,GAAE,QAAA,QAAA,CAAA"}
@@ -8,8 +8,8 @@ declare const __VLS_export: import("vue").DefineComponent<GridInputProps, import
8
8
  onInput?: ((value: string) => any) | undefined;
9
9
  }>, {
10
10
  length: number;
11
- separator: string;
12
11
  zero: false;
12
+ separator: string;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  declare const _default: typeof __VLS_export;
15
15
  //#endregion
@@ -6,8 +6,8 @@ import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
6
6
  import { Minus, Plus } from "@veltra/icons/normal";
7
7
  //#region src/components/group-input/group-input.vue
8
8
  const _hoisted_1 = { key: 0 };
9
- const _sfc_main = /* @__PURE__ */ defineComponent({
10
- name: "GroupInput",
9
+ const _sfc_main = /*@__PURE__*/ defineComponent({
10
+ name: "UGroupInput",
11
11
  __name: "group-input",
12
12
  props: {
13
13
  modelValue: { default: () => [] },
@@ -1 +1 @@
1
- {"version":3,"file":"group-input.js","names":[],"sources":["../../../src/components/group-input/group-input.vue"],"sourcesContent":["<template>\n <ul :class=\"[cls.b, cls.m(size)]\" v-if=\"!readonly\">\n <li v-if=\"isEmpty && creatable\">\n <u-button style=\"width: 100%\" :icon=\"Plus\" @click=\"handleAdd(0)\" :size=\"size\">\n 新增\n </u-button>\n </li>\n <li v-for=\"(item, index) of items\" :key=\"item.id\" :class=\"cls.e('item')\" :style=\"itemStyle\">\n <slot v-bind=\"{ item: item.data, index }\" />\n <span :class=\"cls.e('actions')\">\n <u-button\n :icon=\"Minus\"\n circle\n :disabled=\"disabled\"\n :size=\"size\"\n @click=\"handleRemove(index)\"\n />\n <u-button\n :icon=\"Plus\"\n circle\n :disabled=\"disabled\"\n :size=\"size\"\n type=\"primary\"\n @click=\"handleAdd(index)\"\n />\n </span>\n </li>\n </ul>\n\n <template v-else-if=\"items?.length\">\n <ul :class=\"[cls.b, cls.m(size)]\">\n <li v-for=\"item of items\" :key=\"item.id\" :class=\"cls.e('item')\">\n <span v-for=\"v in item.data\">{{ v }}</span>\n </li>\n </ul>\n </template>\n\n <template v-else>\n {{ FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup generic=\"GroupItem extends Record<string, any>\">\nimport { useFormFallbackProps } from '@veltra/compositions'\nimport { Minus, Plus } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed } from 'vue'\n\nimport type { GroupInputEmits, GroupInputProps } from '../../types'\nimport { UButton } from '../button'\nimport { useGroupItems } from './use-group-items'\n\ndefineOptions({ name: 'GroupInput' })\n\nconst props = withDefaults(defineProps<GroupInputProps<GroupItem>>(), {\n modelValue: () => [],\n disabled: undefined,\n readonly: undefined,\n creatable: true\n})\n\nconst emit = defineEmits<GroupInputEmits>()\n\nconst cls = bem('group-input')\n\nconst { formProps } = injectFormContext()\nconst { disabled, size, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst { items, createItem, runByEvent } = useGroupItems({ props, emit })\n\nconst isEmpty = computed(() => {\n return !items.value.length\n})\n\nfunction handleAdd(index: number) {\n runByEvent(() => {\n items.value = [\n ...items.value.slice(0, index + 1),\n createItem({}),\n ...items.value.slice(index + 1)\n ]\n })\n}\n\nfunction handleRemove(index: number) {\n runByEvent(() => {\n items.value = [...items.value.slice(0, index), ...items.value.slice(index + 1)]\n })\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAE7B,MAAM,EAAE,cAAc,kBAAkB;EACxC,MAAM,EAAE,UAAU,MAAM,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAAC;EAED,MAAM,EAAE,OAAO,YAAY,eAAe,cAAc;GAAE;GAAO;EAAK,CAAC;EAEvE,MAAM,UAAU,eAAe;GAC7B,OAAO,CAAC,MAAM,MAAM;EACtB,CAAC;EAED,SAAS,UAAU,OAAe;GAChC,iBAAiB;IACf,MAAM,QAAQ;KACZ,GAAG,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;KACjC,WAAW,CAAC,CAAC;KACb,GAAG,MAAM,MAAM,MAAM,QAAQ,CAA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C,MAAM,MAAA,IAAA;KACP,QAAA;KACC,UAAU,MAAA,QAAA;KACV,MAAM,MAAA,IAAA;KACP,MAAK;KACJ,UAAK,WAAE,UAAU,KAAK;;;;;;;qBAMV,MAAA,KAAA,GAAO,UAAA,UAAA,GAC1B,mBAIK,MAAA;;IAJA,OAAK,eAAA,CAAG,MAAA,GAAA,EAAI,GAAG,MAAA,GAAA,EAAI,EAAE,MAAA,IAAA,CAAI,CAAA,CAAA;yBAC5B,mBAEK,UAAA,MAAA,WAFc,MAAA,KAAA,IAAR,SAAI;wBAAf,mBAEK,MAAA;KAFsB,KAAK,KAAK;KAAK,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,MAAA,CAAA;0BACpD,mBAA2C,UAAA,MAAA,WAAzB,KAAK,OAAV,MAAC;yBAAd,mBAA2C,QAAA,MAAA,gBAAX,CAAC,GAAA,CAAA;;mCAKvC,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"group-input.js","names":[],"sources":["../../../src/components/group-input/group-input.vue"],"sourcesContent":["<template>\n <ul :class=\"[cls.b, cls.m(size)]\" v-if=\"!readonly\">\n <li v-if=\"isEmpty && creatable\">\n <u-button style=\"width: 100%\" :icon=\"Plus\" @click=\"handleAdd(0)\" :size=\"size\">\n 新增\n </u-button>\n </li>\n <li v-for=\"(item, index) of items\" :key=\"item.id\" :class=\"cls.e('item')\" :style=\"itemStyle\">\n <slot v-bind=\"{ item: item.data, index }\" />\n <span :class=\"cls.e('actions')\">\n <u-button\n :icon=\"Minus\"\n circle\n :disabled=\"disabled\"\n :size=\"size\"\n @click=\"handleRemove(index)\"\n />\n <u-button\n :icon=\"Plus\"\n circle\n :disabled=\"disabled\"\n :size=\"size\"\n type=\"primary\"\n @click=\"handleAdd(index)\"\n />\n </span>\n </li>\n </ul>\n\n <template v-else-if=\"items?.length\">\n <ul :class=\"[cls.b, cls.m(size)]\">\n <li v-for=\"item of items\" :key=\"item.id\" :class=\"cls.e('item')\">\n <span v-for=\"v in item.data\">{{ v }}</span>\n </li>\n </ul>\n </template>\n\n <template v-else>\n {{ FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup generic=\"GroupItem extends Record<string, any>\">\nimport { useFormFallbackProps } from '@veltra/compositions'\nimport { Minus, Plus } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed } from 'vue'\n\nimport type { GroupInputEmits, GroupInputProps } from '../../types'\nimport { UButton } from '../button'\nimport { useGroupItems } from './use-group-items'\n\ndefineOptions({ name: 'UGroupInput' })\n\nconst props = withDefaults(defineProps<GroupInputProps<GroupItem>>(), {\n modelValue: () => [],\n disabled: undefined,\n readonly: undefined,\n creatable: true\n})\n\nconst emit = defineEmits<GroupInputEmits>()\n\nconst cls = bem('group-input')\n\nconst { formProps } = injectFormContext()\nconst { disabled, size, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst { items, createItem, runByEvent } = useGroupItems({ props, emit })\n\nconst isEmpty = computed(() => {\n return !items.value.length\n})\n\nfunction handleAdd(index: number) {\n runByEvent(() => {\n items.value = [\n ...items.value.slice(0, index + 1),\n createItem({}),\n ...items.value.slice(index + 1)\n ]\n })\n}\n\nfunction handleRemove(index: number) {\n runByEvent(() => {\n items.value = [...items.value.slice(0, index), ...items.value.slice(index + 1)]\n })\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAE7B,MAAM,EAAE,cAAc,kBAAkB;EACxC,MAAM,EAAE,UAAU,MAAM,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GA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A4C,KAAA,QAAA,WAA5C,WAA4C,EAAA,SAAA,KAAA,GAAA;KAAA,MAAtB,KAAK;KAAM;IAAK,CAAA,CAAA,GACtC,mBAgBO,QAAA,EAhBA,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,SAAA,CAAA,EAAA,GAAA,CACjB,YAME,MAAA,WAAA,GAAA;KALC,MAAM,MAAA,KAAA;KACP,QAAA;KACC,UAAU,MAAA,QAAA;KACV,MAAM,MAAA,IAAA;KACN,UAAK,WAAE,aAAa,KAAK;;;;;;QAE5B,YAOE,MAAA,WAAA,GAAA;KANC,MAAM,MAAA,IAAA;KACP,QAAA;KACC,UAAU,MAAA,QAAA;KACV,MAAM,MAAA,IAAA;KACP,MAAK;KACJ,UAAK,WAAE,UAAU,KAAK;;;;;;;qBAMV,MAAA,KAAA,CAAK,EAAE,UAAA,UAAA,GAC1B,mBAIK,MAAA;;IAJA,OAAK,eAAA,CAAG,MAAA,GAAA,CAAG,CAAC,GAAG,MAAA,GAAA,CAAG,CAAC,EAAE,MAAA,IAAA,CAAI,CAAA,CAAA;yBAC5B,mBAEK,UAAA,MAAA,WAFc,MAAA,KAAA,IAAR,SAAI;wBAAf,mBAEK,MAAA;KAFsB,KAAK,KAAK;KAAK,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,CAAA;0BACpD,mBAA2C,UAAA,MAAA,WAAzB,KAAK,OAAV,MAAC;yBAAd,mBAA2C,QAAA,MAAA,gBAAX,CAAC,GAAA,CAAA;;mCAKvC,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
@@ -1,8 +1,8 @@
1
1
  import { computed, createElementBlock, defineComponent, normalizeClass, normalizeStyle, openBlock, renderSlot, unref } from "vue";
2
2
  import { bem, withUnit } from "@veltra/utils";
3
3
  //#region src/components/icon/icon.vue
4
- const _sfc_main = /* @__PURE__ */ defineComponent({
5
- name: "Icon",
4
+ const _sfc_main = /*@__PURE__*/ defineComponent({
5
+ name: "UIcon",
6
6
  __name: "icon",
7
7
  props: { size: {} },
8
8
  setup(__props) {
@@ -1 +1 @@
1
- {"version":3,"file":"icon.js","names":[],"sources":["../../../src/components/icon/icon.vue"],"sourcesContent":["<template>\n <i :class=\"cls.b\" :style=\"style\">\n <slot></slot>\n </i>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem, withUnit } from '@veltra/utils'\nimport { type CSSProperties, computed } from 'vue'\n\nimport type { IconProps } from '../../types'\n\ndefineOptions({ name: 'Icon' })\n\nconst props = defineProps<IconProps>()\n\nconst cls = bem('icon')\n\nconst style = computed<CSSProperties>(() => {\n return { fontSize: withUnit(props.size, 'px') }\n})\n</script>\n"],"mappings":";;;;;;;;EAcA,MAAM,QAAQ;EAEd,MAAM,MAAM,IAAI,MAAM;EAEtB,MAAM,QAAQ,eAA8B;GAC1C,OAAO,EAAE,UAAU,SAAS,MAAM,MAAM,IAAI,EAAE;EAChD,CAAC;;uBAnBC,mBAEI,KAAA;IAFA,OAAK,eAAE,MAAA,GAAA,EAAI,CAAC;IAAG,OAAK,eAAE,MAAA,KAAK;OAC7B,WAAa,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"icon.js","names":[],"sources":["../../../src/components/icon/icon.vue"],"sourcesContent":["<template>\n <i :class=\"cls.b\" :style=\"style\">\n <slot></slot>\n </i>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem, withUnit } from '@veltra/utils'\nimport { type CSSProperties, computed } from 'vue'\n\nimport type { IconProps } from '../../types'\n\ndefineOptions({ name: 'UIcon' })\n\nconst props = defineProps<IconProps>()\n\nconst cls = bem('icon')\n\nconst style = computed<CSSProperties>(() => {\n return { fontSize: withUnit(props.size, 'px') }\n})\n</script>\n"],"mappings":";;;;;;;;EAcA,MAAM,QAAQ;EAEd,MAAM,MAAM,IAAI,MAAM;EAEtB,MAAM,QAAQ,eAA8B;GAC1C,OAAO,EAAE,UAAU,SAAS,MAAM,MAAM,IAAI,EAAE;EAChD,CAAC;;uBAnBC,mBAEI,KAAA;IAFA,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC;IAAG,OAAK,eAAE,MAAA,KAAK;OAC7B,WAAa,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"inputClass\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n v-if=\"!readonly\"\n >\n <span v-if=\"$slots.prefix || prefix\" :class=\"prefixClass\" @click=\"handlePrefixClick\">\n {{ prefix }}\n <slot name=\"prefix\"></slot>\n </span>\n\n <input\n :class=\"cls.e('native')\"\n :placeholder=\"props.placeholder\"\n type=\"text\"\n :value=\"model\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @compositionstart=\"handleCompositionStart\"\n @compositionend=\"handleCompositionEnd\"\n autocomplete=\"off\"\n ref=\"el\"\n :disabled=\"disabled\"\n :readonly=\"nativeReadonly\"\n />\n\n <span :class=\"suffixClass\" v-if=\"hasSuffix\">\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <UIcon\n v-if=\"showClear\"\n :class=\"cls.e('clear')\"\n title=\"清除\"\n @click.stop=\"clearModelValue\"\n key=\"clear\"\n >\n <Close />\n </UIcon>\n\n <span v-else :class=\"cls.e('suffix-content')\" @click=\"handleSuffixClick\" key=\"suffix\">\n {{ suffix }}\n <slot name=\"suffix\"></slot>\n </span>\n </Transition>\n </span>\n </div>\n\n <template v-else>\n {{ generateModel || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { useFocus, useFormFallbackProps } from '@veltra/compositions'\nimport { Close } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, getCurrentInstance, ref, shallowRef, nextTick } from 'vue'\n\nimport type { InputEmits, InputProps, _InputExposed } from '../../types'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'Input' })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n placeholder: '请输入',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<InputEmits>()\n\nconst model = defineModel<string>()\n\nconst inst = getCurrentInstance()\n\nconst cls = bem('input')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])\n\nconst { focus, handleBlur, handleFocus } = useFocus((focused) => {\n if (focused) {\n emit('focus')\n } else {\n emit('blur')\n }\n})\n\nconst inputClass = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('disabled', disabled.value),\n bem.is('readonly', readonly.value),\n bem.is('focus', focus.value)\n ]\n})\n\nconst prefixClass = [cls.e('prefix'), bem.is('clickable', !!inst?.vnode.props?.['onPrefix:click'])]\n\nconst suffixClass = [cls.e('suffix'), bem.is('clickable', !!inst?.vnode.props?.['onSuffix:click'])]\n\nlet isComposing = false\n\nfunction handleCompositionStart() {\n isComposing = true\n}\n\nfunction handleCompositionEnd(e: Event) {\n isComposing = false\n handleInput(e)\n}\n\nconst handleInput = (e: Event) => {\n if (isComposing) return\n\n const inputVal = (e.target as HTMLInputElement).value\n emit('native:input', e)\n\n const valid = props.pattern?.test(inputVal) ?? true\n\n if (!valid) return\n model.value = inputVal\n}\n\nconst handlePrefixClick = () => {\n emit('prefix:click', model.value)\n}\n\nconst handleSuffixClick = () => {\n emit('suffix:click', model.value)\n}\n\nconst clearModelValue = () => {\n model.value = ''\n emit('clear')\n}\n\nconst hovered = ref(false)\nconst handleMouseEnter = () => {\n hovered.value = true\n}\n\nconst handleMouseLeave = () => {\n hovered.value = false\n}\n\nconst showClear = computed(() => {\n return props.clearable && !disabled.value && !!model.value && hovered.value\n})\n\nconst hasSuffixContent = computed(() => {\n return !!inst?.slots.suffix || !!props.suffix\n})\n\nconst hasSuffix = computed(() => {\n return hasSuffixContent.value || showClear.value\n})\n\nconst handleChange = (e: Event) => {\n const target = e.target as HTMLInputElement\n\n const valid = props.pattern?.test(target.value) ?? true\n\n if (valid) {\n emit('change', target.value)\n } else {\n nextTick(() => {\n target.value = model.value ?? ''\n })\n }\n}\n\nconst el = shallowRef<HTMLInputElement>()\n\nconst generateModel = computed(() => {\n if (!model.value) return ''\n\n return `${props.prefix ?? ''}${model.value}${props.suffix ?? ''}`\n})\n\ndefineExpose<_InputExposed>({ el })\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"inputClass\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n v-if=\"!readonly\"\n >\n <span v-if=\"$slots.prefix || prefix\" :class=\"prefixClass\" @click=\"handlePrefixClick\">\n {{ prefix }}\n <slot name=\"prefix\"></slot>\n </span>\n\n <input\n :class=\"cls.e('native')\"\n :placeholder=\"props.placeholder\"\n type=\"text\"\n :value=\"model\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @compositionstart=\"handleCompositionStart\"\n @compositionend=\"handleCompositionEnd\"\n autocomplete=\"off\"\n ref=\"el\"\n :disabled=\"disabled\"\n :readonly=\"nativeReadonly\"\n />\n\n <span :class=\"suffixClass\" v-if=\"hasSuffix\">\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <UIcon\n v-if=\"showClear\"\n :class=\"cls.e('clear')\"\n title=\"清除\"\n @click.stop=\"clearModelValue\"\n key=\"clear\"\n >\n <Close />\n </UIcon>\n\n <span v-else :class=\"cls.e('suffix-content')\" @click=\"handleSuffixClick\" key=\"suffix\">\n {{ suffix }}\n <slot name=\"suffix\"></slot>\n </span>\n </Transition>\n </span>\n </div>\n\n <template v-else>\n {{ generateModel || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { useFocus, useFormFallbackProps } from '@veltra/compositions'\nimport { Close } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, getCurrentInstance, ref, shallowRef, nextTick } from 'vue'\n\nimport type { InputEmits, InputProps, _InputExposed } from '../../types'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UInput' })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n placeholder: '请输入',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<InputEmits>()\n\nconst model = defineModel<string>()\n\nconst inst = getCurrentInstance()\n\nconst cls = bem('input')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])\n\nconst { focus, handleBlur, handleFocus } = useFocus((focused) => {\n if (focused) {\n emit('focus')\n } else {\n emit('blur')\n }\n})\n\nconst inputClass = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('disabled', disabled.value),\n bem.is('readonly', readonly.value),\n bem.is('focus', focus.value)\n ]\n})\n\nconst prefixClass = [cls.e('prefix'), bem.is('clickable', !!inst?.vnode.props?.['onPrefix:click'])]\n\nconst suffixClass = [cls.e('suffix'), bem.is('clickable', !!inst?.vnode.props?.['onSuffix:click'])]\n\nlet isComposing = false\n\nfunction handleCompositionStart() {\n isComposing = true\n}\n\nfunction handleCompositionEnd(e: Event) {\n isComposing = false\n handleInput(e)\n}\n\nconst handleInput = (e: Event) => {\n if (isComposing) return\n\n const inputVal = (e.target as HTMLInputElement).value\n emit('native:input', e)\n\n const valid = props.pattern?.test(inputVal) ?? true\n\n if (!valid) return\n model.value = inputVal\n}\n\nconst handlePrefixClick = () => {\n emit('prefix:click', model.value)\n}\n\nconst handleSuffixClick = () => {\n emit('suffix:click', model.value)\n}\n\nconst clearModelValue = () => {\n model.value = ''\n emit('clear')\n}\n\nconst hovered = ref(false)\nconst handleMouseEnter = () => {\n hovered.value = true\n}\n\nconst handleMouseLeave = () => {\n hovered.value = false\n}\n\nconst showClear = computed(() => {\n return props.clearable && !disabled.value && !!model.value && hovered.value\n})\n\nconst hasSuffixContent = computed(() => {\n return !!inst?.slots.suffix || !!props.suffix\n})\n\nconst hasSuffix = computed(() => {\n return hasSuffixContent.value || showClear.value\n})\n\nconst handleChange = (e: Event) => {\n const target = e.target as HTMLInputElement\n\n const valid = props.pattern?.test(target.value) ?? true\n\n if (valid) {\n emit('change', target.value)\n } else {\n nextTick(() => {\n target.value = model.value ?? ''\n })\n }\n}\n\nconst el = shallowRef<HTMLInputElement>()\n\nconst generateModel = computed(() => {\n if (!model.value) return ''\n\n return `${props.prefix ?? ''}${model.value}${props.suffix ?? ''}`\n})\n\ndefineExpose<_InputExposed>({ el })\n</script>\n"],"mappings":""}
@@ -11,7 +11,7 @@ const _hoisted_1 = [
11
11
  "readonly"
12
12
  ];
13
13
  var input_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
14
- name: "Input",
14
+ name: "UInput",
15
15
  __name: "input",
16
16
  props: /*@__PURE__*/ mergeModels({
17
17
  modelValue: {},
@@ -1 +1 @@
1
- {"version":3,"file":"input.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"inputClass\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n v-if=\"!readonly\"\n >\n <span v-if=\"$slots.prefix || prefix\" :class=\"prefixClass\" @click=\"handlePrefixClick\">\n {{ prefix }}\n <slot name=\"prefix\"></slot>\n </span>\n\n <input\n :class=\"cls.e('native')\"\n :placeholder=\"props.placeholder\"\n type=\"text\"\n :value=\"model\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @compositionstart=\"handleCompositionStart\"\n @compositionend=\"handleCompositionEnd\"\n autocomplete=\"off\"\n ref=\"el\"\n :disabled=\"disabled\"\n :readonly=\"nativeReadonly\"\n />\n\n <span :class=\"suffixClass\" v-if=\"hasSuffix\">\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <UIcon\n v-if=\"showClear\"\n :class=\"cls.e('clear')\"\n title=\"清除\"\n @click.stop=\"clearModelValue\"\n key=\"clear\"\n >\n <Close />\n </UIcon>\n\n <span v-else :class=\"cls.e('suffix-content')\" @click=\"handleSuffixClick\" key=\"suffix\">\n {{ suffix }}\n <slot name=\"suffix\"></slot>\n </span>\n </Transition>\n </span>\n </div>\n\n <template v-else>\n {{ generateModel || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { useFocus, useFormFallbackProps } from '@veltra/compositions'\nimport { Close } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, getCurrentInstance, ref, shallowRef, nextTick } from 'vue'\n\nimport type { InputEmits, InputProps, _InputExposed } from '../../types'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'Input' })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n placeholder: '请输入',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<InputEmits>()\n\nconst model = defineModel<string>()\n\nconst inst = getCurrentInstance()\n\nconst cls = bem('input')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])\n\nconst { focus, handleBlur, handleFocus } = useFocus((focused) => {\n if (focused) {\n emit('focus')\n } else {\n emit('blur')\n }\n})\n\nconst inputClass = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('disabled', disabled.value),\n bem.is('readonly', readonly.value),\n bem.is('focus', focus.value)\n ]\n})\n\nconst prefixClass = [cls.e('prefix'), bem.is('clickable', !!inst?.vnode.props?.['onPrefix:click'])]\n\nconst suffixClass = [cls.e('suffix'), bem.is('clickable', !!inst?.vnode.props?.['onSuffix:click'])]\n\nlet isComposing = false\n\nfunction handleCompositionStart() {\n isComposing = true\n}\n\nfunction handleCompositionEnd(e: Event) {\n isComposing = false\n handleInput(e)\n}\n\nconst handleInput = (e: Event) => {\n if (isComposing) return\n\n const inputVal = (e.target as HTMLInputElement).value\n emit('native:input', e)\n\n const valid = props.pattern?.test(inputVal) ?? true\n\n if (!valid) return\n model.value = inputVal\n}\n\nconst handlePrefixClick = () => {\n emit('prefix:click', model.value)\n}\n\nconst handleSuffixClick = () => {\n emit('suffix:click', model.value)\n}\n\nconst clearModelValue = () => {\n model.value = ''\n emit('clear')\n}\n\nconst hovered = ref(false)\nconst handleMouseEnter = () => {\n hovered.value = true\n}\n\nconst handleMouseLeave = () => {\n hovered.value = false\n}\n\nconst showClear = computed(() => {\n return props.clearable && !disabled.value && !!model.value && hovered.value\n})\n\nconst hasSuffixContent = computed(() => {\n return !!inst?.slots.suffix || !!props.suffix\n})\n\nconst hasSuffix = computed(() => {\n return hasSuffixContent.value || showClear.value\n})\n\nconst handleChange = (e: Event) => {\n const target = e.target as HTMLInputElement\n\n const valid = props.pattern?.test(target.value) ?? true\n\n if (valid) {\n emit('change', target.value)\n } else {\n nextTick(() => {\n target.value = model.value ?? ''\n })\n }\n}\n\nconst el = shallowRef<HTMLInputElement>()\n\nconst generateModel = computed(() => {\n if (!model.value) return ''\n\n return `${props.prefix ?? ''}${model.value}${props.suffix ?? ''}`\n})\n\ndefineExpose<_InputExposed>({ el })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAmB,SAAA,YAAC;EAElC,MAAM,OAAO,mBAAmB;EAEhC,MAAM,MAAM,IAAI,OAAO;EAEvB,MAAM,EAAE,cAAc,kBAA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AAI,OAAA,OAAA,OAAA,MAAA,GAAA,SAAE,MAAA,UAAA,KAAA,MAAA,UAAA,EAAA,GAAA,IAAA;KACN,oBAAkB;KAClB,kBAAgB;KACjB,cAAa;cACT;KAAJ,KAAI;KACH,UAAU,MAAA,QAAA;KACV,UAAU,QAAA;;IAGoB,UAAA,SAAA,UAAA,GAAjC,mBAiBO,QAAA;;KAjBA,OAAK,eAAE,WAAW;QACvB,YAea,YAAA;KAfD,MAAK;KAAU,MAAK;;4BAStB,CAPA,UAAA,SAAA,UAAA,GADR,YAQQ,MAAA,SAAA,GAAA;MANL,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,OAAA,CAAA;MACb,OAAM;MACL,SAAK,cAAO,iBAAe,CAAA,MAAA,CAAA;MAC5B,KAAI;;6BAEK,CAAT,YAAS,MAAA,KAAA,CAAA,CAAA,CAAA;;uCAGX,mBAGO,QAAA;MAHO,OAAK,eAAE,MAAA,GAAA,EAAI,EAAC,gBAAA,CAAA;MAAqB,SAAO;MAAmB,KAAI;yCACxE,QAAA,MAAM,IAAG,KACZ,CAAA,GAAA,WAA2B,KAAA,QAAA,QAAA,CAAA,GAAA,CAAA,EAAA,CAAA;;;2BAMnC,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,cAAA,SAAiB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"input.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../src/components/input/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"inputClass\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n v-if=\"!readonly\"\n >\n <span v-if=\"$slots.prefix || prefix\" :class=\"prefixClass\" @click=\"handlePrefixClick\">\n {{ prefix }}\n <slot name=\"prefix\"></slot>\n </span>\n\n <input\n :class=\"cls.e('native')\"\n :placeholder=\"props.placeholder\"\n type=\"text\"\n :value=\"model\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @compositionstart=\"handleCompositionStart\"\n @compositionend=\"handleCompositionEnd\"\n autocomplete=\"off\"\n ref=\"el\"\n :disabled=\"disabled\"\n :readonly=\"nativeReadonly\"\n />\n\n <span :class=\"suffixClass\" v-if=\"hasSuffix\">\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <UIcon\n v-if=\"showClear\"\n :class=\"cls.e('clear')\"\n title=\"清除\"\n @click.stop=\"clearModelValue\"\n key=\"clear\"\n >\n <Close />\n </UIcon>\n\n <span v-else :class=\"cls.e('suffix-content')\" @click=\"handleSuffixClick\" key=\"suffix\">\n {{ suffix }}\n <slot name=\"suffix\"></slot>\n </span>\n </Transition>\n </span>\n </div>\n\n <template v-else>\n {{ generateModel || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"tsx\" setup>\nimport { useFocus, useFormFallbackProps } from '@veltra/compositions'\nimport { Close } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, getCurrentInstance, ref, shallowRef, nextTick } from 'vue'\n\nimport type { InputEmits, InputProps, _InputExposed } from '../../types'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UInput' })\n\nconst props = withDefaults(defineProps<InputProps>(), {\n placeholder: '请输入',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<InputEmits>()\n\nconst model = defineModel<string>()\n\nconst inst = getCurrentInstance()\n\nconst cls = bem('input')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])\n\nconst { focus, handleBlur, handleFocus } = useFocus((focused) => {\n if (focused) {\n emit('focus')\n } else {\n emit('blur')\n }\n})\n\nconst inputClass = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('disabled', disabled.value),\n bem.is('readonly', readonly.value),\n bem.is('focus', focus.value)\n ]\n})\n\nconst prefixClass = [cls.e('prefix'), bem.is('clickable', !!inst?.vnode.props?.['onPrefix:click'])]\n\nconst suffixClass = [cls.e('suffix'), bem.is('clickable', !!inst?.vnode.props?.['onSuffix:click'])]\n\nlet isComposing = false\n\nfunction handleCompositionStart() {\n isComposing = true\n}\n\nfunction handleCompositionEnd(e: Event) {\n isComposing = false\n handleInput(e)\n}\n\nconst handleInput = (e: Event) => {\n if (isComposing) return\n\n const inputVal = (e.target as HTMLInputElement).value\n emit('native:input', e)\n\n const valid = props.pattern?.test(inputVal) ?? true\n\n if (!valid) return\n model.value = inputVal\n}\n\nconst handlePrefixClick = () => {\n emit('prefix:click', model.value)\n}\n\nconst handleSuffixClick = () => {\n emit('suffix:click', model.value)\n}\n\nconst clearModelValue = () => {\n model.value = ''\n emit('clear')\n}\n\nconst hovered = ref(false)\nconst handleMouseEnter = () => {\n hovered.value = true\n}\n\nconst handleMouseLeave = () => {\n hovered.value = false\n}\n\nconst showClear = computed(() => {\n return props.clearable && !disabled.value && !!model.value && hovered.value\n})\n\nconst hasSuffixContent = computed(() => {\n return !!inst?.slots.suffix || !!props.suffix\n})\n\nconst hasSuffix = computed(() => {\n return hasSuffixContent.value || showClear.value\n})\n\nconst handleChange = (e: Event) => {\n const target = e.target as HTMLInputElement\n\n const valid = props.pattern?.test(target.value) ?? true\n\n if (valid) {\n emit('change', target.value)\n } else {\n nextTick(() => {\n target.value = model.value ?? ''\n })\n }\n}\n\nconst el = shallowRef<HTMLInputElement>()\n\nconst generateModel = computed(() => {\n if (!model.value) return ''\n\n return `${props.prefix ?? ''}${model.value}${props.suffix ?? ''}`\n})\n\ndefineExpose<_InputExposed>({ el })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAmB,SAAA,YAAC;EAElC,MAAM,OAAO,m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A,MAAA,GAAA,SAAE,MAAA,WAAA,KAAA,MAAA,WAAA,CAAA,CAAA,GAAA,IAAA;KACP,QAAI,OAAA,OAAA,OAAA,MAAA,GAAA,SAAE,MAAA,UAAA,KAAA,MAAA,UAAA,CAAA,CAAA,GAAA,IAAA;KACN,oBAAkB;KAClB,kBAAgB;KACjB,cAAa;cACT;KAAJ,KAAI;KACH,UAAU,MAAA,QAAA;KACV,UAAU,QAAA;;IAGoB,UAAA,SAAA,UAAA,GAAjC,mBAiBO,QAAA;;KAjBA,OAAK,eAAE,WAAW;QACvB,YAea,YAAA;KAfD,MAAK;KAAU,MAAK;;4BAStB,CAPA,UAAA,SAAA,UAAA,GADR,YAQQ,MAAA,SAAA,GAAA;MANL,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;MACb,OAAM;MACL,SAAK,cAAO,iBAAe,CAAA,MAAA,CAAA;MAC5B,KAAI;;6BAEK,CAAT,YAAS,MAAA,KAAA,CAAA,CAAA,CAAA;;uCAGX,mBAGO,QAAA;MAHO,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,gBAAA,CAAA;MAAqB,SAAO;MAAmB,KAAI;yCACxE,QAAA,MAAM,IAAG,KACZ,CAAA,GAAA,WAA2B,KAAA,QAAA,QAAA,CAAA,GAAA,CAAA,EAAA,CAAA;;;2BAMnC,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,cAAA,SAAiB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
@@ -1,8 +1,8 @@
1
1
  import { createElementBlock, defineComponent, normalizeClass, openBlock, renderSlot, unref } from "vue";
2
2
  import { bem } from "@veltra/utils";
3
3
  //#region src/components/kbd/kbd.vue
4
- const _sfc_main = /* @__PURE__ */ defineComponent({
5
- name: "Kbd",
4
+ const _sfc_main = /*@__PURE__*/ defineComponent({
5
+ name: "UKbd",
6
6
  __name: "kbd",
7
7
  setup(__props) {
8
8
  const cls = bem("kbd");
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.js","names":[],"sources":["../../../src/components/kbd/kbd.vue"],"sourcesContent":["<template>\n <kbd :class=\"cls.b\">\n <slot />\n </kbd>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\n\ndefineOptions({ name: 'Kbd' })\n\nconst cls = bem('kbd')\n</script>\n"],"mappings":";;;;;;;EAWA,MAAM,MAAM,IAAI,KAAK;;uBAVnB,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,GAAA,EAAI,CAAC,EAAA,GAAA,CAChB,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"kbd.js","names":[],"sources":["../../../src/components/kbd/kbd.vue"],"sourcesContent":["<template>\n <kbd :class=\"cls.b\">\n <slot />\n </kbd>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\n\ndefineOptions({ name: 'UKbd' })\n\nconst cls = bem('kbd')\n</script>\n"],"mappings":";;;;;;;EAWA,MAAM,MAAM,IAAI,KAAK;;uBAVnB,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC,EAAA,GAAA,CAChB,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
@@ -5,8 +5,8 @@ import { useDrag } from "@veltra/compositions";
5
5
  import { bem } from "@veltra/utils";
6
6
  import { Move } from "@veltra/icons/normal";
7
7
  //#region src/components/layout/layout-resizer.vue
8
- const _sfc_main = /* @__PURE__ */ defineComponent({
9
- name: "LayoutResizer",
8
+ const _sfc_main = /*@__PURE__*/ defineComponent({
9
+ name: "ULayoutResizer",
10
10
  __name: "layout-resizer",
11
11
  props: {
12
12
  horizontal: { type: Boolean },
@@ -1 +1 @@
1
- {"version":3,"file":"layout-resizer.js","names":[],"sources":["../../../src/components/layout/layout-resizer.vue"],"sourcesContent":["<template>\n <div\n :class=\"className\"\n :style=\"{ transform: `translate3d(${offsets.x}, ${offsets.y}, 0)` }\"\n ref=\"resizerRef\"\n >\n <u-icon :size=\"10\"> <Move /> </u-icon>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useDrag } from '@veltra/compositions'\nimport { Move } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, shallowReactive, shallowRef } from 'vue'\n\nimport { UIcon } from '../icon'\nimport { LayoutDIKey } from './di'\n\ndefineOptions({ name: 'LayoutResizer' })\n\nconst props = defineProps<{\n /** 是否横向 */\n horizontal?: boolean\n /** 默认偏移量 */\n offset?: number\n}>()\n\nconst emit = defineEmits<{\n (e: 'resize', offset: number): void\n (e: 'resize-start'): void\n (e: 'resize-end'): void\n}>()\n\nconst { cls } = inject(LayoutDIKey)!\n\nconst className = computed(() => {\n return [cls.e('resizer'), bem.is('horizontal', props.horizontal)]\n})\n\nconst resizerRef = shallowRef<HTMLDivElement>()\n\nlet offset = props.offset ?? 0\nconst offsets = shallowReactive({\n x: props.horizontal ? '0' : offset + 'px',\n y: props.horizontal ? offset + 'px' : '0'\n})\nlet currentOffset = 0\nuseDrag({\n target: resizerRef,\n onDragStart() {\n currentOffset = offset\n emit('resize-start')\n },\n onDrag({ x, y }) {\n if (!props.horizontal) {\n offset = currentOffset + x\n offsets.x = offset + 'px'\n emit('resize', x)\n } else {\n offset = currentOffset + y\n offsets.y = offset + 'px'\n emit('resize', y)\n }\n },\n onDragEnd() {\n emit('resize-end')\n }\n})\n\ndefineExpose({\n update(_offset: number): void {\n offset = _offset\n if (!props.horizontal) {\n offsets.x = offset + 'px'\n } else {\n offsets.y = offset + 'px'\n }\n }\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAqBA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAMb,MAAM,EAAE,QAAQ,OAAO,WAAW;EAElC,MAAM,YAAY,eAAe;GAC/B,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,cAAc,MAAM,UAAU,CAAC;EAClE,CAAC;EAED,MAAM,aAAa,WAA2B;EAE9C,IAAI,SAAS,MAAM,UAAU;EAC7B,MAAM,UAAU,gBAAgB;GAC9B,GAAG,MAAM,aAAa,MAAM,SAAS;GACrC,GAAG,MAAM,aAAa,SAAS,OAAO;EACxC,CAAC;EACD,IAAI,gBAAgB;EACpB,QAAQ;GACN,QAAQ;GACR,cAAc;IACZ,gBAAgB;IAChB,KAAK,cAAc;GACrB;GACA,OAAO,EAAE,GAAG,KAAK;IACf,IAAI,CAAC,MAAM,YAAY;KACrB,SAAS,gBAAgB;KACzB,QAAQ,IAAI,SAAS;KACrB,KAAK,UAAU,CAAC;IAClB,OAAO;KACL,SAAS,gBAAgB;KACzB,QAAQ,IAAI,SAAS;KACrB,KAAK,UAAU,CAAC;IAClB;GACF;GACA,YAAY;IACV,KAAK,YAAY;GACnB;EACF,CAAC;EAED,SAAa,EACX,OAAO,SAAuB;GAC5B,SAAS;GACT,IAAI,CAAC,MAAM,YACT,QAAQ,IAAI,SAAS;QAErB,QAAQ,IAAI,SAAS;EAEzB,EACF,CAAC;;uBA9EC,mBAMM,OAAA;IALH,OAAK,eAAE,UAAA,KAAS;IAChB,OAAK,eAAA,EAAA,WAAA,eAA8B,MAAA,OAAA,EAAQ,EAAC,IAAK,MAAA,OAAA,EAAQ,EAAC,MAAA,CAAA;aACvD;IAAJ,KAAI;OAEJ,YAAsC,MAAA,WAAA,GAAA,EAA7B,MAAM,GAAE,GAAA;2BAAW,CAAR,YAAQ,MAAA,IAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"layout-resizer.js","names":[],"sources":["../../../src/components/layout/layout-resizer.vue"],"sourcesContent":["<template>\n <div\n :class=\"className\"\n :style=\"{ transform: `translate3d(${offsets.x}, ${offsets.y}, 0)` }\"\n ref=\"resizerRef\"\n >\n <u-icon :size=\"10\"> <Move /> </u-icon>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useDrag } from '@veltra/compositions'\nimport { Move } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, shallowReactive, shallowRef } from 'vue'\n\nimport { UIcon } from '../icon'\nimport { LayoutDIKey } from './di'\n\ndefineOptions({ name: 'ULayoutResizer' })\n\nconst props = defineProps<{\n /** 是否横向 */\n horizontal?: boolean\n /** 默认偏移量 */\n offset?: number\n}>()\n\nconst emit = defineEmits<{\n (e: 'resize', offset: number): void\n (e: 'resize-start'): void\n (e: 'resize-end'): void\n}>()\n\nconst { cls } = inject(LayoutDIKey)!\n\nconst className = computed(() => {\n return [cls.e('resizer'), bem.is('horizontal', props.horizontal)]\n})\n\nconst resizerRef = shallowRef<HTMLDivElement>()\n\nlet offset = props.offset ?? 0\nconst offsets = shallowReactive({\n x: props.horizontal ? '0' : offset + 'px',\n y: props.horizontal ? offset + 'px' : '0'\n})\nlet currentOffset = 0\nuseDrag({\n target: resizerRef,\n onDragStart() {\n currentOffset = offset\n emit('resize-start')\n },\n onDrag({ x, y }) {\n if (!props.horizontal) {\n offset = currentOffset + x\n offsets.x = offset + 'px'\n emit('resize', x)\n } else {\n offset = currentOffset + y\n offsets.y = offset + 'px'\n emit('resize', y)\n }\n },\n onDragEnd() {\n emit('resize-end')\n }\n})\n\ndefineExpose({\n update(_offset: number): void {\n offset = _offset\n if (!props.horizontal) {\n offsets.x = offset + 'px'\n } else {\n offsets.y = offset + 'px'\n }\n }\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAqBA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAMb,MAAM,EAAE,QAAQ,OAAO,WAAW;EAElC,MAAM,YAAY,eAAe;GAC/B,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,cAAc,MAAM,UAAU,CAAC;EAClE,CAAC;EAED,MAAM,aAAa,WAA2B;EAE9C,IAAI,SAAS,MAAM,UAAU;EAC7B,MAAM,UAAU,gBAAgB;GAC9B,GAAG,MAAM,aAAa,MAAM,SAAS;GACrC,GAAG,MAAM,aAAa,SAAS,OAAO;EACxC,CAAC;EACD,IAAI,gBAAgB;EACpB,QAAQ;GACN,QAAQ;GACR,cAAc;IACZ,gBAAgB;IAChB,KAAK,cAAc;GACrB;GACA,OAAO,EAAE,GAAG,KAAK;IACf,IAAI,CAAC,MAAM,YAAY;KACrB,SAAS,gBAAgB;KACzB,QAAQ,IAAI,SAAS;KACrB,KAAK,UAAU,CAAC;IAClB,OAAO;KACL,SAAS,gBAAgB;KACzB,QAAQ,IAAI,SAAS;KACrB,KAAK,UAAU,CAAC;IAClB;GACF;GACA,YAAY;IACV,KAAK,YAAY;GACnB;EACF,CAAC;EAED,SAAa,EACX,OAAO,SAAuB;GAC5B,SAAS;GACT,IAAI,CAAC,MAAM,YACT,QAAQ,IAAI,SAAS;QAErB,QAAQ,IAAI,SAAS;EAEzB,EACF,CAAC;;uBA9EC,mBAMM,OAAA;IALH,OAAK,eAAE,UAAA,KAAS;IAChB,OAAK,eAAA,EAAA,WAAA,eAA8B,MAAA,OAAA,CAAO,CAAC,EAAC,IAAK,MAAA,OAAA,CAAO,CAAC,EAAC,MAAA,CAAA;aACvD;IAAJ,KAAI;OAEJ,YAAsC,MAAA,WAAA,GAAA,EAA7B,MAAM,GAAE,GAAA;2BAAW,CAAR,YAAQ,MAAA,IAAA,CAAA,CAAA,CAAA"}
@@ -4,8 +4,8 @@ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock
4
4
  import { useResizeObserver } from "@veltra/compositions";
5
5
  import { bem, withUnit } from "@veltra/utils";
6
6
  //#region src/components/layout/layout.vue
7
- const _sfc_main = /* @__PURE__ */ defineComponent({
8
- name: "Layout",
7
+ const _sfc_main = /*@__PURE__*/ defineComponent({
8
+ name: "ULayout",
9
9
  __name: "layout",
10
10
  props: {
11
11
  tag: { default: "div" },