@veltra/desktop 1.14.1 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/dist/components/alert/alert.js +31 -28
  2. package/dist/components/alert/alert.js.map +1 -1
  3. package/dist/components/alert/style.d.ts +1 -1
  4. package/dist/components/alert/style.js +1 -0
  5. package/dist/components/alert/style2.css +5 -1
  6. package/dist/components/auto-complete/style.d.ts +0 -1
  7. package/dist/components/auto-complete/style2.css +1 -0
  8. package/dist/components/back-top/style2.css +11 -2
  9. package/dist/components/badge/badge.js +15 -15
  10. package/dist/components/badge/badge.js.map +1 -1
  11. package/dist/components/badge/style2.css +10 -1
  12. package/dist/components/batch-edit/batch-edit-form.js +108 -97
  13. package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
  14. package/dist/components/batch-edit/batch-edit.js +11 -5
  15. package/dist/components/batch-edit/batch-edit.js.map +1 -1
  16. package/dist/components/batch-edit/style2.css +25 -1
  17. package/dist/components/breadcrumb/style2.css +4 -1
  18. package/dist/components/button/style2.css +3 -2
  19. package/dist/components/carousel/carousel.js +5 -3
  20. package/dist/components/carousel/carousel.js.map +1 -1
  21. package/dist/components/carousel/style2.css +7 -1
  22. package/dist/components/carousel/use-carousel.js +16 -2
  23. package/dist/components/carousel/use-carousel.js.map +1 -1
  24. package/dist/components/cascade/cascade.js +13 -19
  25. package/dist/components/cascade/cascade.js.map +1 -1
  26. package/dist/components/cascade/style.d.ts +1 -3
  27. package/dist/components/cascade/style2.css +16 -0
  28. package/dist/components/check-tag/check-tag.js +11 -5
  29. package/dist/components/check-tag/check-tag.js.map +1 -1
  30. package/dist/components/check-tag/style2.css +10 -0
  31. package/dist/components/checkbox/checkbox-button.js +8 -3
  32. package/dist/components/checkbox/checkbox-button.js.map +1 -1
  33. package/dist/components/checkbox/checkbox.js +6 -16
  34. package/dist/components/checkbox/checkbox.js.map +1 -1
  35. package/dist/components/checkbox/style.d.ts +1 -1
  36. package/dist/components/checkbox/style.js +0 -1
  37. package/dist/components/checkbox/style2.css +32 -2
  38. package/dist/components/checkbox-group/style.d.ts +1 -1
  39. package/dist/components/chip/chip.js +63 -0
  40. package/dist/components/chip/chip.js.map +1 -0
  41. package/dist/components/chip/style.d.ts +1 -0
  42. package/dist/components/chip/style.js +1 -0
  43. package/dist/components/chip/style2.css +94 -0
  44. package/dist/components/chip-group/chip-group.js +279 -0
  45. package/dist/components/chip-group/chip-group.js.map +1 -0
  46. package/dist/components/chip-group/reveal.js +80 -0
  47. package/dist/components/chip-group/reveal.js.map +1 -0
  48. package/dist/components/chip-group/style.d.ts +1 -0
  49. package/dist/components/chip-group/style.js +2 -0
  50. package/dist/components/chip-group/style2.css +68 -0
  51. package/dist/components/code-editor/code-editor.js +26 -3
  52. package/dist/components/code-editor/code-editor.js.map +1 -1
  53. package/dist/components/code-editor/style2.css +38 -3
  54. package/dist/components/collapse/collapse-item.js +4 -1
  55. package/dist/components/collapse/collapse-item.js.map +1 -1
  56. package/dist/components/collapse/collapse.js +1 -1
  57. package/dist/components/collapse/collapse.js.map +1 -1
  58. package/dist/components/collapse/style2.css +6 -3
  59. package/dist/components/condition-editor/style.d.ts +0 -1
  60. package/dist/components/condition-editor/style2.css +24 -6
  61. package/dist/components/contextmenu/contextmenu-sub.js +13 -7
  62. package/dist/components/contextmenu/contextmenu-sub.js.map +1 -1
  63. package/dist/components/contextmenu/style2.css +14 -1
  64. package/dist/components/date-panel/style2.css +9 -1
  65. package/dist/components/date-picker/style.d.ts +1 -2
  66. package/dist/components/date-range-picker/date-range-picker.js +14 -20
  67. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  68. package/dist/components/dialog/dialog.js +5 -2
  69. package/dist/components/dialog/dialog.js.map +1 -1
  70. package/dist/components/dialog/style2.css +5 -11
  71. package/dist/components/dialog/use-maximum.js +83 -20
  72. package/dist/components/dialog/use-maximum.js.map +1 -1
  73. package/dist/components/drawer/style2.css +8 -4
  74. package/dist/components/dual-nav/style2.css +5 -2
  75. package/dist/components/expression-editor/style2.css +17 -5
  76. package/dist/components/file-viewer/style2.css +8 -2
  77. package/dist/components/float-button/float-button.js +1 -1
  78. package/dist/components/float-button/float-button.js.map +1 -1
  79. package/dist/components/float-button/style2.css +2 -3
  80. package/dist/components/form-item/style2.css +13 -1
  81. package/dist/components/grid-input/style2.css +15 -3
  82. package/dist/components/group-nav/style2.css +16 -7
  83. package/dist/components/icon/style2.css +1 -1
  84. package/dist/components/image-cropper/style2.css +4 -1
  85. package/dist/components/image-previewer/image-previewer.js +14 -2
  86. package/dist/components/image-previewer/image-previewer.js.map +1 -1
  87. package/dist/components/image-previewer/style.d.ts +1 -1
  88. package/dist/components/image-previewer/style.js +1 -0
  89. package/dist/components/image-previewer/style2.css +9 -14
  90. package/dist/components/index.d.ts +32 -30
  91. package/dist/components/index.js +63 -59
  92. package/dist/components/index.js.map +1 -1
  93. package/dist/components/input/input.js.map +1 -1
  94. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +13 -19
  95. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  96. package/dist/components/input/style.d.ts +1 -1
  97. package/dist/components/input/style.js +0 -1
  98. package/dist/components/input/style2.css +13 -1
  99. package/dist/components/kanban/kanban-column.js +1 -0
  100. package/dist/components/kanban/kanban-column.js.map +1 -1
  101. package/dist/components/kanban/style2.css +6 -2
  102. package/dist/components/layout/layout-resizer.js +8 -1
  103. package/dist/components/layout/layout-resizer.js.map +1 -1
  104. package/dist/components/layout/layout.js +11 -1
  105. package/dist/components/layout/layout.js.map +1 -1
  106. package/dist/components/layout/style2.css +22 -0
  107. package/dist/components/loading/style2.css +26 -7
  108. package/dist/components/message/style2.css +31 -2
  109. package/dist/components/message-confirm/style2.css +21 -0
  110. package/dist/components/multi-select/multi-select.js +33 -36
  111. package/dist/components/multi-select/multi-select.js.map +1 -1
  112. package/dist/components/multi-select/style.d.ts +1 -4
  113. package/dist/components/multi-select/style.js +0 -1
  114. package/dist/components/multi-select/style2.css +13 -0
  115. package/dist/components/multi-tree-select/multi-tree-select.js +10 -19
  116. package/dist/components/multi-tree-select/multi-tree-select.js.map +1 -1
  117. package/dist/components/multi-tree-select/style.d.ts +1 -5
  118. package/dist/components/multi-tree-select/style.js +0 -1
  119. package/dist/components/nav/nav-sub.js +62 -51
  120. package/dist/components/nav/nav-sub.js.map +1 -1
  121. package/dist/components/nav/style2.css +50 -26
  122. package/dist/components/notification/notification-box.js +4 -2
  123. package/dist/components/notification/notification-box.js.map +1 -1
  124. package/dist/components/notification/style2.css +37 -0
  125. package/dist/components/number-input/style.d.ts +0 -1
  126. package/dist/components/number-input/style2.css +5 -2
  127. package/dist/components/paginator/style2.css +1 -0
  128. package/dist/components/palette/style.d.ts +1 -2
  129. package/dist/components/password-input/style.d.ts +1 -1
  130. package/dist/components/password-input/style2.css +10 -1
  131. package/dist/components/pop-confirm/pop-confirm.js +1 -1
  132. package/dist/components/pop-confirm/pop-confirm.js.map +1 -1
  133. package/dist/components/progress/style2.css +2 -2
  134. package/dist/components/progress-nodes/style2.css +3 -3
  135. package/dist/components/radio/radio.js +2 -8
  136. package/dist/components/radio/radio.js.map +1 -1
  137. package/dist/components/radio/style.d.ts +1 -1
  138. package/dist/components/radio/style.js +0 -1
  139. package/dist/components/radio/style2.css +11 -1
  140. package/dist/components/radio-group/style.d.ts +1 -1
  141. package/dist/components/rate/style2.css +7 -0
  142. package/dist/components/rich-text-editor/style2.css +6 -3
  143. package/dist/components/scroll/style2.css +27 -13
  144. package/dist/components/segment/segment.js +54 -3
  145. package/dist/components/segment/segment.js.map +1 -1
  146. package/dist/components/segment/style2.css +26 -2
  147. package/dist/components/select/select.js +29 -26
  148. package/dist/components/select/select.js.map +1 -1
  149. package/dist/components/select/style.d.ts +0 -1
  150. package/dist/components/select/style2.css +11 -1
  151. package/dist/components/steps/style2.css +21 -2
  152. package/dist/components/switch/style2.css +10 -2
  153. package/dist/components/table/style.d.ts +1 -3
  154. package/dist/components/table/style2.css +20 -7
  155. package/dist/components/tabs/style.d.ts +1 -2
  156. package/dist/components/tabs/style.js +0 -1
  157. package/dist/components/tabs/style2.css +37 -2
  158. package/dist/components/tabs/tabs-horizontal.js +7 -3
  159. package/dist/components/tabs/tabs-horizontal.js.map +1 -1
  160. package/dist/components/tabs/tabs.js +2 -8
  161. package/dist/components/tabs/tabs.js.map +1 -1
  162. package/dist/components/tabs/use-tabs-bar.js +41 -9
  163. package/dist/components/tabs/use-tabs-bar.js.map +1 -1
  164. package/dist/components/tag/style2.css +19 -10
  165. package/dist/components/textarea/style.d.ts +1 -1
  166. package/dist/components/textarea/style.js +0 -1
  167. package/dist/components/textarea/style2.css +9 -1
  168. package/dist/components/textarea/textarea.js +7 -13
  169. package/dist/components/textarea/textarea.js.map +1 -1
  170. package/dist/components/theme/style.d.ts +0 -1
  171. package/dist/components/theme/style2.css +43 -30
  172. package/dist/components/time-picker/style.d.ts +1 -2
  173. package/dist/components/time-picker/style2.css +4 -1
  174. package/dist/components/tip/style2.css +16 -5
  175. package/dist/components/tip/tip.js +22 -1
  176. package/dist/components/tip/tip.js.map +1 -1
  177. package/dist/components/transfer/style.d.ts +1 -2
  178. package/dist/components/transfer/style2.css +21 -1
  179. package/dist/components/transfer/transfer-list.js +20 -17
  180. package/dist/components/transfer/transfer-list.js.map +1 -1
  181. package/dist/components/tree/style.d.ts +1 -1
  182. package/dist/components/tree/style2.css +5 -2
  183. package/dist/components/tree-select/style.d.ts +1 -3
  184. package/dist/components/tree-select/tree-select.js +24 -25
  185. package/dist/components/tree-select/tree-select.js.map +1 -1
  186. package/dist/index.d.ts +86 -82
  187. package/dist/index.js +84 -82
  188. package/dist/style.d.ts +0 -8
  189. package/dist/style.js +2 -0
  190. package/dist/types/chip-group.d.ts +35 -0
  191. package/dist/types/chip.d.ts +28 -0
  192. package/dist/types/index.d.ts +3 -1
  193. package/package.json +1 -1
  194. package/src/components/alert/alert.vue +18 -16
  195. package/src/components/alert/style.scss +9 -1
  196. package/src/components/alert/style.ts +1 -0
  197. package/src/components/auto-complete/style.scss +3 -0
  198. package/src/components/back-top/style.scss +17 -3
  199. package/src/components/badge/badge.vue +6 -7
  200. package/src/components/badge/style.scss +20 -1
  201. package/src/components/batch-edit/__test__/batch-edit.test.ts +10 -0
  202. package/src/components/batch-edit/batch-edit-form.vue +95 -83
  203. package/src/components/batch-edit/batch-edit.vue +18 -3
  204. package/src/components/batch-edit/style.scss +39 -3
  205. package/src/components/breadcrumb/style.scss +5 -1
  206. package/src/components/button/style.scss +4 -2
  207. package/src/components/carousel/carousel.vue +8 -2
  208. package/src/components/carousel/style.scss +10 -1
  209. package/src/components/carousel/use-carousel.ts +17 -2
  210. package/src/components/cascade/cascade.vue +9 -11
  211. package/src/components/cascade/style.scss +27 -0
  212. package/src/components/check-tag/check-tag.vue +13 -3
  213. package/src/components/check-tag/style.scss +21 -0
  214. package/src/components/checkbox/checkbox-button.vue +11 -1
  215. package/src/components/checkbox/checkbox.vue +10 -8
  216. package/src/components/checkbox/style.scss +51 -2
  217. package/src/components/checkbox/style.ts +0 -1
  218. package/src/components/chip/__test__/chip.test.ts +69 -0
  219. package/src/components/chip/chip.vue +54 -0
  220. package/src/components/chip/index.ts +1 -0
  221. package/src/components/chip/style.scss +102 -0
  222. package/src/components/chip/style.ts +1 -0
  223. package/src/components/chip-group/__test__/chip-group.test.ts +411 -0
  224. package/src/components/chip-group/__test__/reveal.test.ts +74 -0
  225. package/src/components/chip-group/chip-group.vue +326 -0
  226. package/src/components/chip-group/index.ts +1 -0
  227. package/src/components/chip-group/reveal.ts +106 -0
  228. package/src/components/chip-group/style.scss +72 -0
  229. package/src/components/chip-group/style.ts +2 -0
  230. package/src/components/code-editor/code-editor.vue +24 -3
  231. package/src/components/code-editor/style.scss +54 -4
  232. package/src/components/collapse/collapse-item.vue +10 -1
  233. package/src/components/collapse/collapse.vue +3 -1
  234. package/src/components/collapse/style.scss +10 -7
  235. package/src/components/condition-editor/style.scss +39 -12
  236. package/src/components/contextmenu/contextmenu-sub.vue +9 -7
  237. package/src/components/contextmenu/style.scss +17 -1
  238. package/src/components/date-panel/style.scss +22 -1
  239. package/src/components/date-range-picker/date-range-picker.vue +10 -12
  240. package/src/components/dialog/dialog.vue +2 -1
  241. package/src/components/dialog/style.scss +6 -13
  242. package/src/components/dialog/use-maximum.ts +95 -27
  243. package/src/components/drawer/style.scss +6 -1
  244. package/src/components/dual-nav/style.scss +9 -4
  245. package/src/components/expression-editor/style.scss +27 -9
  246. package/src/components/file-viewer/style.scss +12 -2
  247. package/src/components/float-button/float-button.vue +1 -1
  248. package/src/components/float-button/style.scss +4 -3
  249. package/src/components/form-item/style.scss +16 -2
  250. package/src/components/grid-input/style.scss +6 -1
  251. package/src/components/group-nav/style.scss +30 -13
  252. package/src/components/icon/style.scss +2 -1
  253. package/src/components/image-cropper/style.scss +6 -1
  254. package/src/components/image-previewer/image-previewer.vue +20 -2
  255. package/src/components/image-previewer/style.scss +17 -14
  256. package/src/components/image-previewer/style.ts +1 -0
  257. package/src/components/index.ts +4 -0
  258. package/src/components/input/input.vue +8 -16
  259. package/src/components/input/style.scss +19 -1
  260. package/src/components/input/style.ts +0 -1
  261. package/src/components/kanban/kanban-column.vue +2 -0
  262. package/src/components/kanban/style.scss +11 -2
  263. package/src/components/layout/__test__/layout.test.ts +135 -0
  264. package/src/components/layout/layout-resizer.vue +8 -1
  265. package/src/components/layout/layout.vue +17 -1
  266. package/src/components/layout/style.scss +31 -6
  267. package/src/components/loading/style.scss +39 -8
  268. package/src/components/message/style.scss +35 -2
  269. package/src/components/message-confirm/style.scss +27 -0
  270. package/src/components/multi-select/multi-select.vue +21 -20
  271. package/src/components/multi-select/style.scss +14 -0
  272. package/src/components/multi-select/style.ts +0 -1
  273. package/src/components/multi-tree-select/__test__/multi-tree-select.test.ts +4 -2
  274. package/src/components/multi-tree-select/multi-tree-select.vue +8 -10
  275. package/src/components/multi-tree-select/style.ts +0 -1
  276. package/src/components/nav/nav-sub.vue +30 -11
  277. package/src/components/nav/style.scss +37 -13
  278. package/src/components/notification/notification-box.vue +5 -2
  279. package/src/components/notification/style.scss +31 -0
  280. package/src/components/number-input/style.scss +8 -2
  281. package/src/components/paginator/style.scss +3 -0
  282. package/src/components/password-input/style.scss +15 -1
  283. package/src/components/pop-confirm/pop-confirm.vue +1 -1
  284. package/src/components/progress/style.scss +3 -3
  285. package/src/components/progress-nodes/style.scss +5 -5
  286. package/src/components/radio/radio.vue +1 -3
  287. package/src/components/radio/style.scss +19 -1
  288. package/src/components/radio/style.ts +0 -1
  289. package/src/components/rate/style.scss +9 -0
  290. package/src/components/rich-text-editor/style.scss +13 -3
  291. package/src/components/scroll/style.scss +39 -20
  292. package/src/components/segment/segment.vue +56 -2
  293. package/src/components/segment/style.scss +32 -2
  294. package/src/components/select/select.vue +25 -20
  295. package/src/components/select/style.scss +22 -1
  296. package/src/components/steps/style.scss +27 -5
  297. package/src/components/switch/style.scss +16 -2
  298. package/src/components/table/style.scss +44 -20
  299. package/src/components/tabs/style.scss +50 -2
  300. package/src/components/tabs/style.ts +0 -1
  301. package/src/components/tabs/tabs-horizontal.vue +2 -1
  302. package/src/components/tabs/tabs.vue +4 -6
  303. package/src/components/tabs/use-tabs-bar.ts +55 -8
  304. package/src/components/tag/style.scss +22 -5
  305. package/src/components/textarea/style.scss +15 -2
  306. package/src/components/textarea/style.ts +0 -1
  307. package/src/components/textarea/textarea.vue +7 -9
  308. package/src/components/theme/style.scss +73 -31
  309. package/src/components/time-picker/style.scss +9 -1
  310. package/src/components/tip/style.scss +18 -5
  311. package/src/components/tip/tip.vue +33 -1
  312. package/src/components/transfer/style.scss +31 -1
  313. package/src/components/transfer/transfer-list.vue +18 -15
  314. package/src/components/tree/style.scss +8 -3
  315. package/src/components/tree-select/tree-select.vue +21 -17
  316. package/src/style.ts +2 -0
  317. package/src/types/chip-group.ts +36 -0
  318. package/src/types/chip.ts +29 -0
  319. package/src/types/index.ts +2 -0
@@ -1,6 +1,6 @@
1
1
  import _sfc_main$1 from "../icon/icon.js";
2
2
  import { calcTextareaHeight } from "./utils.js";
3
- import { Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, ref, shallowRef, toDisplayString, unref, useModel, vModelText, watch, withCtx, withDirectives, withModifiers } from "vue";
3
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, ref, shallowRef, toDisplayString, unref, useModel, vModelText, watch, withCtx, withDirectives, withModifiers } from "vue";
4
4
  import { useFocus, useFormFallbackProps } from "@veltra/compositions";
5
5
  import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
6
6
  import { Close } from "@veltra/icons/normal";
@@ -143,20 +143,14 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
143
143
  key: 0,
144
144
  class: normalizeClass(unref(cls).m("count"))
145
145
  }, toDisplayString(initNum.value) + "/" + toDisplayString(props.maxlength), 3)) : createCommentVNode("v-if", true),
146
- createVNode(Transition, {
147
- name: "zoom-in",
148
- mode: "out-in"
146
+ props.clearable && model.value && hovered.value && !unref(disabled) && !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$1), {
147
+ key: 1,
148
+ class: normalizeClass(unref(cls).m("clear")),
149
+ onClick: withModifiers(handleClear, ["stop"])
149
150
  }, {
150
- default: withCtx(() => [props.clearable && model.value && hovered.value && !unref(disabled) && !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$1), {
151
- key: 0,
152
- class: normalizeClass(unref(cls).m("clear")),
153
- onClick: withModifiers(handleClear, ["stop"])
154
- }, {
155
- default: withCtx(() => [createVNode(unref(Close))]),
156
- _: 1
157
- }, 8, ["class"])) : createCommentVNode("v-if", true)]),
151
+ default: withCtx(() => [createVNode(unref(Close))]),
158
152
  _: 1
159
- })
153
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
160
154
  ], 34)) : (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(model.value || unref(FORM_EMPTY_CONTENT)), 1));
161
155
  };
162
156
  }
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.js","names":["_useModel","_unref","_openBlock","_createElementBlock","_normalizeClass","_withDirectives","_createElementVNode","_vModelText","_toDisplayString","_createCommentVNode","_createVNode","_Transition","_withCtx","_createBlock","UIcon","_withModifiers"],"sources":["../../../src/components/textarea/textarea.vue"],"sourcesContent":["<template>\n <div\n v-if=\"!readonly\"\n :class=\"textareaClass\"\n @mouseenter=\"hovered = true\"\n @mouseleave=\"hovered = false\"\n >\n <textarea\n :class=\"cls.e('native')\"\n :placeholder=\"placeholder\"\n v-model=\"model\"\n :maxlength=\"maxlength\"\n :rows=\"rows\"\n :cols=\"cols\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n :disabled=\"disabled\"\n :readonly=\"nativeReadonly\"\n ref=\"textareaRef\"\n />\n <span v-if=\"props.maxlength && props.showCount\" :class=\"cls.m('count')\">\n {{ initNum }}/{{ props.maxlength }}\n </span>\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <u-icon\n v-if=\"props.clearable && model! && hovered && !disabled && !readonly\"\n :class=\"cls.m('clear')\"\n @click.stop=\"handleClear\"\n >\n <Close />\n </u-icon>\n </Transition>\n </div>\n\n <span v-else style=\"white-space: pre-wrap\">\n {{ model || FORM_EMPTY_CONTENT }}\n </span>\n</template>\n\n<script lang=\"ts\" 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, ref, shallowRef, watch } from 'vue'\n\nimport type { TextareaProps, TextareaEmits, ComponentSize } from '../../types'\nimport { UIcon } from '../icon'\nimport { calcTextareaHeight } from './utils'\n\ndefineOptions({ name: 'UTextarea' })\n\nconst props = withDefaults(defineProps<TextareaProps>(), {\n placeholder: '请输入',\n resize: true,\n clearable: true,\n disabled: undefined,\n readonly: undefined,\n autosize: false\n})\n\nconst cls = bem('textarea')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default' as ComponentSize,\n disabled: false,\n readonly: false\n})\n\nconst emit = defineEmits<TextareaEmits>()\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null)\n\nconst model = defineModel<string>()\n\nconst hovered = shallowRef(false)\n\nconst { focus, handleBlur, handleFocus } = useFocus((focused) => {\n focused ? emit('focus') : emit('blur')\n})\n\nconst textareaClass = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('resize-none', !props.resize),\n bem.is('disabled', disabled.value),\n bem.is('readonly', readonly.value),\n bem.is('focus', focus.value),\n cls.m('more')\n ]\n})\n\nconst handleInput = (e: Event) => {\n const value = (e.target as HTMLTextAreaElement).value\n if (value.length > props.maxlength!) {\n // 如果输入的字符数超过了最大长度,截取字符串到最大长度\n const truncatedValue = value.slice(0, props.maxlength)\n emit('update:modelValue', truncatedValue)\n } else {\n // 如果没有超过最大长度,则正常更新模型值\n emit('update:modelValue', value)\n }\n}\n\nconst initNum = computed(() => {\n if (!props.maxlength) return 0\n return props.maxlength - (model.value?.length ?? 0)\n})\n\nconst handleClear = () => {\n model.value = ''\n emit('clear')\n}\n\nconst handleChange = (e: Event) => {\n emit('change', (e.target as HTMLTextAreaElement).value)\n}\n\nwatch(\n [model, textareaRef],\n ([model, textareaRef]) => {\n if (!textareaRef) return\n if (!props.autosize) return\n calcTextareaHeight(textareaRef)\n },\n { immediate: true }\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDA,MAAM,QAAQ;EASd,MAAM,MAAM,IAAI,UAAU;EAE1B,MAAM,EAAE,cAAc,kBAAkB;EAExC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC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,SAAAH,cAAS,CAATF,YAAST,MAAA,KAAA,CAAA,C;;;;;G,WAKfC,UAAA,GAAAC,mBAEO,QAFP,YAEOK,gBADF,MAAA,SAASP,MAAA,kBAAA,CAAkB,GAAA,CAAA"}
1
+ {"version":3,"file":"textarea.js","names":["_useModel","_unref","_openBlock","_createElementBlock","_normalizeClass","_withDirectives","_createElementVNode","_vModelText","_toDisplayString","_createCommentVNode","_createBlock","UIcon","_withModifiers","_withCtx","_createVNode"],"sources":["../../../src/components/textarea/textarea.vue"],"sourcesContent":["<template>\n <div\n v-if=\"!readonly\"\n :class=\"textareaClass\"\n @mouseenter=\"hovered = true\"\n @mouseleave=\"hovered = false\"\n >\n <textarea\n :class=\"cls.e('native')\"\n :placeholder=\"placeholder\"\n v-model=\"model\"\n :maxlength=\"maxlength\"\n :rows=\"rows\"\n :cols=\"cols\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n :disabled=\"disabled\"\n :readonly=\"nativeReadonly\"\n ref=\"textareaRef\"\n />\n <span v-if=\"props.maxlength && props.showCount\" :class=\"cls.m('count')\">\n {{ initNum }}/{{ props.maxlength }}\n </span>\n <u-icon\n v-if=\"props.clearable && model! && hovered && !disabled && !readonly\"\n :class=\"cls.m('clear')\"\n @click.stop=\"handleClear\"\n >\n <Close />\n </u-icon>\n </div>\n\n <span v-else style=\"white-space: pre-wrap\">\n {{ model || FORM_EMPTY_CONTENT }}\n </span>\n</template>\n\n<script lang=\"ts\" 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, ref, shallowRef, watch } from 'vue'\n\nimport type { TextareaProps, TextareaEmits, ComponentSize } from '../../types'\nimport { UIcon } from '../icon'\nimport { calcTextareaHeight } from './utils'\n\ndefineOptions({ name: 'UTextarea' })\n\nconst props = withDefaults(defineProps<TextareaProps>(), {\n placeholder: '请输入',\n resize: true,\n clearable: true,\n disabled: undefined,\n readonly: undefined,\n autosize: false\n})\n\nconst cls = bem('textarea')\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default' as ComponentSize,\n disabled: false,\n readonly: false\n})\n\nconst emit = defineEmits<TextareaEmits>()\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null)\n\nconst model = defineModel<string>()\n\nconst hovered = shallowRef(false)\n\nconst { focus, handleBlur, handleFocus } = useFocus((focused) => {\n focused ? emit('focus') : emit('blur')\n})\n\nconst textareaClass = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('resize-none', !props.resize),\n bem.is('disabled', disabled.value),\n bem.is('readonly', readonly.value),\n bem.is('focus', focus.value),\n cls.m('more')\n ]\n})\n\nconst handleInput = (e: Event) => {\n const value = (e.target as HTMLTextAreaElement).value\n if (value.length > props.maxlength!) {\n // 如果输入的字符数超过了最大长度,截取字符串到最大长度\n const truncatedValue = value.slice(0, props.maxlength)\n emit('update:modelValue', truncatedValue)\n } else {\n // 如果没有超过最大长度,则正常更新模型值\n emit('update:modelValue', value)\n }\n}\n\nconst initNum = computed(() => {\n if (!props.maxlength) return 0\n return props.maxlength - (model.value?.length ?? 0)\n})\n\nconst handleClear = () => {\n model.value = ''\n emit('clear')\n}\n\nconst handleChange = (e: Event) => {\n emit('change', (e.target as HTMLTextAreaElement).value)\n}\n\nwatch(\n [model, textareaRef],\n ([model, textareaRef]) => {\n if (!textareaRef) return\n if (!props.autosize) return\n calcTextareaHeight(textareaRef)\n },\n { immediate: true }\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDA,MAAM,QAAQ;EASd,MAAM,MAAM,IAAI,UAAU;EAE1B,MAAM,EAAE,cAAc,kBAAkB;EAExC,MAAM,EA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AA,KAAA,CAAA,C;;;G,WAIbC,UAAA,GAAAC,mBAEO,QAFP,YAEOK,gBADF,MAAA,SAASP,MAAA,kBAAA,CAAkB,GAAA,CAAA"}
@@ -1,5 +1,4 @@
1
1
  import "../button/style.js";
2
- import "../input/style.js";
3
2
  import "../select/style.js";
4
3
  import "../number-input/style.js";
5
4
  import "../palette/style.js";
@@ -24,8 +24,8 @@
24
24
  padding: 14px;
25
25
  border: var(--u-border);
26
26
  border-radius: var(--u-radius-large);
27
- background: radial-gradient(circle at top right, rgba(30, 136, 229, 0.14), transparent 36%), linear-gradient(180deg, var(--u-bg-color-top) 0%, var(--u-bg-color-middle) 100%);
28
- box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
27
+ background: radial-gradient(circle at top right, var(--u-color-primary-a-16), transparent 36%), linear-gradient(180deg, var(--u-bg-color-top) 0%, var(--u-bg-color-middle) 100%);
28
+ box-shadow: var(--u-shadow-lg), inset 0 1px 0 var(--u-text-color-white-a-70);
29
29
  backdrop-filter: var(--u-bg-filter);
30
30
  -webkit-backdrop-filter: var(--u-bg-filter);
31
31
  overflow: hidden;
@@ -53,7 +53,7 @@
53
53
  height: 24px;
54
54
  padding: 0 10px;
55
55
  border-radius: 999px;
56
- background: rgba(30, 136, 229, 0.08);
56
+ background: var(--u-color-primary-a-8);
57
57
  color: var(--u-color-primary);
58
58
  font-size: 12px;
59
59
  font-weight: 700;
@@ -86,17 +86,20 @@
86
86
  padding: 0 14px;
87
87
  border-radius: 999px;
88
88
  color: var(--u-text-color-second);
89
- background: rgba(148, 163, 184, 0.12);
90
- transition: all 0.22s ease;
89
+ background: var(--u-border-color-a-11);
90
+ transition: background-color var(--u-transition-normal) var(--u-transition-ease), color var(--u-transition-normal) var(--u-transition-ease), box-shadow var(--u-transition-normal) var(--u-transition-ease), transform var(--u-transition-normal) var(--u-transition-ease-out);
91
91
  }
92
92
  .u-theme__toggle:hover {
93
- background: rgba(148, 163, 184, 0.18);
93
+ background: var(--u-border-color-a-16);
94
94
  color: var(--u-text-color-title);
95
95
  }
96
+ .u-theme__toggle:active {
97
+ transform: translateY(0) scale(0.98);
98
+ }
96
99
  .u-theme__toggle.is-active {
97
- background: rgba(30, 136, 229, 0.12);
100
+ background: var(--u-color-primary-a-11);
98
101
  color: var(--u-color-primary);
99
- box-shadow: inset 0 0 0 1px rgba(30, 136, 229, 0.18);
102
+ box-shadow: inset 0 0 0 1px var(--u-color-primary-a-16);
100
103
  }
101
104
  .u-theme__nav {
102
105
  display: flex;
@@ -112,7 +115,7 @@
112
115
  }
113
116
  .u-theme__nav::-webkit-scrollbar-thumb {
114
117
  border-radius: 4px;
115
- background: rgba(148, 163, 184, 0.2);
118
+ background: var(--u-border-color-a-22);
116
119
  }
117
120
  .u-theme__nav-item {
118
121
  display: grid;
@@ -121,18 +124,25 @@
121
124
  text-align: left;
122
125
  border-radius: var(--u-radius-default);
123
126
  background: var(--u-bg-color-top);
124
- border: 1px solid rgba(148, 163, 184, 0.12);
125
- transition: all 0.22s ease;
127
+ border: 1px solid var(--u-border-color-a-11);
128
+ transition: background-color var(--u-transition-normal) var(--u-transition-ease), border-color var(--u-transition-normal) var(--u-transition-ease), box-shadow var(--u-transition-normal) var(--u-transition-ease), opacity var(--u-transition-normal) var(--u-transition-ease), transform var(--u-transition-normal) var(--u-transition-ease-out);
126
129
  }
127
130
  .u-theme__nav-item:hover {
128
- transform: translateY(-1px);
129
131
  background: var(--u-bg-color-hover);
130
- border-color: rgba(30, 136, 229, 0.16);
132
+ border-color: var(--u-color-primary-a-16);
133
+ }
134
+ @media (hover: hover) and (pointer: fine) {
135
+ .u-theme__nav-item:hover {
136
+ transform: translateY(-1px);
137
+ }
138
+ }
139
+ .u-theme__nav-item:not(.is-disabled):active {
140
+ transform: translateY(0) scale(0.98);
131
141
  }
132
142
  .u-theme__nav-item.is-active {
133
- background: linear-gradient(135deg, rgba(30, 136, 229, 0.14), var(--u-bg-color-top));
134
- border-color: rgba(30, 136, 229, 0.22);
135
- box-shadow: 0 8px 20px rgba(30, 136, 229, 0.12);
143
+ background: linear-gradient(135deg, var(--u-color-primary-a-16), var(--u-bg-color-top));
144
+ border-color: var(--u-color-primary-a-22);
145
+ box-shadow: 0 8px 20px var(--u-color-primary-a-11);
136
146
  }
137
147
  .u-theme__nav-item.is-disabled {
138
148
  opacity: 0.55;
@@ -152,7 +162,7 @@
152
162
  min-height: 0;
153
163
  border-radius: var(--u-radius-large);
154
164
  background: linear-gradient(180deg, var(--u-bg-color-top), var(--u-bg-color-middle));
155
- border: 1px solid rgba(148, 163, 184, 0.16);
165
+ border: 1px solid var(--u-border-color-a-16);
156
166
  display: flex;
157
167
  flex-direction: column;
158
168
  overflow: hidden;
@@ -163,7 +173,7 @@
163
173
  justify-content: space-between;
164
174
  gap: 12px;
165
175
  padding: 14px 14px 12px;
166
- border-bottom: 1px solid rgba(148, 163, 184, 0.1);
176
+ border-bottom: 1px solid var(--u-border-color-a-10);
167
177
  }
168
178
  .u-theme__panel-title {
169
179
  margin: 0;
@@ -180,7 +190,7 @@
180
190
  flex-shrink: 0;
181
191
  padding: 4px 10px;
182
192
  border-radius: 999px;
183
- background: rgba(30, 136, 229, 0.08);
193
+ background: var(--u-color-primary-a-8);
184
194
  color: var(--u-color-primary);
185
195
  font-size: var(--u-font-size-assist-default);
186
196
  font-weight: 700;
@@ -200,16 +210,16 @@
200
210
  padding: 12px;
201
211
  border-radius: var(--u-radius-default);
202
212
  background: var(--u-bg-color-top);
203
- border: 1px solid rgba(148, 163, 184, 0.14);
204
- transition: all 0.22s ease;
213
+ border: 1px solid var(--u-border-color-a-16);
214
+ transition: border-color var(--u-transition-normal) var(--u-transition-ease), box-shadow var(--u-transition-normal) var(--u-transition-ease), background-color var(--u-transition-normal) var(--u-transition-ease);
205
215
  }
206
216
  .u-theme__item:hover {
207
- border-color: rgba(30, 136, 229, 0.16);
208
- box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
217
+ border-color: var(--u-color-primary-a-16);
218
+ box-shadow: var(--u-shadow-sm);
209
219
  }
210
220
  .u-theme__item.is-changed {
211
- background: linear-gradient(135deg, rgba(30, 136, 229, 0.08), var(--u-bg-color-top));
212
- border-color: rgba(30, 136, 229, 0.18);
221
+ background: linear-gradient(135deg, var(--u-color-primary-a-8), var(--u-bg-color-top));
222
+ border-color: var(--u-color-primary-a-16);
213
223
  }
214
224
  .u-theme__item-head {
215
225
  display: flex;
@@ -251,7 +261,7 @@
251
261
  flex-shrink: 0;
252
262
  padding: 2px 8px;
253
263
  border-radius: 999px;
254
- background: rgba(30, 136, 229, 0.1);
264
+ background: var(--u-color-primary-a-10);
255
265
  color: var(--u-color-primary);
256
266
  font-size: 11px;
257
267
  font-weight: 700;
@@ -274,7 +284,7 @@
274
284
  }
275
285
  .u-theme__palette-custom .u-palette {
276
286
  flex-shrink: 0;
277
- box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
287
+ box-shadow: 0 0 0 1px var(--u-border-color-a-5);
278
288
  }
279
289
  .u-theme__palette-custom .u-input {
280
290
  flex: 1;
@@ -328,15 +338,18 @@
328
338
  padding: 0 12px;
329
339
  border-radius: var(--u-radius-default);
330
340
  background: var(--u-bg-color-top);
331
- border: 1px solid rgba(148, 163, 184, 0.16);
341
+ border: 1px solid var(--u-border-color-a-16);
332
342
  color: var(--u-text-color-main);
333
- transition: all 0.22s ease;
343
+ transition: background-color var(--u-transition-normal) var(--u-transition-ease), border-color var(--u-transition-normal) var(--u-transition-ease), color var(--u-transition-normal) var(--u-transition-ease), transform var(--u-transition-normal) var(--u-transition-ease-out);
334
344
  }
335
345
  .u-theme__preset:hover {
336
- border-color: rgba(30, 136, 229, 0.18);
346
+ border-color: var(--u-color-primary-a-16);
337
347
  color: var(--u-color-primary);
338
348
  background: var(--u-bg-color-hover);
339
349
  }
350
+ .u-theme__preset:active {
351
+ transform: translateY(0) scale(0.98);
352
+ }
340
353
  .u-theme__action-btn {
341
354
  min-width: 74px;
342
355
  }
@@ -1,2 +1 @@
1
- import "../dropdown/style.js";
2
- import "../input/style.js";
1
+ import "../dropdown/style.js";
@@ -91,7 +91,10 @@
91
91
  cursor: pointer;
92
92
  user-select: none;
93
93
  color: var(--u-text-color-main);
94
- transition: background-color var(--u-transition-fast) var(--u-transition-ease);
94
+ transition: background-color var(--u-transition-fast) var(--u-transition-ease), transform var(--u-transition-fast) var(--u-transition-ease-out);
95
+ }
96
+ .u-time-picker__item:not(.is-disabled):active {
97
+ transform: scale(0.97);
95
98
  }
96
99
  .u-time-picker__item:hover {
97
100
  background-color: var(--u-bg-color-hover);
@@ -126,17 +126,28 @@
126
126
  }
127
127
 
128
128
  .tip-enter-active {
129
- transition-timing-function: ease;
130
- transition-duration: 0.25s;
129
+ transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
130
+ transition-duration: 160ms;
131
131
  }
132
132
 
133
133
  .tip-leave-active {
134
- transition-timing-function: ease-out;
135
- transition-duration: 0.15s;
134
+ transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
135
+ transition-duration: 120ms;
136
136
  }
137
137
 
138
138
  .tip-enter-from,
139
139
  .tip-leave-to {
140
140
  opacity: 0;
141
- transform: scale(0.9);
141
+ transform: scale(0.96);
142
+ }
143
+
144
+ @media (prefers-reduced-motion: reduce) {
145
+ .tip-enter-active,
146
+ .tip-leave-active {
147
+ transition-property: opacity;
148
+ }
149
+ .tip-enter-from,
150
+ .tip-leave-to {
151
+ transform: none;
152
+ }
142
153
  }
@@ -118,6 +118,23 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
118
118
  const triggerDom = computed(() => {
119
119
  return props.triggerDom || triggerRef.value?.$el;
120
120
  });
121
+ const placementSide = shallowRef(props.direction);
122
+ function originFor(side) {
123
+ if (side === "top") return "center bottom";
124
+ if (side === "bottom") return "center top";
125
+ if (side === "left") return "right center";
126
+ return "left center";
127
+ }
128
+ const contentStyle = computed(() => {
129
+ const origin = { transformOrigin: originFor(placementSide.value) };
130
+ const base = props.style;
131
+ if (base == null || base === "") return origin;
132
+ if (typeof base === "string") return [base, origin];
133
+ return [base, origin];
134
+ });
135
+ watch(() => props.direction, (side) => {
136
+ placementSide.value = side;
137
+ });
121
138
  const { update, popperContainerId } = usePop({
122
139
  triggerRef: triggerDom,
123
140
  contentRef,
@@ -126,6 +143,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
126
143
  alignment: toRef(() => props.alignment),
127
144
  onTriggerPositionChange() {
128
145
  close();
146
+ },
147
+ onPop(position) {
148
+ const side = position.placement.split("-")[0];
149
+ if (side === "top" || side === "bottom" || side === "left" || side === "right") placementSide.value = side;
129
150
  }
130
151
  });
131
152
  watch(triggerDom, (dom) => {
@@ -152,7 +173,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
152
173
  default: withCtx(() => [unref(tipVisible) ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(__props.contentTag), {
153
174
  key: 0,
154
175
  class: normalizeClass(contentClass.value),
155
- style: normalizeStyle([__props.style, { zIndex: unref(zIndex)() }]),
176
+ style: normalizeStyle([contentStyle.value, { zIndex: unref(zIndex)() }]),
156
177
  ref_key: "contentRef",
157
178
  ref: contentRef,
158
179
  onMouseenter: eventsHandlers.value.onMouseenter,
@@ -1 +1 @@
1
- {"version":3,"file":"tip.js","names":["_openBlock","_createElementBlock","_Fragment","_createCommentVNode","_createVNode","_unref","UNodeRender","_mergeProps","_createBlock","_Teleport","_Transition","_withCtx","_withDirectives","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withModifiers","_renderSlot","_createTextVNode","_toDisplayString"],"sources":["../../../src/components/tip/tip.vue"],"sourcesContent":["<template>\n <!-- 触发 -->\n <UNodeRender v-bind=\"eventsHandlers\" :content=\"renderDefaultSlotTrigger()\" ref=\"triggerRef\" />\n\n <!-- 弹出内容 -->\n <teleport :to=\"`#${popperContainerId}`\">\n <transition name=\"tip\">\n <component\n v-if=\"tipVisible\"\n :is=\"contentTag\"\n :class=\"contentClass\"\n :style=\"[style, { zIndex: zIndex() }]\"\n ref=\"contentRef\"\n @mouseenter=\"eventsHandlers.onMouseenter\"\n @mouseleave=\"eventsHandlers.onMouseleave\"\n @click.stop\n v-click-outside=\"handleClickOutside\"\n >\n <UNodeRender v-if=\"externalNode\" :content=\"externalNode\" />\n\n <slot name=\"content\">{{ content }}</slot>\n\n <div :class=\"cls.e('arrow')\" v-if=\"!hideArrow\" ref=\"arrowRef\"></div>\n </component>\n </transition>\n </teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps, usePop } from '@veltra/compositions'\nimport { vClickOutside } from '@veltra/directives'\nimport { bem, extractNormalVNodes, zIndex } from '@veltra/utils'\nimport { shallowRef, computed, useSlots, onBeforeUnmount, toRef, watch, nextTick } from 'vue'\n\nimport type { TipProps, ComponentSize, TipEmits } from '../../types'\nimport { UNodeRender } from '../node-render'\nimport { useNest } from './use-nest'\n\ndefineOptions({ name: 'UTip' })\n\nconst props = withDefaults(defineProps<TipProps>(), {\n content: '',\n trigger: 'hover',\n direction: 'top',\n alignment: 'center',\n contentTag: 'div',\n visible: undefined,\n showDelay: 0\n})\n\nconst emit = defineEmits<TipEmits>()\n\nconst cls = bem('tip')\nconst slots = useSlots()\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst contentClass = computed(() => {\n const fixed = [cls.e('content'), cls.m(size.value), props.type && cls.m('color-' + props.type)]\n const className = props.class\n if (!Array.isArray(className)) {\n return [...fixed, className]\n }\n return [...fixed, ...className]\n})\n\nconst triggerRef = shallowRef<InstanceType<typeof UNodeRender>>()\nconst contentRef = shallowRef<HTMLElement>()\nconst arrowRef = shallowRef<HTMLElement>()\n\nconst _visible = shallowRef(false)\n\nconst visible = computed(() => {\n return props.visible !== undefined ? props.visible : _visible.value\n})\n\nfunction updateVisible(v: boolean) {\n if (props.visible === undefined) {\n _visible.value = v\n } else {\n emit('update:visible', v)\n }\n}\n\nconst tipVisible = useNest(visible)\n\nfunction renderDefaultSlotTrigger() {\n const nodes = slots.default?.()\n if (!nodes?.length) return null\n return extractNormalVNodes(nodes)[0]\n}\n\nconst eventsHandlers = computed(() => {\n const { trigger, disabled } = props\n\n const handlers: Record<string, Function> = {}\n\n if (disabled) return handlers\n\n if (trigger === 'click') {\n handlers.onClick = open\n } else if (trigger === 'hover') {\n handlers.onMouseenter = open\n handlers.onMouseleave = close\n }\n\n return handlers\n})\n\nconst handleClickOutside = (e: MouseEvent) => {\n if (props.trigger === 'hover') return\n\n // 点击的元素在触发元素中则啥也\n if (props.trigger === 'click' && triggerDom.value.contains(e.target as Node)) {\n return\n }\n close()\n}\n\nlet openTimer: ReturnType<typeof setTimeout> | undefined\nlet closeTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction clearOpenTimer() {\n if (openTimer !== undefined) {\n clearTimeout(openTimer)\n openTimer = undefined\n }\n}\n\nfunction clearCloseTimer() {\n if (closeTimer !== undefined) {\n clearTimeout(closeTimer)\n closeTimer = undefined\n }\n}\n\n/** 弹出 */\nconst open = (e?: PointerEvent) => {\n e?.stopPropagation()\n clearCloseTimer()\n\n const delay = props.trigger === 'hover' ? props.showDelay : 0\n if (delay <= 0) {\n clearOpenTimer()\n updateVisible(true)\n return\n }\n\n clearOpenTimer()\n openTimer = setTimeout(() => {\n openTimer = undefined\n updateVisible(true)\n }, delay)\n}\n/** 关闭 */\nconst close = () => {\n clearOpenTimer()\n\n if (props.trigger === 'hover') {\n closeTimer = setTimeout(() => {\n closeTimer = undefined\n updateVisible(false)\n }, 250)\n } else {\n updateVisible(false)\n }\n}\n\nconst triggerDom = computed(() => {\n return props.triggerDom || triggerRef.value?.$el\n})\n\nconst { update, popperContainerId } = usePop({\n triggerRef: triggerDom,\n contentRef,\n arrowRef,\n direction: toRef(() => props.direction),\n alignment: toRef(() => props.alignment),\n onTriggerPositionChange() {\n close()\n }\n})\n\nwatch(triggerDom, (dom) => {\n // TODO: 看起来不是很优雅\n if (dom?.nodeType === Node.ELEMENT_NODE && visible.value) {\n nextT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eRender","_mergeProps","_createBlock","_Teleport","_Transition","_withCtx","_withDirectives","_resolveDynamicComponent","_normalizeClass","_normalizeStyle","_withModifiers","_renderSlot","_createTextVNode","_toDisplayString"],"sources":["../../../src/components/tip/tip.vue"],"sourcesContent":["<template>\n <!-- 触发 -->\n <UNodeRender v-bind=\"eventsHandlers\" :content=\"renderDefaultSlotTrigger()\" ref=\"triggerRef\" />\n\n <!-- 弹出内容 -->\n <teleport :to=\"`#${popperContainerId}`\">\n <transition name=\"tip\">\n <component\n v-if=\"tipVisible\"\n :is=\"contentTag\"\n :class=\"contentClass\"\n :style=\"[contentStyle, { zIndex: zIndex() }]\"\n ref=\"contentRef\"\n @mouseenter=\"eventsHandlers.onMouseenter\"\n @mouseleave=\"eventsHandlers.onMouseleave\"\n @click.stop\n v-click-outside=\"handleClickOutside\"\n >\n <UNodeRender v-if=\"externalNode\" :content=\"externalNode\" />\n\n <slot name=\"content\">{{ content }}</slot>\n\n <div :class=\"cls.e('arrow')\" v-if=\"!hideArrow\" ref=\"arrowRef\"></div>\n </component>\n </transition>\n </teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps, usePop } from '@veltra/compositions'\nimport { vClickOutside } from '@veltra/directives'\nimport { bem, extractNormalVNodes, zIndex } from '@veltra/utils'\nimport { shallowRef, computed, useSlots, onBeforeUnmount, toRef, watch, nextTick } from 'vue'\n\nimport type { TipProps, ComponentSize, TipEmits } from '../../types'\nimport { UNodeRender } from '../node-render'\nimport { useNest } from './use-nest'\n\ndefineOptions({ name: 'UTip' })\n\nconst props = withDefaults(defineProps<TipProps>(), {\n content: '',\n trigger: 'hover',\n direction: 'top',\n alignment: 'center',\n contentTag: 'div',\n visible: undefined,\n showDelay: 0\n})\n\nconst emit = defineEmits<TipEmits>()\n\nconst cls = bem('tip')\nconst slots = useSlots()\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst contentClass = computed(() => {\n const fixed = [cls.e('content'), cls.m(size.value), props.type && cls.m('color-' + props.type)]\n const className = props.class\n if (!Array.isArray(className)) {\n return [...fixed, className]\n }\n return [...fixed, ...className]\n})\n\nconst triggerRef = shallowRef<InstanceType<typeof UNodeRender>>()\nconst contentRef = shallowRef<HTMLElement>()\nconst arrowRef = shallowRef<HTMLElement>()\n\nconst _visible = shallowRef(false)\n\nconst visible = computed(() => {\n return props.visible !== undefined ? props.visible : _visible.value\n})\n\nfunction updateVisible(v: boolean) {\n if (props.visible === undefined) {\n _visible.value = v\n } else {\n emit('update:visible', v)\n }\n}\n\nconst tipVisible = useNest(visible)\n\nfunction renderDefaultSlotTrigger() {\n const nodes = slots.default?.()\n if (!nodes?.length) return null\n return extractNormalVNodes(nodes)[0]\n}\n\nconst eventsHandlers = computed(() => {\n const { trigger, disabled } = props\n\n const handlers: Record<string, Function> = {}\n\n if (disabled) return handlers\n\n if (trigger === 'click') {\n handlers.onClick = open\n } else if (trigger === 'hover') {\n handlers.onMouseenter = open\n handlers.onMouseleave = close\n }\n\n return handlers\n})\n\nconst handleClickOutside = (e: MouseEvent) => {\n if (props.trigger === 'hover') return\n\n // 点击的元素在触发元素中则啥也\n if (props.trigger === 'click' && triggerDom.value.contains(e.target as Node)) {\n return\n }\n close()\n}\n\nlet openTimer: ReturnType<typeof setTimeout> | undefined\nlet closeTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction clearOpenTimer() {\n if (openTimer !== undefined) {\n clearTimeout(openTimer)\n openTimer = undefined\n }\n}\n\nfunction clearCloseTimer() {\n if (closeTimer !== undefined) {\n clearTimeout(closeTimer)\n closeTimer = undefined\n }\n}\n\n/** 弹出 */\nconst open = (e?: PointerEvent) => {\n e?.stopPropagation()\n clearCloseTimer()\n\n const delay = props.trigger === 'hover' ? props.showDelay : 0\n if (delay <= 0) {\n clearOpenTimer()\n updateVisible(true)\n return\n }\n\n clearOpenTimer()\n openTimer = setTimeout(() => {\n openTimer = undefined\n updateVisible(true)\n }, delay)\n}\n/** 关闭 */\nconst close = () => {\n clearOpenTimer()\n\n if (props.trigger === 'hover') {\n closeTimer = setTimeout(() => {\n closeTimer = undefined\n updateVisible(false)\n }, 250)\n } else {\n updateVisible(false)\n }\n}\n\nconst triggerDom = computed(() => {\n return props.triggerDom || triggerRef.value?.$el\n})\n\ntype TipSide = 'top' | 'bottom' | 'left' | 'right'\n\nconst placementSide = shallowRef<TipSide>(props.direction)\n\nfunction originFor(side: TipSide): string {\n if (side === 'top') return 'center bottom'\n if (side === 'bottom') return 'center top'\n if (side === 'left') return 'right center'\n return 'left center'\n}\n\nconst contentStyle = computed(() => {\n const origin = { transformOrigin: originFor(placementSide.value) }\n const base = props.style\n if (base == null || base === '') return origin\n if (typeof base === 'string') return [base, origin]\n return [base, origin]\n})\n\nwatch(\n () => props.direction,\n (side) => {\n placementSide.value = side\n }\n)\n\nconst { update, popperContainerId } = usePop({\n triggerRef: triggerDom,\n contentRef,\n arrowRef,\n direction: toRef(() => props.direction),\n alignment: toRef(() => props.alignment),\n onTriggerPositionChange() {\n close()\n },\n onPop(position) {\n const side = position.placement.split('-')[0] as TipSide\n if (side === 'top' || side === 'bottom' || side === 'left' || side === 'right') {\n placementSide.value = side\n }\n }\n})\n\nwatch(triggerDom, (dom) => {\n // TODO: 看起来不是很优雅\n if (dom?.nodeType === Node.ELEMENT_NODE && visible.value) {\n nextTick(() => {\n void update()\n })\n }\n})\n\n/** 外部节点 */\nconst externalNode = shallowRef<any>()\n\nonBeforeUnmount(() => {\n clearOpenTimer()\n clearCloseTimer()\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,QAAQ;EAUd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,KAAK;EACrB,MAAM,QAAQ,SAAS;EACvB,MAAM,EAAE,SAAS,iBAAiB,CAAC,KAAK,GAAG,EAAE,MAAM,UAA2B,CAAC;EAE/E,MAAM,eAAe,eAAe;GAClC,MAAM,QAAQ;IAAC,IAAI,EAAE,SAAS;IAAG,IAAI,EAAE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Ka,eAAET,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;QAAiC,SAAA;QAAJ,KAAI;;;;;;;;;K,MANlC,CAAAA,MAAA,aAAA,GAAA,kBAAkB,C"}
@@ -1,2 +1 @@
1
- import "../button/style.js";
2
- import "../checkbox/style.js";
1
+ import "../button/style.js";
@@ -79,12 +79,13 @@
79
79
  cursor: not-allowed;
80
80
  }
81
81
  .u-transfer-list__body {
82
- flex: 1;
82
+ flex: none;
83
83
  height: 240px;
84
84
  margin: 0;
85
85
  padding: 0;
86
86
  list-style: none;
87
87
  overflow-y: auto;
88
+ position: relative;
88
89
  }
89
90
  .u-transfer-list__item {
90
91
  cursor: pointer;
@@ -93,6 +94,10 @@
93
94
  justify-content: flex-start;
94
95
  align-items: center;
95
96
  flex-wrap: nowrap;
97
+ transition: background-color var(--u-transition-fast) var(--u-transition-ease);
98
+ }
99
+ .u-transfer-list__item:not(.is-disabled):active {
100
+ background-color: var(--u-bg-color-hover);
96
101
  }
97
102
  .u-transfer-list__item:hover {
98
103
  background-color: var(--u-bg-color-hover);
@@ -109,6 +114,21 @@
109
114
  text-overflow: ellipsis;
110
115
  white-space: nowrap;
111
116
  }
117
+ .u-transfer-list .u-transfer-list-enter-active,
118
+ .u-transfer-list .u-transfer-list-leave-active {
119
+ transition: opacity var(--u-transition-fast) var(--u-transition-ease-out);
120
+ }
121
+ .u-transfer-list .u-transfer-list-enter-from,
122
+ .u-transfer-list .u-transfer-list-leave-to {
123
+ opacity: 0;
124
+ }
125
+ .u-transfer-list .u-transfer-list-leave-active {
126
+ position: absolute;
127
+ width: 100%;
128
+ }
129
+ .u-transfer-list .u-transfer-list-move {
130
+ transition: transform var(--u-transition-normal) var(--u-transition-ease);
131
+ }
112
132
  .u-transfer-list__empty {
113
133
  height: 240px;
114
134
  display: flex;
@@ -1,6 +1,6 @@
1
1
  import _sfc_main$1 from "../empty/empty.js";
2
2
  import _sfc_main$2 from "../checkbox/checkbox.js";
3
- import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, toDisplayString, unref, vModelText, withDirectives, withModifiers } from "vue";
3
+ import { Fragment, TransitionGroup, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, toDisplayString, unref, vModelText, withCtx, withDirectives, withModifiers } from "vue";
4
4
  import { bem } from "@veltra/utils";
5
5
  //#region src/components/transfer/transfer-list.vue
6
6
  const _hoisted_1 = ["placeholder", "disabled"];
@@ -72,22 +72,25 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
72
72
  filtered.value.length ? (openBlock(), createElementBlock("ul", {
73
73
  key: 1,
74
74
  class: normalizeClass(unref(cls).e("body"))
75
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(filtered.value, (option) => {
76
- return openBlock(), createElementBlock("li", {
77
- key: option.key,
78
- class: normalizeClass([unref(cls).e("item"), unref(bem).is("disabled", __props.disabled || option.disabled)]),
79
- onClick: ($event) => handleItemClick(option)
80
- }, [createVNode(unref(_sfc_main$2), {
81
- "model-value": __props.checkedKeys.has(option.key),
82
- disabled: __props.disabled || option.disabled,
83
- "onUpdate:modelValue": ($event) => emit("check", option.key, $event),
84
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
85
- }, null, 8, [
86
- "model-value",
87
- "disabled",
88
- "onUpdate:modelValue"
89
- ]), createElementVNode("span", { class: normalizeClass(unref(cls).e("item-label")) }, toDisplayString(option.label), 3)], 10, _hoisted_2);
90
- }), 128))], 2)) : (openBlock(), createElementBlock("div", {
75
+ }, [createCommentVNode(" 两栏间移动:离场/入场带方向位移,-move FLIP 让位;过滤增删同样受益 "), createVNode(TransitionGroup, { name: unref(cls).b }, {
76
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(filtered.value, (option) => {
77
+ return openBlock(), createElementBlock("li", {
78
+ key: option.key,
79
+ class: normalizeClass([unref(cls).e("item"), unref(bem).is("disabled", __props.disabled || option.disabled)]),
80
+ onClick: ($event) => handleItemClick(option)
81
+ }, [createVNode(unref(_sfc_main$2), {
82
+ "model-value": __props.checkedKeys.has(option.key),
83
+ disabled: __props.disabled || option.disabled,
84
+ "onUpdate:modelValue": ($event) => emit("check", option.key, $event),
85
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
86
+ }, null, 8, [
87
+ "model-value",
88
+ "disabled",
89
+ "onUpdate:modelValue"
90
+ ]), createElementVNode("span", { class: normalizeClass(unref(cls).e("item-label")) }, toDisplayString(option.label), 3)], 10, _hoisted_2);
91
+ }), 128))]),
92
+ _: 1
93
+ }, 8, ["name"])], 2)) : (openBlock(), createElementBlock("div", {
91
94
  key: 2,
92
95
  class: normalizeClass(unref(cls).e("empty"))
93
96
  }, [createVNode(unref(_sfc_main$1))], 2))
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-list.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_createVNode","UCheckbox","_toDisplayString","_withDirectives","_vModelText","_createCommentVNode","_Fragment","_renderList","_withModifiers","UEmpty"],"sources":["../../../src/components/transfer/transfer-list.vue"],"sourcesContent":["<template>\n <div :class=\"[cls.b, cls.m(size)]\">\n <div :class=\"cls.e('header')\">\n <u-checkbox\n :model-value=\"allChecked\"\n :indeterminate=\"indeterminate\"\n :disabled=\"disabled || !selectable.length\"\n @update:model-value=\"handleCheckAll\"\n />\n\n <span :class=\"cls.e('title')\">{{ title }}</span>\n\n <span :class=\"cls.e('count')\">{{ checkedCount }}/{{ options.length }}</span>\n </div>\n\n <div v-if=\"filterable\" :class=\"cls.e('filter')\">\n <input\n v-model=\"query\"\n :class=\"cls.e('filter-input')\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n />\n </div>\n\n <ul v-if=\"filtered.length\" :class=\"cls.e('body')\">\n <li\n v-for=\"option of filtered\"\n :key=\"option.key\"\n :class=\"[cls.e('item'), bem.is('disabled', disabled || option.disabled)]\"\n @click=\"handleItemClick(option)\"\n >\n <u-checkbox\n :model-value=\"checkedKeys.has(option.key)\"\n :disabled=\"disabled || option.disabled\"\n @update:model-value=\"emit('check', option.key, $event)\"\n @click.stop\n />\n\n <span :class=\"cls.e('item-label')\">{{ option.label }}</span>\n </li>\n </ul>\n\n <div v-else :class=\"cls.e('empty')\">\n <u-empty />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport type { ComponentSize } from '@veltra/utils'\nimport { bem } from '@veltra/utils'\nimport { computed, ref } from 'vue'\n\nimport type { TransferOption } from '../../types'\nimport { UCheckbox } from '../checkbox'\nimport { UEmpty } from '../empty'\n\ndefineOptions({ name: 'UTransferList' })\n\nconst {\n title = '',\n options = [],\n checkedKeys,\n filterable = false,\n placeholder = '',\n disabled = false,\n size = 'default'\n} = defineProps<{\n /** 栏标题 */\n title?: string\n /** 本栏选项 */\n options?: TransferOption[]\n /** 两栏共用的勾选 key 集合 */\n checkedKeys: Set<string | number>\n /** 是否显示搜索框 */\n filterable?: boolean\n /** 搜索框占位符 */\n placeholder?: string\n /** 是否禁用整栏 */\n disabled?: boolean\n /** 组件尺寸 */\n size?: ComponentSize\n}>()\n\nconst emit = defineEmits<{\n (e: 'check', key: string | number, checked: boolean): void\n (e: 'check-all', keys: Array<string | number>, checked: boolean): void\n}>()\n\nconst cls = bem('transfer-list')\n\nconst query = ref('')\n\n/** 搜索只作用于本栏,按 label 匹配 */\nconst filtered = computed(() => options.filter((o) => o.label.includes(query.value)))\nconst selectable = computed(() => filtered.value.filter((o) => !o.disabled))\n\nconst allChecked = computed(\n () => selectable.value.length > 0 && selectable.value.every((o) => checkedKeys.has(o.key))\n)\n\nconst indeterminate = computed(() => {\n const count = selectable.value.filter((o) => checkedKeys.has(o.key)).length\n return count > 0 && !allChecked.value\n})\n\nconst checkedCount = computed(() => options.filter((o) => checkedKeys.has(o.key)).length)\n\nfunction handleCheckAll(checked: boolean) {\n const keys = checked\n ? selectable.value.map((o) => o.key)\n : filtered.value.filter((o) => checkedKeys.has(o.key)).map((o) => o.key)\n emit('check-all', keys, checked)\n}\n\nfunction handleItemClick(option: TransferOption) {\n if (disabled || option.disabled) return\n emit('check', option.key, !checkedKeys.has(option.key))\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFA,MAAM,OAAO;EAKb,MAAM,MAAM,IAAI,eAAe;EAE/B,MAAM,QAAQ,IAAI,EAAE;;EAGpB,MAAM,WAAW,eAAe,QAAA,QAAQ,QAAQ,MAAM,EAAE,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC;EACpF,MAAM,aAAa,eAAe,SAAS,MAAM,QAAQ,MAAM,CAAC,EAAE,QAAQ,CAAC;EAE3E,MAAM,aAAa,eACX,WAAW,MAAM,SAAS,KAAK,WAAW,MAAM,OAAO,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAC3F;EAEA,MAAM,gBAAgB,eAAe;GAEnC,OADc,WAAW,MAAM,QAAQ,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,SACtD,KAAK,CAAC,WAAW;EAClC,CAAC;EAED,MAAM,eAAe,eAAe,QAAA,QAAQ,QAAQ,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM;EAExF,SAAS,eAAe,SAAkB;GACxC,MAAM,OAAO,UACT,WAAW,MAAM,KAAK,MAAM,EAAE,GAAG,IACjC,SAAS,MAAM,QAAQ,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,GAAG;GACzE,KAAK,aAAa,MAAM,OAAO;EACjC;EAEA,SAAS,gBAAgB,QAAwB;GAC/C,IAAI,QAAA,YAAY,OAAO,UAAU;GACjC,KAAK,SAAS,OAAO,KAAK,CAAC,QAAA,YAAY,IAAI,OAAO,GAAG,CAAC;EACxD;;GArHE,OAAAA,UAAA,GAAAC,mBA4CM,OAAA,EA5CA,OAAK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,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,GAAUA,MAAA,GAAA,CAAG,CAAC,GAAE,YAAa,QAAA,YAAY,OAAO,QAAQ,CAAA,CAAA;MACrE,UAAK,WAAE,gBAAgB,MAAM;K,IAE9BE,YAKEF,MAAAG,WAAA,GAAA;MAJC,eAAa,QAAA,YAAY,IAAI,OAAO,GAAG;MACvC,UAAU,QAAA,YAAY,OAAO;MAC7B,wBAAkB,WAAE,KAAI,SAAU,OAAO,KAAK,MAAM;MACpD,SAAK,OAAA,OAAA,OAAA,KAAAO,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;;;;;K,IAGbT,mBAA4D,QAAA,EAArD,OAAKF,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,YAAA,CAAA,EAAmB,GAAAI,gBAAA,OAAO,KAAK,GAAA,CAAA,C;I,mBAItDP,UAAA,GAAAC,mBAEM,OAAA;;KAFO,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;I,IACvBE,YAAWF,MAAAW,WAAA,CAAA,C"}
1
+ {"version":3,"file":"transfer-list.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_createVNode","UCheckbox","_toDisplayString","_withDirectives","_vModelText","_createCommentVNode","_TransitionGroup","_withCtx","_Fragment","_renderList","_withModifiers","UEmpty"],"sources":["../../../src/components/transfer/transfer-list.vue"],"sourcesContent":["<template>\n <div :class=\"[cls.b, cls.m(size)]\">\n <div :class=\"cls.e('header')\">\n <u-checkbox\n :model-value=\"allChecked\"\n :indeterminate=\"indeterminate\"\n :disabled=\"disabled || !selectable.length\"\n @update:model-value=\"handleCheckAll\"\n />\n\n <span :class=\"cls.e('title')\">{{ title }}</span>\n\n <span :class=\"cls.e('count')\">{{ checkedCount }}/{{ options.length }}</span>\n </div>\n\n <div v-if=\"filterable\" :class=\"cls.e('filter')\">\n <input\n v-model=\"query\"\n :class=\"cls.e('filter-input')\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n />\n </div>\n\n <ul v-if=\"filtered.length\" :class=\"cls.e('body')\">\n <!-- 两栏间移动:离场/入场带方向位移,-move FLIP 让位;过滤增删同样受益 -->\n <TransitionGroup :name=\"cls.b\">\n <li\n v-for=\"option of filtered\"\n :key=\"option.key\"\n :class=\"[cls.e('item'), bem.is('disabled', disabled || option.disabled)]\"\n @click=\"handleItemClick(option)\"\n >\n <u-checkbox\n :model-value=\"checkedKeys.has(option.key)\"\n :disabled=\"disabled || option.disabled\"\n @update:model-value=\"emit('check', option.key, $event)\"\n @click.stop\n />\n\n <span :class=\"cls.e('item-label')\">{{ option.label }}</span>\n </li>\n </TransitionGroup>\n </ul>\n\n <div v-else :class=\"cls.e('empty')\">\n <u-empty />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport type { ComponentSize } from '@veltra/utils'\nimport { bem } from '@veltra/utils'\nimport { computed, ref } from 'vue'\n\nimport type { TransferOption } from '../../types'\nimport { UCheckbox } from '../checkbox'\nimport { UEmpty } from '../empty'\n\ndefineOptions({ name: 'UTransferList' })\n\nconst {\n title = '',\n options = [],\n checkedKeys,\n filterable = false,\n placeholder = '',\n disabled = false,\n size = 'default'\n} = defineProps<{\n /** 栏标题 */\n title?: string\n /** 本栏选项 */\n options?: TransferOption[]\n /** 两栏共用的勾选 key 集合 */\n checkedKeys: Set<string | number>\n /** 是否显示搜索框 */\n filterable?: boolean\n /** 搜索框占位符 */\n placeholder?: string\n /** 是否禁用整栏 */\n disabled?: boolean\n /** 组件尺寸 */\n size?: ComponentSize\n}>()\n\nconst emit = defineEmits<{\n (e: 'check', key: string | number, checked: boolean): void\n (e: 'check-all', keys: Array<string | number>, checked: boolean): void\n}>()\n\nconst cls = bem('transfer-list')\n\nconst query = ref('')\n\n/** 搜索只作用于本栏,按 label 匹配 */\nconst filtered = computed(() => options.filter((o) => o.label.includes(query.value)))\nconst selectable = computed(() => filtered.value.filter((o) => !o.disabled))\n\nconst allChecked = computed(\n () => selectable.value.length > 0 && selectable.value.every((o) => checkedKeys.has(o.key))\n)\n\nconst indeterminate = computed(() => {\n const count = selectable.value.filter((o) => checkedKeys.has(o.key)).length\n return count > 0 && !allChecked.value\n})\n\nconst checkedCount = computed(() => options.filter((o) => checkedKeys.has(o.key)).length)\n\nfunction handleCheckAll(checked: boolean) {\n const keys = checked\n ? selectable.value.map((o) => o.key)\n : filtered.value.filter((o) => checkedKeys.has(o.key)).map((o) => o.key)\n emit('check-all', keys, checked)\n}\n\nfunction handleItemClick(option: TransferOption) {\n if (disabled || option.disabled) return\n emit('check', option.key, !checkedKeys.has(option.key))\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAuFA,MAAM,OAAO;EAKb,MAAM,MAAM,IAAI,eAAe;EAE/B,MAAM,QAAQ,IAAI,EAAE;;EAGpB,MAAM,WAAW,eAAe,QAAA,QAAQ,QAAQ,MAAM,EAAE,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC;EACpF,MAAM,aAAa,eAAe,SAAS,MAAM,QAAQ,MAAM,CAAC,EAAE,QAAQ,CAAC;EAE3E,MAAM,aAAa,eACX,WAAW,MAAM,SAAS,KAAK,WAAW,MAAM,OAAO,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAC3F;EAEA,MAAM,gBAAgB,eAAe;GAEnC,OADc,WAAW,MAAM,QAAQ,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,SACtD,KAAK,CAAC,WAAW;EAClC,CAAC;EAED,MAAM,eAAe,eAAe,QAAA,QAAQ,QAAQ,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM;EAExF,SAAS,eAAe,SAAkB;GACxC,MAAM,OAAO,UACT,WAAW,MAAM,KAAK,MAAM,EAAE,GAAG,IACjC,SAAS,MAAM,QAAQ,MAAM,QAAA,YAAY,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,MAAM,EAA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AAC,mBAmBK,MAAA;;KAnBuB,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,CAAA;I,IACtCO,mBAAA,2CAAA,GACAL,YAgBkBM,iBAAA,EAhBA,MAAMR,MAAA,GAAA,CAAG,CAAC,E;KAExB,SAAAS,cAA0B,EAD5BZ,UAAA,IAAA,GAAAC,mBAcKY,UAAA,MAAAC,WAbc,SAAA,QAAV,WAAM;MADf,OAAAd,UAAA,GAAAC,mBAcK,MAAA;OAZF,KAAK,OAAO;OACZ,OAAKC,eAAA,CAAGC,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,GAAUA,MAAA,GAAA,CAAG,CAAC,GAAE,YAAa,QAAA,YAAY,OAAO,QAAQ,CAAA,CAAA;OACrE,UAAK,WAAE,gBAAgB,MAAM;M,IAE9BE,YAKEF,MAAAG,WAAA,GAAA;OAJC,eAAa,QAAA,YAAY,IAAI,OAAO,GAAG;OACvC,UAAU,QAAA,YAAY,OAAO;OAC7B,wBAAkB,WAAE,KAAI,SAAU,OAAO,KAAK,MAAM;OACpD,SAAK,OAAA,OAAA,OAAA,KAAAS,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;;;;;M,IAGbX,mBAA4D,QAAA,EAArD,OAAKF,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,YAAA,CAAA,EAAmB,GAAAI,gBAAA,OAAO,KAAK,GAAA,CAAA,C;;;I,yBAKxDP,UAAA,GAAAC,mBAEM,OAAA;;KAFO,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;I,IACvBE,YAAWF,MAAAa,WAAA,CAAA,C"}
@@ -1 +1 @@
1
- import "../checkbox/style.js";
1
+ export {}
@@ -119,11 +119,14 @@
119
119
  height: 20px;
120
120
  font-size: 20px;
121
121
  border-radius: 50%;
122
- transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
122
+ transition: transform var(--u-transition-fast) var(--u-transition-ease), background-color var(--u-transition-fast) var(--u-transition-ease);
123
123
  }
124
124
  .u-tree__expand-icon:hover {
125
125
  background-color: var(--u-bg-color-hover);
126
126
  }
127
+ .u-tree__expand-icon:active {
128
+ background-color: var(--u-bg-color-middle);
129
+ }
127
130
  .u-tree__leaf-icon {
128
131
  flex-shrink: 0;
129
132
  width: 20px;
@@ -138,7 +141,7 @@
138
141
  overflow: hidden;
139
142
  user-select: none;
140
143
  word-break: break-word;
141
- transition: background-color 0.2s ease;
144
+ transition: background-color var(--u-transition-fast) var(--u-transition-ease);
142
145
  display: flex;
143
146
  justify-content: flex-start;
144
147
  align-items: center;
@@ -1,3 +1 @@
1
- import "../dropdown/style.js";
2
- import "../input/style.js";
3
- import "../tree/style.js";
1
+ import "../dropdown/style.js";