@unicom-cloud/ui 0.8.106 → 0.8.108
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/App.js +7 -0
- package/BackTop.js +2 -4
- package/Calendar.js +2 -2
- package/ColorPicker.js +15 -14
- package/Constant.js +4 -0
- package/Copy.js +4 -3
- package/Countdown.js +25 -0
- package/Grid.js +8 -10
- package/LiquidFill.js +4 -3
- package/List.js +7 -6
- package/Marquee.js +4 -3
- package/Modal.js +4 -2
- package/PageHeader.js +3 -2
- package/QrCode.js +4 -3
- package/RowCol.js +8 -0
- package/Segmented.js +14 -4
- package/Statistic.js +5 -4
- package/Tour.js +4 -3
- package/Transfer.js +4 -2
- package/anchor/Link.js +1 -1
- package/app/App.js +26 -0
- package/app/context.js +9 -0
- package/app/index.js +9 -0
- package/app/interface.js +1 -0
- package/app/useApp.js +8 -0
- package/avatar/Group.js +1 -1
- package/back-top/index.js +44 -56
- package/button/index.js +52 -51
- package/calendar/Lunar.js +71 -0
- package/calendar/index.js +11 -11
- package/cascader/base/node.js +22 -20
- package/cascader/base/store.js +10 -10
- package/cascader/util.js +29 -27
- package/color-picker/Mode.js +8 -7
- package/color-picker/hooks/useColorPicker.js +56 -55
- package/color-picker/index.js +49 -48
- package/color-picker/utils.js +58 -57
- package/components/common/empty/index.js +2 -2
- package/components/common/flex/index.js +64 -55
- package/components/common/flex/interface.js +6 -6
- package/components/common/hooks/useInterval.js +6 -6
- package/components/common/icons/file/index.js +13 -11
- package/components/common/space/index.js +53 -53
- package/components/common/utils/dayjs.js +114 -126
- package/components/common/utils/is.js +98 -104
- package/components/common/utils/setDir.js +12 -0
- package/components/common/utils/setTheme.js +13 -13
- package/components/common/utils/toArray.js +7 -5
- package/config-provider/ConfigProvider.js +32 -30
- package/constant/index.js +4 -0
- package/copy/index.js +2 -1
- package/countdown/index.js +113 -0
- package/countdown/interface.js +1 -0
- package/countdown/util.js +29 -0
- package/descriptions/index.js +45 -45
- package/divider/index.js +28 -20
- package/dropdown/Button.js +1 -1
- package/empty/index.js +1 -1
- package/flex/index.js +30 -29
- package/form/FormItem.js +126 -122
- package/grid/Grid.js +56 -90
- package/grid/Item.js +44 -65
- package/grid/context.js +2 -6
- package/grid/index.js +6 -8
- package/grid/util.js +6 -44
- package/hooks/useResponsiveState.js +54 -0
- package/index.js +614 -605
- package/input/Button.js +12 -12
- package/input/Group.js +11 -12
- package/input/Input.js +112 -102
- package/input/InputElement.js +25 -24
- package/input/Search.js +24 -24
- package/layout/Sider.js +1 -1
- package/liquid-fill/index.js +4 -3
- package/list/Item.js +21 -21
- package/list/index.js +53 -52
- package/marquee/index.js +20 -19
- package/marquee-/index.js +4 -3
- package/mentions/util.js +9 -8
- package/modal/Confirm.js +17 -17
- package/modal/Modal.js +247 -237
- package/modal/index.js +4 -2
- package/modal/use-modal/index.js +2 -2
- package/package.json +1 -1
- package/page-header/index.js +57 -56
- package/pagination/Pagination.js +89 -92
- package/qr-code/index.js +4 -3
- package/radio/Group.js +1 -1
- package/row-col/Col-.js +88 -0
- package/row-col/Col.js +159 -0
- package/row-col/Row.js +73 -0
- package/row-col/context.js +5 -0
- package/row-col/index.js +11 -0
- package/row-col/interface.js +1 -0
- package/segmented/index.js +257 -206
- package/select/Select.js +191 -191
- package/select/util.js +50 -50
- package/select-view/Core.js +31 -28
- package/space/index.js +15 -13
- package/splitter/SplitBar.js +44 -46
- package/statistic/index.js +56 -55
- package/statistic/interface.js +4 -1
- package/style.css +1 -1
- package/table/Table.js +198 -210
- package/table/hook/useColumns.js +27 -26
- package/table/hook/useStickyClassNames.js +9 -8
- package/table/hook/useThResizable.js +4 -3
- package/table/th-resizable/index.js +2 -2
- package/table/thead/index.js +18 -16
- package/time-picker/util.js +20 -30
- package/timeline/Item.js +1 -1
- package/tour/index.js +4 -3
- package/transfer/index.js +93 -91
- package/trigger/index.js +66 -66
- package/types/common/development/interface.d.ts +3 -3
- package/types/common/flex/index.d.ts +3 -9
- package/types/common/flex/interface.d.ts +15 -4
- package/types/common/space/index.d.ts +3 -5
- package/types/common/space/interface.d.ts +2 -0
- package/types/common/utils/dayjs.d.ts +3 -1
- package/types/common/utils/is.d.ts +3 -4
- package/types/common/utils/setDir.d.ts +2 -0
- package/types/pc/app/App.d.ts +6 -0
- package/types/pc/app/context.d.ts +4 -0
- package/types/pc/app/index.d.ts +5 -0
- package/types/pc/app/interface.d.ts +17 -0
- package/types/pc/app/useApp.d.ts +3 -0
- package/types/pc/back-top/interface.d.ts +4 -17
- package/types/pc/button/interface.d.ts +2 -2
- package/types/pc/calendar/Lunar.d.ts +17 -0
- package/types/pc/calendar/index.d.ts +1 -1
- package/types/pc/config-provider/interface.d.ts +17 -12
- package/types/pc/constant/index.d.ts +1 -0
- package/types/pc/countdown/interface.d.ts +65 -0
- package/types/pc/countdown/util.d.ts +7 -0
- package/types/pc/divider/interface.d.ts +1 -0
- package/types/pc/flex/index.d.ts +8 -6
- package/types/pc/flex/interface.d.ts +3 -10
- package/types/pc/form/FormItem.d.ts +1 -1
- package/types/pc/form/interface.d.ts +1 -1
- package/types/pc/grid/Grid.d.ts +2 -4
- package/types/pc/grid/Item.d.ts +1 -5
- package/types/pc/grid/context.d.ts +4 -15
- package/types/pc/grid/index.d.ts +4 -6
- package/types/pc/grid/interface.d.ts +14 -142
- package/types/pc/grid/util.d.ts +1 -10
- package/types/pc/hooks/useResponsiveState.d.ts +3 -0
- package/types/pc/index.d.ts +10 -4
- package/types/pc/input/Button.d.ts +2 -2
- package/types/pc/list/interface.d.ts +2 -1
- package/types/pc/message/index.d.ts +1 -9
- package/types/pc/message/interface.d.ts +8 -0
- package/types/pc/message/useMessage.d.ts +1 -2
- package/types/pc/modal/Modal.d.ts +1 -0
- package/types/pc/modal/config.d.ts +1 -2
- package/types/pc/modal/index.d.ts +2 -1
- package/types/pc/modal/interface.d.ts +17 -5
- package/types/pc/notification/index.d.ts +2 -9
- package/types/pc/notification/interface.d.ts +7 -0
- package/types/pc/notification/useNotification.d.ts +1 -2
- package/types/pc/pagination/PageOption.d.ts +0 -1
- package/types/pc/pagination/interface.d.ts +5 -6
- package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
- package/types/pc/{grid → row-col}/Col.d.ts +1 -2
- package/types/pc/{grid → row-col}/Row.d.ts +1 -2
- package/types/pc/row-col/context.d.ts +6 -0
- package/types/pc/row-col/index.d.ts +7 -0
- package/types/pc/row-col/interface.d.ts +112 -0
- package/types/pc/segmented/index.d.ts +3 -7
- package/types/pc/segmented/interface.d.ts +38 -5
- package/types/pc/select-view/Core.d.ts +1 -8
- package/types/pc/select-view/index.d.ts +1 -8
- package/types/pc/select-view/interface.d.ts +9 -2
- package/types/pc/space/index.d.ts +5 -7
- package/types/pc/space/interface.d.ts +3 -10
- package/types/pc/statistic/index.d.ts +1 -1
- package/types/pc/statistic/interface.d.ts +1 -49
- package/types/pc/utils/is.d.ts +1 -1
- package/types/pc/utils/names.d.ts +422 -111
- package/types/pc/utils/responsiveObserve.d.ts +8 -8
- package/typography/Ellipsis.js +5 -4
- package/typography/Operations.js +4 -3
- package/utils/dayjs.js +13 -11
- package/utils/index.js +245 -244
- package/utils/is.js +65 -66
- package/utils/names.js +309 -150
- package/utils/responsiveObserve.js +43 -36
- package/version/index.js +1 -1
- package/grid/Col-.js +0 -86
- package/grid/Col.js +0 -169
- package/grid/Row.js +0 -96
- package/grid/hook/useResponsiveState.js +0 -38
- package/statistic/Countdown.js +0 -56
- package/statistic/util.js +0 -33
- package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
- package/types/pc/statistic/util.d.ts +0 -1
- /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
package/transfer/index.js
CHANGED
|
@@ -1,88 +1,90 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsxs as X, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import Y from "@unicom-cloud/icons/IconUiLeft";
|
|
3
|
+
import Z from "@unicom-cloud/icons/IconUiRight";
|
|
4
|
+
import ee from "lodash/isPlainObject";
|
|
5
|
+
import te, { useContext as se, useMemo as V } from "react";
|
|
6
|
+
import re from "../button/index.js";
|
|
7
7
|
import "../config-provider/ConfigProvider.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import oe from "../components/common/hooks/useMergeProps.js";
|
|
9
|
+
import w from "../components/common/hooks/useMergeValue.js";
|
|
10
|
+
import A from "@unicom-cloud/utils/class-name";
|
|
11
|
+
import "../components/common/utils/is.js";
|
|
11
12
|
import { pickDataAttributes as ae } from "../components/common/utils/pick.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
13
|
+
import ne from "./List.js";
|
|
14
|
+
import ce from "../config-provider/context.js";
|
|
15
|
+
import { isArray as b } from "@unicom-cloud/utils/is";
|
|
16
|
+
const le = {
|
|
15
17
|
titleTexts: ["Source", "Target"],
|
|
16
18
|
defaultSelectedKeys: [],
|
|
17
19
|
defaultTargetKeys: [],
|
|
18
20
|
dataSource: [],
|
|
19
|
-
filterOption: (
|
|
21
|
+
filterOption: (h, p) => typeof p?.value == "string" && p.value.indexOf(h) !== -1
|
|
20
22
|
};
|
|
21
|
-
function
|
|
22
|
-
const { getPrefixCls:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
function de(h, p) {
|
|
24
|
+
const { getPrefixCls: N, componentConfig: L, rtl: R } = se(ce), C = oe(
|
|
25
|
+
h,
|
|
26
|
+
le,
|
|
27
|
+
L?.Transfer
|
|
26
28
|
), {
|
|
27
|
-
prefixCls:
|
|
28
|
-
style:
|
|
29
|
-
className:
|
|
30
|
-
children:
|
|
29
|
+
prefixCls: j,
|
|
30
|
+
style: k,
|
|
31
|
+
className: B,
|
|
32
|
+
children: E,
|
|
31
33
|
dataSource: d,
|
|
32
|
-
defaultTargetKeys:
|
|
33
|
-
defaultSelectedKeys:
|
|
34
|
-
targetKeys:
|
|
35
|
-
selectedKeys:
|
|
36
|
-
oneWay:
|
|
34
|
+
defaultTargetKeys: O,
|
|
35
|
+
defaultSelectedKeys: $,
|
|
36
|
+
targetKeys: M,
|
|
37
|
+
selectedKeys: U,
|
|
38
|
+
oneWay: W,
|
|
37
39
|
simple: n,
|
|
38
40
|
disabled: y,
|
|
39
|
-
titleTexts:
|
|
41
|
+
titleTexts: z,
|
|
40
42
|
operationTexts: K,
|
|
41
|
-
operationStyle:
|
|
42
|
-
onSearch:
|
|
43
|
-
onChange:
|
|
44
|
-
onSelectChange:
|
|
45
|
-
...
|
|
46
|
-
} =
|
|
47
|
-
value: E,
|
|
48
|
-
defaultValue: n ? C.concat(O) : C
|
|
49
|
-
}), [$, x] = P([], {
|
|
43
|
+
operationStyle: F,
|
|
44
|
+
onSearch: H,
|
|
45
|
+
onChange: _,
|
|
46
|
+
onSelectChange: I,
|
|
47
|
+
...q
|
|
48
|
+
} = C, c = j || N?.("transfer"), S = !!(n || W), [i, G] = w([], {
|
|
50
49
|
value: M,
|
|
51
|
-
defaultValue: n ?
|
|
52
|
-
}), [
|
|
50
|
+
defaultValue: n ? O.concat($) : O
|
|
51
|
+
}), [T, x] = w([], {
|
|
52
|
+
value: U,
|
|
53
|
+
defaultValue: n ? [] : $
|
|
54
|
+
}), [v, D] = V(
|
|
53
55
|
() => [[], []],
|
|
54
56
|
[d, i]
|
|
55
|
-
), [l, f] =
|
|
56
|
-
|
|
57
|
+
), [l, f] = V(() => {
|
|
58
|
+
v.length = 0, D.length = 0;
|
|
57
59
|
const e = {
|
|
58
|
-
dataSource:
|
|
60
|
+
dataSource: v,
|
|
59
61
|
selectedKeys: [],
|
|
60
62
|
validKeys: [],
|
|
61
63
|
selectedValidKeys: [],
|
|
62
64
|
selectedDisabledKeys: []
|
|
63
|
-
},
|
|
64
|
-
dataSource:
|
|
65
|
+
}, o = {
|
|
66
|
+
dataSource: D,
|
|
65
67
|
selectedKeys: [],
|
|
66
68
|
validKeys: [],
|
|
67
69
|
selectedValidKeys: [],
|
|
68
70
|
selectedDisabledKeys: []
|
|
69
71
|
};
|
|
70
72
|
return d.forEach((t) => {
|
|
71
|
-
const s = i.indexOf(t.key) > -1 ?
|
|
72
|
-
t.disabled || s.validKeys.push(t.key),
|
|
73
|
-
}),
|
|
74
|
-
|
|
75
|
-
}), e.dataSource = d.slice(), e.selectedKeys = i.slice()), [e,
|
|
76
|
-
}, [d, i,
|
|
77
|
-
if (
|
|
73
|
+
const s = i.indexOf(t.key) > -1 ? o : e;
|
|
74
|
+
t.disabled || s.validKeys.push(t.key), T.indexOf(t.key) > -1 && (s.selectedKeys.push(t.key), t.disabled ? s.selectedDisabledKeys.push(t.key) : s.selectedValidKeys.push(t.key)), s.dataSource.push(t);
|
|
75
|
+
}), ee(n) && n.retainSelectedItems && (Object.entries(e).forEach(([t, s]) => {
|
|
76
|
+
b(s) && (e[t] = s.concat(o[t]));
|
|
77
|
+
}), e.dataSource = d.slice(), e.selectedKeys = i.slice()), [e, o];
|
|
78
|
+
}, [d, i, T, n]), g = (e, o = null) => {
|
|
79
|
+
if (b(o) && o.length === 0)
|
|
78
80
|
return;
|
|
79
|
-
|
|
80
|
-
const t = e === "target" ? i.concat(
|
|
81
|
+
o = o || (e === "target" ? l.selectedValidKeys : f.selectedValidKeys);
|
|
82
|
+
const t = e === "target" ? i.concat(o).sort((s, r) => d.findIndex(({ key: a }) => a === s) - d.findIndex(({ key: a }) => a === r)) : i.filter((s) => o.indexOf(s) === -1);
|
|
81
83
|
x(
|
|
82
84
|
l.selectedDisabledKeys.concat(f.selectedDisabledKeys)
|
|
83
|
-
),
|
|
84
|
-
},
|
|
85
|
-
if (
|
|
85
|
+
), G(t), _?.(t, e, o);
|
|
86
|
+
}, J = (e, o) => {
|
|
87
|
+
if (o === "source")
|
|
86
88
|
if (n) {
|
|
87
89
|
const t = e.filter(
|
|
88
90
|
(r) => l.selectedKeys.indexOf(r) === -1
|
|
@@ -91,22 +93,22 @@ function le(m, p) {
|
|
|
91
93
|
);
|
|
92
94
|
g("target", t), g("source", s);
|
|
93
95
|
} else
|
|
94
|
-
x(e.concat(f.selectedKeys)),
|
|
96
|
+
x(e.concat(f.selectedKeys)), I?.(e, f.selectedKeys);
|
|
95
97
|
else
|
|
96
|
-
x(l.selectedKeys.concat(e)),
|
|
97
|
-
},
|
|
98
|
-
const e = f.selectedKeys.length > 0,
|
|
99
|
-
return n ? null : /* @__PURE__ */
|
|
98
|
+
x(l.selectedKeys.concat(e)), I?.(l.selectedKeys, e);
|
|
99
|
+
}, Q = () => {
|
|
100
|
+
const e = f.selectedKeys.length > 0, o = l.selectedKeys.length > 0, t = S ? ["target"] : ["target", "source"];
|
|
101
|
+
return n ? null : /* @__PURE__ */ m(
|
|
100
102
|
"div",
|
|
101
103
|
{
|
|
102
|
-
style:
|
|
103
|
-
className:
|
|
104
|
+
style: F,
|
|
105
|
+
className: A(`${c}-operations`, {
|
|
104
106
|
[`${c}-operations-words`]: K
|
|
105
107
|
}),
|
|
106
108
|
children: t.map((s, r) => {
|
|
107
|
-
let
|
|
108
|
-
return s === "source" ? (
|
|
109
|
-
|
|
109
|
+
let a, u;
|
|
110
|
+
return s === "source" ? (a = Y, u = y || !e) : (a = Z, u = y || !o), /* @__PURE__ */ m(
|
|
111
|
+
re,
|
|
110
112
|
{
|
|
111
113
|
tabIndex: u ? -1 : void 0,
|
|
112
114
|
"aria-label": `move selected ${s === "target" ? "right" : "left"}`,
|
|
@@ -115,7 +117,7 @@ function le(m, p) {
|
|
|
115
117
|
shape: "round",
|
|
116
118
|
disabled: u,
|
|
117
119
|
onClick: () => g(s),
|
|
118
|
-
icon: /* @__PURE__ */
|
|
120
|
+
icon: /* @__PURE__ */ m(a, {}),
|
|
119
121
|
children: K && K[r]
|
|
120
122
|
},
|
|
121
123
|
r
|
|
@@ -123,61 +125,61 @@ function le(m, p) {
|
|
|
123
125
|
})
|
|
124
126
|
}
|
|
125
127
|
);
|
|
126
|
-
},
|
|
127
|
-
const
|
|
128
|
-
return Object.entries(s).forEach(([r,
|
|
128
|
+
}, P = (e) => {
|
|
129
|
+
const o = e === "source" ? l : f, t = e === "target", s = { ...q };
|
|
130
|
+
return Object.entries(s).forEach(([r, a]) => {
|
|
129
131
|
[
|
|
130
132
|
"searchPlaceholder",
|
|
131
133
|
"showSearch",
|
|
132
134
|
"showFooter",
|
|
133
135
|
"pagination",
|
|
134
136
|
"listStyle"
|
|
135
|
-
].indexOf(r) > -1 && (s[r] =
|
|
136
|
-
}), /* @__PURE__ */
|
|
137
|
-
|
|
137
|
+
].indexOf(r) > -1 && (s[r] = b(a) ? a[e === "source" ? 0 : 1] : a);
|
|
138
|
+
}), /* @__PURE__ */ m(
|
|
139
|
+
ne,
|
|
138
140
|
{
|
|
139
|
-
...
|
|
141
|
+
...o,
|
|
140
142
|
...s,
|
|
141
143
|
style: s.listStyle,
|
|
142
144
|
prefixCls: c,
|
|
143
145
|
className: `${c}-view-${e}`,
|
|
144
146
|
listType: e,
|
|
145
|
-
title:
|
|
147
|
+
title: z[t ? 1 : 0],
|
|
146
148
|
disabled: y,
|
|
147
149
|
allowClear: t && S,
|
|
148
|
-
renderList:
|
|
149
|
-
handleSelect: (r) =>
|
|
150
|
+
renderList: E,
|
|
151
|
+
handleSelect: (r) => J(r, e),
|
|
150
152
|
handleRemove: (r) => g(t ? "source" : "target", r),
|
|
151
|
-
onSearch: (r) =>
|
|
152
|
-
renderHeaderUnit: (r,
|
|
153
|
+
onSearch: (r) => H?.(r, e),
|
|
154
|
+
renderHeaderUnit: (r, a) => `${S ? "" : `${r} / `}${a}`
|
|
153
155
|
}
|
|
154
156
|
);
|
|
155
157
|
};
|
|
156
|
-
return /* @__PURE__ */
|
|
158
|
+
return /* @__PURE__ */ X(
|
|
157
159
|
"div",
|
|
158
160
|
{
|
|
159
|
-
...ae(
|
|
161
|
+
...ae(C),
|
|
160
162
|
ref: p,
|
|
161
|
-
className:
|
|
163
|
+
className: A(
|
|
162
164
|
c,
|
|
163
165
|
{
|
|
164
166
|
[`${c}-simple`]: n,
|
|
165
167
|
[`${c}-disabled`]: y,
|
|
166
|
-
[`${c}-rtl`]:
|
|
168
|
+
[`${c}-rtl`]: R
|
|
167
169
|
},
|
|
168
|
-
|
|
170
|
+
B
|
|
169
171
|
),
|
|
170
|
-
style:
|
|
172
|
+
style: k,
|
|
171
173
|
children: [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
P("source"),
|
|
175
|
+
Q(),
|
|
176
|
+
P("target")
|
|
175
177
|
]
|
|
176
178
|
}
|
|
177
179
|
);
|
|
178
180
|
}
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
+
const ie = te.forwardRef(de);
|
|
182
|
+
ie.displayName = "Transfer";
|
|
181
183
|
export {
|
|
182
|
-
|
|
184
|
+
ie as default
|
|
183
185
|
};
|
package/trigger/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { jsx as P, jsxs as De } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import ro from "../dist/react-transition-group/src/CSSTransition.js";
|
|
3
3
|
import "../dist/react-transition-group/src/ReplaceTransition.js";
|
|
4
4
|
import "../dist/react-transition-group/src/SwitchTransition.js";
|
|
5
5
|
import "../dist/react-transition-group/chunk/CPfP7aNL.js";
|
|
6
6
|
import "../dist/react-transition-group/src/TransitionGroup.js";
|
|
7
|
-
import
|
|
7
|
+
import xe from "lodash/isArray";
|
|
8
8
|
import D from "lodash/isFunction";
|
|
9
|
-
import { forwardRef as io, useContext as so, useRef as L, useState as uo, Children as
|
|
9
|
+
import { forwardRef as io, useContext as so, useRef as L, useState as uo, Children as Me, useCallback as Se, cloneElement as Oe, useImperativeHandle as co, useLayoutEffect as lo, useEffect as g, Fragment as po } from "react";
|
|
10
10
|
import { createPortal as ao } from "react-dom";
|
|
11
11
|
import "../config-provider/ConfigProvider.js";
|
|
12
12
|
import R from "@unicom-cloud/utils/class-name";
|
|
13
|
-
import { on as G, off as J, getScrollElements as fo, isScrollElement as mo, contains as
|
|
13
|
+
import { on as G, off as J, getScrollElements as fo, isScrollElement as mo, contains as ve } from "../components/common/utils/dom.js";
|
|
14
14
|
import { supportRef as go } from "../components/common/utils/is.js";
|
|
15
|
-
import { Esc as
|
|
15
|
+
import { Esc as be } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
16
16
|
import { mergeProps as yo } from "../components/common/utils/mergeProps.js";
|
|
17
17
|
import { pickDataAttributes as To } from "../components/common/utils/pick.js";
|
|
18
18
|
import { callbackOriginRef as Co, findDOMNode_ as Po } from "../components/common/utils/reactDOM.js";
|
|
19
19
|
import { resizeObserver as Z } from "../components/common/utils/resizeObserver.js";
|
|
20
|
-
import { throttleByRaf as
|
|
20
|
+
import { throttleByRaf as Ne } from "../components/common/utils/throttleByRaf.js";
|
|
21
21
|
import ho, { getBoundingClientRect as Eo } from "./getPopupStyle.js";
|
|
22
22
|
import wo from "../config-provider/context.js";
|
|
23
23
|
import { isPlainObject as ee } from "@unicom-cloud/utils/is";
|
|
24
24
|
function Do(d, $) {
|
|
25
25
|
if (!d)
|
|
26
26
|
return {};
|
|
27
|
-
const { width: y, height: x, left: T, right:
|
|
27
|
+
const { width: y, height: x, left: T, right: z } = Eo(d, $);
|
|
28
28
|
return {
|
|
29
29
|
width: y,
|
|
30
30
|
height: x,
|
|
31
31
|
left: T,
|
|
32
|
-
right:
|
|
32
|
+
right: z
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const Go = [
|
|
@@ -70,24 +70,24 @@ const Mo = {
|
|
|
70
70
|
updateOnScroll: !0
|
|
71
71
|
};
|
|
72
72
|
function So(d, $) {
|
|
73
|
-
const y = so(wo), { getPrefixCls: x, zIndex: T, rtl:
|
|
73
|
+
const y = so(wo), { getPrefixCls: x, zIndex: T, rtl: z } = y, i = u(d), {
|
|
74
74
|
children: oe,
|
|
75
75
|
style: te,
|
|
76
|
-
className:
|
|
76
|
+
className: $e,
|
|
77
77
|
arrowProps: _,
|
|
78
78
|
disabled: M,
|
|
79
|
-
popup:
|
|
80
|
-
classNames:
|
|
81
|
-
duration:
|
|
79
|
+
popup: ke,
|
|
80
|
+
classNames: A,
|
|
81
|
+
duration: He,
|
|
82
82
|
unmountOnExit: ne,
|
|
83
|
-
alignPoint:
|
|
84
|
-
autoAlignPopupWidth:
|
|
85
|
-
position:
|
|
83
|
+
alignPoint: Ie,
|
|
84
|
+
autoAlignPopupWidth: Le,
|
|
85
|
+
position: _e,
|
|
86
86
|
childrenPrefix: h,
|
|
87
|
-
showArrow:
|
|
87
|
+
showArrow: Be,
|
|
88
88
|
popupStyle: re,
|
|
89
|
-
__onExit:
|
|
90
|
-
__onExited:
|
|
89
|
+
__onExit: Ve,
|
|
90
|
+
__onExited: Fe
|
|
91
91
|
} = i, ie = oe || oe === 0, a = L(null), S = L(null), se = L(null), ue = L(null), t = L({
|
|
92
92
|
rootElement: void 0,
|
|
93
93
|
triggerDestoried: !1,
|
|
@@ -109,22 +109,22 @@ function So(d, $) {
|
|
|
109
109
|
// 保存当前节点到弹出容器间的所有滚动元素
|
|
110
110
|
delayTimeoutID: -1,
|
|
111
111
|
updatePositionTimeoutID: -1
|
|
112
|
-
}), [Y, O] = uo({ popupVisible: !1, popupStyle: {} }), K = i.popupVisible,
|
|
112
|
+
}), [Y, O] = uo({ popupVisible: !1, popupStyle: {} }), K = i.popupVisible, Re = Y.popupVisible, s = K ?? Re, l = {}, Q = {
|
|
113
113
|
onMouseDown() {
|
|
114
114
|
t.current.hasPopupMouseDown = !0, setTimeout(() => {
|
|
115
115
|
t.current.hasPopupMouseDown = !1;
|
|
116
116
|
}, 0);
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
I() && !M ? (l.onMouseEnter =
|
|
120
|
-
const k = V(), H =
|
|
119
|
+
I() && !M ? (l.onMouseEnter = Xe, l.onMouseLeave = ge, U() && (l.onClick = ye), Ie && (l.onMouseMove = Ue), Ye() || (Q.onMouseEnter = je, Q.onMouseLeave = qe)) : (l.onMouseEnter = w("onMouseEnter"), l.onMouseLeave = w("onMouseLeave")), le() && !M ? (l.onContextMenu = Ge, l.onClick = ye) : l.onContextMenu = w("onContextMenu"), ce() && !M ? l.onClick = Je : l.onClick = l.onClick || w("onClick"), X() && !M ? (l.onFocus = Ze, pe() && (l.onBlur = eo)) : (l.onFocus = w("onFocus"), l.onBlur = w("onBlur")), M ? l.onKeyDown = w("onKeyDown") : l.onKeyDown = Qe;
|
|
120
|
+
const k = V(), H = Me.only(ke?.());
|
|
121
121
|
k.props.className && (l.className = k.props.className), h && s && (l.className = R(l.className, `${h}-open`)), X() && (l.tabIndex = M ? -1 : 0);
|
|
122
|
-
const v = x?.("trigger"),
|
|
122
|
+
const v = x?.("trigger"), ze = R(
|
|
123
123
|
v,
|
|
124
124
|
h,
|
|
125
|
-
`${v}-position-${
|
|
126
|
-
{ [`${v}-rtl`]:
|
|
127
|
-
|
|
125
|
+
`${v}-position-${_e}`,
|
|
126
|
+
{ [`${v}-rtl`]: z },
|
|
127
|
+
$e
|
|
128
128
|
);
|
|
129
129
|
function u(e) {
|
|
130
130
|
const { componentConfig: o } = y ?? {};
|
|
@@ -132,7 +132,7 @@ function So(d, $) {
|
|
|
132
132
|
ee(e) ? e : d,
|
|
133
133
|
Mo,
|
|
134
134
|
o?.Trigger ?? {},
|
|
135
|
-
|
|
135
|
+
xe(e) ? e : void 0
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
function b() {
|
|
@@ -141,8 +141,8 @@ function So(d, $) {
|
|
|
141
141
|
);
|
|
142
142
|
return t.current.rootElement = e, e;
|
|
143
143
|
}
|
|
144
|
-
const W =
|
|
145
|
-
|
|
144
|
+
const W = Se(
|
|
145
|
+
Ne(() => {
|
|
146
146
|
N();
|
|
147
147
|
}),
|
|
148
148
|
[s]
|
|
@@ -166,7 +166,7 @@ function So(d, $) {
|
|
|
166
166
|
function Ae() {
|
|
167
167
|
return I() && u(["mouseLeaveToClose"]).mouseLeaveToClose;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function Ye() {
|
|
170
170
|
return I() && !u(["popupHoverStay"]).popupHoverStay;
|
|
171
171
|
}
|
|
172
172
|
function U() {
|
|
@@ -179,7 +179,7 @@ function So(d, $) {
|
|
|
179
179
|
function pe() {
|
|
180
180
|
return X() && u(["blurToHide"]).blurToHide;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Ke() {
|
|
183
183
|
t.current.updatePositionTimeoutID && (t.current.updatePositionTimeoutID.cancel ? t.current.updatePositionTimeoutID.cancel() : (clearTimeout(t.current.updatePositionTimeoutID), t.current.updatePositionTimeoutID = null)), E();
|
|
184
184
|
}
|
|
185
185
|
function ae(e) {
|
|
@@ -263,7 +263,7 @@ function So(d, $) {
|
|
|
263
263
|
e();
|
|
264
264
|
}, 0);
|
|
265
265
|
}
|
|
266
|
-
const B =
|
|
266
|
+
const B = Se(Ne(C), [
|
|
267
267
|
s
|
|
268
268
|
]);
|
|
269
269
|
function N(e = 0, o) {
|
|
@@ -306,32 +306,32 @@ function So(d, $) {
|
|
|
306
306
|
}
|
|
307
307
|
function me(e) {
|
|
308
308
|
const o = u(["onClickOutside", "clickOutsideToClose"]);
|
|
309
|
-
let n =
|
|
310
|
-
n ||=
|
|
309
|
+
let n = ve(a.current, e.target);
|
|
310
|
+
n ||= ve(b(), e.target), n ||= !!t.current.hasPopupMouseDown, n || (o.onClickOutside?.(), o.clickOutsideToClose && (pe() || I() || f(!1)));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function Qe(e) {
|
|
313
313
|
const o = e.key;
|
|
314
|
-
m("onKeyDown", e), o ===
|
|
314
|
+
m("onKeyDown", e), o === be.key && We(e);
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function We(e) {
|
|
317
317
|
const { escToClose: o } = u(["escToClose"]);
|
|
318
|
-
o && e && e.key ===
|
|
318
|
+
o && e && e.key === be.key && s && f(!1);
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Xe(e) {
|
|
321
321
|
const { mouseEnterDelay: o } = u(["mouseEnterDelay"]);
|
|
322
322
|
m("onMouseEnter", e), E(), f(!0, o || 0);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Ue(e) {
|
|
325
325
|
m("onMouseMove", e), q(e), s && B();
|
|
326
326
|
}
|
|
327
327
|
function ge(e) {
|
|
328
328
|
const { mouseLeaveDelay: o } = u(["mouseLeaveDelay"]);
|
|
329
329
|
E(), m("onMouseLeave", e), Ae() && s && f(!1, o || 0);
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function je() {
|
|
332
332
|
E();
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function qe(e) {
|
|
335
335
|
ge(e);
|
|
336
336
|
}
|
|
337
337
|
function q(e) {
|
|
@@ -340,22 +340,22 @@ function So(d, $) {
|
|
|
340
340
|
clientY: e.clientY
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Ge(e) {
|
|
344
344
|
e.preventDefault(), m("onContextMenu", e), q(e), s ? u(["alignPoint"]).alignPoint && B() : f(!0, 0);
|
|
345
345
|
}
|
|
346
346
|
function ye(e) {
|
|
347
347
|
s && (t.current.mousedownToHide = !0), m("onClick", e), U() && s && f(!s, 0);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Je(e) {
|
|
350
350
|
s && (t.current.mousedownToHide = !0), m("onClick", e), q(e), !(!U() && s) && f(!s, 0);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Ze(e) {
|
|
353
353
|
const { focusDelay: o } = u(["focusDelay"]), n = () => {
|
|
354
354
|
m("onFocus", e);
|
|
355
355
|
};
|
|
356
356
|
E(), t.current.mousedownToHide || (s ? n?.() : f(!0, o || 0, n)), t.current.mousedownToHide = !1;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function eo(e) {
|
|
359
359
|
f(!1, 200, () => m("onBlur", e));
|
|
360
360
|
}
|
|
361
361
|
function Te() {
|
|
@@ -364,7 +364,7 @@ function So(d, $) {
|
|
|
364
364
|
function V() {
|
|
365
365
|
const { children: e } = i, o = e, n = o && typeof o != "string" && o.type;
|
|
366
366
|
let r = e;
|
|
367
|
-
if (["string", "number"].indexOf(typeof e) > -1 ||
|
|
367
|
+
if (["string", "number"].indexOf(typeof e) > -1 || Me.count(e) > 1)
|
|
368
368
|
r = /* @__PURE__ */ P("span", { children: e });
|
|
369
369
|
else if (o && n && (n.__PQB_BUTTON === !0 || n.__PQB_CHECKBOX === !0 || n.__PQB_SWITCH === !0 || n.__PQB_RADIO === !0 || n === "button") && o.props.disabled) {
|
|
370
370
|
const { picked: c, omitted: p } = xo(o.props.style, [
|
|
@@ -382,7 +382,7 @@ function So(d, $) {
|
|
|
382
382
|
{
|
|
383
383
|
className: o.props?.className,
|
|
384
384
|
style: { display: "inline-block", ...c, cursor: "not-allowed" },
|
|
385
|
-
children:
|
|
385
|
+
children: Oe(o, {
|
|
386
386
|
style: {
|
|
387
387
|
...p,
|
|
388
388
|
pointerEvents: "none"
|
|
@@ -408,11 +408,11 @@ function So(d, $) {
|
|
|
408
408
|
const e = u(["containerScrollToClose", "updateOnScroll"]);
|
|
409
409
|
e.containerScrollToClose ? f(!1) : e.updateOnScroll && N();
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function oo() {
|
|
412
412
|
t.current.scrollElements || (t.current.scrollElements = fo(
|
|
413
413
|
b()
|
|
414
414
|
// refPopupContainer.current.parentNode as HTMLElement,
|
|
415
|
-
),
|
|
415
|
+
), xe(t.current.scrollElements) && (i.containerScrollToClose && S.current?.parentNode === document.body && t.current.scrollElements.indexOf(document.body) === -1 && mo(document.documentElement) && t.current.scrollElements.push(window), t.current.scrollElements.forEach((e) => {
|
|
416
416
|
G(e, "scroll", Ce);
|
|
417
417
|
})));
|
|
418
418
|
}
|
|
@@ -471,7 +471,7 @@ function So(d, $) {
|
|
|
471
471
|
i.alignPoint,
|
|
472
472
|
i.boundaryDistance,
|
|
473
473
|
i.position
|
|
474
|
-
]), g(() => (s && (i.updateOnScroll || i.containerScrollToClose ?
|
|
474
|
+
]), g(() => (s && (i.updateOnScroll || i.containerScrollToClose ? oo() : (N(), Pe())), () => {
|
|
475
475
|
Pe();
|
|
476
476
|
}), [
|
|
477
477
|
s,
|
|
@@ -499,30 +499,30 @@ function So(d, $) {
|
|
|
499
499
|
return o.popupVisible = !!K, o;
|
|
500
500
|
}), () => {
|
|
501
501
|
}), [K]), g(() => () => {
|
|
502
|
-
|
|
502
|
+
Ke();
|
|
503
503
|
}, []);
|
|
504
|
-
const
|
|
504
|
+
const to = ie && Oe(k, {
|
|
505
505
|
...l,
|
|
506
506
|
ref: go(k) ? (e) => {
|
|
507
507
|
t.current.child = e, Co(k, e);
|
|
508
508
|
} : void 0
|
|
509
|
-
}),
|
|
510
|
-
|
|
509
|
+
}), no = /* @__PURE__ */ P(
|
|
510
|
+
ro,
|
|
511
511
|
{
|
|
512
512
|
in: !!s,
|
|
513
|
-
timeout:
|
|
514
|
-
classNames:
|
|
513
|
+
timeout: He,
|
|
514
|
+
classNames: A,
|
|
515
515
|
unmountOnExit: ne,
|
|
516
516
|
appear: !0,
|
|
517
517
|
mountOnEnter: !0,
|
|
518
518
|
onEnter: () => {
|
|
519
519
|
t.current.triggerDestoried = !1;
|
|
520
520
|
const e = a.current;
|
|
521
|
-
e && (e.style.display = "initial", e.style.pointerEvents = "none",
|
|
521
|
+
e && (e.style.display = "initial", e.style.pointerEvents = "none", A === "slideDynamicOrigin" && (e.style.transform = fe()), C());
|
|
522
522
|
},
|
|
523
523
|
onEntering: () => {
|
|
524
524
|
const e = a.current;
|
|
525
|
-
e && (
|
|
525
|
+
e && (A === "slideDynamicOrigin" && (e.style.transform = ""), C());
|
|
526
526
|
},
|
|
527
527
|
onEntered: () => {
|
|
528
528
|
const e = a.current;
|
|
@@ -530,14 +530,14 @@ function So(d, $) {
|
|
|
530
530
|
},
|
|
531
531
|
onExit: () => {
|
|
532
532
|
const e = a.current;
|
|
533
|
-
e && (e.style.pointerEvents = "none",
|
|
533
|
+
e && (e.style.pointerEvents = "none", Ve?.(e));
|
|
534
534
|
},
|
|
535
535
|
onExited: () => {
|
|
536
536
|
const e = a.current;
|
|
537
537
|
e && (e.style.display = "none", ne && (t.current.triggerDestoried = !0), O((o) => {
|
|
538
538
|
const n = { ...o };
|
|
539
539
|
return n.popupStyle = {}, n;
|
|
540
|
-
}),
|
|
540
|
+
}), Fe?.(e));
|
|
541
541
|
},
|
|
542
542
|
nodeRef: a,
|
|
543
543
|
children: /* @__PURE__ */ De(
|
|
@@ -547,7 +547,7 @@ function So(d, $) {
|
|
|
547
547
|
"trigger-placement": t.current.realPosition,
|
|
548
548
|
...To(i),
|
|
549
549
|
style: {
|
|
550
|
-
width:
|
|
550
|
+
width: Le && te?.width === void 0 ? t.current.childrenDomSize?.width : "",
|
|
551
551
|
...Y.popupStyle,
|
|
552
552
|
position: "absolute",
|
|
553
553
|
zIndex: T || "",
|
|
@@ -555,7 +555,7 @@ function So(d, $) {
|
|
|
555
555
|
// display
|
|
556
556
|
},
|
|
557
557
|
...Q,
|
|
558
|
-
className:
|
|
558
|
+
className: ze,
|
|
559
559
|
children: [
|
|
560
560
|
ee(re) ? /* @__PURE__ */ P(
|
|
561
561
|
H.type,
|
|
@@ -565,7 +565,7 @@ function So(d, $) {
|
|
|
565
565
|
style: { ...H.props.style, ...re }
|
|
566
566
|
}
|
|
567
567
|
) : H,
|
|
568
|
-
(
|
|
568
|
+
(Be || _) && /* @__PURE__ */ P(
|
|
569
569
|
"div",
|
|
570
570
|
{
|
|
571
571
|
ref: se,
|
|
@@ -600,14 +600,14 @@ function So(d, $) {
|
|
|
600
600
|
if (D(e)) {
|
|
601
601
|
const o = e(b());
|
|
602
602
|
o && (F = ao(
|
|
603
|
-
/* @__PURE__ */ P("div", { ref: S, className: `${v}-container`, children:
|
|
603
|
+
/* @__PURE__ */ P("div", { ref: S, className: `${v}-container`, children: no }),
|
|
604
604
|
o
|
|
605
605
|
// popupVisible ? 1 : 0,
|
|
606
606
|
));
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
return ie && (F = /* @__PURE__ */ De(po, { children: [
|
|
610
|
-
|
|
610
|
+
to,
|
|
611
611
|
F
|
|
612
612
|
] })), F;
|
|
613
613
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Development 组件的属性类型定义
|
|
4
4
|
* @property {string} [url] - 图片 URL,如果有则显示图片而不是图标
|
|
5
|
-
* @property {
|
|
5
|
+
* @property {ReactNode} [icon] - 自定义图标,会覆盖默认的等待图标
|
|
6
6
|
* @property {string} [label] - 提示文字,默认为"等待开发"
|
|
7
7
|
* @property {string} [tip] - 提示文字别名,优先级低于 label
|
|
8
8
|
* @property {string} [className] - 根节点类名
|
|
@@ -12,7 +12,7 @@ import React from 'react';
|
|
|
12
12
|
*/
|
|
13
13
|
export interface DevelopmentProps {
|
|
14
14
|
url?: string;
|
|
15
|
-
icon?:
|
|
15
|
+
icon?: ReactNode;
|
|
16
16
|
label?: string;
|
|
17
17
|
tip?: string;
|
|
18
18
|
className?: string;
|