@unicom-cloud/ui 0.8.102 → 0.8.103
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/Copy.js +1 -1
- package/LiquidFill.js +1 -1
- package/Marquee.js +2 -2
- package/QrCode.js +1 -1
- package/Tour.js +1 -1
- package/components/common/space/index.js +24 -24
- package/copy/index.js +1 -1
- package/grid/Col.js +32 -32
- package/grid/Row.js +53 -44
- package/liquid-fill/index.js +1 -1
- package/liquid-fill/interface.js +1 -0
- package/marquee/index.js +138 -221
- package/marquee/interface.js +1 -0
- package/marquee-/index.js +260 -0
- package/marquee-/interface.js +1 -0
- package/package.json +1 -1
- package/qr-code/index.js +1 -1
- package/style.css +1 -1
- package/table/hook/useThResizable.js +1 -1
- package/table/th-resizable/index.js +1 -1
- package/tour/index.js +1 -1
- package/tour/interface.js +1 -0
- package/types/pc/config-provider/interface.d.ts +8 -8
- package/types/pc/grid/Row.d.ts +2 -1
- package/types/pc/index.d.ts +4 -4
- package/types/pc/liquid-fill/index.d.ts +2 -113
- package/types/pc/liquid-fill/interface.d.ts +113 -0
- package/types/pc/marquee/index.d.ts +3 -60
- package/types/pc/marquee/interface.d.ts +95 -0
- package/types/pc/marquee-/index.d.ts +8 -0
- package/types/pc/marquee-/interface.d.ts +56 -0
- package/types/pc/qr-code/index.d.ts +1 -31
- package/types/pc/qr-code/interface.d.ts +26 -33
- package/types/pc/tour/index.d.ts +2 -45
- package/types/pc/tour/interface.d.ts +46 -0
- package/types/pc/utils/responsiveObserve.d.ts +8 -4
- package/typography/Ellipsis.js +1 -1
- package/typography/Operations.js +1 -1
- package/utils/responsiveObserve.js +32 -25
- package/version/index.js +1 -1
package/marquee/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useContext as
|
|
1
|
+
import { jsx as s, Fragment as et, jsxs as j } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as rt, useContext as it, useState as y, useRef as k, useCallback as A, useEffect as R, useMemo as f, Fragment as ot, Children as H } from "react";
|
|
3
3
|
import "../config-provider/ConfigProvider.js";
|
|
4
4
|
import "lodash/isEqualWith";
|
|
5
5
|
import "../components/common/utils/is.js";
|
|
6
6
|
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
7
7
|
import "lodash/isNumber";
|
|
8
|
-
import "lodash/merge";
|
|
8
|
+
import nt from "lodash/merge";
|
|
9
9
|
import "../components/common/utils/dom.js";
|
|
10
10
|
import "../components/common/hooks/useIntersectionObserver.js";
|
|
11
|
-
import
|
|
11
|
+
import st from "../components/common/hooks/useMergeProps.js";
|
|
12
12
|
import "../components/common/utils/reactDOM.js";
|
|
13
13
|
import "@unicom-cloud/utils/constant";
|
|
14
14
|
import "lodash/debounce";
|
|
15
15
|
import "@unicom-cloud/utils/date";
|
|
16
16
|
import "@unicom-cloud/utils/case-name";
|
|
17
|
-
import
|
|
17
|
+
import mt from "@unicom-cloud/utils/class-name";
|
|
18
18
|
import "@unicom-cloud/utils/constant/ui";
|
|
19
19
|
import "../utils/contextHolder.js";
|
|
20
20
|
import "@unicom-cloud/utils/clipboard-copy";
|
|
@@ -45,7 +45,8 @@ import "../dist/react-transition-group/src/ReplaceTransition.js";
|
|
|
45
45
|
import "../dist/react-transition-group/src/SwitchTransition.js";
|
|
46
46
|
import "../dist/react-transition-group/chunk/CPfP7aNL.js";
|
|
47
47
|
import "../dist/react-transition-group/src/TransitionGroup.js";
|
|
48
|
-
import { resizeObserver as
|
|
48
|
+
import { resizeObserver as at } from "../components/common/utils/resizeObserver.js";
|
|
49
|
+
import "uuid";
|
|
49
50
|
import "@unicom-cloud/utils/file/saveAs";
|
|
50
51
|
import "@unicom-cloud/utils/screenfull";
|
|
51
52
|
import "@unicom-cloud/utils/tinycolor";
|
|
@@ -53,232 +54,148 @@ import "@unicom-cloud/utils/ui-color";
|
|
|
53
54
|
import "@unicom-cloud/utils/constant/ui.js";
|
|
54
55
|
import "react-is";
|
|
55
56
|
import "@unicom-cloud/utils/tree";
|
|
56
|
-
import "@unicom-cloud/utils/is";
|
|
57
|
-
import "uuid";
|
|
57
|
+
import { isPlainObject as lt } from "@unicom-cloud/utils/is";
|
|
58
58
|
import "../dist/validate/src/index.js";
|
|
59
|
-
import
|
|
60
|
-
const
|
|
59
|
+
import pt from "../config-provider/context.js";
|
|
60
|
+
const ct = {
|
|
61
61
|
speed: 50,
|
|
62
|
-
// 默认50像素/秒(数值越大越快)
|
|
63
62
|
direction: "left",
|
|
64
63
|
pauseOnHover: !1,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
64
|
+
loop: 0
|
|
65
|
+
}, ye = rt(
|
|
66
|
+
function(B, E) {
|
|
67
|
+
const { getPrefixCls: z, componentConfig: I } = it(pt), i = z?.("marquee"), t = z?.("marquee-var"), V = st(
|
|
68
|
+
B,
|
|
69
|
+
ct,
|
|
70
|
+
I?.Marquee
|
|
71
|
+
), {
|
|
72
|
+
style: W = {},
|
|
73
|
+
className: _,
|
|
74
|
+
autoFill: m = !1,
|
|
75
|
+
play: p = !0,
|
|
76
|
+
pauseOnHover: C = !1,
|
|
77
|
+
pauseOnClick: v = !1,
|
|
78
|
+
direction: e = "left",
|
|
79
|
+
speed: M = 50,
|
|
80
|
+
delay: F = 0,
|
|
81
|
+
loop: q = 0,
|
|
82
|
+
gradient: D,
|
|
83
|
+
onFinish: G,
|
|
84
|
+
onCycleComplete: J,
|
|
85
|
+
onMount: x,
|
|
86
|
+
children: h
|
|
87
|
+
} = V, K = e === "left" || e === "right";
|
|
88
|
+
let r = D;
|
|
89
|
+
r === !0 && (r = {}), lt(r) && (r = nt(
|
|
90
|
+
{ size: K ? 50 : 20, color: "#fff" },
|
|
91
|
+
r
|
|
92
|
+
));
|
|
93
|
+
const [O, L] = y(0), [g, Q] = y(0), [$, T] = y(1), [w, U] = y(!1), X = k(null), a = E || X, c = k(null), u = A(() => {
|
|
94
|
+
if (c.current && a.current) {
|
|
95
|
+
const o = a.current.getBoundingClientRect(), d = c.current.getBoundingClientRect();
|
|
96
|
+
let n = o.width, l = d.width;
|
|
97
|
+
(e === "up" || e === "down") && (n = o.height, l = d.height), T(
|
|
98
|
+
m && n && l ? Math.max(2, Math.ceil(n / l)) : 1
|
|
99
|
+
), L(n), Q(l);
|
|
99
100
|
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
}, [m, a, e]);
|
|
102
|
+
R(() => {
|
|
103
|
+
if (!w) return;
|
|
104
|
+
u();
|
|
105
|
+
const o = at(
|
|
106
|
+
[a.current, c.current],
|
|
107
|
+
u
|
|
108
|
+
);
|
|
109
|
+
return () => {
|
|
110
|
+
o();
|
|
111
|
+
};
|
|
112
|
+
}, [u, a, c, w]), R(() => (u(), () => {
|
|
113
|
+
}), [u, h]), R(() => (U(!0), x && x(), () => {
|
|
114
|
+
}), [x]);
|
|
115
|
+
const P = f(() => g ? m ? g * $ / M : Math.max(O, g) / M : 0, [m, O, g, $, M]), Y = f(
|
|
116
|
+
() => ({
|
|
117
|
+
...W,
|
|
118
|
+
[`--${t}-pause-on-hover`]: !p || C ? "paused" : "running",
|
|
119
|
+
[`--${t}-pause-on-click`]: !p || C && !v || v ? "paused" : "running",
|
|
120
|
+
[`--${t}-width`]: e === "up" || e === "down" ? "100vh" : "100%",
|
|
121
|
+
[`--${t}-transform`]: e === "up" ? "rotate(-90deg)" : e === "down" ? "rotate(90deg)" : "none"
|
|
122
|
+
}),
|
|
123
|
+
[W, t, p, C, v, e]
|
|
124
|
+
), Z = f(
|
|
125
|
+
() => ({
|
|
126
|
+
[`--${t}-gradient-color`]: r?.color,
|
|
127
|
+
[`--${t}-gradient-width`]: typeof r?.size == "number" ? `${r?.size}px` : r?.size
|
|
128
|
+
}),
|
|
129
|
+
[r?.color, r?.size, t]
|
|
130
|
+
), S = f(
|
|
131
|
+
() => ({
|
|
132
|
+
[`--${t}-play`]: p ? "running" : "paused",
|
|
133
|
+
[`--${t}-direction`]: e === "left" ? "normal" : "reverse",
|
|
134
|
+
[`--${t}-duration`]: `${P}s`,
|
|
135
|
+
[`--${t}-delay`]: `${F}s`,
|
|
136
|
+
[`--${t}-iteration-count`]: q ? `${q}` : "infinite",
|
|
137
|
+
[`--${t}-min-width`]: m ? "auto" : "100%"
|
|
138
|
+
}),
|
|
139
|
+
[t, p, e, P, F, q, m]
|
|
140
|
+
), N = f(
|
|
141
|
+
() => ({
|
|
142
|
+
[`--${t}-transform`]: e === "up" ? "rotate(90deg)" : e === "down" ? "rotate(-90deg)" : "none"
|
|
143
|
+
}),
|
|
144
|
+
[e, t]
|
|
145
|
+
), b = A(
|
|
146
|
+
(o) => Array.from({ length: o }).map((d, n) => /* @__PURE__ */ s(ot, { children: H.map(h, (l, tt) => /* @__PURE__ */ s(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
style: N,
|
|
150
|
+
className: `${i}-child`,
|
|
151
|
+
children: l
|
|
152
|
+
},
|
|
153
|
+
`child-${n}-${tt}`
|
|
154
|
+
)) }, n)),
|
|
155
|
+
[h, N, i]
|
|
106
156
|
);
|
|
107
|
-
return (
|
|
108
|
-
}, []), N(() => {
|
|
109
|
-
z(), g(0);
|
|
110
|
-
}, [$]), N(() => {
|
|
111
|
-
if (!M || !y)
|
|
112
|
-
return;
|
|
113
|
-
let r = null, t = x;
|
|
114
|
-
const i = o ? F.width : F.height;
|
|
115
|
-
let e = X;
|
|
116
|
-
const f = (v) => {
|
|
117
|
-
if (!r) {
|
|
118
|
-
r = v, n.current = requestAnimationFrame(f);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const Q = (v - r) / 1e3;
|
|
122
|
-
r = v;
|
|
123
|
-
const C = E * Q;
|
|
124
|
-
switch (c) {
|
|
125
|
-
case "left":
|
|
126
|
-
if (t -= C, t <= -i && (t += i, e += 1, g(e), a > 0 && e >= a)) {
|
|
127
|
-
cancelAnimationFrame(n.current), m(!1), p(0), b?.();
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
break;
|
|
131
|
-
case "right":
|
|
132
|
-
if (t += C, t >= 0 && (t -= i, e += 1, g(e), a > 0 && e >= a)) {
|
|
133
|
-
cancelAnimationFrame(n.current), m(!1), p(-i), b?.();
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
break;
|
|
137
|
-
case "up":
|
|
138
|
-
if (t -= C, t <= -i && (t += i, e += 1, g(e), a > 0 && e >= a)) {
|
|
139
|
-
cancelAnimationFrame(n.current), m(!1), p(0), b?.();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
case "down":
|
|
144
|
-
if (t += C, t >= 0 && (t -= i, e += 1, g(e), a > 0 && e >= a)) {
|
|
145
|
-
cancelAnimationFrame(n.current), m(!1), p(-i), b?.();
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
p(t), n.current = requestAnimationFrame(f);
|
|
151
|
-
};
|
|
152
|
-
return n.current = requestAnimationFrame(f), () => {
|
|
153
|
-
n.current && cancelAnimationFrame(n.current);
|
|
154
|
-
};
|
|
155
|
-
}, [M, E, c, F, y, a]), N(() => (z(), () => {
|
|
156
|
-
n.current && cancelAnimationFrame(n.current);
|
|
157
|
-
}), []);
|
|
158
|
-
const Y = () => {
|
|
159
|
-
H && m(!1);
|
|
160
|
-
}, G = () => {
|
|
161
|
-
H && m(!0);
|
|
162
|
-
}, J = () => o ? `translateX(${x}px)` : `translateY(${x}px)`, K = () => {
|
|
163
|
-
const r = {
|
|
164
|
-
display: o ? "inline-block" : "block",
|
|
165
|
-
whiteSpace: o ? "nowrap" : "normal",
|
|
166
|
-
// 消除元素间默认间距
|
|
167
|
-
marginRight: o ? 0 : void 0,
|
|
168
|
-
marginBottom: o ? void 0 : 0
|
|
169
|
-
}, t = /* @__PURE__ */ l(
|
|
157
|
+
return w ? /* @__PURE__ */ s(et, { children: /* @__PURE__ */ j(
|
|
170
158
|
"div",
|
|
171
159
|
{
|
|
172
|
-
ref:
|
|
173
|
-
style:
|
|
174
|
-
className: `${
|
|
175
|
-
children:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return y ? /* @__PURE__ */ S(A, { children: [
|
|
179
|
-
t,
|
|
180
|
-
/* @__PURE__ */ l("div", { style: r, className: `${s}-children`, children: $ })
|
|
181
|
-
] }) : t;
|
|
182
|
-
};
|
|
183
|
-
return /* @__PURE__ */ S(
|
|
184
|
-
"div",
|
|
185
|
-
{
|
|
186
|
-
ref: h,
|
|
187
|
-
className: Z(
|
|
188
|
-
s,
|
|
189
|
-
`${s}-${c}`,
|
|
190
|
-
D
|
|
191
|
-
),
|
|
192
|
-
style: {
|
|
193
|
-
overflow: "hidden",
|
|
194
|
-
position: "relative",
|
|
195
|
-
...L
|
|
196
|
-
},
|
|
197
|
-
onMouseEnter: Y,
|
|
198
|
-
onMouseLeave: G,
|
|
199
|
-
children: [
|
|
200
|
-
/* @__PURE__ */ l(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
ref: T,
|
|
204
|
-
style: {
|
|
205
|
-
display: o ? "inline-block" : "block",
|
|
206
|
-
whiteSpace: "nowrap",
|
|
207
|
-
willChange: "transform",
|
|
208
|
-
// 启用GPU加速
|
|
209
|
-
transform: J()
|
|
210
|
-
},
|
|
211
|
-
className: `${s}-content`,
|
|
212
|
-
children: K()
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
W && y && (o ? /* @__PURE__ */ S(A, { children: [
|
|
216
|
-
/* @__PURE__ */ l(
|
|
217
|
-
"div",
|
|
218
|
-
{
|
|
219
|
-
style: {
|
|
220
|
-
position: "absolute",
|
|
221
|
-
top: 0,
|
|
222
|
-
left: 0,
|
|
223
|
-
width: d,
|
|
224
|
-
height: "100%",
|
|
225
|
-
background: "linear-gradient(to right, #fff, transparent)",
|
|
226
|
-
pointerEvents: "none"
|
|
227
|
-
},
|
|
228
|
-
className: `${s}-linear-gradient-to-right`
|
|
229
|
-
}
|
|
230
|
-
),
|
|
231
|
-
/* @__PURE__ */ l(
|
|
160
|
+
ref: a,
|
|
161
|
+
style: Y,
|
|
162
|
+
className: mt(i, `${i}-${e}`, _),
|
|
163
|
+
children: [
|
|
164
|
+
!!r && /* @__PURE__ */ s("div", { style: Z, className: `${i}-overlay` }),
|
|
165
|
+
/* @__PURE__ */ j(
|
|
232
166
|
"div",
|
|
233
167
|
{
|
|
234
|
-
style:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
pointerEvents: "none"
|
|
258
|
-
},
|
|
259
|
-
className: `${s}-linear-gradient-to-bottom`
|
|
168
|
+
style: S,
|
|
169
|
+
className: `${i}-item`,
|
|
170
|
+
onAnimationIteration: J,
|
|
171
|
+
onAnimationEnd: G,
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ s(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
ref: c,
|
|
177
|
+
className: `${i}-initial-child-container`,
|
|
178
|
+
children: H.map(h, (o, d) => /* @__PURE__ */ s(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
style: N,
|
|
182
|
+
className: `${i}-child`,
|
|
183
|
+
children: o
|
|
184
|
+
},
|
|
185
|
+
`original-${d}`
|
|
186
|
+
))
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
b($ - 1)
|
|
190
|
+
]
|
|
260
191
|
}
|
|
261
192
|
),
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
left: 0,
|
|
269
|
-
width: "100%",
|
|
270
|
-
height: d,
|
|
271
|
-
background: "linear-gradient(to top, #fff, transparent)",
|
|
272
|
-
pointerEvents: "none"
|
|
273
|
-
},
|
|
274
|
-
className: `${s}-linear-gradient-to-top`
|
|
275
|
-
}
|
|
276
|
-
)
|
|
277
|
-
] }))
|
|
278
|
-
]
|
|
279
|
-
}
|
|
280
|
-
);
|
|
281
|
-
};
|
|
193
|
+
/* @__PURE__ */ s("div", { style: S, className: `${i}-item`, children: b($) })
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
) }) : null;
|
|
197
|
+
}
|
|
198
|
+
);
|
|
282
199
|
export {
|
|
283
|
-
|
|
200
|
+
ye as default
|
|
284
201
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { jsxs as z, jsx as m, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as V, useRef as C, useState as d, useEffect as F } from "react";
|
|
3
|
+
import "../config-provider/ConfigProvider.js";
|
|
4
|
+
import "lodash/isEqualWith";
|
|
5
|
+
import "../components/common/utils/is.js";
|
|
6
|
+
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
7
|
+
import "lodash/isNumber";
|
|
8
|
+
import Z from "lodash/merge";
|
|
9
|
+
import "../components/common/utils/dom.js";
|
|
10
|
+
import "../components/common/hooks/useIntersectionObserver.js";
|
|
11
|
+
import _ from "../components/common/hooks/useMergeProps.js";
|
|
12
|
+
import "../components/common/utils/reactDOM.js";
|
|
13
|
+
import "@unicom-cloud/utils/constant";
|
|
14
|
+
import "lodash/debounce";
|
|
15
|
+
import "@unicom-cloud/utils/date";
|
|
16
|
+
import "@unicom-cloud/utils/case-name";
|
|
17
|
+
import tt from "@unicom-cloud/utils/class-name";
|
|
18
|
+
import "@unicom-cloud/utils/constant/ui";
|
|
19
|
+
import "../utils/contextHolder.js";
|
|
20
|
+
import "@unicom-cloud/utils/clipboard-copy";
|
|
21
|
+
import "../components/common/utils/dayjs.js";
|
|
22
|
+
import "@unicom-cloud/utils/file/fileToURL";
|
|
23
|
+
import "lodash/escapeRegExp";
|
|
24
|
+
import "lodash/isArray";
|
|
25
|
+
import "lodash/isString";
|
|
26
|
+
import "lodash/isFunction";
|
|
27
|
+
import "lodash/throttle";
|
|
28
|
+
import "lodash/camelCase";
|
|
29
|
+
import "lodash/capitalize";
|
|
30
|
+
import "lodash/cloneDeep";
|
|
31
|
+
import "lodash/get";
|
|
32
|
+
import "lodash/has";
|
|
33
|
+
import "lodash/kebabCase";
|
|
34
|
+
import "lodash/mergeWith";
|
|
35
|
+
import "lodash/set";
|
|
36
|
+
import "lodash/setWith";
|
|
37
|
+
import "lodash/snakeCase";
|
|
38
|
+
import "lodash/startCase";
|
|
39
|
+
import "lodash/uniq";
|
|
40
|
+
import "lodash/upperFirst";
|
|
41
|
+
import "@unicom-cloud/utils/math";
|
|
42
|
+
import "lodash/isPlainObject";
|
|
43
|
+
import "../dist/react-transition-group/src/CSSTransition.js";
|
|
44
|
+
import "../dist/react-transition-group/src/ReplaceTransition.js";
|
|
45
|
+
import "../dist/react-transition-group/src/SwitchTransition.js";
|
|
46
|
+
import "../dist/react-transition-group/chunk/CPfP7aNL.js";
|
|
47
|
+
import "../dist/react-transition-group/src/TransitionGroup.js";
|
|
48
|
+
import { resizeObserver as et } from "../components/common/utils/resizeObserver.js";
|
|
49
|
+
import "uuid";
|
|
50
|
+
import "@unicom-cloud/utils/file/saveAs";
|
|
51
|
+
import "@unicom-cloud/utils/screenfull";
|
|
52
|
+
import "@unicom-cloud/utils/tinycolor";
|
|
53
|
+
import "@unicom-cloud/utils/ui-color";
|
|
54
|
+
import "@unicom-cloud/utils/constant/ui.js";
|
|
55
|
+
import "react-is";
|
|
56
|
+
import "@unicom-cloud/utils/tree";
|
|
57
|
+
import { isPlainObject as q } from "@unicom-cloud/utils/is";
|
|
58
|
+
import "../dist/validate/src/index.js";
|
|
59
|
+
import rt from "../config-provider/context.js";
|
|
60
|
+
const ot = {
|
|
61
|
+
speed: 50,
|
|
62
|
+
direction: "left",
|
|
63
|
+
pauseOnHover: !1,
|
|
64
|
+
loop: 0
|
|
65
|
+
}, me = (R) => {
|
|
66
|
+
const { getPrefixCls: L, componentConfig: D } = V(rt), s = L?.("marquee"), E = _(
|
|
67
|
+
R,
|
|
68
|
+
ot,
|
|
69
|
+
D?.Marquee
|
|
70
|
+
), {
|
|
71
|
+
children: N,
|
|
72
|
+
style: W,
|
|
73
|
+
className: j,
|
|
74
|
+
speed: A = 50,
|
|
75
|
+
direction: l = "left",
|
|
76
|
+
pauseOnHover: P = !1,
|
|
77
|
+
loop: a = 0,
|
|
78
|
+
gradient: T = { color: "#fff" },
|
|
79
|
+
onComplete: h
|
|
80
|
+
} = E, g = C(null), B = C(null), $ = C(null), c = C(), [S, I] = d({ width: 0, height: 0 }), [it, X] = d({ width: 0, height: 0 }), [y, Y] = d(!1), [H, p] = d(!0), [k, f] = d(0), [M, b] = d(0), i = l === "left" || l === "right";
|
|
81
|
+
let o = T;
|
|
82
|
+
q(o) && (o = Z(
|
|
83
|
+
{ size: i ? 50 : 20, color: "#fff" },
|
|
84
|
+
o
|
|
85
|
+
));
|
|
86
|
+
const O = () => {
|
|
87
|
+
if ($.current && g.current) {
|
|
88
|
+
const r = $.current.scrollWidth, t = $.current.scrollHeight, n = g.current.offsetWidth, e = g.current.offsetHeight;
|
|
89
|
+
I({ width: r, height: t }), X({ width: n, height: e });
|
|
90
|
+
const u = i ? r > n : t > e;
|
|
91
|
+
if (Y(u), u) {
|
|
92
|
+
const v = l === "right" ? -r : l === "down" ? -t : 0;
|
|
93
|
+
f(v);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
F(() => {
|
|
98
|
+
const r = g.current;
|
|
99
|
+
if (!r)
|
|
100
|
+
return;
|
|
101
|
+
const t = et([r], O);
|
|
102
|
+
return () => t();
|
|
103
|
+
}, []), F(() => {
|
|
104
|
+
O(), b(0);
|
|
105
|
+
}, [N]), F(() => {
|
|
106
|
+
if (!H || !y)
|
|
107
|
+
return;
|
|
108
|
+
let r = null, t = k;
|
|
109
|
+
const n = i ? S.width : S.height;
|
|
110
|
+
let e = M;
|
|
111
|
+
const u = (v) => {
|
|
112
|
+
if (!r) {
|
|
113
|
+
r = v, c.current = requestAnimationFrame(u);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const U = (v - r) / 1e3;
|
|
117
|
+
r = v;
|
|
118
|
+
const w = A * U;
|
|
119
|
+
switch (l) {
|
|
120
|
+
case "left":
|
|
121
|
+
if (t -= w, t <= -n && (t += n, e += 1, b(e), a > 0 && e >= a)) {
|
|
122
|
+
cancelAnimationFrame(c.current), p(!1), f(0), h?.();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
case "right":
|
|
127
|
+
if (t += w, t >= 0 && (t -= n, e += 1, b(e), a > 0 && e >= a)) {
|
|
128
|
+
cancelAnimationFrame(c.current), p(!1), f(-n), h?.();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
case "up":
|
|
133
|
+
if (t -= w, t <= -n && (t += n, e += 1, b(e), a > 0 && e >= a)) {
|
|
134
|
+
cancelAnimationFrame(c.current), p(!1), f(0), h?.();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case "down":
|
|
139
|
+
if (t += w, t >= 0 && (t -= n, e += 1, b(e), a > 0 && e >= a)) {
|
|
140
|
+
cancelAnimationFrame(c.current), p(!1), f(-n), h?.();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
f(t), c.current = requestAnimationFrame(u);
|
|
146
|
+
};
|
|
147
|
+
return c.current = requestAnimationFrame(u), () => {
|
|
148
|
+
c.current && cancelAnimationFrame(c.current);
|
|
149
|
+
};
|
|
150
|
+
}, [
|
|
151
|
+
H,
|
|
152
|
+
A,
|
|
153
|
+
l,
|
|
154
|
+
S,
|
|
155
|
+
y,
|
|
156
|
+
a,
|
|
157
|
+
M,
|
|
158
|
+
k,
|
|
159
|
+
i,
|
|
160
|
+
h
|
|
161
|
+
]);
|
|
162
|
+
const G = () => {
|
|
163
|
+
P && p(!1);
|
|
164
|
+
}, J = () => {
|
|
165
|
+
P && p(!0);
|
|
166
|
+
}, K = () => i ? `translateX(${k}px)` : `translateY(${k}px)`, Q = () => {
|
|
167
|
+
const r = {
|
|
168
|
+
display: i ? "inline-block" : "block",
|
|
169
|
+
whiteSpace: i ? "nowrap" : "normal",
|
|
170
|
+
marginRight: i ? 0 : void 0,
|
|
171
|
+
marginBottom: i ? void 0 : 0
|
|
172
|
+
}, t = /* @__PURE__ */ m(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
ref: $,
|
|
176
|
+
style: r,
|
|
177
|
+
className: `${s}-children`,
|
|
178
|
+
children: N
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
return y ? /* @__PURE__ */ z(x, { children: [
|
|
182
|
+
t,
|
|
183
|
+
/* @__PURE__ */ m("div", { style: r, className: `${s}-children`, children: N })
|
|
184
|
+
] }) : t;
|
|
185
|
+
};
|
|
186
|
+
return /* @__PURE__ */ z(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
ref: g,
|
|
190
|
+
style: W,
|
|
191
|
+
className: tt(
|
|
192
|
+
s,
|
|
193
|
+
`${s}-${l}`,
|
|
194
|
+
j
|
|
195
|
+
),
|
|
196
|
+
onMouseEnter: G,
|
|
197
|
+
onMouseLeave: J,
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ m(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
ref: B,
|
|
203
|
+
style: {
|
|
204
|
+
display: i ? "inline-block" : "block",
|
|
205
|
+
transform: K()
|
|
206
|
+
},
|
|
207
|
+
className: `${s}-content`,
|
|
208
|
+
children: Q()
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
q(o) && y && (i ? /* @__PURE__ */ z(x, { children: [
|
|
212
|
+
/* @__PURE__ */ m(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
style: {
|
|
216
|
+
width: o.size,
|
|
217
|
+
background: `linear-gradient(to right, ${o.color}, transparent)`
|
|
218
|
+
},
|
|
219
|
+
className: `${s}-linear-gradient-to-right`
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ m(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
style: {
|
|
226
|
+
width: o.size,
|
|
227
|
+
background: `linear-gradient(to left, ${o.color}, transparent)`
|
|
228
|
+
},
|
|
229
|
+
className: `${s}-linear-gradient-to-left`
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
] }) : /* @__PURE__ */ z(x, { children: [
|
|
233
|
+
/* @__PURE__ */ m(
|
|
234
|
+
"div",
|
|
235
|
+
{
|
|
236
|
+
style: {
|
|
237
|
+
height: o.size,
|
|
238
|
+
background: `linear-gradient(to top, ${o.color}, transparent)`
|
|
239
|
+
},
|
|
240
|
+
className: `${s}-linear-gradient-to-bottom`
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
/* @__PURE__ */ m(
|
|
244
|
+
"div",
|
|
245
|
+
{
|
|
246
|
+
style: {
|
|
247
|
+
height: o.size,
|
|
248
|
+
background: `linear-gradient(to bottom, ${o.color}, transparent)`
|
|
249
|
+
},
|
|
250
|
+
className: `${s}-linear-gradient-to-top`
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] }))
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
export {
|
|
259
|
+
me as default
|
|
260
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/ui","version":"0.8.
|
|
1
|
+
{"name":"@unicom-cloud/ui","version":"0.8.103","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"react":"^18.3.1","react-dom":"^18.3.1","dayjs":"^1.11.10","lodash":"^4.17.21","uuid":"^11.1.0","qrcode.react":"^4.2.0"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|