@veltra/desktop 1.8.5 → 1.9.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 (195) hide show
  1. package/dist/components/alert/alert.js +69 -0
  2. package/dist/components/alert/alert.js.map +1 -0
  3. package/dist/components/alert/style.d.ts +1 -0
  4. package/dist/components/alert/style.js +1 -0
  5. package/dist/components/alert/style2.css +76 -0
  6. package/dist/components/anchor/anchor-item.js +35 -0
  7. package/dist/components/anchor/anchor-item.js.map +1 -0
  8. package/dist/components/anchor/anchor.js +61 -0
  9. package/dist/components/anchor/anchor.js.map +1 -0
  10. package/dist/components/anchor/di.js +6 -0
  11. package/dist/components/anchor/di.js.map +1 -0
  12. package/dist/components/anchor/style.d.ts +1 -0
  13. package/dist/components/anchor/style.js +1 -0
  14. package/dist/components/anchor/style2.css +45 -0
  15. package/dist/components/anchor/use-anchor.js +81 -0
  16. package/dist/components/anchor/use-anchor.js.map +1 -0
  17. package/dist/components/avatar/avatar-group.js +28 -0
  18. package/dist/components/avatar/avatar-group.js.map +1 -0
  19. package/dist/components/avatar/avatar.js +51 -0
  20. package/dist/components/avatar/avatar.js.map +1 -0
  21. package/dist/components/avatar/style.d.ts +1 -0
  22. package/dist/components/avatar/style.js +1 -0
  23. package/dist/components/avatar/style2.css +87 -0
  24. package/dist/components/back-top/back-top.js +82 -0
  25. package/dist/components/back-top/back-top.js.map +1 -0
  26. package/dist/components/back-top/style.d.ts +1 -0
  27. package/dist/components/back-top/style.js +2 -0
  28. package/dist/components/back-top/style2.css +32 -0
  29. package/dist/components/carousel/carousel-item.js +27 -0
  30. package/dist/components/carousel/carousel-item.js.map +1 -0
  31. package/dist/components/carousel/carousel.js +118 -0
  32. package/dist/components/carousel/carousel.js.map +1 -0
  33. package/dist/components/carousel/di.js +7 -0
  34. package/dist/components/carousel/di.js.map +1 -0
  35. package/dist/components/carousel/style.d.ts +1 -0
  36. package/dist/components/carousel/style.js +1 -0
  37. package/dist/components/carousel/style2.css +97 -0
  38. package/dist/components/carousel/use-carousel.js +68 -0
  39. package/dist/components/carousel/use-carousel.js.map +1 -0
  40. package/dist/components/descriptions/descriptions-item.js +16 -0
  41. package/dist/components/descriptions/descriptions-item.js.map +1 -0
  42. package/dist/components/descriptions/descriptions.js +67 -0
  43. package/dist/components/descriptions/descriptions.js.map +1 -0
  44. package/dist/components/descriptions/style.d.ts +1 -0
  45. package/dist/components/descriptions/style.js +1 -0
  46. package/dist/components/descriptions/style2.css +81 -0
  47. package/dist/components/divider/divider.js +41 -0
  48. package/dist/components/divider/divider.js.map +1 -0
  49. package/dist/components/divider/style.d.ts +1 -0
  50. package/dist/components/divider/style.js +1 -0
  51. package/dist/components/divider/style2.css +68 -0
  52. package/dist/components/expression-editor/components/variable-picker.js +1 -1
  53. package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
  54. package/dist/components/image-cropper/image-cropper.js +1 -1
  55. package/dist/components/image-cropper/image-cropper.js.map +1 -1
  56. package/dist/components/index.d.ts +48 -30
  57. package/dist/components/index.js +95 -59
  58. package/dist/components/index.js.map +1 -1
  59. package/dist/components/input/input.js.map +1 -1
  60. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +2 -1
  61. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  62. package/dist/components/rate/rate.js +130 -0
  63. package/dist/components/rate/rate.js.map +1 -0
  64. package/dist/components/rate/style.d.ts +1 -0
  65. package/dist/components/rate/style.js +1 -0
  66. package/dist/components/rate/style2.css +58 -0
  67. package/dist/components/skeleton/skeleton.js +74 -0
  68. package/dist/components/skeleton/skeleton.js.map +1 -0
  69. package/dist/components/skeleton/style.d.ts +1 -0
  70. package/dist/components/skeleton/style.js +1 -0
  71. package/dist/components/skeleton/style2.css +86 -0
  72. package/dist/components/space/space.js +47 -0
  73. package/dist/components/space/space.js.map +1 -0
  74. package/dist/components/space/style.d.ts +1 -0
  75. package/dist/components/space/style.js +1 -0
  76. package/dist/components/space/style2.css +43 -0
  77. package/dist/components/time-picker/style.d.ts +2 -0
  78. package/dist/components/time-picker/style.js +3 -0
  79. package/dist/components/time-picker/style2.css +110 -0
  80. package/dist/components/time-picker/time-picker.js +196 -0
  81. package/dist/components/time-picker/time-picker.js.map +1 -0
  82. package/dist/components/timeline/style.d.ts +1 -0
  83. package/dist/components/timeline/style.js +1 -0
  84. package/dist/components/timeline/style2.css +95 -0
  85. package/dist/components/timeline/timeline-item.js +32 -0
  86. package/dist/components/timeline/timeline-item.js.map +1 -0
  87. package/dist/components/timeline/timeline.js +17 -0
  88. package/dist/components/timeline/timeline.js.map +1 -0
  89. package/dist/components/transfer/style.d.ts +2 -0
  90. package/dist/components/transfer/style.js +4 -0
  91. package/dist/components/transfer/style2.css +172 -0
  92. package/dist/components/transfer/transfer-list.js +101 -0
  93. package/dist/components/transfer/transfer-list.js.map +1 -0
  94. package/dist/components/transfer/transfer.js +138 -0
  95. package/dist/components/transfer/transfer.js.map +1 -0
  96. package/dist/index.d.ts +119 -88
  97. package/dist/index.js +106 -88
  98. package/dist/types/alert.d.ts +27 -0
  99. package/dist/types/anchor.d.ts +48 -0
  100. package/dist/types/avatar.d.ts +28 -0
  101. package/dist/types/back-top.d.ts +19 -0
  102. package/dist/types/carousel.d.ts +25 -0
  103. package/dist/types/descriptions.d.ts +22 -0
  104. package/dist/types/divider.d.ts +14 -0
  105. package/dist/types/index.d.ts +14 -1
  106. package/dist/types/layout.d.ts +2 -1
  107. package/dist/types/rate.d.ts +26 -0
  108. package/dist/types/skeleton.d.ts +24 -0
  109. package/dist/types/space.d.ts +20 -0
  110. package/dist/types/time-picker.d.ts +38 -0
  111. package/dist/types/timeline.d.ts +16 -0
  112. package/dist/types/transfer.d.ts +37 -0
  113. package/package.json +2 -1
  114. package/src/components/alert/alert.vue +62 -0
  115. package/src/components/alert/index.ts +1 -0
  116. package/src/components/alert/style.scss +67 -0
  117. package/src/components/alert/style.ts +1 -0
  118. package/src/components/anchor/anchor-item.vue +35 -0
  119. package/src/components/anchor/anchor.vue +63 -0
  120. package/src/components/anchor/di.ts +15 -0
  121. package/src/components/anchor/index.ts +2 -0
  122. package/src/components/anchor/style.scss +44 -0
  123. package/src/components/anchor/style.ts +1 -0
  124. package/src/components/anchor/use-anchor.ts +120 -0
  125. package/src/components/avatar/avatar-group.vue +26 -0
  126. package/src/components/avatar/avatar.vue +52 -0
  127. package/src/components/avatar/index.ts +2 -0
  128. package/src/components/avatar/style.scss +79 -0
  129. package/src/components/avatar/style.ts +1 -0
  130. package/src/components/back-top/back-top.vue +89 -0
  131. package/src/components/back-top/index.ts +1 -0
  132. package/src/components/back-top/style.scss +31 -0
  133. package/src/components/back-top/style.ts +2 -0
  134. package/src/components/carousel/carousel-item.vue +27 -0
  135. package/src/components/carousel/carousel.vue +93 -0
  136. package/src/components/carousel/di.ts +15 -0
  137. package/src/components/carousel/index.ts +2 -0
  138. package/src/components/carousel/style.scss +109 -0
  139. package/src/components/carousel/style.ts +1 -0
  140. package/src/components/carousel/use-carousel.ts +77 -0
  141. package/src/components/descriptions/descriptions-item.vue +12 -0
  142. package/src/components/descriptions/descriptions.vue +81 -0
  143. package/src/components/descriptions/index.ts +2 -0
  144. package/src/components/descriptions/style.scss +73 -0
  145. package/src/components/descriptions/style.ts +1 -0
  146. package/src/components/divider/divider.vue +29 -0
  147. package/src/components/divider/index.ts +1 -0
  148. package/src/components/divider/style.scss +90 -0
  149. package/src/components/divider/style.ts +1 -0
  150. package/src/components/expression-editor/components/variable-picker.vue +1 -1
  151. package/src/components/image-cropper/image-cropper.vue +1 -1
  152. package/src/components/index.ts +26 -0
  153. package/src/components/input/__test__/input.test.ts +106 -0
  154. package/src/components/input/input.vue +4 -1
  155. package/src/components/rate/index.ts +1 -0
  156. package/src/components/rate/rate.vue +127 -0
  157. package/src/components/rate/style.scss +51 -0
  158. package/src/components/rate/style.ts +1 -0
  159. package/src/components/skeleton/index.ts +1 -0
  160. package/src/components/skeleton/skeleton.vue +37 -0
  161. package/src/components/skeleton/style.scss +94 -0
  162. package/src/components/skeleton/style.ts +1 -0
  163. package/src/components/space/index.ts +1 -0
  164. package/src/components/space/space.vue +45 -0
  165. package/src/components/space/style.scss +41 -0
  166. package/src/components/space/style.ts +1 -0
  167. package/src/components/time-picker/index.ts +1 -0
  168. package/src/components/time-picker/style.scss +82 -0
  169. package/src/components/time-picker/style.ts +3 -0
  170. package/src/components/time-picker/time-picker.vue +183 -0
  171. package/src/components/timeline/index.ts +2 -0
  172. package/src/components/timeline/style.scss +107 -0
  173. package/src/components/timeline/style.ts +1 -0
  174. package/src/components/timeline/timeline-item.vue +43 -0
  175. package/src/components/timeline/timeline.vue +17 -0
  176. package/src/components/transfer/index.ts +1 -0
  177. package/src/components/transfer/style.scss +135 -0
  178. package/src/components/transfer/style.ts +4 -0
  179. package/src/components/transfer/transfer-list.vue +120 -0
  180. package/src/components/transfer/transfer.vue +134 -0
  181. package/src/types/alert.ts +29 -0
  182. package/src/types/anchor.ts +50 -0
  183. package/src/types/avatar.ts +31 -0
  184. package/src/types/back-top.ts +20 -0
  185. package/src/types/carousel.ts +29 -0
  186. package/src/types/descriptions.ts +22 -0
  187. package/src/types/divider.ts +14 -0
  188. package/src/types/index.ts +16 -0
  189. package/src/types/layout.ts +2 -1
  190. package/src/types/rate.ts +27 -0
  191. package/src/types/skeleton.ts +29 -0
  192. package/src/types/space.ts +22 -0
  193. package/src/types/time-picker.ts +40 -0
  194. package/src/types/timeline.ts +15 -0
  195. package/src/types/transfer.ts +45 -0
@@ -0,0 +1,82 @@
1
+ import _sfc_main$1 from "../icon/icon.js";
2
+ import _sfc_main$2 from "../button/button.js";
3
+ import { Teleport, Transition, createBlock, createCommentVNode, createVNode, defineComponent, normalizeClass, onBeforeUnmount, onMounted, openBlock, shallowRef, unref, watch, withCtx } from "vue";
4
+ import { bem } from "@veltra/utils";
5
+ import { ArrowUp } from "@veltra/icons/normal";
6
+ //#region src/components/back-top/back-top.vue
7
+ const _sfc_main = /*@__PURE__*/ defineComponent({
8
+ name: "UBackTop",
9
+ __name: "back-top",
10
+ props: {
11
+ visibilityHeight: { default: 400 },
12
+ target: {}
13
+ },
14
+ emits: ["click"],
15
+ setup(__props, { emit: __emit }) {
16
+ const props = __props;
17
+ const emit = __emit;
18
+ const cls = bem("back-top");
19
+ const transitionName = cls.create("fade").b;
20
+ const visible = shallowRef(false);
21
+ let scrollTarget = null;
22
+ const resolveTarget = () => {
23
+ const { target } = props;
24
+ if (!target) return window;
25
+ if (typeof target === "string") return document.querySelector(target) ?? window;
26
+ return target;
27
+ };
28
+ const updateVisible = () => {
29
+ const top = scrollTarget === window ? window.scrollY : scrollTarget?.scrollTop ?? 0;
30
+ visible.value = top >= props.visibilityHeight;
31
+ };
32
+ const bind = () => {
33
+ scrollTarget = resolveTarget();
34
+ scrollTarget.addEventListener("scroll", updateVisible, { passive: true });
35
+ };
36
+ const unbind = () => {
37
+ scrollTarget?.removeEventListener("scroll", updateVisible);
38
+ scrollTarget = null;
39
+ };
40
+ watch(() => props.target, () => {
41
+ if (!scrollTarget) return;
42
+ unbind();
43
+ bind();
44
+ updateVisible();
45
+ });
46
+ onMounted(() => {
47
+ bind();
48
+ updateVisible();
49
+ });
50
+ onBeforeUnmount(unbind);
51
+ const scrollToTop = () => {
52
+ scrollTarget?.scrollTo({
53
+ top: 0,
54
+ behavior: "smooth"
55
+ });
56
+ emit("click");
57
+ };
58
+ return (_ctx, _cache) => {
59
+ return openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, { name: unref(transitionName) }, {
60
+ default: withCtx(() => [visible.value ? (openBlock(), createBlock(unref(_sfc_main$2), {
61
+ key: 0,
62
+ class: normalizeClass(unref(cls).b),
63
+ circle: "",
64
+ size: "large",
65
+ title: "回到顶部",
66
+ onClick: scrollToTop
67
+ }, {
68
+ default: withCtx(() => [createVNode(unref(_sfc_main$1), null, {
69
+ default: withCtx(() => [createVNode(unref(ArrowUp))]),
70
+ _: 1
71
+ })]),
72
+ _: 1
73
+ }, 8, ["class"])) : createCommentVNode("v-if", true)]),
74
+ _: 1
75
+ }, 8, ["name"])]);
76
+ };
77
+ }
78
+ });
79
+ //#endregion
80
+ export { _sfc_main as default };
81
+
82
+ //# sourceMappingURL=back-top.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"back-top.js","names":["_openBlock","_createBlock","_Teleport","_createVNode","_Transition","_unref","_withCtx","UButton","_normalizeClass","UIcon","_createCommentVNode"],"sources":["../../../src/components/back-top/back-top.vue"],"sourcesContent":["<template>\n <Teleport to=\"body\">\n <Transition :name=\"transitionName\">\n <u-button\n v-if=\"visible\"\n :class=\"cls.b\"\n circle\n size=\"large\"\n title=\"回到顶部\"\n @click=\"scrollToTop\"\n >\n <u-icon><ArrowUp /></u-icon>\n </u-button>\n </Transition>\n </Teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { ArrowUp } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { onBeforeUnmount, onMounted, shallowRef, watch } from 'vue'\n\nimport type { BackTopEmits, BackTopProps } from '../../types'\nimport { UButton } from '../button'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UBackTop' })\n\nconst props = withDefaults(defineProps<BackTopProps>(), { visibilityHeight: 400 })\n\nconst emit = defineEmits<BackTopEmits>()\n\nconst cls = bem('back-top')\nconst transitionName = cls.create('fade').b\n\nconst visible = shallowRef(false)\n\nlet scrollTarget: HTMLElement | Window | null = null\n\nconst resolveTarget = (): HTMLElement | Window => {\n const { target } = props\n\n if (!target) return window\n if (typeof target === 'string') {\n return document.querySelector<HTMLElement>(target) ?? window\n }\n return target\n}\n\nconst updateVisible = () => {\n const top =\n scrollTarget === window ? window.scrollY : ((scrollTarget as HTMLElement)?.scrollTop ?? 0)\n\n visible.value = top >= props.visibilityHeight\n}\n\nconst bind = () => {\n scrollTarget = resolveTarget()\n scrollTarget.addEventListener('scroll', updateVisible, { passive: true })\n}\n\nconst unbind = () => {\n scrollTarget?.removeEventListener('scroll', updateVisible)\n scrollTarget = null\n}\n\nwatch(\n () => props.target,\n () => {\n if (!scrollTarget) return\n\n unbind()\n bind()\n updateVisible()\n }\n)\n\nonMounted(() => {\n bind()\n updateVisible()\n})\n\nonBeforeUnmount(unbind)\n\nconst scrollToTop = () => {\n scrollTarget?.scrollTo({ top: 0, behavior: 'smooth' })\n emit('click')\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;EA4BA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,UAAU;EAC1B,MAAM,iBAAiB,IAAI,OAAO,MAAM,CAAC,CAAC;EAE1C,MAAM,UAAU,WAAW,KAAK;EAEhC,IAAI,eAA4C;EAEhD,MAAM,sBAA4C;GAChD,MAAM,EAAE,WAAW;GAEnB,IAAI,CAAC,QAAQ,OAAO;GACpB,IAAI,OAAO,WAAW,UACpB,OAAO,SAAS,cAA2B,MAAM,KAAK;GAExD,OAAO;EACT;EAEA,MAAM,sBAAsB;GAC1B,MAAM,MACJ,iBAAiB,SAAS,OAAO,UAAY,cAA8B,aAAa;GAE1F,QAAQ,QAAQ,OAAO,MAAM;EAC/B;EAEA,MAAM,aAAa;GACjB,eAAe,cAAc;GAC7B,aAAa,iBAAiB,UAAU,eAAe,EAAE,SAAS,KAAK,CAAC;EAC1E;EAEA,MAAM,eAAe;GACnB,cAAc,oBAAoB,UAAU,aAAa;GACzD,eAAe;EACjB;EAEA,YACQ,MAAM,cACN;GACJ,IAAI,CAAC,cAAc;GAEnB,OAAO;GACP,KAAK;GACL,cAAc;EAChB,CACF;EAEA,gBAAgB;GACd,KAAK;GACL,cAAc;EAChB,CAAC;EAED,gBAAgB,MAAM;EAEtB,MAAM,oBAAoB;GACxB,cAAc,SAAS;IAAE,KAAK;IAAG,UAAU;GAAS,CAAC;GACrD,KAAK,OAAO;EACd;;GAtFE,OAAAA,UAAA,GAAAC,YAaWC,UAAA,EAbD,IAAG,OAAM,GAAA,CACjBC,YAWaC,YAAA,EAXA,MAAMC,MAAA,cAAA,EAAc,GAAA;IAC/B,SAAAC,cASW,CARH,QAAA,SADRN,UAAA,GAAAC,YASWI,MAAAE,WAAA,GAAA;;KAPR,OAAKC,eAAEH,MAAA,GAAA,CAAG,CAAC,CAAC;KACb,QAAA;KACA,MAAK;KACL,OAAM;KACL,SAAO;;KAER,SAAAC,cAA4B,CAA5BH,YAA4BE,MAAAI,WAAA,GAAA,MAAA;MAApB,SAAAH,cAAW,CAAXH,YAAWE,MAAA,OAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1 @@
1
+ import "../button/style.js";
@@ -0,0 +1,2 @@
1
+ import "../button/style.js";
2
+ import "./style2.css";
@@ -0,0 +1,32 @@
1
+ @charset "UTF-8";
2
+ /** flex布局 */
3
+ /**
4
+ * 设置css变量
5
+ * 参数1:变量前缀
6
+ * 参数2: 一个由值组成的列表或者由key, value组成的map
7
+ * css-var(height, (
8
+ * large: 40px
9
+ * default: 32px
10
+ * small: 24px
11
+ * ))
12
+ * 生成的css变量:
13
+ * --u-height-large: 40px;
14
+ * --u-height-default: 32px;
15
+ * --u-height-small: 24px;
16
+ */
17
+ /** 暗色:`UITheme.render()` 按主题系列写入 html[data-theme] */
18
+ .u-back-top {
19
+ position: fixed;
20
+ right: 10px;
21
+ bottom: 10px;
22
+ z-index: 100;
23
+ box-shadow: var(--u-shadow-lg);
24
+ }
25
+
26
+ .u-back-top-fade-enter-active, .u-back-top-fade-leave-active {
27
+ transition: opacity var(--u-transition-normal) var(--u-transition-ease), transform var(--u-transition-normal) var(--u-transition-ease);
28
+ }
29
+ .u-back-top-fade-enter-from, .u-back-top-fade-leave-to {
30
+ opacity: 0;
31
+ transform: scale(0.4);
32
+ }
@@ -0,0 +1,27 @@
1
+ import { CarouselDIKey } from "./di.js";
2
+ import { computed, createElementBlock, defineComponent, getCurrentInstance, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, renderSlot, unref } from "vue";
3
+ import { bem } from "@veltra/utils";
4
+ //#region src/components/carousel/carousel-item.vue
5
+ const _hoisted_1 = ["aria-hidden"];
6
+ const _sfc_main = /*@__PURE__*/ defineComponent({
7
+ name: "UCarouselItem",
8
+ __name: "carousel-item",
9
+ setup(__props) {
10
+ const context = inject(CarouselDIKey, void 0);
11
+ const cls = context?.cls ?? bem("carousel");
12
+ const uid = getCurrentInstance()?.uid ?? -1;
13
+ const isActive = computed(() => context !== void 0 && context.itemUids.value.indexOf(uid) === context.current.value);
14
+ onMounted(() => context?.register(uid));
15
+ onBeforeUnmount(() => context?.unregister(uid));
16
+ return (_ctx, _cache) => {
17
+ return openBlock(), createElementBlock("div", {
18
+ class: normalizeClass(unref(cls).e("item")),
19
+ "aria-hidden": !isActive.value
20
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1);
21
+ };
22
+ }
23
+ });
24
+ //#endregion
25
+ export { _sfc_main as default };
26
+
27
+ //# sourceMappingURL=carousel-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carousel-item.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_renderSlot"],"sources":["../../../src/components/carousel/carousel-item.vue"],"sourcesContent":["<template>\n <div :class=\"cls.e('item')\" :aria-hidden=\"!isActive\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { computed, getCurrentInstance, inject, onBeforeUnmount, onMounted } from 'vue'\n\nimport { CarouselDIKey } from './di'\n\ndefineOptions({ name: 'UCarouselItem' })\n\nconst context = inject(CarouselDIKey, undefined)\n\nconst cls = context?.cls ?? bem('carousel')\n\nconst uid = getCurrentInstance()?.uid ?? -1\n\nconst isActive = computed(\n () => context !== undefined && context.itemUids.value.indexOf(uid) === context.current.value\n)\n\nonMounted(() => context?.register(uid))\nonBeforeUnmount(() => context?.unregister(uid))\n</script>\n"],"mappings":";;;;;;;;;EAcA,MAAM,UAAU,OAAO,eAAe,KAAA,CAAS;EAE/C,MAAM,MAAM,SAAS,OAAO,IAAI,UAAU;EAE1C,MAAM,MAAM,mBAAmB,CAAC,EAAE,OAAO;EAEzC,MAAM,WAAW,eACT,YAAY,KAAA,KAAa,QAAQ,SAAS,MAAM,QAAQ,GAAG,MAAM,QAAQ,QAAQ,KACzF;EAEA,gBAAgB,SAAS,SAAS,GAAG,CAAC;EACtC,sBAAsB,SAAS,WAAW,GAAG,CAAC;;GAxB5C,OAAAA,UAAA,GAAAC,mBAEM,OAAA;IAFA,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,CAAA;IAAW,eAAW,CAAG,SAAA;GACzC,GAAA,CAAAC,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,IAAA,UAAA"}
@@ -0,0 +1,118 @@
1
+ import _sfc_main$1 from "../icon/icon.js";
2
+ import { CarouselDIKey } from "./di.js";
3
+ import { useCarousel } from "./use-carousel.js";
4
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, openBlock, provide, ref, renderList, renderSlot, unref, useModel, watch, withCtx } from "vue";
5
+ import { bem } from "@veltra/utils";
6
+ import { ArrowLeft, ArrowRight } from "@veltra/icons/normal";
7
+ //#region src/components/carousel/carousel.vue
8
+ const _hoisted_1 = ["disabled"];
9
+ const _hoisted_2 = ["disabled"];
10
+ const _hoisted_3 = ["aria-label", "onClick"];
11
+ const _sfc_main = /*@__PURE__*/ defineComponent({
12
+ name: "UCarousel",
13
+ __name: "carousel",
14
+ props: /*@__PURE__*/ mergeModels({
15
+ activeIndex: {},
16
+ autoplay: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ interval: { default: 3e3 },
21
+ loop: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ arrows: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ dots: {
30
+ type: Boolean,
31
+ default: true
32
+ }
33
+ }, {
34
+ "activeIndex": { default: 0 },
35
+ "activeIndexModifiers": {}
36
+ }),
37
+ emits: /*@__PURE__*/ mergeModels(["update:activeIndex", "change"], ["update:activeIndex"]),
38
+ setup(__props, { emit: __emit }) {
39
+ const emit = __emit;
40
+ const cls = bem("carousel");
41
+ const model = useModel(__props, "activeIndex");
42
+ /** 已注册页 uid,顺序即插槽渲染顺序,页数由此推导 */
43
+ const itemUids = ref([]);
44
+ const register = (uid) => {
45
+ if (!itemUids.value.includes(uid)) itemUids.value.push(uid);
46
+ };
47
+ const unregister = (uid) => {
48
+ const index = itemUids.value.indexOf(uid);
49
+ if (index > -1) itemUids.value.splice(index, 1);
50
+ };
51
+ const { current, canPrev, canNext, goTo, prev, next } = useCarousel({
52
+ model,
53
+ count: () => itemUids.value.length,
54
+ autoplay: () => __props.autoplay,
55
+ interval: () => __props.interval,
56
+ loop: () => __props.loop
57
+ });
58
+ provide(CarouselDIKey, {
59
+ cls,
60
+ itemUids,
61
+ current,
62
+ register,
63
+ unregister
64
+ });
65
+ const trackStyle = computed(() => ({ transform: `translateX(-${current.value * 100}%)` }));
66
+ watch(model, (index, prevIndex) => emit("change", index, prevIndex));
67
+ return (_ctx, _cache) => {
68
+ return openBlock(), createElementBlock("div", {
69
+ class: normalizeClass(unref(cls).b),
70
+ role: "region",
71
+ "aria-roledescription": "carousel"
72
+ }, [
73
+ createElementVNode("div", {
74
+ class: normalizeClass(unref(cls).e("track")),
75
+ style: normalizeStyle(trackStyle.value)
76
+ }, [renderSlot(_ctx.$slots, "default")], 6),
77
+ __props.arrows ? (openBlock(), createElementBlock("button", {
78
+ key: 0,
79
+ type: "button",
80
+ class: normalizeClass([unref(cls).e("arrow"), unref(cls).em("arrow", "prev")]),
81
+ disabled: !unref(canPrev),
82
+ "aria-label": "上一页",
83
+ onClick: _cache[0] || (_cache[0] = (...args) => unref(prev) && unref(prev)(...args))
84
+ }, [createVNode(unref(_sfc_main$1), null, {
85
+ default: withCtx(() => [createVNode(unref(ArrowLeft))]),
86
+ _: 1
87
+ })], 10, _hoisted_1)) : createCommentVNode("v-if", true),
88
+ __props.arrows ? (openBlock(), createElementBlock("button", {
89
+ key: 1,
90
+ type: "button",
91
+ class: normalizeClass([unref(cls).e("arrow"), unref(cls).em("arrow", "next")]),
92
+ disabled: !unref(canNext),
93
+ "aria-label": "下一页",
94
+ onClick: _cache[1] || (_cache[1] = (...args) => unref(next) && unref(next)(...args))
95
+ }, [createVNode(unref(_sfc_main$1), null, {
96
+ default: withCtx(() => [createVNode(unref(ArrowRight))]),
97
+ _: 1
98
+ })], 10, _hoisted_2)) : createCommentVNode("v-if", true),
99
+ __props.dots ? (openBlock(), createElementBlock("div", {
100
+ key: 2,
101
+ class: normalizeClass(unref(cls).e("dots"))
102
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(itemUids.value.length, (page) => {
103
+ return openBlock(), createElementBlock("button", {
104
+ key: page,
105
+ type: "button",
106
+ class: normalizeClass([unref(cls).e("dot"), unref(bem).is("active", page - 1 === unref(current))]),
107
+ "aria-label": `切换到第 ${page} 页`,
108
+ onClick: ($event) => unref(goTo)(page - 1)
109
+ }, null, 10, _hoisted_3);
110
+ }), 128))], 2)) : createCommentVNode("v-if", true)
111
+ ], 2);
112
+ };
113
+ }
114
+ });
115
+ //#endregion
116
+ export { _sfc_main as default };
117
+
118
+ //# sourceMappingURL=carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carousel.js","names":["_useModel","_openBlock","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_normalizeStyle","_renderSlot","_createVNode","UIcon","_withCtx","_createCommentVNode","_Fragment","_renderList"],"sources":["../../../src/components/carousel/carousel.vue"],"sourcesContent":["<template>\n <div :class=\"cls.b\" role=\"region\" aria-roledescription=\"carousel\">\n <div :class=\"cls.e('track')\" :style=\"trackStyle\">\n <slot />\n </div>\n\n <button\n v-if=\"arrows\"\n type=\"button\"\n :class=\"[cls.e('arrow'), cls.em('arrow', 'prev')]\"\n :disabled=\"!canPrev\"\n aria-label=\"上一页\"\n @click=\"prev\"\n >\n <u-icon><ArrowLeft /></u-icon>\n </button>\n\n <button\n v-if=\"arrows\"\n type=\"button\"\n :class=\"[cls.e('arrow'), cls.em('arrow', 'next')]\"\n :disabled=\"!canNext\"\n aria-label=\"下一页\"\n @click=\"next\"\n >\n <u-icon><ArrowRight /></u-icon>\n </button>\n\n <div v-if=\"dots\" :class=\"cls.e('dots')\">\n <button\n v-for=\"page in itemUids.length\"\n :key=\"page\"\n type=\"button\"\n :class=\"[cls.e('dot'), bem.is('active', page - 1 === current)]\"\n :aria-label=\"`切换到第 ${page} 页`\"\n @click=\"goTo(page - 1)\"\n />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { ArrowLeft, ArrowRight } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, provide, ref, watch } from 'vue'\n\nimport type { CarouselEmits, CarouselProps } from '../../types'\nimport { UIcon } from '../icon'\nimport { CarouselDIKey } from './di'\nimport { useCarousel } from './use-carousel'\n\ndefineOptions({ name: 'UCarousel' })\n\nconst {\n autoplay = false,\n interval = 3000,\n loop = true,\n arrows = false,\n dots = true\n} = defineProps<CarouselProps>()\n\nconst emit = defineEmits<CarouselEmits>()\n\nconst cls = bem('carousel')\n\nconst model = defineModel<number>('activeIndex', { default: 0 })\n\n/** 已注册页 uid,顺序即插槽渲染顺序,页数由此推导 */\nconst itemUids = ref<number[]>([])\n\nconst register = (uid: number) => {\n if (!itemUids.value.includes(uid)) itemUids.value.push(uid)\n}\n\nconst unregister = (uid: number) => {\n const index = itemUids.value.indexOf(uid)\n if (index > -1) itemUids.value.splice(index, 1)\n}\n\nconst { current, canPrev, canNext, goTo, prev, next } = useCarousel({\n model,\n count: () => itemUids.value.length,\n autoplay: () => autoplay,\n interval: () => interval,\n loop: () => loop\n})\n\nprovide(CarouselDIKey, { cls, itemUids, current, register, unregister })\n\nconst trackStyle = computed(() => ({ transform: `translateX(-${current.value * 100}%)` }))\n\nwatch(model, (index, prevIndex) => emit('change', index, prevIndex))\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
+ //#region src/components/carousel/di.ts
3
+ const CarouselDIKey = Symbol("Carousel");
4
+ //#endregion
5
+ export { CarouselDIKey };
6
+
7
+ //# sourceMappingURL=di.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"di.js","names":[],"sources":["../../../src/components/carousel/di.ts"],"sourcesContent":["import { type BEM } from '@veltra/utils'\nimport type { ComputedRef, InjectionKey, Ref } from 'vue'\n\n/** 走马灯页上下文:页注册到容器换页数,取激活态渲染 aria */\nexport interface CarouselContext {\n cls: BEM<'carousel'>\n /** 已注册页的 uid,顺序即插槽渲染顺序 */\n itemUids: Ref<number[]>\n /** 当前激活页索引(已收敛到页数范围内) */\n current: ComputedRef<number>\n register: (uid: number) => void\n unregister: (uid: number) => void\n}\n\nexport const CarouselDIKey: InjectionKey<CarouselContext> = Symbol('Carousel')\n"],"mappings":";;AAcA,MAAa,gBAA+C,OAAO,UAAU"}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ import "./style2.css";
@@ -0,0 +1,97 @@
1
+ @charset "UTF-8";
2
+ /** flex布局 */
3
+ /**
4
+ * 设置css变量
5
+ * 参数1:变量前缀
6
+ * 参数2: 一个由值组成的列表或者由key, value组成的map
7
+ * css-var(height, (
8
+ * large: 40px
9
+ * default: 32px
10
+ * small: 24px
11
+ * ))
12
+ * 生成的css变量:
13
+ * --u-height-large: 40px;
14
+ * --u-height-default: 32px;
15
+ * --u-height-small: 24px;
16
+ */
17
+ /** 暗色:`UITheme.render()` 按主题系列写入 html[data-theme] */
18
+ .u-carousel {
19
+ position: relative;
20
+ width: 100%;
21
+ overflow: hidden;
22
+ border-radius: var(--u-radius-default);
23
+ background-color: var(--u-bg-color-middle);
24
+ }
25
+ .u-carousel__track {
26
+ display: flex;
27
+ transition: transform var(--u-transition-slow) var(--u-transition-ease-out);
28
+ }
29
+ .u-carousel__item {
30
+ flex: 0 0 100%;
31
+ width: 100%;
32
+ }
33
+ .u-carousel__arrow {
34
+ position: absolute;
35
+ top: 50%;
36
+ z-index: 1;
37
+ display: inline-flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ width: 32px;
41
+ height: 32px;
42
+ padding: 0;
43
+ border: none;
44
+ border-radius: 50%;
45
+ transform: translateY(-50%);
46
+ cursor: pointer;
47
+ color: var(--u-text-color-white);
48
+ background-color: var(--u-bg-color-black-a-70);
49
+ transition: transform var(--u-transition-fast) var(--u-transition-ease), opacity var(--u-transition-fast) var(--u-transition-ease);
50
+ }
51
+ .u-carousel__arrow:hover:not(:disabled) {
52
+ transform: translateY(-50%) scale(1.08);
53
+ }
54
+ .u-carousel__arrow:focus-visible {
55
+ box-shadow: var(--u-focus-ring);
56
+ }
57
+ .u-carousel__arrow:disabled {
58
+ cursor: not-allowed;
59
+ opacity: 0.55;
60
+ }
61
+ .u-carousel__arrow--prev {
62
+ left: var(--u-gap-default);
63
+ }
64
+ .u-carousel__arrow--next {
65
+ right: var(--u-gap-default);
66
+ }
67
+ .u-carousel__dots {
68
+ position: absolute;
69
+ bottom: var(--u-gap-small);
70
+ left: 0;
71
+ right: 0;
72
+ z-index: 1;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ gap: var(--u-gap-small);
77
+ }
78
+ .u-carousel__dot {
79
+ width: 8px;
80
+ height: 8px;
81
+ padding: 0;
82
+ border: none;
83
+ border-radius: var(--u-radius-default);
84
+ cursor: pointer;
85
+ background-color: var(--u-text-color-white-a-40);
86
+ transition: width var(--u-transition-fast) var(--u-transition-ease), background-color var(--u-transition-fast) var(--u-transition-ease);
87
+ }
88
+ .u-carousel__dot:hover {
89
+ background-color: var(--u-text-color-white-a-70);
90
+ }
91
+ .u-carousel__dot:focus-visible {
92
+ box-shadow: var(--u-focus-ring);
93
+ }
94
+ .u-carousel__dot.is-active {
95
+ width: 20px;
96
+ background-color: var(--u-text-color-white);
97
+ }
@@ -0,0 +1,68 @@
1
+ import { computed, onScopeDispose, toValue, watch } from "vue";
2
+ //#region src/components/carousel/use-carousel.ts
3
+ /**
4
+ * 走马灯索引与自动播放计时:
5
+ * - `goTo` 把目标索引收敛到 `[0, 页数)`,越界按取模回绕
6
+ * - `prev` / `next` 单步切换,循环时回绕,非循环时停在边界
7
+ * - 自动播放开关、间隔、页数、当前页任一变化后重置计时,手动切换同样重新计时
8
+ */
9
+ function useCarousel({ model, count, autoplay, interval, loop }) {
10
+ const pageCount = () => Math.max(toValue(count), 0);
11
+ /** 展示索引:外部传入越界值时收敛到页数范围内,避免轨道滑出空白 */
12
+ const current = computed(() => {
13
+ const total = pageCount();
14
+ if (total <= 0) return 0;
15
+ return Math.min(Math.max(model.value, 0), total - 1);
16
+ });
17
+ const goTo = (index) => {
18
+ const total = pageCount();
19
+ if (total <= 0) return;
20
+ const next = (index % total + total) % total;
21
+ if (next !== model.value) model.value = next;
22
+ };
23
+ const step = (direction) => {
24
+ const total = pageCount();
25
+ if (total <= 1) return;
26
+ const target = current.value + direction;
27
+ if (toValue(loop)) {
28
+ goTo(target);
29
+ return;
30
+ }
31
+ if (target >= 0 && target < total) goTo(target);
32
+ };
33
+ const canPrev = computed(() => toValue(loop) || current.value > 0);
34
+ const canNext = computed(() => toValue(loop) || current.value < pageCount() - 1);
35
+ const prev = () => step(-1);
36
+ const next = () => step(1);
37
+ let timer;
38
+ const stopAutoplay = () => {
39
+ if (timer !== void 0) {
40
+ clearInterval(timer);
41
+ timer = void 0;
42
+ }
43
+ };
44
+ const startAutoplay = () => {
45
+ stopAutoplay();
46
+ if (!toValue(autoplay) || pageCount() < 2) return;
47
+ timer = setInterval(() => step(1), toValue(interval));
48
+ };
49
+ watch([
50
+ autoplay,
51
+ count,
52
+ interval,
53
+ current
54
+ ], startAutoplay);
55
+ onScopeDispose(stopAutoplay);
56
+ return {
57
+ current,
58
+ canPrev,
59
+ canNext,
60
+ goTo,
61
+ prev,
62
+ next
63
+ };
64
+ }
65
+ //#endregion
66
+ export { useCarousel };
67
+
68
+ //# sourceMappingURL=use-carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-carousel.js","names":[],"sources":["../../../src/components/carousel/use-carousel.ts"],"sourcesContent":["import type { MaybeRefOrGetter, ModelRef } from 'vue'\nimport { computed, onScopeDispose, toValue, watch } from 'vue'\n\nexport interface UseCarouselOptions {\n /** 当前页索引,v-model:active-index */\n model: ModelRef<number>\n /** 页数,取已注册页数量 */\n count: MaybeRefOrGetter<number>\n /** 是否自动播放 */\n autoplay: MaybeRefOrGetter<boolean>\n /** 自动播放间隔(毫秒) */\n interval: MaybeRefOrGetter<number>\n /** 是否循环切换 */\n loop: MaybeRefOrGetter<boolean>\n}\n\n/**\n * 走马灯索引与自动播放计时:\n * - `goTo` 把目标索引收敛到 `[0, 页数)`,越界按取模回绕\n * - `prev` / `next` 单步切换,循环时回绕,非循环时停在边界\n * - 自动播放开关、间隔、页数、当前页任一变化后重置计时,手动切换同样重新计时\n */\nexport function useCarousel({ model, count, autoplay, interval, loop }: UseCarouselOptions) {\n const pageCount = () => Math.max(toValue(count), 0)\n\n /** 展示索引:外部传入越界值时收敛到页数范围内,避免轨道滑出空白 */\n const current = computed(() => {\n const total = pageCount()\n if (total <= 0) return 0\n return Math.min(Math.max(model.value, 0), total - 1)\n })\n\n const goTo = (index: number) => {\n const total = pageCount()\n if (total <= 0) return\n const next = ((index % total) + total) % total\n if (next !== model.value) model.value = next\n }\n\n const step = (direction: 1 | -1) => {\n const total = pageCount()\n if (total <= 1) return\n const target = current.value + direction\n if (toValue(loop)) {\n goTo(target)\n return\n }\n if (target >= 0 && target < total) goTo(target)\n }\n\n const canPrev = computed(() => toValue(loop) || current.value > 0)\n const canNext = computed(() => toValue(loop) || current.value < pageCount() - 1)\n\n const prev = () => step(-1)\n const next = () => step(1)\n\n let timer: ReturnType<typeof setInterval> | undefined\n\n const stopAutoplay = () => {\n if (timer !== undefined) {\n clearInterval(timer)\n timer = undefined\n }\n }\n\n const startAutoplay = () => {\n stopAutoplay()\n if (!toValue(autoplay) || pageCount() < 2) return\n timer = setInterval(() => step(1), toValue(interval))\n }\n\n watch([autoplay, count, interval, current], startAutoplay)\n\n onScopeDispose(stopAutoplay)\n\n return { current, canPrev, canNext, goTo, prev, next }\n}\n"],"mappings":";;;;;;;;AAsBA,SAAgB,YAAY,EAAE,OAAO,OAAO,UAAU,UAAU,QAA4B;CAC1F,MAAM,kBAAkB,KAAK,IAAI,QAAQ,KAAK,GAAG,CAAC;;CAGlD,MAAM,UAAU,eAAe;EAC7B,MAAM,QAAQ,UAAU;EACxB,IAAI,SAAS,GAAG,OAAO;EACvB,OAAO,KAAK,IAAI,KAAK,IAAI,MAAM,OAAO,CAAC,GAAG,QAAQ,CAAC;CACrD,CAAC;CAED,MAAM,QAAQ,UAAkB;EAC9B,MAAM,QAAQ,UAAU;EACxB,IAAI,SAAS,GAAG;EAChB,MAAM,QAAS,QAAQ,QAAS,SAAS;EACzC,IAAI,SAAS,MAAM,OAAO,MAAM,QAAQ;CAC1C;CAEA,MAAM,QAAQ,cAAsB;EAClC,MAAM,QAAQ,UAAU;EACxB,IAAI,SAAS,GAAG;EAChB,MAAM,SAAS,QAAQ,QAAQ;EAC/B,IAAI,QAAQ,IAAI,GAAG;GACjB,KAAK,MAAM;GACX;EACF;EACA,IAAI,UAAU,KAAK,SAAS,OAAO,KAAK,MAAM;CAChD;CAEA,MAAM,UAAU,eAAe,QAAQ,IAAI,KAAK,QAAQ,QAAQ,CAAC;CACjE,MAAM,UAAU,eAAe,QAAQ,IAAI,KAAK,QAAQ,QAAQ,UAAU,IAAI,CAAC;CAE/E,MAAM,aAAa,KAAK,EAAE;CAC1B,MAAM,aAAa,KAAK,CAAC;CAEzB,IAAI;CAEJ,MAAM,qBAAqB;EACzB,IAAI,UAAU,KAAA,GAAW;GACvB,cAAc,KAAK;GACnB,QAAQ,KAAA;EACV;CACF;CAEA,MAAM,sBAAsB;EAC1B,aAAa;EACb,IAAI,CAAC,QAAQ,QAAQ,KAAK,UAAU,IAAI,GAAG;EAC3C,QAAQ,kBAAkB,KAAK,CAAC,GAAG,QAAQ,QAAQ,CAAC;CACtD;CAEA,MAAM;EAAC;EAAU;EAAO;EAAU;CAAO,GAAG,aAAa;CAEzD,eAAe,YAAY;CAE3B,OAAO;EAAE;EAAS;EAAS;EAAS;EAAM;EAAM;CAAK;AACvD"}
@@ -0,0 +1,16 @@
1
+ import { Fragment, createCommentVNode, createElementBlock, defineComponent, openBlock, renderSlot } from "vue";
2
+ //#region src/components/descriptions/descriptions-item.vue
3
+ const _sfc_main = /*@__PURE__*/ defineComponent({
4
+ name: "UDescriptionsItem",
5
+ __name: "descriptions-item",
6
+ props: { label: {} },
7
+ setup(__props) {
8
+ return (_ctx, _cache) => {
9
+ return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" 本组件不自行布局:由 UDescriptions 收集插槽 vnode 后渲染进键值表格 "), renderSlot(_ctx.$slots, "default")], 2112);
10
+ };
11
+ }
12
+ });
13
+ //#endregion
14
+ export { _sfc_main as default };
15
+
16
+ //# sourceMappingURL=descriptions-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptions-item.js","names":["_openBlock","_createElementBlock","_Fragment","_createCommentVNode","_renderSlot"],"sources":["../../../src/components/descriptions/descriptions-item.vue"],"sourcesContent":["<template>\n <!-- 本组件不自行布局:由 UDescriptions 收集插槽 vnode 后渲染进键值表格 -->\n <slot />\n</template>\n\n<script lang=\"ts\" setup>\nimport type { DescriptionsItemProps } from '../../types'\n\ndefineOptions({ name: 'UDescriptionsItem' })\n\ndefineProps<DescriptionsItemProps>()\n</script>\n"],"mappings":";;;;;;;;GACE,OAAA,UAAA,GAAA,mBAAA,UAAA,MAAA,CAAAG,mBAAA,gDAAA,GACAC,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,IAAA"}
@@ -0,0 +1,67 @@
1
+ import _sfc_main$1 from "./descriptions-item.js";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, renderList, resolveDynamicComponent, toDisplayString, unref, useSlots } from "vue";
3
+ import { useFallbackProps } from "@veltra/compositions";
4
+ import { bem } from "@veltra/utils";
5
+ //#region src/components/descriptions/descriptions.vue
6
+ const _hoisted_1 = { key: 1 };
7
+ const _sfc_main = /*@__PURE__*/ defineComponent({
8
+ name: "UDescriptions",
9
+ __name: "descriptions",
10
+ props: {
11
+ title: {},
12
+ column: {},
13
+ border: { type: Boolean },
14
+ layout: {},
15
+ size: {}
16
+ },
17
+ setup(__props) {
18
+ const props = __props;
19
+ const { size } = useFallbackProps([props], { size: "default" });
20
+ const cls = bem("descriptions");
21
+ const slots = useSlots();
22
+ const rows = computed(() => {
23
+ const items = (slots.default?.() ?? []).filter((vnode) => vnode.type === _sfc_main$1);
24
+ const column = Math.max(1, Math.trunc(props.column ?? 3));
25
+ const grouped = [];
26
+ for (let i = 0; i < items.length; i += column) grouped.push(items.slice(i, i + column).map((vnode) => ({
27
+ label: vnode.props?.label,
28
+ vnode
29
+ })));
30
+ return grouped;
31
+ });
32
+ const isVertical = computed(() => props.layout === "vertical");
33
+ const classList = computed(() => [
34
+ cls.b,
35
+ cls.m(props.layout ?? "horizontal"),
36
+ cls.m(size.value),
37
+ bem.is("bordered", !!props.border)
38
+ ]);
39
+ return (_ctx, _cache) => {
40
+ return openBlock(), createElementBlock("div", { class: normalizeClass(classList.value) }, [__props.title ? (openBlock(), createElementBlock("div", {
41
+ key: 0,
42
+ class: normalizeClass(unref(cls).e("header"))
43
+ }, toDisplayString(__props.title), 3)) : createCommentVNode("v-if", true), rows.value.length ? (openBlock(), createElementBlock("table", {
44
+ key: 1,
45
+ class: normalizeClass(unref(cls).e("table"))
46
+ }, [createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, rowIndex) => {
47
+ return openBlock(), createElementBlock(Fragment, { key: rowIndex }, [isVertical.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (item, i) => {
48
+ return openBlock(), createElementBlock("th", {
49
+ key: i,
50
+ class: normalizeClass(unref(cls).e("label"))
51
+ }, toDisplayString(item.label), 3);
52
+ }), 128))]), createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (item, i) => {
53
+ return openBlock(), createElementBlock("td", {
54
+ key: i,
55
+ class: normalizeClass(unref(cls).e("content"))
56
+ }, [(openBlock(), createBlock(resolveDynamicComponent(item.vnode)))], 2);
57
+ }), 128))])], 64)) : (openBlock(), createElementBlock("tr", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (item, i) => {
58
+ return openBlock(), createElementBlock(Fragment, { key: i }, [createElementVNode("th", { class: normalizeClass(unref(cls).e("label")) }, toDisplayString(item.label), 3), createElementVNode("td", { class: normalizeClass(unref(cls).e("content")) }, [(openBlock(), createBlock(resolveDynamicComponent(item.vnode)))], 2)], 64);
59
+ }), 128))]))], 64);
60
+ }), 128))])], 2)) : createCommentVNode("v-if", true)], 2);
61
+ };
62
+ }
63
+ });
64
+ //#endregion
65
+ export { _sfc_main as default };
66
+
67
+ //# sourceMappingURL=descriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptions.js","names":["UDescriptionsItem","_openBlock","_createElementBlock","_normalizeClass","_unref","_toDisplayString","_createCommentVNode","_createElementVNode","_Fragment","_renderList","_createBlock","_resolveDynamicComponent"],"sources":["../../../src/components/descriptions/descriptions.vue"],"sourcesContent":["<template>\n <div :class=\"classList\">\n <div v-if=\"title\" :class=\"cls.e('header')\">{{ title }}</div>\n\n <table v-if=\"rows.length\" :class=\"cls.e('table')\">\n <tbody>\n <template v-for=\"(row, rowIndex) of rows\" :key=\"rowIndex\">\n <template v-if=\"isVertical\">\n <tr>\n <th v-for=\"(item, i) of row\" :key=\"i\" :class=\"cls.e('label')\">\n {{ item.label }}\n </th>\n </tr>\n <tr>\n <td v-for=\"(item, i) of row\" :key=\"i\" :class=\"cls.e('content')\">\n <component :is=\"item.vnode\" />\n </td>\n </tr>\n </template>\n <tr v-else>\n <template v-for=\"(item, i) of row\" :key=\"i\">\n <th :class=\"cls.e('label')\">{{ item.label }}</th>\n <td :class=\"cls.e('content')\">\n <component :is=\"item.vnode\" />\n </td>\n </template>\n </tr>\n </template>\n </tbody>\n </table>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { bem } from '@veltra/utils'\nimport { computed, useSlots, type VNode } from 'vue'\n\nimport type { ComponentSize, DescriptionsProps } from '../../types'\nimport UDescriptionsItem from './descriptions-item.vue'\n\ndefineOptions({ name: 'UDescriptions' })\n\nconst props = defineProps<DescriptionsProps>()\n\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst cls = bem('descriptions')\n\nconst slots = useSlots()\n\ninterface DescriptionItem {\n label: string | undefined\n vnode: VNode\n}\n\n// 插槽 vnode 须在渲染路径读取:插槽内容读取的响应式数据经调用链追踪,内容变化时重新计算\nconst rows = computed<DescriptionItem[][]>(() => {\n const items = (slots.default?.() ?? []).filter((vnode) => vnode.type === UDescriptionsItem)\n const column = Math.max(1, Math.trunc(props.column ?? 3))\n\n const grouped: DescriptionItem[][] = []\n for (let i = 0; i < items.length; i += column) {\n grouped.push(\n items\n .slice(i, i + column)\n .map((vnode) => ({ label: vnode.props?.label as string | undefined, vnode }))\n )\n }\n return grouped\n})\n\nconst isVertical = computed(() => props.layout === 'vertical')\n\nconst classList = computed(() => [\n cls.b,\n cls.m(props.layout ?? 'horizontal'),\n cls.m(size.value),\n bem.is('bordered', !!props.border)\n])\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;EA2CA,MAAM,QAAQ;EAEd,MAAM,EAAE,SAAS,iBAAiB,CAAC,KAAK,GAAG,EAAE,MAAM,UAA2B,CAAC;EAE/E,MAAM,MAAM,IAAI,cAAc;EAE9B,MAAM,QAAQ,SAAS;EAQvB,MAAM,OAAO,eAAoC;GAC/C,MAAM,SAAS,MAAM,UAAU,KAAK,CAA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