x-next 1.4.0 → 1.5.0

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 (34) hide show
  1. package/AI_USAGE.md +2 -2
  2. package/CHANGELOG.md +35 -0
  3. package/dist/components/dropdown/DropdownButton.vue.d.ts +2 -1
  4. package/dist/components/dropdown/index.d.ts +3 -0
  5. package/dist/components/steps/context.d.ts +9 -0
  6. package/dist/components/tabs/TabPane.vue.d.ts +2 -0
  7. package/dist/components/tabs/index.d.ts +6 -0
  8. package/dist/components/tabs/interface.d.ts +4 -0
  9. package/dist/es/components/dropdown/Dropdown.vue2.js +11 -4
  10. package/dist/es/components/dropdown/DropdownButton.vue.js +8 -7
  11. package/dist/es/components/dropdown/DropdownButton.vue2.js +19 -17
  12. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +18 -17
  13. package/dist/es/components/menu/MenuSubMenu.js +50 -36
  14. package/dist/es/components/menu/sub-menu-pop.vue2.js +30 -30
  15. package/dist/es/components/pagination/Pagination.js +73 -70
  16. package/dist/es/components/steps/Step.vue2.js +51 -47
  17. package/dist/es/components/steps/Steps.vue2.js +22 -19
  18. package/dist/es/components/tabs/TabPane.vue.js +11 -9
  19. package/dist/es/components/tabs/TabPane.vue2.js +28 -24
  20. package/dist/es/components/tabs/tabs-nav.js +20 -18
  21. package/dist/es/components/tabs/tabs-tab.vue.js +10 -8
  22. package/dist/es/locale/en-US.js +2 -1
  23. package/dist/es/locale/zh-CN.js +2 -1
  24. package/dist/es/style.css +1 -1
  25. package/dist/index.cjs +4 -4
  26. package/dist/index.umd.js +4 -4
  27. package/dist/locale/interface.d.ts +2 -0
  28. package/dist/style/dropdown.css +1 -1
  29. package/dist/style/menu.css +1 -1
  30. package/dist/style/pagination.css +1 -1
  31. package/dist/style/steps.css +1 -1
  32. package/dist/style/tabs.css +1 -1
  33. package/dist/style.css +1 -1
  34. package/package.json +3 -2
package/AI_USAGE.md CHANGED
@@ -1,9 +1,9 @@
1
1
  <!-- Generated by pnpm generate:ai-usage. Edit src/docs/guide/ai-usage-recipes.md and script/ai-usage/manifest.js. -->
2
2
  # x-next AI 使用手册
3
3
 
4
- 适用版本:**x-next@1.4.0**。Vue:`^3.5.0`;Node:`>=20.19.0`。
4
+ 适用版本:**x-next@1.5.0**。Vue:`^3.5.0`;Node:`>=20.19.0`。
5
5
 
6
- 来源指纹(精选示例、映射、版本与公开类型声明):`37f7ca897f3f8851dd34e16a59bbdeb40404262841c8c0bc9112fc62100f031a`。
6
+ 来源指纹(精选示例、映射、版本与公开类型声明):`8ed10e46d0e5b1359b27d93837370dcf2fca95d511be5e798e112ff5977d856f`。
7
7
 
8
8
  先按业务需要选择组件,不要求全部迁移。本手册限定在用户确认的 22 个组件及必要的同族子组件,未覆盖的导出不表示已完成业务验收。
9
9
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
2
2
 
3
3
  本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [1.5.0] - 2026-10-02
6
+
7
+ ### 修复
8
+
9
+ - **Steps**:
10
+ - 修复横向连接线特异性回归——显示规则特异性 (0,4,1) 压过 arrow / navigation / vertical / dot / line-less 各模式的 `display: none` (0,2,1),导致这些模式渲染出 5000px 的水平残线并溢出整页;改为给显示规则加模式守卫。
11
+ - 修复 SSR / 首帧所有步骤被判成 `finish`(DOM 测量未就绪时 `innerIndex` 为 -1、`stepNumber` 为 0),文档站静态产物此前是「全部打勾」;改用 setup 顺序号兜底。
12
+ - **Menu**:
13
+ - 修复水平溢出收纳时,其内部弹层 Menu 向根收集器上报空数据,导致 `autoOpen` / `defaultOpenKeys` / `autoOpenSelected` 在溢出场景整体失效。
14
+ - 修复点击溢出收纳头会把内部占位 key `__arco-menu-overflow-sub-menu` 泄漏到 `update:openKeys` / `sub-menu-click` 公开事件。
15
+ - **Tabs**:
16
+ - 补齐全垂直布局规则:标签间距、垂直专用水平内边距、内容区方向性留白、滚动轨道留白、新增按钮对齐。
17
+ - 修复 `justify` 与垂直布局同时命中导致导航与内容上下堆叠。
18
+ - 修复 `position="bottom"` 时激活下划线画在页面最底边、与分隔线错开一个标签高。
19
+ - tab 与 panel 补齐 `id` / `aria-controls` / `aria-labelledby` 双向关联,读屏可建立对应关系。
20
+ - `scrollPosition` 类型支持 `number`(原先只声明 `String`,传数字会触发 prop 校验告警)。
21
+ - **Pagination**:
22
+ - 修复 `mm()` 误传含 `&` 的选择器导致编译出非法 CSS,首 / 末页箭头禁用色失效、看起来仍可点击。
23
+ - 修复 `autoAdjust` 判断分支不可达(`computedCurrent` 已钳制,条件恒假),总页数减少时不再调整当前页也不派发事件。
24
+ - 修复省略号死规则,`--x-pagination-size-icon-ellipsis` 字号首次生效。
25
+ - **Dropdown**:
26
+ - 修复仅在 `optionProps` 中禁用子菜单时,hover 触发仍会弹出被禁用的子菜单。
27
+ - 根触发器补齐 `aria-haspopup` / `aria-expanded` 菜单语义。
28
+ - `DropdownButton` 的图标触发器补齐可访问名称(原为无名按钮)。
29
+ - 修复 3 处 Less → SCSS 迁移残留的非法 CSS 值(`-var(...)` 与缺少 `calc` 的减法),这些声明此前被浏览器静默丢弃:Dropdown 子菜单浮层偏移、Menu 横向 pop 的 hover 桥接区、Menu popup 首分组间距校正。
30
+
31
+ ### 新增
32
+
33
+ - 新增 `common.more` locale 文案(中文「更多操作」/ 英文「More actions」),供图标触发器提供可访问名称。
34
+ - 新增 `pnpm run check:compiled-css`:检查编译产物的非法 CSS 值、BEM 拼接损坏的选择器,以及显式登记的层叠守卫,覆盖「SCSS 能编译、单测通过、浏览器静默丢弃规则」这一类此前无门禁的缺陷;已接入 `check` 总入口。
35
+
36
+ ### 测试
37
+
38
+ - 新增 5 项回归测试:Menu 溢出收纳不泄漏内部 key、Pagination `autoAdjust` 越界派发与未越界不派发、Tabs tab/panel id 双向关联与唯一性、Steps SSR 首帧状态推算。
39
+
5
40
  ## [1.4.0] - 2026-10-02
6
41
 
7
42
  ### 新增
@@ -92,6 +92,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
92
92
  modifier: (className: string) => string;
93
93
  is: (className: string) => string;
94
94
  };
95
+ t: (key: import('../../locale').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
95
96
  computedPopupVisible: import('vue').ComputedRef<boolean>;
96
97
  handleClick: (ev: MouseEvent) => void;
97
98
  handleSelect: (value: string | number | Record<string, unknown> | undefined, ev: Event) => void;
@@ -1356,7 +1357,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
1356
1357
  panelElement: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
1357
1358
  handleKeydown: (ev: KeyboardEvent) => void;
1358
1359
  handleScroll: (e: Event) => void;
1359
- t: (key: import('../../index.ts').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
1360
+ t: (key: import('../../locale').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
1360
1361
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("close" | "scroll" | "reachBottom")[], "close" | "scroll" | "reachBottom", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
1361
1362
  closeOnArrowLeft: BooleanConstructor;
1362
1363
  loading: {
@@ -5713,6 +5713,7 @@ export declare const DropdownButton: {
5713
5713
  modifier: (className: string) => string;
5714
5714
  is: (className: string) => string;
5715
5715
  };
5716
+ t: (key: import('../..').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
5716
5717
  computedPopupVisible: import('vue').ComputedRef<boolean>;
5717
5718
  handleClick: (ev: MouseEvent) => void;
5718
5719
  handleSelect: (value: string | number | Record<string, unknown> | undefined, ev: Event) => void;
@@ -7430,6 +7431,7 @@ export declare const DropdownButton: {
7430
7431
  modifier: (className: string) => string;
7431
7432
  is: (className: string) => string;
7432
7433
  };
7434
+ t: (key: import('../..').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
7433
7435
  computedPopupVisible: import('vue').ComputedRef<boolean>;
7434
7436
  handleClick: (ev: MouseEvent) => void;
7435
7437
  handleSelect: (value: string | number | Record<string, unknown> | undefined, ev: Event) => void;
@@ -7498,6 +7500,7 @@ export declare const DropdownButton: {
7498
7500
  modifier: (className: string) => string;
7499
7501
  is: (className: string) => string;
7500
7502
  };
7503
+ t: (key: import('../..').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
7501
7504
  computedPopupVisible: import('vue').ComputedRef<boolean>;
7502
7505
  handleClick: (ev: MouseEvent) => void;
7503
7506
  handleSelect: (value: string | number | Record<string, unknown> | undefined, ev: Event) => void;
@@ -14,5 +14,14 @@ export interface StepsContext {
14
14
  getStatus: (step: number) => StepStatus;
15
15
  onClick: (step: number, ev: Event) => void;
16
16
  parentCls: string;
17
+ /**
18
+ * 按 setup 顺序取序号(1 起)。
19
+ *
20
+ * DOM 测量(useIndex)在 SSR / 首帧不可用,此时 innerIndex 为 -1,
21
+ * stepNumber 变成 0,getStatus(0) 会把所有步骤判成 finish——文档站是
22
+ * SSR,会直接产出「全部打勾」的静态 HTML。setup 顺序即渲染顺序,
23
+ * 用它兜底可让首帧状态正确;挂载后仍以 DOM 实测值为准。
24
+ */
25
+ registerOrder: () => number;
17
26
  }
18
27
  export declare const stepsInjectionKey: InjectionKey<StepsContext>;
@@ -39,6 +39,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
39
39
  active: import('vue').ComputedRef<boolean>;
40
40
  itemRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
41
41
  mounted: import('vue').Ref<boolean, boolean>;
42
+ tabId: import('vue').ComputedRef<string>;
43
+ panelId: import('vue').ComputedRef<string>;
42
44
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
43
45
  /**
44
46
  * @zh 选项卡的标题
@@ -323,6 +323,8 @@ export declare const TabPane: {
323
323
  active: import('vue').ComputedRef<boolean>;
324
324
  itemRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
325
325
  mounted: import('vue').Ref<boolean, boolean>;
326
+ tabId: import('vue').ComputedRef<string>;
327
+ panelId: import('vue').ComputedRef<string>;
326
328
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
327
329
  disabled: boolean;
328
330
  closable: boolean;
@@ -358,6 +360,8 @@ export declare const TabPane: {
358
360
  active: import('vue').ComputedRef<boolean>;
359
361
  itemRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
360
362
  mounted: import('vue').Ref<boolean, boolean>;
363
+ tabId: import('vue').ComputedRef<string>;
364
+ panelId: import('vue').ComputedRef<string>;
361
365
  }, {}, {}, {}, {
362
366
  disabled: boolean;
363
367
  closable: boolean;
@@ -390,6 +394,8 @@ export declare const TabPane: {
390
394
  active: import('vue').ComputedRef<boolean>;
391
395
  itemRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
392
396
  mounted: import('vue').Ref<boolean, boolean>;
397
+ tabId: import('vue').ComputedRef<string>;
398
+ panelId: import('vue').ComputedRef<string>;
393
399
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
394
400
  disabled: boolean;
395
401
  closable: boolean;
@@ -7,6 +7,10 @@ export interface TabData {
7
7
  disabled?: boolean;
8
8
  closable?: boolean;
9
9
  slots: Slots;
10
+ /** tab 自身 id,供 panel 的 aria-labelledby 引用(TabPane 按实例 uid 生成) */
11
+ tabId?: string;
12
+ /** 对应 panel 的 id,供 tab 的 aria-controls 引用 */
13
+ panelId?: string;
10
14
  }
11
15
  export type TabTriggerEvent = 'click' | 'hover';
12
16
  export type ScrollPosition = 'start' | 'end' | 'center' | 'auto' | number;
@@ -6,8 +6,8 @@ import { dropdownInjectionKey as O } from "./context.js";
6
6
  import { getClassNameMixin as P } from "../../_utils/config.js";
7
7
  import T from "../../_container/render-function.js";
8
8
  import { useFirstElement as k } from "../../_hooks/use-first-element.js";
9
- import { mergeFirstChild as K } from "../../_utils/vue-eco.js";
10
- import { useDropdownKeyboard as x } from "./use-keyboard.js";
9
+ import { mergeFirstChild as x } from "../../_utils/vue-eco.js";
10
+ import { useDropdownKeyboard as K } from "./use-keyboard.js";
11
11
  const q = v({
12
12
  name: "Dropdown",
13
13
  components: {
@@ -153,14 +153,21 @@ const q = v({
153
153
  defaultPopupVisible: d,
154
154
  popupVisible: s,
155
155
  emit: t
156
- }), { children: l, firstElement: m } = k(), r = x(
156
+ }), { children: l, firstElement: m } = k(), r = K(
157
157
  a,
158
158
  p,
159
159
  m
160
160
  ), g = (o) => {
161
161
  var i;
162
- return l.value = ((i = n.default) == null ? void 0 : i.call(n)) ?? [], K(l.value, {
162
+ return l.value = ((i = n.default) == null ? void 0 : i.call(n)) ?? [], x(l.value, {
163
163
  ...o,
164
+ /*
165
+ * 根触发器补菜单语义。子菜单的触发器已在 DropdownSubmenu 上声明
166
+ * aria-haspopup/aria-expanded,根触发器此前没有,读屏无法得知
167
+ * 这是一个会展开菜单的按钮,也不知道展开状态。
168
+ */
169
+ "aria-haspopup": "menu",
170
+ "aria-expanded": a.value ? "true" : "false",
164
171
  onKeydown: (u) => {
165
172
  u.key !== "ArrowRight" && r.handleTriggerKeydown(u);
166
173
  },
@@ -1,13 +1,13 @@
1
1
  import d from "./DropdownButton.vue2.js";
2
- import { resolveComponent as n, openBlock as u, createBlock as c, normalizeClass as i, withCtx as o, createVNode as p, mergeProps as m, renderSlot as s } from "vue";
2
+ import { resolveComponent as n, openBlock as u, createBlock as c, normalizeClass as t, withCtx as o, createVNode as p, mergeProps as m, renderSlot as s } from "vue";
3
3
  import b from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  function f(e, g, h, C, z, B) {
5
- const t = n("Button"), l = n("IconMore"), r = n("Dropdown"), a = n("ButtonGroup");
5
+ const i = n("Button"), l = n("IconMore"), r = n("Dropdown"), a = n("ButtonGroup");
6
6
  return u(), c(a, {
7
- class: i(e.className.element("button"))
7
+ class: t(e.className.element("button"))
8
8
  }, {
9
9
  default: o(() => [
10
- p(t, m({
10
+ p(i, m({
11
11
  size: e.size,
12
12
  type: e.type,
13
13
  disabled: e.disabled
@@ -30,11 +30,12 @@ function f(e, g, h, C, z, B) {
30
30
  s(e.$slots, "content")
31
31
  ]),
32
32
  default: o(() => [
33
- p(t, {
34
- class: i(e.className.element("button--trigger")),
33
+ p(i, {
34
+ class: t(e.className.element("button--trigger")),
35
35
  size: e.size,
36
36
  type: e.type,
37
37
  disabled: e.disabled,
38
+ "aria-label": e.t("common.more"),
38
39
  narrow: ""
39
40
  }, {
40
41
  prefix: o(() => [
@@ -43,7 +44,7 @@ function f(e, g, h, C, z, B) {
43
44
  ])
44
45
  ]),
45
46
  _: 3
46
- }, 8, ["class", "size", "type", "disabled"])
47
+ }, 8, ["class", "size", "type", "disabled", "aria-label"])
47
48
  ]),
48
49
  _: 3
49
50
  }, 8, ["popup-visible", "trigger", "position", "popup-container", "hide-on-select", "onSelect", "onPopupVisibleChange"])
@@ -1,16 +1,17 @@
1
- import { defineComponent as a, toRefs as s } from "vue";
2
- import d from "../../icons/_self/more-dot.js";
3
- import { ButtonGroup as c, Button as f } from "../button/index.js";
4
- import m from "./Dropdown.vue.js";
5
- import { useTrigger as b } from "../../_hooks/use-trigger.js";
6
- import { getClassNameMixin as g } from "../../_utils/config.js";
7
- const P = a({
1
+ import { defineComponent as s, toRefs as d } from "vue";
2
+ import c from "../../icons/_self/more-dot.js";
3
+ import { ButtonGroup as f, Button as m } from "../button/index.js";
4
+ import b from "./Dropdown.vue.js";
5
+ import { useTrigger as g } from "../../_hooks/use-trigger.js";
6
+ import { useLocale as y } from "../../locale/index.js";
7
+ import { getClassNameMixin as h } from "../../_utils/config.js";
8
+ const M = s({
8
9
  name: "DropdownButton",
9
10
  components: {
10
- IconMore: d,
11
- Button: f,
12
- ButtonGroup: c,
13
- Dropdown: m
11
+ IconMore: c,
12
+ Button: m,
13
+ ButtonGroup: f,
14
+ Dropdown: b
14
15
  },
15
16
  props: {
16
17
  /**
@@ -129,24 +130,25 @@ const P = a({
129
130
  * @binding {boolean} popupVisible
130
131
  */
131
132
  setup(e, { emit: t }) {
132
- const { defaultPopupVisible: p, popupVisible: i } = s(e), l = g("dropdown"), { computedPopupVisible: n, handlePopupVisibleChange: r } = b({
133
+ const { defaultPopupVisible: p, popupVisible: i } = d(e), l = h("dropdown"), { t: n } = y(), { computedPopupVisible: r, handlePopupVisibleChange: u } = g({
133
134
  defaultPopupVisible: p,
134
135
  popupVisible: i,
135
136
  emit: t
136
137
  });
137
138
  return {
138
139
  className: l,
139
- computedPopupVisible: n,
140
+ t: n,
141
+ computedPopupVisible: r,
140
142
  handleClick: (o) => {
141
143
  t("click", o);
142
144
  },
143
- handleSelect: (o, u) => {
144
- t("select", o, u);
145
+ handleSelect: (o, a) => {
146
+ t("select", o, a);
145
147
  },
146
- handlePopupVisibleChange: r
148
+ handlePopupVisibleChange: u
147
149
  };
148
150
  }
149
151
  });
150
152
  export {
151
- P as default
153
+ M as default
152
154
  };
@@ -1,24 +1,25 @@
1
- import u from "./DropdownSubmenu.vue2.js";
2
- import { resolveComponent as s, openBlock as f, createBlock as c, withCtx as e, createVNode as p, mergeProps as g, createSlots as r, renderSlot as n, normalizeClass as m } from "vue";
3
- import b from "../../_virtual/_plugin-vue_export-helper.js";
4
- function h(o, C, w, $, P, v) {
5
- const a = s("IconRight"), t = s("dropdown-option"), l = s("dropdown-panel"), d = s("Trigger");
6
- return f(), c(d, {
1
+ import f from "./DropdownSubmenu.vue2.js";
2
+ import { resolveComponent as s, openBlock as c, createBlock as g, withCtx as e, createVNode as p, mergeProps as m, createSlots as a, renderSlot as n, normalizeClass as b } from "vue";
3
+ import h from "../../_virtual/_plugin-vue_export-helper.js";
4
+ function C(o, w, $, P, v, V) {
5
+ var i;
6
+ const t = s("IconRight"), l = s("dropdown-option"), d = s("dropdown-panel"), u = s("Trigger");
7
+ return c(), g(u, {
7
8
  "popup-visible": o.computedPopupVisible,
8
9
  trigger: o.trigger,
9
10
  position: o.position,
10
- disabled: o.disabled,
11
+ disabled: o.disabled || !!((i = o.optionProps) != null && i.disabled),
11
12
  "popup-offset": 4,
12
13
  onPopupVisibleChange: o.handlePopupVisibleChange,
13
14
  onShow: o.handleShow
14
15
  }, {
15
16
  content: e(() => [
16
- p(l, {
17
+ p(d, {
17
18
  ref: "panelRef",
18
- class: m(o.className.block),
19
+ class: b(o.className.block),
19
20
  "close-on-arrow-left": "",
20
21
  onClose: o.handleClose
21
- }, r({
22
+ }, a({
22
23
  default: e(() => [
23
24
  n(o.$slots, "content")
24
25
  ]),
@@ -34,10 +35,10 @@ function h(o, C, w, $, P, v) {
34
35
  ]), 1032, ["class", "onClose"])
35
36
  ]),
36
37
  default: e(() => {
37
- var i;
38
+ var r;
38
39
  return [
39
- p(t, g({ ref: "optionRef" }, o.optionProps, {
40
- disabled: o.disabled || ((i = o.optionProps) == null ? void 0 : i.disabled),
40
+ p(l, m({ ref: "optionRef" }, o.optionProps, {
41
+ disabled: o.disabled || ((r = o.optionProps) == null ? void 0 : r.disabled),
41
42
  active: o.computedPopupVisible,
42
43
  "uninject-context": "",
43
44
  "aria-haspopup": "menu",
@@ -45,10 +46,10 @@ function h(o, C, w, $, P, v) {
45
46
  onKeydownCapture: o.handleTriggerKeydown,
46
47
  onFocusinCapture: o.handleTriggerFocus,
47
48
  onFocusoutCapture: o.handleTriggerFocus
48
- }), r({
49
+ }), a({
49
50
  suffix: e(() => [
50
51
  n(o.$slots, "suffix", {}, () => [
51
- p(a)
52
+ p(t)
52
53
  ])
53
54
  ]),
54
55
  default: e(() => [
@@ -69,7 +70,7 @@ function h(o, C, w, $, P, v) {
69
70
  _: 3
70
71
  }, 8, ["popup-visible", "trigger", "position", "disabled", "onPopupVisibleChange", "onShow"]);
71
72
  }
72
- const k = /* @__PURE__ */ b(u, [["render", h]]);
73
+ const y = /* @__PURE__ */ h(f, [["render", C]]);
73
74
  export {
74
- k as default
75
+ y as default
75
76
  };
@@ -1,13 +1,14 @@
1
- import { defineComponent as x, createVNode as r, mergeProps as y, toRefs as M, computed as a, toRef as h } from "vue";
1
+ import { defineComponent as h, createVNode as s, mergeProps as y, toRefs as x, computed as a, provide as C, toRef as b } from "vue";
2
2
  import g from "./sub-menu-inline.vue.js";
3
- import C from "./sub-menu-pop.vue.js";
4
- import k from "./hooks/use-menu.js";
5
- import I from "./hooks/use-level.js";
6
- import v from "../../icons/_self/menu/down.js";
7
- import K from "../../icons/_self/dropdown/more.js";
8
- import P from "./hooks/use-menu-context.js";
9
- import _ from "./hooks/use-menu-data-collector.js";
10
- const w = {
3
+ import I from "./sub-menu-pop.vue.js";
4
+ import v from "./hooks/use-menu.js";
5
+ import k from "./hooks/use-level.js";
6
+ import K from "../../icons/_self/menu/down.js";
7
+ import _ from "../../icons/_self/dropdown/more.js";
8
+ import D from "./hooks/use-menu-context.js";
9
+ import P from "./hooks/use-menu-data-collector.js";
10
+ import { DataCollectorInjectionKey as w } from "./context.js";
11
+ const R = {
11
12
  /**
12
13
  * @zh 子菜单的标题
13
14
  * @en The title of the submenu
@@ -51,9 +52,9 @@ const w = {
51
52
  _internalSkipCollect: {
52
53
  type: Boolean
53
54
  }
54
- }, O = /* @__PURE__ */ x({
55
+ }, q = /* @__PURE__ */ h({
55
56
  name: "SubMenu",
56
- props: w,
57
+ props: R,
57
58
  slots: Object,
58
59
  /**
59
60
  * @zh 菜单的图标
@@ -81,47 +82,60 @@ const w = {
81
82
  }) {
82
83
  const {
83
84
  key: n
84
- } = k(), {
85
+ } = v(), {
85
86
  level: d
86
- } = I(), {
87
+ } = k(), {
87
88
  popup: o
88
- } = M(e), t = P(), s = a(() => {
89
+ } = x(e), t = D(), i = a(() => {
89
90
  const {
90
- mode: i,
91
- collapsed: p,
91
+ mode: p,
92
+ collapsed: c,
92
93
  inTrigger: m
93
94
  } = t;
94
- return !!(typeof o.value == "function" ? o.value(d.value) : o.value) || p || m || i !== "vertical";
95
+ return !!(typeof o.value == "function" ? o.value(d.value) : o.value) || c || m || p !== "vertical";
95
96
  }), {
96
97
  subMenuKeys: l,
97
98
  menuItemKeys: f
98
99
  } = e._internalSkipCollect ? {
99
100
  subMenuKeys: a(() => []),
100
101
  menuItemKeys: a(() => [])
101
- } : _({
102
+ } : P({
102
103
  key: n.value,
103
104
  type: "subMenu"
104
- }), b = a(() => {
105
- const i = t.selectedKeys || [], p = (m) => {
106
- for (let c = 0; c < i.length; c++) {
107
- const S = i[c];
105
+ });
106
+ e._internalSkipCollect && C(w, {
107
+ collectSubMenu: () => {
108
+ },
109
+ removeSubMenu: () => {
110
+ },
111
+ collectMenuItem: () => {
112
+ },
113
+ removeMenuItem: () => {
114
+ },
115
+ reportMenuData: () => {
116
+ }
117
+ });
118
+ const M = a(() => {
119
+ const p = t.selectedKeys || [], c = (m) => {
120
+ for (let r = 0; r < p.length; r++) {
121
+ const S = p[r];
108
122
  if (m.includes(S))
109
123
  return !0;
110
124
  }
111
125
  return !1;
112
126
  };
113
- return p(l.value) || p(f.value);
127
+ return c(l.value) || c(f.value);
114
128
  });
115
129
  return {
116
130
  subMenuKeys: l,
117
131
  menuItemKeys: f,
118
- isChildrenSelected: b,
132
+ isChildrenSelected: M,
119
133
  props: e,
120
134
  attrs: u,
121
135
  computedKey: n,
122
- computedPopup: s,
123
- expandIconDown: h(t, "expandIconDown"),
124
- expandIconRight: h(t, "expandIconRight")
136
+ computedPopup: i,
137
+ expandIconDown: b(t, "expandIconDown"),
138
+ expandIconRight: b(t, "expandIconRight")
125
139
  };
126
140
  },
127
141
  render() {
@@ -132,30 +146,30 @@ const w = {
132
146
  computedPopup: d,
133
147
  expandIconDown: o,
134
148
  expandIconRight: t,
135
- isChildrenSelected: s
149
+ isChildrenSelected: i
136
150
  } = this, l = {
137
151
  ...this.$slots,
138
- "expand-icon-down": this.$slots["expand-icon-down"] || o || (() => [r(v, null, null)]),
139
- "expand-icon-right": this.$slots["expand-icon-right"] || t || (() => [r(K, null, null)])
152
+ "expand-icon-down": this.$slots["expand-icon-down"] || o || (() => [s(K, null, null)]),
153
+ "expand-icon-right": this.$slots["expand-icon-right"] || t || (() => [s(_, null, null)])
140
154
  };
141
- return d ? r(C, y({
155
+ return d ? s(I, y({
142
156
  key: n,
143
157
  title: e.title,
144
158
  selectable: e.selectable,
145
159
  disabled: e.disabled,
146
- isChildrenSelected: s,
160
+ isChildrenSelected: i,
147
161
  popupMaxHeight: e.popupMaxHeight,
148
162
  _internalSkipCollect: e._internalSkipCollect
149
- }, u), l) : r(g, y({
163
+ }, u), l) : s(g, y({
150
164
  key: n,
151
165
  title: e.title,
152
166
  disabled: e.disabled,
153
- isChildrenSelected: s,
167
+ isChildrenSelected: i,
154
168
  _internalSkipCollect: e._internalSkipCollect
155
169
  }, u), l);
156
170
  }
157
171
  });
158
172
  export {
159
- O as default,
160
- w as menuSubMenuProps
173
+ q as default,
174
+ R as menuSubMenuProps
161
175
  };
@@ -2,10 +2,10 @@ import { defineComponent as S, toRefs as B, computed as o, ref as P } from "vue"
2
2
  import { Trigger as $ } from "../trigger/index.js";
3
3
  import H from "./base-menu.vue.js";
4
4
  import N from "./hooks/use-menu.js";
5
- import I from "./hooks/use-level.js";
6
- import { omit as K } from "../../_utils/omit.js";
7
- import V from "./indent.vue.js";
8
- import _ from "./hooks/use-menu-context.js";
5
+ import _ from "./hooks/use-level.js";
6
+ import { omit as I } from "../../_utils/omit.js";
7
+ import K from "./indent.vue.js";
8
+ import V from "./hooks/use-menu-context.js";
9
9
  import R from "../../_container/render-function.js";
10
10
  import { isNumber as T } from "../../_utils/is.js";
11
11
  import { getClassNameMixin as w } from "../../_utils/config.js";
@@ -14,7 +14,7 @@ const Q = S({
14
14
  components: {
15
15
  Menu: H,
16
16
  Trigger: $,
17
- MenuIndent: V,
17
+ MenuIndent: K,
18
18
  RenderFunction: R
19
19
  },
20
20
  inheritAttrs: !1,
@@ -39,57 +39,57 @@ const Q = S({
39
39
  type: Boolean
40
40
  }
41
41
  },
42
- setup(g) {
43
- const { key: l } = N(), { level: i } = I(), { selectable: a, disabled: u, isChildrenSelected: C, popupMaxHeight: x } = B(g), t = _(), { onSubMenuClick: r, onMenuItemClick: n } = t, p = o(() => t.prefixCls), m = o(() => t.mode), c = o(() => t.selectedKeys || []), s = o(() => `${p.value}-pop`), f = o(
44
- () => a.value && c.value.includes(l.value) || C.value
42
+ setup(s) {
43
+ const { key: l } = N(), { level: a } = _(), { selectable: u, disabled: p, isChildrenSelected: C, popupMaxHeight: x } = B(s), t = V(), { onSubMenuClick: r, onMenuItemClick: n } = t, m = o(() => t.prefixCls), c = o(() => t.mode), f = o(() => t.selectedKeys || []), i = o(() => `${m.value}-pop`), v = o(
44
+ () => u.value && f.value.includes(l.value) || C.value
45
45
  ), M = o(() => [
46
- `${s.value}`,
47
- `${s.value}-header`,
46
+ `${i.value}`,
47
+ `${i.value}-header`,
48
48
  {
49
- [`${p.value}-selected`]: f.value
49
+ [`${m.value}-selected`]: v.value
50
50
  }
51
- ]), h = o(() => m.value === "horizontal" && !t.inTrigger), v = P(!1), d = (e) => {
52
- v.value = e;
53
- }, y = w("trigger"), b = o(() => {
51
+ ]), h = o(() => c.value === "horizontal" && !t.inTrigger), d = P(!1), g = (e) => {
52
+ d.value = e;
53
+ }, y = w("trigger"), k = o(() => {
54
54
  var e;
55
55
  return [
56
- `${s.value}-trigger`,
56
+ `${i.value}-trigger`,
57
57
  {
58
- [`${s.value}-trigger-dark`]: t.theme === "dark"
58
+ [`${i.value}-trigger-dark`]: t.theme === "dark"
59
59
  },
60
60
  // @ts-ignore
61
61
  (e = t.triggerProps) == null ? void 0 : e.class
62
62
  ];
63
- }), k = o(() => K(t.triggerProps || {}, ["class"]));
63
+ }), b = o(() => I(t.triggerProps || {}, ["class"]));
64
64
  return {
65
- menuPrefixCls: p,
66
- mode: m,
67
- level: i,
65
+ menuPrefixCls: m,
66
+ mode: c,
67
+ level: a,
68
68
  classNames: M,
69
- isSelected: f,
70
- disabled: u,
71
- selectedKeys: c,
69
+ isSelected: v,
70
+ disabled: p,
71
+ selectedKeys: f,
72
72
  needPopOnBottom: h,
73
- popVisible: v,
73
+ popVisible: d,
74
74
  className: y,
75
- triggerClassNames: b,
76
- triggerProps: k,
75
+ triggerClassNames: k,
76
+ triggerProps: b,
77
77
  menuContext: t,
78
78
  popupMenuStyles: o(() => {
79
79
  const e = x.value ?? t.popupMaxHeight;
80
80
  return T(e) ? { maxHeight: `${e}px` } : e ? {} : { maxHeight: "unset" };
81
81
  }),
82
82
  onClick: () => {
83
- u.value || (r && r(l.value, i.value), a.value && n && n(l.value));
83
+ p.value || s._internalSkipCollect || (r && r(l.value, a.value), u.value && n && n(l.value));
84
84
  },
85
85
  onKeydown: (e) => {
86
- u.value || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r && r(l.value, i.value), a.value && n && n(l.value));
86
+ p.value || s._internalSkipCollect || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r && r(l.value, a.value), u.value && n && n(l.value));
87
87
  },
88
88
  onMenuItemClick: (e) => {
89
- n && n(e), d(!1);
89
+ n && n(e), g(!1);
90
90
  },
91
91
  onVisibleChange: (e) => {
92
- d(e);
92
+ g(e);
93
93
  }
94
94
  };
95
95
  }