@veltra/desktop 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/components/action/action-group.vue.d.ts +1 -1
  2. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js +4 -4
  3. package/dist/components/action/action.js +1 -1
  4. package/dist/components/action/action.vue.d.ts +3 -3
  5. package/dist/components/auto-complete/auto-complete.js +4 -4
  6. package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
  7. package/dist/components/batch-edit/batch-edit-form.js +6 -6
  8. package/dist/components/batch-edit/batch-edit-list.js +8 -8
  9. package/dist/components/batch-edit/batch-edit.js +1 -1
  10. package/dist/components/batch-edit/batch-edit.vue.d.ts +2 -2
  11. package/dist/components/button/button.vue.d.ts +1 -1
  12. package/dist/components/cascade/cascade-panel-item.js +4 -4
  13. package/dist/components/cascade/cascade.js +5 -5
  14. package/dist/components/cascade/cascade.vue.d.ts +6 -6
  15. package/dist/components/cascade/use-select.js +1 -1
  16. package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
  17. package/dist/components/collapse/collapse-item.js +122 -0
  18. package/dist/components/collapse/collapse-item.js.map +1 -0
  19. package/dist/components/collapse/collapse-item.vue.d.ts +29 -0
  20. package/dist/components/collapse/collapse.js +114 -0
  21. package/dist/components/collapse/collapse.js.map +1 -0
  22. package/dist/components/collapse/collapse.vue.d.ts +29 -0
  23. package/dist/components/collapse/di.js +6 -0
  24. package/dist/components/collapse/di.js.map +1 -0
  25. package/dist/components/collapse/index.d.ts +2 -0
  26. package/dist/components/collapse/style.d.ts +1 -0
  27. package/dist/components/collapse/style.js +1 -0
  28. package/dist/components/collapse/style2.css +144 -0
  29. package/dist/components/context-menu/context-menu-item.js +1 -1
  30. package/dist/components/context-menu/context-menu.vue.d.ts +15 -0
  31. package/dist/components/context-menu/index.d.ts +1 -0
  32. package/dist/components/date-panel/date-panel.vue.d.ts +2 -2
  33. package/dist/components/date-picker/date-picker.js +1 -1
  34. package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
  35. package/dist/components/date-range-picker/date-range-picker.js +1 -1
  36. package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
  37. package/dist/components/dialog/dialog.js +6 -6
  38. package/dist/components/expression-editor/components/variable-picker.js +10 -10
  39. package/dist/components/file-picker/file-picker.vue.d.ts +1 -1
  40. package/dist/components/file-viewer/file-viewer.js +10 -10
  41. package/dist/components/form/dynamic-form-model.js +1 -1
  42. package/dist/components/form/form-model.js +1 -1
  43. package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js +1 -1
  44. package/dist/components/form/use-node-interceptor.js +1 -1
  45. package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js +4 -4
  46. package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
  47. package/dist/components/form-item/helper.js +1 -1
  48. package/dist/components/index.d.ts +89 -86
  49. package/dist/components/index.js +202 -0
  50. package/dist/components/index.js.map +1 -0
  51. package/dist/components/input/input.vue.d.ts +3 -3
  52. package/dist/components/menu/menu-sub-collapsed.js +6 -6
  53. package/dist/components/multi-select/multi-select.js +13 -13
  54. package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
  55. package/dist/components/multi-tree-select/multi-tree-select.js +13 -13
  56. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
  57. package/dist/components/notification/notification.vue.d.ts +1 -1
  58. package/dist/components/number/number.js +1 -1
  59. package/dist/components/number-input/number-input.js +2 -2
  60. package/dist/components/number-input/number-input.vue.d.ts +1 -1
  61. package/dist/components/number-range-input/number-range-input.js +1 -1
  62. package/dist/components/number-range-input/number-range-input.vue.d.ts +2 -2
  63. package/dist/components/paginator/paginator.js +2 -2
  64. package/dist/components/palette/palette-color-switch.js +1 -1
  65. package/dist/components/password-input/password-input.js +1 -1
  66. package/dist/components/password-input/password-input.vue.d.ts +1 -1
  67. package/dist/components/pop-confirm/pop-confirm.js +5 -5
  68. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  69. package/dist/components/progress/progress.js +1 -1
  70. package/dist/components/progress-nodes/progress-nodes.js +1 -1
  71. package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
  72. package/dist/components/scroll/scroll.js +1 -1
  73. package/dist/components/scroll/scroll.vue.d.ts +2 -2
  74. package/dist/components/select/select.js +11 -11
  75. package/dist/components/select/select.vue.d.ts +2 -2
  76. package/dist/components/steps/steps.js +1 -1
  77. package/dist/components/steps/steps.vue.d.ts +1 -1
  78. package/dist/components/table/table-body.js +1 -1
  79. package/dist/components/table/table-foot.js +1 -1
  80. package/dist/components/table/table.vue.d.ts +2 -2
  81. package/dist/components/table/use-columns.js +1 -1
  82. package/dist/components/table/use-rows.js +1 -1
  83. package/dist/components/table/use-table.js +1 -1
  84. package/dist/components/tabs/tabs-horizontal.vue.d.ts +4 -4
  85. package/dist/components/tabs/tabs-vertical.vue.d.ts +3 -3
  86. package/dist/components/tabs/tabs.vue.d.ts +4 -4
  87. package/dist/components/textarea/textarea.vue.d.ts +3 -3
  88. package/dist/components/theme/theme.js +7 -7
  89. package/dist/components/tip/tip.vue.d.ts +1 -1
  90. package/dist/components/tree/tree-node.js +3 -3
  91. package/dist/components/tree/tree.vue.d.ts +6 -6
  92. package/dist/components/tree-select/tree-select.js +5 -5
  93. package/dist/components/tree-select/tree-select.vue.d.ts +5 -5
  94. package/dist/components/watermark/watermark.js +1 -1
  95. package/dist/components/watermark/watermark.vue.d.ts +1 -1
  96. package/dist/index.d.ts +86 -82
  97. package/dist/index.js +85 -82
  98. package/dist/install.d.ts +8 -0
  99. package/dist/install.js +20 -0
  100. package/dist/install.js.map +1 -0
  101. package/dist/style.d.ts +1 -0
  102. package/dist/style.js +73 -0
  103. package/dist/types/calendar.d.ts +1 -1
  104. package/dist/types/cascade.d.ts +1 -1
  105. package/dist/types/collapse.d.ts +68 -0
  106. package/dist/types/date-panel.d.ts +1 -1
  107. package/dist/types/date-picker.d.ts +1 -1
  108. package/dist/types/date-range-picker.d.ts +1 -1
  109. package/dist/types/index.d.ts +2 -1
  110. package/dist/types/table.d.ts +1 -1
  111. package/dist/types/tree.d.ts +1 -1
  112. package/package.json +25 -11
  113. package/src/components/collapse/collapse-item.vue +138 -0
  114. package/src/components/collapse/collapse.vue +122 -0
  115. package/src/components/collapse/di.ts +15 -0
  116. package/src/components/collapse/index.ts +2 -0
  117. package/src/components/collapse/style.scss +186 -0
  118. package/src/components/collapse/style.ts +1 -0
  119. package/src/components/context-menu/index.ts +2 -0
  120. package/src/components/index.ts +73 -71
  121. package/src/install.ts +27 -0
  122. package/src/style.ts +73 -0
  123. package/src/types/collapse.ts +78 -0
  124. package/src/types/index.ts +1 -0
@@ -8,8 +8,8 @@ type __VLS_Slots = {
8
8
  };
9
9
  declare const __VLS_base: _$vue.DefineComponent<ActionGroupProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<ActionGroupProps> & Readonly<{}>, {
10
10
  max: number;
11
- loading: boolean;
12
11
  circle: boolean;
12
+ loading: boolean;
13
13
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
14
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
15
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,6 @@
1
1
  import _sfc_main from "../icon/icon.js";
2
- import _sfc_main$1 from "../button/button.js";
3
- import _sfc_main$2 from "../tip/tip.js";
2
+ import _sfc_main$1 from "../tip/tip.js";
3
+ import _sfc_main$2 from "../button/button.js";
4
4
  import { ActionDIKey } from "./di.js";
5
5
  import { Fragment, createBlock, createElementBlock, createTextVNode, createVNode, defineComponent, openBlock, provide, renderList, resolveDynamicComponent, useSlots } from "vue";
6
6
  import { bem, extractNormalVNodes } from "@veltra/utils";
@@ -37,12 +37,12 @@ var action_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
37
37
  normalNodes = extractedNodes.slice(0, props.max - 1);
38
38
  hiddenNodes = extractedNodes.slice(props.max - 1);
39
39
  }
40
- const dropdown = hiddenNodes.length ? createVNode(_sfc_main$2, {
40
+ const dropdown = hiddenNodes.length ? createVNode(_sfc_main$1, {
41
41
  "direction": "bottom",
42
42
  "class": cls.e("dropdown")
43
43
  }, {
44
44
  content: () => hiddenNodes,
45
- default: () => createVNode(_sfc_main$1, {
45
+ default: () => createVNode(_sfc_main$2, {
46
46
  "text": true,
47
47
  "size": "small",
48
48
  "type": "primary",
@@ -2,8 +2,8 @@ import _sfc_main$1 from "../button/button.js";
2
2
  import _sfc_main$2 from "../pop-confirm/pop-confirm.js";
3
3
  import { ActionDIKey } from "./di.js";
4
4
  import { computed, createBlock, createVNode, defineComponent, inject, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
5
- import { o } from "@cat-kit/core";
6
5
  import { bem } from "@veltra/utils";
6
+ import { o } from "@cat-kit/core";
7
7
  //#region src/components/action/action.vue
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
9
  name: "Action",
@@ -15,12 +15,12 @@ declare const __VLS_base: _$vue.DefineComponent<ActionProps, {}, {}, {}, {}, _$v
15
15
  }, string, _$vue.PublicProps, Readonly<ActionProps> & Readonly<{
16
16
  onRun?: (() => any) | undefined;
17
17
  }>, {
18
- type: ButtonType;
19
18
  size: _$_veltra_utils0.ComponentSize;
20
- loading: boolean;
19
+ type: ButtonType;
20
+ text: boolean;
21
21
  circle: boolean;
22
+ loading: boolean;
22
23
  inDropdown: boolean;
23
- text: boolean;
24
24
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
25
25
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
26
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,6 @@
1
- import _sfc_main$1 from "../dropdown/dropdown.js";
1
+ import _sfc_main$1 from "../scroll/scroll.js";
2
+ import _sfc_main$2 from "../dropdown/dropdown.js";
2
3
  import input_default from "../input/input.js";
3
- import _sfc_main$2 from "../scroll/scroll.js";
4
4
  import { useKeyboard } from "./use-keyboard.js";
5
5
  import { useSuggestions } from "./use-suggestions.js";
6
6
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeClass, normalizeProps, openBlock, renderList, renderSlot, shallowRef, toDisplayString, unref, useModel, useSlots, watch, withCtx, withDirectives } from "vue";
@@ -126,7 +126,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
126
126
  dropdownRef.value?.close();
127
127
  };
128
128
  return (_ctx, _cache) => {
129
- return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$1), {
129
+ return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$2), {
130
130
  key: 0,
131
131
  trigger: "click",
132
132
  class: normalizeClass([
@@ -164,7 +164,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
164
164
  "clearable",
165
165
  "modelValue"
166
166
  ])]),
167
- content: withCtx(() => [createVNode(unref(_sfc_main$2), {
167
+ content: withCtx(() => [createVNode(unref(_sfc_main$1), {
168
168
  tag: "ul",
169
169
  class: normalizeClass(unref(cls).e("options")),
170
170
  ref_key: "scrollRef",
@@ -25,9 +25,9 @@ declare const __VLS_base: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {}, {
25
25
  onSelect?: ((value: string) => any) | undefined;
26
26
  }>, {
27
27
  disabled: boolean;
28
+ readonly: boolean;
28
29
  placeholder: string;
29
30
  clearable: boolean;
30
- readonly: boolean;
31
31
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
32
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
33
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,9 @@
1
- import _sfc_main$1 from "../button/button.js";
2
- import _sfc_main$2 from "../scroll/scroll.js";
1
+ import _sfc_main$1 from "../scroll/scroll.js";
2
+ import form_default from "../form/form.js";
3
+ import _sfc_main$2 from "../button/button.js";
3
4
  import _sfc_main$3 from "../card/card.js";
4
5
  import _sfc_main$4 from "../card/card-header.js";
5
6
  import _sfc_main$5 from "../card/card-action.js";
6
- import form_default from "../form/form.js";
7
7
  import { BatchEditDIKey } from "./di.js";
8
8
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, guardReactiveProps, inject, normalizeClass, normalizeProps, openBlock, renderSlot, toDisplayString, unref, withCtx, withKeys } from "vue";
9
9
  //#region src/components/batch-edit/batch-edit-form.vue
@@ -33,7 +33,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
33
  appear: "",
34
34
  mode: "out-in"
35
35
  }, {
36
- default: withCtx(() => [createVNode(unref(_sfc_main$2), {
36
+ default: withCtx(() => [createVNode(unref(_sfc_main$1), {
37
37
  always: "",
38
38
  class: normalizeClass(unref(cls).e("form-wrap"))
39
39
  }, {
@@ -63,7 +63,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
63
  _: 3
64
64
  }),
65
65
  createVNode(unref(_sfc_main$5), { class: normalizeClass(unref(cls).e("action")) }, {
66
- default: withCtx(() => [createVNode(unref(_sfc_main$1), {
66
+ default: withCtx(() => [createVNode(unref(_sfc_main$2), {
67
67
  text: "",
68
68
  type: "primary",
69
69
  loading: unref(state).loading,
@@ -71,7 +71,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
71
  }, {
72
72
  default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode(" 关闭 ", -1)])]),
73
73
  _: 1
74
- }, 8, ["loading", "onClick"]), !unref(props).readonly && unref(state).dataUpdated && (creatable.value || updatable.value) ? (openBlock(), createBlock(unref(_sfc_main$1), {
74
+ }, 8, ["loading", "onClick"]), !unref(props).readonly && unref(state).dataUpdated && (creatable.value || updatable.value) ? (openBlock(), createBlock(unref(_sfc_main$2), {
75
75
  key: 0,
76
76
  type: unref(state).type === "create" ? "success" : "primary",
77
77
  loading: unref(state).loading,
@@ -1,8 +1,8 @@
1
1
  import _sfc_main$1 from "../button/button.js";
2
- import _sfc_main$2 from "../action/action.js";
3
- import action_group_default from "../action/action-group.js";
2
+ import _sfc_main$2 from "../table/table.js";
4
3
  import { BatchEditDIKey } from "./di.js";
5
- import _sfc_main$3 from "../table/table.js";
4
+ import _sfc_main$3 from "../action/action.js";
5
+ import action_group_default from "../action/action-group.js";
6
6
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, mergeProps, normalizeClass, openBlock, toDisplayString, unref, withCtx, withModifiers } from "vue";
7
7
  import { o } from "@cat-kit/core";
8
8
  import { AddChild, Delete, InsertToNext, InsertToPrev } from "@veltra/icons/normal";
@@ -47,7 +47,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
47
  }
48
48
  }
49
49
  return (_ctx, _cache) => {
50
- return openBlock(), createBlock(unref(_sfc_main$3), mergeProps(tableProps.value, {
50
+ return openBlock(), createBlock(unref(_sfc_main$2), mergeProps(tableProps.value, {
51
51
  slots: __props.slots,
52
52
  class: unref(cls).e("table"),
53
53
  columns: columns.value,
@@ -65,22 +65,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
65
  max: 9
66
66
  }, {
67
67
  default: withCtx(() => [
68
- unref(staticFeatures).has("create") || unref(dynamicFeatures).create?.(row) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(_sfc_main$2), mergeProps({
68
+ unref(staticFeatures).has("create") || unref(dynamicFeatures).create?.(row) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(_sfc_main$3), mergeProps({
69
69
  onRun: ($event) => unref(handleInsertToPrev)(row),
70
70
  icon: unref(InsertToPrev),
71
71
  title: "插入到上一行"
72
- }, unref(props).actionsProps?.create), null, 16, ["onRun", "icon"]), createVNode(unref(_sfc_main$2), mergeProps({
72
+ }, unref(props).actionsProps?.create), null, 16, ["onRun", "icon"]), createVNode(unref(_sfc_main$3), mergeProps({
73
73
  onRun: ($event) => unref(handleInsertToNext)(row),
74
74
  icon: unref(InsertToNext),
75
75
  title: "插入到下一行"
76
76
  }, unref(props).actionsProps?.create), null, 16, ["onRun", "icon"])], 64)) : createCommentVNode("v-if", true),
77
- unref(props).tree && (unref(staticFeatures).has("createChild") || unref(dynamicFeatures).createChild?.(row)) ? (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
77
+ unref(props).tree && (unref(staticFeatures).has("createChild") || unref(dynamicFeatures).createChild?.(row)) ? (openBlock(), createBlock(unref(_sfc_main$3), mergeProps({
78
78
  key: 1,
79
79
  onRun: ($event) => unref(handleInsertChild)(row),
80
80
  icon: unref(AddChild),
81
81
  title: "添加子项"
82
82
  }, unref(props).actionsProps?.createChild), null, 16, ["onRun", "icon"])) : createCommentVNode("v-if", true),
83
- unref(staticFeatures).has("delete") || unref(dynamicFeatures).delete?.(row) ? (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
83
+ unref(staticFeatures).has("delete") || unref(dynamicFeatures).delete?.(row) ? (openBlock(), createBlock(unref(_sfc_main$3), mergeProps({
84
84
  key: 2,
85
85
  icon: unref(Delete),
86
86
  type: "danger",
@@ -1,5 +1,5 @@
1
- import { DialogDIKey } from "../dialog/di.js";
2
1
  import _sfc_main$1 from "../layout/layout.js";
2
+ import { DialogDIKey } from "../dialog/di.js";
3
3
  import { BatchEditDIKey } from "./di.js";
4
4
  import _sfc_main$2 from "./batch-edit-form.js";
5
5
  import _sfc_main$3 from "./batch-edit-list.js";
@@ -7,9 +7,9 @@ import * as _$_cat_kit_core0 from "@cat-kit/core";
7
7
  //#region src/components/batch-edit/batch-edit.vue.d.ts
8
8
  declare const __VLS_export: <Model extends FormModel>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
9
9
  props: _$vue.PublicProps & __VLS_PrettifyLocal<BatchEditProps<Model> & {
10
- "onUpdate:data"?: ((value: Record<string, any>[]) => any) | undefined;
11
- "onUpdate:checked"?: ((value: Record<string, any>[]) => any) | undefined;
12
10
  "onUpdate:selected"?: ((value: Record<string, any> | undefined) => any) | undefined;
11
+ "onUpdate:checked"?: ((value: Record<string, any>[]) => any) | undefined;
12
+ "onUpdate:data"?: ((value: Record<string, any>[]) => any) | undefined;
13
13
  "onUpdate:rows"?: ((rows: TableRow[]) => any) | undefined;
14
14
  "onUpdate:forest"?: ((rows?: _$_cat_kit_core0.Forest<Record<string, unknown>, any> | undefined) => any) | undefined;
15
15
  "onUpdate:current"?: ((row?: TableRow | undefined) => any) | undefined;
@@ -11,9 +11,9 @@ declare const __VLS_base: _$vue.DefineComponent<ButtonProps, _ButtonExposed, {},
11
11
  }, string, _$vue.PublicProps, Readonly<ButtonProps> & Readonly<{
12
12
  onClick?: ((e: MouseEvent) => any) | undefined;
13
13
  }>, {
14
- loadingIcon: _$vue.Component;
15
14
  disabled: boolean;
16
15
  iconPosition: "left" | "right";
16
+ loadingIcon: _$vue.Component;
17
17
  propagate: boolean;
18
18
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
19
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,5 +1,5 @@
1
- import _sfc_main$1 from "../icon/icon.js";
2
- import _sfc_main$2 from "../scroll/scroll.js";
1
+ import _sfc_main$1 from "../scroll/scroll.js";
2
+ import _sfc_main$2 from "../icon/icon.js";
3
3
  import _sfc_main$3 from "../checkbox/checkbox.js";
4
4
  import { CascadeDIKey } from "./di.js";
5
5
  import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, normalizeClass, onMounted, openBlock, renderList, shallowRef, toDisplayString, unref, useTemplateRef, withCtx } from "vue";
@@ -39,7 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
39
  });
40
40
  });
41
41
  return (_ctx, _cache) => {
42
- return openBlock(), createBlock(unref(_sfc_main$2), {
42
+ return openBlock(), createBlock(unref(_sfc_main$1), {
43
43
  tag: "ul",
44
44
  class: normalizeClass(unref(panelCls).b),
45
45
  ref: "scroll-container",
@@ -65,7 +65,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
65
  "onUpdate:modelValue"
66
66
  ])) : createCommentVNode("v-if", true),
67
67
  createElementVNode("span", { class: normalizeClass(unref(panelCls).e("option-label")) }, toDisplayString(node.label), 3),
68
- node.children?.length ? (openBlock(), createBlock(unref(_sfc_main$1), {
68
+ node.children?.length ? (openBlock(), createBlock(unref(_sfc_main$2), {
69
69
  key: 1,
70
70
  class: normalizeClass(unref(panelCls).e("option-expand"))
71
71
  }, {
@@ -1,7 +1,7 @@
1
1
  import _sfc_main$1 from "../icon/icon.js";
2
- import _sfc_main$2 from "../dropdown/dropdown.js";
2
+ import _sfc_main$2 from "../empty/empty.js";
3
+ import _sfc_main$3 from "../dropdown/dropdown.js";
3
4
  import input_default from "../input/input.js";
4
- import _sfc_main$3 from "../empty/empty.js";
5
5
  import _sfc_main$4 from "../tag/tag.js";
6
6
  import { CascadeDIKey } from "./di.js";
7
7
  import _sfc_main$5 from "./cascade-panel-item.js";
@@ -10,9 +10,9 @@ import { useCheck } from "./use-check.js";
10
10
  import { useDataMap } from "./use-data-map.js";
11
11
  import { useSelect } from "./use-select.js";
12
12
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, provide, renderList, shallowRef, toDisplayString, triggerRef, unref, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
13
- import { Forest, o } from "@cat-kit/core";
14
13
  import { FORM_EMPTY_CONTENT, bem } from "@veltra/utils";
15
14
  import { useFormComponent, useFormFallbackProps, useUserAction } from "@veltra/compositions";
15
+ import { Forest, o } from "@cat-kit/core";
16
16
  import { ArrowDown, Close, Search } from "@veltra/icons/normal";
17
17
  //#region src/components/cascade/cascade.vue
18
18
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -168,7 +168,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
168
168
  checkedSet
169
169
  });
170
170
  return (_ctx, _cache) => {
171
- return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$2), {
171
+ return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$3), {
172
172
  key: 0,
173
173
  class: normalizeClass([
174
174
  unref(cls).b,
@@ -289,7 +289,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
289
289
  }), 128))], 2)) : (openBlock(), createElementBlock("div", {
290
290
  key: 2,
291
291
  class: normalizeClass(unref(cls).e("empty"))
292
- }, [createVNode(unref(_sfc_main$3))], 2))
292
+ }, [createVNode(unref(_sfc_main$2))], 2))
293
293
  ]),
294
294
  _: 1
295
295
  }, 8, [
@@ -3,25 +3,25 @@ import * as _$vue from "vue";
3
3
 
4
4
  //#region src/components/cascade/cascade.vue.d.ts
5
5
  declare const __VLS_export: _$vue.DefineComponent<CascadeProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {} & {
6
- clear: () => any;
7
6
  "update:modelValue": (value?: string | string[] | undefined) => any;
7
+ clear: () => any;
8
8
  change: (...args: [value?: string | undefined, label?: string | undefined, item?: Record<string, any> | undefined] | [value: string[], label: string[], data: Record<string, any>[]]) => any;
9
9
  }, string, _$vue.PublicProps, Readonly<CascadeProps> & Readonly<{
10
- onClear?: (() => any) | undefined;
11
10
  "onUpdate:modelValue"?: ((value?: string | string[] | undefined) => any) | undefined;
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
14
  disabled: boolean;
15
- placeholder: string;
16
- clearable: boolean;
17
15
  readonly: boolean;
18
- data: Record<string, any>[];
19
- separator: string;
20
16
  labelKey: string;
21
17
  valueKey: string;
22
18
  childrenKey: string;
19
+ data: Record<string, any>[];
20
+ placeholder: string;
21
+ clearable: boolean;
23
22
  filterable: boolean;
24
23
  visibilityLimit: number;
24
+ separator: string;
25
25
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
27
27
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { computed, nextTick, shallowRef, triggerRef, watch } from "vue";
2
- import "@cat-kit/core";
3
2
  import { createIncrease } from "@veltra/utils";
3
+ import "@cat-kit/core";
4
4
  //#region src/components/cascade/use-select.ts
5
5
  function useSelect(options) {
6
6
  const { props, emit, dataMap, isUserActive, dropdownRef, forest } = options;
@@ -20,9 +20,9 @@ declare const __VLS_base: _$vue.DefineComponent<__VLS_PublicProps, {}, {}, {}, {
20
20
  "onUpdate:modelValue"?: ((checked: boolean) => any) | undefined;
21
21
  onChange?: ((checked: boolean) => any) | undefined;
22
22
  }>, {
23
- type: _$_veltra_utils0.ColorType;
24
23
  disabled: boolean;
25
24
  readonly: boolean;
25
+ type: _$_veltra_utils0.ColorType;
26
26
  round: boolean;
27
27
  }, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
28
28
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,122 @@
1
+ import _sfc_main$1 from "../icon/icon.js";
2
+ import { CollapseDIKey } from "./di.js";
3
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
4
+ import { bem } from "@veltra/utils";
5
+ import { ArrowRight } from "@veltra/icons/normal";
6
+ //#region src/components/collapse/collapse-item.vue
7
+ const _hoisted_1 = [
8
+ "aria-expanded",
9
+ "aria-disabled",
10
+ "tabindex",
11
+ "onKeydown"
12
+ ];
13
+ const _hoisted_2 = ["aria-hidden"];
14
+ const _sfc_main = /* @__PURE__ */ defineComponent({
15
+ name: "CollapseItem",
16
+ __name: "collapse-item",
17
+ props: {
18
+ value: {},
19
+ title: {},
20
+ disabled: { type: Boolean },
21
+ hideIcon: { type: Boolean }
22
+ },
23
+ setup(__props) {
24
+ const props = __props;
25
+ const context = inject(CollapseDIKey);
26
+ const cls = context?.cls ?? bem("collapse");
27
+ const isActive = computed(() => !!context?.activeValues.value.includes(props.value));
28
+ const iconPosition = computed(() => context?.iconPosition.value ?? "right");
29
+ const iconComponent = computed(() => context?.expandIcon.value ?? ArrowRight);
30
+ const showLeftIcon = computed(() => !props.hideIcon && iconPosition.value === "left");
31
+ const showRightIcon = computed(() => !props.hideIcon && iconPosition.value === "right");
32
+ const classList = computed(() => [
33
+ cls.e("item"),
34
+ bem.is("active", isActive.value),
35
+ bem.is("disabled", props.disabled)
36
+ ]);
37
+ const headerClassList = computed(() => [
38
+ cls.e("header"),
39
+ bem.is("disabled", props.disabled),
40
+ bem.is("active", isActive.value)
41
+ ]);
42
+ const handleClick = () => {
43
+ if (props.disabled) return;
44
+ context?.toggle(props.value);
45
+ };
46
+ const wrapperEl = ref();
47
+ let cleanupTransition = null;
48
+ const cancelTransition = () => {
49
+ cleanupTransition?.();
50
+ cleanupTransition = null;
51
+ };
52
+ const animateHeight = (active) => {
53
+ const el = wrapperEl.value;
54
+ if (!el) return;
55
+ cancelTransition();
56
+ const startHeight = el.offsetHeight;
57
+ const endHeight = active ? el.scrollHeight : 0;
58
+ if (startHeight === endHeight) {
59
+ el.style.height = active ? "auto" : "0px";
60
+ return;
61
+ }
62
+ el.style.height = `${startHeight}px`;
63
+ el.offsetHeight;
64
+ el.style.height = `${endHeight}px`;
65
+ const onEnd = (e) => {
66
+ if (e.target !== el || e.propertyName !== "height") return;
67
+ cleanup();
68
+ if (active) el.style.height = "auto";
69
+ };
70
+ const cleanup = () => {
71
+ el.removeEventListener("transitionend", onEnd);
72
+ el.removeEventListener("transitioncancel", onEnd);
73
+ cleanupTransition = null;
74
+ };
75
+ el.addEventListener("transitionend", onEnd);
76
+ el.addEventListener("transitioncancel", onEnd);
77
+ cleanupTransition = cleanup;
78
+ };
79
+ onMounted(() => {
80
+ if (!wrapperEl.value) return;
81
+ wrapperEl.value.style.height = isActive.value ? "auto" : "0px";
82
+ });
83
+ watch(isActive, animateHeight);
84
+ onBeforeUnmount(cancelTransition);
85
+ return (_ctx, _cache) => {
86
+ return openBlock(), createElementBlock("div", { class: normalizeClass(classList.value) }, [createElementVNode("div", {
87
+ class: normalizeClass(headerClassList.value),
88
+ role: "button",
89
+ "aria-expanded": isActive.value,
90
+ "aria-disabled": __props.disabled,
91
+ tabindex: __props.disabled ? -1 : 0,
92
+ onClick: handleClick,
93
+ onKeydown: [withKeys(withModifiers(handleClick, ["prevent"]), ["enter"]), withKeys(withModifiers(handleClick, ["prevent"]), ["space"])]
94
+ }, [
95
+ showLeftIcon.value ? (openBlock(), createElementBlock("span", {
96
+ key: 0,
97
+ class: normalizeClass(unref(cls).e("icon"))
98
+ }, [renderSlot(_ctx.$slots, "icon", { isActive: isActive.value }, () => [createVNode(unref(_sfc_main$1), null, {
99
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
100
+ _: 1
101
+ })])], 2)) : createCommentVNode("v-if", true),
102
+ createElementVNode("span", { class: normalizeClass(unref(cls).e("title")) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2),
103
+ showRightIcon.value ? (openBlock(), createElementBlock("span", {
104
+ key: 1,
105
+ class: normalizeClass(unref(cls).e("icon"))
106
+ }, [renderSlot(_ctx.$slots, "icon", { isActive: isActive.value }, () => [createVNode(unref(_sfc_main$1), null, {
107
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
108
+ _: 1
109
+ })])], 2)) : createCommentVNode("v-if", true)
110
+ ], 42, _hoisted_1), createElementVNode("div", {
111
+ ref_key: "wrapperEl",
112
+ ref: wrapperEl,
113
+ class: normalizeClass(unref(cls).e("content-wrapper")),
114
+ "aria-hidden": !isActive.value
115
+ }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2)], 10, _hoisted_2)], 2);
116
+ };
117
+ }
118
+ });
119
+ //#endregion
120
+ export { _sfc_main as default };
121
+
122
+ //# sourceMappingURL=collapse-item.js.map
@@ -0,0 +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 v-if=\"showLeftIcon\" :class=\"cls.e('icon')\">\n <slot name=\"icon\" :is-active=\"isActive\">\n <UIcon><component :is=\"iconComponent\" /></UIcon>\n </slot>\n </span>\n\n <span :class=\"cls.e('title')\">\n <slot name=\"title\">{{ title }}</slot>\n </span>\n\n <span v-if=\"showRightIcon\" :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 iconPosition = computed(() => context?.iconPosition.value ?? 'right')\n\nconst iconComponent = computed(() => context?.expandIcon.value ?? ArrowRight)\n\nconst showLeftIcon = computed(() => !props.hideIcon && iconPosition.value === 'left')\nconst showRightIcon = computed(() => !props.hideIcon && iconPosition.value === 'right')\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>()\nlet cleanupTransition: (() => void) | null = null\n\nconst cancelTransition = () => {\n cleanupTransition?.()\n cleanupTransition = null\n}\n\n// 用 height 数值过渡替代 grid-template-rows,避免每帧 grid 重排带来的卡顿。\nconst animateHeight = (active: boolean) => {\n const el = wrapperEl.value\n if (!el) return\n\n cancelTransition()\n\n const startHeight = el.offsetHeight\n const endHeight = active ? el.scrollHeight : 0\n\n if (startHeight === endHeight) {\n el.style.height = active ? 'auto' : '0px'\n return\n }\n\n el.style.height = `${startHeight}px`\n // 强制 reflow,确保起始高度被采纳,避免 0 → auto 直接跳变。\n void el.offsetHeight\n el.style.height = `${endHeight}px`\n\n const onEnd = (e: TransitionEvent) => {\n if (e.target !== el || e.propertyName !== 'height') return\n cleanup()\n if (active) {\n // 回归 auto,让后续内容动态变化时不被锁死高度。\n el.style.height = 'auto'\n }\n }\n\n const cleanup = () => {\n el.removeEventListener('transitionend', onEnd)\n el.removeEventListener('transitioncancel', onEnd)\n cleanupTransition = null\n }\n\n el.addEventListener('transitionend', onEnd)\n el.addEventListener('transitioncancel', onEnd)\n cleanupTransition = cleanup\n}\n\nonMounted(() => {\n if (!wrapperEl.value) return\n wrapperEl.value.style.height = isActive.value ? 'auto' : '0px'\n})\n\nwatch(isActive, animateHeight)\n\nonBeforeUnmount(cancelTransition)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAiDA,MAAM,QAAQ;EAEd,MAAM,UAAU,OAAO,cAAa;EAEpC,MAAM,MAAM,SAAS,OAAO,IAAI,WAAU;EAE1C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,aAAa,MAAM,SAAS,MAAM,MAAM,CAAA;EAEnF,MAAM,eAAe,eAAe,SAAS,aAAa,SAAS,QAAO;EAE1E,MAAM,gBAAgB,eAAe,SAAS,WAAW,SAAS,WAAU;EAE5E,MAAM,eAAe,eAAe,CAAC,MAAM,YAAY,aAAa,UAAU,OAAM;EACpF,MAAM,gBAAgB,eAAe,CAAC,MAAM,YAAY,aAAa,UAAU,QAAO;EAEtF,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,MAAM,SAAU;AACpB,YAAS,OAAO,MAAM,MAAK;;EAG7B,MAAM,YAAY,KAAiB;EACnC,IAAI,oBAAyC;EAE7C,MAAM,yBAAyB;AAC7B,wBAAoB;AACpB,uBAAoB;;EAItB,MAAM,iBAAiB,WAAoB;GACzC,MAAM,KAAK,UAAU;AACrB,OAAI,CAAC,GAAI;AAET,qBAAiB;GAEjB,MAAM,cAAc,GAAG;GACvB,MAAM,YAAY,SAAS,GAAG,eAAe;AAE7C,OAAI,g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AAA,EAAA,CAAA;;;IAIxC,mBAEO,QAAA,EAFA,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,QAAA,CAAA,EAAA,EAAA,CACjB,WAAqC,KAAA,QAAA,SAAA,EAAA,QAAA,CAAA,gBAAA,gBAAf,QAAA,MAAK,EAAA,EAAA,CAAA,CAAA,CAAA,EAAA,EAAA;IAGjB,cAAA,SAAA,WAAA,EAAZ,mBAIO,QAAA;;KAJqB,OAAK,eAAE,MAAA,IAAG,CAAC,EAAC,OAAA,CAAA;QACtC,WAEO,KAAA,QAAA,QAAA,EAFY,UAAW,SAAA,OAAQ,QAE/B,CADL,YAAgD,MAAA,YAAA,EAAA,MAAA;4BAAR,EAAA,WAAA,EAAjC,YAAiC,wBAAjB,cAAA,MAAa,CAAA,EAAA,CAAA;;;uBAI1C,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"}
@@ -0,0 +1,29 @@
1
+ import { CollapseItemProps } from "../../types/collapse.js";
2
+ import * as _$vue from "vue";
3
+
4
+ //#region src/components/collapse/collapse-item.vue.d.ts
5
+ declare var __VLS_1: {
6
+ isActive: boolean;
7
+ }, __VLS_14: {}, __VLS_16: {
8
+ isActive: boolean;
9
+ }, __VLS_29: {};
10
+ type __VLS_Slots = {} & {
11
+ icon?: (props: typeof __VLS_1) => any;
12
+ } & {
13
+ title?: (props: typeof __VLS_14) => any;
14
+ } & {
15
+ icon?: (props: typeof __VLS_16) => any;
16
+ } & {
17
+ default?: (props: typeof __VLS_29) => any;
18
+ };
19
+ declare const __VLS_base: _$vue.DefineComponent<CollapseItemProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<CollapseItemProps> & Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
+ declare const _default: typeof __VLS_export;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
27
+ //#endregion
28
+ export { _default };
29
+ //# sourceMappingURL=collapse-item.vue.d.ts.map
@@ -0,0 +1,114 @@
1
+ import { CollapseDIKey } from "./di.js";
2
+ import { computed, createElementBlock, defineComponent, normalizeClass, openBlock, provide, renderSlot } from "vue";
3
+ import { bem } from "@veltra/utils";
4
+ import { useFormFallbackProps, useModel as useModel$1 } from "@veltra/compositions";
5
+ //#region src/components/collapse/collapse.vue
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ name: "Collapse",
8
+ __name: "collapse",
9
+ props: {
10
+ modelValue: {},
11
+ accordion: {
12
+ type: Boolean,
13
+ default: false
14
+ },
15
+ bordered: {
16
+ type: Boolean,
17
+ default: true
18
+ },
19
+ iconPosition: { default: "right" },
20
+ expandIcon: {},
21
+ size: {}
22
+ },
23
+ emits: ["update:modelValue", "change"],
24
+ setup(__props, { expose: __expose, emit: __emit }) {
25
+ const props = __props;
26
+ const emit = __emit;
27
+ const cls = bem("collapse");
28
+ const { size } = useFormFallbackProps([props], { size: "default" });
29
+ const iconPosition = computed(() => props.iconPosition ?? "right");
30
+ const expandIcon = computed(() => props.expandIcon);
31
+ const classList = computed(() => [
32
+ cls.b,
33
+ cls.m(size.value),
34
+ cls.m(`icon-${iconPosition.value}`),
35
+ bem.is("bordered", props.bordered)
36
+ ]);
37
+ const modelValue = useModel$1({
38
+ props,
39
+ emit,
40
+ propName: "modelValue"
41
+ });
42
+ const activeValues = computed(() => {
43
+ const v = modelValue.value;
44
+ if (v === void 0 || v === null) return [];
45
+ return Array.isArray(v) ? v : [v];
46
+ });
47
+ const update = (next) => {
48
+ modelValue.value = next;
49
+ emit("change", next);
50
+ };
51
+ const toggle = (value) => {
52
+ if (props.accordion) {
53
+ update(activeValues.value[0] === value ? [] : value);
54
+ return;
55
+ }
56
+ const values = activeValues.value.slice();
57
+ const index = values.indexOf(value);
58
+ if (index > -1) values.splice(index, 1);
59
+ else values.push(value);
60
+ update(values);
61
+ };
62
+ const expand = (value) => {
63
+ if (activeValues.value.includes(value)) return;
64
+ if (props.accordion) {
65
+ update(value);
66
+ return;
67
+ }
68
+ update([...activeValues.value, value]);
69
+ };
70
+ const collapse = (value) => {
71
+ if (!activeValues.value.includes(value)) return;
72
+ if (props.accordion) {
73
+ update([]);
74
+ return;
75
+ }
76
+ update(activeValues.value.filter((v) => v !== value));
77
+ };
78
+ const expandAll = (values) => {
79
+ if (props.accordion) {
80
+ update(values[0] ?? []);
81
+ return;
82
+ }
83
+ update([...values]);
84
+ };
85
+ const collapseAll = () => {
86
+ update([]);
87
+ };
88
+ provide(CollapseDIKey, {
89
+ cls,
90
+ size,
91
+ iconPosition,
92
+ expandIcon,
93
+ activeValues,
94
+ toggle
95
+ });
96
+ __expose({
97
+ toggle,
98
+ expand,
99
+ collapse,
100
+ expandAll,
101
+ collapseAll
102
+ });
103
+ return (_ctx, _cache) => {
104
+ return openBlock(), createElementBlock("div", {
105
+ class: normalizeClass(classList.value),
106
+ role: "region"
107
+ }, [renderSlot(_ctx.$slots, "default")], 2);
108
+ };
109
+ }
110
+ });
111
+ //#endregion
112
+ export { _sfc_main as default };
113
+
114
+ //# sourceMappingURL=collapse.js.map
@@ -0,0 +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 } from '@veltra/utils'\nimport { computed, provide } from 'vue'\n\nimport type {\n CollapseEmits,\n CollapseModelValue,\n CollapseProps,\n CollapseValue,\n _CollapseExposed\n} from '../../types'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({\n name: 'Collapse'\n})\n\nconst props = withDefaults(defineProps<CollapseProps>(), {\n accordion: false,\n bordered: true,\n iconPosition: 'right'\n})\nconst emit = defineEmits<CollapseEmits>()\n\nconst cls = bem('collapse')\n\nconst { size } = useFormFallbackProps([props], { size: 'default' })\n\nconst iconPosition = computed(() => props.iconPosition ?? 'right')\nconst expandIcon = computed(() => props.expandIcon)\n\nconst classList = computed(() => [\n cls.b,\n cls.m(size.value),\n cls.m(`icon-${iconPosition.value}`),\n bem.is('bordered', props.bordered)\n])\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\nconst expand = (value: CollapseValue) => {\n if (activeValues.value.includes(value)) return\n if (props.accordion) {\n update(value)\n return\n }\n update([...activeValues.value, value])\n}\n\nconst collapse = (value: CollapseValue) => {\n if (!activeValues.value.includes(value)) return\n if (props.accordion) {\n update([])\n return\n }\n update(activeValues.value.filter((v) => v !== value))\n}\n\nconst expandAll = (values: CollapseValue[]) => {\n if (props.accordion) {\n update(values[0] ?? [])\n return\n }\n update([...values])\n}\n\nconst collapseAll = () => {\n update([])\n}\n\nprovide(CollapseDIKey, {\n cls,\n size,\n iconPosition,\n expandIcon,\n activeValues,\n toggle\n})\n\ndefineExpose<_CollapseExposed>({\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