@veltra/desktop 1.1.10 → 1.1.12

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 (28) hide show
  1. package/dist/components/cascade/cascade.vue.d.ts +1 -1
  2. package/dist/components/collapse/collapse-item.js +2 -1
  3. package/dist/components/collapse/collapse-item.js.map +1 -1
  4. package/dist/components/collapse/collapse.js +11 -1
  5. package/dist/components/collapse/collapse.js.map +1 -1
  6. package/dist/components/collapse/collapse.vue.d.ts +1 -0
  7. package/dist/components/collapse/di.js.map +1 -1
  8. package/dist/components/collapse/style2.css +17 -4
  9. package/dist/components/file-viewer/file-viewer.vue.d.ts +2 -2
  10. package/dist/components/multi-select/multi-select.vue.d.ts +1 -1
  11. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +1 -1
  12. package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
  13. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  14. package/dist/components/tabs/tabs-horizontal.vue.d.ts +1 -1
  15. package/dist/components/tabs/tabs.js +6 -11
  16. package/dist/components/tabs/tabs.js.map +1 -1
  17. package/dist/components/tabs/tabs.vue.d.ts +1 -1
  18. package/dist/components/tip/tip.vue.d.ts +1 -1
  19. package/dist/components/tree/tree.vue.d.ts +1 -1
  20. package/dist/components/tree-select/tree-select.vue.d.ts +1 -1
  21. package/dist/types/collapse.d.ts +5 -0
  22. package/package.json +11 -11
  23. package/src/components/collapse/collapse-item.vue +2 -1
  24. package/src/components/collapse/collapse.vue +6 -2
  25. package/src/components/collapse/di.ts +1 -0
  26. package/src/components/collapse/style.scss +23 -2
  27. package/src/components/tabs/tabs.vue +8 -13
  28. package/src/types/collapse.ts +6 -0
@@ -11,12 +11,12 @@ declare const __VLS_export: _$vue.DefineComponent<CascadeProps, {}, {}, {}, {},
11
11
  onClear?: (() => any) | undefined;
12
12
  onChange?: ((...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any) | undefined;
13
13
  }>, {
14
+ data: Record<string, any>[];
14
15
  disabled: boolean;
15
16
  readonly: boolean;
16
17
  labelKey: string;
17
18
  valueKey: string;
18
19
  childrenKey: string;
19
- data: Record<string, any>[];
20
20
  placeholder: string;
21
21
  clearable: boolean;
22
22
  filterable: boolean;
@@ -28,7 +28,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
28
28
  const classList = computed(() => [
29
29
  cls.e("item"),
30
30
  bem.is("active", isActive.value),
31
- bem.is("disabled", props.disabled)
31
+ bem.is("disabled", props.disabled),
32
+ bem.is("bordered", context?.bordered.value)
32
33
  ]);
33
34
  const headerClassList = computed(() => [
34
35
  cls.e("header"),
@@ -1 +1 @@
1
- {"version":3,"file":"collapse-item.js","names":[],"sources":["../../../src/components/collapse/collapse-item.vue"],"sourcesContent":["<template>\n <div :class=\"classList\">\n <div\n :class=\"headerClassList\"\n role=\"button\"\n :aria-expanded=\"isActive\"\n :aria-disabled=\"disabled\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"handleClick\"\n @keydown.enter.prevent=\"handleClick\"\n @keydown.space.prevent=\"handleClick\"\n >\n <span :class=\"cls.e('title')\">\n <slot name=\"title\">{{ title }}</slot>\n </span>\n\n <span :class=\"cls.e('icon')\">\n <slot name=\"icon\" :is-active=\"isActive\">\n <UIcon><component :is=\"iconComponent\" /></UIcon>\n </slot>\n </span>\n </div>\n <div ref=\"wrapperEl\" :class=\"cls.e('content-wrapper')\" :aria-hidden=\"!isActive\">\n <div :class=\"cls.e('content')\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { ArrowRight } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport type { CollapseItemProps } from '../../types'\nimport { UIcon } from '../icon'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({\n name: 'CollapseItem'\n})\n\nconst props = defineProps<CollapseItemProps>()\n\nconst context = inject(CollapseDIKey)!\n\nconst cls = context?.cls ?? bem('collapse')\n\nconst isActive = computed(() => !!context?.activeValues.value.includes(props.value))\n\nconst iconComponent = computed(() => context?.expandIcon.value ?? ArrowRight)\n\nconst classList = computed(() => [\n cls.e('item'),\n bem.is('active', isActive.value),\n bem.is('disabled', props.disabled)\n])\n\nconst headerClassList = computed(() => [\n cls.e('header'),\n bem.is('disabled', props.disabled),\n bem.is('active', isActive.value)\n])\n\nconst handleClick = () => {\n if (props.disabled) return\n context?.toggle(props.value)\n}\n\nconst wrapperEl = ref<HTMLElement>()\n\nconst { expandTransition } = context\n\nonMounted(() => {\n context?.register(props.value)\n if (!wrapperEl.value) return\n expandTransition.setExpanded(wrapperEl.value, isActive.value)\n})\n\nwatch(isActive, (active) => {\n if (!wrapperEl.value) return\n active ? expandTransition.expand(wrapperEl.value) : expandTransition.collapse(wrapperEl.value)\n})\n\nonBeforeUnmount(() => {\n context?.unregister(props.value)\n if (!wrapperEl.value) return\n expandTransition.cancel(wrapperEl.value)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EA2CA,MAAM,QAAQ;EAEd,MAAM,UAAU,OAAO,cAAc;EAErC,MAAM,MAAM,SAAS,OAAO,IAAI,WAAU;EAE1C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,aAAa,MAAM,SAAS,MAAM,MAAM,CAAA;EAEnF,MAAM,gBAAgB,eAAe,SAAS,WAAW,SAAS,WAAU;EAE5E,MAAM,YAAY,eAAe;GAC/B,IAAI,EAAE,OAAO;GACb,IAAI,GAAG,UAAU,SAAS,MAAM;GAChC,IAAI,GAAG,YAAY,MAAM,SAAQ;GAClC,CAAA;EAED,MAAM,kBAAkB,eAAe;GACrC,IAAI,EAAE,SAAS;GACf,IAAI,GAAG,YAAY,MAAM,SAAS;GAClC,IAAI,GAAG,UAAU,SAAS,MAAK;GAChC,CAAA;EAED,MAAM,oBAAoB;AACxB,OAAI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AA,WAAA,EAAjC,YAAiC,wBAAjB,cAAA,MAAa,CAAA,EAAA,CAAA;;gCAI1C,mBAIM,OAAA;aAJG;IAAJ,KAAI;IAAa,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,kBAAA,CAAA;IAAsB,eAAW,CAAG,SAAA;OACpE,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,UAAA,CAAA,EAAA,EAAA,CAChB,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA,CAAA,EAAA,IAAA,WAAA,CAAA,EAAA,EAAA"}
1
+ {"version":3,"file":"collapse-item.js","names":[],"sources":["../../../src/components/collapse/collapse-item.vue"],"sourcesContent":["<template>\n <div :class=\"classList\">\n <div\n :class=\"headerClassList\"\n role=\"button\"\n :aria-expanded=\"isActive\"\n :aria-disabled=\"disabled\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"handleClick\"\n @keydown.enter.prevent=\"handleClick\"\n @keydown.space.prevent=\"handleClick\"\n >\n <span :class=\"cls.e('title')\">\n <slot name=\"title\">{{ title }}</slot>\n </span>\n\n <span :class=\"cls.e('icon')\">\n <slot name=\"icon\" :is-active=\"isActive\">\n <UIcon><component :is=\"iconComponent\" /></UIcon>\n </slot>\n </span>\n </div>\n <div ref=\"wrapperEl\" :class=\"cls.e('content-wrapper')\" :aria-hidden=\"!isActive\">\n <div :class=\"cls.e('content')\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { ArrowRight } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport type { CollapseItemProps } from '../../types'\nimport { UIcon } from '../icon'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({\n name: 'CollapseItem'\n})\n\nconst props = defineProps<CollapseItemProps>()\n\nconst context = inject(CollapseDIKey)!\n\nconst cls = context?.cls ?? bem('collapse')\n\nconst isActive = computed(() => !!context?.activeValues.value.includes(props.value))\n\nconst iconComponent = computed(() => context?.expandIcon.value ?? ArrowRight)\n\nconst classList = computed(() => [\n cls.e('item'),\n bem.is('active', isActive.value),\n bem.is('disabled', props.disabled),\n bem.is('bordered', context?.bordered.value)\n])\n\nconst headerClassList = computed(() => [\n cls.e('header'),\n bem.is('disabled', props.disabled),\n bem.is('active', isActive.value)\n])\n\nconst handleClick = () => {\n if (props.disabled) return\n context?.toggle(props.value)\n}\n\nconst wrapperEl = ref<HTMLElement>()\n\nconst { expandTransition } = context\n\nonMounted(() => {\n context?.register(props.value)\n if (!wrapperEl.value) return\n expandTransition.setExpanded(wrapperEl.value, isActive.value)\n})\n\nwatch(isActive, (active) => {\n if (!wrapperEl.value) return\n active ? expandTransition.expand(wrapperEl.value) : expandTransition.collapse(wrapperEl.value)\n})\n\nonBeforeUnmount(() => {\n context?.unregister(props.value)\n if (!wrapperEl.value) return\n expandTransition.cancel(wrapperEl.value)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EA2CA,MAAM,QAAQ;EAEd,MAAM,UAAU,OAAO,cAAc;EAErC,MAAM,MAAM,SAAS,OAAO,IAAI,WAAU;EAE1C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,aAAa,MAAM,SAAS,MAAM,MAAM,CAAA;EAEnF,MAAM,gBAAgB,eAAe,SAAS,WAAW,SAAS,WAAU;EAE5E,MAAM,YAAY,eAAe;GAC/B,IAAI,EAAE,OAAO;GACb,IAAI,GAAG,UAAU,SAAS,MAAM;GAChC,IAAI,GAAG,YAAY,MAAM,SAAS;GAClC,IAAI,GAAG,YAAY,SAAS,SAAS,MAAK;GAC3C,CAAA;EAED,MAAM,kBAAkB,eAAe;GACrC,IAAI,EAAE,SAAS;GACf,IAAI,GAAG,YAAY,MAAM,SAAS;GAClC,IAAI,GAAG,UAAU,SAAS,MAAK;GAChC,CAAA;EAED,MAAM,oBAAoB;AACxB,OAAI,MAAM,SAAU;AACpB,YAAS,OAAO,MA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AAA,MAAa,CAAA,EAAA,CAAA;;gCAI1C,mBAIM,OAAA;aAJG;IAAJ,KAAI;IAAa,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,kBAAA,CAAA;IAAsB,eAAW,CAAG,SAAA;OACpE,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,UAAA,CAAA,EAAA,EAAA,CAChB,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA,CAAA,EAAA,IAAA,WAAA,CAAA,EAAA,EAAA"}
@@ -16,6 +16,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
16
16
  type: Boolean,
17
17
  default: false
18
18
  },
19
+ bordered: {
20
+ type: Boolean,
21
+ default: false
22
+ },
19
23
  expandIcon: {},
20
24
  size: {}
21
25
  },
@@ -27,7 +31,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
31
  const expandTransition = new ExpandTransition({ transition: "height 0.24s cubic-bezier(0.4, 0, 0.2, 1)" });
28
32
  const { size } = useFormFallbackProps([props], { size: "default" });
29
33
  const expandIcon = computed(() => props.expandIcon);
30
- const classList = computed(() => [cls.b, cls.m(size.value)]);
34
+ const bordered = computed(() => props.bordered);
35
+ const classList = computed(() => [
36
+ cls.b,
37
+ cls.m(size.value),
38
+ bem.is("bordered", bordered.value)
39
+ ]);
31
40
  const modelValue = useModel$1({
32
41
  props,
33
42
  emit,
@@ -73,6 +82,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
73
82
  provide(CollapseDIKey, {
74
83
  cls,
75
84
  size,
85
+ bordered,
76
86
  expandIcon,
77
87
  activeValues,
78
88
  toggle,
@@ -1 +1 @@
1
- {"version":3,"file":"collapse.js","names":[],"sources":["../../../src/components/collapse/collapse.vue"],"sourcesContent":["<template>\n <div :class=\"classList\" role=\"region\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFormFallbackProps, useModel } from '@veltra/compositions'\nimport { bem, ExpandTransition } from '@veltra/utils'\nimport { computed, provide, ref } from 'vue'\n\nimport type { CollapseEmits, CollapseModelValue, CollapseProps, CollapseValue } from '../../types'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({\n name: 'Collapse'\n})\n\nconst props = withDefaults(defineProps<CollapseProps>(), {\n accordion: false,\n defaultCollapseAll: false\n})\nconst emit = defineEmits<CollapseEmits>()\n\nconst cls = bem('collapse')\n\nconst expandTransition = new ExpandTransition({\n transition: 'height 0.24s cubic-bezier(0.4, 0, 0.2, 1)'\n})\n\nconst { size } = useFormFallbackProps([props], { size: 'default' })\n\nconst expandIcon = computed(() => props.expandIcon)\n\nconst classList = computed(() => [cls.b, cls.m(size.value)])\n\nconst modelValue = useModel<CollapseProps, 'modelValue'>({\n props,\n emit,\n propName: 'modelValue'\n})\n\nconst activeValues = computed<CollapseValue[]>(() => {\n const v = modelValue.value\n if (v === undefined || v === null) return []\n return Array.isArray(v) ? v : [v]\n})\n\nconst update = (next: CollapseModelValue) => {\n modelValue.value = next\n emit('change', next)\n}\n\nconst toggle = (value: CollapseValue) => {\n if (props.accordion) {\n update(activeValues.value[0] === value ? [] : value)\n return\n }\n\n const values = activeValues.value.slice()\n const index = values.indexOf(value)\n if (index > -1) values.splice(index, 1)\n else values.push(value)\n update(values)\n}\n\n// 收集子组件已注册的 values\nconst registeredValues = ref<CollapseValue[]>([])\n\n// 初始捕获 modelValue 是否具有有效初值\nconst hasInitialValue =\n modelValue.value !== undefined &&\n modelValue.value !== null &&\n (!Array.isArray(modelValue.value) || modelValue.value.length > 0)\n\nconst register = (value: CollapseValue) => {\n if (!registeredValues.value.includes(value)) {\n registeredValues.value.push(value)\n\n // 若默认展开全部(defaultCollapseAll 为 false)且外部未指定初始值,则自动展开该子项\n if (!props.defaultCollapseAll && !hasInitialValue) {\n if (props.accordion) {\n if (registeredValues.value.length === 1) {\n update(value)\n }\n } else {\n const current = Array.isArray(modelValue.value)\n ? modelValue.value\n : modelValue.value !== undefined && modelValue.value !== null\n ? [modelValue.value]\n : []\n if (!current.includes(value)) {\n update([...current, value])\n }\n }\n }\n }\n}\n\nconst unregister = (value: CollapseValue) => {\n const idx = registeredValues.value.indexOf(value)\n if (idx > -1) {\n registeredValues.value.splice(idx, 1)\n }\n}\n\nprovide(CollapseDIKey, {\n cls,\n size,\n expandIcon,\n activeValues,\n toggle,\n expandTransition,\n register,\n unregister\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAkBA,MAAM,QAAQ;EAId,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,WAAU;EAE1B,MAAM,mBAAmB,IAAI,iBAAiB,EAC5C,YAAY,6CACb,CAAA;EAED,MAAM,EAAE,SAAS,qBAAqB,CAAC,MAAM,EAAE,EAAE,MAAM,WAAW,CAAA;EAElE,MAAM,aAAa,eAAe,MAAM,WAAU;EAElD,MAAM,YAAY,eAAe,CAAC,IAAI,GAAG,IAAI,EAAE,KAAK,MAAM,CAAC,CAAA;EAE3D,MAAM,aAAa,WAAsC;GACvD;GACA;GACA,UAAU;GACX,CAAA;EAED,MAAM,eAAe,eAAgC;GACnD,MAAM,IAAI,WAAW;AACrB,OAAI,MAAM,KAAA,KAAa,MAAM,KAAM,QAAO,EAAC;AAC3C,UAAO,MAAM,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAC;IACjC;EAED,MAAM,UAAU,SAA6B;AAC3C,cAAW,QAAQ;AACnB,QAAK,UAAU,KAAI;;EAGrB,MAAM,UAAU,UAAyB;AACvC,OAAI,MAAM,WAAW;AACnB,WAAO,aAAa,MAAM,OAAO,QAAQ,EAAE,GAAG,MAAK;AACnD;;GAGF,MAAM,SAAS,aAAa,MAAM,OAAM;GACxC,MAAM,QAAQ,OAAO,QAAQ,MAAK;AAClC,OAAI,QAAQ,GAAI,QAAO,OAAO,OAAO,EAAC;OACjC,QAAO,KAAK,MAAK;AACtB,UAAO,OAAM;;EAIf,MAAM,mBAAmB,IAAqB,EAAE,CAAA;EAGhD,MAAM,kBACJ,WAAW,UAAU,KAAA,KACrB,WAAW,UAAU,SACpB,CAAC,MAAM,QAAQ,WAAW,MAAM,IAAI,WAAW,MAAM,SAAS;EAEjE,MAAM,YAAY,UAAyB;AACzC,OAAI,CAAC,iBAAiB,MAAM,SAAS,MAAM,EAAE;AAC3C,qBAAiB,MAAM,KAAK,MAAK;AAGjC,QAAI,CAAC,MAAM,sBAAsB,CAAC,gBAChC,KAAI,MAAM;SACJ,iBAAiB,MAAM,WAAW,EACpC,QAAO,MAAK;WAET;KACL,MAAM,UAAU,MAAM,QAAQ,WAAW,MAAK,GAC1C,WAAW,QACX,WAAW,UAAU,KAAA,KAAa,WAAW,UAAU,OACrD,CAAC,WAAW,MAAK,GACjB,EAAC;AACP,SAAI,CAAC,QAAQ,SAAS,MAAM,CAC1B,QAAO,CAAC,GAAG,SAAS,MAAM,CAAA;;;;EAOpC,MAAM,cAAc,UAAyB;GAC3C,MAAM,MAAM,iBAAiB,MAAM,QAAQ,MAAK;AAChD,OAAI,MAAM,GACR,kBAAiB,MAAM,OAAO,KAAK,EAAC;;AAIxC,UAAQ,eAAe;GACrB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAA;;uBAlHC,mBAEM,OAAA;IAFA,OAAK,eAAE,UAAA,MAAS;IAAE,MAAK;OAC3B,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA"}
1
+ {"version":3,"file":"collapse.js","names":[],"sources":["../../../src/components/collapse/collapse.vue"],"sourcesContent":["<template>\n <div :class=\"classList\" role=\"region\">\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFormFallbackProps, useModel } from '@veltra/compositions'\nimport { bem, ExpandTransition } from '@veltra/utils'\nimport { computed, provide, ref } from 'vue'\n\nimport type { CollapseEmits, CollapseModelValue, CollapseProps, CollapseValue } from '../../types'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({\n name: 'Collapse'\n})\n\nconst props = withDefaults(defineProps<CollapseProps>(), {\n accordion: false,\n defaultCollapseAll: false,\n bordered: false\n})\nconst emit = defineEmits<CollapseEmits>()\n\nconst cls = bem('collapse')\n\nconst expandTransition = new ExpandTransition({\n transition: 'height 0.24s cubic-bezier(0.4, 0, 0.2, 1)'\n})\n\nconst { size } = useFormFallbackProps([props], { size: 'default' })\n\nconst expandIcon = computed(() => props.expandIcon)\n\nconst bordered = computed(() => props.bordered)\n\nconst classList = computed(() => [cls.b, cls.m(size.value), bem.is('bordered', bordered.value)])\n\nconst modelValue = useModel<CollapseProps, 'modelValue'>({\n props,\n emit,\n propName: 'modelValue'\n})\n\nconst activeValues = computed<CollapseValue[]>(() => {\n const v = modelValue.value\n if (v === undefined || v === null) return []\n return Array.isArray(v) ? v : [v]\n})\n\nconst update = (next: CollapseModelValue) => {\n modelValue.value = next\n emit('change', next)\n}\n\nconst toggle = (value: CollapseValue) => {\n if (props.accordion) {\n update(activeValues.value[0] === value ? [] : value)\n return\n }\n\n const values = activeValues.value.slice()\n const index = values.indexOf(value)\n if (index > -1) values.splice(index, 1)\n else values.push(value)\n update(values)\n}\n\n// 收集子组件已注册的 values\nconst registeredValues = ref<CollapseValue[]>([])\n\n// 初始捕获 modelValue 是否具有有效初值\nconst hasInitialValue =\n modelValue.value !== undefined &&\n modelValue.value !== null &&\n (!Array.isArray(modelValue.value) || modelValue.value.length > 0)\n\nconst register = (value: CollapseValue) => {\n if (!registeredValues.value.includes(value)) {\n registeredValues.value.push(value)\n\n // 若默认展开全部(defaultCollapseAll 为 false)且外部未指定初始值,则自动展开该子项\n if (!props.defaultCollapseAll && !hasInitialValue) {\n if (props.accordion) {\n if (registeredValues.value.length === 1) {\n update(value)\n }\n } else {\n const current = Array.isArray(modelValue.value)\n ? modelValue.value\n : modelValue.value !== undefined && modelValue.value !== null\n ? [modelValue.value]\n : []\n if (!current.includes(value)) {\n update([...current, value])\n }\n }\n }\n }\n}\n\nconst unregister = (value: CollapseValue) => {\n const idx = registeredValues.value.indexOf(value)\n if (idx > -1) {\n registeredValues.value.splice(idx, 1)\n }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AW,MAAM,IAAI,WAAW,MAAM,SAAS;EAEjE,MAAM,YAAY,UAAyB;AACzC,OAAI,CAAC,iBAAiB,MAAM,SAAS,MAAM,EAAE;AAC3C,qBAAiB,MAAM,KAAK,MAAK;AAGjC,QAAI,CAAC,MAAM,sBAAsB,CAAC,gBAChC,KAAI,MAAM;SACJ,iBAAiB,MAAM,WAAW,EACpC,QAAO,MAAK;WAET;KACL,MAAM,UAAU,MAAM,QAAQ,WAAW,MAAK,GAC1C,WAAW,QACX,WAAW,UAAU,KAAA,KAAa,WAAW,UAAU,OACrD,CAAC,WAAW,MAAK,GACjB,EAAC;AACP,SAAI,CAAC,QAAQ,SAAS,MAAM,CAC1B,QAAO,CAAC,GAAG,SAAS,MAAM,CAAA;;;;EAOpC,MAAM,cAAc,UAAyB;GAC3C,MAAM,MAAM,iBAAiB,MAAM,QAAQ,MAAK;AAChD,OAAI,MAAM,GACR,kBAAiB,MAAM,OAAO,KAAK,EAAC;;AAIxC,UAAQ,eAAe;GACrB;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAA;;uBAtHC,mBAEM,OAAA;IAFA,OAAK,eAAE,UAAA,MAAS;IAAE,MAAK;OAC3B,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA"}
@@ -13,6 +13,7 @@ declare const __VLS_base: _$vue.DefineComponent<CollapseProps, {}, {}, {}, {}, _
13
13
  "onUpdate:modelValue"?: ((value: CollapseModelValue) => any) | undefined;
14
14
  onChange?: ((value: CollapseModelValue) => any) | undefined;
15
15
  }>, {
16
+ bordered: boolean;
16
17
  accordion: boolean;
17
18
  defaultCollapseAll: boolean;
18
19
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"di.js","names":[],"sources":["../../../src/components/collapse/di.ts"],"sourcesContent":["import { type BEM, type ComponentSize, ExpandTransition } from '@veltra/utils'\nimport type { Component, ComputedRef, InjectionKey } from 'vue'\n\nimport type { CollapseValue } from '../../types'\n\nexport interface CollapseContext {\n cls: BEM<'collapse'>\n size: ComputedRef<ComponentSize>\n expandIcon: ComputedRef<Component | undefined>\n activeValues: ComputedRef<CollapseValue[]>\n toggle: (value: CollapseValue) => void\n expandTransition: ExpandTransition\n register: (value: CollapseValue) => void\n unregister: (value: CollapseValue) => void\n}\n\nexport const CollapseDIKey: InjectionKey<CollapseContext> = Symbol('Collapse')\n"],"mappings":";;AAgBA,MAAa,gBAA+C,OAAO,WAAW"}
1
+ {"version":3,"file":"di.js","names":[],"sources":["../../../src/components/collapse/di.ts"],"sourcesContent":["import { type BEM, type ComponentSize, ExpandTransition } from '@veltra/utils'\nimport type { Component, ComputedRef, InjectionKey } from 'vue'\n\nimport type { CollapseValue } from '../../types'\n\nexport interface CollapseContext {\n cls: BEM<'collapse'>\n size: ComputedRef<ComponentSize>\n bordered: ComputedRef<boolean>\n expandIcon: ComputedRef<Component | undefined>\n activeValues: ComputedRef<CollapseValue[]>\n toggle: (value: CollapseValue) => void\n expandTransition: ExpandTransition\n register: (value: CollapseValue) => void\n unregister: (value: CollapseValue) => void\n}\n\nexport const CollapseDIKey: InjectionKey<CollapseContext> = Symbol('Collapse')\n"],"mappings":";;AAiBA,MAAa,gBAA+C,OAAO,WAAW"}
@@ -46,7 +46,7 @@
46
46
  cursor: pointer;
47
47
  font-weight: 500;
48
48
  letter-spacing: 0.01em;
49
- color: var(--u-text-color-title);
49
+ color: var(--u-collapse-title-color, var(--u-text-color-main));
50
50
  user-select: none;
51
51
  outline: none;
52
52
  transition: color 0.18s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.18s cubic-bezier(0.4, 0, 0.2, 1);
@@ -94,7 +94,7 @@
94
94
  }
95
95
  .u-collapse--small .u-collapse__header {
96
96
  padding: calc(var(--u-gap-small) - 2px) var(--u-gap-small);
97
- font-size: var(--u-font-size-title-small);
97
+ font-size: var(--u-font-size-main-small);
98
98
  }
99
99
  .u-collapse--small .u-collapse__content {
100
100
  font-size: var(--u-font-size-main-small);
@@ -111,7 +111,7 @@
111
111
  }
112
112
  .u-collapse--default .u-collapse__header {
113
113
  padding: calc(var(--u-gap-default) - 2px) var(--u-gap-default);
114
- font-size: var(--u-font-size-title-default);
114
+ font-size: var(--u-font-size-main-default);
115
115
  }
116
116
  .u-collapse--default .u-collapse__content {
117
117
  font-size: var(--u-font-size-main-default);
@@ -128,7 +128,7 @@
128
128
  }
129
129
  .u-collapse--large .u-collapse__header {
130
130
  padding: calc(var(--u-gap-large) - 2px) var(--u-gap-large);
131
- font-size: var(--u-font-size-title-large);
131
+ font-size: var(--u-font-size-main-large);
132
132
  }
133
133
  .u-collapse--large .u-collapse__content {
134
134
  font-size: var(--u-font-size-main-large);
@@ -140,3 +140,16 @@
140
140
  .u-collapse--large .u-collapse__item + .u-collapse__item {
141
141
  margin-top: var(--u-gap-large);
142
142
  }
143
+ .u-collapse.is-bordered .u-collapse__item {
144
+ background-color: transparent;
145
+ border: 1px solid var(--u-border-color);
146
+ }
147
+ .u-collapse.is-bordered .u-collapse__item:hover, .u-collapse.is-bordered .u-collapse__item.is-active {
148
+ background-color: transparent;
149
+ }
150
+ .u-collapse.is-bordered .u-collapse__header {
151
+ border-radius: 0;
152
+ }
153
+ .u-collapse.is-bordered .u-collapse__header.is-active {
154
+ border-bottom: 1px solid var(--u-border-color);
155
+ }
@@ -14,19 +14,19 @@ declare const __VLS_export: _$vue.DefineComponent<__VLS_PublicProps, _FileViewer
14
14
  } & {
15
15
  "update:modelValue": (id: string) => any;
16
16
  change: (file: FileViewerItem) => any;
17
- "update:open": (value: boolean) => any;
18
17
  error: (err: {
19
18
  file: FileViewerItem;
20
19
  error: unknown;
21
20
  }) => any;
21
+ "update:open": (value: boolean) => any;
22
22
  }, string, _$vue.PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
23
  "onUpdate:modelValue"?: ((id: string) => any) | undefined;
24
24
  onChange?: ((file: FileViewerItem) => any) | undefined;
25
- "onUpdate:open"?: ((value: boolean) => any) | undefined;
26
25
  onError?: ((err: {
27
26
  file: FileViewerItem;
28
27
  error: unknown;
29
28
  }) => any) | undefined;
29
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
30
30
  }>, {
31
31
  modelValue: string;
32
32
  open: boolean;
@@ -30,9 +30,9 @@ declare const __VLS_base: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {}, {
30
30
  }>, {
31
31
  disabled: boolean;
32
32
  readonly: boolean;
33
+ minWidth: string;
33
34
  labelKey: string;
34
35
  valueKey: string;
35
- minWidth: string;
36
36
  placeholder: string;
37
37
  clearable: boolean;
38
38
  visibilityLimit: number;
@@ -24,10 +24,10 @@ declare const __VLS_base: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {}, {
24
24
  }>, {
25
25
  disabled: boolean;
26
26
  readonly: boolean;
27
+ minWidth: string;
27
28
  expandAll: boolean;
28
29
  labelKey: string;
29
30
  valueKey: string;
30
- minWidth: string;
31
31
  placeholder: string;
32
32
  clearable: boolean;
33
33
  filterable: boolean;
@@ -27,9 +27,9 @@ declare const __VLS_export: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {},
27
27
  disabled: boolean;
28
28
  readonly: boolean;
29
29
  clearable: boolean;
30
- separator: string;
31
30
  startPlaceholder: string;
32
31
  endPlaceholder: string;
32
+ separator: string;
33
33
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  //#endregion
@@ -14,8 +14,8 @@ declare const __VLS_base: _$vue.DefineComponent<PopConfirmProps, {}, {}, {}, {},
14
14
  onConfirm?: (() => any) | undefined;
15
15
  onCancel?: (() => any) | undefined;
16
16
  }>, {
17
- direction: TipDirection;
18
17
  trigger: "hover" | "click";
18
+ direction: TipDirection;
19
19
  icon: _$vue.Component;
20
20
  iconColor: string;
21
21
  confirmText: string;
@@ -24,9 +24,9 @@ declare const __VLS_base: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {}, {
24
24
  onClick?: ((item: TabItem, index: number) => any) | undefined;
25
25
  }>, {
26
26
  closable: boolean;
27
+ block: boolean;
27
28
  rounded: boolean;
28
29
  position: "top" | "bottom";
29
- block: boolean;
30
30
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
31
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
32
  declare const _default: typeof __VLS_export;
@@ -1,7 +1,7 @@
1
1
  import _sfc_main$1 from "../scroll/scroll.js";
2
2
  import _sfc_main$2 from "./tabs-horizontal.js";
3
3
  import _sfc_main$3 from "./tabs-vertical.js";
4
- import { KeepAlive, Transition, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, resolveDynamicComponent, unref, useModel, useSlots, withCtx } from "vue";
4
+ import { KeepAlive, Transition, computed, createBlock, createElementBlock, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, resolveDynamicComponent, unref, useModel, useSlots, withCtx } from "vue";
5
5
  import { useFallbackProps } from "@veltra/compositions";
6
6
  import { bem } from "@veltra/utils";
7
7
  //#region src/components/tabs/tabs.vue
@@ -49,15 +49,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  /** 避免模板中使用类型断言:收敛 position 到水平 / 垂直子组件所需的子集。 */
50
50
  const horizontalPosition = computed(() => props.position === "bottom" ? "bottom" : "top");
51
51
  const verticalPosition = computed(() => props.position === "right" ? "right" : "left");
52
- /** 是否存在任一内容面板插槽;没有则不渲染内容区域。 */
53
- const hasContentSlots = computed(() => Object.keys(slots).length > 0);
54
52
  const onClick = (item, index) => emit("click", item, index);
55
53
  const onClose = (item, index) => emit("close", item, index);
56
- const renderContent = () => {
54
+ const renderSlots = () => {
57
55
  const key = model.value;
58
56
  if (!key) return null;
59
57
  const nodes = slots[key]?.({ key });
60
- if (Array.isArray(nodes)) return createVNode(_sfc_main$1, null, { default: () => nodes });
58
+ if (Array.isArray(nodes)) return createVNode(_sfc_main$1, { class: cls.e("content") }, { default: () => nodes });
61
59
  return nodes;
62
60
  };
63
61
  return (_ctx, _cache) => {
@@ -99,16 +97,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
97
  "size",
100
98
  "closable",
101
99
  "rounded"
102
- ])), hasContentSlots.value ? (openBlock(), createElementBlock("div", {
103
- key: 2,
104
- class: normalizeClass(unref(cls).e("content"))
105
- }, [createVNode(Transition, {
100
+ ])), createVNode(Transition, {
106
101
  name: "fade",
107
102
  mode: "out-in"
108
103
  }, {
109
- default: withCtx(() => [__props.keepAlive ? (openBlock(), createBlock(KeepAlive, { key: 0 }, [(openBlock(), createBlock(resolveDynamicComponent(renderContent()), { key: model.value }))], 1024)) : (openBlock(), createBlock(resolveDynamicComponent(renderContent()), { key: model.value }))]),
104
+ default: withCtx(() => [__props.keepAlive ? (openBlock(), createBlock(KeepAlive, { key: 0 }, [(openBlock(), createBlock(resolveDynamicComponent(renderSlots()), { key: model.value }))], 1024)) : (openBlock(), createBlock(resolveDynamicComponent(renderSlots()), { key: model.value }))]),
110
105
  _: 1
111
- })], 2)) : createCommentVNode("v-if", true)], 2);
106
+ })], 2);
112
107
  };
113
108
  }
114
109
  });
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.vue"],"sourcesContent":["<template>\n <div :class=\"[cls.b, cls.m(position!)]\">\n <u-tabs-horizontal\n v-if=\"isHorizontal\"\n v-model=\"model\"\n :items=\"items\"\n :position=\"horizontalPosition\"\n :size=\"size\"\n :closable=\"closable\"\n :block=\"block\"\n :rounded=\"rounded\"\n @click=\"onClick\"\n @close=\"onClose\"\n />\n <u-tabs-vertical\n v-else\n v-model=\"model\"\n :items=\"items\"\n :position=\"verticalPosition\"\n :size=\"size\"\n :closable=\"closable\"\n :rounded=\"rounded\"\n @click=\"onClick\"\n @close=\"onClose\"\n />\n\n <div v-if=\"hasContentSlots\" :class=\"cls.e('content')\">\n <transition name=\"fade\" mode=\"out-in\">\n <keep-alive v-if=\"keepAlive\">\n <component :key=\"model\" :is=\"renderContent()\" />\n </keep-alive>\n <component v-else :key=\"model\" :is=\"renderContent()\" />\n </transition>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { bem } from '@veltra/utils'\nimport { computed, createVNode, useSlots } from 'vue'\n\nimport type { ComponentSize, TabItem, TabsEmits, TabsProps } from '../../types'\nimport { UScroll } from '../scroll'\nimport UTabsHorizontal from './tabs-horizontal.vue'\nimport UTabsVertical from './tabs-vertical.vue'\n\ndefineOptions({ name: 'Tabs' })\n\nconst props = withDefaults(defineProps<TabsProps>(), {\n position: 'top',\n closable: false,\n block: false,\n rounded: false,\n keepAlive: false\n})\n\nconst emit = defineEmits<TabsEmits>()\n\nconst slots = useSlots() as Record<string, ((props?: any) => any) | undefined>\n\nconst { size } = useFallbackProps([props], {\n size: 'default' as ComponentSize\n})\n\nconst cls = bem('tabs')\n\nconst model = defineModel<string>()\n\nconst isHorizontal = computed(() => props.position === 'top' || props.position === 'bottom')\n\n/** 避免模板中使用类型断言:收敛 position 到水平 / 垂直子组件所需的子集。 */\nconst horizontalPosition = computed<'top' | 'bottom'>(() =>\n props.position === 'bottom' ? 'bottom' : 'top'\n)\n\nconst verticalPosition = computed<'left' | 'right'>(() =>\n props.position === 'right' ? 'right' : 'left'\n)\n\n/** 是否存在任一内容面板插槽;没有则不渲染内容区域。 */\nconst hasContentSlots = computed(() => Object.keys(slots).length > 0)\n\nconst onClick = (item: TabItem, index: number) => emit('click', item, index)\nconst onClose = (item: TabItem, index: number) => emit('close', item, index)\n\nconst renderContent = () => {\n const key = model.value\n if (!key) return null\n const nodes = slots[key]?.({ key })\n if (Array.isArray(nodes)) {\n return createVNode(UScroll, null, { default: () => nodes })\n }\n return nodes\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,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;;;;;;;QAGC,gBAAA,SAAA,WAAA,EAAX,mBAOM,OAAA;;IAPuB,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,UAAA,CAAA;OACvC,YAKa,YAAA;IALD,MAAK;IAAO,MAAK;;2BAGd,CAFK,QAAA,aAAA,WAAA,EAAlB,YAEa,WAAA,EAAA,KAAA,GAAA,EAAA,EAAA,WAAA,EADX,YAAgD,wBAAnB,eAAa,CAAA,EAAA,EAA9B,KAAK,MAAA,OAAK,CAAA,EAAA,EAAA,KAAA,KAAA,WAAA,EAExB,YAAuD,wBAAnB,eAAa,CAAA,EAAA,EAA9B,KAAK,MAAA,OAAK,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"tabs.js","names":[],"sources":["../../../src/components/tabs/tabs.vue"],"sourcesContent":["<template>\n <div :class=\"[cls.b, cls.m(position!)]\">\n <u-tabs-horizontal\n v-if=\"isHorizontal\"\n v-model=\"model\"\n :items=\"items\"\n :position=\"horizontalPosition\"\n :size=\"size\"\n :closable=\"closable\"\n :block=\"block\"\n :rounded=\"rounded\"\n @click=\"onClick\"\n @close=\"onClose\"\n />\n <u-tabs-vertical\n v-else\n v-model=\"model\"\n :items=\"items\"\n :position=\"verticalPosition\"\n :size=\"size\"\n :closable=\"closable\"\n :rounded=\"rounded\"\n @click=\"onClick\"\n @close=\"onClose\"\n />\n\n <transition name=\"fade\" mode=\"out-in\">\n <KeepAlive v-if=\"keepAlive\">\n <component :key=\"model\" :is=\"renderSlots()\" />\n </KeepAlive>\n <component v-else :key=\"model\" :is=\"renderSlots()\" />\n </transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { bem } from '@veltra/utils'\nimport { computed, createVNode, useSlots } from 'vue'\n\nimport type { ComponentSize, TabItem, TabsEmits, TabsProps } from '../../types'\nimport { UScroll } from '../scroll'\nimport UTabsHorizontal from './tabs-horizontal.vue'\nimport UTabsVertical from './tabs-vertical.vue'\n\ndefineOptions({ name: 'Tabs' })\n\nconst props = withDefaults(defineProps<TabsProps>(), {\n position: 'top',\n closable: false,\n block: false,\n rounded: false,\n keepAlive: false\n})\n\nconst emit = defineEmits<TabsEmits>()\n\nconst slots = useSlots() as Record<string, ((props?: any) => any) | undefined>\n\nconst { size } = useFallbackProps([props], {\n size: 'default' as ComponentSize\n})\n\nconst cls = bem('tabs')\n\nconst model = defineModel<string>()\n\nconst isHorizontal = computed(() => props.position === 'top' || props.position === 'bottom')\n\n/** 避免模板中使用类型断言:收敛 position 到水平 / 垂直子组件所需的子集。 */\nconst horizontalPosition = computed<'top' | 'bottom'>(() =>\n props.position === 'bottom' ? 'bottom' : 'top'\n)\n\nconst verticalPosition = computed<'left' | 'right'>(() =>\n props.position === 'right' ? 'right' : 'left'\n)\n\nconst onClick = (item: TabItem, index: number) => emit('click', item, index)\nconst onClose = (item: TabItem, index: number) => emit('close', item, index)\n\nconst renderSlots = () => {\n const key = model.value\n if (!key) return null\n const nodes = slots[key]?.({ key })\n if (Array.isArray(nodes)) {\n return createVNode(UScroll, { class: cls.e('content') }, { default: () => nodes })\n }\n return nodes\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,QAAQ,UAAU;EAExB,MAAM,EAAE,SAAS,iBAAiB,CAAC,MAAM,EAAE,EACzC,MAAM,WACP,CAAA;EAED,MAAM,MAAM,IAAI,OAAM;EAEtB,MAAM,QAAQ,SAAmB,SAAA,aAAC;EAElC,MAAM,eAAe,eAAe,MAAM,aAAa,SAAS,MAAM,aAAa,SAAQ;;EAG3F,MAAM,qBAAqB,eACzB,MAAM,aAAa,WAAW,WAAW,MAC3C;EAEA,MAAM,mBAAmB,eACvB,MAAM,aAAa,UAAU,UAAU,OACzC;EAEA,MAAM,WAAW,MAAe,UAAkB,KAAK,SAAS,MAAM,MAAK;EAC3E,MAAM,WAAW,MAAe,UAAkB,KAAK,SAAS,MAAM,MAAK;EAE3E,MAAM,oBAAoB;GACxB,MAAM,MAAM,MAAM;AAClB,OAAI,CAAC,IAAK,QAAO;GACjB,MAAM,QAAQ,MAAM,OAAO,EAAE,KAAK,CAAA;AAClC,OAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,YAAY,aAAS,EAAE,OAAO,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,eAAe,OAAO,CAAA;AAEnF,UAAO;;;uBAvFP,mBA+BM,OAAA,EA/BA,OAAK,eAAA,CAAG,MAAA,IAAG,CAAC,GAAG,MAAA,IAAG,CAAC,EAAE,QAAA,SAAQ,CAAA,CAAA,EAAA,EAAA,CAEzB,aAAA,SAAA,WAAA,EADR,YAWE,aAAA;;gBATS,MAAA;iEAAA,MAAK,QAAA;IACb,OAAO,QAAA;IACP,UAAU,mBAAA;IACV,MAAM,MAAA,KAAI;IACV,UAAU,QAAA;IACV,OAAO,QAAA;IACP,SAAS,QAAA;IACF;IACA;;;;;;;;;uBAEV,YAUE,aAAA;;gBARS,MAAA;iEAAA,MAAK,QAAA;IACb,OAAO,QAAA;IACP,UAAU,iBAAA;IACV,MAAM,MAAA,KAAI;IACV,UAAU,QAAA;IACV,SAAS,QAAA;IACF;IACA;;;;;;;;QAGV,YAKa,YAAA;IALD,MAAK;IAAO,MAAK;;2BAGf,CAFK,QAAA,aAAA,WAAA,EAAjB,YAEY,WAAA,EAAA,KAAA,GAAA,EAAA,EAAA,WAAA,EADV,YAA8C,wBAAjB,aAAW,CAAA,EAAA,EAA5B,KAAK,MAAA,OAAK,CAAA,EAAA,EAAA,KAAA,KAAA,WAAA,EAExB,YAAqD,wBAAjB,aAAW,CAAA,EAAA,EAA5B,KAAK,MAAA,OAAK,CAAA,EAAA,CAAA"}
@@ -19,9 +19,9 @@ declare const __VLS_export: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {},
19
19
  onClick?: ((item: TabItem, index: number) => any) | undefined;
20
20
  }>, {
21
21
  closable: boolean;
22
+ block: boolean;
22
23
  rounded: boolean;
23
24
  position: "left" | "right" | "top" | "bottom";
24
- block: boolean;
25
25
  keepAlive: boolean;
26
26
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
27
27
  declare const _default: typeof __VLS_export;
@@ -11,10 +11,10 @@ declare const __VLS_base: _$vue.DefineComponent<TipProps, {}, {}, {}, {}, _$vue.
11
11
  }, string, _$vue.PublicProps, Readonly<TipProps> & Readonly<{
12
12
  "onUpdate:visible"?: ((value: boolean) => any) | undefined;
13
13
  }>, {
14
- direction: TipDirection;
15
14
  trigger: "hover" | "click";
16
15
  contentTag: string;
17
16
  visible: boolean;
17
+ direction: TipDirection;
18
18
  content: string;
19
19
  alignment: TipAlign;
20
20
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
@@ -21,11 +21,11 @@ declare const __VLS_base: _$vue.DefineComponent<TreeProps, _TreeExposed, {}, {},
21
21
  "onNode-contextmenu"?: ((event: MouseEvent, node: TreeNode<Record<string, any>>) => any) | undefined;
22
22
  "onSelected-synced"?: ((selected?: Record<string, any> | undefined) => any) | undefined;
23
23
  }>, {
24
+ data: Record<string, any>[];
24
25
  expandOnClickNode: boolean;
25
26
  labelKey: string;
26
27
  valueKey: string;
27
28
  childrenKey: string;
28
- data: Record<string, any>[];
29
29
  checkStrictly: boolean;
30
30
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
31
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -26,10 +26,10 @@ declare const __VLS_base: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {}, {
26
26
  }>, {
27
27
  disabled: boolean;
28
28
  readonly: boolean;
29
+ minWidth: string;
29
30
  expandAll: boolean;
30
31
  labelKey: string;
31
32
  valueKey: string;
32
- minWidth: string;
33
33
  placeholder: string;
34
34
  clearable: boolean;
35
35
  filterable: boolean;
@@ -20,6 +20,11 @@ interface CollapseProps extends ComponentProps {
20
20
  * @default false
21
21
  */
22
22
  defaultCollapseAll?: boolean;
23
+ /**
24
+ * 是否使用边框模式
25
+ * @default false
26
+ */
27
+ bordered?: boolean;
23
28
  /**
24
29
  * 自定义展开图标组件,活动态会自动旋转 90°。
25
30
  * 接受任意 Vue 组件(SFC、Functional Component 等)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltra/desktop",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -61,22 +61,22 @@
61
61
  "@lexical/rich-text": "^0.43.0",
62
62
  "@lexical/selection": "^0.43.0",
63
63
  "@lexical/utils": "^0.43.0",
64
- "@veltra/compositions": "1.1.10",
65
- "@veltra/directives": "1.1.10",
66
- "@veltra/icons": "1.1.10",
67
- "@veltra/styles": "1.1.10",
68
- "@veltra/utils": "1.1.10",
64
+ "@veltra/compositions": "1.1.12",
65
+ "@veltra/directives": "1.1.12",
66
+ "@veltra/icons": "1.1.12",
67
+ "@veltra/styles": "1.1.12",
68
+ "@veltra/utils": "1.1.12",
69
69
  "@visactor/vtable": "^1.26.0",
70
70
  "codemirror": "^6.0.2",
71
71
  "docx-preview": "^0.3.7",
72
72
  "lexical": "^0.43.0"
73
73
  },
74
74
  "peerDependencies": {
75
- "@veltra/compositions": "1.1.10",
76
- "@veltra/directives": "1.1.10",
77
- "@veltra/icons": "1.1.10",
78
- "@veltra/styles": "1.1.10",
79
- "@veltra/utils": "1.1.10",
75
+ "@veltra/compositions": "1.1.12",
76
+ "@veltra/directives": "1.1.12",
77
+ "@veltra/icons": "1.1.12",
78
+ "@veltra/styles": "1.1.12",
79
+ "@veltra/utils": "1.1.12",
80
80
  "vue": "^3.5.33"
81
81
  }
82
82
  }
@@ -54,7 +54,8 @@ const iconComponent = computed(() => context?.expandIcon.value ?? ArrowRight)
54
54
  const classList = computed(() => [
55
55
  cls.e('item'),
56
56
  bem.is('active', isActive.value),
57
- bem.is('disabled', props.disabled)
57
+ bem.is('disabled', props.disabled),
58
+ bem.is('bordered', context?.bordered.value)
58
59
  ])
59
60
 
60
61
  const headerClassList = computed(() => [
@@ -18,7 +18,8 @@ defineOptions({
18
18
 
19
19
  const props = withDefaults(defineProps<CollapseProps>(), {
20
20
  accordion: false,
21
- defaultCollapseAll: false
21
+ defaultCollapseAll: false,
22
+ bordered: false
22
23
  })
23
24
  const emit = defineEmits<CollapseEmits>()
24
25
 
@@ -32,7 +33,9 @@ const { size } = useFormFallbackProps([props], { size: 'default' })
32
33
 
33
34
  const expandIcon = computed(() => props.expandIcon)
34
35
 
35
- const classList = computed(() => [cls.b, cls.m(size.value)])
36
+ const bordered = computed(() => props.bordered)
37
+
38
+ const classList = computed(() => [cls.b, cls.m(size.value), bem.is('bordered', bordered.value)])
36
39
 
37
40
  const modelValue = useModel<CollapseProps, 'modelValue'>({
38
41
  props,
@@ -107,6 +110,7 @@ const unregister = (value: CollapseValue) => {
107
110
  provide(CollapseDIKey, {
108
111
  cls,
109
112
  size,
113
+ bordered,
110
114
  expandIcon,
111
115
  activeValues,
112
116
  toggle,
@@ -6,6 +6,7 @@ import type { CollapseValue } from '../../types'
6
6
  export interface CollapseContext {
7
7
  cls: BEM<'collapse'>
8
8
  size: ComputedRef<ComponentSize>
9
+ bordered: ComputedRef<boolean>
9
10
  expandIcon: ComputedRef<Component | undefined>
10
11
  activeValues: ComputedRef<CollapseValue[]>
11
12
  toggle: (value: CollapseValue) => void
@@ -60,7 +60,7 @@ $transition-normal: 0.24s $ease;
60
60
  cursor: pointer;
61
61
  font-weight: 500;
62
62
  letter-spacing: 0.01em;
63
- color: fn.use-var(text-color, title);
63
+ color: fn.component-var(collapse, title-color, fn.use-var(text-color, main));
64
64
  user-select: none;
65
65
  outline: none;
66
66
  transition:
@@ -125,7 +125,7 @@ $transition-normal: 0.24s $ease;
125
125
 
126
126
  @include m.bem($root-name, header) {
127
127
  padding: calc(fn.use-var(gap, $size) - 2px) fn.use-var(gap, $size);
128
- font-size: fn.use-var(font-size-title, $size);
128
+ font-size: fn.use-var(font-size-main, $size);
129
129
  }
130
130
 
131
131
  @include m.bem($root-name, content) {
@@ -141,4 +141,25 @@ $transition-normal: 0.24s $ease;
141
141
  }
142
142
  }
143
143
  }
144
+
145
+ // ===== Bordered =====
146
+ @include m.is(bordered) {
147
+ #{fn.bem($root-name, item)} {
148
+ background-color: transparent;
149
+ border: 1px solid vars.$border-color;
150
+
151
+ &:hover,
152
+ &.is-active {
153
+ background-color: transparent;
154
+ }
155
+ }
156
+
157
+ #{fn.bem($root-name, header)} {
158
+ border-radius: 0;
159
+
160
+ @include m.is(active) {
161
+ border-bottom: 1px solid vars.$border-color;
162
+ }
163
+ }
164
+ }
144
165
  }
@@ -24,14 +24,12 @@
24
24
  @close="onClose"
25
25
  />
26
26
 
27
- <div v-if="hasContentSlots" :class="cls.e('content')">
28
- <transition name="fade" mode="out-in">
29
- <keep-alive v-if="keepAlive">
30
- <component :key="model" :is="renderContent()" />
31
- </keep-alive>
32
- <component v-else :key="model" :is="renderContent()" />
33
- </transition>
34
- </div>
27
+ <transition name="fade" mode="out-in">
28
+ <KeepAlive v-if="keepAlive">
29
+ <component :key="model" :is="renderSlots()" />
30
+ </KeepAlive>
31
+ <component v-else :key="model" :is="renderSlots()" />
32
+ </transition>
35
33
  </div>
36
34
  </template>
37
35
 
@@ -78,18 +76,15 @@ const verticalPosition = computed<'left' | 'right'>(() =>
78
76
  props.position === 'right' ? 'right' : 'left'
79
77
  )
80
78
 
81
- /** 是否存在任一内容面板插槽;没有则不渲染内容区域。 */
82
- const hasContentSlots = computed(() => Object.keys(slots).length > 0)
83
-
84
79
  const onClick = (item: TabItem, index: number) => emit('click', item, index)
85
80
  const onClose = (item: TabItem, index: number) => emit('close', item, index)
86
81
 
87
- const renderContent = () => {
82
+ const renderSlots = () => {
88
83
  const key = model.value
89
84
  if (!key) return null
90
85
  const nodes = slots[key]?.({ key })
91
86
  if (Array.isArray(nodes)) {
92
- return createVNode(UScroll, null, { default: () => nodes })
87
+ return createVNode(UScroll, { class: cls.e('content') }, { default: () => nodes })
93
88
  }
94
89
  return nodes
95
90
  }
@@ -24,6 +24,12 @@ export interface CollapseProps extends ComponentProps {
24
24
  */
25
25
  defaultCollapseAll?: boolean
26
26
 
27
+ /**
28
+ * 是否使用边框模式
29
+ * @default false
30
+ */
31
+ bordered?: boolean
32
+
27
33
  /**
28
34
  * 自定义展开图标组件,活动态会自动旋转 90°。
29
35
  * 接受任意 Vue 组件(SFC、Functional Component 等)。