@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.
- package/codemods/modal-onCancel-to-onDismiss.js +69 -0
- package/es/Cascader/Cascader.js +188 -180
- package/es/Collapse/index.js +45 -38
- package/es/ComboSelect/index.js +297 -290
- package/es/ComboSelect/interface.d.ts +4 -1
- package/es/DatePicker/generatePicker/generateRangePicker.d.ts +0 -8
- package/es/DatePicker/generatePicker/generateRangePicker.js +76 -68
- package/es/DatePicker/generatePicker/index.d.ts +11 -4
- package/es/Modal/Confirm/index.js +81 -75
- package/es/Modal/index.d.ts +12 -1
- package/es/Modal/index.js +156 -141
- package/es/Tooltip/index.js +67 -61
- package/lib/Cascader/Cascader.js +1 -1
- package/lib/Collapse/index.js +1 -1
- package/lib/ComboSelect/index.js +1 -1
- package/lib/ComboSelect/interface.d.ts +4 -1
- package/lib/DatePicker/generatePicker/generateRangePicker.d.ts +0 -8
- package/lib/DatePicker/generatePicker/generateRangePicker.js +1 -1
- package/lib/DatePicker/generatePicker/index.d.ts +11 -4
- package/lib/Modal/Confirm/index.js +1 -1
- package/lib/Modal/index.d.ts +12 -1
- package/lib/Modal/index.js +1 -1
- package/lib/Tooltip/index.js +1 -1
- package/package.json +3 -2
package/es/Modal/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { j as t } from "../_virtual/jsx-runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Close as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Confirm as
|
|
9
|
-
import
|
|
10
|
-
import { $prefixCls as
|
|
11
|
-
import
|
|
2
|
+
import n from "react";
|
|
3
|
+
import _e from "rc-dialog";
|
|
4
|
+
import { Button as k } from "../Button/index.js";
|
|
5
|
+
import { Close as ze } from "../node_modules/@para-ui/icons/Close/index.js";
|
|
6
|
+
import Fe from "../GlobalContext/useFormatMessage.js";
|
|
7
|
+
import Te from "./lang/index.js";
|
|
8
|
+
import { Confirm as to } from "./Confirm/index.js";
|
|
9
|
+
import P from "clsx";
|
|
10
|
+
import { $prefixCls as W } from "../GlobalContext/constant.js";
|
|
11
|
+
import Ie from "../AutoTips/index.js";
|
|
12
12
|
import './index.css';/* empty css */
|
|
13
13
|
let h;
|
|
14
|
-
const
|
|
14
|
+
const Ke = (e) => {
|
|
15
15
|
h = {
|
|
16
16
|
x: e.pageX,
|
|
17
17
|
y: e.pageY
|
|
@@ -19,89 +19,104 @@ const ze = (e) => {
|
|
|
19
19
|
h = null;
|
|
20
20
|
}, 100);
|
|
21
21
|
};
|
|
22
|
-
window.document.documentElement && document.documentElement.addEventListener("click",
|
|
23
|
-
const
|
|
22
|
+
window.document.documentElement && document.documentElement.addEventListener("click", Ke, !0);
|
|
23
|
+
const oo = (e) => {
|
|
24
24
|
const {
|
|
25
|
-
open:
|
|
26
|
-
visible:
|
|
27
|
-
defaultOpen:
|
|
28
|
-
closeIcon:
|
|
29
|
-
centered:
|
|
30
|
-
focusTriggerAfterClose:
|
|
31
|
-
title:
|
|
32
|
-
footer:
|
|
33
|
-
showActions:
|
|
34
|
-
actions:
|
|
35
|
-
header:
|
|
36
|
-
hideHeader:
|
|
37
|
-
showCancel:
|
|
38
|
-
maskClosable:
|
|
39
|
-
disableBackdropClick:
|
|
40
|
-
closeOnBackdrop:
|
|
41
|
-
keyboard:
|
|
42
|
-
disableEscapeKeyDown:
|
|
43
|
-
closeOnEsc:
|
|
25
|
+
open: f,
|
|
26
|
+
visible: m,
|
|
27
|
+
defaultOpen: v,
|
|
28
|
+
closeIcon: X,
|
|
29
|
+
centered: L = !0,
|
|
30
|
+
focusTriggerAfterClose: J = !0,
|
|
31
|
+
title: Q,
|
|
32
|
+
footer: U,
|
|
33
|
+
showActions: Y = !0,
|
|
34
|
+
actions: q,
|
|
35
|
+
header: E,
|
|
36
|
+
hideHeader: Z = !1,
|
|
37
|
+
showCancel: ee = !0,
|
|
38
|
+
maskClosable: oe = !1,
|
|
39
|
+
disableBackdropClick: ne = !0,
|
|
40
|
+
closeOnBackdrop: p,
|
|
41
|
+
keyboard: se = !1,
|
|
42
|
+
disableEscapeKeyDown: te = !0,
|
|
43
|
+
closeOnEsc: x,
|
|
44
44
|
restoreFocusOnClose: g,
|
|
45
|
-
fullScreen:
|
|
46
|
-
customizeSize:
|
|
47
|
-
style:
|
|
48
|
-
bodyStyle:
|
|
49
|
-
contentWidth:
|
|
50
|
-
contentHeight:
|
|
51
|
-
contentStyle:
|
|
52
|
-
size:
|
|
53
|
-
children:
|
|
54
|
-
closable:
|
|
55
|
-
mask:
|
|
56
|
-
...
|
|
57
|
-
} = e,
|
|
58
|
-
|
|
59
|
-
process.env.NODE_ENV !== "production" &&
|
|
45
|
+
fullScreen: le,
|
|
46
|
+
customizeSize: ae,
|
|
47
|
+
style: re,
|
|
48
|
+
bodyStyle: ce,
|
|
49
|
+
contentWidth: ie,
|
|
50
|
+
contentHeight: N,
|
|
51
|
+
contentStyle: b,
|
|
52
|
+
size: a = "md",
|
|
53
|
+
children: de,
|
|
54
|
+
closable: ue = !0,
|
|
55
|
+
mask: w = !0,
|
|
56
|
+
...fe
|
|
57
|
+
} = e, O = Fe("Modal", Te), i = e.onClose !== void 0, S = n.useRef(!1);
|
|
58
|
+
n.useEffect(() => {
|
|
59
|
+
process.env.NODE_ENV !== "production" && i && !S.current && (S.current = !0, console.warn(
|
|
60
60
|
"[Modal] onClose 已在 v5.x.next 标记为 @deprecated,将在 v6.0 移除。请迁移到 onDismiss(处理 X/ESC/mask 关闭)+ onOk(确定按钮)+ onCancel(取消按钮)三回调模式。详见 BREAKING-CHANGES §B-Modal-props-rework。"
|
|
61
61
|
));
|
|
62
|
-
}, [
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
process.env.NODE_ENV !== "production" &&
|
|
62
|
+
}, [i]);
|
|
63
|
+
const B = m !== void 0, D = n.useRef(!1);
|
|
64
|
+
n.useEffect(() => {
|
|
65
|
+
process.env.NODE_ENV !== "production" && B && !D.current && (D.current = !0, console.warn(
|
|
66
66
|
"[Modal] visible 已在 v5.x.next 标记为 @deprecated,将在 v6.0 移除。请改用 open prop。详见 BREAKING-CHANGES §B-Modal-props-rework 子条 #3-A"
|
|
67
67
|
));
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
process.env.NODE_ENV !== "production" &&
|
|
68
|
+
}, [B]);
|
|
69
|
+
const A = e.onOk !== void 0, M = e.onSubmit !== void 0, y = n.useRef(!1);
|
|
70
|
+
n.useEffect(() => {
|
|
71
|
+
process.env.NODE_ENV !== "production" && A && !M && !y.current && (y.current = !0, console.warn(
|
|
72
72
|
"[Modal] onOk 已在 v5.x.next 标记为 @deprecated,将在 v6.0 移除。请改用 onSubmit prop(语义更清晰)。详见 BREAKING-CHANGES §B-Modal-props-rework"
|
|
73
73
|
));
|
|
74
|
-
}, [
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
process.env.NODE_ENV !== "production" &&
|
|
74
|
+
}, [A, M]);
|
|
75
|
+
const R = e.onCancel !== void 0, $ = e.onDismiss !== void 0, j = n.useRef(!1);
|
|
76
|
+
n.useEffect(() => {
|
|
77
|
+
if (process.env.NODE_ENV !== "production" && R && !$ && !i && !j.current)
|
|
78
|
+
throw j.current = !0, new Error(
|
|
79
|
+
"[Modal] v5.0.0-beta.14 起 X / ESC / 蒙层关闭路径主职责已交给 onDismiss(γ 互斥语义)。当前仅传 onCancel 而未传 onDismiss/onClose,prod 走 fallback 兼容,dev 抛 Error 强制迁移。一键迁移:`npx jscodeshift -t node_modules/@para-ui/core/codemods/modal-onCancel-to-onDismiss.js --parser=tsx src/`。v6.0(2026 Q3)起 fallback 删除,届时 X/ESC/mask 静默失效。详见 docs/UPGRADE_v4_to_v5.md §3.D.0 + BREAKING-CHANGES §B-Modal-props-rework 子条 #5。"
|
|
80
|
+
);
|
|
81
|
+
}, [R, $, i]);
|
|
82
|
+
const H = e.maskClosable !== void 0, G = e.disableBackdropClick !== void 0, _ = e.disableEscapeKeyDown !== void 0, z = e.focusTriggerAfterClose !== void 0, F = n.useRef(!1);
|
|
83
|
+
n.useEffect(() => {
|
|
84
|
+
if (process.env.NODE_ENV === "production" || F.current) return;
|
|
85
|
+
const o = [];
|
|
86
|
+
H && o.push("maskClosable → closeOnBackdrop"), G && o.push("disableBackdropClick → closeOnBackdrop"), _ && o.push("disableEscapeKeyDown → closeOnEsc"), z && o.push("focusTriggerAfterClose → restoreFocusOnClose"), o.length !== 0 && (F.current = !0, console.warn(
|
|
87
|
+
`[Modal] 检测到 v5.x.next 已 @deprecated 的反向命名 prop:${o.join("、")}。v5.x 仍 fallback 兼容,v6.0 移除。请按箭头右侧迁移到正向命名(对齐业界 antd/chakra/mui)。详见 BREAKING-CHANGES §B-Modal-props-rework + §B6。`
|
|
88
|
+
));
|
|
89
|
+
}, [H, G, _, z]);
|
|
90
|
+
const l = f !== void 0 || m !== void 0, [me, d] = n.useState(v ?? !1), Ce = l ? f ?? m ?? !1 : me, T = v !== void 0, I = f !== void 0;
|
|
91
|
+
n.useEffect(() => {
|
|
92
|
+
process.env.NODE_ENV !== "production" && I && T && console.warn(
|
|
78
93
|
"[Modal] 同时传 open + defaultOpen,defaultOpen 被忽略(open 优先,受控模式)。详见 BREAKING-CHANGES §B-Modal-props-rework 子条 #2"
|
|
79
94
|
);
|
|
80
|
-
}, [
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
}, [I, T]);
|
|
96
|
+
const K = n.useRef(l);
|
|
97
|
+
n.useEffect(() => {
|
|
98
|
+
K.current !== l && (process.env.NODE_ENV !== "production" && console.warn("[Modal] open 受控/非受控状态运行时切换,React 不支持此模式,请保持一致。"), K.current = l);
|
|
84
99
|
}, [l]);
|
|
85
|
-
const
|
|
86
|
-
e.onCancel?.(o), e.onClose?.("cancel"), l ||
|
|
87
|
-
},
|
|
88
|
-
e.onClose !== void 0 ? (e.onCancel?.(o), e.onClose("x")) : e.onDismiss
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
e.onClose !== void 0 ? (e.onCancel?.(o), e.onClose(
|
|
92
|
-
},
|
|
93
|
-
e.onSubmit ? e.onSubmit(o) : e.onOk?.(o), e.onClose?.("ok"), l ||
|
|
94
|
-
},
|
|
100
|
+
const ke = le || a === "fullScreen", s = `${W}-modal`, he = x !== void 0 ? x : !te, ve = p !== void 0 ? p : !ne, Ee = g !== void 0 ? g : J, pe = (o) => {
|
|
101
|
+
e.onCancel?.(o), e.onClose?.("cancel"), l || d(!1);
|
|
102
|
+
}, xe = (o) => {
|
|
103
|
+
e.onClose !== void 0 ? (e.onCancel?.(o), e.onClose("x")) : e.onDismiss !== void 0 ? e.onDismiss("x") : e.onCancel?.(o), l || d(!1);
|
|
104
|
+
}, ge = (o) => {
|
|
105
|
+
const r = o && o.type === "keydown" ? "esc" : "mask";
|
|
106
|
+
e.onClose !== void 0 ? (e.onCancel?.(o), e.onClose(r)) : e.onDismiss !== void 0 ? e.onDismiss(r) : e.onCancel?.(o), l || d(!1);
|
|
107
|
+
}, Ne = (o) => {
|
|
108
|
+
e.onSubmit ? e.onSubmit(o) : e.onOk?.(o), e.onClose?.("ok"), l || d(!1);
|
|
109
|
+
}, be = () => {
|
|
95
110
|
const o = {
|
|
96
|
-
sm: `${
|
|
97
|
-
md: `${
|
|
98
|
-
lg: `${
|
|
99
|
-
auto: `${
|
|
100
|
-
fullScreen: `${
|
|
111
|
+
sm: `${s}-sm`,
|
|
112
|
+
md: `${s}-md`,
|
|
113
|
+
lg: `${s}-lg`,
|
|
114
|
+
auto: `${s}-auto`,
|
|
115
|
+
fullScreen: `${s}-fullscreen`
|
|
101
116
|
};
|
|
102
|
-
if (!
|
|
103
|
-
return
|
|
104
|
-
},
|
|
117
|
+
if (!b)
|
|
118
|
+
return ke ? o.fullScreen : o[a];
|
|
119
|
+
}, we = () => !a || a === "fullScreen" || a === "auto" ? void 0 : {
|
|
105
120
|
sm: {
|
|
106
121
|
width: 430,
|
|
107
122
|
maxHeight: 118
|
|
@@ -114,94 +129,94 @@ const Le = (e) => {
|
|
|
114
129
|
width: 948,
|
|
115
130
|
maxHeight: 478
|
|
116
131
|
}
|
|
117
|
-
}[
|
|
118
|
-
const { maxHeight: o, width:
|
|
132
|
+
}[a], Oe = () => w ? `${s}-with-mask` : `${s}-without-mask`, Se = () => ({ ...ae, ...re }), Be = () => {
|
|
133
|
+
const { maxHeight: o, width: r } = we() || {};
|
|
119
134
|
return {
|
|
120
135
|
// contentWidth 和 contentHeight 优先级总是最高
|
|
121
|
-
maxHeight:
|
|
122
|
-
width:
|
|
123
|
-
height:
|
|
136
|
+
maxHeight: N || o || "calc(100vh - 142px)",
|
|
137
|
+
width: ie || r,
|
|
138
|
+
height: N,
|
|
124
139
|
// minHeight: contentHeight || 118,
|
|
125
|
-
...
|
|
126
|
-
...
|
|
140
|
+
...ce,
|
|
141
|
+
...b
|
|
127
142
|
};
|
|
128
|
-
},
|
|
129
|
-
if (
|
|
130
|
-
if (
|
|
131
|
-
const o =
|
|
132
|
-
|
|
143
|
+
}, De = () => {
|
|
144
|
+
if (Z) return null;
|
|
145
|
+
if (E) return E;
|
|
146
|
+
const o = ue && /* @__PURE__ */ t.jsx(
|
|
147
|
+
k.IconButton,
|
|
133
148
|
{
|
|
134
|
-
onClick:
|
|
135
|
-
className: `${
|
|
149
|
+
onClick: xe,
|
|
150
|
+
className: `${s}-close`,
|
|
136
151
|
variant: "outlined",
|
|
137
152
|
size: "small",
|
|
138
|
-
children:
|
|
153
|
+
children: X || /* @__PURE__ */ t.jsx(ze, { className: `${s}-close-icon` })
|
|
139
154
|
}
|
|
140
155
|
);
|
|
141
156
|
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
142
|
-
/* @__PURE__ */ t.jsx(
|
|
157
|
+
/* @__PURE__ */ t.jsx(Ie, { className: `${s}-title-text`, children: Q }),
|
|
143
158
|
o
|
|
144
159
|
] });
|
|
145
|
-
},
|
|
146
|
-
if (!
|
|
147
|
-
const { okText: o, cancelText:
|
|
148
|
-
|
|
160
|
+
}, Ae = () => {
|
|
161
|
+
if (!Y) return null;
|
|
162
|
+
const { okText: o, cancelText: r, okButtonProps: Re, cancelButtonProps: $e, confirmLoading: je = !1 } = e, He = /* @__PURE__ */ t.jsx(
|
|
163
|
+
k,
|
|
149
164
|
{
|
|
150
165
|
variant: "contained",
|
|
151
166
|
size: "large",
|
|
152
|
-
loading:
|
|
153
|
-
onClick:
|
|
154
|
-
...
|
|
155
|
-
children: o ??
|
|
167
|
+
loading: je,
|
|
168
|
+
onClick: Ne,
|
|
169
|
+
...Re,
|
|
170
|
+
children: o ?? O({ id: "ok" })
|
|
156
171
|
}
|
|
157
|
-
),
|
|
158
|
-
|
|
172
|
+
), V = [ee && /* @__PURE__ */ t.jsx(
|
|
173
|
+
k,
|
|
159
174
|
{
|
|
160
175
|
variant: "outlined",
|
|
161
176
|
size: "large",
|
|
162
|
-
onClick:
|
|
163
|
-
|
|
164
|
-
children:
|
|
177
|
+
onClick: pe,
|
|
178
|
+
...$e,
|
|
179
|
+
children: r ?? O({ id: "cancel" })
|
|
165
180
|
}
|
|
166
|
-
),
|
|
167
|
-
if (typeof
|
|
168
|
-
const c =
|
|
169
|
-
return /* @__PURE__ */ t.jsx(t.Fragment, { children: Array.isArray(c) ? c.map((
|
|
170
|
-
} else if (
|
|
171
|
-
return
|
|
172
|
-
return /* @__PURE__ */ t.jsx(t.Fragment, { children:
|
|
173
|
-
},
|
|
174
|
-
[`${
|
|
175
|
-
}),
|
|
181
|
+
), He], u = q ?? U;
|
|
182
|
+
if (typeof u == "function") {
|
|
183
|
+
const c = u(V);
|
|
184
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: Array.isArray(c) ? c.map((C, Ge) => /* @__PURE__ */ t.jsx(n.Fragment, { children: C }, Ge)) : c });
|
|
185
|
+
} else if (u)
|
|
186
|
+
return u;
|
|
187
|
+
return /* @__PURE__ */ t.jsx(t.Fragment, { children: V.map((c, C) => /* @__PURE__ */ t.jsx(n.Fragment, { children: c }, C)) });
|
|
188
|
+
}, Me = P(e.wrapClassName, {
|
|
189
|
+
[`${s}-centered`]: L
|
|
190
|
+
}), ye = P(e.className, `${W}-scrollbar-small`, be(), Oe());
|
|
176
191
|
return /* @__PURE__ */ t.jsx(
|
|
177
|
-
|
|
192
|
+
_e,
|
|
178
193
|
{
|
|
179
|
-
...
|
|
180
|
-
mask:
|
|
181
|
-
visible:
|
|
182
|
-
title:
|
|
183
|
-
footer:
|
|
184
|
-
style:
|
|
185
|
-
bodyStyle:
|
|
186
|
-
prefixCls:
|
|
187
|
-
className:
|
|
188
|
-
wrapClassName:
|
|
194
|
+
...fe,
|
|
195
|
+
mask: w,
|
|
196
|
+
visible: Ce,
|
|
197
|
+
title: De(),
|
|
198
|
+
footer: Ae(),
|
|
199
|
+
style: Se(),
|
|
200
|
+
bodyStyle: Be(),
|
|
201
|
+
prefixCls: s,
|
|
202
|
+
className: ye,
|
|
203
|
+
wrapClassName: Me,
|
|
189
204
|
mousePosition: h,
|
|
190
|
-
onClose:
|
|
205
|
+
onClose: ge,
|
|
191
206
|
closable: !1,
|
|
192
207
|
closeIcon: null,
|
|
193
|
-
maskClosable:
|
|
194
|
-
keyboard:
|
|
195
|
-
focusTriggerAfterClose:
|
|
196
|
-
transitionName: `${
|
|
197
|
-
maskTransitionName: `${
|
|
198
|
-
children:
|
|
208
|
+
maskClosable: ve || oe,
|
|
209
|
+
keyboard: he || se,
|
|
210
|
+
focusTriggerAfterClose: Ee,
|
|
211
|
+
transitionName: `${s}-zoom`,
|
|
212
|
+
maskTransitionName: `${s}-fade`,
|
|
213
|
+
children: de
|
|
199
214
|
}
|
|
200
215
|
);
|
|
201
216
|
};
|
|
202
217
|
export {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
218
|
+
to as Confirm,
|
|
219
|
+
oo as Modal,
|
|
220
|
+
oo as default
|
|
206
221
|
};
|
|
207
222
|
//# sourceMappingURL=index.js.map
|
package/es/Tooltip/index.js
CHANGED
|
@@ -1,106 +1,112 @@
|
|
|
1
1
|
import { j as r } from "../_virtual/jsx-runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { $rcPrefixCls as
|
|
7
|
-
import { Forbid as
|
|
2
|
+
import n from "react";
|
|
3
|
+
import z from "rc-tooltip";
|
|
4
|
+
import U, { getDisabledCompatibleChildren as w, mapLegacyPlacement as q } from "./utils.js";
|
|
5
|
+
import G from "clsx";
|
|
6
|
+
import { $rcPrefixCls as E, $prefixCls as J } from "../GlobalContext/constant.js";
|
|
7
|
+
import { Forbid as K } from "../node_modules/@para-ui/icons/Forbid/index.js";
|
|
8
8
|
import './index.css';/* empty css */
|
|
9
|
-
const
|
|
10
|
-
const [
|
|
11
|
-
|
|
12
|
-
("visible" in e || "open" in e) &&
|
|
13
|
-
}, [e.visible ?? e.open]),
|
|
9
|
+
const P = n.forwardRef((e, $) => {
|
|
10
|
+
const [T, m] = n.useState(e.defaultVisible), c = n.useRef(null), p = n.useRef(null), [j, N] = n.useState([0, 0]), g = n.useRef(!1);
|
|
11
|
+
n.useEffect(() => {
|
|
12
|
+
("visible" in e || "open" in e) && m(!!(e.visible ?? e.open));
|
|
13
|
+
}, [e.visible ?? e.open]), n.useEffect(() => {
|
|
14
14
|
process.env.NODE_ENV !== "production" && !g.current && Array.isArray(e.trigger) && e.trigger.length === 0 && (g.current = !0, console.warn(
|
|
15
15
|
"[Tooltip] `trigger=[]` 受控屏蔽写法已 deprecated,请改用 `visible={false}`(语义更清晰);v6 可能收紧 trigger 类型,提前迁移。"
|
|
16
16
|
));
|
|
17
17
|
}, [e.trigger]);
|
|
18
|
-
const
|
|
18
|
+
const u = () => {
|
|
19
19
|
const { title: t } = e;
|
|
20
20
|
return !t && t !== 0;
|
|
21
|
-
},
|
|
22
|
-
"visible" in e || "open" in e || u(
|
|
23
|
-
},
|
|
21
|
+
}, V = (t) => {
|
|
22
|
+
"visible" in e || "open" in e || m(u() ? !1 : t), u() || e.onVisibleChange?.(t);
|
|
23
|
+
}, b = () => {
|
|
24
24
|
const { builtinPlacements: t, autoAdjustOverflow: i } = e;
|
|
25
|
-
return t ||
|
|
25
|
+
return t || U({ autoAdjustOverflow: i });
|
|
26
26
|
}, S = (t, i) => {
|
|
27
|
-
const s =
|
|
27
|
+
const s = b(), o = Object.keys(s).find(
|
|
28
28
|
(a) => s[a].points[0] === i.points[0] && s[a].points[1] === i.points[1]
|
|
29
29
|
);
|
|
30
30
|
if (!o)
|
|
31
31
|
return;
|
|
32
|
-
const f = t.getBoundingClientRect(),
|
|
32
|
+
const f = t.getBoundingClientRect(), l = {
|
|
33
33
|
top: "50%",
|
|
34
34
|
left: "50%"
|
|
35
35
|
};
|
|
36
|
-
o.indexOf("top") >= 0 || o.indexOf("Bottom") >= 0 ?
|
|
37
|
-
},
|
|
36
|
+
o.indexOf("top") >= 0 || o.indexOf("Bottom") >= 0 ? l.top = `${f.height - (i.offset?.[1] || 0)}px` : (o.indexOf("Top") >= 0 || o.indexOf("bottom") >= 0) && (l.top = `${-(i.offset?.[1] || 0)}px`), o.indexOf("left") >= 0 || o.indexOf("Right") >= 0 ? l.left = `${f.width - (i.offset?.[0] || 0)}px` : (o.indexOf("right") >= 0 || o.indexOf("Left") >= 0) && (l.left = `${-(i.offset?.[0] || 0)}px`), t.style.transformOrigin = `${l.left} ${l.top}`;
|
|
37
|
+
}, D = (t) => {
|
|
38
38
|
if (c.current) {
|
|
39
|
-
const i =
|
|
39
|
+
const i = p.current?.popupRef?.current?.getElement()?.offsetHeight || 0, s = i === 0 ? 60 : 30, { x: o, y: f, width: l } = c.current.getBoundingClientRect(), a = t.clientX - (o + l / 2), Y = t.clientY - f + i + s;
|
|
40
40
|
setTimeout(() => {
|
|
41
|
-
|
|
41
|
+
N([-a, -Y]);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
}, {
|
|
45
|
-
prefixCls:
|
|
46
|
-
getPopupContainer:
|
|
47
|
-
overlayClassName:
|
|
45
|
+
prefixCls: A = `${E}-tooltip`,
|
|
46
|
+
getPopupContainer: W,
|
|
47
|
+
overlayClassName: F,
|
|
48
48
|
overlayInnerStyle: L,
|
|
49
49
|
overlayStyle: M,
|
|
50
|
-
children:
|
|
51
|
-
title:
|
|
50
|
+
children: v,
|
|
51
|
+
title: _,
|
|
52
52
|
placement: B,
|
|
53
|
-
isPopover:
|
|
54
|
-
followCursor:
|
|
55
|
-
maxWidth:
|
|
56
|
-
disabled:
|
|
57
|
-
showForbidIcon:
|
|
58
|
-
...
|
|
53
|
+
isPopover: I,
|
|
54
|
+
followCursor: x,
|
|
55
|
+
maxWidth: y,
|
|
56
|
+
disabled: d,
|
|
57
|
+
showForbidIcon: k,
|
|
58
|
+
...H
|
|
59
59
|
} = e;
|
|
60
|
-
let
|
|
61
|
-
!("visible" in e || "open" in e) &&
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
let h = T;
|
|
61
|
+
!("visible" in e || "open" in e) && u() && (h = !1);
|
|
62
|
+
const O = n.useRef(!1);
|
|
63
|
+
n.useEffect(() => {
|
|
64
|
+
process.env.NODE_ENV !== "production" && d !== void 0 && !O.current && (O.current = !0, console.warn(
|
|
65
|
+
"[Tooltip] disabled 已 @deprecated → 请改用 showForbidIcon(自描述命名,对齐业界)。v5.x 仍 fallback 兼容,v6.0 移除。"
|
|
66
|
+
));
|
|
67
|
+
}, [d]);
|
|
68
|
+
const X = G(!I && `${J}-tooltip`, F), C = { ...M };
|
|
69
|
+
y && (C.maxWidth = y);
|
|
70
|
+
const R = { targetOffset: j };
|
|
71
|
+
return e.offset && (R.offset = e.offset), /* @__PURE__ */ r.jsx(
|
|
72
|
+
z,
|
|
67
73
|
{
|
|
68
|
-
...
|
|
69
|
-
prefixCls:
|
|
70
|
-
placement:
|
|
74
|
+
...H,
|
|
75
|
+
prefixCls: A,
|
|
76
|
+
placement: x ? "top" : q(B),
|
|
71
77
|
overlayClassName: X,
|
|
72
|
-
getTooltipContainer:
|
|
73
|
-
ref:
|
|
74
|
-
builtinPlacements:
|
|
78
|
+
getTooltipContainer: W,
|
|
79
|
+
ref: $ || p,
|
|
80
|
+
builtinPlacements: b(),
|
|
75
81
|
overlay: /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
76
|
-
(
|
|
77
|
-
|
|
82
|
+
(d || k) && /* @__PURE__ */ r.jsx(K, { className: "disabled-svg" }),
|
|
83
|
+
_
|
|
78
84
|
] }),
|
|
79
|
-
visible:
|
|
80
|
-
align:
|
|
81
|
-
onVisibleChange:
|
|
85
|
+
visible: h,
|
|
86
|
+
align: R,
|
|
87
|
+
onVisibleChange: V,
|
|
82
88
|
onPopupAlign: S,
|
|
83
|
-
overlayStyle:
|
|
89
|
+
overlayStyle: C,
|
|
84
90
|
overlayInnerStyle: L,
|
|
85
91
|
arrowContent: null,
|
|
86
92
|
motion: {
|
|
87
|
-
motionName: `${
|
|
93
|
+
motionName: `${E}-tooltip-zoom-big-fast`,
|
|
88
94
|
motionDeadline: 1e3
|
|
89
95
|
},
|
|
90
|
-
children:
|
|
96
|
+
children: x ? /* @__PURE__ */ r.jsx(
|
|
91
97
|
"div",
|
|
92
98
|
{
|
|
93
99
|
style: { display: "inline-block" },
|
|
94
100
|
ref: c,
|
|
95
|
-
onMouseMove:
|
|
96
|
-
children:
|
|
101
|
+
onMouseMove: D,
|
|
102
|
+
children: w(v)
|
|
97
103
|
}
|
|
98
|
-
) :
|
|
104
|
+
) : w(v)
|
|
99
105
|
}
|
|
100
106
|
);
|
|
101
107
|
});
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
P.displayName = "Tooltip";
|
|
109
|
+
P.defaultProps = {
|
|
104
110
|
placement: "topLeft",
|
|
105
111
|
mouseEnterDelay: 0.1,
|
|
106
112
|
mouseLeaveDelay: 0.1,
|
|
@@ -110,7 +116,7 @@ w.defaultProps = {
|
|
|
110
116
|
maxWidth: 500
|
|
111
117
|
};
|
|
112
118
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
P as Tooltip,
|
|
120
|
+
P as default
|
|
115
121
|
};
|
|
116
122
|
//# sourceMappingURL=index.js.map
|
package/lib/Cascader/Cascader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../_virtual/jsx-runtime.js"),Ke=require("rc-select"),ce=require("clsx"),Le=require("rc-select/lib/hooks/useId"),Fe=require("rc-tree/lib/utils/conductUtil"),Ue=require("../node_modules/@para-ui/icons/Right/index.js"),ue=require("rc-util/lib/hooks/useEvent"),ze=require("rc-util/lib/hooks/useMergedState"),Be=require("../node_modules/@para-ui/icons/Down/index.js"),Je=require("../node_modules/@para-ui/icons/CloseCircleF/index.js"),Ge=require("react"),Qe=require("./context.js"),Xe=require("./hooks/useDisplayValues.js"),Ye=require("./hooks/useEntities.js"),Ze=require("./hooks/useMissingValues.js"),et=require("./OptionList/index.js"),f=require("./utils/commonUtil.js"),A=require("./utils/treeUtil.js"),tt=require("@snack-kit/lib"),j=require("../GlobalContext/constant.js"),de=require("../Tooltip/index.js"),st=require("./lang/index.js"),nt=require("../GlobalContext/useFormatMessage.js"),ot=require("../HelperText/index.js");function rt(o){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const p in o)if(p!=="default"){const E=Object.getOwnPropertyDescriptor(o,p);Object.defineProperty(l,p,E.get?E:{enumerable:!0,get:()=>o[p]})}}return l.default=o,Object.freeze(l)}const s=rt(Ge);function at(o){return Array.isArray(o)&&Array.isArray(o[0])}function H(o){return o?at(o)?o:(o.length===0?[]:[o]).map(l=>Array.isArray(l)?l:[l]):[]}const O=s.forwardRef((o,l)=>{const p=nt.default("Cascader",st.default),{id:E,prefixCls:pe=`${j.$prefixCls}-cascader`,fieldNames:K,className:it,defaultValue:me,value:R,changeOnSelect:L,onChange:y,displayRender:he,expandTrigger:F,options:g,optionsTitle:U=[],dropdownPrefixCls:z,loadData:B,popupVisible:V,open:S,popupClassName:P,dropdownClassName:xe,dropdownMenuColumnStyle:J,popupPlacement:q,placement:fe,onDropdownVisibleChange:ge,onPopupVisibleChange:M,expandIcon:G=n.jsxRuntimeExports.jsx(Ue.Right,{}),loadingIcon:Q,placeholder:D=p({id:"placeholder"}),allClear:Ce=!0,menuMaxHight:je=158,expandJoin:Ee="/",disabled:b=!1,loading:w,disabledTooltip:k,error:X=!1,hideErrorDom:Re,helperText:ye="",children:Y,dropdownMatchSelectWidth:Ve=!1,showCheckedStrategy:Z=f.SHOW_PARENT,...be}=o,we=Le(E),[$,ve]=ze(me,{value:R,postState:H}),c=s.useMemo(()=>f.fillFieldNames(K),[JSON.stringify(K)]),u=s.useMemo(()=>g||[],[g]),m=Ye.default(u,c),C=s.useCallback(e=>{const t=m();return e.map(r=>{const{nodes:i}=t[r];return i.map(a=>a[c.value])})},[m,c]),[h,ee]=s.useState(),[_,T]=s.useState(!1),[te,Ne]=s.useState("auto"),x=s.useRef({id:tt.UUID(),level:1}),Oe=e=>H(e).map(i=>A.toPathOptions(i,u,c).map(a=>a.option));s.useEffect(()=>{if(!R)return;const t=Oe(R)[0];t&&ee(t.map(r=>r?.label).join(Ee))},[R]);const se=Ze.default(u,c),[v,ne,oe]=s.useMemo(()=>{const[e,t]=se($);if(!$.length)return[e,[],t];const r=f.toPathKeys(e),i=m(),{checkedKeys:a,halfCheckedKeys:d}=Fe.conductCheck(r,!0,i);return[C(a),C(d),t]},[$,m,C,se]),Se=s.useMemo(()=>{const e=f.toPathKeys(v),t=A.formatStrategyValues(e,m,Z);return[...oe,...C(t)]},[v,m,C,oe,Z]),Pe=Xe.default(Se,u,c,!1,he),re=ue(e=>{ve(e);const t=H(e),r=t.map(d=>A.toPathOptions(d,u,c).map(N=>N.option)),i=t[0],a=r[0];y&&y(i,a||[])}),I=ue(e=>{re(e)}),qe=(e,t)=>{if(t.type==="clear"){re([]);return}const{valueCells:r}=t.values[0];I(r)},Me=xe||P,De=fe||q,ke=e=>{T(e),ge?.(e),M?.(e)},ae=s.useRef(!1);s.useEffect(()=>{if(process.env.NODE_ENV==="production"||ae.current)return;const e=[];V!==void 0&&e.push("popupVisible → open"),P!==void 0&&e.push("popupClassName → dropdownClassName"),q!==void 0&&e.push("popupPlacement → placement"),M!==void 0&&e.push("onPopupVisibleChange → onDropdownVisibleChange"),e.length!==0&&(ae.current=!0,console.warn(`[Cascader] 检测到已 @deprecated 的 popup* 命名 prop:${e.join("、")}。v5.x 仍 fallback 兼容,v6.0 移除。请按箭头右侧迁移。`))},[V,P,q,M]);const ie=s.useMemo(()=>({options:u,optionsTitle:U,fieldNames:c,values:v,menuMaxHight:je,halfValues:ne,changeOnSelect:L,onSelect:I,menuWidth:te,dropdownPrefixCls:z,loadData:B,expandTrigger:F,expandIcon:G,loadingIcon:Q,dropdownMenuColumnStyle:J,loading:w}),[te,u,x,U,c,v,ne,L,I,z,B,F,G,Q,J,w]),le=!u.length,$e=(e,t=1)=>{let r=t;const i=[...e.map(a=>({option:a,depth:1}))];for(;i.length>0&&r<3;){const a=i.pop();if(!a)break;const{option:d,depth:N}=a;r=Math.max(r,N),d.children&&d.children.length>0&&i.push(...d.children.map(He=>({option:He,depth:N+1})))}return r};s.useEffect(()=>{T(!!(S!==void 0?S:V))},[S,V]),s.useEffect(()=>(window.addEventListener("resize",W),()=>{window.removeEventListener("resize",W)}),[]),s.useEffect(()=>{const t=g?.[0]?.children;x.current.level=!t||t.length<1||w?1:$e(g||[]),W()},[g,w]);const _e=e=>{e.stopPropagation(),ee(""),y&&y([],[]),T(!1),ie.values=[]},W=()=>{const e=document.getElementById(`${x.current.id}`);if(!e)return;const{clientWidth:t}=e;Ne((t/x.current.level).toFixed(2))},Te=s.useMemo(()=>n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:h?b&&k?n.jsxRuntimeExports.jsx(de.Tooltip,{disabled:!0,children:n.jsxRuntimeExports.jsx("span",{className:"select-label-text",children:h})}):n.jsxRuntimeExports.jsx("span",{className:"select-label-text",children:h}):b&&k?n.jsxRuntimeExports.jsx(de.Tooltip,{disabled:!0,...k,children:n.jsxRuntimeExports.jsx("span",{className:"select-label-placeholder",children:D})}):n.jsxRuntimeExports.jsx("span",{className:"select-label-placeholder",children:D})}),[h,D]),Ie=()=>{if(Ce)return n.jsxRuntimeExports.jsx("span",{className:"clean-up-icon",onClick:_e,children:n.jsxRuntimeExports.jsx(Je.CloseCircleF,{})})},We=s.useMemo(()=>{const e=ce(`${j.$prefixCls}-cascader-select-content`,{[`${j.$prefixCls}-cascader-select-value`]:h,[`${j.$prefixCls}-cascader-select-disabled`]:b,[`${j.$prefixCls}-cascader-error`]:X}),t=ce("select-svg",{"select-svg-open":_});return Y||n.jsxRuntimeExports.jsxs("div",{className:e,id:x.current.id,children:[Te,n.jsxRuntimeExports.jsxs("span",{className:t,children:[n.jsxRuntimeExports.jsx(Be.Down,{}),Ie()]})]})},[h,_,x]),Ae=le?{}:{minWidth:"auto"};return n.jsxRuntimeExports.jsxs(Qe.default.Provider,{value:ie,children:[n.jsxRuntimeExports.jsx(Ke.BaseSelect,{...be,ref:l,disabled:b,id:we,prefixCls:pe,dropdownMatchSelectWidth:Ve,dropdownStyle:Ae,showSearch:!1,searchValue:"",onSearch:()=>{console.log("not search")},displayValues:Pe,onDisplayValuesChange:qe,OptionList:et.default,emptyOptions:le,open:_,dropdownClassName:Me,placement:De,onDropdownVisibleChange:ke,getRawInputElement:()=>We}),n.jsxRuntimeExports.jsx(ot.default,{className:"text-field-error-text",error:X,helperText:ye,hideErrorDom:Re})]})});process.env.NODE_ENV!=="production"&&(O.displayName="Cascader");O.SHOW_PARENT=f.SHOW_PARENT;O.SHOW_CHILD=f.SHOW_CHILD;exports.default=O;
|
|
2
2
|
//# sourceMappingURL=Cascader.js.map
|
package/lib/Collapse/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const r=require("../_virtual/jsx-runtime.js"),p=require("react"),P=require("rc-collapse"),R=require("./collapsePanel.js"),t=require("./util.js"),g=require("../node_modules/@para-ui/icons/Right/index.js"),j=require("./motion.js"),a=require("../GlobalContext/constant.js");;/* empty css */const c=s=>{const{className:i="",expandIconPosition:d="left"}=s,u=p.useRef(!1);p.useEffect(()=>{process.env.NODE_ENV==="production"||u.current||!t.toArray(s.children).some(l=>l?.props?.disabled!==void 0)||(u.current=!0,console.warn('[Collapse] CollapsePanel.disabled 已 @deprecated。v5.x 仍 fallback 兼容(自动映射 collapsible="disabled"),v6.0 移除。请直接传 collapsible="disabled"。'))},[s.children]);const x=()=>{const{children:e}=s;return t.toArray(e).map((l,o)=>{const n=l;if(n.props?.disabled){const h=n.key||String(o),{disabled:C,collapsible:v}=n.props,q={...t.omit(n.props,["disabled"]),key:h,collapsible:v??(C?"disabled":void 0)};return t.cloneElement(n,q)}return n})},f=(e={})=>{const{expandIcon:l}=s,o=l?l(e):r.jsxRuntimeExports.jsx(g.Right,{className:"collapse-expand-svg"});return r.jsxRuntimeExports.jsx("div",{className:"collapse-svg-box",children:o})},b=()=>{let e=`${a.$prefixCls}-collapse`;return i&&(e+=` ${i}`),d&&(e+=` ${a.$prefixCls}-collapse-svg-${d}`),e},m={...j.default,motionAppear:!1,leavedClassName:"collapse-content-hidden"};return r.jsxRuntimeExports.jsx(P,{openMotion:m,...s,expandIcon:f,prefixCls:`${a.$rcPrefixCls}-collapse`,className:b(),children:x()})};c.Panel=R.CollapsePanelProps;exports.Collapse=c;exports.default=c;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|