clxx 2.1.2 → 2.1.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/LICENSE +20 -20
- package/README.md +768 -35
- package/build/Ago/index.d.ts +0 -1
- package/build/Alert/Wrapper.d.ts +0 -1
- package/build/Alert/Wrapper.js +12 -12
- package/build/Alert/index.js +2 -2
- package/build/AutoGrid/index.js +16 -21
- package/build/AutoGrid/style.d.ts +5 -5
- package/build/CarouselNotice/index.d.ts +0 -1
- package/build/CarouselNotice/index.js +6 -6
- package/build/CarouselNotice/style.d.ts +6 -1
- package/build/CarouselNotice/style.js +7 -7
- package/build/Clickable/index.d.ts +5 -5
- package/build/Clickable/index.js +11 -8
- package/build/Container/index.d.ts +2 -2
- package/build/Container/index.js +85 -60
- package/build/Countdowner/index.d.ts +3 -3
- package/build/Countdowner/index.js +18 -11
- package/build/Dialog/Wrapper.d.ts +0 -1
- package/build/Dialog/Wrapper.js +7 -10
- package/build/Dialog/style.d.ts +15 -10
- package/build/Dialog/style.js +88 -88
- package/build/Effect/useInterval.d.ts +1 -1
- package/build/Effect/useInterval.js +1 -1
- package/build/Effect/useUpdate.d.ts +1 -1
- package/build/Effect/useUpdate.js +1 -1
- package/build/Effect/useWindowResize.d.ts +4 -2
- package/build/Effect/useWindowResize.js +28 -11
- package/build/Flex/index.d.ts +0 -1
- package/build/Indicator/index.js +22 -23
- package/build/Indicator/style.d.ts +6 -1
- package/build/Indicator/style.js +7 -7
- package/build/Loading/Wrapper.js +2 -2
- package/build/Loading/style.d.ts +12 -2
- package/build/Loading/style.js +14 -14
- package/build/Overlay/index.d.ts +1 -1
- package/build/Overlay/index.js +41 -37
- package/build/SafeArea/index.d.ts +1 -2
- package/build/SafeArea/index.js +6 -6
- package/build/ScrollView/index.d.ts +1 -1
- package/build/ScrollView/index.js +111 -27
- package/build/Toast/Toast.js +4 -4
- package/build/Toast/style.d.ts +42 -12
- package/build/Toast/style.js +54 -54
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/utils/Countdown.d.ts +3 -1
- package/build/utils/Countdown.js +5 -2
- package/build/utils/createApp.d.ts +14 -13
- package/build/utils/createApp.js +58 -42
- package/build/utils/cssUtil.d.ts +2 -2
- package/build/utils/cssUtil.js +24 -13
- package/build/utils/defaultScroll.d.ts +0 -1
- package/build/utils/defaultScroll.js +8 -5
- package/build/utils/is.d.ts +23 -4
- package/build/utils/is.js +97 -15
- package/build/utils/jsonp.js +2 -2
- package/build/utils/request.js +12 -2
- package/package.json +15 -12
- package/test/README.md +16 -0
- package/test/eslint.config.js +29 -0
- package/test/index.html +13 -0
- package/test/jsconfig.json +8 -0
- package/test/package.json +27 -0
- package/test/public/vite.svg +1 -0
- package/test/src/ago/index.jsx +30 -0
- package/test/src/alert/index.jsx +111 -0
- package/test/src/autogrid/index.css +0 -0
- package/test/src/autogrid/index.jsx +26 -0
- package/test/src/carouse-notice/index.jsx +59 -0
- package/test/src/clickable/index.css +21 -0
- package/test/src/clickable/index.jsx +39 -0
- package/test/src/countdown/index.jsx +95 -0
- package/test/src/dialog/index.jsx +104 -0
- package/test/src/dialog/index.module.css +5 -0
- package/test/src/image-picker/index.css +0 -0
- package/test/src/image-picker/index.jsx +88 -0
- package/test/src/index/index.jsx +46 -0
- package/test/src/index.css +49 -0
- package/test/src/index.jsx +31 -0
- package/test/src/indicator/index.jsx +25 -0
- package/test/src/loading/index.jsx +36 -0
- package/test/src/overlay/index.jsx +31 -0
- package/test/src/privacy/index.css +13 -0
- package/test/src/privacy/index.jsx +34 -0
- package/test/src/scrollview/index.css +10 -0
- package/test/src/scrollview/index.jsx +52 -0
- package/test/src/toast/index.jsx +86 -0
- package/test/vite.config.js +15 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import React, { useRef, useState } from "react";
|
|
3
|
+
import { ScrollView } from "@";
|
|
4
|
+
|
|
5
|
+
export default function Index() {
|
|
6
|
+
const [list, setList] = useState([1]);
|
|
7
|
+
const isLoading = useRef(false);
|
|
8
|
+
const [showLoading, setShowLoading] = useState(true);
|
|
9
|
+
|
|
10
|
+
const loadMore = async () => {
|
|
11
|
+
if (!showLoading) return;
|
|
12
|
+
|
|
13
|
+
isLoading.current = true;
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
window.setTimeout(() => {
|
|
16
|
+
const num = list.length + 1;
|
|
17
|
+
list.push(num);
|
|
18
|
+
setList([...list]);
|
|
19
|
+
resolve();
|
|
20
|
+
isLoading.current = false;
|
|
21
|
+
if (num > 5) {
|
|
22
|
+
setShowLoading(false);
|
|
23
|
+
}
|
|
24
|
+
}, 800);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="ScrollView">
|
|
30
|
+
<ScrollView
|
|
31
|
+
onReachTop={(e) => {
|
|
32
|
+
console.log("reachTop", e);
|
|
33
|
+
}}
|
|
34
|
+
onReachBottom={(e) => {
|
|
35
|
+
console.log("reachBottom", e);
|
|
36
|
+
if (!isLoading.current) {
|
|
37
|
+
loadMore();
|
|
38
|
+
}
|
|
39
|
+
}}
|
|
40
|
+
showLoading={showLoading}
|
|
41
|
+
>
|
|
42
|
+
{list.map((item, index) => {
|
|
43
|
+
return (
|
|
44
|
+
<div className="content" key={index}>
|
|
45
|
+
{item}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
})}
|
|
49
|
+
</ScrollView>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { showToast, showUniqToast } from "@";
|
|
3
|
+
|
|
4
|
+
export default function Index () {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<p>toast内容为纯文本</p>
|
|
8
|
+
<button
|
|
9
|
+
onClick={() => {
|
|
10
|
+
showToast("一个简单的Toast轻提示");
|
|
11
|
+
}}
|
|
12
|
+
>
|
|
13
|
+
显示Toast,默认屏幕居中
|
|
14
|
+
</button>
|
|
15
|
+
|
|
16
|
+
<p>toast内容为可定制组件</p>
|
|
17
|
+
<button
|
|
18
|
+
onClick={() => {
|
|
19
|
+
showToast(
|
|
20
|
+
<div style={{ border: "1px solid red", background: "green" }}>
|
|
21
|
+
一个简单的<span style={{ color: "red" }}>Toast</span>轻提示
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
显示Toast
|
|
27
|
+
</button>
|
|
28
|
+
|
|
29
|
+
<p>toast内容在顶部显示</p>
|
|
30
|
+
<button
|
|
31
|
+
onClick={() => {
|
|
32
|
+
showToast({
|
|
33
|
+
content: "抱歉,发生了很多错误",
|
|
34
|
+
position: "top",
|
|
35
|
+
});
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
显示Toast
|
|
39
|
+
</button>
|
|
40
|
+
|
|
41
|
+
<p>toast内容在底部显示</p>
|
|
42
|
+
<button
|
|
43
|
+
onClick={() => {
|
|
44
|
+
showToast({
|
|
45
|
+
content: "一个简单的Toast轻提示Toast轻提示Toast轻提示Toast轻提示",
|
|
46
|
+
position: "bottom",
|
|
47
|
+
});
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
显示Toast
|
|
51
|
+
</button>
|
|
52
|
+
|
|
53
|
+
<p>内容非常长的Toast</p>
|
|
54
|
+
<button
|
|
55
|
+
onClick={() => {
|
|
56
|
+
showToast(
|
|
57
|
+
"这是一个内容非常长的提示,你看看它的内容到底有多么的长,长度超出屏幕的宽度"
|
|
58
|
+
);
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
显示Toast
|
|
62
|
+
</button>
|
|
63
|
+
|
|
64
|
+
<p>全局唯一的Toast</p>
|
|
65
|
+
<button
|
|
66
|
+
onClick={() => {
|
|
67
|
+
showUniqToast("全局唯一的Toast");
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
显示Toast
|
|
71
|
+
</button>
|
|
72
|
+
<p>全局唯一的顶部Toast,永不消失</p>
|
|
73
|
+
<button
|
|
74
|
+
onClick={() => {
|
|
75
|
+
showUniqToast({
|
|
76
|
+
content: "全局唯一的Toast顶部",
|
|
77
|
+
position: "top",
|
|
78
|
+
duration: 10000000
|
|
79
|
+
});
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
显示Toast
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// https://vite.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: {
|
|
10
|
+
"@": path.resolve(__dirname, "../build/index"),
|
|
11
|
+
react: path.resolve(__dirname, "node_modules/react"),
|
|
12
|
+
"react-dom": path.resolve(__dirname, "node_modules/react-dom"),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|