wz-h5-design 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button/index.js +32 -7
- package/dist/Button/index.umd.cjs +1 -1
- package/dist/Button/style/index.css +1 -1
- package/dist/Button/style.css +1 -1
- package/dist/ButtonGroup/index.js +34 -0
- package/dist/ButtonGroup/index.umd.cjs +1 -0
- package/dist/ButtonGroup/style/index.css +1 -0
- package/dist/ButtonGroup/style/index.js +1 -0
- package/dist/ButtonGroup/style.css +1 -0
- package/dist/Cell/index.js +29 -2
- package/dist/Cell/index.umd.cjs +2 -2
- package/dist/Cell/style/index.css +1 -1
- package/dist/Cell/style.css +1 -1
- package/dist/CheckList/index.js +28 -1
- package/dist/CheckList/index.umd.cjs +1 -1
- package/dist/CheckList/style.css +1 -1
- package/dist/Checkbox/index.js +34 -2
- package/dist/Checkbox/index.umd.cjs +1 -1
- package/dist/Checkbox/style/index.css +1 -1
- package/dist/Checkbox/style.css +1 -1
- package/dist/DatePicker/style/index.css +1 -1
- package/dist/DatePicker/style.css +1 -1
- package/dist/DateRangePicker/index.js +65 -9
- package/dist/DateRangePicker/index.umd.cjs +1 -1
- package/dist/DateRangePicker/style/index.css +1 -1
- package/dist/DateRangePicker/style.css +1 -1
- package/dist/Dialog/index.js +32 -7
- package/dist/Dialog/index.umd.cjs +2 -2
- package/dist/Dialog/style.css +1 -1
- package/dist/Divider/index.js +13 -4
- package/dist/Divider/index.umd.cjs +1 -1
- package/dist/Input/style/index.css +1 -1
- package/dist/Input/style.css +1 -1
- package/dist/Radio/index.js +34 -2
- package/dist/Radio/index.umd.cjs +1 -1
- package/dist/Radio/style/index.css +1 -1
- package/dist/Radio/style.css +1 -1
- package/dist/TimePicker/style/index.css +1 -1
- package/dist/TimePicker/style.css +1 -1
- package/dist/Tip/index.js +28 -5
- package/dist/Tip/index.umd.cjs +2 -2
- package/dist/Tip/style/index.css +1 -1
- package/dist/Tip/style.css +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/Button/Button.d.ts +4 -1
- package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +20 -0
- package/dist/types/components/ButtonGroup/index.d.ts +5 -0
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +6 -0
- package/dist/types/components/Divider/Divider.d.ts +2 -0
- package/dist/types/components/Tip/Tip.d.ts +21 -2
- package/dist/types/components/index.d.ts +2 -1
- package/dist/wz-h5-design.es.js +181 -56
- package/dist/wz-h5-design.umd.js +2 -2
- package/package.json +1 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './Button.scss';
|
|
3
3
|
export interface ButtonProps {
|
|
4
|
-
type?: 'primary' | 'outline' | 'cancel' | 'text';
|
|
4
|
+
type?: 'primary' | 'outline' | 'cancel' | 'text' | 'plain';
|
|
5
5
|
size?: 'small' | 'medium' | 'large';
|
|
6
6
|
block?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
color?: string;
|
|
9
9
|
textColor?: string;
|
|
10
10
|
borderColor?: string;
|
|
11
|
+
width?: string | number;
|
|
12
|
+
height?: string | number;
|
|
13
|
+
fontSize?: string | number;
|
|
11
14
|
className?: string;
|
|
12
15
|
style?: React.CSSProperties;
|
|
13
16
|
children?: React.ReactNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './ButtonGroup.scss';
|
|
3
|
+
export interface ButtonGroupProps {
|
|
4
|
+
/** 背景色,支持白色、灰色等 */
|
|
5
|
+
bgColor?: string;
|
|
6
|
+
/** 容器高度 */
|
|
7
|
+
height?: string | number;
|
|
8
|
+
/** 内边距 */
|
|
9
|
+
padding?: string | number;
|
|
10
|
+
/** 是否固定在底部 */
|
|
11
|
+
fixed?: boolean;
|
|
12
|
+
/** 按钮之间的间距 */
|
|
13
|
+
gap?: string | number;
|
|
14
|
+
/** 自定义类名 */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** 自定义样式 */
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
@@ -9,5 +9,11 @@ export interface DateRangePickerProps {
|
|
|
9
9
|
endLabel?: string;
|
|
10
10
|
className?: string;
|
|
11
11
|
style?: React.CSSProperties;
|
|
12
|
+
/** 是否显示长期有效选项 */
|
|
13
|
+
showLongTerm?: boolean;
|
|
14
|
+
/** 长期有效文案 */
|
|
15
|
+
longTermLabel?: string;
|
|
16
|
+
/** 长期有效时结束日期的值,默认 '9999-12-31' */
|
|
17
|
+
longTermValue?: string;
|
|
12
18
|
}
|
|
13
19
|
export declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
@@ -24,9 +24,28 @@ export interface TipProps {
|
|
|
24
24
|
*/
|
|
25
25
|
onClose?: () => void;
|
|
26
26
|
/**
|
|
27
|
-
* @description
|
|
27
|
+
* @description 是否加粗文字
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
bold?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description 左侧图标名称
|
|
33
|
+
*/
|
|
34
|
+
icon?: string;
|
|
35
|
+
/**
|
|
36
|
+
* @description 是否显示操作按钮
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
showAction?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @description 操作按钮文字
|
|
42
|
+
* @default '查看'
|
|
43
|
+
*/
|
|
44
|
+
actionText?: string;
|
|
45
|
+
/**
|
|
46
|
+
* @description 操作按钮点击事件
|
|
28
47
|
*/
|
|
29
|
-
|
|
48
|
+
onAction?: () => void;
|
|
30
49
|
}
|
|
31
50
|
export declare const Tip: FC<TipProps>;
|
|
32
51
|
export default Tip;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Button } from "./Button/Button";
|
|
2
|
+
import { ButtonGroup } from "./ButtonGroup/ButtonGroup";
|
|
2
3
|
import { Radio } from "./Radio/Radio";
|
|
3
4
|
import { Checkbox } from "./Checkbox/Checkbox";
|
|
4
5
|
import { Switch } from "./Switch/Switch";
|
|
@@ -30,5 +31,5 @@ import { Tooltip } from "./Tooltip/Tooltip";
|
|
|
30
31
|
import { Dialog } from "./Dialog";
|
|
31
32
|
import { ConfigProvider, useConfig } from "./ConfigProvider";
|
|
32
33
|
import type { ConfigProviderProps, ThemeType, ThemeVars } from "./ConfigProvider";
|
|
33
|
-
export { Button, Radio, Checkbox, Switch, Tabbar, Icon, Card, Cell, Tabs, Collapse, Stepper, Popup, Cascader, Input, Divider, CheckList, Search, TimePicker, DatePicker, DateRangePicker, Flex, Grid, GridView, Tag, Tip, NavBar, DropdownMenu, Toast, Tooltip, Dialog, ConfigProvider, useConfig, };
|
|
34
|
+
export { Button, ButtonGroup, Radio, Checkbox, Switch, Tabbar, Icon, Card, Cell, Tabs, Collapse, Stepper, Popup, Cascader, Input, Divider, CheckList, Search, TimePicker, DatePicker, DateRangePicker, Flex, Grid, GridView, Tag, Tip, NavBar, DropdownMenu, Toast, Tooltip, Dialog, ConfigProvider, useConfig, };
|
|
34
35
|
export type { ConfigProviderProps, ThemeType, ThemeVars };
|
package/dist/wz-h5-design.es.js
CHANGED
|
@@ -9,6 +9,9 @@ const Button = forwardRef(({
|
|
|
9
9
|
color = "",
|
|
10
10
|
textColor = "",
|
|
11
11
|
borderColor = "",
|
|
12
|
+
width,
|
|
13
|
+
height,
|
|
14
|
+
fontSize,
|
|
12
15
|
className = "",
|
|
13
16
|
style = {},
|
|
14
17
|
children,
|
|
@@ -18,12 +21,22 @@ const Button = forwardRef(({
|
|
|
18
21
|
}, ref) => {
|
|
19
22
|
const [isActive, setIsActive] = useState(false);
|
|
20
23
|
const timerRef = useRef(null);
|
|
24
|
+
const formatSize = (value) => {
|
|
25
|
+
if (value === void 0) return void 0;
|
|
26
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
27
|
+
};
|
|
21
28
|
const buttonStyle = useMemo(() => {
|
|
29
|
+
const customStyle = {
|
|
30
|
+
width: formatSize(width),
|
|
31
|
+
height: formatSize(height),
|
|
32
|
+
fontSize: formatSize(fontSize)
|
|
33
|
+
};
|
|
22
34
|
if (type === "cancel") {
|
|
23
35
|
return {
|
|
24
36
|
background: "#D6D6D6",
|
|
25
37
|
color: textColor || "#fff",
|
|
26
|
-
...style
|
|
38
|
+
...style,
|
|
39
|
+
...customStyle
|
|
27
40
|
};
|
|
28
41
|
}
|
|
29
42
|
if (type === "outline") {
|
|
@@ -31,7 +44,8 @@ const Button = forwardRef(({
|
|
|
31
44
|
color: textColor || "var(--wz-primary-color)",
|
|
32
45
|
borderColor: borderColor || "var(--wz-primary-color)",
|
|
33
46
|
background: "transparent",
|
|
34
|
-
...style
|
|
47
|
+
...style,
|
|
48
|
+
...customStyle
|
|
35
49
|
};
|
|
36
50
|
}
|
|
37
51
|
if (type === "text") {
|
|
@@ -40,7 +54,17 @@ const Button = forwardRef(({
|
|
|
40
54
|
background: "transparent",
|
|
41
55
|
border: "none",
|
|
42
56
|
boxShadow: "none",
|
|
43
|
-
...style
|
|
57
|
+
...style,
|
|
58
|
+
...customStyle
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (type === "plain") {
|
|
62
|
+
return {
|
|
63
|
+
color: textColor || "#666666",
|
|
64
|
+
borderColor: borderColor || "#666666",
|
|
65
|
+
background: "transparent",
|
|
66
|
+
...style,
|
|
67
|
+
...customStyle
|
|
44
68
|
};
|
|
45
69
|
}
|
|
46
70
|
if (type === "primary") {
|
|
@@ -49,10 +73,10 @@ const Button = forwardRef(({
|
|
|
49
73
|
s.background = color || "var(--wz-primary-gradient, var(--wz-primary-color))";
|
|
50
74
|
}
|
|
51
75
|
s.color = textColor || "#fff";
|
|
52
|
-
return s;
|
|
76
|
+
return { ...s, ...customStyle };
|
|
53
77
|
}
|
|
54
|
-
return style;
|
|
55
|
-
}, [type, color, textColor, borderColor, style]);
|
|
78
|
+
return { ...style, ...customStyle };
|
|
79
|
+
}, [type, color, textColor, borderColor, width, height, fontSize, style]);
|
|
56
80
|
const handleClick = (e) => {
|
|
57
81
|
if (disabled) return;
|
|
58
82
|
setIsActive(true);
|
|
@@ -85,12 +109,69 @@ const Button = forwardRef(({
|
|
|
85
109
|
type === "primary" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask" }),
|
|
86
110
|
type === "outline" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask" }),
|
|
87
111
|
type === "outline" && disabled && /* @__PURE__ */ jsx("span", { className: "wz-button__mask--disabled" }),
|
|
88
|
-
type === "cancel" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask--cancel" })
|
|
112
|
+
type === "cancel" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask--cancel" }),
|
|
113
|
+
type === "plain" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask" })
|
|
89
114
|
]
|
|
90
115
|
}
|
|
91
116
|
);
|
|
92
117
|
});
|
|
93
118
|
Button.displayName = "Button";
|
|
119
|
+
const ButtonGroup = ({
|
|
120
|
+
bgColor = "#fff",
|
|
121
|
+
height,
|
|
122
|
+
padding = "2px 10px",
|
|
123
|
+
fixed = false,
|
|
124
|
+
gap = 12,
|
|
125
|
+
className = "",
|
|
126
|
+
style = {},
|
|
127
|
+
children
|
|
128
|
+
}) => {
|
|
129
|
+
const formatSize = (value) => {
|
|
130
|
+
if (value === void 0) return void 0;
|
|
131
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
132
|
+
};
|
|
133
|
+
const containerStyle = {
|
|
134
|
+
backgroundColor: bgColor,
|
|
135
|
+
height: formatSize(height),
|
|
136
|
+
padding: formatSize(padding),
|
|
137
|
+
gap: formatSize(gap),
|
|
138
|
+
...style
|
|
139
|
+
};
|
|
140
|
+
const classNames2 = [
|
|
141
|
+
"wz-button-group",
|
|
142
|
+
fixed ? "wz-button-group--fixed" : "",
|
|
143
|
+
className
|
|
144
|
+
].filter(Boolean).join(" ");
|
|
145
|
+
return /* @__PURE__ */ jsx("div", { className: classNames2, style: containerStyle, children });
|
|
146
|
+
};
|
|
147
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
148
|
+
const Icon = ({
|
|
149
|
+
name,
|
|
150
|
+
size = 24,
|
|
151
|
+
color = "currentColor",
|
|
152
|
+
className = "",
|
|
153
|
+
style,
|
|
154
|
+
onClick,
|
|
155
|
+
type = "yunying"
|
|
156
|
+
// 默认使用yunying图标库
|
|
157
|
+
}) => {
|
|
158
|
+
const iconStyle = {
|
|
159
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
160
|
+
color,
|
|
161
|
+
...style
|
|
162
|
+
};
|
|
163
|
+
const iconFontClass = `iconfont-${type}`;
|
|
164
|
+
const iconPrefix = "icon-";
|
|
165
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
166
|
+
return /* @__PURE__ */ jsx(
|
|
167
|
+
"i",
|
|
168
|
+
{
|
|
169
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
170
|
+
style: iconStyle,
|
|
171
|
+
onClick
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
};
|
|
94
175
|
const RadioGroupContext = createContext({});
|
|
95
176
|
const Radio = ({
|
|
96
177
|
size,
|
|
@@ -118,6 +199,11 @@ const Radio = ({
|
|
|
118
199
|
const isChecked = isInGroup ? groupContext.value === value : checked;
|
|
119
200
|
const isDisabled = disabled || groupContext.disabled;
|
|
120
201
|
const radioSize = size || groupContext.size || "medium";
|
|
202
|
+
const iconSizeMap = {
|
|
203
|
+
small: 16,
|
|
204
|
+
medium: 18,
|
|
205
|
+
large: 20
|
|
206
|
+
};
|
|
121
207
|
return /* @__PURE__ */ jsxs(
|
|
122
208
|
"label",
|
|
123
209
|
{
|
|
@@ -136,7 +222,7 @@ const Radio = ({
|
|
|
136
222
|
...rest
|
|
137
223
|
}
|
|
138
224
|
),
|
|
139
|
-
/* @__PURE__ */ jsx("span", { className: "wz-radio-inner" }),
|
|
225
|
+
/* @__PURE__ */ jsx("span", { className: "wz-radio-inner", children: /* @__PURE__ */ jsx(Icon, { name: isChecked ? "radio-sel" : "radio-nor", type: "yunying", size: iconSizeMap[radioSize] }) }),
|
|
140
226
|
children && /* @__PURE__ */ jsx("span", { className: "wz-radio-label", children })
|
|
141
227
|
]
|
|
142
228
|
}
|
|
@@ -197,6 +283,11 @@ const Checkbox = ({
|
|
|
197
283
|
const isChecked = isInGroup ? (_a = groupContext.value) == null ? void 0 : _a.includes(value) : checked;
|
|
198
284
|
const isDisabled = disabled || groupContext.disabled;
|
|
199
285
|
const checkboxSize = size || groupContext.size || "medium";
|
|
286
|
+
const iconSizeMap = {
|
|
287
|
+
small: 16,
|
|
288
|
+
medium: 18,
|
|
289
|
+
large: 20
|
|
290
|
+
};
|
|
200
291
|
return /* @__PURE__ */ jsxs(
|
|
201
292
|
"label",
|
|
202
293
|
{
|
|
@@ -215,7 +306,7 @@ const Checkbox = ({
|
|
|
215
306
|
...rest
|
|
216
307
|
}
|
|
217
308
|
),
|
|
218
|
-
/* @__PURE__ */ jsx("span", { className: "wz-checkbox-inner" }),
|
|
309
|
+
/* @__PURE__ */ jsx("span", { className: "wz-checkbox-inner", children: /* @__PURE__ */ jsx(Icon, { name: isChecked ? "checkbox-checked" : "checkbox", type: "yunying", size: iconSizeMap[checkboxSize] }) }),
|
|
219
310
|
children && /* @__PURE__ */ jsx("span", { className: "wz-checkbox-label", children })
|
|
220
311
|
]
|
|
221
312
|
}
|
|
@@ -346,33 +437,6 @@ var classnames = { exports: {} };
|
|
|
346
437
|
})(classnames);
|
|
347
438
|
var classnamesExports = classnames.exports;
|
|
348
439
|
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
349
|
-
const Icon = ({
|
|
350
|
-
name,
|
|
351
|
-
size = 24,
|
|
352
|
-
color = "currentColor",
|
|
353
|
-
className = "",
|
|
354
|
-
style,
|
|
355
|
-
onClick,
|
|
356
|
-
type = "yunying"
|
|
357
|
-
// 默认使用yunying图标库
|
|
358
|
-
}) => {
|
|
359
|
-
const iconStyle = {
|
|
360
|
-
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
361
|
-
color,
|
|
362
|
-
...style
|
|
363
|
-
};
|
|
364
|
-
const iconFontClass = `iconfont-${type}`;
|
|
365
|
-
const iconPrefix = "icon-";
|
|
366
|
-
const iconClass = `${iconPrefix}${name}`;
|
|
367
|
-
return /* @__PURE__ */ jsx(
|
|
368
|
-
"i",
|
|
369
|
-
{
|
|
370
|
-
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
371
|
-
style: iconStyle,
|
|
372
|
-
onClick
|
|
373
|
-
}
|
|
374
|
-
);
|
|
375
|
-
};
|
|
376
440
|
const TabbarItem = (props) => {
|
|
377
441
|
const { title, icon, activeIcon, badge, badgeAsBubble, hump, active, onItemClick, onClick, activeColor } = props;
|
|
378
442
|
const renderIcon = (iconSource) => {
|
|
@@ -535,7 +599,7 @@ const Cell$1 = (props) => {
|
|
|
535
599
|
};
|
|
536
600
|
const renderRightIcon = () => {
|
|
537
601
|
if (arrow) {
|
|
538
|
-
return /* @__PURE__ */ jsx("div", { className: "wz-cell-arrow" });
|
|
602
|
+
return /* @__PURE__ */ jsx("div", { className: "wz-cell-arrow", children: /* @__PURE__ */ jsx(Icon, { name: "right-arrow", size: 16 }) });
|
|
539
603
|
}
|
|
540
604
|
return null;
|
|
541
605
|
};
|
|
@@ -1100,23 +1164,32 @@ const Input = forwardRef(
|
|
|
1100
1164
|
}
|
|
1101
1165
|
);
|
|
1102
1166
|
Input.displayName = "Input";
|
|
1167
|
+
const COLOR_MAP = {
|
|
1168
|
+
horizontal: {
|
|
1169
|
+
default: "#f7f7f7",
|
|
1170
|
+
emphasis: "#eeeeee"
|
|
1171
|
+
},
|
|
1172
|
+
vertical: "rgba(0, 0, 0, 0.1)"
|
|
1173
|
+
};
|
|
1103
1174
|
const Divider = ({
|
|
1104
1175
|
direction = "horizontal",
|
|
1105
|
-
|
|
1176
|
+
type = "default",
|
|
1177
|
+
color,
|
|
1106
1178
|
length,
|
|
1107
1179
|
margin,
|
|
1108
1180
|
style,
|
|
1109
1181
|
className = ""
|
|
1110
1182
|
}) => {
|
|
1111
1183
|
const isVertical = direction === "vertical";
|
|
1184
|
+
const defaultColor = isVertical ? COLOR_MAP.vertical : COLOR_MAP.horizontal[type];
|
|
1112
1185
|
return /* @__PURE__ */ jsx(
|
|
1113
1186
|
"div",
|
|
1114
1187
|
{
|
|
1115
1188
|
className: `wz-divider wz-divider--${direction} ${className}`,
|
|
1116
1189
|
style: {
|
|
1117
|
-
background: color,
|
|
1118
|
-
width: isVertical ?
|
|
1119
|
-
height: isVertical ? length || 24 :
|
|
1190
|
+
background: color || defaultColor,
|
|
1191
|
+
width: isVertical ? 2 : length || "100%",
|
|
1192
|
+
height: isVertical ? length || 24 : 2,
|
|
1120
1193
|
margin,
|
|
1121
1194
|
...style
|
|
1122
1195
|
}
|
|
@@ -1147,7 +1220,7 @@ const CheckList = ({ options, value, onChange, multiple = false, style, classNam
|
|
|
1147
1220
|
onClick: () => handleClick(item),
|
|
1148
1221
|
children: [
|
|
1149
1222
|
/* @__PURE__ */ jsx("span", { className: "wz-check-list__label", children: item }),
|
|
1150
|
-
isChecked(item) && /* @__PURE__ */ jsx("span", { className: "wz-check-list__icon", children: "
|
|
1223
|
+
isChecked(item) && /* @__PURE__ */ jsx("span", { className: "wz-check-list__icon", children: /* @__PURE__ */ jsx(Icon, { name: "check", size: 18, type: "yunying" }) })
|
|
1151
1224
|
]
|
|
1152
1225
|
},
|
|
1153
1226
|
item
|
|
@@ -1632,7 +1705,10 @@ const DateRangePicker = ({
|
|
|
1632
1705
|
startLabel = "开始时间",
|
|
1633
1706
|
endLabel = "结束时间",
|
|
1634
1707
|
className = "",
|
|
1635
|
-
style
|
|
1708
|
+
style,
|
|
1709
|
+
showLongTerm = false,
|
|
1710
|
+
longTermLabel = "长期有效",
|
|
1711
|
+
longTermValue = "9999-12-31"
|
|
1636
1712
|
}) => {
|
|
1637
1713
|
const todayStr = React.useMemo(() => {
|
|
1638
1714
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -1644,6 +1720,7 @@ const DateRangePicker = ({
|
|
|
1644
1720
|
const [innerValue, setInnerValue] = useState(value || [todayStr, todayStr]);
|
|
1645
1721
|
const range = value || innerValue;
|
|
1646
1722
|
const [active, setActive] = useState("start");
|
|
1723
|
+
const isLongTerm = range[1] === longTermValue;
|
|
1647
1724
|
const handleSelect = (val) => {
|
|
1648
1725
|
if (active === "start") {
|
|
1649
1726
|
const newRange = [val, range[1] && range[1] >= val ? range[1] : val];
|
|
@@ -1655,6 +1732,17 @@ const DateRangePicker = ({
|
|
|
1655
1732
|
onChange == null ? void 0 : onChange(newRange);
|
|
1656
1733
|
}
|
|
1657
1734
|
};
|
|
1735
|
+
const handleLongTermToggle = () => {
|
|
1736
|
+
if (isLongTerm) {
|
|
1737
|
+
const newRange = [range[0], range[0]];
|
|
1738
|
+
setInnerValue(newRange);
|
|
1739
|
+
onChange == null ? void 0 : onChange(newRange);
|
|
1740
|
+
} else {
|
|
1741
|
+
const newRange = [range[0], longTermValue];
|
|
1742
|
+
setInnerValue(newRange);
|
|
1743
|
+
onChange == null ? void 0 : onChange(newRange);
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1658
1746
|
return /* @__PURE__ */ jsxs("div", { className: `wz-date-range-picker ${className}`, style, children: [
|
|
1659
1747
|
/* @__PURE__ */ jsxs("div", { className: "wz-date-range-picker-label-row", children: [
|
|
1660
1748
|
/* @__PURE__ */ jsx("div", { className: "wz-date-range-picker-label", children: startLabel }),
|
|
@@ -1670,14 +1758,28 @@ const DateRangePicker = ({
|
|
|
1670
1758
|
}
|
|
1671
1759
|
) }),
|
|
1672
1760
|
/* @__PURE__ */ jsx("div", { className: "wz-date-range-picker-sep", children: "至" }),
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1761
|
+
/* @__PURE__ */ jsxs("div", { className: "wz-date-range-picker-col", children: [
|
|
1762
|
+
/* @__PURE__ */ jsx(
|
|
1763
|
+
"div",
|
|
1764
|
+
{
|
|
1765
|
+
className: `wz-date-range-picker-value${active === "end" ? " active" : ""}${isLongTerm ? " disabled" : ""}`,
|
|
1766
|
+
onClick: () => !isLongTerm && setActive("end"),
|
|
1767
|
+
children: isLongTerm ? longTermLabel : range[1] || "请选择"
|
|
1768
|
+
}
|
|
1769
|
+
),
|
|
1770
|
+
showLongTerm && /* @__PURE__ */ jsxs("div", { className: "wz-date-range-picker-long-term", onClick: handleLongTermToggle, children: [
|
|
1771
|
+
/* @__PURE__ */ jsx(
|
|
1772
|
+
Icon,
|
|
1773
|
+
{
|
|
1774
|
+
name: isLongTerm ? "radio-sel" : "radio-nor",
|
|
1775
|
+
type: "yunying",
|
|
1776
|
+
size: 20,
|
|
1777
|
+
color: isLongTerm ? "var(--active-color)" : "#ccc"
|
|
1778
|
+
}
|
|
1779
|
+
),
|
|
1780
|
+
/* @__PURE__ */ jsx("span", { className: "wz-date-range-picker-long-term-text", children: longTermLabel })
|
|
1781
|
+
] })
|
|
1782
|
+
] })
|
|
1681
1783
|
] }),
|
|
1682
1784
|
/* @__PURE__ */ jsx("div", { className: "wz-date-range-picker-picker", children: /* @__PURE__ */ jsx(
|
|
1683
1785
|
DatePicker,
|
|
@@ -1951,20 +2053,42 @@ const Tip = ({
|
|
|
1951
2053
|
className,
|
|
1952
2054
|
visible = true,
|
|
1953
2055
|
onClose,
|
|
1954
|
-
|
|
1955
|
-
|
|
2056
|
+
marquee = false,
|
|
2057
|
+
bold = false,
|
|
2058
|
+
icon,
|
|
2059
|
+
showAction = false,
|
|
2060
|
+
actionText = "查看",
|
|
2061
|
+
onAction
|
|
1956
2062
|
}) => {
|
|
2063
|
+
const contentRef = useRef(null);
|
|
2064
|
+
const [isMultiLine, setIsMultiLine] = useState(false);
|
|
2065
|
+
useEffect(() => {
|
|
2066
|
+
if (contentRef.current && !marquee) {
|
|
2067
|
+
const el = contentRef.current;
|
|
2068
|
+
const lineHeight = parseFloat(getComputedStyle(el).lineHeight) || 20;
|
|
2069
|
+
setIsMultiLine(el.scrollHeight > lineHeight * 1.5);
|
|
2070
|
+
}
|
|
2071
|
+
}, [content, marquee]);
|
|
1957
2072
|
if (!visible) {
|
|
1958
2073
|
return null;
|
|
1959
2074
|
}
|
|
1960
2075
|
const baseClass = "wz-tip";
|
|
2076
|
+
const hasRightArea = showAction || onClose;
|
|
1961
2077
|
const tipClass = classNames(baseClass, className, {
|
|
1962
|
-
[`${baseClass}--marquee`]: marquee
|
|
2078
|
+
[`${baseClass}--marquee`]: marquee,
|
|
2079
|
+
[`${baseClass}--bold`]: bold,
|
|
2080
|
+
[`${baseClass}--center`]: !marquee && !isMultiLine,
|
|
2081
|
+
[`${baseClass}--left`]: !marquee && isMultiLine,
|
|
2082
|
+
[`${baseClass}--has-icon`]: !!icon,
|
|
2083
|
+
[`${baseClass}--has-right`]: hasRightArea
|
|
1963
2084
|
});
|
|
1964
2085
|
const contentNode = marquee ? /* @__PURE__ */ jsx("div", { className: `${baseClass}-marquee-box`, children: /* @__PURE__ */ jsx("span", { children: content }) }) : content;
|
|
1965
2086
|
return /* @__PURE__ */ jsxs("div", { className: tipClass, children: [
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
-
|
|
2087
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}-content`, ref: contentRef, children: [
|
|
2088
|
+
icon && /* @__PURE__ */ jsx("span", { className: `${baseClass}-icon`, children: /* @__PURE__ */ jsx(Icon, { name: icon, size: 16 }) }),
|
|
2089
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}-text`, children: contentNode })
|
|
2090
|
+
] }),
|
|
2091
|
+
showAction && /* @__PURE__ */ jsx("div", { className: `${baseClass}-action`, onClick: onAction, children: actionText }),
|
|
1968
2092
|
onClose && /* @__PURE__ */ jsx("div", { className: `${baseClass}-close`, onClick: onClose, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 16 }) })
|
|
1969
2093
|
] });
|
|
1970
2094
|
};
|
|
@@ -2490,6 +2614,7 @@ const ConfigProvider = ({
|
|
|
2490
2614
|
};
|
|
2491
2615
|
export {
|
|
2492
2616
|
Button,
|
|
2617
|
+
ButtonGroup,
|
|
2493
2618
|
Card,
|
|
2494
2619
|
Cascader,
|
|
2495
2620
|
Cell,
|