@antdv-next/x 1.2.1 → 1.2.2

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.
package/dist/index.umd.js CHANGED
@@ -66,7 +66,7 @@
66
66
  shiki_dist_themes_vitesse_dark_mjs = __toESM(shiki_dist_themes_vitesse_dark_mjs, 1);
67
67
  shiki_dist_themes_vitesse_light_mjs = __toESM(shiki_dist_themes_vitesse_light_mjs, 1);
68
68
  //#region package.json
69
- var version = "1.2.1";
69
+ var version = "1.2.2";
70
70
  //#endregion
71
71
  //#region components/x-provider/context.ts
72
72
  var XProviderContextKey = Symbol("antdv-next-x-provider-context");
@@ -10737,6 +10737,13 @@
10737
10737
  //#endregion
10738
10738
  //#region components/suggestion/useActive.ts
10739
10739
  /**
10740
+ * An Enter pressed with a modifier or while an IME is composing belongs to the trigger
10741
+ * (submit, newline, candidate confirmation), never to the suggestion list.
10742
+ */
10743
+ function isPlainEnter(event) {
10744
+ return !event.isComposing && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey;
10745
+ }
10746
+ /**
10740
10747
  * Cascader does not expose active item control, so we use `value` to mirror focus path.
10741
10748
  */
10742
10749
  function useActive(items, open, rtl, onCancel) {
@@ -10767,6 +10774,26 @@
10767
10774
  const firstItem = getItems(activePaths.value.length + 1)[0];
10768
10775
  if (firstItem) activePaths.value = [...activePaths.value, firstItem.value];
10769
10776
  };
10777
+ const getActiveItem = () => {
10778
+ let currentItems = items.value;
10779
+ let activeItem;
10780
+ for (const activePath of activePaths.value) {
10781
+ activeItem = currentItems.find((item) => item.value === activePath);
10782
+ if (!activeItem) return void 0;
10783
+ currentItems = activeItem.children || [];
10784
+ }
10785
+ return activeItem;
10786
+ };
10787
+ /**
10788
+ * Whether this Enter belongs to the popup: it needs an open popup, a plain Enter and a
10789
+ * leaf item to select. Anything else stays with the trigger, so the input can still
10790
+ * submit, insert a newline or confirm an IME candidate.
10791
+ */
10792
+ const shouldSelectOnEnter = (event) => {
10793
+ if (!open.value || !isPlainEnter(event)) return false;
10794
+ const activeItem = getActiveItem();
10795
+ return !!activeItem && !activeItem.children?.length;
10796
+ };
10770
10797
  const onKeyDown = (event) => {
10771
10798
  if (!open.value) return;
10772
10799
  switch (event.key) {
@@ -10792,12 +10819,21 @@
10792
10819
  event.preventDefault();
10793
10820
  event.stopPropagation();
10794
10821
  break;
10795
- case "Enter":
10822
+ case "Enter": {
10823
+ if (!isPlainEnter(event)) break;
10824
+ const activeItem = getActiveItem();
10825
+ if (!activeItem) break;
10796
10826
  event.preventDefault();
10827
+ if (activeItem.children?.length) {
10828
+ offsetNext();
10829
+ event.stopPropagation();
10830
+ }
10797
10831
  return false;
10832
+ }
10798
10833
  case "Escape":
10799
10834
  onCancel();
10800
10835
  event.preventDefault();
10836
+ event.stopPropagation();
10801
10837
  break;
10802
10838
  default: break;
10803
10839
  }
@@ -10805,7 +10841,11 @@
10805
10841
  (0, vue.watch)([open, items], ([nextOpen, nextItems]) => {
10806
10842
  if (nextOpen && Array.isArray(nextItems) && nextItems.length > 0) activePaths.value = [nextItems[0].value];
10807
10843
  }, { immediate: true });
10808
- return [activePaths, onKeyDown];
10844
+ return [
10845
+ activePaths,
10846
+ onKeyDown,
10847
+ shouldSelectOnEnter
10848
+ ];
10809
10849
  }
10810
10850
  //#endregion
10811
10851
  //#region components/suggestion/index.tsx
@@ -10888,10 +10928,18 @@
10888
10928
  const innerOpen = (0, vue.ref)(false);
10889
10929
  const mergedOpen = (0, vue.computed)(() => props.open ?? innerOpen.value);
10890
10930
  const itemList = (0, vue.ref)([]);
10931
+ /**
10932
+ * What the last `onTrigger` asked for. A function `items` is usually an inline arrow,
10933
+ * so it gets a new identity on every parent render — without this the watcher below
10934
+ * would re-evaluate it with no info and drop the triggered list.
10935
+ */
10936
+ const triggerInfo = (0, vue.ref)();
10937
+ const resolveItems = (source, info) => {
10938
+ if (typeof source === "function") return source(info);
10939
+ return Array.isArray(source) ? source : [];
10940
+ };
10891
10941
  (0, vue.watch)(() => props.items, (nextItems) => {
10892
- if (Array.isArray(nextItems)) itemList.value = nextItems;
10893
- else if (typeof nextItems === "function") itemList.value = nextItems();
10894
- else itemList.value = [];
10942
+ itemList.value = resolveItems(nextItems, triggerInfo.value);
10895
10943
  }, { immediate: true });
10896
10944
  const triggerOpen = (nextOpen) => {
10897
10945
  if (props.open === void 0) innerOpen.value = nextOpen;
@@ -10906,7 +10954,8 @@
10906
10954
  triggerOpen(false);
10907
10955
  return;
10908
10956
  }
10909
- if (typeof props.items === "function") itemList.value = props.items(nextInfo);
10957
+ triggerInfo.value = nextInfo;
10958
+ if (typeof props.items === "function") itemList.value = resolveItems(props.items, nextInfo);
10910
10959
  triggerOpen(true);
10911
10960
  };
10912
10961
  const onInternalChange = (valuePath, selectedOptions) => {
@@ -10916,10 +10965,31 @@
10916
10965
  if (lastValue !== void 0) emit("select", String(lastValue), selected);
10917
10966
  triggerOpen(false);
10918
10967
  };
10919
- const [activePath, onKeyDown] = useActive(itemList, mergedOpen, isRtl, onClose);
10968
+ const [activePath, onKeyDown, shouldSelectOnEnter] = useActive(itemList, mergedOpen, isRtl, onClose);
10920
10969
  const onInternalOpenChange = (nextOpen) => {
10921
10970
  if (!nextOpen) onClose();
10922
10971
  };
10972
+ /**
10973
+ * Cascader renders our children as its raw input element, so every keydown from the
10974
+ * children bubbles into BaseSelect's keyboard model. That model is built for a
10975
+ * non-editable trigger and breaks typing inside an editable one such as Sender:
10976
+ *
10977
+ * - Space is always `preventDefault()`ed, so no space can be typed;
10978
+ * - Enter is always `preventDefault()`ed, even when there is nothing to select;
10979
+ * - Backspace makes the option list step back a level or close the popup.
10980
+ *
10981
+ * Keep exactly those inside the content wrapper. Every other key — Escape, arrows,
10982
+ * application shortcuts — must keep bubbling, otherwise the app around us stops
10983
+ * receiving keyboard events while the trigger has focus.
10984
+ */
10985
+ const onContentKeyDown = (event) => {
10986
+ const { key } = event;
10987
+ if (key === "Enter") {
10988
+ if (!shouldSelectOnEnter(event)) event.stopPropagation();
10989
+ return;
10990
+ }
10991
+ if (key === " " || key === "Backspace" && mergedOpen.value) event.stopPropagation();
10992
+ };
10923
10993
  const domAttrs = (0, vue.computed)(() => {
10924
10994
  const { class: _class, style: _style, ...rest } = attrs;
10925
10995
  return rest;
@@ -10993,7 +11063,8 @@
10993
11063
  contextConfig.value.classes?.content,
10994
11064
  mergedClasses.value.content
10995
11065
  ],
10996
- "style": [contextConfig.value.styles?.content, mergedStyles.value.content]
11066
+ "style": [contextConfig.value.styles?.content, mergedStyles.value.content],
11067
+ "onKeydown": onContentKeyDown
10997
11068
  }, [childNode])])] });
10998
11069
  };
10999
11070
  }
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "1.2.1";
2
+ var version = "1.2.2";
3
3
  //#endregion
4
4
  export { version };
@@ -85,10 +85,18 @@ var XSuggestion = /* @__PURE__ */ defineComponent({
85
85
  const innerOpen = ref(false);
86
86
  const mergedOpen = computed(() => props.open ?? innerOpen.value);
87
87
  const itemList = ref([]);
88
+ /**
89
+ * What the last `onTrigger` asked for. A function `items` is usually an inline arrow,
90
+ * so it gets a new identity on every parent render — without this the watcher below
91
+ * would re-evaluate it with no info and drop the triggered list.
92
+ */
93
+ const triggerInfo = ref();
94
+ const resolveItems = (source, info) => {
95
+ if (typeof source === "function") return source(info);
96
+ return Array.isArray(source) ? source : [];
97
+ };
88
98
  watch(() => props.items, (nextItems) => {
89
- if (Array.isArray(nextItems)) itemList.value = nextItems;
90
- else if (typeof nextItems === "function") itemList.value = nextItems();
91
- else itemList.value = [];
99
+ itemList.value = resolveItems(nextItems, triggerInfo.value);
92
100
  }, { immediate: true });
93
101
  const triggerOpen = (nextOpen) => {
94
102
  if (props.open === void 0) innerOpen.value = nextOpen;
@@ -103,7 +111,8 @@ var XSuggestion = /* @__PURE__ */ defineComponent({
103
111
  triggerOpen(false);
104
112
  return;
105
113
  }
106
- if (typeof props.items === "function") itemList.value = props.items(nextInfo);
114
+ triggerInfo.value = nextInfo;
115
+ if (typeof props.items === "function") itemList.value = resolveItems(props.items, nextInfo);
107
116
  triggerOpen(true);
108
117
  };
109
118
  const onInternalChange = (valuePath, selectedOptions) => {
@@ -113,10 +122,31 @@ var XSuggestion = /* @__PURE__ */ defineComponent({
113
122
  if (lastValue !== void 0) emit("select", String(lastValue), selected);
114
123
  triggerOpen(false);
115
124
  };
116
- const [activePath, onKeyDown] = useActive(itemList, mergedOpen, isRtl, onClose);
125
+ const [activePath, onKeyDown, shouldSelectOnEnter] = useActive(itemList, mergedOpen, isRtl, onClose);
117
126
  const onInternalOpenChange = (nextOpen) => {
118
127
  if (!nextOpen) onClose();
119
128
  };
129
+ /**
130
+ * Cascader renders our children as its raw input element, so every keydown from the
131
+ * children bubbles into BaseSelect's keyboard model. That model is built for a
132
+ * non-editable trigger and breaks typing inside an editable one such as Sender:
133
+ *
134
+ * - Space is always `preventDefault()`ed, so no space can be typed;
135
+ * - Enter is always `preventDefault()`ed, even when there is nothing to select;
136
+ * - Backspace makes the option list step back a level or close the popup.
137
+ *
138
+ * Keep exactly those inside the content wrapper. Every other key — Escape, arrows,
139
+ * application shortcuts — must keep bubbling, otherwise the app around us stops
140
+ * receiving keyboard events while the trigger has focus.
141
+ */
142
+ const onContentKeyDown = (event) => {
143
+ const { key } = event;
144
+ if (key === "Enter") {
145
+ if (!shouldSelectOnEnter(event)) event.stopPropagation();
146
+ return;
147
+ }
148
+ if (key === " " || key === "Backspace" && mergedOpen.value) event.stopPropagation();
149
+ };
120
150
  const domAttrs = computed(() => {
121
151
  const { class: _class, style: _style, ...rest } = attrs;
122
152
  return rest;
@@ -190,7 +220,8 @@ var XSuggestion = /* @__PURE__ */ defineComponent({
190
220
  contextConfig.value.classes?.content,
191
221
  mergedClasses.value.content
192
222
  ],
193
- "style": [contextConfig.value.styles?.content, mergedStyles.value.content]
223
+ "style": [contextConfig.value.styles?.content, mergedStyles.value.content],
224
+ "onKeydown": onContentKeyDown
194
225
  }, [childNode])])] });
195
226
  };
196
227
  }
@@ -6,5 +6,5 @@ interface ActiveItem {
6
6
  /**
7
7
  * Cascader does not expose active item control, so we use `value` to mirror focus path.
8
8
  */
9
- export default function useActive(items: Ref<ActiveItem[]>, open: Ref<boolean>, rtl: Ref<boolean>, onCancel: () => void): readonly [Ref<string[], string[]>, (event: KeyboardEvent) => false | undefined];
9
+ export default function useActive(items: Ref<ActiveItem[]>, open: Ref<boolean>, rtl: Ref<boolean>, onCancel: () => void): readonly [Ref<string[], string[]>, (event: KeyboardEvent) => false | undefined, (event: KeyboardEvent) => boolean];
10
10
  export {};
@@ -1,6 +1,13 @@
1
1
  import { ref, watch } from "vue";
2
2
  //#region components/suggestion/useActive.ts
3
3
  /**
4
+ * An Enter pressed with a modifier or while an IME is composing belongs to the trigger
5
+ * (submit, newline, candidate confirmation), never to the suggestion list.
6
+ */
7
+ function isPlainEnter(event) {
8
+ return !event.isComposing && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey;
9
+ }
10
+ /**
4
11
  * Cascader does not expose active item control, so we use `value` to mirror focus path.
5
12
  */
6
13
  function useActive(items, open, rtl, onCancel) {
@@ -31,6 +38,26 @@ function useActive(items, open, rtl, onCancel) {
31
38
  const firstItem = getItems(activePaths.value.length + 1)[0];
32
39
  if (firstItem) activePaths.value = [...activePaths.value, firstItem.value];
33
40
  };
41
+ const getActiveItem = () => {
42
+ let currentItems = items.value;
43
+ let activeItem;
44
+ for (const activePath of activePaths.value) {
45
+ activeItem = currentItems.find((item) => item.value === activePath);
46
+ if (!activeItem) return void 0;
47
+ currentItems = activeItem.children || [];
48
+ }
49
+ return activeItem;
50
+ };
51
+ /**
52
+ * Whether this Enter belongs to the popup: it needs an open popup, a plain Enter and a
53
+ * leaf item to select. Anything else stays with the trigger, so the input can still
54
+ * submit, insert a newline or confirm an IME candidate.
55
+ */
56
+ const shouldSelectOnEnter = (event) => {
57
+ if (!open.value || !isPlainEnter(event)) return false;
58
+ const activeItem = getActiveItem();
59
+ return !!activeItem && !activeItem.children?.length;
60
+ };
34
61
  const onKeyDown = (event) => {
35
62
  if (!open.value) return;
36
63
  switch (event.key) {
@@ -56,12 +83,21 @@ function useActive(items, open, rtl, onCancel) {
56
83
  event.preventDefault();
57
84
  event.stopPropagation();
58
85
  break;
59
- case "Enter":
86
+ case "Enter": {
87
+ if (!isPlainEnter(event)) break;
88
+ const activeItem = getActiveItem();
89
+ if (!activeItem) break;
60
90
  event.preventDefault();
91
+ if (activeItem.children?.length) {
92
+ offsetNext();
93
+ event.stopPropagation();
94
+ }
61
95
  return false;
96
+ }
62
97
  case "Escape":
63
98
  onCancel();
64
99
  event.preventDefault();
100
+ event.stopPropagation();
65
101
  break;
66
102
  default: break;
67
103
  }
@@ -69,7 +105,11 @@ function useActive(items, open, rtl, onCancel) {
69
105
  watch([open, items], ([nextOpen, nextItems]) => {
70
106
  if (nextOpen && Array.isArray(nextItems) && nextItems.length > 0) activePaths.value = [nextItems[0].value];
71
107
  }, { immediate: true });
72
- return [activePaths, onKeyDown];
108
+ return [
109
+ activePaths,
110
+ onKeyDown,
111
+ shouldSelectOnEnter
112
+ ];
73
113
  }
74
114
  //#endregion
75
115
  export { useActive as default };
@@ -1,7 +1,7 @@
1
1
  import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p, p as m, r as h, s as g, t as _, u as v, v as y, x as b, y as x } from "./Serializer-Sc9uEpQk.js";
2
2
  import { Comment as S, Fragment as C, Teleport as w, Text as T, Transition as E, TransitionGroup as D, cloneVNode as O, computed as k, createTextVNode as A, createVNode as j, defineComponent as M, getCurrentInstance as N, getCurrentScope as P, h as F, inject as I, isVNode as L, markRaw as R, mergeDefaults as z, mergeProps as B, nextTick as V, onBeforeMount as ee, onBeforeUnmount as H, onBeforeUpdate as U, onMounted as W, onScopeDispose as te, onUnmounted as ne, onUpdated as re, provide as G, reactive as ie, ref as K, render as ae, resolveDynamicComponent as oe, shallowReactive as se, shallowRef as q, toRaw as ce, toRef as le, toRefs as ue, toValue as de, triggerRef as fe, unref as pe, useAttrs as me, useId as he, useSlots as ge, vShow as _e, watch as J, watchEffect as ve, withDirectives as ye } from "vue";
3
3
  //#region package.json
4
- var be = "1.2.1", xe = "anticon", Se = {}, Ce = [
4
+ var be = "1.2.2", xe = "anticon", Se = {}, Ce = [
5
5
  "outlined",
6
6
  "borderless",
7
7
  "filled",
@@ -53933,7 +53933,10 @@ var SI = /* @__PURE__ */ M({
53933
53933
  }, DI = mM("Suggestion", (e) => EI(Qo(e, {})), () => ({}));
53934
53934
  //#endregion
53935
53935
  //#region components/suggestion/useActive.ts
53936
- function OI(e, t, n, r) {
53936
+ function OI(e) {
53937
+ return !e.isComposing && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey;
53938
+ }
53939
+ function kI(e, t, n, r) {
53937
53940
  let i = K([]), a = (t, n = i.value) => {
53938
53941
  let r = e.value;
53939
53942
  for (let e = 0; e < t - 1; e += 1) {
@@ -53952,34 +53955,54 @@ function OI(e, t, n, r) {
53952
53955
  }, c = () => {
53953
53956
  let e = a(i.value.length + 1)[0];
53954
53957
  e && (i.value = [...i.value, e.value]);
53958
+ }, l = () => {
53959
+ let t = e.value, n;
53960
+ for (let e of i.value) {
53961
+ if (n = t.find((t) => t.value === e), !n) return;
53962
+ t = n.children || [];
53963
+ }
53964
+ return n;
53955
53965
  };
53956
53966
  return J([t, e], ([e, t]) => {
53957
53967
  e && Array.isArray(t) && t.length > 0 && (i.value = [t[0].value]);
53958
- }, { immediate: !0 }), [i, (e) => {
53959
- if (t.value) switch (e.key) {
53960
- case "ArrowDown":
53961
- o(1), e.preventDefault(), e.stopPropagation();
53962
- break;
53963
- case "ArrowUp":
53964
- o(-1), e.preventDefault(), e.stopPropagation();
53965
- break;
53966
- case "ArrowRight":
53967
- n.value ? s() : c(), e.preventDefault(), e.stopPropagation();
53968
- break;
53969
- case "ArrowLeft":
53970
- n.value ? c() : s(), e.preventDefault(), e.stopPropagation();
53971
- break;
53972
- case "Enter": return e.preventDefault(), !1;
53973
- case "Escape":
53974
- r(), e.preventDefault();
53975
- break;
53976
- default: break;
53968
+ }, { immediate: !0 }), [
53969
+ i,
53970
+ (e) => {
53971
+ if (t.value) switch (e.key) {
53972
+ case "ArrowDown":
53973
+ o(1), e.preventDefault(), e.stopPropagation();
53974
+ break;
53975
+ case "ArrowUp":
53976
+ o(-1), e.preventDefault(), e.stopPropagation();
53977
+ break;
53978
+ case "ArrowRight":
53979
+ n.value ? s() : c(), e.preventDefault(), e.stopPropagation();
53980
+ break;
53981
+ case "ArrowLeft":
53982
+ n.value ? c() : s(), e.preventDefault(), e.stopPropagation();
53983
+ break;
53984
+ case "Enter": {
53985
+ if (!OI(e)) break;
53986
+ let t = l();
53987
+ if (!t) break;
53988
+ return e.preventDefault(), t.children?.length && (c(), e.stopPropagation()), !1;
53989
+ }
53990
+ case "Escape":
53991
+ r(), e.preventDefault(), e.stopPropagation();
53992
+ break;
53993
+ default: break;
53994
+ }
53995
+ },
53996
+ (e) => {
53997
+ if (!t.value || !OI(e)) return !1;
53998
+ let n = l();
53999
+ return !!n && !n.children?.length;
53977
54000
  }
53978
- }];
54001
+ ];
53979
54002
  }
53980
54003
  //#endregion
53981
54004
  //#region components/suggestion/index.tsx
53982
- var kI = /* @__PURE__ */ M({
54005
+ var AI = /* @__PURE__ */ M({
53983
54006
  name: "AxSuggestion",
53984
54007
  inheritAttrs: !1,
53985
54008
  props: {
@@ -54044,52 +54067,59 @@ var kI = /* @__PURE__ */ M({
54044
54067
  u.value.popup,
54045
54068
  o.value,
54046
54069
  e.block ? `${o.value}-block` : ""
54047
- ].filter(Boolean).join(" ")), p = K(!1), m = k(() => e.open ?? p.value), h = K([]);
54070
+ ].filter(Boolean).join(" ")), p = K(!1), m = k(() => e.open ?? p.value), h = K([]), g = K(), _ = (e, t) => typeof e == "function" ? e(t) : Array.isArray(e) ? e : [];
54048
54071
  J(() => e.items, (e) => {
54049
- Array.isArray(e) ? h.value = e : typeof e == "function" ? h.value = e() : h.value = [];
54072
+ h.value = _(e, g.value);
54050
54073
  }, { immediate: !0 });
54051
- let g = (t) => {
54074
+ let v = (t) => {
54052
54075
  e.open === void 0 && (p.value = t), n("update:open", t), n("openChange", t);
54053
- }, _ = () => {
54054
- g(!1);
54055
- }, v = (t) => {
54076
+ }, y = () => {
54077
+ v(!1);
54078
+ }, b = (t) => {
54056
54079
  if (t === !1) {
54057
- g(!1);
54080
+ v(!1);
54058
54081
  return;
54059
54082
  }
54060
- typeof e.items == "function" && (h.value = e.items(t)), g(!0);
54061
- }, y = (e, t) => {
54083
+ g.value = t, typeof e.items == "function" && (h.value = _(e.items, t)), v(!0);
54084
+ }, x = (e, t) => {
54062
54085
  let r = Array.isArray(e) ? e : [], i = r[r.length - 1];
54063
- i !== void 0 && n("select", String(i), t ?? []), g(!1);
54064
- }, [b, x] = OI(h, m, s, _), S = (e) => {
54065
- e || _();
54066
- }, C = k(() => {
54086
+ i !== void 0 && n("select", String(i), t ?? []), v(!1);
54087
+ }, [S, C, w] = kI(h, m, s, y), T = (e) => {
54088
+ e || y();
54089
+ }, E = (e) => {
54090
+ let { key: t } = e;
54091
+ if (t === "Enter") {
54092
+ w(e) || e.stopPropagation();
54093
+ return;
54094
+ }
54095
+ (t === " " || t === "Backspace" && m.value) && e.stopPropagation();
54096
+ }, D = k(() => {
54067
54097
  let { class: e, style: t, ...n } = r;
54068
54098
  return n;
54069
- }), w = (e, n) => {
54099
+ }), O = (e, n) => {
54070
54100
  let r = t[e];
54071
54101
  return r ? r(n) : n.originNode;
54072
54102
  };
54073
54103
  return () => {
54074
54104
  let n = t.default?.({
54075
- onTrigger: v,
54076
- onKeyDown: x,
54105
+ onTrigger: b,
54106
+ onKeyDown: C,
54077
54107
  open: m.value
54078
54108
  });
54079
- return j(Xw, B(C.value, {
54109
+ return j(Xw, B(D.value, {
54080
54110
  options: h.value,
54081
54111
  open: m.value,
54082
- value: b.value,
54112
+ value: S.value,
54083
54113
  multiple: !1,
54084
54114
  placement: s.value ? "topRight" : "topLeft",
54085
54115
  optionRender: (e) => {
54086
- let t = e, n = w("labelRender", {
54116
+ let t = e, n = O("labelRender", {
54087
54117
  item: t,
54088
54118
  originNode: t.label
54089
- }), r = w("iconRender", {
54119
+ }), r = O("iconRender", {
54090
54120
  item: t,
54091
54121
  originNode: t.icon
54092
- }), i = w("extraRender", {
54122
+ }), i = O("extraRender", {
54093
54123
  item: t,
54094
54124
  originNode: t.extra
54095
54125
  });
@@ -54106,8 +54136,8 @@ var kI = /* @__PURE__ */ M({
54106
54136
  d.value.root,
54107
54137
  e.style
54108
54138
  ],
54109
- onOpenChange: S,
54110
- onChange: y,
54139
+ onOpenChange: T,
54140
+ onChange: x,
54111
54141
  popupMatchSelectWidth: e.block
54112
54142
  }), { default: () => [j("div", {
54113
54143
  class: [
@@ -54131,11 +54161,12 @@ var kI = /* @__PURE__ */ M({
54131
54161
  a.value.classes?.content,
54132
54162
  u.value.content
54133
54163
  ],
54134
- style: [a.value.styles?.content, d.value.content]
54164
+ style: [a.value.styles?.content, d.value.content],
54165
+ onKeydown: E
54135
54166
  }, [n])])] });
54136
54167
  };
54137
54168
  }
54138
- }), AI = /* @__PURE__ */ M({
54169
+ }), jI = /* @__PURE__ */ M({
54139
54170
  name: "ThinkIcon",
54140
54171
  setup() {
54141
54172
  return () => j("svg", {
@@ -54147,7 +54178,7 @@ var kI = /* @__PURE__ */ M({
54147
54178
  "aria-label": "think"
54148
54179
  }, [j("path", { d: "M847.936 168.448c65.088 65.664 46.144 198.528-36.224 337.536 88.128 143.04 109.824 281.408 43.008 348.8-66.56 67.072-202.688 45.696-343.808-41.984-141.12 87.68-277.248 109.056-343.808 41.984-66.816-67.392-45.056-205.76 43.008-348.8-82.368-139.008-101.248-271.872-36.16-337.536 65.408-65.92 198.336-46.336 336.96 37.76l9.728-5.76c135.104-79.232 263.36-96.448 327.296-32zM249.088 565.568l-2.24 4.16a536.704 536.704 0 0 0-38.272 85.696c-28.928 85.888-16.128 134.144 3.584 153.984 19.712 19.776 67.52 32.768 152.704 3.584a531.84 531.84 0 0 0 87.616-40.064c-35.84-26.816-71.488-57.664-105.792-92.288a950.4 950.4 0 0 1-97.6-115.072z m523.648 0.064l-2.56 3.584c-27.392 37.76-59.2 75.328-94.976 111.424a951.744 951.744 0 0 1-105.856 92.288c30.336 17.088 59.904 30.528 87.68 40.064 85.12 29.184 132.992 16.192 152.64-3.584 19.712-19.84 32.576-68.096 3.584-153.984a541.824 541.824 0 0 0-40.512-89.792z m-261.76-283.2l-17.664 12.416c-36.352 26.24-72.96 57.472-108.416 93.184a878.208 878.208 0 0 0-99.008 118.656c28.8 42.88 64.128 86.528 105.792 128.512a874.24 874.24 0 0 0 119.232 100.928 875.84 875.84 0 0 0 119.232-100.928 871.232 871.232 0 0 0 105.728-128.448 868.224 868.224 0 0 0-98.944-118.72 867.136 867.136 0 0 0-126.016-105.6z m3.2 105.472a11.52 11.52 0 0 1 7.808 7.808l7.232 24.512c10.432 35.2 37.888 62.72 73.088 73.152l24.192 7.168a11.52 11.52 0 0 1 0.064 22.144l-24.704 7.424A108.288 108.288 0 0 0 529.28 603.008l-7.296 24.576a11.52 11.52 0 0 1-22.144 0l-7.296-24.576a108.288 108.288 0 0 0-72.576-72.96l-24.704-7.36a11.52 11.52 0 0 1 0-22.144l24.32-7.168c35.136-10.432 62.592-37.952 73.024-73.152l7.232-24.512a11.52 11.52 0 0 1 14.336-7.808z m136.064-177.664a522.496 522.496 0 0 0-79.872 35.776c37.76 27.84 75.456 60.16 111.552 96.64a956.16 956.16 0 0 1 89.856 104.32c14.656-27.392 26.24-54.016 34.688-79.168 28.928-85.888 16.064-134.08-3.52-153.984-19.712-19.776-67.52-32.768-152.704-3.584z m-431.36 3.584c-19.584 19.84-32.512 68.096-3.52 153.984 8.512 25.152 20.096 51.776 34.688 79.168 26.24-35.392 56.32-70.528 89.856-104.32a948.224 948.224 0 0 1 111.616-96.64 514.816 514.816 0 0 0-79.936-35.776c-85.12-29.184-132.928-16.192-152.64 3.584z" }, null)]);
54149
54180
  }
54150
- }), jI = (e) => {
54181
+ }), MI = (e) => {
54151
54182
  let { componentCls: t, paddingXS: n, paddingSM: r, marginSM: i, fontSize: a, fontSizeHeading5: o, fontSizeSM: s, lineHeight: c, colorTextSecondary: l, colorTextDescription: u, colorBorder: d, lineWidth: f, motionDurationMid: p, motionEaseInOut: m } = e;
54152
54183
  return { [t]: {
54153
54184
  [`${t}-collapse-enter-active, ${t}-collapse-leave-active`]: {
@@ -54191,17 +54222,17 @@ var kI = /* @__PURE__ */ M({
54191
54222
  },
54192
54223
  [`&${t}-rtl`]: { direction: "rtl" }
54193
54224
  } };
54194
- }, MI = mM("Think", (e) => {
54225
+ }, NI = mM("Think", (e) => {
54195
54226
  let t = Qo(e, {});
54196
54227
  return [
54197
- jI(t),
54228
+ MI(t),
54198
54229
  iM(t),
54199
54230
  rM(t, `${t.componentCls}-motion-blink`)
54200
54231
  ];
54201
54232
  }, (e) => ({
54202
54233
  colorTextBlink: e.colorTextBase,
54203
54234
  colorTextBlinkDefault: e.colorTextDescription
54204
- })), NI = /* @__PURE__ */ M({
54235
+ })), PI = /* @__PURE__ */ M({
54205
54236
  name: "AxThink",
54206
54237
  inheritAttrs: !1,
54207
54238
  props: {
@@ -54281,7 +54312,7 @@ var kI = /* @__PURE__ */ M({
54281
54312
  },
54282
54313
  emits: ["update:expanded", "expand"],
54283
54314
  setup(e, { slots: t, emit: n, expose: r }) {
54284
- let i = me(), a = De(), o = Pe("think"), s = K(), [c, l] = MI(k(() => e.prefixCls)), u = K(e.defaultExpanded), d = k(() => e.expanded === void 0 ? u.value : e.expanded);
54315
+ let i = me(), a = De(), o = Pe("think"), s = K(), [c, l] = NI(k(() => e.prefixCls)), u = K(e.defaultExpanded), d = k(() => e.expanded === void 0 ? u.value : e.expanded);
54285
54316
  J(() => e.expanded, (e) => {
54286
54317
  e !== void 0 && (u.value = e);
54287
54318
  });
@@ -54309,7 +54340,7 @@ var kI = /* @__PURE__ */ M({
54309
54340
  function y(e) {
54310
54341
  e.style.height = "", e.style.opacity = "";
54311
54342
  }
54312
- let b = k(() => t.icon ? t.icon() : e.loading ? e.loading === !0 ? j(Zf, null, null) : e.loading : e.icon ?? j(AI, null, null)), x = k(() => {
54343
+ let b = k(() => t.icon ? t.icon() : e.loading ? e.loading === !0 ? j(Zf, null, null) : e.loading : e.icon ?? j(jI, null, null)), x = k(() => {
54313
54344
  let { class: e, style: t, ...n } = i;
54314
54345
  return n;
54315
54346
  }), S = k(() => e.prefixCls);
@@ -54370,12 +54401,12 @@ var kI = /* @__PURE__ */ M({
54370
54401
  onAfterLeave: y
54371
54402
  }, { default: () => [e.destroyOnHidden && !d.value ? null : C()] })]);
54372
54403
  }
54373
- }), PI = {
54404
+ }), FI = {
54374
54405
  loading: j(Zf, null, null),
54375
54406
  success: j(Pd, null, null),
54376
54407
  error: j(Hd, null, null),
54377
54408
  abort: j($f, null, null)
54378
- }, FI = (e) => {
54409
+ }, II = (e) => {
54379
54410
  let { componentCls: t, calc: n } = e, r = `${t}-item`;
54380
54411
  return { [r]: {
54381
54412
  display: "inline-flex",
@@ -54451,7 +54482,7 @@ var kI = /* @__PURE__ */ M({
54451
54482
  [`&${r}-click:hover`]: { background: e.colorErrorBgFilledHover }
54452
54483
  }
54453
54484
  } };
54454
- }, II = (e) => {
54485
+ }, LI = (e) => {
54455
54486
  let { componentCls: t, calc: n } = e, r = e.iconSize ?? e.fontSize;
54456
54487
  return { [t]: {
54457
54488
  [`&${t}-box`]: {
@@ -54535,11 +54566,11 @@ var kI = /* @__PURE__ */ M({
54535
54566
  } }
54536
54567
  }
54537
54568
  } };
54538
- }, LI = mM("ThoughtChain", (e) => {
54569
+ }, RI = mM("ThoughtChain", (e) => {
54539
54570
  let t = Qo(e, {});
54540
54571
  return [
54572
+ LI(t),
54541
54573
  II(t),
54542
- FI(t),
54543
54574
  iM(t),
54544
54575
  rM(t, `${t.componentCls}-motion-blink`)
54545
54576
  ];
@@ -54564,7 +54595,7 @@ var kI = /* @__PURE__ */ M({
54564
54595
  colorSuccessDisabled: l,
54565
54596
  colorPrimaryDisabled: u
54566
54597
  };
54567
- }), RI = /* @__PURE__ */ M({
54598
+ }), zI = /* @__PURE__ */ M({
54568
54599
  name: "AxThoughtChainItem",
54569
54600
  props: {
54570
54601
  prefixCls: {
@@ -54629,14 +54660,14 @@ var kI = /* @__PURE__ */ M({
54629
54660
  }
54630
54661
  },
54631
54662
  setup(e, { expose: t, slots: n }) {
54632
- let r = De(), i = K(), [a, o] = LI(k(() => e.prefixCls)), s = k(() => `${e.prefixCls}-item`);
54663
+ let r = De(), i = K(), [a, o] = RI(k(() => e.prefixCls)), s = k(() => `${e.prefixCls}-item`);
54633
54664
  function c(t) {
54634
54665
  e.disabled || !e.onClick || e.onClick(t);
54635
54666
  }
54636
54667
  return t({ get nativeElement() {
54637
54668
  return i.value;
54638
54669
  } }), () => {
54639
- let t = s.value, l = `${e.prefixCls}-status`, u = n.icon, d = e.status ? PI[e.status] : e.icon, f = u ? u({
54670
+ let t = s.value, l = `${e.prefixCls}-status`, u = n.icon, d = e.status ? FI[e.status] : e.icon, f = u ? u({
54640
54671
  originNode: d,
54641
54672
  status: e.status
54642
54673
  }) : d, p = n.title ? n.title({ originNode: e.title }) : e.title, m = n.description ? n.description({ originNode: e.description }) : e.description, h = Ie(p), g = Ie(m);
@@ -54679,7 +54710,7 @@ var kI = /* @__PURE__ */ M({
54679
54710
  }, [m])])]);
54680
54711
  };
54681
54712
  }
54682
- }), zI = /* @__PURE__ */ M({
54713
+ }), BI = /* @__PURE__ */ M({
54683
54714
  name: "ThoughtChainNode",
54684
54715
  props: {
54685
54716
  item: {
@@ -54740,7 +54771,7 @@ var kI = /* @__PURE__ */ M({
54740
54771
  collapsible: n,
54741
54772
  toggleExpand: () => t("toggleExpand")
54742
54773
  }), s = (t) => {
54743
- let { item: n, index: r } = e, s = j("span", { class: `${i.value}-index-icon` }, [r + 1]), c = n.icon === !1 ? null : n.status ? PI[n.status] : n.icon ?? s, l = e.iconRenderSlot ? e.iconRenderSlot({
54774
+ let { item: n, index: r } = e, s = j("span", { class: `${i.value}-index-icon` }, [r + 1]), c = n.icon === !1 ? null : n.status ? FI[n.status] : n.icon ?? s, l = e.iconRenderSlot ? e.iconRenderSlot({
54744
54775
  ...o(t),
54745
54776
  originNode: c,
54746
54777
  status: n.status
@@ -54832,7 +54863,7 @@ var kI = /* @__PURE__ */ M({
54832
54863
  ])]);
54833
54864
  };
54834
54865
  }
54835
- }), BI = /* @__PURE__ */ M({
54866
+ }), VI = /* @__PURE__ */ M({
54836
54867
  name: "AxThoughtChain",
54837
54868
  inheritAttrs: !1,
54838
54869
  props: {
@@ -54887,7 +54918,7 @@ var kI = /* @__PURE__ */ M({
54887
54918
  },
54888
54919
  emits: ["update:expandedKeys", "expand"],
54889
54920
  setup(e, { emit: t, expose: n, slots: r }) {
54890
- let i = me(), a = De(), o = Pe("thoughtChain"), s = K(), [c, l] = LI(k(() => e.prefixCls)), u = K(e.defaultExpandedKeys ?? []), d = k(() => e.expandedKeys === void 0 ? u.value : e.expandedKeys);
54921
+ let i = me(), a = De(), o = Pe("thoughtChain"), s = K(), [c, l] = RI(k(() => e.prefixCls)), u = K(e.defaultExpandedKeys ?? []), d = k(() => e.expandedKeys === void 0 ? u.value : e.expandedKeys);
54891
54922
  J(() => e.expandedKeys, (e) => {
54892
54923
  e !== void 0 && (u.value = [...e]);
54893
54924
  });
@@ -54939,7 +54970,7 @@ var kI = /* @__PURE__ */ M({
54939
54970
  ]
54940
54971
  }), [t.map((t, n) => {
54941
54972
  let i = t.key ?? String(n);
54942
- return j(zI, {
54973
+ return j(BI, {
54943
54974
  key: i,
54944
54975
  item: t,
54945
54976
  index: n,
@@ -54959,10 +54990,10 @@ var kI = /* @__PURE__ */ M({
54959
54990
  };
54960
54991
  }
54961
54992
  });
54962
- BI.Item = RI;
54993
+ VI.Item = zI;
54963
54994
  //#endregion
54964
54995
  //#region components/welcome/style/index.ts
54965
- var VI = (e) => {
54996
+ var HI = (e) => {
54966
54997
  let { componentCls: t, calc: n } = e, r = n(e.fontSizeHeading3).mul(e.lineHeightHeading3).equal(), i = n(e.fontSize).mul(e.lineHeight).equal();
54967
54998
  return { [t]: {
54968
54999
  display: "flex",
@@ -54994,7 +55025,7 @@ var VI = (e) => {
54994
55025
  [`${t}-description`]: { display: "block" },
54995
55026
  [`&${t}-rtl`]: { direction: "rtl" }
54996
55027
  } };
54997
- }, HI = (e) => {
55028
+ }, UI = (e) => {
54998
55029
  let { componentCls: t } = e;
54999
55030
  return { [t]: {
55000
55031
  "&-filled": {
@@ -55008,22 +55039,22 @@ var VI = (e) => {
55008
55039
  lineHeight: e.lineHeightHeading3
55009
55040
  } }
55010
55041
  } };
55011
- }, UI = mM("Welcome", (e) => {
55042
+ }, WI = mM("Welcome", (e) => {
55012
55043
  let t = Qo(e, {});
55013
- return [VI(t), HI(t)];
55044
+ return [HI(t), UI(t)];
55014
55045
  }, () => ({}));
55015
55046
  //#endregion
55016
55047
  //#region components/welcome/index.tsx
55017
- function WI(e) {
55048
+ function GI(e) {
55018
55049
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !L(e);
55019
55050
  }
55020
- function GI(e) {
55051
+ function KI(e) {
55021
55052
  return typeof e == "string" && /^https?:\/\//.test(e);
55022
55053
  }
55023
- function KI(e) {
55054
+ function qI(e) {
55024
55055
  return Array.isArray(e) ? e.length > 0 : e != null;
55025
55056
  }
55026
- var qI = /* @__PURE__ */ M({
55057
+ var JI = /* @__PURE__ */ M({
55027
55058
  name: "AxWelcome",
55028
55059
  inheritAttrs: !1,
55029
55060
  props: {
@@ -55097,7 +55128,7 @@ var qI = /* @__PURE__ */ M({
55097
55128
  }
55098
55129
  },
55099
55130
  setup(e, { expose: t, slots: n }) {
55100
- let r = De(), i = me(), a = Pe("welcome"), o = K(), [s, c] = UI(k(() => e.prefixCls));
55131
+ let r = De(), i = me(), a = Pe("welcome"), o = K(), [s, c] = WI(k(() => e.prefixCls));
55101
55132
  t({ get nativeElement() {
55102
55133
  return o.value;
55103
55134
  } });
@@ -55117,8 +55148,8 @@ var qI = /* @__PURE__ */ M({
55117
55148
  { [`${e.prefixCls}-rtl`]: r.value.direction === "rtl" }
55118
55149
  ]), d = k(() => {
55119
55150
  let t = n.icon?.() ?? e.icon;
55120
- if (!KI(t)) return null;
55121
- let r = !n.icon && GI(t) ? t : void 0;
55151
+ if (!qI(t)) return null;
55152
+ let r = !n.icon && KI(t) ? t : void 0;
55122
55153
  return j("div", {
55123
55154
  class: [
55124
55155
  `${e.prefixCls}-icon`,
@@ -55132,7 +55163,7 @@ var qI = /* @__PURE__ */ M({
55132
55163
  }, null) : t]);
55133
55164
  }), f = k(() => {
55134
55165
  let t = n.title?.() ?? e.title;
55135
- return KI(t) ? j(ZA.Title, {
55166
+ return qI(t) ? j(ZA.Title, {
55136
55167
  level: 4,
55137
55168
  class: [
55138
55169
  `${e.prefixCls}-title`,
@@ -55140,10 +55171,10 @@ var qI = /* @__PURE__ */ M({
55140
55171
  e.classes?.title
55141
55172
  ],
55142
55173
  style: [a.value.styles?.title, e.styles?.title]
55143
- }, WI(t) ? t : { default: () => [t] }) : null;
55174
+ }, GI(t) ? t : { default: () => [t] }) : null;
55144
55175
  }), p = k(() => {
55145
55176
  let t = n.extra?.() ?? e.extra;
55146
- return KI(t) ? j("div", {
55177
+ return qI(t) ? j("div", {
55147
55178
  class: [
55148
55179
  `${e.prefixCls}-extra`,
55149
55180
  a.value.classes?.extra,
@@ -55153,14 +55184,14 @@ var qI = /* @__PURE__ */ M({
55153
55184
  }, [t]) : null;
55154
55185
  }), m = k(() => {
55155
55186
  let t = n.description?.() ?? e.description;
55156
- return KI(t) ? j(ZA.Text, {
55187
+ return qI(t) ? j(ZA.Text, {
55157
55188
  class: [
55158
55189
  `${e.prefixCls}-description`,
55159
55190
  a.value.classes?.description,
55160
55191
  e.classes?.description
55161
55192
  ],
55162
55193
  style: [a.value.styles?.description, e.styles?.description]
55163
- }, WI(t) ? t : { default: () => [t] }) : null;
55194
+ }, GI(t) ? t : { default: () => [t] }) : null;
55164
55195
  });
55165
55196
  return () => j("div", B({ ref: o }, l.value, {
55166
55197
  class: u.value,
@@ -55173,7 +55204,7 @@ var qI = /* @__PURE__ */ M({
55173
55204
  ]
55174
55205
  }), [d.value, j("div", { class: `${e.prefixCls}-content-wrapper` }, [p.value ? j("div", { class: `${e.prefixCls}-title-wrapper` }, [f.value, p.value]) : f.value, m.value])]);
55175
55206
  }
55176
- }), JI = /* @__PURE__ */ M({
55207
+ }), YI = /* @__PURE__ */ M({
55177
55208
  name: "AxProvider",
55178
55209
  inheritAttrs: !1,
55179
55210
  props: {
@@ -55269,7 +55300,7 @@ var qI = /* @__PURE__ */ M({
55269
55300
  iconPrefixCls: e.iconPrefixCls
55270
55301
  }), { default: () => [t.default?.()] });
55271
55302
  }
55272
- }), YI = [
55303
+ }), XI = [
55273
55304
  tP,
55274
55305
  eP,
55275
55306
  ZN,
@@ -55277,11 +55308,11 @@ var qI = /* @__PURE__ */ M({
55277
55308
  bP,
55278
55309
  QP,
55279
55310
  HP,
55280
- JI,
55311
+ YI,
55281
55312
  MM,
55282
55313
  LF,
55283
55314
  TI,
55284
- qI,
55315
+ JI,
55285
55316
  DM,
55286
55317
  kM,
55287
55318
  jM,
@@ -55294,17 +55325,17 @@ var qI = /* @__PURE__ */ M({
55294
55325
  xI,
55295
55326
  yI,
55296
55327
  bI,
55297
- kI,
55298
- NI,
55299
- BI,
55300
- RI
55301
- ], XI = {
55328
+ AI,
55329
+ PI,
55330
+ VI,
55331
+ zI
55332
+ ], ZI = {
55302
55333
  install(e) {
55303
- YI.forEach((t) => {
55334
+ XI.forEach((t) => {
55304
55335
  t.name && e.component(t.name, t);
55305
55336
  });
55306
55337
  },
55307
55338
  version: be
55308
55339
  };
55309
55340
  //#endregion
55310
- export { MM as Actions, DM as ActionsAudio, kM as ActionsCopy, jM as ActionsFeedback, EM as ActionsItem, vN as Attachments, tP as Bubble, JN as BubbleDivider, eP as BubbleList, ZN as BubbleSystem, bP as CodeHighlighter, QP as Conversations, HP as ConversationsCreation, rN as FileCard, nN as FileCardList, fF as Folder, DF as Mermaid, jF as Notification, LF as Prompts, xI as Sender, yI as SenderHeader, bI as SenderSwitch, TI as Sources, kI as Suggestion, NI as Think, BI as ThoughtChain, RI as ThoughtChainItem, qI as Welcome, AF as XNotification, JI as XProvider, XI as default, sP as setupCodeHighlighter, be as version };
55341
+ export { MM as Actions, DM as ActionsAudio, kM as ActionsCopy, jM as ActionsFeedback, EM as ActionsItem, vN as Attachments, tP as Bubble, JN as BubbleDivider, eP as BubbleList, ZN as BubbleSystem, bP as CodeHighlighter, QP as Conversations, HP as ConversationsCreation, rN as FileCard, nN as FileCardList, fF as Folder, DF as Mermaid, jF as Notification, LF as Prompts, xI as Sender, yI as SenderHeader, bI as SenderSwitch, TI as Sources, AI as Suggestion, PI as Think, VI as ThoughtChain, zI as ThoughtChainItem, JI as Welcome, AF as XNotification, YI as XProvider, ZI as default, sP as setupCodeHighlighter, be as version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antdv-next/x",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist",