@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/button/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import R, { forwardRef as
|
|
1
|
+
import { jsx as l, jsxs as A, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import Q from "@unicom-cloud/icons/IconUiLoading";
|
|
3
|
+
import R, { forwardRef as W, useContext as Y, useState as H, useRef as J, useEffect as K } from "react";
|
|
4
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
function
|
|
5
|
+
import V from "../components/common/hooks/useMergeProps.js";
|
|
6
|
+
import X from "@unicom-cloud/utils/class-name";
|
|
7
|
+
import Z from "./Group.js";
|
|
8
|
+
import tt from "../config-provider/context.js";
|
|
9
|
+
const et = /^[\u4e00-\u9fa5]{2}$/;
|
|
10
|
+
function nt(u) {
|
|
11
11
|
const o = [];
|
|
12
12
|
let i = !1;
|
|
13
|
-
return R.Children.forEach(
|
|
13
|
+
return R.Children.forEach(u, (e) => {
|
|
14
14
|
const r = typeof e == "string" || typeof e == "number";
|
|
15
15
|
if (r && i) {
|
|
16
|
-
const a = o.length - 1,
|
|
17
|
-
o[a] = `${
|
|
16
|
+
const a = o.length - 1, f = o[a];
|
|
17
|
+
o[a] = `${f}${e}`;
|
|
18
18
|
} else
|
|
19
19
|
o.push(e);
|
|
20
20
|
i = r;
|
|
@@ -23,21 +23,22 @@ function et(f) {
|
|
|
23
23
|
(e) => typeof e == "string" ? /* @__PURE__ */ l("span", { children: e }) : e
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const ot = {
|
|
27
27
|
htmlType: "button",
|
|
28
28
|
type: "default",
|
|
29
|
-
shape: "square"
|
|
29
|
+
shape: "square",
|
|
30
|
+
size: "medium"
|
|
30
31
|
};
|
|
31
|
-
function
|
|
32
|
+
function st(u, o) {
|
|
32
33
|
const {
|
|
33
34
|
getPrefixCls: i,
|
|
34
35
|
size: e,
|
|
35
36
|
autoInsertSpaceInButton: r,
|
|
36
37
|
componentConfig: a,
|
|
37
|
-
rtl:
|
|
38
|
-
} =
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
rtl: f
|
|
39
|
+
} = Y(tt), _ = V(
|
|
40
|
+
u,
|
|
41
|
+
ot,
|
|
41
42
|
a?.Button
|
|
42
43
|
), {
|
|
43
44
|
style: g,
|
|
@@ -46,10 +47,10 @@ function ot(f, o) {
|
|
|
46
47
|
htmlType: S,
|
|
47
48
|
type: x,
|
|
48
49
|
status: y,
|
|
49
|
-
size:
|
|
50
|
-
shape:
|
|
50
|
+
size: N = "medium",
|
|
51
|
+
shape: k,
|
|
51
52
|
href: d,
|
|
52
|
-
anchorProps:
|
|
53
|
+
anchorProps: U,
|
|
53
54
|
disabled: c,
|
|
54
55
|
loading: m,
|
|
55
56
|
loadingFixedWidth: O,
|
|
@@ -59,56 +60,56 @@ function ot(f, o) {
|
|
|
59
60
|
iconRight: j,
|
|
60
61
|
onClick: D,
|
|
61
62
|
long: L,
|
|
62
|
-
...
|
|
63
|
-
} = _,
|
|
64
|
-
|
|
63
|
+
...T
|
|
64
|
+
} = _, q = N === "default" ? "medium" : N, B = m ? /* @__PURE__ */ l(Q, {}) : E, [h, P] = H(!1), v = J(), s = o || v;
|
|
65
|
+
K(() => {
|
|
65
66
|
if (r && s && s.current) {
|
|
66
67
|
const n = s.current.textContent;
|
|
67
|
-
|
|
68
|
+
et.test(n) ? h || P(!0) : h && P(!1);
|
|
68
69
|
}
|
|
69
70
|
}, [s.current, r]);
|
|
70
|
-
const t = i?.("btn"), C = x === "default" ? "secondary" : x,
|
|
71
|
+
const t = i?.("btn"), C = x === "default" ? "secondary" : x, w = X(
|
|
71
72
|
t,
|
|
72
73
|
C === "text-only" && `${t}-text`,
|
|
73
74
|
`${t}-${C}`,
|
|
74
|
-
C !== "text-only" && `${t}-size-${
|
|
75
|
-
`${t}-shape-${
|
|
75
|
+
C !== "text-only" && `${t}-size-${q || e}`,
|
|
76
|
+
`${t}-shape-${k}`,
|
|
76
77
|
{
|
|
77
78
|
[`${t}-long`]: L,
|
|
78
79
|
[`${t}-status-${y}`]: y,
|
|
79
80
|
[`${t}-loading-fixed-width`]: O,
|
|
80
81
|
[`${t}-loading`]: m,
|
|
81
82
|
[`${t}-link`]: d,
|
|
82
|
-
[`${t}-icon-only`]: F || !p && p !== 0 &&
|
|
83
|
+
[`${t}-icon-only`]: F || !p && p !== 0 && B,
|
|
83
84
|
[`${t}-disabled`]: c,
|
|
84
85
|
[`${t}-two-chinese-chars`]: h,
|
|
85
|
-
[`${t}-rtl`]:
|
|
86
|
+
[`${t}-rtl`]: f
|
|
86
87
|
},
|
|
87
88
|
I
|
|
88
|
-
),
|
|
89
|
+
), b = (n) => {
|
|
89
90
|
if (m || c) {
|
|
90
91
|
typeof n?.preventDefault == "function" && n.preventDefault();
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
D?.(n);
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
}, z = /* @__PURE__ */ A(M, { children: [
|
|
96
|
+
B,
|
|
97
|
+
nt(p),
|
|
97
98
|
j,
|
|
98
99
|
G
|
|
99
100
|
] });
|
|
100
101
|
if (d) {
|
|
101
|
-
const n = { ...
|
|
102
|
+
const n = { ...U };
|
|
102
103
|
return c ? delete n.href : n.href = d, /* @__PURE__ */ l(
|
|
103
104
|
"a",
|
|
104
105
|
{
|
|
105
106
|
ref: s,
|
|
106
|
-
...
|
|
107
|
+
...T,
|
|
107
108
|
...n,
|
|
108
109
|
style: g,
|
|
109
|
-
className:
|
|
110
|
-
onClick:
|
|
111
|
-
children:
|
|
110
|
+
className: w,
|
|
111
|
+
onClick: b,
|
|
112
|
+
children: z
|
|
112
113
|
}
|
|
113
114
|
);
|
|
114
115
|
}
|
|
@@ -116,21 +117,21 @@ function ot(f, o) {
|
|
|
116
117
|
"button",
|
|
117
118
|
{
|
|
118
119
|
ref: s,
|
|
119
|
-
...
|
|
120
|
+
...T,
|
|
120
121
|
style: g,
|
|
121
|
-
className:
|
|
122
|
+
className: w,
|
|
122
123
|
type: S,
|
|
123
124
|
disabled: c,
|
|
124
|
-
onClick:
|
|
125
|
-
children:
|
|
125
|
+
onClick: b,
|
|
126
|
+
children: z
|
|
126
127
|
}
|
|
127
128
|
);
|
|
128
129
|
}
|
|
129
|
-
const
|
|
130
|
+
const rt = W(st), $ = rt;
|
|
130
131
|
$.__PQB_BUTTON = !0;
|
|
131
|
-
$.Group =
|
|
132
|
+
$.Group = Z;
|
|
132
133
|
$.displayName = "Button";
|
|
133
|
-
const
|
|
134
|
+
const mt = [
|
|
134
135
|
"default",
|
|
135
136
|
"primary",
|
|
136
137
|
"secondary",
|
|
@@ -138,10 +139,10 @@ const dt = [
|
|
|
138
139
|
"text",
|
|
139
140
|
"text-only",
|
|
140
141
|
"outline"
|
|
141
|
-
],
|
|
142
|
+
], ht = ["warning", "danger", "success", "processing", "default"];
|
|
142
143
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
ht as BUTTON_STATUS,
|
|
145
|
+
mt as BUTTON_TYPE,
|
|
146
|
+
Z as ButtonGroup,
|
|
146
147
|
$ as default
|
|
147
148
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { LunarUtil as m, SolarUtil as g, Solar as u, Lunar as C } from "@unicom-cloud/utils/lunar";
|
|
3
|
+
import { useEffect as I } from "react";
|
|
4
|
+
import E from "./index.js";
|
|
5
|
+
import d from "../flex/index.js";
|
|
6
|
+
import S from "../space/index.js";
|
|
7
|
+
import "../components/common/utils/is.js";
|
|
8
|
+
import { isPlainObject as c } from "@unicom-cloud/utils/is";
|
|
9
|
+
function j(f) {
|
|
10
|
+
const { festival: n } = f;
|
|
11
|
+
return I(() => (c(n?.lunar) && Object.entries(n.lunar).forEach(([e, t], r, i) => {
|
|
12
|
+
m.FESTIVAL[e] = t;
|
|
13
|
+
}), () => {
|
|
14
|
+
c(n?.lunar) && Object.entries(n.lunar).forEach(([e, t], r, i) => {
|
|
15
|
+
delete m.FESTIVAL[e];
|
|
16
|
+
});
|
|
17
|
+
}), [n.lunar]), I(() => (c(n?.solar) && Object.entries(n.solar).forEach(([e, t], r, i) => {
|
|
18
|
+
g.FESTIVAL[e] = t;
|
|
19
|
+
}), () => {
|
|
20
|
+
c(n?.solar) && Object.entries(n.solar).forEach(([e, t], r, i) => {
|
|
21
|
+
delete g.FESTIVAL[e];
|
|
22
|
+
});
|
|
23
|
+
}), [n.solar]), /* @__PURE__ */ a(
|
|
24
|
+
E,
|
|
25
|
+
{
|
|
26
|
+
headerRender: ({
|
|
27
|
+
value: e,
|
|
28
|
+
pageShowDate: t,
|
|
29
|
+
onChangeMode: r,
|
|
30
|
+
onChange: i,
|
|
31
|
+
onChangePageDate: h,
|
|
32
|
+
header: o
|
|
33
|
+
}) => {
|
|
34
|
+
const p = t?.toDate?.(), D = u.fromDate(p), l = C.fromDate(p);
|
|
35
|
+
return /* @__PURE__ */ s(d.Vertical, { children: [
|
|
36
|
+
/* @__PURE__ */ a("div", { children: o }),
|
|
37
|
+
/* @__PURE__ */ s(d, { style: { padding: "0px 24px" }, children: [
|
|
38
|
+
/* @__PURE__ */ a("span", { children: l.getYearInChinese() }),
|
|
39
|
+
/* @__PURE__ */ a("span", { children: l.getYearInGanZhi() }),
|
|
40
|
+
/* @__PURE__ */ a("span", { children: l.getYearShengXiao() }),
|
|
41
|
+
/* @__PURE__ */ s("span", { children: [
|
|
42
|
+
l.getMonthInChinese(),
|
|
43
|
+
"月"
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ a("span", { children: l.getSeason() }),
|
|
46
|
+
/* @__PURE__ */ a("span", { children: D.getXingZuo() })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
},
|
|
50
|
+
dateInnerContent: (e) => {
|
|
51
|
+
const t = u.fromDate(e.toDate()), r = C.fromDate(e.toDate()), i = r.getJieQi(), h = [
|
|
52
|
+
...t.getFestivals(),
|
|
53
|
+
...r.getFestivals()
|
|
54
|
+
// ...solar.getOtherFestivals(),
|
|
55
|
+
// ...lunar.getOtherFestivals(),
|
|
56
|
+
];
|
|
57
|
+
let o = r.getDayInChinese();
|
|
58
|
+
return r.getDay() == 1 && (o = `${r.getMonthInChinese()}月${o}`), /* @__PURE__ */ s(d.Vertical, { gap: 0, children: [
|
|
59
|
+
/* @__PURE__ */ a("span", { children: o }),
|
|
60
|
+
!!h.length && /* @__PURE__ */ a(S, { children: h }),
|
|
61
|
+
!!i && /* @__PURE__ */ a("span", { children: i })
|
|
62
|
+
] });
|
|
63
|
+
},
|
|
64
|
+
...f
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
j.displayName = "LunarComponent";
|
|
69
|
+
export {
|
|
70
|
+
j as default
|
|
71
|
+
};
|
package/calendar/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import de from "../components/common/hooks/useMergeProps.js";
|
|
|
6
6
|
import me from "@unicom-cloud/utils/class-name";
|
|
7
7
|
import { getDayjsValue as u, getNow as A, methods as g } from "../components/common/utils/dayjs.js";
|
|
8
8
|
import { pickDataAttributes as ce } from "../components/common/utils/pick.js";
|
|
9
|
-
import ie
|
|
10
|
-
import
|
|
11
|
-
import he from "./
|
|
12
|
-
import ue from "./
|
|
9
|
+
import ie from "./header/index.js";
|
|
10
|
+
import pe from "./header/Panel.js";
|
|
11
|
+
import fe, { getAllDaysByTime as he } from "./Month.js";
|
|
12
|
+
import ue from "./Year.js";
|
|
13
13
|
import ge from "../config-provider/context.js";
|
|
14
14
|
function ye(m, y) {
|
|
15
15
|
return m === "month" || m === "year" && !y ? "YYYY-MM-DD" : "YYYY-MM";
|
|
@@ -57,7 +57,7 @@ function De(m) {
|
|
|
57
57
|
u(w || _, i)
|
|
58
58
|
), [X, p] = M(
|
|
59
59
|
u(F, i) || Y || A()
|
|
60
|
-
), t = u(R, i) || X, C = "value" in s ? u(w, i) : Y, N = le(() =>
|
|
60
|
+
), t = u(R, i) || X, C = "value" in s ? u(w, i) : Y, N = le(() => he(s, t), [t.toString(), a, W]);
|
|
61
61
|
function f(e) {
|
|
62
62
|
U(e), z?.(e), v(e);
|
|
63
63
|
}
|
|
@@ -100,8 +100,8 @@ function De(m) {
|
|
|
100
100
|
modes: I,
|
|
101
101
|
innerMode: a,
|
|
102
102
|
panelOperations: J
|
|
103
|
-
}, $ = d ? /* @__PURE__ */ r(
|
|
104
|
-
|
|
103
|
+
}, $ = d ? /* @__PURE__ */ r(pe, { ...V }) : /* @__PURE__ */ r(
|
|
104
|
+
ie,
|
|
105
105
|
{
|
|
106
106
|
...V,
|
|
107
107
|
CALENDAR_LOCALE: l,
|
|
@@ -129,7 +129,7 @@ function De(m) {
|
|
|
129
129
|
header: $
|
|
130
130
|
}) : $,
|
|
131
131
|
a === "month" && /* @__PURE__ */ r("div", { className: `${o}-body`, children: /* @__PURE__ */ r(
|
|
132
|
-
|
|
132
|
+
fe,
|
|
133
133
|
{
|
|
134
134
|
...s,
|
|
135
135
|
prefixCls: o,
|
|
@@ -142,7 +142,7 @@ function De(m) {
|
|
|
142
142
|
}
|
|
143
143
|
) }),
|
|
144
144
|
a === "year" && /* @__PURE__ */ r("div", { className: `${o}-body`, children: /* @__PURE__ */ r(
|
|
145
|
-
|
|
145
|
+
ue,
|
|
146
146
|
{
|
|
147
147
|
...s,
|
|
148
148
|
prefixCls: o,
|
|
@@ -168,7 +168,7 @@ function De(m) {
|
|
|
168
168
|
}
|
|
169
169
|
De.displayName = "Calendar";
|
|
170
170
|
export {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
fe as CalendarMonth,
|
|
172
|
+
ue as CalendarYear,
|
|
173
173
|
De as default
|
|
174
174
|
};
|
package/cascader/base/node.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import n from "lodash/get";
|
|
2
2
|
import { DefaultFieldNames as _ } from "../Cascader.js";
|
|
3
|
+
import "../../components/common/utils/is.js";
|
|
4
|
+
import { isArray as C } from "@unicom-cloud/utils/is";
|
|
3
5
|
class u {
|
|
4
6
|
value;
|
|
5
7
|
label;
|
|
@@ -27,21 +29,21 @@ class u {
|
|
|
27
29
|
config = {};
|
|
28
30
|
// 保存暴露给外部的属性
|
|
29
31
|
_data;
|
|
30
|
-
constructor(e, t,
|
|
31
|
-
this.config = t || {}, this._initNode(e,
|
|
32
|
+
constructor(e, t, h) {
|
|
33
|
+
this.config = t || {}, this._initNode(e, h || null);
|
|
32
34
|
}
|
|
33
35
|
_initNode = (e, t = null) => {
|
|
34
|
-
const { showEmptyChildren:
|
|
35
|
-
let r =
|
|
36
|
-
|
|
37
|
-
const c = n(e,
|
|
36
|
+
const { showEmptyChildren: h, lazyload: a } = this.config, l = { ..._, ...this.config.fieldNames }, s = n(e, l.children) || e[l.children];
|
|
37
|
+
let r = C(s) ? h ? !1 : s.length === 0 : !0;
|
|
38
|
+
a && (l.isLeaf in e ? r = !!n(e, l.isLeaf) || !!e[l.isLeaf] : r = !1);
|
|
39
|
+
const c = n(e, l.value) || e[l.value], f = n(e, l.label) || e[l.label], d = {
|
|
38
40
|
...e,
|
|
39
41
|
value: c,
|
|
40
42
|
label: f,
|
|
41
43
|
isLeaf: r,
|
|
42
44
|
loading: !1,
|
|
43
45
|
loaded: !1,
|
|
44
|
-
disabled: t && t.disabled || n(e,
|
|
46
|
+
disabled: t && t.disabled || n(e, l.disabled) || e[l.disabled],
|
|
45
47
|
parent: t,
|
|
46
48
|
pathValue: t ? [...t.pathValue, c] : [c],
|
|
47
49
|
pathLabel: t ? [...t.pathLabel, f] : [f],
|
|
@@ -62,9 +64,9 @@ class u {
|
|
|
62
64
|
* 那么只有当前节点的所有children加起来等于children.length,才是全选,否则和大于0,就是半选。
|
|
63
65
|
*/
|
|
64
66
|
_isHalfChecked = () => {
|
|
65
|
-
const e = this.children.reduce((t,
|
|
66
|
-
const
|
|
67
|
-
return t +
|
|
67
|
+
const e = this.children.reduce((t, h) => {
|
|
68
|
+
const a = h._halfChecked ? 0.5 : h._checked ? 1 : 0;
|
|
69
|
+
return t + a;
|
|
68
70
|
}, 0);
|
|
69
71
|
return e !== this.children.length && e > 0;
|
|
70
72
|
};
|
|
@@ -74,18 +76,18 @@ class u {
|
|
|
74
76
|
* @param ignoreDisabled 是否忽略节点禁用设置选中状态,一般在初始化设置选中状态时传参为true
|
|
75
77
|
*/
|
|
76
78
|
_setNodeChildrenChecked = (e, t) => {
|
|
77
|
-
!t && this.disabled || this.children && this.children.length && (this.children.forEach((
|
|
78
|
-
|
|
79
|
+
!t && this.disabled || this.children && this.children.length && (this.children.forEach((h) => {
|
|
80
|
+
h.disabled ? t && h.setCheckedStateIgnoreDisabled(e) : h.setCheckedState(e);
|
|
79
81
|
}), this.updateHalfState(e));
|
|
80
82
|
};
|
|
81
83
|
getSelfChildrenValue = () => {
|
|
82
|
-
const e = [], t = (
|
|
83
|
-
if (!
|
|
84
|
-
e.push(
|
|
84
|
+
const e = [], t = (h, a) => {
|
|
85
|
+
if (!a || !a.length) {
|
|
86
|
+
e.push(h);
|
|
85
87
|
return;
|
|
86
88
|
}
|
|
87
|
-
(
|
|
88
|
-
t(
|
|
89
|
+
(a || []).forEach((l) => {
|
|
90
|
+
t(l.pathValue, l.children);
|
|
89
91
|
});
|
|
90
92
|
};
|
|
91
93
|
return t(this.pathValue, this.children), e;
|
|
@@ -102,9 +104,9 @@ class u {
|
|
|
102
104
|
const t = e ? this._checked : !this._checked && !this._halfChecked;
|
|
103
105
|
if (!(this.disabled || t) && (this.setCheckedProperty(e), !this.config.changeOnSelect)) {
|
|
104
106
|
this._setNodeChildrenChecked(e);
|
|
105
|
-
let
|
|
106
|
-
for (;
|
|
107
|
-
|
|
107
|
+
let h = this.parent;
|
|
108
|
+
for (; h && !h.disabled; )
|
|
109
|
+
h.updateHalfState(e), h = h.parent;
|
|
108
110
|
}
|
|
109
111
|
};
|
|
110
112
|
// 忽略禁用设置选中状态
|
package/cascader/base/store.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "lodash/isArray";
|
|
2
2
|
import f from "lodash/isEqualWith";
|
|
3
3
|
import l from "lodash/isFunction";
|
|
4
4
|
import c from "lodash/isString";
|
|
5
|
-
import { transformValuesToSet as d, valueInSet as
|
|
5
|
+
import { transformValuesToSet as d, valueInSet as h } from "../util.js";
|
|
6
6
|
import u from "./node.js";
|
|
7
|
-
class
|
|
7
|
+
class C {
|
|
8
8
|
nodes = [];
|
|
9
9
|
flatNodes = [];
|
|
10
10
|
config = {};
|
|
11
11
|
constructor(e, t, s) {
|
|
12
12
|
this.config = { ...s };
|
|
13
|
-
const r =
|
|
13
|
+
const r = o(t) ? t : [];
|
|
14
14
|
this.nodes = this._calcNodes(e, null), this._updateFlatNodes(), this.setNodeCheckedByValue(r);
|
|
15
15
|
}
|
|
16
16
|
// 初始化节点状态,附加状态信息字段: _checked,_halfChecked,parent,disabled
|
|
@@ -20,7 +20,7 @@ class S {
|
|
|
20
20
|
const e = !this.config.changeOnSelect;
|
|
21
21
|
this.flatNodes = [];
|
|
22
22
|
const t = (s) => {
|
|
23
|
-
s && ((!e || s.isLeaf) && this.flatNodes.push(s),
|
|
23
|
+
s && ((!e || s.isLeaf) && this.flatNodes.push(s), o(s.children) && s.children.forEach((r) => {
|
|
24
24
|
t(r);
|
|
25
25
|
}));
|
|
26
26
|
};
|
|
@@ -38,8 +38,8 @@ class S {
|
|
|
38
38
|
this.flatNodes.forEach((s) => {
|
|
39
39
|
let r = !1;
|
|
40
40
|
this.config.showParent ? s.pathValue.some(
|
|
41
|
-
(
|
|
42
|
-
) && (r = !0) :
|
|
41
|
+
(i, a, n) => h(t, n.slice(0, a + 1))
|
|
42
|
+
) && (r = !0) : h(t, s.pathValue) && (r = !0), s.setCheckedStateIgnoreDisabled(r);
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -67,8 +67,8 @@ class S {
|
|
|
67
67
|
searchNodeByLabel = (e) => {
|
|
68
68
|
if (!e)
|
|
69
69
|
return this.flatNodes;
|
|
70
|
-
const { filterOption: t } = this.config, s = l(t) ? t : (r,
|
|
71
|
-
return this.flatNodes.filter((r) => r.getPathNodes().some((
|
|
70
|
+
const { filterOption: t } = this.config, s = l(t) ? t : (r, i) => c(i.label) && i.label.indexOf(r) > -1;
|
|
71
|
+
return this.flatNodes.filter((r) => r.getPathNodes().some((a) => s(e, a._data)));
|
|
72
72
|
};
|
|
73
73
|
/** 获取所有节点 */
|
|
74
74
|
getOptions = () => this.nodes;
|
|
@@ -86,5 +86,5 @@ class S {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
export {
|
|
89
|
-
|
|
89
|
+
C as default
|
|
90
90
|
};
|
package/cascader/util.js
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "../components/common/utils/is.js";
|
|
2
|
+
import C from "./base/store.js";
|
|
3
|
+
import { isArray as V } from "@unicom-cloud/utils/is";
|
|
4
|
+
const a = "__pqb_cascader__", N = "parent", v = "child", E = {
|
|
3
5
|
cascader: "cascader",
|
|
4
6
|
select: "select"
|
|
5
7
|
};
|
|
6
|
-
function
|
|
8
|
+
function w(e) {
|
|
7
9
|
return {
|
|
8
10
|
showEmptyChildren: e.showEmptyChildren,
|
|
9
11
|
changeOnSelect: e.changeOnSelect,
|
|
10
12
|
lazyload: !!e.loadMore,
|
|
11
13
|
fieldNames: e.fieldNames,
|
|
12
14
|
filterOption: e.filterOption,
|
|
13
|
-
showParent: e.mode === "multiple" && !e.changeOnSelect && e.checkedStrategy ===
|
|
15
|
+
showParent: e.mode === "multiple" && !e.changeOnSelect && e.checkedStrategy === N
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
const n = t ?
|
|
18
|
-
return new
|
|
18
|
+
function P(e, t) {
|
|
19
|
+
const n = t ? V(t[0]) ? t : [t] : [];
|
|
20
|
+
return new C(e.options || [], n, w(e));
|
|
19
21
|
}
|
|
20
|
-
const
|
|
22
|
+
const g = (e) => (e || []).reduce((c, o) => (c.add([].concat(o).join(a)), c), /* @__PURE__ */ new Set()), i = (e, t) => {
|
|
21
23
|
const n = t || [];
|
|
22
24
|
return e.has(n.join(a));
|
|
23
|
-
},
|
|
25
|
+
}, b = (e, t) => {
|
|
24
26
|
const n = t || [];
|
|
25
27
|
return e.delete(n.join(a));
|
|
26
|
-
},
|
|
28
|
+
}, A = (e, t, n) => {
|
|
27
29
|
let c = [];
|
|
28
30
|
if (e === void 0 ? c = [] : t ? c = e : c = [e], n && n.config.showParent) {
|
|
29
|
-
const o = n.getCheckedNodes(), h =
|
|
31
|
+
const o = n.getCheckedNodes(), h = g(
|
|
30
32
|
o.map((l) => l.pathValue)
|
|
31
33
|
), f = [], s = {};
|
|
32
34
|
return c.map((l, S, r) => {
|
|
33
|
-
l.some((u, m,
|
|
34
|
-
const d =
|
|
35
|
+
l.some((u, m, k) => {
|
|
36
|
+
const d = k.slice(0, m + 1), _ = i(h, d);
|
|
35
37
|
return _ && !s[d.join(a)] && (f.push(d), s[d.join(a)] = 1), _;
|
|
36
38
|
});
|
|
37
39
|
}), f;
|
|
38
40
|
}
|
|
39
41
|
return c;
|
|
40
|
-
},
|
|
41
|
-
const t = (n) =>
|
|
42
|
+
}, y = (e) => {
|
|
43
|
+
const t = (n) => V(n) ? n.every((c) => c._checked || c.disabled ? !0 : t(c.children)) : !1;
|
|
42
44
|
return e._halfChecked && t(e?.children);
|
|
43
|
-
},
|
|
44
|
-
const o = c &&
|
|
45
|
+
}, H = (e, t, n, c) => {
|
|
46
|
+
const o = c && y(n) ? !1 : c, h = t.getCheckedNodes().reduce((r, u) => (r.add(u.pathValue.join(a)), r), /* @__PURE__ */ new Set());
|
|
45
47
|
n.setCheckedState(o);
|
|
46
|
-
const s = t.getCheckedNodes().map((r) => r.pathValue), l =
|
|
48
|
+
const s = t.getCheckedNodes().map((r) => r.pathValue), l = g(s), S = /* @__PURE__ */ new Set();
|
|
47
49
|
return e.filter((r, u, m) => {
|
|
48
50
|
if (!i(h, r) || i(l, r))
|
|
49
51
|
return S.add(r.join(a)), !0;
|
|
@@ -52,15 +54,15 @@ const V = (e) => (e || []).reduce((c, o) => (c.add([].concat(o).join(a)), c), /*
|
|
|
52
54
|
);
|
|
53
55
|
};
|
|
54
56
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
E as PANEL_MODE,
|
|
58
|
+
v as SHOW_CHILD,
|
|
59
|
+
N as SHOW_PARENT,
|
|
58
60
|
a as ValueSeparator,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
A as formatValue,
|
|
62
|
+
w as getConfig,
|
|
63
|
+
H as getMultipleCheckValue,
|
|
64
|
+
P as getStore,
|
|
65
|
+
b as removeValueFromSet,
|
|
66
|
+
g as transformValuesToSet,
|
|
65
67
|
i as valueInSet
|
|
66
68
|
};
|
package/color-picker/Mode.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import i from "lodash/isArray";
|
|
1
2
|
import { ColorPickerMode as t } from "./interface.js";
|
|
2
|
-
const
|
|
3
|
+
const e = (r) => i(r) && r.length === 1 ? r[0] : r, f = (r) => e(r) === t.Single, d = (r) => e(r) === t.Gradient, s = (r) => i(e(r)), g = (r) => s(r) ? t.Gradient : r, p = (r, n, o) => r && i(r) ? t.Gradient : r && typeof r == "string" ? t.Single : n && i(n) ? t.Gradient : n && typeof n == "string" ? t.Single : g(o);
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
g as getInitialActiveMode,
|
|
6
|
+
e as getMode,
|
|
7
|
+
p as getModeByValue,
|
|
8
|
+
d as isGradientMode,
|
|
9
|
+
s as isMultiMode,
|
|
10
|
+
f as isSingleMode
|
|
10
11
|
};
|