clxx 2.1.6 → 2.1.7
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/AGENTS.md +2 -0
- package/README.md +63 -0
- package/build/Ago/index.js +14 -8
- package/build/Alert/Wrapper.js +13 -10
- package/build/Alert/index.js +17 -11
- package/build/Alert/style.js +4 -1
- package/build/AutoGrid/index.js +50 -14
- package/build/AutoGrid/style.js +9 -6
- package/build/CarouselNotice/index.js +22 -19
- package/build/CarouselNotice/style.js +6 -3
- package/build/CitySelect/data.d.ts +3 -0
- package/build/CitySelect/data.js +2355 -0
- package/build/CitySelect/index.d.ts +17 -0
- package/build/CitySelect/index.js +300 -0
- package/build/CitySelect/search.d.ts +2 -0
- package/build/CitySelect/search.js +70 -0
- package/build/CitySelect/style.d.ts +4 -0
- package/build/CitySelect/style.js +237 -0
- package/build/CitySelect/type.d.ts +17 -0
- package/build/CitySelect/type.js +2 -0
- package/build/Clickable/index.js +56 -20
- package/build/Container/index.js +52 -16
- package/build/Countdowner/index.js +50 -14
- package/build/Dialog/Wrapper.js +13 -10
- package/build/Dialog/index.js +18 -12
- package/build/Dialog/style.js +29 -25
- package/build/Effect/useInterval.js +7 -4
- package/build/Effect/useTick.js +9 -6
- package/build/Effect/useUpdate.js +6 -3
- package/build/Effect/useViewport.js +15 -8
- package/build/Effect/useWindowResize.js +7 -4
- package/build/Fixed/index.js +6 -3
- package/build/Flex/Col.js +23 -15
- package/build/Flex/Row.js +23 -15
- package/build/Flex/index.js +9 -5
- package/build/Indicator/index.js +20 -14
- package/build/Indicator/style.js +6 -3
- package/build/Loading/Wrapper.js +14 -11
- package/build/Loading/index.js +17 -10
- package/build/Loading/style.js +9 -6
- package/build/Overlay/index.js +12 -9
- package/build/SafeArea/index.js +8 -5
- package/build/ScrollView/index.js +24 -21
- package/build/ScrollView/style.js +4 -1
- package/build/Toast/Toast.js +53 -17
- package/build/Toast/index.js +21 -14
- package/build/Toast/style.js +22 -18
- package/build/index.d.ts +1 -1
- package/build/index.js +102 -36
- package/build/utils/Countdown.js +7 -3
- package/build/utils/ago.js +10 -4
- package/build/utils/calendarTable.js +9 -3
- package/build/utils/createApp.js +35 -27
- package/build/utils/cssUtil.js +10 -5
- package/build/utils/defaultScroll.js +4 -1
- package/build/utils/dom.js +6 -3
- package/build/utils/is.js +6 -2
- package/build/utils/jsonp.js +4 -1
- package/build/utils/request.js +40 -27
- package/build/utils/tick.js +4 -1
- package/build/utils/uniqKey.js +4 -1
- package/build/utils/wait.js +8 -4
- package/package.json +1 -1
- package/test/src/city-select/index.jsx +21 -0
- package/test/src/index/index.jsx +1 -0
- package/test/vite.config.js +6 -2
- package/build/context.d.ts +0 -14
- package/build/context.js +0 -21
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,12 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
10
|
}
|
|
10
11
|
return t;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ScrollView = ScrollView;
|
|
15
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const Indicator_1 = require("../Indicator");
|
|
18
|
+
const Row_1 = require("../Flex/Row");
|
|
19
|
+
const style_1 = require("./style");
|
|
20
|
+
function ScrollView(props) {
|
|
18
21
|
const { children, height, reachTopThreshold = 50, onReachTop, reachBottomThreshold = 50, onReachBottom, showLoading = true, loadingContent, onScroll, scrollThrottle = 16, containerStyle, wrapperStyle, loadingStyle } = props, attrs = __rest(props, ["children", "height", "reachTopThreshold", "onReachTop", "reachBottomThreshold", "onReachBottom", "showLoading", "loadingContent", "onScroll", "scrollThrottle", "containerStyle", "wrapperStyle", "loadingStyle"]);
|
|
19
22
|
// 容器高度
|
|
20
23
|
const heightStyle = {};
|
|
@@ -22,17 +25,17 @@ export function ScrollView(props) {
|
|
|
22
25
|
heightStyle.height = height;
|
|
23
26
|
}
|
|
24
27
|
// 滚动容器
|
|
25
|
-
const container = useRef(null);
|
|
28
|
+
const container = (0, react_1.useRef)(null);
|
|
26
29
|
// 当前滚动到顶部的距离
|
|
27
|
-
const lastScrollTop = useRef(0);
|
|
30
|
+
const lastScrollTop = (0, react_1.useRef)(0);
|
|
28
31
|
// 防止重复触发的标记
|
|
29
|
-
const hasReachedTop = useRef(false);
|
|
30
|
-
const hasReachedBottom = useRef(false);
|
|
32
|
+
const hasReachedTop = (0, react_1.useRef)(false);
|
|
33
|
+
const hasReachedBottom = (0, react_1.useRef)(false);
|
|
31
34
|
// 节流控制
|
|
32
|
-
const throttleTimer = useRef(undefined);
|
|
33
|
-
const lastCallTime = useRef(0);
|
|
35
|
+
const throttleTimer = (0, react_1.useRef)(undefined);
|
|
36
|
+
const lastCallTime = (0, react_1.useRef)(0);
|
|
34
37
|
// 使用 ref 保存所有滚动处理需要的 props,彻底消除陈旧闭包
|
|
35
|
-
const propsRef = useRef({
|
|
38
|
+
const propsRef = (0, react_1.useRef)({
|
|
36
39
|
onScroll,
|
|
37
40
|
onReachTop,
|
|
38
41
|
onReachBottom,
|
|
@@ -47,16 +50,16 @@ export function ScrollView(props) {
|
|
|
47
50
|
reachBottomThreshold,
|
|
48
51
|
};
|
|
49
52
|
// container 是否有滚动条
|
|
50
|
-
const [hasScrollBar, setHasScrollBar] = useState(false);
|
|
53
|
+
const [hasScrollBar, setHasScrollBar] = (0, react_1.useState)(false);
|
|
51
54
|
// 检查是否有滚动条
|
|
52
|
-
const checkScrollBar = useCallback(() => {
|
|
55
|
+
const checkScrollBar = (0, react_1.useCallback)(() => {
|
|
53
56
|
if (container.current) {
|
|
54
57
|
const hasScroll = container.current.scrollHeight > container.current.clientHeight;
|
|
55
58
|
setHasScrollBar(hasScroll);
|
|
56
59
|
}
|
|
57
60
|
}, []);
|
|
58
61
|
// 使用 ResizeObserver 监听内容高度变化
|
|
59
|
-
useLayoutEffect(() => {
|
|
62
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
60
63
|
const containerEl = container.current;
|
|
61
64
|
if (!containerEl)
|
|
62
65
|
return;
|
|
@@ -77,7 +80,7 @@ export function ScrollView(props) {
|
|
|
77
80
|
}, [checkScrollBar]);
|
|
78
81
|
// 核心滚动处理逻辑
|
|
79
82
|
// 所有外部值从 ref 读取,deps 为空,引用永远稳定,不存在闭包过期问题
|
|
80
|
-
const processScroll = useCallback((rawEvent) => {
|
|
83
|
+
const processScroll = (0, react_1.useCallback)((rawEvent) => {
|
|
81
84
|
const box = container.current;
|
|
82
85
|
if (!box)
|
|
83
86
|
return;
|
|
@@ -129,7 +132,7 @@ export function ScrollView(props) {
|
|
|
129
132
|
lastScrollTop.current = scrollTop;
|
|
130
133
|
}, []);
|
|
131
134
|
// 节流滚动回调(leading + trailing)
|
|
132
|
-
const scrollCallback = useCallback((rawEvent) => {
|
|
135
|
+
const scrollCallback = (0, react_1.useCallback)((rawEvent) => {
|
|
133
136
|
// 不节流时直接执行
|
|
134
137
|
if (scrollThrottle <= 0) {
|
|
135
138
|
processScroll(rawEvent);
|
|
@@ -161,7 +164,7 @@ export function ScrollView(props) {
|
|
|
161
164
|
}
|
|
162
165
|
}, [scrollThrottle, processScroll]);
|
|
163
166
|
// 清理节流定时器
|
|
164
|
-
useEffect(() => {
|
|
167
|
+
(0, react_1.useEffect)(() => {
|
|
165
168
|
return () => {
|
|
166
169
|
if (throttleTimer.current !== undefined) {
|
|
167
170
|
clearTimeout(throttleTimer.current);
|
|
@@ -172,11 +175,11 @@ export function ScrollView(props) {
|
|
|
172
175
|
let showLoadingContent = null;
|
|
173
176
|
if (showLoading) {
|
|
174
177
|
if (!loadingContent) {
|
|
175
|
-
showLoadingContent = (
|
|
178
|
+
showLoadingContent = ((0, jsx_runtime_1.jsxs)(Row_1.RowCenter, { css: [style_1.style.loading, loadingStyle], children: [(0, jsx_runtime_1.jsx)(Indicator_1.Indicator, { barColor: "#333", barCount: 12 }), (0, jsx_runtime_1.jsx)("p", { children: "\u6570\u636E\u52A0\u8F7D\u4E2D..." })] }));
|
|
176
179
|
}
|
|
177
180
|
else {
|
|
178
181
|
showLoadingContent = loadingContent;
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
return (
|
|
184
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ css: [style_1.style.container, heightStyle, containerStyle], onScroll: scrollCallback, ref: container }, attrs, { children: [(0, jsx_runtime_1.jsx)("div", { css: wrapperStyle, children: children }), hasScrollBar && showLoadingContent] })));
|
|
182
185
|
}
|
package/build/Toast/Toast.js
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
1
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
36
|
var t = {};
|
|
3
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -9,17 +43,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
43
|
}
|
|
10
44
|
return t;
|
|
11
45
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.Toast = Toast;
|
|
48
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
49
|
+
const react_1 = __importStar(require("react"));
|
|
50
|
+
const style_1 = require("./style");
|
|
51
|
+
function Toast(props) {
|
|
16
52
|
const { content = "", position = "middle", duration = 2000, radius = 16, offsetTop = 50, offsetBottom = 50, onHide = () => undefined, containerStyle, contentStyle } = props, attributes = __rest(props, ["content", "position", "duration", "radius", "offsetTop", "offsetBottom", "onHide", "containerStyle", "contentStyle"]);
|
|
17
53
|
// 初始化显示的动画
|
|
18
|
-
const getResult = getAnimation(position, "show");
|
|
19
|
-
const [animation, setAnimation] = useState(getResult.animation);
|
|
20
|
-
useEffect(() => {
|
|
54
|
+
const getResult = (0, style_1.getAnimation)(position, "show");
|
|
55
|
+
const [animation, setAnimation] = (0, react_1.useState)(getResult.animation);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
21
57
|
const timer = window.setTimeout(() => {
|
|
22
|
-
const { animation } = getAnimation(position, "hide");
|
|
58
|
+
const { animation } = (0, style_1.getAnimation)(position, "hide");
|
|
23
59
|
setAnimation(animation);
|
|
24
60
|
}, duration);
|
|
25
61
|
return () => {
|
|
@@ -27,29 +63,29 @@ export function Toast(props) {
|
|
|
27
63
|
};
|
|
28
64
|
}, [position, duration]);
|
|
29
65
|
let showContent;
|
|
30
|
-
const middleStyle = position === "middle" ? style.contentMiddle : undefined;
|
|
31
|
-
if (
|
|
32
|
-
showContent =
|
|
66
|
+
const middleStyle = position === "middle" ? style_1.style.contentMiddle : undefined;
|
|
67
|
+
if (react_1.default.isValidElement(content)) {
|
|
68
|
+
showContent = (0, jsx_runtime_1.jsx)("div", { css: [middleStyle, contentStyle], children: content });
|
|
33
69
|
}
|
|
34
70
|
else {
|
|
35
|
-
showContent = (
|
|
71
|
+
showContent = ((0, jsx_runtime_1.jsx)("p", { css: [style_1.style.content(radius), middleStyle, contentStyle], children: content }));
|
|
36
72
|
}
|
|
37
73
|
// toast消失动画结束触发
|
|
38
74
|
const animationEnd = (event) => {
|
|
39
|
-
const { keyframes } = getAnimation(position, "hide");
|
|
75
|
+
const { keyframes } = (0, style_1.getAnimation)(position, "hide");
|
|
40
76
|
if (event.animationName === keyframes.name) {
|
|
41
77
|
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
42
78
|
}
|
|
43
79
|
};
|
|
44
80
|
let positionStyle;
|
|
45
81
|
if (position === "top") {
|
|
46
|
-
positionStyle = style.top(offsetTop);
|
|
82
|
+
positionStyle = style_1.style.top(offsetTop);
|
|
47
83
|
}
|
|
48
84
|
else if (position === "bottom") {
|
|
49
|
-
positionStyle = style.bottom(offsetBottom);
|
|
85
|
+
positionStyle = style_1.style.bottom(offsetBottom);
|
|
50
86
|
}
|
|
51
87
|
else {
|
|
52
|
-
positionStyle = style.middle;
|
|
88
|
+
positionStyle = style_1.style.middle;
|
|
53
89
|
}
|
|
54
|
-
return (
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: [style_1.style.container(), positionStyle, animation, containerStyle], onAnimationEnd: animationEnd }, attributes, { children: showContent })));
|
|
55
91
|
}
|
package/build/Toast/index.js
CHANGED
|
@@ -1,39 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.showToast = showToast;
|
|
7
|
+
exports.showUniqToast = showUniqToast;
|
|
8
|
+
const react_1 = require("@emotion/react");
|
|
9
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
10
|
+
const react_2 = __importDefault(require("react"));
|
|
11
|
+
const uniqKey_1 = require("../utils/uniqKey");
|
|
12
|
+
const dom_1 = require("../utils/dom");
|
|
13
|
+
const Toast_1 = require("./Toast");
|
|
7
14
|
/**
|
|
8
15
|
* 显示一个全局的轻提示,这个toast不是唯一的
|
|
9
16
|
* @param option 可以是一个字符串,也可以是一个React组件
|
|
10
17
|
*/
|
|
11
|
-
|
|
12
|
-
const { mount, unmount } = createPortalDOM();
|
|
18
|
+
function showToast(option) {
|
|
19
|
+
const { mount, unmount } = (0, dom_1.createPortalDOM)();
|
|
13
20
|
let props = {};
|
|
14
|
-
if (
|
|
21
|
+
if (react_2.default.isValidElement(option) || typeof option !== 'object') {
|
|
15
22
|
props.content = option;
|
|
16
23
|
}
|
|
17
24
|
else {
|
|
18
25
|
props = option;
|
|
19
26
|
}
|
|
20
27
|
props.onHide = unmount;
|
|
21
|
-
mount(
|
|
28
|
+
mount((0, jsx_runtime_1.jsx)(Toast_1.Toast, Object.assign({}, props)));
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* 生成一个全局唯一的Toast
|
|
25
32
|
* @param option
|
|
26
33
|
*/
|
|
27
34
|
let portalDOM = null;
|
|
28
|
-
|
|
35
|
+
function showUniqToast(option) {
|
|
29
36
|
// 先清理上一个 Toast 的 DOM 容器,避免快速连续调用时旧容器泄漏
|
|
30
37
|
if (portalDOM) {
|
|
31
38
|
portalDOM.unmount();
|
|
32
39
|
portalDOM = null;
|
|
33
40
|
}
|
|
34
|
-
portalDOM = createPortalDOM();
|
|
41
|
+
portalDOM = (0, dom_1.createPortalDOM)();
|
|
35
42
|
let props = {};
|
|
36
|
-
if (
|
|
43
|
+
if (react_2.default.isValidElement(option) || typeof option !== 'object') {
|
|
37
44
|
props.content = option;
|
|
38
45
|
}
|
|
39
46
|
else {
|
|
@@ -44,5 +51,5 @@ export function showUniqToast(option) {
|
|
|
44
51
|
portalDOM = null;
|
|
45
52
|
};
|
|
46
53
|
props.onHide = onHide;
|
|
47
|
-
portalDOM.mount(
|
|
54
|
+
portalDOM.mount((0, react_1.createElement)(Toast_1.Toast, Object.assign({}, props, { key: (0, uniqKey_1.uniqKey)() })));
|
|
48
55
|
}
|
package/build/Toast/style.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.style = exports.bottomHideAnimation = exports.bottomShowAnimation = exports.topHideAnimation = exports.topShowAnimation = exports.middleHideAnimation = exports.middleShowAnimation = void 0;
|
|
4
|
+
exports.getAnimation = getAnimation;
|
|
5
|
+
const react_1 = require("@emotion/react");
|
|
6
|
+
exports.middleShowAnimation = (0, react_1.keyframes) `
|
|
3
7
|
from {
|
|
4
8
|
opacity: 0;
|
|
5
9
|
transform: translateX(-50%) scale(0.9);
|
|
@@ -9,7 +13,7 @@ export const middleShowAnimation = keyframes `
|
|
|
9
13
|
transform: translateX(-50%) scale(1);
|
|
10
14
|
}
|
|
11
15
|
`;
|
|
12
|
-
|
|
16
|
+
exports.middleHideAnimation = (0, react_1.keyframes) `
|
|
13
17
|
from {
|
|
14
18
|
opacity: 1;
|
|
15
19
|
transform: translateX(-50%) scale(1);
|
|
@@ -19,7 +23,7 @@ export const middleHideAnimation = keyframes `
|
|
|
19
23
|
transform: translateX(-50%) scale(0.9);
|
|
20
24
|
}
|
|
21
25
|
`;
|
|
22
|
-
|
|
26
|
+
exports.topShowAnimation = (0, react_1.keyframes) `
|
|
23
27
|
from {
|
|
24
28
|
opacity: 0;
|
|
25
29
|
transform: translate(-50%, -100%);
|
|
@@ -29,7 +33,7 @@ export const topShowAnimation = keyframes `
|
|
|
29
33
|
transform: translate(-50%, 0);
|
|
30
34
|
}
|
|
31
35
|
`;
|
|
32
|
-
|
|
36
|
+
exports.topHideAnimation = (0, react_1.keyframes) `
|
|
33
37
|
from {
|
|
34
38
|
opacity: 1;
|
|
35
39
|
transform: translate(-50%, 0);
|
|
@@ -39,7 +43,7 @@ export const topHideAnimation = keyframes `
|
|
|
39
43
|
transform: translate(-50%, -100%);
|
|
40
44
|
}
|
|
41
45
|
`;
|
|
42
|
-
|
|
46
|
+
exports.bottomShowAnimation = (0, react_1.keyframes) `
|
|
43
47
|
from {
|
|
44
48
|
opacity: 0;
|
|
45
49
|
transform: translate(-50%, 100%);
|
|
@@ -49,7 +53,7 @@ export const bottomShowAnimation = keyframes `
|
|
|
49
53
|
transform: translate(-50%, 0);
|
|
50
54
|
}
|
|
51
55
|
`;
|
|
52
|
-
|
|
56
|
+
exports.bottomHideAnimation = (0, react_1.keyframes) `
|
|
53
57
|
from {
|
|
54
58
|
opacity: 1;
|
|
55
59
|
transform: translate(-50%, 0);
|
|
@@ -65,11 +69,11 @@ export const bottomHideAnimation = keyframes `
|
|
|
65
69
|
* @param type
|
|
66
70
|
* @returns
|
|
67
71
|
*/
|
|
68
|
-
|
|
72
|
+
function getAnimation(position, type) {
|
|
69
73
|
const animation = {
|
|
70
|
-
top: [topShowAnimation, topHideAnimation],
|
|
71
|
-
middle: [middleShowAnimation, middleHideAnimation],
|
|
72
|
-
bottom: [bottomShowAnimation, bottomHideAnimation],
|
|
74
|
+
top: [exports.topShowAnimation, exports.topHideAnimation],
|
|
75
|
+
middle: [exports.middleShowAnimation, exports.middleHideAnimation],
|
|
76
|
+
bottom: [exports.bottomShowAnimation, exports.bottomHideAnimation],
|
|
73
77
|
};
|
|
74
78
|
let keyframes;
|
|
75
79
|
if (type === "show") {
|
|
@@ -80,14 +84,14 @@ export function getAnimation(position, type) {
|
|
|
80
84
|
}
|
|
81
85
|
return {
|
|
82
86
|
keyframes,
|
|
83
|
-
animation: css({
|
|
87
|
+
animation: (0, react_1.css)({
|
|
84
88
|
animation: `${keyframes} 300ms ease`,
|
|
85
89
|
}),
|
|
86
90
|
};
|
|
87
91
|
}
|
|
88
|
-
|
|
92
|
+
exports.style = {
|
|
89
93
|
container() {
|
|
90
|
-
return css({
|
|
94
|
+
return (0, react_1.css)({
|
|
91
95
|
position: "fixed",
|
|
92
96
|
left: "50%",
|
|
93
97
|
transform: "translateX(-50%)",
|
|
@@ -96,14 +100,14 @@ export const style = {
|
|
|
96
100
|
});
|
|
97
101
|
},
|
|
98
102
|
top(offset) {
|
|
99
|
-
return css({ top: offset / 100 + 'rem' });
|
|
103
|
+
return (0, react_1.css)({ top: offset / 100 + 'rem' });
|
|
100
104
|
},
|
|
101
|
-
middle: css({ top: "50%" }),
|
|
105
|
+
middle: (0, react_1.css)({ top: "50%" }),
|
|
102
106
|
bottom(offset) {
|
|
103
|
-
return css({ bottom: offset / 100 + 'rem' });
|
|
107
|
+
return (0, react_1.css)({ bottom: offset / 100 + 'rem' });
|
|
104
108
|
},
|
|
105
109
|
content: (radius) => {
|
|
106
|
-
return css({
|
|
110
|
+
return (0, react_1.css)({
|
|
107
111
|
position: "relative",
|
|
108
112
|
backgroundColor: "rgba(0, 0, 0, .8)",
|
|
109
113
|
color: "#fff",
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { tick } from './utils/tick';
|
|
2
|
-
export { setContextValue, getContextValue } from './context';
|
|
3
2
|
export { jsonp } from './utils/jsonp';
|
|
4
3
|
export { uniqKey } from './utils/uniqKey';
|
|
5
4
|
export { ago } from './utils/ago';
|
|
@@ -34,3 +33,4 @@ export { AutoGrid } from './AutoGrid';
|
|
|
34
33
|
export { showAlert } from './Alert';
|
|
35
34
|
export { ScrollView } from './ScrollView';
|
|
36
35
|
export { CarouselNotice } from './CarouselNotice';
|
|
36
|
+
export { CitySelect, showCitySelect } from './CitySelect';
|
package/build/index.js
CHANGED
|
@@ -1,36 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showUniqToast = exports.showToast = exports.Overlay = exports.Countdowner = exports.ColStart = exports.ColEvenly = exports.ColEnd = exports.ColCenter = exports.ColBetween = exports.ColAround = exports.Col = exports.RowStart = exports.RowEvenly = exports.RowEnd = exports.RowCenter = exports.RowBetween = exports.RowAround = exports.Row = exports.FlexItem = exports.Flex = exports.Container = exports.Ago = exports.useViewport = exports.useWindowResize = exports.useUpdate = exports.useTick = exports.useInterval = exports.createPortalDOM = exports.getHistory = exports.history = exports.createApp = exports.splitValue = exports.normalizeUnit = exports.waitUntil = exports.waitFor = exports.is = exports.defaultScroll = exports.Countdown = exports.calendarTable = exports.registerHostAlias = exports.buildUrlByOption = exports.sendRequest = exports.sugarSend = exports.sendJSON = exports.POST = exports.GET = exports.ago = exports.uniqKey = exports.jsonp = exports.tick = void 0;
|
|
4
|
+
exports.showCitySelect = exports.CitySelect = exports.CarouselNotice = exports.ScrollView = exports.showAlert = exports.AutoGrid = exports.SafeArea = exports.showLoadingAtLeast = exports.showLoading = exports.Indicator = exports.Clickable = exports.showDialog = void 0;
|
|
5
|
+
var tick_1 = require("./utils/tick");
|
|
6
|
+
Object.defineProperty(exports, "tick", { enumerable: true, get: function () { return tick_1.tick; } });
|
|
7
|
+
var jsonp_1 = require("./utils/jsonp");
|
|
8
|
+
Object.defineProperty(exports, "jsonp", { enumerable: true, get: function () { return jsonp_1.jsonp; } });
|
|
9
|
+
var uniqKey_1 = require("./utils/uniqKey");
|
|
10
|
+
Object.defineProperty(exports, "uniqKey", { enumerable: true, get: function () { return uniqKey_1.uniqKey; } });
|
|
11
|
+
var ago_1 = require("./utils/ago");
|
|
12
|
+
Object.defineProperty(exports, "ago", { enumerable: true, get: function () { return ago_1.ago; } });
|
|
13
|
+
var request_1 = require("./utils/request");
|
|
14
|
+
Object.defineProperty(exports, "GET", { enumerable: true, get: function () { return request_1.GET; } });
|
|
15
|
+
Object.defineProperty(exports, "POST", { enumerable: true, get: function () { return request_1.POST; } });
|
|
16
|
+
Object.defineProperty(exports, "sendJSON", { enumerable: true, get: function () { return request_1.sendJSON; } });
|
|
17
|
+
Object.defineProperty(exports, "sugarSend", { enumerable: true, get: function () { return request_1.sugarSend; } });
|
|
18
|
+
Object.defineProperty(exports, "sendRequest", { enumerable: true, get: function () { return request_1.sendRequest; } });
|
|
19
|
+
Object.defineProperty(exports, "buildUrlByOption", { enumerable: true, get: function () { return request_1.buildUrlByOption; } });
|
|
20
|
+
Object.defineProperty(exports, "registerHostAlias", { enumerable: true, get: function () { return request_1.registerHostAlias; } });
|
|
21
|
+
var calendarTable_1 = require("./utils/calendarTable");
|
|
22
|
+
Object.defineProperty(exports, "calendarTable", { enumerable: true, get: function () { return calendarTable_1.calendarTable; } });
|
|
23
|
+
var Countdown_1 = require("./utils/Countdown");
|
|
24
|
+
Object.defineProperty(exports, "Countdown", { enumerable: true, get: function () { return Countdown_1.Countdown; } });
|
|
25
|
+
var defaultScroll_1 = require("./utils/defaultScroll");
|
|
26
|
+
Object.defineProperty(exports, "defaultScroll", { enumerable: true, get: function () { return defaultScroll_1.defaultScroll; } });
|
|
27
|
+
var is_1 = require("./utils/is");
|
|
28
|
+
Object.defineProperty(exports, "is", { enumerable: true, get: function () { return is_1.is; } });
|
|
29
|
+
var wait_1 = require("./utils/wait");
|
|
30
|
+
Object.defineProperty(exports, "waitFor", { enumerable: true, get: function () { return wait_1.waitFor; } });
|
|
31
|
+
Object.defineProperty(exports, "waitUntil", { enumerable: true, get: function () { return wait_1.waitUntil; } });
|
|
32
|
+
var cssUtil_1 = require("./utils/cssUtil");
|
|
33
|
+
Object.defineProperty(exports, "normalizeUnit", { enumerable: true, get: function () { return cssUtil_1.normalizeUnit; } });
|
|
34
|
+
Object.defineProperty(exports, "splitValue", { enumerable: true, get: function () { return cssUtil_1.splitValue; } });
|
|
35
|
+
var createApp_1 = require("./utils/createApp");
|
|
36
|
+
Object.defineProperty(exports, "createApp", { enumerable: true, get: function () { return createApp_1.createApp; } });
|
|
37
|
+
Object.defineProperty(exports, "history", { enumerable: true, get: function () { return createApp_1.history; } });
|
|
38
|
+
Object.defineProperty(exports, "getHistory", { enumerable: true, get: function () { return createApp_1.getHistory; } });
|
|
39
|
+
var dom_1 = require("./utils/dom");
|
|
40
|
+
Object.defineProperty(exports, "createPortalDOM", { enumerable: true, get: function () { return dom_1.createPortalDOM; } });
|
|
41
|
+
var useInterval_1 = require("./Effect/useInterval");
|
|
42
|
+
Object.defineProperty(exports, "useInterval", { enumerable: true, get: function () { return useInterval_1.useInterval; } });
|
|
43
|
+
var useTick_1 = require("./Effect/useTick");
|
|
44
|
+
Object.defineProperty(exports, "useTick", { enumerable: true, get: function () { return useTick_1.useTick; } });
|
|
45
|
+
var useUpdate_1 = require("./Effect/useUpdate");
|
|
46
|
+
Object.defineProperty(exports, "useUpdate", { enumerable: true, get: function () { return useUpdate_1.useUpdate; } });
|
|
47
|
+
var useWindowResize_1 = require("./Effect/useWindowResize");
|
|
48
|
+
Object.defineProperty(exports, "useWindowResize", { enumerable: true, get: function () { return useWindowResize_1.useWindowResize; } });
|
|
49
|
+
var useViewport_1 = require("./Effect/useViewport");
|
|
50
|
+
Object.defineProperty(exports, "useViewport", { enumerable: true, get: function () { return useViewport_1.useViewport; } });
|
|
51
|
+
var Ago_1 = require("./Ago");
|
|
52
|
+
Object.defineProperty(exports, "Ago", { enumerable: true, get: function () { return Ago_1.Ago; } });
|
|
53
|
+
var Container_1 = require("./Container");
|
|
54
|
+
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return Container_1.Container; } });
|
|
55
|
+
var Flex_1 = require("./Flex");
|
|
56
|
+
Object.defineProperty(exports, "Flex", { enumerable: true, get: function () { return Flex_1.Flex; } });
|
|
57
|
+
Object.defineProperty(exports, "FlexItem", { enumerable: true, get: function () { return Flex_1.FlexItem; } });
|
|
58
|
+
var Row_1 = require("./Flex/Row");
|
|
59
|
+
Object.defineProperty(exports, "Row", { enumerable: true, get: function () { return Row_1.Row; } });
|
|
60
|
+
Object.defineProperty(exports, "RowAround", { enumerable: true, get: function () { return Row_1.RowAround; } });
|
|
61
|
+
Object.defineProperty(exports, "RowBetween", { enumerable: true, get: function () { return Row_1.RowBetween; } });
|
|
62
|
+
Object.defineProperty(exports, "RowCenter", { enumerable: true, get: function () { return Row_1.RowCenter; } });
|
|
63
|
+
Object.defineProperty(exports, "RowEnd", { enumerable: true, get: function () { return Row_1.RowEnd; } });
|
|
64
|
+
Object.defineProperty(exports, "RowEvenly", { enumerable: true, get: function () { return Row_1.RowEvenly; } });
|
|
65
|
+
Object.defineProperty(exports, "RowStart", { enumerable: true, get: function () { return Row_1.RowStart; } });
|
|
66
|
+
var Col_1 = require("./Flex/Col");
|
|
67
|
+
Object.defineProperty(exports, "Col", { enumerable: true, get: function () { return Col_1.Col; } });
|
|
68
|
+
Object.defineProperty(exports, "ColAround", { enumerable: true, get: function () { return Col_1.ColAround; } });
|
|
69
|
+
Object.defineProperty(exports, "ColBetween", { enumerable: true, get: function () { return Col_1.ColBetween; } });
|
|
70
|
+
Object.defineProperty(exports, "ColCenter", { enumerable: true, get: function () { return Col_1.ColCenter; } });
|
|
71
|
+
Object.defineProperty(exports, "ColEnd", { enumerable: true, get: function () { return Col_1.ColEnd; } });
|
|
72
|
+
Object.defineProperty(exports, "ColEvenly", { enumerable: true, get: function () { return Col_1.ColEvenly; } });
|
|
73
|
+
Object.defineProperty(exports, "ColStart", { enumerable: true, get: function () { return Col_1.ColStart; } });
|
|
74
|
+
var Countdowner_1 = require("./Countdowner");
|
|
75
|
+
Object.defineProperty(exports, "Countdowner", { enumerable: true, get: function () { return Countdowner_1.Countdowner; } });
|
|
76
|
+
var Overlay_1 = require("./Overlay");
|
|
77
|
+
Object.defineProperty(exports, "Overlay", { enumerable: true, get: function () { return Overlay_1.Overlay; } });
|
|
78
|
+
var Toast_1 = require("./Toast");
|
|
79
|
+
Object.defineProperty(exports, "showToast", { enumerable: true, get: function () { return Toast_1.showToast; } });
|
|
80
|
+
Object.defineProperty(exports, "showUniqToast", { enumerable: true, get: function () { return Toast_1.showUniqToast; } });
|
|
81
|
+
var Dialog_1 = require("./Dialog");
|
|
82
|
+
Object.defineProperty(exports, "showDialog", { enumerable: true, get: function () { return Dialog_1.showDialog; } });
|
|
83
|
+
var Clickable_1 = require("./Clickable");
|
|
84
|
+
Object.defineProperty(exports, "Clickable", { enumerable: true, get: function () { return Clickable_1.Clickable; } });
|
|
85
|
+
var Indicator_1 = require("./Indicator");
|
|
86
|
+
Object.defineProperty(exports, "Indicator", { enumerable: true, get: function () { return Indicator_1.Indicator; } });
|
|
87
|
+
var Loading_1 = require("./Loading");
|
|
88
|
+
Object.defineProperty(exports, "showLoading", { enumerable: true, get: function () { return Loading_1.showLoading; } });
|
|
89
|
+
Object.defineProperty(exports, "showLoadingAtLeast", { enumerable: true, get: function () { return Loading_1.showLoadingAtLeast; } });
|
|
90
|
+
var SafeArea_1 = require("./SafeArea");
|
|
91
|
+
Object.defineProperty(exports, "SafeArea", { enumerable: true, get: function () { return SafeArea_1.SafeArea; } });
|
|
92
|
+
var AutoGrid_1 = require("./AutoGrid");
|
|
93
|
+
Object.defineProperty(exports, "AutoGrid", { enumerable: true, get: function () { return AutoGrid_1.AutoGrid; } });
|
|
94
|
+
var Alert_1 = require("./Alert");
|
|
95
|
+
Object.defineProperty(exports, "showAlert", { enumerable: true, get: function () { return Alert_1.showAlert; } });
|
|
96
|
+
var ScrollView_1 = require("./ScrollView");
|
|
97
|
+
Object.defineProperty(exports, "ScrollView", { enumerable: true, get: function () { return ScrollView_1.ScrollView; } });
|
|
98
|
+
var CarouselNotice_1 = require("./CarouselNotice");
|
|
99
|
+
Object.defineProperty(exports, "CarouselNotice", { enumerable: true, get: function () { return CarouselNotice_1.CarouselNotice; } });
|
|
100
|
+
var CitySelect_1 = require("./CitySelect");
|
|
101
|
+
Object.defineProperty(exports, "CitySelect", { enumerable: true, get: function () { return CitySelect_1.CitySelect; } });
|
|
102
|
+
Object.defineProperty(exports, "showCitySelect", { enumerable: true, get: function () { return CitySelect_1.showCitySelect; } });
|
package/build/utils/Countdown.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Countdown = void 0;
|
|
4
|
+
const tick_1 = require("./tick");
|
|
5
|
+
class Countdown {
|
|
3
6
|
constructor(option) {
|
|
4
7
|
/**
|
|
5
8
|
* 倒计时的剩余时间,单位为秒
|
|
@@ -61,7 +64,7 @@ export class Countdown {
|
|
|
61
64
|
// 记录倒计时开启时的时间
|
|
62
65
|
const start = Date.now();
|
|
63
66
|
// 使用 1000ms 间隔,避免每帧都执行(性能优化)
|
|
64
|
-
this._stopTick = tick(() => {
|
|
67
|
+
this._stopTick = (0, tick_1.tick)(() => {
|
|
65
68
|
var _a, _b, _c, _d;
|
|
66
69
|
// 获取倒计时已经持续的时间
|
|
67
70
|
const duration = Math.floor((Date.now() - start) / 1000);
|
|
@@ -121,3 +124,4 @@ export class Countdown {
|
|
|
121
124
|
return result;
|
|
122
125
|
}
|
|
123
126
|
}
|
|
127
|
+
exports.Countdown = Countdown;
|
package/build/utils/ago.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ago = ago;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
2
8
|
/**
|
|
3
9
|
* 用于格式化显示:多久以前
|
|
4
10
|
* @param date
|
|
5
11
|
*/
|
|
6
|
-
|
|
7
|
-
const now =
|
|
8
|
-
const input =
|
|
12
|
+
function ago(date) {
|
|
13
|
+
const now = (0, dayjs_1.default)();
|
|
14
|
+
const input = (0, dayjs_1.default)(date);
|
|
9
15
|
if (!input.isValid()) {
|
|
10
16
|
return {
|
|
11
17
|
num: 0,
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.calendarTable = calendarTable;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
2
8
|
/**
|
|
3
9
|
* 创建一个月历视图的原始数据表
|
|
4
10
|
* @param usefulFormat dayjs构造函数可以识别的任意值
|
|
5
11
|
* @param startFromSunday 是否以星期天作为一周的第一天
|
|
6
12
|
* @param sizeGuarantee 是否保证生成表格始终有6行
|
|
7
13
|
*/
|
|
8
|
-
|
|
9
|
-
const value =
|
|
14
|
+
function calendarTable(usefulFormat = (0, dayjs_1.default)(), startFromSunday = false, sizeGuarantee = true) {
|
|
15
|
+
const value = (0, dayjs_1.default)(usefulFormat);
|
|
10
16
|
const startOfMonth = value.startOf("month");
|
|
11
17
|
const endOfMonth = value.endOf("month");
|
|
12
18
|
const monthStartDay = startOfMonth.date();
|