@para-ui/core 5.0.0-beta.13 → 5.0.0-beta.14

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.
@@ -0,0 +1,69 @@
1
+ /**
2
+ * jscodeshift codemod · modal-onCancel-to-onDismiss
3
+ *
4
+ * 为 v5.0.0-beta.14 提供:把 `<Modal onCancel={fn}>` v4 写法
5
+ * 自动改成 `<Modal onCancel={fn} onDismiss={fn}>`,解决 X/ESC/蒙层
6
+ * 在 v6.0(2026 Q3)起 silently 失效的迁移问题。
7
+ *
8
+ * 用法(业务方):
9
+ * npx jscodeshift -t node_modules/@para-ui/core/codemods/modal-onCancel-to-onDismiss.js \
10
+ * --parser=tsx --extensions=tsx,jsx src/
11
+ *
12
+ * 规则:
13
+ * - 仅处理 <Modal> JSX(不处理 <NS.Modal>;不处理命令式 Modal.Confirm)
14
+ * - 已有 onDismiss / onClose → skip(避免破坏 legacy 双触发或 γ 单触发)
15
+ * - 含 JSX spread `{...rest}` → skip(无法静态判定)
16
+ * - onCancel 表达式直接复用作 onDismiss 值(同回调,与 dev throw / ESLint rule 一致)
17
+ *
18
+ * 详见:
19
+ * - docs/UPGRADE_v4_to_v5.md §3.D.0
20
+ * - BREAKING-CHANGES §B-Modal-props-rework 子条 #5
21
+ */
22
+ module.exports = function transformer(file, api) {
23
+ const j = api.jscodeshift;
24
+ const root = j(file.source);
25
+ let touched = 0;
26
+
27
+ root.find(j.JSXOpeningElement)
28
+ .filter(path => {
29
+ const name = path.node.name;
30
+ return name && name.type === 'JSXIdentifier' && name.name === 'Modal';
31
+ })
32
+ .forEach(path => {
33
+ const attrs = path.node.attributes || [];
34
+ let onCancelAttr = null;
35
+ let hasOnDismiss = false;
36
+ let hasOnClose = false;
37
+ let hasSpread = false;
38
+
39
+ for (const attr of attrs) {
40
+ if (attr.type === 'JSXSpreadAttribute') {
41
+ hasSpread = true;
42
+ continue;
43
+ }
44
+ if (attr.type !== 'JSXAttribute') continue;
45
+ if (!attr.name || attr.name.type !== 'JSXIdentifier') continue;
46
+ if (attr.name.name === 'onCancel') onCancelAttr = attr;
47
+ else if (attr.name.name === 'onDismiss') hasOnDismiss = true;
48
+ else if (attr.name.name === 'onClose') hasOnClose = true;
49
+ }
50
+
51
+ if (hasSpread || !onCancelAttr || hasOnDismiss || hasOnClose) return;
52
+ if (!onCancelAttr.value) return;
53
+
54
+ const dismissAttr = j.jsxAttribute(
55
+ j.jsxIdentifier('onDismiss'),
56
+ onCancelAttr.value
57
+ );
58
+ path.node.attributes.push(dismissAttr);
59
+ touched += 1;
60
+ });
61
+
62
+ if (touched > 0) {
63
+ // 仅在有改动时输出,避免 dirty toSource 触发空 diff
64
+ return root.toSource({ quote: 'single', reuseWhitespace: true });
65
+ }
66
+ return null;
67
+ };
68
+
69
+ module.exports.parser = 'tsx';
@@ -1,95 +1,95 @@
1
- import { j as s } from "../_virtual/jsx-runtime.js";
1
+ import { j as o } from "../_virtual/jsx-runtime.js";
2
2
  import { BaseSelect as Fe } from "rc-select";
3
- import te from "clsx";
4
- import _e from "rc-select/lib/hooks/useId";
5
- import { conductCheck as Be } from "rc-tree/lib/utils/conductUtil";
6
- import { Right as Je } from "../node_modules/@para-ui/icons/Right/index.js";
7
- import se from "rc-util/lib/hooks/useEvent";
8
- import ze from "rc-util/lib/hooks/useMergedState";
9
- import { Down as Ue } from "../node_modules/@para-ui/icons/Down/index.js";
10
- import { CloseCircleF as qe } from "../node_modules/@para-ui/icons/CloseCircleF/index.js";
11
- import * as o from "react";
12
- import Ge from "./context.js";
13
- import Qe from "./hooks/useDisplayValues.js";
14
- import Xe from "./hooks/useEntities.js";
15
- import Ye from "./hooks/useMissingValues.js";
16
- import Ze from "./OptionList/index.js";
17
- import { SHOW_PARENT as ae, fillFieldNames as et, toPathKeys as oe, SHOW_CHILD as tt } from "./utils/commonUtil.js";
18
- import { formatStrategyValues as st, toPathOptions as ne } from "./utils/treeUtil.js";
19
- import { UUID as ot } from "@snack-kit/lib";
20
- import { $prefixCls as x } from "../GlobalContext/constant.js";
21
- import { Tooltip as re } from "../Tooltip/index.js";
22
- import nt from "./lang/index.js";
23
- import rt from "../GlobalContext/useFormatMessage.js";
24
- import at from "../HelperText/index.js";
25
- function lt(l) {
3
+ import re from "clsx";
4
+ import Be from "rc-select/lib/hooks/useId";
5
+ import { conductCheck as Je } from "rc-tree/lib/utils/conductUtil";
6
+ import { Right as ze } from "../node_modules/@para-ui/icons/Right/index.js";
7
+ import ae from "rc-util/lib/hooks/useEvent";
8
+ import Ue from "rc-util/lib/hooks/useMergedState";
9
+ import { Down as qe } from "../node_modules/@para-ui/icons/Down/index.js";
10
+ import { CloseCircleF as Ge } from "../node_modules/@para-ui/icons/CloseCircleF/index.js";
11
+ import * as s from "react";
12
+ import Qe from "./context.js";
13
+ import Xe from "./hooks/useDisplayValues.js";
14
+ import Ye from "./hooks/useEntities.js";
15
+ import Ze from "./hooks/useMissingValues.js";
16
+ import et from "./OptionList/index.js";
17
+ import { SHOW_PARENT as pe, fillFieldNames as tt, toPathKeys as le, SHOW_CHILD as st } from "./utils/commonUtil.js";
18
+ import { formatStrategyValues as ot, toPathOptions as ie } from "./utils/treeUtil.js";
19
+ import { UUID as nt } from "@snack-kit/lib";
20
+ import { $prefixCls as C } from "../GlobalContext/constant.js";
21
+ import { Tooltip as ce } from "../Tooltip/index.js";
22
+ import rt from "./lang/index.js";
23
+ import at from "../GlobalContext/useFormatMessage.js";
24
+ import lt from "../HelperText/index.js";
25
+ function it(l) {
26
26
  return Array.isArray(l) && Array.isArray(l[0]);
27
27
  }
28
- function P(l) {
29
- return l ? lt(l) ? l : (l.length === 0 ? [] : [l]).map((h) => Array.isArray(h) ? h : [h]) : [];
28
+ function T(l) {
29
+ return l ? it(l) ? l : (l.length === 0 ? [] : [l]).map((h) => Array.isArray(h) ? h : [h]) : [];
30
30
  }
31
- const k = o.forwardRef((l, h) => {
32
- const le = rt("Cascader", nt), {
31
+ const A = s.forwardRef((l, h) => {
32
+ const de = at("Cascader", rt), {
33
33
  // MISC
34
- id: ie,
35
- prefixCls: ce = `${x}-cascader`,
36
- fieldNames: I,
37
- className: it,
34
+ id: ue,
35
+ prefixCls: me = `${C}-cascader`,
36
+ fieldNames: H,
37
+ className: ct,
38
38
  // Value
39
- defaultValue: pe,
40
- value: C,
41
- changeOnSelect: W,
39
+ defaultValue: he,
40
+ value: x,
41
+ changeOnSelect: L,
42
42
  onChange: V,
43
- displayRender: de,
43
+ displayRender: fe,
44
44
  // Trigger
45
- expandTrigger: T,
45
+ expandTrigger: $,
46
46
  // Options
47
47
  options: f,
48
- optionsTitle: A = [],
49
- dropdownPrefixCls: H,
50
- loadData: L,
48
+ optionsTitle: K = [],
49
+ dropdownPrefixCls: _,
50
+ loadData: F,
51
51
  // Open
52
- popupVisible: K,
53
- open: S,
54
- popupClassName: ue,
55
- dropdownClassName: me,
56
- dropdownMenuColumnStyle: $,
57
- popupPlacement: he,
58
- placement: fe,
59
- onDropdownVisibleChange: ge,
60
- onPopupVisibleChange: xe,
52
+ popupVisible: w,
53
+ open: E,
54
+ popupClassName: M,
55
+ dropdownClassName: ge,
56
+ dropdownMenuColumnStyle: B,
57
+ popupPlacement: O,
58
+ placement: Ce,
59
+ onDropdownVisibleChange: xe,
60
+ onPopupVisibleChange: S,
61
61
  // Icon
62
- expandIcon: F = /* @__PURE__ */ s.jsx(Je, {}),
63
- loadingIcon: _,
62
+ expandIcon: J = /* @__PURE__ */ o.jsx(ze, {}),
63
+ loadingIcon: z,
64
64
  // Placeholder
65
- placeholder: v = le({ id: "placeholder" }),
65
+ placeholder: j = de({ id: "placeholder" }),
66
66
  // Clear
67
- allClear: Ce = !0,
67
+ allClear: Ve = !0,
68
68
  //MenuStlye
69
- menuMaxHight: Ve = 158,
69
+ menuMaxHight: we = 158,
70
70
  //Other
71
71
  expandJoin: ye = "/",
72
72
  disabled: y = !1,
73
- loading: w,
74
- disabledTooltip: E,
73
+ loading: v,
74
+ disabledTooltip: D,
75
75
  // error
76
- error: B = !1,
77
- hideErrorDom: we,
76
+ error: U = !1,
77
+ hideErrorDom: ve,
78
78
  helperText: Ne = "",
79
79
  // Children
80
- children: J,
81
- dropdownMatchSelectWidth: Me = !1,
82
- showCheckedStrategy: z = ae,
83
- ...Se
84
- } = l, ve = _e(ie), [O, Ee] = ze(pe, {
85
- value: C,
86
- postState: P
87
- }), i = o.useMemo(
88
- () => et(I),
80
+ children: q,
81
+ dropdownMatchSelectWidth: be = !1,
82
+ showCheckedStrategy: G = pe,
83
+ ...Ee
84
+ } = l, Me = Be(ue), [P, Oe] = Ue(he, {
85
+ value: x,
86
+ postState: T
87
+ }), i = s.useMemo(
88
+ () => tt(H),
89
89
  /* eslint-disable react-hooks/exhaustive-deps */
90
- [JSON.stringify(I)]
90
+ [JSON.stringify(H)]
91
91
  /* eslint-enable react-hooks/exhaustive-deps */
92
- ), c = o.useMemo(() => f || [], [f]), d = Xe(c, i), g = o.useCallback(
92
+ ), c = s.useMemo(() => f || [], [f]), d = Ye(c, i), g = s.useCallback(
93
93
  (e) => {
94
94
  const t = d();
95
95
  return e.map((n) => {
@@ -98,198 +98,206 @@ const k = o.forwardRef((l, h) => {
98
98
  });
99
99
  },
100
100
  [d, i]
101
- ), [u, U] = o.useState(), [b, j] = o.useState(!1), [q, Oe] = o.useState("auto"), m = o.useRef({
102
- id: ot(),
101
+ ), [u, Q] = s.useState(), [R, k] = s.useState(!1), [X, Se] = s.useState("auto"), m = s.useRef({
102
+ id: nt(),
103
103
  level: 1
104
- }), be = (e) => P(e).map(
105
- (a) => ne(a, c, i).map((r) => r.option)
104
+ }), je = (e) => T(e).map(
105
+ (a) => ie(a, c, i).map((r) => r.option)
106
106
  );
107
- o.useEffect(() => {
108
- if (!C) return;
109
- const t = be(C)[0];
110
- t && U(t.map((n) => n?.label).join(ye));
111
- }, [C]);
112
- const G = Ye(c, i), [N, Q, X] = o.useMemo(() => {
113
- const [e, t] = G(O);
114
- if (!O.length)
107
+ s.useEffect(() => {
108
+ if (!x) return;
109
+ const t = je(x)[0];
110
+ t && Q(t.map((n) => n?.label).join(ye));
111
+ }, [x]);
112
+ const Y = Ze(c, i), [N, Z, ee] = s.useMemo(() => {
113
+ const [e, t] = Y(P);
114
+ if (!P.length)
115
115
  return [e, [], t];
116
- const n = oe(e), a = d(), { checkedKeys: r, halfCheckedKeys: p } = Be(n, !0, a);
116
+ const n = le(e), a = d(), { checkedKeys: r, halfCheckedKeys: p } = Je(n, !0, a);
117
117
  return [g(r), g(p), t];
118
- }, [O, d, g, G]), je = o.useMemo(() => {
119
- const e = oe(N), t = st(e, d, z);
120
- return [...X, ...g(t)];
121
- }, [N, d, g, X, z]), De = Qe(je, c, i, !1, de), Y = se((e) => {
122
- Ee(e);
123
- const t = P(e), n = t.map(
124
- (p) => ne(p, c, i).map((M) => M.option)
118
+ }, [P, d, g, Y]), De = s.useMemo(() => {
119
+ const e = le(N), t = ot(e, d, G);
120
+ return [...ee, ...g(t)];
121
+ }, [N, d, g, ee, G]), Pe = Xe(De, c, i, !1, fe), te = ae((e) => {
122
+ Oe(e);
123
+ const t = T(e), n = t.map(
124
+ (p) => ie(p, c, i).map((b) => b.option)
125
125
  ), a = t[0], r = n[0];
126
126
  V && V(a, r || []);
127
- }), D = se((e) => {
128
- Y(e);
127
+ }), I = ae((e) => {
128
+ te(e);
129
129
  }), Re = (e, t) => {
130
130
  if (t.type === "clear") {
131
- Y([]);
131
+ te([]);
132
132
  return;
133
133
  }
134
134
  const { valueCells: n } = t.values[0];
135
- D(n);
136
- }, Pe = me || ue, ke = fe || he, Ie = (e) => {
137
- j(e), ge?.(e), xe?.(e);
138
- }, Z = o.useMemo(
135
+ I(n);
136
+ }, ke = ge || M, Ie = Ce || O, We = (e) => {
137
+ k(e), xe?.(e), S?.(e);
138
+ }, se = s.useRef(!1);
139
+ s.useEffect(() => {
140
+ if (process.env.NODE_ENV === "production" || se.current) return;
141
+ const e = [];
142
+ w !== void 0 && e.push("popupVisible → open"), M !== void 0 && e.push("popupClassName → dropdownClassName"), O !== void 0 && e.push("popupPlacement → placement"), S !== void 0 && e.push("onPopupVisibleChange → onDropdownVisibleChange"), e.length !== 0 && (se.current = !0, console.warn(
143
+ `[Cascader] 检测到已 @deprecated 的 popup* 命名 prop:${e.join("、")}。v5.x 仍 fallback 兼容,v6.0 移除。请按箭头右侧迁移。`
144
+ ));
145
+ }, [w, M, O, S]);
146
+ const oe = s.useMemo(
139
147
  () => ({
140
148
  options: c,
141
- optionsTitle: A,
149
+ optionsTitle: K,
142
150
  fieldNames: i,
143
151
  values: N,
144
- menuMaxHight: Ve,
145
- halfValues: Q,
146
- changeOnSelect: W,
147
- onSelect: D,
148
- menuWidth: q,
149
- dropdownPrefixCls: H,
150
- loadData: L,
151
- expandTrigger: T,
152
- expandIcon: F,
153
- loadingIcon: _,
154
- dropdownMenuColumnStyle: $,
155
- loading: w
152
+ menuMaxHight: we,
153
+ halfValues: Z,
154
+ changeOnSelect: L,
155
+ onSelect: I,
156
+ menuWidth: X,
157
+ dropdownPrefixCls: _,
158
+ loadData: F,
159
+ expandTrigger: $,
160
+ expandIcon: J,
161
+ loadingIcon: z,
162
+ dropdownMenuColumnStyle: B,
163
+ loading: v
156
164
  }),
157
165
  [
158
- q,
166
+ X,
159
167
  c,
160
168
  m,
161
- A,
169
+ K,
162
170
  i,
163
171
  N,
164
- Q,
165
- W,
166
- D,
167
- H,
172
+ Z,
168
173
  L,
169
- T,
170
- F,
174
+ I,
171
175
  _,
176
+ F,
172
177
  $,
173
- w
178
+ J,
179
+ z,
180
+ B,
181
+ v
174
182
  ]
175
- ), ee = !c.length, We = (e, t = 1) => {
183
+ ), ne = !c.length, Te = (e, t = 1) => {
176
184
  let n = t;
177
185
  const a = [...e.map((r) => ({ option: r, depth: 1 }))];
178
186
  for (; a.length > 0 && n < 3; ) {
179
187
  const r = a.pop();
180
188
  if (!r) break;
181
- const { option: p, depth: M } = r;
182
- n = Math.max(n, M), p.children && p.children.length > 0 && a.push(
183
- ...p.children.map(($e) => ({
184
- option: $e,
185
- depth: M + 1
189
+ const { option: p, depth: b } = r;
190
+ n = Math.max(n, b), p.children && p.children.length > 0 && a.push(
191
+ ...p.children.map((_e) => ({
192
+ option: _e,
193
+ depth: b + 1
186
194
  }))
187
195
  );
188
196
  }
189
197
  return n;
190
198
  };
191
- o.useEffect(() => {
192
- j(!!(S !== void 0 ? S : K));
193
- }, [S, K]), o.useEffect(() => (window.addEventListener("resize", R), () => {
194
- window.removeEventListener("resize", R);
195
- }), []), o.useEffect(() => {
199
+ s.useEffect(() => {
200
+ k(!!(E !== void 0 ? E : w));
201
+ }, [E, w]), s.useEffect(() => (window.addEventListener("resize", W), () => {
202
+ window.removeEventListener("resize", W);
203
+ }), []), s.useEffect(() => {
196
204
  const t = f?.[0]?.children;
197
- m.current.level = !t || t.length < 1 || w ? 1 : We(f || []), R();
198
- }, [f, w]);
199
- const Te = (e) => {
200
- e.stopPropagation(), U(""), V && V([], []), j(!1), Z.values = [];
201
- }, R = () => {
205
+ m.current.level = !t || t.length < 1 || v ? 1 : Te(f || []), W();
206
+ }, [f, v]);
207
+ const Ae = (e) => {
208
+ e.stopPropagation(), Q(""), V && V([], []), k(!1), oe.values = [];
209
+ }, W = () => {
202
210
  const e = document.getElementById(`${m.current.id}`);
203
211
  if (!e) return;
204
212
  const { clientWidth: t } = e;
205
- Oe((t / m.current.level).toFixed(2));
206
- }, Ae = o.useMemo(() => /* @__PURE__ */ s.jsx(s.Fragment, { children: u ? y && E ? /* @__PURE__ */ s.jsx(re, { disabled: !0, children: /* @__PURE__ */ s.jsx("span", { className: "select-label-text", children: u }) }) : /* @__PURE__ */ s.jsx("span", { className: "select-label-text", children: u }) : y && E ? /* @__PURE__ */ s.jsx(
207
- re,
213
+ Se((t / m.current.level).toFixed(2));
214
+ }, He = s.useMemo(() => /* @__PURE__ */ o.jsx(o.Fragment, { children: u ? y && D ? /* @__PURE__ */ o.jsx(ce, { disabled: !0, children: /* @__PURE__ */ o.jsx("span", { className: "select-label-text", children: u }) }) : /* @__PURE__ */ o.jsx("span", { className: "select-label-text", children: u }) : y && D ? /* @__PURE__ */ o.jsx(
215
+ ce,
208
216
  {
209
217
  disabled: !0,
210
- ...E,
211
- children: /* @__PURE__ */ s.jsx("span", { className: "select-label-placeholder", children: v })
218
+ ...D,
219
+ children: /* @__PURE__ */ o.jsx("span", { className: "select-label-placeholder", children: j })
212
220
  }
213
- ) : /* @__PURE__ */ s.jsx("span", { className: "select-label-placeholder", children: v }) }), [u, v]), He = () => {
214
- if (Ce)
215
- return /* @__PURE__ */ s.jsx(
221
+ ) : /* @__PURE__ */ o.jsx("span", { className: "select-label-placeholder", children: j }) }), [u, j]), Le = () => {
222
+ if (Ve)
223
+ return /* @__PURE__ */ o.jsx(
216
224
  "span",
217
225
  {
218
226
  className: "clean-up-icon",
219
- onClick: Te,
220
- children: /* @__PURE__ */ s.jsx(qe, {})
227
+ onClick: Ae,
228
+ children: /* @__PURE__ */ o.jsx(Ge, {})
221
229
  }
222
230
  );
223
- }, Le = o.useMemo(() => {
224
- const e = te(`${x}-cascader-select-content`, {
225
- [`${x}-cascader-select-value`]: u,
226
- [`${x}-cascader-select-disabled`]: y,
227
- [`${x}-cascader-error`]: B
228
- }), t = te("select-svg", {
229
- "select-svg-open": b
231
+ }, $e = s.useMemo(() => {
232
+ const e = re(`${C}-cascader-select-content`, {
233
+ [`${C}-cascader-select-value`]: u,
234
+ [`${C}-cascader-select-disabled`]: y,
235
+ [`${C}-cascader-error`]: U
236
+ }), t = re("select-svg", {
237
+ "select-svg-open": R
230
238
  });
231
- return J || /* @__PURE__ */ s.jsxs(
239
+ return q || /* @__PURE__ */ o.jsxs(
232
240
  "div",
233
241
  {
234
242
  className: e,
235
243
  id: m.current.id,
236
244
  children: [
237
- Ae,
238
- /* @__PURE__ */ s.jsxs("span", { className: t, children: [
239
- /* @__PURE__ */ s.jsx(Ue, {}),
240
- He()
245
+ He,
246
+ /* @__PURE__ */ o.jsxs("span", { className: t, children: [
247
+ /* @__PURE__ */ o.jsx(qe, {}),
248
+ Le()
241
249
  ] })
242
250
  ]
243
251
  }
244
252
  );
245
- }, [u, b, m]), Ke = (
253
+ }, [u, R, m]), Ke = (
246
254
  // Empty keep the width
247
- ee ? {} : {
255
+ ne ? {} : {
248
256
  minWidth: "auto"
249
257
  }
250
258
  );
251
- return /* @__PURE__ */ s.jsxs(Ge.Provider, { value: Z, children: [
252
- /* @__PURE__ */ s.jsx(
259
+ return /* @__PURE__ */ o.jsxs(Qe.Provider, { value: oe, children: [
260
+ /* @__PURE__ */ o.jsx(
253
261
  Fe,
254
262
  {
255
- ...Se,
263
+ ...Ee,
256
264
  ref: h,
257
265
  disabled: y,
258
- id: ve,
259
- prefixCls: ce,
260
- dropdownMatchSelectWidth: Me,
266
+ id: Me,
267
+ prefixCls: me,
268
+ dropdownMatchSelectWidth: be,
261
269
  dropdownStyle: Ke,
262
270
  showSearch: !1,
263
271
  searchValue: "",
264
272
  onSearch: () => {
265
273
  console.log("not search");
266
274
  },
267
- displayValues: De,
275
+ displayValues: Pe,
268
276
  onDisplayValuesChange: Re,
269
- OptionList: Ze,
270
- emptyOptions: ee,
271
- open: b,
272
- dropdownClassName: Pe,
273
- placement: ke,
274
- onDropdownVisibleChange: Ie,
275
- getRawInputElement: () => Le
277
+ OptionList: et,
278
+ emptyOptions: ne,
279
+ open: R,
280
+ dropdownClassName: ke,
281
+ placement: Ie,
282
+ onDropdownVisibleChange: We,
283
+ getRawInputElement: () => $e
276
284
  }
277
285
  ),
278
- /* @__PURE__ */ s.jsx(
279
- at,
286
+ /* @__PURE__ */ o.jsx(
287
+ lt,
280
288
  {
281
289
  className: "text-field-error-text",
282
- error: B,
290
+ error: U,
283
291
  helperText: Ne,
284
- hideErrorDom: we
292
+ hideErrorDom: ve
285
293
  }
286
294
  )
287
295
  ] });
288
296
  });
289
- process.env.NODE_ENV !== "production" && (k.displayName = "Cascader");
290
- k.SHOW_PARENT = ae;
291
- k.SHOW_CHILD = tt;
297
+ process.env.NODE_ENV !== "production" && (A.displayName = "Cascader");
298
+ A.SHOW_PARENT = pe;
299
+ A.SHOW_CHILD = st;
292
300
  export {
293
- k as default
301
+ A as default
294
302
  };
295
303
  //# sourceMappingURL=Cascader.js.map
@@ -1,52 +1,59 @@
1
- import { j as t } from "../_virtual/jsx-runtime.js";
2
- import C from "rc-collapse";
3
- import { CollapsePanelProps as b } from "./collapsePanel.js";
4
- import { toArray as $, omit as g, cloneElement as v } from "./util.js";
5
- import { Right as P } from "../node_modules/@para-ui/icons/Right/index.js";
6
- import j from "./motion.js";
7
- import { $rcPrefixCls as I, $prefixCls as c } from "../GlobalContext/constant.js";
1
+ import { j as n } from "../_virtual/jsx-runtime.js";
2
+ import i from "react";
3
+ import N from "rc-collapse";
4
+ import { CollapsePanelProps as P } from "./collapsePanel.js";
5
+ import { toArray as d, omit as $, cloneElement as g } from "./util.js";
6
+ import { Right as E } from "../node_modules/@para-ui/icons/Right/index.js";
7
+ import R from "./motion.js";
8
+ import { $rcPrefixCls as j, $prefixCls as p } from "../GlobalContext/constant.js";
8
9
  import './index.css';/* empty css */
9
- const N = (s) => {
10
- const { className: r = "", expandIconPosition: a = "left" } = s, i = () => {
11
- const { children: o } = s;
12
- return $(o).map((l, n) => {
13
- const e = l;
14
- if (e.props?.disabled) {
15
- const f = e.key || String(n), { disabled: x, collapsible: h } = e.props, u = {
16
- ...g(e.props, ["disabled"]),
17
- key: f,
18
- collapsible: h ?? (x ? "disabled" : void 0)
10
+ const I = (l) => {
11
+ const { className: r = "", expandIconPosition: t = "left" } = l, c = i.useRef(!1);
12
+ i.useEffect(() => {
13
+ process.env.NODE_ENV === "production" || c.current || !d(l.children).some((s) => s?.props?.disabled !== void 0) || (c.current = !0, console.warn(
14
+ '[Collapse] CollapsePanel.disabled 已 @deprecated。v5.x 仍 fallback 兼容(自动映射 collapsible="disabled"),v6.0 移除。请直接传 collapsible="disabled"。'
15
+ ));
16
+ }, [l.children]);
17
+ const m = () => {
18
+ const { children: e } = l;
19
+ return d(e).map((s, a) => {
20
+ const o = s;
21
+ if (o.props?.disabled) {
22
+ const x = o.key || String(a), { disabled: h, collapsible: C } = o.props, v = {
23
+ ...$(o.props, ["disabled"]),
24
+ key: x,
25
+ collapsible: C ?? (h ? "disabled" : void 0)
19
26
  };
20
- return v(e, u);
27
+ return g(o, v);
21
28
  }
22
- return e;
29
+ return o;
23
30
  });
24
- }, p = (o = {}) => {
25
- const { expandIcon: l } = s, n = l ? l(o) : /* @__PURE__ */ t.jsx(P, { className: "collapse-expand-svg" });
26
- return /* @__PURE__ */ t.jsx("div", { className: "collapse-svg-box", children: n });
27
- }, d = () => {
28
- let o = `${c}-collapse`;
29
- return r && (o += ` ${r}`), a && (o += ` ${c}-collapse-svg-${a}`), o;
30
- }, m = {
31
- ...j,
31
+ }, f = (e = {}) => {
32
+ const { expandIcon: s } = l, a = s ? s(e) : /* @__PURE__ */ n.jsx(E, { className: "collapse-expand-svg" });
33
+ return /* @__PURE__ */ n.jsx("div", { className: "collapse-svg-box", children: a });
34
+ }, u = () => {
35
+ let e = `${p}-collapse`;
36
+ return r && (e += ` ${r}`), t && (e += ` ${p}-collapse-svg-${t}`), e;
37
+ }, b = {
38
+ ...R,
32
39
  motionAppear: !1,
33
40
  leavedClassName: "collapse-content-hidden"
34
41
  };
35
- return /* @__PURE__ */ t.jsx(
36
- C,
42
+ return /* @__PURE__ */ n.jsx(
43
+ N,
37
44
  {
38
- openMotion: m,
39
- ...s,
40
- expandIcon: p,
41
- prefixCls: `${I}-collapse`,
42
- className: d(),
43
- children: i()
45
+ openMotion: b,
46
+ ...l,
47
+ expandIcon: f,
48
+ prefixCls: `${j}-collapse`,
49
+ className: u(),
50
+ children: m()
44
51
  }
45
52
  );
46
53
  };
47
- N.Panel = b;
54
+ I.Panel = P;
48
55
  export {
49
- N as Collapse,
50
- N as default
56
+ I as Collapse,
57
+ I as default
51
58
  };
52
59
  //# sourceMappingURL=index.js.map