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
package/dist/Button/index.js
CHANGED
|
@@ -8,6 +8,9 @@ const Button = forwardRef(({
|
|
|
8
8
|
color = "",
|
|
9
9
|
textColor = "",
|
|
10
10
|
borderColor = "",
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
fontSize,
|
|
11
14
|
className = "",
|
|
12
15
|
style = {},
|
|
13
16
|
children,
|
|
@@ -17,12 +20,22 @@ const Button = forwardRef(({
|
|
|
17
20
|
}, ref) => {
|
|
18
21
|
const [isActive, setIsActive] = useState(false);
|
|
19
22
|
const timerRef = useRef(null);
|
|
23
|
+
const formatSize = (value) => {
|
|
24
|
+
if (value === void 0) return void 0;
|
|
25
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
26
|
+
};
|
|
20
27
|
const buttonStyle = useMemo(() => {
|
|
28
|
+
const customStyle = {
|
|
29
|
+
width: formatSize(width),
|
|
30
|
+
height: formatSize(height),
|
|
31
|
+
fontSize: formatSize(fontSize)
|
|
32
|
+
};
|
|
21
33
|
if (type === "cancel") {
|
|
22
34
|
return {
|
|
23
35
|
background: "#D6D6D6",
|
|
24
36
|
color: textColor || "#fff",
|
|
25
|
-
...style
|
|
37
|
+
...style,
|
|
38
|
+
...customStyle
|
|
26
39
|
};
|
|
27
40
|
}
|
|
28
41
|
if (type === "outline") {
|
|
@@ -30,7 +43,8 @@ const Button = forwardRef(({
|
|
|
30
43
|
color: textColor || "var(--wz-primary-color)",
|
|
31
44
|
borderColor: borderColor || "var(--wz-primary-color)",
|
|
32
45
|
background: "transparent",
|
|
33
|
-
...style
|
|
46
|
+
...style,
|
|
47
|
+
...customStyle
|
|
34
48
|
};
|
|
35
49
|
}
|
|
36
50
|
if (type === "text") {
|
|
@@ -39,7 +53,17 @@ const Button = forwardRef(({
|
|
|
39
53
|
background: "transparent",
|
|
40
54
|
border: "none",
|
|
41
55
|
boxShadow: "none",
|
|
42
|
-
...style
|
|
56
|
+
...style,
|
|
57
|
+
...customStyle
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (type === "plain") {
|
|
61
|
+
return {
|
|
62
|
+
color: textColor || "#666666",
|
|
63
|
+
borderColor: borderColor || "#666666",
|
|
64
|
+
background: "transparent",
|
|
65
|
+
...style,
|
|
66
|
+
...customStyle
|
|
43
67
|
};
|
|
44
68
|
}
|
|
45
69
|
if (type === "primary") {
|
|
@@ -48,10 +72,10 @@ const Button = forwardRef(({
|
|
|
48
72
|
s.background = color || "var(--wz-primary-gradient, var(--wz-primary-color))";
|
|
49
73
|
}
|
|
50
74
|
s.color = textColor || "#fff";
|
|
51
|
-
return s;
|
|
75
|
+
return { ...s, ...customStyle };
|
|
52
76
|
}
|
|
53
|
-
return style;
|
|
54
|
-
}, [type, color, textColor, borderColor, style]);
|
|
77
|
+
return { ...style, ...customStyle };
|
|
78
|
+
}, [type, color, textColor, borderColor, width, height, fontSize, style]);
|
|
55
79
|
const handleClick = (e) => {
|
|
56
80
|
if (disabled) return;
|
|
57
81
|
setIsActive(true);
|
|
@@ -84,7 +108,8 @@ const Button = forwardRef(({
|
|
|
84
108
|
type === "primary" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask" }),
|
|
85
109
|
type === "outline" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask" }),
|
|
86
110
|
type === "outline" && disabled && /* @__PURE__ */ jsx("span", { className: "wz-button__mask--disabled" }),
|
|
87
|
-
type === "cancel" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask--cancel" })
|
|
111
|
+
type === "cancel" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask--cancel" }),
|
|
112
|
+
type === "plain" && isActive && /* @__PURE__ */ jsx("span", { className: "wz-button__mask" })
|
|
88
113
|
]
|
|
89
114
|
}
|
|
90
115
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Button={},e.jsxRuntime,e.React)}(this,(function(e,t,o){"use strict";const r=o.forwardRef((({type:e="primary",size:r="medium",block:n=!1,disabled:a=!1,color:
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Button={},e.jsxRuntime,e.React)}(this,(function(e,t,o){"use strict";const r=o.forwardRef((({type:e="primary",size:r="medium",block:n=!1,disabled:a=!1,color:i="",textColor:l="",borderColor:s="",width:u,height:c,fontSize:d,className:f="",style:b={},children:m,icon:p,iconPosition:w="left",onClick:y},z)=>{const[x,k]=o.useState(!1),g=o.useRef(null),h=e=>{if(void 0!==e)return"number"==typeof e?`${e}px`:e},j=o.useMemo((()=>{const t={width:h(u),height:h(c),fontSize:h(d)};if("cancel"===e)return{background:"#D6D6D6",color:l||"#fff",...b,...t};if("outline"===e)return{color:l||"var(--wz-primary-color)",borderColor:s||"var(--wz-primary-color)",background:"transparent",...b,...t};if("text"===e)return{color:l||b.color||"var(--wz-primary-color, #22C94D)",background:"transparent",border:"none",boxShadow:"none",...b,...t};if("plain"===e)return{color:l||"#666666",borderColor:s||"#666666",background:"transparent",...b,...t};if("primary"===e){let e={...b};return a||(e.background=i||"var(--wz-primary-gradient, var(--wz-primary-color))"),e.color=l||"#fff",{...e,...t}}return{...b,...t}}),[e,i,l,s,u,c,d,b]),_=["wz-button",`wz-button--${e}`,`wz-button--${r}`,n?"wz-button--block":"",a?"wz-button--disabled":"",x&&!a?"wz-button--active":"",f].filter(Boolean).join(" ");return t.jsxs("button",{ref:z,type:"button",className:_,style:j,disabled:a,onClick:e=>{a||(k(!0),g.current&&window.clearTimeout(g.current),g.current=window.setTimeout((()=>k(!1)),100),null==y||y(e))},children:["left"===w&&p,m,"right"===w&&p,"primary"===e&&x&&t.jsx("span",{className:"wz-button__mask"}),"outline"===e&&x&&t.jsx("span",{className:"wz-button__mask"}),"outline"===e&&a&&t.jsx("span",{className:"wz-button__mask--disabled"}),"cancel"===e&&x&&t.jsx("span",{className:"wz-button__mask--cancel"}),"plain"===e&&x&&t.jsx("span",{className:"wz-button__mask"})]})}));r.displayName="Button",e.Button=r,e.default=r,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;gap:5px;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;font-weight:600;line-height:23px;transition:all .2s;display:inline-flex;position:relative;overflow:hidden}.wz-button--primary{color:var(--wz-text-color-white,#fff);background:var(--wz-primary-gradient);border:none}.wz-button--primary.wz-button--disabled{color:#fff;background-color:#d6d6d6}.wz-button--outline{color:var(--wz-primary-color,#22c94d);border:1px solid var(--wz-primary-color,#22c94d);background:0 0}.wz-button--cancel{color:#fff;background:#c0c4cc;border:none}.wz-button--block{width:100%;display:flex}.wz-button--large{border-radius:23px;height:45px;padding:10px 20px;font-size:18px}.wz-button--medium{border-radius:23px;height:30px;padding:4px 16px;font-size:14px}.wz-button--small{border-radius:13px;height:25px;padding:3px 10px;font-size:13px}.wz-button--disabled{cursor:not-allowed;opacity:.
|
|
1
|
+
.wz-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;gap:5px;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;font-weight:600;line-height:23px;transition:all .2s;display:inline-flex;position:relative;overflow:hidden}.wz-button--primary{color:var(--wz-text-color-white,#fff);background:var(--wz-primary-gradient);border:none}.wz-button--primary.wz-button--disabled{color:#fff;background-color:#d6d6d6}.wz-button--outline{color:var(--wz-primary-color,#22c94d);border:1px solid var(--wz-primary-color,#22c94d);background:0 0}.wz-button--plain{color:#666;background:0 0;border:1px solid #666}.wz-button--plain.wz-button--disabled{opacity:.5;background:#fff!important;border:1px solid #ccc!important}.wz-button--cancel{color:#fff;background:#c0c4cc;border:none}.wz-button--block{width:100%;display:flex}.wz-button--large{border-radius:23px;height:45px;padding:10px 20px;font-size:18px}.wz-button--medium{border-radius:23px;height:30px;padding:4px 16px;font-size:14px}.wz-button--small{border-radius:13px;height:25px;padding:3px 10px;font-size:13px}.wz-button--disabled{cursor:not-allowed;opacity:.8}.wz-button--active{opacity:.6}.wz-button__mask{pointer-events:none;border-radius:inherit;z-index:1;background:#00000014;width:100%;height:100%;position:absolute;top:0;left:0}.wz-button__mask--disabled{pointer-events:none;border-radius:inherit;z-index:10;background:#ffffff80;width:100%;height:100%;position:absolute;top:0;left:0}.wz-button__mask--cancel{pointer-events:none;border-radius:inherit;z-index:10;background:#0000000f;width:100%;height:100%;position:absolute;top:0;left:0}@media screen and (max-width:767px){.wz-button--small{height:30px;font-size:14px}.wz-button--medium{height:40px;font-size:15px}.wz-button--large{height:50px;font-size:16px}}.wz-button--text{color:var(--wz-primary-color,#22c94d);box-shadow:none;background:0 0;border:none;height:auto;padding:0 8px;transition:color .2s}.wz-button--text:active{color:var(--wz-primary-color-dark,#179a38);background:var(--wz-bg-color-base,#f5f7f9)}.wz-button--disabled.wz-button--text{color:var(--wz-disabled-color,#c0c4cc);background:0 0}
|
package/dist/Button/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;gap:5px;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;font-weight:600;line-height:23px;transition:all .2s;display:inline-flex;position:relative;overflow:hidden}.wz-button--primary{color:var(--wz-text-color-white,#fff);background:var(--wz-primary-gradient);border:none}.wz-button--primary.wz-button--disabled{color:#fff;background-color:#d6d6d6}.wz-button--outline{color:var(--wz-primary-color,#22c94d);border:1px solid var(--wz-primary-color,#22c94d);background:0 0}.wz-button--cancel{color:#fff;background:#c0c4cc;border:none}.wz-button--block{width:100%;display:flex}.wz-button--large{border-radius:23px;height:45px;padding:10px 20px;font-size:18px}.wz-button--medium{border-radius:23px;height:30px;padding:4px 16px;font-size:14px}.wz-button--small{border-radius:13px;height:25px;padding:3px 10px;font-size:13px}.wz-button--disabled{cursor:not-allowed;opacity:.
|
|
1
|
+
.wz-button{box-sizing:border-box;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;gap:5px;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;font-weight:600;line-height:23px;transition:all .2s;display:inline-flex;position:relative;overflow:hidden}.wz-button--primary{color:var(--wz-text-color-white,#fff);background:var(--wz-primary-gradient);border:none}.wz-button--primary.wz-button--disabled{color:#fff;background-color:#d6d6d6}.wz-button--outline{color:var(--wz-primary-color,#22c94d);border:1px solid var(--wz-primary-color,#22c94d);background:0 0}.wz-button--plain{color:#666;background:0 0;border:1px solid #666}.wz-button--plain.wz-button--disabled{opacity:.5;background:#fff!important;border:1px solid #ccc!important}.wz-button--cancel{color:#fff;background:#c0c4cc;border:none}.wz-button--block{width:100%;display:flex}.wz-button--large{border-radius:23px;height:45px;padding:10px 20px;font-size:18px}.wz-button--medium{border-radius:23px;height:30px;padding:4px 16px;font-size:14px}.wz-button--small{border-radius:13px;height:25px;padding:3px 10px;font-size:13px}.wz-button--disabled{cursor:not-allowed;opacity:.8}.wz-button--active{opacity:.6}.wz-button__mask{pointer-events:none;border-radius:inherit;z-index:1;background:#00000014;width:100%;height:100%;position:absolute;top:0;left:0}.wz-button__mask--disabled{pointer-events:none;border-radius:inherit;z-index:10;background:#ffffff80;width:100%;height:100%;position:absolute;top:0;left:0}.wz-button__mask--cancel{pointer-events:none;border-radius:inherit;z-index:10;background:#0000000f;width:100%;height:100%;position:absolute;top:0;left:0}@media screen and (max-width:767px){.wz-button--small{height:30px;font-size:14px}.wz-button--medium{height:40px;font-size:15px}.wz-button--large{height:50px;font-size:16px}}.wz-button--text{color:var(--wz-primary-color,#22c94d);box-shadow:none;background:0 0;border:none;height:auto;padding:0 8px;transition:color .2s}.wz-button--text:active{color:var(--wz-primary-color-dark,#179a38);background:var(--wz-bg-color-base,#f5f7f9)}.wz-button--disabled.wz-button--text{color:var(--wz-disabled-color,#c0c4cc);background:0 0}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const ButtonGroup = ({
|
|
3
|
+
bgColor = "#fff",
|
|
4
|
+
height,
|
|
5
|
+
padding = "2px 10px",
|
|
6
|
+
fixed = false,
|
|
7
|
+
gap = 12,
|
|
8
|
+
className = "",
|
|
9
|
+
style = {},
|
|
10
|
+
children
|
|
11
|
+
}) => {
|
|
12
|
+
const formatSize = (value) => {
|
|
13
|
+
if (value === void 0) return void 0;
|
|
14
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
15
|
+
};
|
|
16
|
+
const containerStyle = {
|
|
17
|
+
backgroundColor: bgColor,
|
|
18
|
+
height: formatSize(height),
|
|
19
|
+
padding: formatSize(padding),
|
|
20
|
+
gap: formatSize(gap),
|
|
21
|
+
...style
|
|
22
|
+
};
|
|
23
|
+
const classNames = [
|
|
24
|
+
"wz-button-group",
|
|
25
|
+
fixed ? "wz-button-group--fixed" : "",
|
|
26
|
+
className
|
|
27
|
+
].filter(Boolean).join(" ");
|
|
28
|
+
return /* @__PURE__ */ jsx("div", { className: classNames, style: containerStyle, children });
|
|
29
|
+
};
|
|
30
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
31
|
+
export {
|
|
32
|
+
ButtonGroup,
|
|
33
|
+
ButtonGroup as default
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ButtonGroup={},e.jsxRuntime)}(this,(function(e,t){"use strict";const o=({bgColor:e="#fff",height:o,padding:n="2px 10px",fixed:i=!1,gap:u=12,className:r="",style:d={},children:s})=>{const f=e=>{if(void 0!==e)return"number"==typeof e?`${e}px`:e},l={backgroundColor:e,height:f(o),padding:f(n),gap:f(u),...d},p=["wz-button-group",i?"wz-button-group--fixed":"",r].filter(Boolean).join(" ");return t.jsx("div",{className:p,style:l,children:s})};o.displayName="ButtonGroup",e.ButtonGroup=o,e.default=o,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-button-group{box-sizing:border-box;justify-content:center;align-items:center;display:flex}.wz-button-group--fixed{z-index:100;padding-bottom:env(safe-area-inset-bottom);position:fixed;bottom:0;left:0;right:0}.wz-button-group>.wz-button{flex:1}.wz-button-group>.wz-button--text{flex:none}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-button-group{box-sizing:border-box;justify-content:center;align-items:center;display:flex}.wz-button-group--fixed{z-index:100;padding-bottom:env(safe-area-inset-bottom);position:fixed;bottom:0;left:0;right:0}.wz-button-group>.wz-button{flex:1}.wz-button-group>.wz-button--text{flex:none}
|
package/dist/Cell/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
function getDefaultExportFromCjs(x) {
|
|
3
3
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
4
|
}
|
|
@@ -50,6 +50,33 @@ var classnames = { exports: {} };
|
|
|
50
50
|
})(classnames);
|
|
51
51
|
var classnamesExports = classnames.exports;
|
|
52
52
|
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
53
|
+
const Icon = ({
|
|
54
|
+
name,
|
|
55
|
+
size = 24,
|
|
56
|
+
color = "currentColor",
|
|
57
|
+
className = "",
|
|
58
|
+
style,
|
|
59
|
+
onClick,
|
|
60
|
+
type = "yunying"
|
|
61
|
+
// 默认使用yunying图标库
|
|
62
|
+
}) => {
|
|
63
|
+
const iconStyle = {
|
|
64
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
65
|
+
color,
|
|
66
|
+
...style
|
|
67
|
+
};
|
|
68
|
+
const iconFontClass = `iconfont-${type}`;
|
|
69
|
+
const iconPrefix = "icon-";
|
|
70
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"i",
|
|
73
|
+
{
|
|
74
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
75
|
+
style: iconStyle,
|
|
76
|
+
onClick
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
};
|
|
53
80
|
const Cell$1 = (props) => {
|
|
54
81
|
const {
|
|
55
82
|
title,
|
|
@@ -108,7 +135,7 @@ const Cell$1 = (props) => {
|
|
|
108
135
|
};
|
|
109
136
|
const renderRightIcon = () => {
|
|
110
137
|
if (arrow) {
|
|
111
|
-
return /* @__PURE__ */ jsx("div", { className: "wz-cell-arrow" });
|
|
138
|
+
return /* @__PURE__ */ jsx("div", { className: "wz-cell-arrow", children: /* @__PURE__ */ jsx(Icon, { name: "right-arrow", size: 16 }) });
|
|
112
139
|
}
|
|
113
140
|
return null;
|
|
114
141
|
};
|
package/dist/Cell/index.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).Cell={},e.jsxRuntime)}(this,(function(e,l){"use strict";function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).Cell={},e.jsxRuntime)}(this,(function(e,l){"use strict";function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n={exports:{}};
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/t=
|
|
6
|
+
*/t=n,function(){var e={}.hasOwnProperty;function l(){for(var s=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)s.push(n);else if(Array.isArray(n)){if(n.length){var i=l.apply(null,n);i&&s.push(i)}}else if("object"===r){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){s.push(n.toString());continue}for(var a in n)e.call(n,a)&&n[a]&&s.push(a)}}}return s.join(" ")}t.exports?(l.default=l,t.exports=l):window.classNames=l}();const r=s(n.exports),i=({name:e,size:s=24,color:t="currentColor",className:n="",style:r,onClick:i,type:a="yunying"})=>{const c={fontSize:"number"==typeof s?`${s}px`:s,color:t,...r},o=`iconfont-${a}`,u=`icon-${e}`;return l.jsx("i",{className:`wz-icon ${o} ${u} ${n}`,style:c,onClick:i})},a=e=>{const{className:s,style:t,children:n}=e;return l.jsx("div",{className:r("wz-cell-group",s),style:t,children:n})},c=e=>{const{title:s,label:t,value:n,icon:a,arrow:c=!1,border:o=!0,center:u=!1,disabled:d=!1,required:p=!1,className:f,style:y,titleStyle:m,titleClassName:h,labelStyle:x,labelClassName:v,valueStyle:j,valueClassName:w,onClick:b,children:N}=e,z=r("wz-cell",{"wz-cell-border":o,"wz-cell-center":u,"wz-cell-disabled":d},f);return l.jsxs("div",{className:z,style:y,onClick:d?void 0:b,children:[a?l.jsx("div",{className:"wz-cell-icon",children:a}):null,l.jsxs("div",{className:"wz-cell-content",children:[s?l.jsxs("div",{className:r("wz-cell-title",h),style:m,children:[p&&l.jsx("span",{className:"wz-cell-required",children:"*"}),s,n&&l.jsx("span",{className:r("wz-cell-value",w),style:j,children:n})]}):null,t?l.jsx("div",{className:r("wz-cell-label",v),style:x,children:t}):null]}),null,N&&l.jsx("div",{className:"wz-cell-extra",children:N}),c?l.jsx("div",{className:"wz-cell-arrow",children:l.jsx(i,{name:"right-arrow",size:16})}):null]})};c.Group=a,e.Cell=c,e.CellGroup=a,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-cell-group{background-color:var(--wz-bg-color-white,#fff);border-radius:8px;overflow:hidden}.wz-cell-group .wz-cell{background-color:#0000;border-radius:0}.wz-cell{background-color:var(--wz-bg-color-white,#fff);-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;border-radius:8px;outline:none;align-items:center;padding:12px;line-height:1.5;display:flex;position:relative}.wz-cell-border:after{content:"";background-color:var(--wz-border-color-base,#dcdfe6);height:1px;position:absolute;bottom:0;left:12px;right:12px;transform:scaleY(.5)}.wz-cell-center{align-items:center}.wz-cell-disabled{opacity:.5;cursor:not-allowed}.wz-cell-icon{color:var(--wz-text-color-regular,#666);align-items:center;margin-right:12px;font-size:16px;display:flex}.wz-cell-content{flex:1;min-width:0}.wz-cell-title{color:var(--wz-text-color-primary,#333);align-items:center;font-size:14px;display:flex}.wz-cell-title .wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;margin-left:8px;font-size:14px}.wz-cell-label{color:var(--wz-text-color-secondary,#999);margin-top:4px;font-size:13px}.wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;text-overflow:ellipsis;margin-left:8px;font-size:15px;overflow:hidden}.wz-cell-required{color:var(--wz-danger-color,#ff4d4f);margin-right:4px;font-size:15px;font-weight:600}.wz-cell-arrow{
|
|
1
|
+
.wz-cell-group{background-color:var(--wz-bg-color-white,#fff);border-radius:8px;overflow:hidden}.wz-cell-group .wz-cell{background-color:#0000;border-radius:0}.wz-cell{background-color:var(--wz-bg-color-white,#fff);-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;border-radius:8px;outline:none;align-items:center;padding:12px;line-height:1.5;display:flex;position:relative}.wz-cell-border:after{content:"";background-color:var(--wz-border-color-base,#dcdfe6);height:1px;position:absolute;bottom:0;left:12px;right:12px;transform:scaleY(.5)}.wz-cell-center{align-items:center}.wz-cell-disabled{opacity:.5;cursor:not-allowed}.wz-cell-icon{color:var(--wz-text-color-regular,#666);align-items:center;margin-right:12px;font-size:16px;display:flex}.wz-cell-content{flex:1;min-width:0}.wz-cell-title{color:var(--wz-text-color-primary,#333);align-items:center;font-size:14px;display:flex}.wz-cell-title .wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;margin-left:8px;font-size:14px}.wz-cell-label{color:var(--wz-text-color-secondary,#999);margin-top:4px;font-size:13px}.wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;text-overflow:ellipsis;margin-left:8px;font-size:15px;overflow:hidden}.wz-cell-required{color:var(--wz-danger-color,#ff4d4f);margin-right:4px;font-size:15px;font-weight:600}.wz-cell-arrow{color:var(--wz-text-color-secondary,#999);align-items:center;margin-left:12px;display:flex}.wz-cell-extra{color:var(--wz-text-color-regular,#666);align-items:center;min-width:0;margin-left:8px;font-size:15px;display:flex}.wz-cell:has(.wz-cell-arrow):active{background-color:var(--wz-bg-color-light,#f8f8f8)}
|
package/dist/Cell/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-cell-group .wz-cell{background-color:#0000;border-radius:0}.wz-cell{background-color:var(--wz-bg-color-white,#fff);-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;border-radius:8px;outline:none;align-items:center;padding:12px;line-height:1.5;display:flex;position:relative}.wz-cell-border:after{content:"";background-color:var(--wz-border-color-base,#dcdfe6);height:1px;position:absolute;bottom:0;left:12px;right:12px;transform:scaleY(.5)}.wz-cell-center{align-items:center}.wz-cell-disabled{opacity:.5;cursor:not-allowed}.wz-cell-icon{color:var(--wz-text-color-regular,#666);align-items:center;margin-right:12px;font-size:16px;display:flex}.wz-cell-content{flex:1;min-width:0}.wz-cell-title{color:var(--wz-text-color-primary,#333);align-items:center;font-size:14px;display:flex}.wz-cell-title .wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;margin-left:8px;font-size:14px}.wz-cell-label{color:var(--wz-text-color-secondary,#999);margin-top:4px;font-size:13px}.wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;text-overflow:ellipsis;margin-left:8px;font-size:15px;overflow:hidden}.wz-cell-required{color:var(--wz-danger-color,#ff4d4f);margin-right:4px;font-size:15px;font-weight:600}.wz-cell-arrow{
|
|
1
|
+
.wz-cell-group .wz-cell{background-color:#0000;border-radius:0}.wz-cell{background-color:var(--wz-bg-color-white,#fff);-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;border-radius:8px;outline:none;align-items:center;padding:12px;line-height:1.5;display:flex;position:relative}.wz-cell-border:after{content:"";background-color:var(--wz-border-color-base,#dcdfe6);height:1px;position:absolute;bottom:0;left:12px;right:12px;transform:scaleY(.5)}.wz-cell-center{align-items:center}.wz-cell-disabled{opacity:.5;cursor:not-allowed}.wz-cell-icon{color:var(--wz-text-color-regular,#666);align-items:center;margin-right:12px;font-size:16px;display:flex}.wz-cell-content{flex:1;min-width:0}.wz-cell-title{color:var(--wz-text-color-primary,#333);align-items:center;font-size:14px;display:flex}.wz-cell-title .wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;margin-left:8px;font-size:14px}.wz-cell-label{color:var(--wz-text-color-secondary,#999);margin-top:4px;font-size:13px}.wz-cell-value{color:var(--wz-text-color-regular,#666);white-space:nowrap;text-overflow:ellipsis;margin-left:8px;font-size:15px;overflow:hidden}.wz-cell-required{color:var(--wz-danger-color,#ff4d4f);margin-right:4px;font-size:15px;font-weight:600}.wz-cell-arrow{color:var(--wz-text-color-secondary,#999);align-items:center;margin-left:12px;display:flex}.wz-cell-extra{color:var(--wz-text-color-regular,#666);align-items:center;min-width:0;margin-left:8px;font-size:15px;display:flex}.wz-cell:has(.wz-cell-arrow):active{background-color:var(--wz-bg-color-light,#f8f8f8)}.wz-icon{justify-content:center;align-items:center;transition:color .2s ease-in-out;display:inline-flex}.wz-icon-home:before{content:""}.wz-icon-search:before{content:""}.wz-icon-person:before{content:""}.wz-icon-settings:before{content:""}.wz-icon-notifications:before{content:""}.wz-icon-message:before{content:""}.wz-icon-favorite:before{content:""}.wz-icon-star:before{content:""}.wz-icon-close:before{content:""}.wz-icon-check:before{content:""}.wz-icon-arrow-back:before{content:""}.wz-icon-arrow-forward:before{content:""}.wz-icon-menu:before{content:""}.wz-icon-more:before{content:""}.wz-icon-add:before{content:""}.wz-icon-edit:before{content:""}.wz-icon-delete:before{content:""}.wz-icon-share:before{content:""}.wz-icon-download:before{content:""}.wz-icon-upload:before{content:""}.wz-icon-refresh:before{content:""}.wz-icon-help:before{content:""}.wz-icon-info:before{content:""}.wz-icon-warning:before{content:""}.wz-icon-error:before{content:""}.wz-icon-success:before{content:""}.wz-cell-group{background-color:var(--wz-bg-color-white,#fff);border-radius:8px;overflow:hidden}
|
package/dist/CheckList/index.js
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
const Icon = ({
|
|
3
|
+
name,
|
|
4
|
+
size = 24,
|
|
5
|
+
color = "currentColor",
|
|
6
|
+
className = "",
|
|
7
|
+
style,
|
|
8
|
+
onClick,
|
|
9
|
+
type = "yunying"
|
|
10
|
+
// 默认使用yunying图标库
|
|
11
|
+
}) => {
|
|
12
|
+
const iconStyle = {
|
|
13
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
14
|
+
color,
|
|
15
|
+
...style
|
|
16
|
+
};
|
|
17
|
+
const iconFontClass = `iconfont-${type}`;
|
|
18
|
+
const iconPrefix = "icon-";
|
|
19
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
"i",
|
|
22
|
+
{
|
|
23
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
24
|
+
style: iconStyle,
|
|
25
|
+
onClick
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
2
29
|
const CheckList = ({ options, value, onChange, multiple = false, style, className = "" }) => {
|
|
3
30
|
const isChecked = (item) => {
|
|
4
31
|
if (multiple && Array.isArray(value)) return value.includes(item);
|
|
@@ -23,7 +50,7 @@ const CheckList = ({ options, value, onChange, multiple = false, style, classNam
|
|
|
23
50
|
onClick: () => handleClick(item),
|
|
24
51
|
children: [
|
|
25
52
|
/* @__PURE__ */ jsx("span", { className: "wz-check-list__label", children: item }),
|
|
26
|
-
isChecked(item) && /* @__PURE__ */ jsx("span", { className: "wz-check-list__icon", children: "
|
|
53
|
+
isChecked(item) && /* @__PURE__ */ jsx("span", { className: "wz-check-list__icon", children: /* @__PURE__ */ jsx(Icon, { name: "check", size: 18, type: "yunying" }) })
|
|
27
54
|
]
|
|
28
55
|
},
|
|
29
56
|
item
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["react/jsx-runtime"],s):(e="undefined"!=typeof globalThis?globalThis:e||self).CheckList=s(e.jsxRuntime)}(this,(function(e){"use strict";return({options:
|
|
1
|
+
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["react/jsx-runtime"],s):(e="undefined"!=typeof globalThis?globalThis:e||self).CheckList=s(e.jsxRuntime)}(this,(function(e){"use strict";const s=({name:s,size:i=24,color:n="currentColor",className:c="",style:t,onClick:l,type:o="yunying"})=>{const r={fontSize:"number"==typeof i?`${i}px`:i,color:n,...t},a=`iconfont-${o}`,u=`icon-${s}`;return e.jsx("i",{className:`wz-icon ${a} ${u} ${c}`,style:r,onClick:l})};return({options:i,value:n,onChange:c,multiple:t=!1,style:l,className:o=""})=>{const r=e=>t&&Array.isArray(n)?n.includes(e):n===e;return e.jsx("div",{className:`wz-check-list ${o}`,style:l,children:i.map((i=>e.jsxs("div",{className:"wz-check-list__item"+(r(i)?" wz-check-list__item--active":""),onClick:()=>(e=>{if(t){if(!Array.isArray(n))return;n.includes(e)?c(n.filter((s=>s!==e))):c([...n,e])}else c(e)})(i),children:[e.jsx("span",{className:"wz-check-list__label",children:i}),r(i)&&e.jsx("span",{className:"wz-check-list__icon",children:e.jsx(s,{name:"check",size:18,type:"yunying"})})]},i)))})}}));
|
package/dist/CheckList/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-check-list{margin:0;padding:0}.wz-check-list__item{font-size:var(--wz-check-list-font-size,15px);color:var(--wz-text-color-primary,#111);cursor:pointer;background:var(--wz-bg-color-white,#fff);border-radius:var(--wz-check-list-radius,8px);-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;justify-content:space-between;align-items:center;margin-bottom:2px;padding:15px 20px;transition:background .2s;display:flex}.wz-check-list__item--active{color:var(--wz-primary-color,#1677ff);background:var(--wz-bg-color-white,#fff);font-weight:700}.wz-check-list__label{flex:1}.wz-check-list__icon{color:var(--wz-primary-color,#1677ff);margin-left:8px;font-size:16px}
|
|
1
|
+
.wz-check-list{margin:0;padding:0}.wz-check-list__item{font-size:var(--wz-check-list-font-size,15px);color:var(--wz-text-color-primary,#111);cursor:pointer;background:var(--wz-bg-color-white,#fff);border-radius:var(--wz-check-list-radius,8px);-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;justify-content:space-between;align-items:center;margin-bottom:2px;padding:15px 20px;transition:background .2s;display:flex}.wz-check-list__item--active{color:var(--wz-primary-color,#1677ff);background:var(--wz-bg-color-white,#fff);font-weight:700}.wz-check-list__label{flex:1}.wz-check-list__icon{color:var(--wz-primary-color,#1677ff);margin-left:8px;font-size:16px}.wz-icon{justify-content:center;align-items:center;transition:color .2s ease-in-out;display:inline-flex}.wz-icon-home:before{content:""}.wz-icon-search:before{content:""}.wz-icon-person:before{content:""}.wz-icon-settings:before{content:""}.wz-icon-notifications:before{content:""}.wz-icon-message:before{content:""}.wz-icon-favorite:before{content:""}.wz-icon-star:before{content:""}.wz-icon-close:before{content:""}.wz-icon-check:before{content:""}.wz-icon-arrow-back:before{content:""}.wz-icon-arrow-forward:before{content:""}.wz-icon-menu:before{content:""}.wz-icon-more:before{content:""}.wz-icon-add:before{content:""}.wz-icon-edit:before{content:""}.wz-icon-delete:before{content:""}.wz-icon-share:before{content:""}.wz-icon-download:before{content:""}.wz-icon-upload:before{content:""}.wz-icon-refresh:before{content:""}.wz-icon-help:before{content:""}.wz-icon-info:before{content:""}.wz-icon-warning:before{content:""}.wz-icon-error:before{content:""}.wz-icon-success:before{content:""}
|
package/dist/Checkbox/index.js
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useContext, createContext } from "react";
|
|
3
|
+
const Icon = ({
|
|
4
|
+
name,
|
|
5
|
+
size = 24,
|
|
6
|
+
color = "currentColor",
|
|
7
|
+
className = "",
|
|
8
|
+
style,
|
|
9
|
+
onClick,
|
|
10
|
+
type = "yunying"
|
|
11
|
+
// 默认使用yunying图标库
|
|
12
|
+
}) => {
|
|
13
|
+
const iconStyle = {
|
|
14
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
15
|
+
color,
|
|
16
|
+
...style
|
|
17
|
+
};
|
|
18
|
+
const iconFontClass = `iconfont-${type}`;
|
|
19
|
+
const iconPrefix = "icon-";
|
|
20
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"i",
|
|
23
|
+
{
|
|
24
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
25
|
+
style: iconStyle,
|
|
26
|
+
onClick
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
3
30
|
const CheckboxContext = createContext({});
|
|
4
31
|
const Checkbox = ({
|
|
5
32
|
size,
|
|
@@ -29,6 +56,11 @@ const Checkbox = ({
|
|
|
29
56
|
const isChecked = isInGroup ? (_a = groupContext.value) == null ? void 0 : _a.includes(value) : checked;
|
|
30
57
|
const isDisabled = disabled || groupContext.disabled;
|
|
31
58
|
const checkboxSize = size || groupContext.size || "medium";
|
|
59
|
+
const iconSizeMap = {
|
|
60
|
+
small: 16,
|
|
61
|
+
medium: 18,
|
|
62
|
+
large: 20
|
|
63
|
+
};
|
|
32
64
|
return /* @__PURE__ */ jsxs(
|
|
33
65
|
"label",
|
|
34
66
|
{
|
|
@@ -47,7 +79,7 @@ const Checkbox = ({
|
|
|
47
79
|
...rest
|
|
48
80
|
}
|
|
49
81
|
),
|
|
50
|
-
/* @__PURE__ */ jsx("span", { className: "wz-checkbox-inner" }),
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "wz-checkbox-inner", children: /* @__PURE__ */ jsx(Icon, { name: isChecked ? "checkbox-checked" : "checkbox", type: "yunying", size: iconSizeMap[checkboxSize] }) }),
|
|
51
83
|
children && /* @__PURE__ */ jsx("span", { className: "wz-checkbox-label", children })
|
|
52
84
|
]
|
|
53
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,c){"object"==typeof exports&&"undefined"!=typeof module?module.exports=c(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],c):(e="undefined"!=typeof globalThis?globalThis:e||self).Checkbox=c(e.jsxRuntime,e.React)}(this,(function(e,c){"use strict";const l=({name:c,size:l=24,color:s="currentColor",className:n="",style:a,onClick:i,type:o="yunying"})=>{const t={fontSize:"number"==typeof l?`${l}px`:l,color:s,...a},r=`iconfont-${o}`,d=`icon-${c}`;return e.jsx("i",{className:`wz-icon ${r} ${d} ${n}`,style:t,onClick:i})},s=c.createContext({}),n=({size:n,checked:a,disabled:i,onChange:o,children:t,value:r,className:d="",style:u,...h})=>{var x;const b=c.useContext(s),m=!!b.value,p=m?null==(x=b.value)?void 0:x.includes(r):a,f=i||b.disabled,k=n||b.size||"medium";return e.jsxs("label",{className:`wz-checkbox-wrapper ${f?"wz-checkbox--disabled":""} wz-checkbox--${k} ${d}`,style:u,children:[e.jsx("input",{type:"checkbox",className:"wz-checkbox-input",checked:p,disabled:f,onChange:e=>{var c;if(!i&&!b.disabled)if(m){const l=e.target.checked?[...b.value||[],r]:(b.value||[]).filter((e=>e!==r));null==(c=b.onChange)||c.call(b,l)}else null==o||o(e.target.checked)},value:r,...h}),e.jsx("span",{className:"wz-checkbox-inner",children:e.jsx(l,{name:p?"checkbox-checked":"checkbox",type:"yunying",size:{small:16,medium:18,large:20}[k]})}),t&&e.jsx("span",{className:"wz-checkbox-label",children:t})]})},a=({value:l,defaultValue:n,onChange:a,disabled:i,size:o,children:t,className:r="",style:d})=>{const[u,h]=c.useState(n||[]),x={value:void 0!==l?l:u,onChange:e=>{h(e),null==a||a(e)},disabled:i,size:o};return e.jsx(s.Provider,{value:x,children:e.jsx("div",{className:`wz-checkbox-group ${r}`,style:d,children:t})})};return n.Group=a,n.displayName="Checkbox",a.displayName="Checkbox.Group",n}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-checkbox-group{flex-direction:column;gap:12px;display:inline-flex}.wz-checkbox-group.wz-checkbox-group--horizontal{flex-direction:row;align-items:center}.wz-checkbox-wrapper{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none;align-items:center;padding:8px 0;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;transition:all .2s ease-in-out;display:inline-flex;position:relative}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-inner{
|
|
1
|
+
.wz-checkbox-group{flex-direction:column;gap:12px;display:inline-flex}.wz-checkbox-group.wz-checkbox-group--horizontal{flex-direction:row;align-items:center}.wz-checkbox-wrapper{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none;align-items:center;padding:8px 0;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;transition:all .2s ease-in-out;display:inline-flex;position:relative}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-inner{font-size:16px}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-label{margin-left:8px;font-size:13px}.wz-checkbox-wrapper.wz-checkbox--medium .wz-checkbox-inner{font-size:18px}.wz-checkbox-wrapper.wz-checkbox--medium .wz-checkbox-label{margin-left:12px;font-size:14px}.wz-checkbox-wrapper.wz-checkbox--large .wz-checkbox-inner{font-size:20px}.wz-checkbox-wrapper.wz-checkbox--large .wz-checkbox-label{margin-left:16px;font-size:16px}.wz-checkbox-wrapper.wz-checkbox--disabled{cursor:not-allowed;opacity:.6}.wz-checkbox-wrapper.wz-checkbox--disabled .wz-checkbox-label{color:var(--wz-disabled-color,#c0c4cc)}.wz-checkbox-input{opacity:0;z-index:-1;width:0;height:0;margin:0;padding:0;position:absolute}.wz-checkbox-inner{color:var(--wz-border-color-base,#dcdfe6);justify-content:center;align-items:center;transition:all .2s cubic-bezier(.4,0,.2,1);display:inline-flex;position:relative}.wz-checkbox-input:checked+.wz-checkbox-inner,.wz-checkbox-input:focus+.wz-checkbox-inner{color:var(--wz-primary-color,#22c94d)}.wz-checkbox-wrapper:hover .wz-checkbox-inner{color:var(--wz-primary-color,#22c94d);opacity:.8}.wz-checkbox-label{color:var(--wz-text-color-primary,#333);font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;line-height:1.5;transition:color .2s}.wz-checkbox-wrapper:hover .wz-checkbox-label{color:var(--wz-primary-color,#22c94d)}@media screen and (max-width:767px){.wz-checkbox-group{gap:8px}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-label{font-size:14px}.wz-checkbox-wrapper.wz-checkbox--medium .wz-checkbox-label{font-size:15px}.wz-checkbox-wrapper.wz-checkbox--large .wz-checkbox-label{font-size:16px}}
|
package/dist/Checkbox/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-checkbox-group{flex-direction:column;gap:12px;display:inline-flex}.wz-checkbox-group.wz-checkbox-group--horizontal{flex-direction:row;align-items:center}.wz-checkbox-wrapper{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none;align-items:center;padding:8px 0;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;transition:all .2s ease-in-out;display:inline-flex;position:relative}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-inner{
|
|
1
|
+
.wz-checkbox-group{flex-direction:column;gap:12px;display:inline-flex}.wz-checkbox-group.wz-checkbox-group--horizontal{flex-direction:row;align-items:center}.wz-checkbox-wrapper{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;outline:none;align-items:center;padding:8px 0;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;transition:all .2s ease-in-out;display:inline-flex;position:relative}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-inner{font-size:16px}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-label{margin-left:8px;font-size:13px}.wz-checkbox-wrapper.wz-checkbox--medium .wz-checkbox-inner{font-size:18px}.wz-checkbox-wrapper.wz-checkbox--medium .wz-checkbox-label{margin-left:12px;font-size:14px}.wz-checkbox-wrapper.wz-checkbox--large .wz-checkbox-inner{font-size:20px}.wz-checkbox-wrapper.wz-checkbox--large .wz-checkbox-label{margin-left:16px;font-size:16px}.wz-checkbox-wrapper.wz-checkbox--disabled{cursor:not-allowed;opacity:.6}.wz-checkbox-wrapper.wz-checkbox--disabled .wz-checkbox-label{color:var(--wz-disabled-color,#c0c4cc)}.wz-checkbox-input{opacity:0;z-index:-1;width:0;height:0;margin:0;padding:0;position:absolute}.wz-checkbox-inner{color:var(--wz-border-color-base,#dcdfe6);justify-content:center;align-items:center;transition:all .2s cubic-bezier(.4,0,.2,1);display:inline-flex;position:relative}.wz-checkbox-input:checked+.wz-checkbox-inner,.wz-checkbox-input:focus+.wz-checkbox-inner{color:var(--wz-primary-color,#22c94d)}.wz-checkbox-wrapper:hover .wz-checkbox-inner{color:var(--wz-primary-color,#22c94d);opacity:.8}.wz-checkbox-label{color:var(--wz-text-color-primary,#333);font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;line-height:1.5;transition:color .2s}.wz-checkbox-wrapper:hover .wz-checkbox-label{color:var(--wz-primary-color,#22c94d)}@media screen and (max-width:767px){.wz-checkbox-group{gap:8px}.wz-checkbox-wrapper.wz-checkbox--small .wz-checkbox-label{font-size:14px}.wz-checkbox-wrapper.wz-checkbox--medium .wz-checkbox-label{font-size:15px}.wz-checkbox-wrapper.wz-checkbox--large .wz-checkbox-label{font-size:16px}}.wz-icon{justify-content:center;align-items:center;transition:color .2s ease-in-out;display:inline-flex}.wz-icon-home:before{content:""}.wz-icon-search:before{content:""}.wz-icon-person:before{content:""}.wz-icon-settings:before{content:""}.wz-icon-notifications:before{content:""}.wz-icon-message:before{content:""}.wz-icon-favorite:before{content:""}.wz-icon-star:before{content:""}.wz-icon-close:before{content:""}.wz-icon-check:before{content:""}.wz-icon-arrow-back:before{content:""}.wz-icon-arrow-forward:before{content:""}.wz-icon-menu:before{content:""}.wz-icon-more:before{content:""}.wz-icon-add:before{content:""}.wz-icon-edit:before{content:""}.wz-icon-delete:before{content:""}.wz-icon-share:before{content:""}.wz-icon-download:before{content:""}.wz-icon-upload:before{content:""}.wz-icon-refresh:before{content:""}.wz-icon-help:before{content:""}.wz-icon-info:before{content:""}.wz-icon-warning:before{content:""}.wz-icon-error:before{content:""}.wz-icon-success:before{content:""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-date-picker{background:var(--wz-date-picker-bg,#f5f5f5);-webkit-user-select:none;user-select:none;touch-action:pan-y;width:100%;position:relative;overflow:hidden}.wz-date-picker-columns{flex-direction:row;width:100%;height:100%;display:flex}.wz-date-picker-list{-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;flex:1 1 0;min-width:0;position:relative;overflow-y:scroll}.wz-date-picker-list::-webkit-scrollbar{display:none}.wz-date-picker-item{color:var(--wz-date-picker-item-color,#bbb);background:0 0;justify-content:center;align-items:center;font-family:"阿里巴巴普惠体 2.0";font-size:20px;font-weight:600;transition:color .2s;display:flex}.wz-date-picker-item.active{color:var(--wz-date-picker-active-color,#000)}.wz-date-picker-mask{z-index:3;pointer-events:none;position:absolute;left:0;right:0}.wz-date-picker-mask-top{background:linear-gradient(to bottom,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);top:0}.wz-date-picker-mask-bottom{background:linear-gradient(to top,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);bottom:0}.wz-date-picker-indicator{z-index:1;pointer-events:none;border-radius:var(--wz-date-picker-radius,10px);background:var(--wz-date-picker-active-bg,#fff);position:absolute;top:50%;left:
|
|
1
|
+
.wz-date-picker{background:var(--wz-date-picker-bg,#f5f5f5);-webkit-user-select:none;user-select:none;touch-action:pan-y;width:100%;position:relative;overflow:hidden}.wz-date-picker-columns{flex-direction:row;width:100%;height:100%;display:flex}.wz-date-picker-list{-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;flex:1 1 0;min-width:0;position:relative;overflow-y:scroll}.wz-date-picker-list::-webkit-scrollbar{display:none}.wz-date-picker-item{color:var(--wz-date-picker-item-color,#bbb);background:0 0;justify-content:center;align-items:center;font-family:"阿里巴巴普惠体 2.0";font-size:20px;font-weight:600;transition:color .2s;display:flex}.wz-date-picker-item.active{color:var(--wz-date-picker-active-color,#000)}.wz-date-picker-mask{z-index:3;pointer-events:none;position:absolute;left:0;right:0}.wz-date-picker-mask-top{background:linear-gradient(to bottom,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);top:0}.wz-date-picker-mask-bottom{background:linear-gradient(to top,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);bottom:0}.wz-date-picker-indicator{z-index:1;pointer-events:none;border-radius:var(--wz-date-picker-radius,10px);background:var(--wz-date-picker-active-bg,#fff);position:absolute;top:50%;left:0;right:0;transform:translateY(-50%)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.wz-date-picker{background:var(--wz-date-picker-bg,#f5f5f5);-webkit-user-select:none;user-select:none;touch-action:pan-y;width:100%;position:relative;overflow:hidden}.wz-date-picker-columns{flex-direction:row;width:100%;height:100%;display:flex}.wz-date-picker-list{-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;flex:1 1 0;min-width:0;position:relative;overflow-y:scroll}.wz-date-picker-list::-webkit-scrollbar{display:none}.wz-date-picker-item{color:var(--wz-date-picker-item-color,#bbb);background:0 0;justify-content:center;align-items:center;font-family:"阿里巴巴普惠体 2.0";font-size:20px;font-weight:600;transition:color .2s;display:flex}.wz-date-picker-item.active{color:var(--wz-date-picker-active-color,#000)}.wz-date-picker-mask{z-index:3;pointer-events:none;position:absolute;left:0;right:0}.wz-date-picker-mask-top{background:linear-gradient(to bottom,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);top:0}.wz-date-picker-mask-bottom{background:linear-gradient(to top,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);bottom:0}.wz-date-picker-indicator{z-index:1;pointer-events:none;border-radius:var(--wz-date-picker-radius,10px);background:var(--wz-date-picker-active-bg,#fff);position:absolute;top:50%;left:
|
|
1
|
+
.wz-date-picker{background:var(--wz-date-picker-bg,#f5f5f5);-webkit-user-select:none;user-select:none;touch-action:pan-y;width:100%;position:relative;overflow:hidden}.wz-date-picker-columns{flex-direction:row;width:100%;height:100%;display:flex}.wz-date-picker-list{-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;flex:1 1 0;min-width:0;position:relative;overflow-y:scroll}.wz-date-picker-list::-webkit-scrollbar{display:none}.wz-date-picker-item{color:var(--wz-date-picker-item-color,#bbb);background:0 0;justify-content:center;align-items:center;font-family:"阿里巴巴普惠体 2.0";font-size:20px;font-weight:600;transition:color .2s;display:flex}.wz-date-picker-item.active{color:var(--wz-date-picker-active-color,#000)}.wz-date-picker-mask{z-index:3;pointer-events:none;position:absolute;left:0;right:0}.wz-date-picker-mask-top{background:linear-gradient(to bottom,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);top:0}.wz-date-picker-mask-bottom{background:linear-gradient(to top,var(--wz-date-picker-bg,#f5f5f5)20%,#f5f5f500);bottom:0}.wz-date-picker-indicator{z-index:1;pointer-events:none;border-radius:var(--wz-date-picker-radius,10px);background:var(--wz-date-picker-active-bg,#fff);position:absolute;top:50%;left:0;right:0;transform:translateY(-50%)}
|
|
@@ -149,6 +149,33 @@ const DatePicker = ({
|
|
|
149
149
|
/* @__PURE__ */ jsx("div", { className: "wz-date-picker-mask wz-date-picker-mask-bottom", style: { height: itemHeight } })
|
|
150
150
|
] });
|
|
151
151
|
};
|
|
152
|
+
const Icon = ({
|
|
153
|
+
name,
|
|
154
|
+
size = 24,
|
|
155
|
+
color = "currentColor",
|
|
156
|
+
className = "",
|
|
157
|
+
style,
|
|
158
|
+
onClick,
|
|
159
|
+
type = "yunying"
|
|
160
|
+
// 默认使用yunying图标库
|
|
161
|
+
}) => {
|
|
162
|
+
const iconStyle = {
|
|
163
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
164
|
+
color,
|
|
165
|
+
...style
|
|
166
|
+
};
|
|
167
|
+
const iconFontClass = `iconfont-${type}`;
|
|
168
|
+
const iconPrefix = "icon-";
|
|
169
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
170
|
+
return /* @__PURE__ */ jsx(
|
|
171
|
+
"i",
|
|
172
|
+
{
|
|
173
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
174
|
+
style: iconStyle,
|
|
175
|
+
onClick
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
};
|
|
152
179
|
const DateRangePicker = ({
|
|
153
180
|
value,
|
|
154
181
|
onChange,
|
|
@@ -157,7 +184,10 @@ const DateRangePicker = ({
|
|
|
157
184
|
startLabel = "开始时间",
|
|
158
185
|
endLabel = "结束时间",
|
|
159
186
|
className = "",
|
|
160
|
-
style
|
|
187
|
+
style,
|
|
188
|
+
showLongTerm = false,
|
|
189
|
+
longTermLabel = "长期有效",
|
|
190
|
+
longTermValue = "9999-12-31"
|
|
161
191
|
}) => {
|
|
162
192
|
const todayStr = React.useMemo(() => {
|
|
163
193
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -169,6 +199,7 @@ const DateRangePicker = ({
|
|
|
169
199
|
const [innerValue, setInnerValue] = useState(value || [todayStr, todayStr]);
|
|
170
200
|
const range = value || innerValue;
|
|
171
201
|
const [active, setActive] = useState("start");
|
|
202
|
+
const isLongTerm = range[1] === longTermValue;
|
|
172
203
|
const handleSelect = (val) => {
|
|
173
204
|
if (active === "start") {
|
|
174
205
|
const newRange = [val, range[1] && range[1] >= val ? range[1] : val];
|
|
@@ -180,6 +211,17 @@ const DateRangePicker = ({
|
|
|
180
211
|
onChange == null ? void 0 : onChange(newRange);
|
|
181
212
|
}
|
|
182
213
|
};
|
|
214
|
+
const handleLongTermToggle = () => {
|
|
215
|
+
if (isLongTerm) {
|
|
216
|
+
const newRange = [range[0], range[0]];
|
|
217
|
+
setInnerValue(newRange);
|
|
218
|
+
onChange == null ? void 0 : onChange(newRange);
|
|
219
|
+
} else {
|
|
220
|
+
const newRange = [range[0], longTermValue];
|
|
221
|
+
setInnerValue(newRange);
|
|
222
|
+
onChange == null ? void 0 : onChange(newRange);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
183
225
|
return /* @__PURE__ */ jsxs("div", { className: `wz-date-range-picker ${className}`, style, children: [
|
|
184
226
|
/* @__PURE__ */ jsxs("div", { className: "wz-date-range-picker-label-row", children: [
|
|
185
227
|
/* @__PURE__ */ jsx("div", { className: "wz-date-range-picker-label", children: startLabel }),
|
|
@@ -195,14 +237,28 @@ const DateRangePicker = ({
|
|
|
195
237
|
}
|
|
196
238
|
) }),
|
|
197
239
|
/* @__PURE__ */ jsx("div", { className: "wz-date-range-picker-sep", children: "至" }),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
240
|
+
/* @__PURE__ */ jsxs("div", { className: "wz-date-range-picker-col", children: [
|
|
241
|
+
/* @__PURE__ */ jsx(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
className: `wz-date-range-picker-value${active === "end" ? " active" : ""}${isLongTerm ? " disabled" : ""}`,
|
|
245
|
+
onClick: () => !isLongTerm && setActive("end"),
|
|
246
|
+
children: isLongTerm ? longTermLabel : range[1] || "请选择"
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
showLongTerm && /* @__PURE__ */ jsxs("div", { className: "wz-date-range-picker-long-term", onClick: handleLongTermToggle, children: [
|
|
250
|
+
/* @__PURE__ */ jsx(
|
|
251
|
+
Icon,
|
|
252
|
+
{
|
|
253
|
+
name: isLongTerm ? "radio-sel" : "radio-nor",
|
|
254
|
+
type: "yunying",
|
|
255
|
+
size: 20,
|
|
256
|
+
color: isLongTerm ? "var(--active-color)" : "#ccc"
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ jsx("span", { className: "wz-date-range-picker-long-term-text", children: longTermLabel })
|
|
260
|
+
] })
|
|
261
|
+
] })
|
|
206
262
|
] }),
|
|
207
263
|
/* @__PURE__ */ jsx("div", { className: "wz-date-range-picker-picker", children: /* @__PURE__ */ jsx(
|
|
208
264
|
DatePicker,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],r):(e="undefined"!=typeof globalThis?globalThis:e||self).DateRangePicker=r(e.jsxRuntime,e.React)}(this,(function(e,r){"use strict";const t=({value:t,onChange:n,min:a="1970-01-01",max:c="2100-12-31",columns:s=["year","month","day"],itemHeight:l=48,className:o="",style:i})=>{const u=new Date,[d,m,p]=t?t.split("-").map(Number):[u.getFullYear(),u.getMonth()+1,u.getDate()],h=Number(a.split("-")[0]),g=Number(c.split("-")[0]),f=r.useMemo((()=>((e,r)=>{const t=[];for(let n=e;n<=r;n++)t.push(n.toString());return t})(h,g)),[h,g]),[y,v]=r.useState(d),[x,N]=r.useState(m),[$,k]=r.useState(p),S=Array.from({length:12},((e,r)=>(r+1).toString().padStart(2,"0"))),j=((e,r)=>{const t=new Date(e,r,0).getDate();return Array.from({length:t},((e,r)=>(r+1).toString().padStart(2,"0")))})(y,x),w=r.useRef(null),b=r.useRef(null),z=r.useRef(null),T=r.useRef(0),M=r.useRef(0),R=r.useRef(!1),C=r.useRef(null);r.useLayoutEffect((()=>{w.current&&w.current.scrollTo({top:(y-h)*l,behavior:"auto"})}),[y,l,h]),r.useLayoutEffect((()=>{b.current&&b.current.scrollTo({top:(x-1)*l,behavior:"auto"})}),[x,l]),r.useLayoutEffect((()=>{z.current&&z.current.scrollTo({top:($-1)*l,behavior:"auto"})}),[$,l]);const D=e=>r=>{var t,n,a;R.current=!0,C.current=e,T.current=r.touches[0].clientY;let c=0;"year"===e&&(c=(null==(t=w.current)?void 0:t.scrollTop)||0),"month"===e&&(c=(null==(n=b.current)?void 0:n.scrollTop)||0),"day"===e&&(c=(null==(a=z.current)?void 0:a.scrollTop)||0),M.current=c},L=e=>{if(!R.current||!C.current)return;const r=e.touches[0].clientY-T.current;"year"===C.current&&w.current&&(w.current.scrollTop=M.current-r),"month"===C.current&&b.current&&(b.current.scrollTop=M.current-r),"day"===C.current&&z.current&&(z.current.scrollTop=M.current-r)},E=()=>{if(R.current&&C.current){if("year"===C.current&&w.current){const e=Math.round(w.current.scrollTop/l);v(Number(f[e])),null==n||n(`${f[e]}-${x.toString().padStart(2,"0")}-${$.toString().padStart(2,"0")}`)}if("month"===C.current&&b.current){const e=Math.round(b.current.scrollTop/l);N(Number(S[e])),null==n||n(`${y}-${S[e]}-${$.toString().padStart(2,"0")}`)}if("day"===C.current&&z.current){const e=Math.round(z.current.scrollTop/l);k(Number(j[e])),null==n||n(`${y}-${x.toString().padStart(2,"0")}-${j[e]}`)}R.current=!1,C.current=null}},Y=e=>()=>{if(!R.current){if("year"===e&&w.current){const e=Math.round(w.current.scrollTop/l);v(Number(f[e])),null==n||n(`${f[e]}-${x.toString().padStart(2,"0")}-${$.toString().padStart(2,"0")}`)}if("month"===e&&b.current){const e=Math.round(b.current.scrollTop/l);N(Number(S[e])),null==n||n(`${y}-${S[e]}-${$.toString().padStart(2,"0")}`)}if("day"===e&&z.current){const e=Math.round(z.current.scrollTop/l);k(Number(j[e])),null==n||n(`${y}-${x.toString().padStart(2,"0")}-${j[e]}`)}}};r.useEffect((()=>{if(t){const[e,r,n]=t.split("-").map(Number);v(e),N(r),k(n),w.current&&w.current.scrollTo({top:(e-h)*l,behavior:"auto"}),b.current&&b.current.scrollTo({top:(r-1)*l,behavior:"auto"}),z.current&&z.current.scrollTo({top:(n-1)*l,behavior:"auto"})}}),[t]);const q=(r,t,n,a)=>e.jsxs("div",{className:"wz-date-picker-list",ref:n,style:{height:3*l},onTouchStart:D(a),onTouchMove:L,onTouchEnd:E,onScroll:Y(a),children:[e.jsx("div",{style:{height:l}}),r.map(((r,n)=>e.jsx("div",{className:"wz-date-picker-item"+(n===t?" active":""),style:{height:l},children:"year"===a?`${r}年`:"month"===a?`${r}月`:`${r}日`},r))),e.jsx("div",{style:{height:l}})]});return e.jsxs("div",{className:`wz-date-picker ${o}`,style:i,children:[e.jsx("div",{className:"wz-date-picker-mask wz-date-picker-mask-top",style:{height:l}}),e.jsx("div",{className:"wz-date-picker-indicator",style:{height:l}}),e.jsxs("div",{className:"wz-date-picker-columns",children:[s.includes("year")&&q(f,y-h,w,"year"),s.includes("month")&&q(S,x-1,b,"month"),s.includes("day")&&q(j,$-1,z,"day")]}),e.jsx("div",{className:"wz-date-picker-mask wz-date-picker-mask-bottom",style:{height:l}})]})},n=({name:r,size:t=24,color:n="currentColor",className:a="",style:c,onClick:s,type:l="yunying"})=>{const o={fontSize:"number"==typeof t?`${t}px`:t,color:n,...c},i=`iconfont-${l}`,u=`icon-${r}`;return e.jsx("i",{className:`wz-icon ${i} ${u} ${a}`,style:o,onClick:s})};return({value:a,onChange:c,min:s="1970-01-01",max:l="2100-12-31",startLabel:o="开始时间",endLabel:i="结束时间",className:u="",style:d,showLongTerm:m=!1,longTermLabel:p="长期有效",longTermValue:h="9999-12-31"})=>{const g=r.useMemo((()=>{const e=new Date;return`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}`}),[]),[f,y]=r.useState(a||[g,g]),v=a||f,[x,N]=r.useState("start"),$=v[1]===h;return e.jsxs("div",{className:`wz-date-range-picker ${u}`,style:d,children:[e.jsxs("div",{className:"wz-date-range-picker-label-row",children:[e.jsx("div",{className:"wz-date-range-picker-label",children:o}),e.jsx("div",{className:"wz-date-range-picker-label",children:i})]}),e.jsxs("div",{className:"wz-date-range-picker-row",children:[e.jsx("div",{className:"wz-date-range-picker-col",children:e.jsx("div",{className:"wz-date-range-picker-value"+("start"===x?" active":""),onClick:()=>N("start"),children:v[0]||"请选择"})}),e.jsx("div",{className:"wz-date-range-picker-sep",children:"至"}),e.jsxs("div",{className:"wz-date-range-picker-col",children:[e.jsx("div",{className:`wz-date-range-picker-value${"end"===x?" active":""}${$?" disabled":""}`,onClick:()=>!$&&N("end"),children:$?p:v[1]||"请选择"}),m&&e.jsxs("div",{className:"wz-date-range-picker-long-term",onClick:()=>{if($){const e=[v[0],v[0]];y(e),null==c||c(e)}else{const e=[v[0],h];y(e),null==c||c(e)}},children:[e.jsx(n,{name:$?"radio-sel":"radio-nor",type:"yunying",size:20,color:$?"var(--active-color)":"#ccc"}),e.jsx("span",{className:"wz-date-range-picker-long-term-text",children:p})]})]})]}),e.jsx("div",{className:"wz-date-range-picker-picker",children:e.jsx(t,{value:"start"===x?v[0]:v[1],onChange:e=>{if("start"===x){const r=[e,v[1]&&v[1]>=e?v[1]:e];y(r),null==c||c(r)}else{const r=[v[0],e&&e>=v[0]?e:v[0]];y(r),null==c||c(r)}},min:s,max:l})})]})}}));
|