clxx 2.0.3 → 2.0.6
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/build/Ago/index.d.ts +3 -5
- package/build/Ago/index.js +6 -7
- package/build/Alert/Wrapper.d.ts +3 -4
- package/build/Alert/Wrapper.js +10 -17
- package/build/Alert/index.d.ts +2 -2
- package/build/Alert/index.js +9 -10
- package/build/Alert/style.js +1 -0
- package/build/AutoGrid/index.d.ts +4 -5
- package/build/AutoGrid/index.js +19 -21
- package/build/CarouselNotice/index.d.ts +4 -5
- package/build/CarouselNotice/index.js +20 -21
- package/build/Clickable/index.d.ts +1 -1
- package/build/Clickable/index.js +3 -2
- package/build/Container/index.d.ts +3 -4
- package/build/Container/index.js +37 -39
- package/build/Countdowner/index.d.ts +4 -5
- package/build/Countdowner/index.js +13 -14
- package/build/Dialog/Wrapper.d.ts +2 -2
- package/build/Dialog/Wrapper.js +6 -9
- package/build/Dialog/index.d.ts +3 -3
- package/build/Dialog/index.js +21 -12
- package/build/{effect → Effect}/useInterval.d.ts +0 -0
- package/build/{effect → Effect}/useInterval.js +0 -0
- package/build/{effect → Effect}/useTick.d.ts +0 -0
- package/build/{effect → Effect}/useTick.js +4 -2
- package/build/Effect/useUpdate.d.ts +5 -0
- package/build/Effect/useUpdate.js +10 -0
- package/build/{effect → Effect}/useViewport.d.ts +0 -0
- package/build/{effect → Effect}/useViewport.js +0 -0
- package/build/{effect → Effect}/useWindowResize.d.ts +0 -0
- package/build/{effect → Effect}/useWindowResize.js +0 -0
- package/build/Flex/Col.d.ts +7 -9
- package/build/Flex/Col.js +14 -15
- package/build/Flex/Row.d.ts +7 -9
- package/build/Flex/Row.js +14 -15
- package/build/Flex/index.d.ts +2 -4
- package/build/Flex/index.js +5 -6
- package/build/Indicator/index.d.ts +4 -5
- package/build/Indicator/index.js +14 -15
- package/build/Loading/Wrapper.d.ts +7 -8
- package/build/Loading/Wrapper.js +14 -18
- package/build/Loading/index.d.ts +1 -1
- package/build/Loading/index.js +10 -11
- package/build/Overlay/index.d.ts +2 -4
- package/build/Overlay/index.js +15 -17
- package/build/SafeArea/index.d.ts +2 -4
- package/build/SafeArea/index.js +7 -8
- package/build/ScrollView/index.d.ts +2 -2
- package/build/ScrollView/index.js +12 -11
- package/build/Toast/Toast.d.ts +2 -2
- package/build/Toast/Toast.js +4 -5
- package/build/Toast/index.d.ts +2 -2
- package/build/Toast/index.js +13 -11
- package/build/Toast/style.d.ts +1 -1
- package/build/Toast/style.js +1 -1
- package/build/index.d.ts +4 -5
- package/build/index.js +4 -5
- package/build/utils/Countdown.d.ts +1 -2
- package/build/utils/Countdown.js +4 -2
- package/build/utils/createApp.d.ts +8 -8
- package/build/utils/createApp.js +29 -23
- package/build/utils/dom.d.ts +5 -5
- package/build/utils/dom.js +14 -27
- package/build/utils/request.js +4 -3
- package/build/utils/tick.d.ts +11 -5
- package/build/utils/tick.js +28 -24
- package/build/utils/wait.js +5 -4
- package/package.json +15 -15
- package/build/Picker/Wrapper.d.ts +0 -20
- package/build/Picker/Wrapper.js +0 -92
- package/build/Picker/index.d.ts +0 -21
- package/build/Picker/index.js +0 -64
- package/build/Picker/style.d.ts +0 -3
- package/build/Picker/style.js +0 -122
- package/build/Picker/swiperStyle.d.ts +0 -1
- package/build/Picker/swiperStyle.js +0 -66
package/build/Ago/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import dayjs from "dayjs";
|
|
5
|
-
import { AgoValue } from "../utils/ago";
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { AgoValue } from '../utils/ago';
|
|
6
4
|
export interface AgoProps extends React.HTMLProps<HTMLSpanElement | HTMLDivElement> {
|
|
7
5
|
date?: dayjs.ConfigType;
|
|
8
6
|
block?: boolean;
|
|
9
7
|
renderContent?: (result: AgoValue) => React.ReactNode;
|
|
10
8
|
}
|
|
11
|
-
export declare function Ago(props: AgoProps): jsx.JSX.Element;
|
|
9
|
+
export declare function Ago(props: AgoProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/Ago/index.js
CHANGED
|
@@ -9,22 +9,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { ago } from "../utils/ago";
|
|
12
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import dayjs from 'dayjs';
|
|
14
|
+
import { ago } from '../utils/ago';
|
|
16
15
|
export function Ago(props) {
|
|
17
16
|
const { date = dayjs(), block = false, renderContent } = props, attrs = __rest(props, ["date", "block", "renderContent"]);
|
|
18
17
|
const agoValue = ago(date);
|
|
19
18
|
// 格式化内容
|
|
20
19
|
let content = agoValue.format;
|
|
21
|
-
if (typeof renderContent ===
|
|
20
|
+
if (typeof renderContent === 'function') {
|
|
22
21
|
content = renderContent(agoValue);
|
|
23
22
|
}
|
|
24
23
|
// 是否显示为块元素
|
|
25
24
|
if (block) {
|
|
26
|
-
return
|
|
25
|
+
return _jsx("div", Object.assign({}, attrs, { children: content }));
|
|
27
26
|
}
|
|
28
27
|
// 默认显示行内元素
|
|
29
|
-
return
|
|
28
|
+
return _jsx("span", Object.assign({}, attrs, { children: content }));
|
|
30
29
|
}
|
package/build/Alert/Wrapper.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import * as CSS from "csstype";
|
|
2
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
3
|
+
import * as CSS from 'csstype';
|
|
5
4
|
export interface AlertWrapperProps {
|
|
6
5
|
title?: React.ReactNode;
|
|
7
6
|
description?: React.ReactNode;
|
|
@@ -18,4 +17,4 @@ export interface AlertWrapperProps {
|
|
|
18
17
|
confirmStyle?: Interpolation<Theme>;
|
|
19
18
|
cancelStyle?: Interpolation<Theme>;
|
|
20
19
|
}
|
|
21
|
-
export declare function AlertWrapper(props: AlertWrapperProps): jsx.JSX.Element;
|
|
20
|
+
export declare function AlertWrapper(props: AlertWrapperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/Alert/Wrapper.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { style } from "./style";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Clickable } from '../Clickable';
|
|
3
|
+
import { Row } from '../Flex/Row';
|
|
4
|
+
import { style } from './style';
|
|
6
5
|
export function AlertWrapper(props) {
|
|
7
|
-
const { title =
|
|
6
|
+
const { title = '提示', description, confirm = '确定', confirmColor = '#007afe', cancel = '取消', cancelColor = '#666', showCancel = false, onConfirm, onCancel,
|
|
8
7
|
// 可定制的样式
|
|
9
8
|
titleStyle, descStyle, btnStyle, cancelStyle, confirmStyle, } = props;
|
|
10
9
|
// 标题样式
|
|
@@ -18,15 +17,9 @@ export function AlertWrapper(props) {
|
|
|
18
17
|
if (showCancel) {
|
|
19
18
|
btnBoxCss.push(style.btnBoxWithCancel);
|
|
20
19
|
}
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
showCancel && (jsx(Clickable, { css: [style.btn, btnStyle, cancelStyle, { color: cancelColor }], onClick: onCancel, activeStyle: {
|
|
27
|
-
backgroundColor: `#c0c0c022`,
|
|
28
|
-
} }, cancel)),
|
|
29
|
-
jsx(Clickable, { css: [style.btn, btnStyle, confirmStyle, { color: confirmColor }], onClick: onConfirm, activeStyle: {
|
|
30
|
-
backgroundColor: `#c0c0c022`,
|
|
31
|
-
} }, confirm))));
|
|
20
|
+
return (_jsxs("div", Object.assign({ css: style.container }, { children: [_jsxs("div", Object.assign({ css: style.content }, { children: [_jsx("div", Object.assign({ css: titleCss }, { children: title })), description && _jsx("div", Object.assign({ css: [style.desc, descStyle] }, { children: description }))] })), _jsxs(Row, Object.assign({ alignItems: "stretch", css: btnBoxCss }, { children: [showCancel && (_jsx(Clickable, Object.assign({ css: [style.btn, btnStyle, cancelStyle, { color: cancelColor }], onClick: onCancel, activeStyle: {
|
|
21
|
+
backgroundColor: `#c0c0c022`,
|
|
22
|
+
} }, { children: cancel }))), _jsx(Clickable, Object.assign({ css: [style.btn, btnStyle, confirmStyle, { color: confirmColor }], onClick: onConfirm, activeStyle: {
|
|
23
|
+
backgroundColor: `#c0c0c022`,
|
|
24
|
+
} }, { children: confirm }))] }))] })));
|
|
32
25
|
}
|
package/build/Alert/index.d.ts
CHANGED
package/build/Alert/index.js
CHANGED
|
@@ -7,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import omit from "lodash/omit";
|
|
10
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { showDialog } from '../Dialog';
|
|
13
|
+
import { AlertWrapper } from './Wrapper';
|
|
14
|
+
import isPlainObject from 'lodash/isPlainObject';
|
|
15
|
+
import omit from 'lodash/omit';
|
|
17
16
|
/**
|
|
18
17
|
* 显示弹框
|
|
19
18
|
* @param option
|
|
@@ -29,7 +28,7 @@ export function showAlert(option) {
|
|
|
29
28
|
config = option;
|
|
30
29
|
}
|
|
31
30
|
// 组件选项
|
|
32
|
-
const props = omit(config, [
|
|
31
|
+
const props = omit(config, ['showMask']);
|
|
33
32
|
props.onCancel = () => __awaiter(this, void 0, void 0, function* () {
|
|
34
33
|
var _a;
|
|
35
34
|
yield closeDialog();
|
|
@@ -42,8 +41,8 @@ export function showAlert(option) {
|
|
|
42
41
|
});
|
|
43
42
|
// 创建对话框
|
|
44
43
|
const closeDialog = showDialog({
|
|
45
|
-
showMask: typeof config.showMask ===
|
|
46
|
-
content:
|
|
44
|
+
showMask: typeof config.showMask === 'undefined' ? true : !!config.showMask,
|
|
45
|
+
content: _jsx(AlertWrapper, Object.assign({}, props)),
|
|
47
46
|
});
|
|
48
47
|
// 返回关闭逻辑
|
|
49
48
|
return closeDialog;
|
package/build/Alert/style.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import CSS from "csstype";
|
|
1
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import CSS from 'csstype';
|
|
5
4
|
export interface AutoGridOption extends React.HTMLProps<HTMLDivElement> {
|
|
6
5
|
children?: React.ReactNode;
|
|
7
6
|
containerStyle?: Interpolation<Theme>;
|
|
@@ -14,4 +13,4 @@ export interface AutoGridOption extends React.HTMLProps<HTMLDivElement> {
|
|
|
14
13
|
* 自动化生成表格
|
|
15
14
|
* @param props
|
|
16
15
|
*/
|
|
17
|
-
export declare function AutoGrid(props: AutoGridOption): jsx.JSX.Element;
|
|
16
|
+
export declare function AutoGrid(props: AutoGridOption): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/AutoGrid/index.js
CHANGED
|
@@ -9,11 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import { normalizeUnit } from "../utils/cssUtil";
|
|
12
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import React, { useCallback } from 'react';
|
|
14
|
+
import { style } from './style';
|
|
15
|
+
import { normalizeUnit } from '../utils/cssUtil';
|
|
17
16
|
/**
|
|
18
17
|
* 自动化生成表格
|
|
19
18
|
* @param props
|
|
@@ -59,22 +58,21 @@ export function AutoGrid(props) {
|
|
|
59
58
|
marginBottom: gap,
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
|
-
return (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
})));
|
|
61
|
+
return (_jsx("div", Object.assign({ css: finalRowStyle }, { children: row.map((item, colIndex) => {
|
|
62
|
+
let finalCss = [...finalItemBoxStyle];
|
|
63
|
+
// 如果是方形的,加入方形相关的样式
|
|
64
|
+
if (isSquare) {
|
|
65
|
+
finalCss.push(style.itemBoxSquare);
|
|
66
|
+
}
|
|
67
|
+
finalCss.push(itemStyle);
|
|
68
|
+
if (isSquare) {
|
|
69
|
+
return (_jsx("div", Object.assign({ css: finalCss }, { children: _jsx("div", Object.assign({ css: style.itemInnerStyle }, { children: item })) }), colIndex));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return (_jsx("div", Object.assign({ css: finalItemBoxStyle }, { children: item }), colIndex));
|
|
73
|
+
}
|
|
74
|
+
}) }), rowIndex));
|
|
77
75
|
});
|
|
78
76
|
};
|
|
79
|
-
return (
|
|
77
|
+
return (_jsx("div", Object.assign({}, extra, { css: [containerStyle] }, { children: showContent() })));
|
|
80
78
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import * as CSS from "csstype";
|
|
2
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
3
|
+
import * as CSS from 'csstype';
|
|
5
4
|
export interface CarouselNoticeOption extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
5
|
list: Array<React.ReactNode>;
|
|
7
6
|
width: CSS.Property.Width;
|
|
8
7
|
height: CSS.Property.Height;
|
|
9
|
-
justify:
|
|
8
|
+
justify: 'start' | 'center' | 'end';
|
|
10
9
|
duration: number;
|
|
11
10
|
interval: number;
|
|
12
11
|
containerStyle?: Interpolation<Theme>;
|
|
@@ -17,4 +16,4 @@ export interface CarouselNoticeOption extends React.DetailedHTMLProps<React.HTML
|
|
|
17
16
|
* 滚动循环轮播公告
|
|
18
17
|
* @param props
|
|
19
18
|
*/
|
|
20
|
-
export declare function CarouselNotice(props: Partial<CarouselNoticeOption>): false | jsx.JSX.Element;
|
|
19
|
+
export declare function CarouselNotice(props: Partial<CarouselNoticeOption>): false | import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -9,17 +9,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import { useState, useEffect } from
|
|
15
|
-
import { useInterval } from
|
|
16
|
-
import { style, Bubble } from
|
|
12
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import { css } from '@emotion/react';
|
|
14
|
+
import { useState, useEffect } from 'react';
|
|
15
|
+
import { useInterval } from '../Effect/useInterval';
|
|
16
|
+
import { style, Bubble } from './style';
|
|
17
17
|
/**
|
|
18
18
|
* 滚动循环轮播公告
|
|
19
19
|
* @param props
|
|
20
20
|
*/
|
|
21
21
|
export function CarouselNotice(props) {
|
|
22
|
-
const { width, height, justify =
|
|
22
|
+
const { width, height, justify = 'center', interval = 3000, duration = 200, list = [], containerStyle, wrapperStyle, itemStyle } = props, attrs = __rest(props, ["width", "height", "justify", "interval", "duration", "list", "containerStyle", "wrapperStyle", "itemStyle"]);
|
|
23
23
|
const [current, setCurrent] = useState(0);
|
|
24
24
|
const [animation, setAnimation] = useState(false);
|
|
25
25
|
/**
|
|
@@ -40,30 +40,30 @@ export function CarouselNotice(props) {
|
|
|
40
40
|
*/
|
|
41
41
|
const showContent = () => {
|
|
42
42
|
const justifyStyle = {};
|
|
43
|
-
if (justify ===
|
|
44
|
-
justifyStyle.justifyContent =
|
|
43
|
+
if (justify === 'center') {
|
|
44
|
+
justifyStyle.justifyContent = 'center';
|
|
45
45
|
}
|
|
46
|
-
else if (justify ===
|
|
47
|
-
justifyStyle.justifyContent =
|
|
46
|
+
else if (justify === 'start') {
|
|
47
|
+
justifyStyle.justifyContent = 'flex-start';
|
|
48
48
|
}
|
|
49
|
-
else if (justify ===
|
|
50
|
-
justifyStyle.justifyContent =
|
|
49
|
+
else if (justify === 'end') {
|
|
50
|
+
justifyStyle.justifyContent = 'flex-end';
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
justifyStyle.justifyContent =
|
|
53
|
+
justifyStyle.justifyContent = 'center';
|
|
54
54
|
}
|
|
55
55
|
const itemCss = [style.item, justifyStyle];
|
|
56
56
|
if (list.length === 1) {
|
|
57
|
-
return (
|
|
57
|
+
return (_jsx("div", Object.assign({ css: [itemCss, itemStyle] }, { children: list[0] }), 0));
|
|
58
58
|
}
|
|
59
59
|
const showList = [];
|
|
60
60
|
if (current === list.length - 1) {
|
|
61
|
-
showList.push(
|
|
62
|
-
showList.push(
|
|
61
|
+
showList.push(_jsx("div", Object.assign({ css: [itemCss, itemStyle] }, { children: list[list.length - 1] }), current));
|
|
62
|
+
showList.push(_jsx("div", Object.assign({ css: [itemCss, itemStyle] }, { children: list[0] }), 0));
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
|
-
showList.push(
|
|
66
|
-
showList.push(
|
|
65
|
+
showList.push(_jsx("div", Object.assign({ css: [itemCss, itemStyle] }, { children: list[current] }), current));
|
|
66
|
+
showList.push(_jsx("div", Object.assign({ css: [itemCss, itemStyle] }, { children: list[current + 1] }), current + 1));
|
|
67
67
|
}
|
|
68
68
|
return showList;
|
|
69
69
|
};
|
|
@@ -76,7 +76,7 @@ export function CarouselNotice(props) {
|
|
|
76
76
|
}
|
|
77
77
|
return css({
|
|
78
78
|
animationName: Bubble,
|
|
79
|
-
animationTimingFunction:
|
|
79
|
+
animationTimingFunction: 'linear',
|
|
80
80
|
animationDuration: `${duration}ms`,
|
|
81
81
|
});
|
|
82
82
|
};
|
|
@@ -92,6 +92,5 @@ export function CarouselNotice(props) {
|
|
|
92
92
|
setAnimation(false);
|
|
93
93
|
};
|
|
94
94
|
return (Array.isArray(list) &&
|
|
95
|
-
list.length > 0 && (
|
|
96
|
-
jsx("div", { onAnimationEnd: animationEnd, css: [style.wrapper, getAnimation(), wrapperStyle] }, showContent()))));
|
|
95
|
+
list.length > 0 && (_jsx("div", Object.assign({}, attrs, { css: [style.box, { width, height }, containerStyle] }, { children: _jsx("div", Object.assign({ onAnimationEnd: animationEnd, css: [style.wrapper, getAnimation(), wrapperStyle] }, { children: showContent() })) }))));
|
|
97
96
|
}
|
|
@@ -9,4 +9,4 @@ export interface ClickableProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
9
9
|
activeStyle: React.CSSProperties;
|
|
10
10
|
disable: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare function Clickable(props: Partial<ClickableProps>): JSX.Element;
|
|
12
|
+
export declare function Clickable(props: Partial<ClickableProps>): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/Clickable/index.js
CHANGED
|
@@ -9,7 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import
|
|
12
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import { useCallback, useRef, useState, useEffect, } from "react";
|
|
13
14
|
import { is } from "../utils/is";
|
|
14
15
|
export function Clickable(props) {
|
|
15
16
|
let { children, bubble = true, className, activeClassName, style, activeStyle, disable = false } = props, attrs = __rest(props, ["children", "bubble", "className", "activeClassName", "style", "activeStyle", "disable"]);
|
|
@@ -74,5 +75,5 @@ export function Clickable(props) {
|
|
|
74
75
|
fullAttrs.onMouseDown = onStart;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
return
|
|
78
|
+
return _jsx("div", Object.assign({}, fullAttrs, { children: children }));
|
|
78
79
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import React from "react";
|
|
1
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
export interface ContainerProps {
|
|
5
4
|
globalStyle?: Interpolation<Theme>;
|
|
6
5
|
children?: React.ReactNode;
|
|
@@ -10,4 +9,4 @@ export interface ContainerProps {
|
|
|
10
9
|
* 自适应容器
|
|
11
10
|
* @param props
|
|
12
11
|
*/
|
|
13
|
-
export declare function Container(props: ContainerProps): jsx.JSX.Element;
|
|
12
|
+
export declare function Container(props: ContainerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/Container/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import React, { useCallback, useEffect, useState } from
|
|
4
|
-
import { getContextValue } from
|
|
5
|
-
import { useWindowResize } from
|
|
6
|
-
import round from
|
|
7
|
-
import { useViewport } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Global } from '@emotion/react';
|
|
3
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { getContextValue } from '../context';
|
|
5
|
+
import { useWindowResize } from '../Effect/useWindowResize';
|
|
6
|
+
import round from 'lodash/round';
|
|
7
|
+
import { useViewport } from '../Effect/useViewport';
|
|
8
8
|
/**
|
|
9
9
|
* 自适应容器
|
|
10
10
|
* @param props
|
|
@@ -36,7 +36,7 @@ export function Container(props) {
|
|
|
36
36
|
// 字体缩放逻辑
|
|
37
37
|
const scaleFont = useCallback(() => {
|
|
38
38
|
let computeSize = parseFloat(window.getComputedStyle(document.documentElement).fontSize);
|
|
39
|
-
if (typeof computeSize ===
|
|
39
|
+
if (typeof computeSize === 'number' && computeSize !== baseFontSize) {
|
|
40
40
|
setBaseFontSize(round(Math.pow(baseFontSize, 2) / computeSize, 1));
|
|
41
41
|
}
|
|
42
42
|
}, [baseFontSize]);
|
|
@@ -48,42 +48,40 @@ export function Container(props) {
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
// 激活iOS上的:active
|
|
50
50
|
const activable = () => { };
|
|
51
|
-
document.body.addEventListener(
|
|
51
|
+
document.body.addEventListener('touchstart', activable);
|
|
52
52
|
return () => {
|
|
53
|
-
document.body.removeEventListener(
|
|
53
|
+
document.body.removeEventListener('touchstart', activable);
|
|
54
54
|
};
|
|
55
55
|
}, []);
|
|
56
|
-
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
boxSizing: "border-box",
|
|
61
|
-
},
|
|
62
|
-
html: {
|
|
63
|
-
WebkitTapHighlightColor: "transparent",
|
|
64
|
-
WebkitOverflowScrolling: "touch",
|
|
65
|
-
WebkitTextSizeAdjust: "100%",
|
|
66
|
-
fontSize: `${baseFontSize}px`,
|
|
67
|
-
touchAction: "manipulation",
|
|
68
|
-
},
|
|
69
|
-
body: {
|
|
70
|
-
fontSize: "16px",
|
|
71
|
-
margin: "0 auto",
|
|
72
|
-
maxWidth: `${maxDocWidth}px`,
|
|
73
|
-
minWidth: `${minDocWidth}px`,
|
|
74
|
-
},
|
|
75
|
-
[`@media (min-width: ${maxDocWidth}px)`]: {
|
|
76
|
-
html: {
|
|
77
|
-
fontSize: `${(100 * maxDocWidth) / designWidth}px`,
|
|
56
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Global, { styles: [
|
|
57
|
+
{
|
|
58
|
+
'*': {
|
|
59
|
+
boxSizing: 'border-box',
|
|
78
60
|
},
|
|
79
|
-
},
|
|
80
|
-
[`@media (max-width: ${minDocWidth}px)`]: {
|
|
81
61
|
html: {
|
|
82
|
-
|
|
62
|
+
WebkitTapHighlightColor: 'transparent',
|
|
63
|
+
WebkitOverflowScrolling: 'touch',
|
|
64
|
+
WebkitTextSizeAdjust: '100%',
|
|
65
|
+
fontSize: `${baseFontSize}px`,
|
|
66
|
+
touchAction: 'manipulation',
|
|
67
|
+
},
|
|
68
|
+
body: {
|
|
69
|
+
fontSize: '16px',
|
|
70
|
+
margin: '0 auto',
|
|
71
|
+
maxWidth: `${maxDocWidth}px`,
|
|
72
|
+
minWidth: `${minDocWidth}px`,
|
|
73
|
+
},
|
|
74
|
+
[`@media (min-width: ${maxDocWidth}px)`]: {
|
|
75
|
+
html: {
|
|
76
|
+
fontSize: `${(100 * maxDocWidth) / designWidth}px`,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
[`@media (max-width: ${minDocWidth}px)`]: {
|
|
80
|
+
html: {
|
|
81
|
+
fontSize: `${(100 * minDocWidth) / designWidth}px`,
|
|
82
|
+
},
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
] }),
|
|
88
|
-
children));
|
|
85
|
+
globalStyle,
|
|
86
|
+
] }), children] }));
|
|
89
87
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { CountdownOption } from "../utils/Countdown";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
3
|
+
import { CountdownOption } from '../utils/Countdown';
|
|
5
4
|
export interface CountdownerOption extends CountdownOption, React.HTMLProps<HTMLDivElement> {
|
|
6
5
|
seperator?: React.ReactNode;
|
|
7
6
|
seperatorStyle?: Interpolation<Theme>;
|
|
@@ -10,4 +9,4 @@ export interface CountdownerOption extends CountdownOption, React.HTMLProps<HTML
|
|
|
10
9
|
renderNumber?: (value: number, key?: string) => React.ReactNode;
|
|
11
10
|
renderSeperator?: (value: number, key?: string) => React.ReactNode;
|
|
12
11
|
}
|
|
13
|
-
export declare function Countdowner(props: CountdownerOption): jsx.JSX.Element;
|
|
12
|
+
export declare function Countdowner(props: CountdownerOption): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -9,39 +9,38 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
import React, { useEffect, useState } from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { RowStart } from "../Flex/Row";
|
|
12
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
+
import React, { useEffect, useState } from 'react';
|
|
14
|
+
import { Countdown, } from '../utils/Countdown';
|
|
15
|
+
import { RowStart } from '../Flex/Row';
|
|
17
16
|
export function Countdowner(props) {
|
|
18
|
-
let { remain = 0, seperator =
|
|
17
|
+
let { remain = 0, seperator = ':', format = 'his', onUpdate, onEnd, seperatorStyle, containerStyle, numberStyle, renderNumber, renderSeperator } = props, extra = __rest(props, ["remain", "seperator", "format", "onUpdate", "onEnd", "seperatorStyle", "containerStyle", "numberStyle", "renderNumber", "renderSeperator"]);
|
|
19
18
|
const [value, setValue] = useState(null);
|
|
20
19
|
let content = [];
|
|
21
|
-
if (value && typeof value ===
|
|
20
|
+
if (value && typeof value === 'object') {
|
|
22
21
|
for (let i = 0; i < format.length; i++) {
|
|
23
22
|
// 渲染数字进组件
|
|
24
23
|
const key = format[i];
|
|
25
24
|
const num = value[key];
|
|
26
25
|
let numberComponent;
|
|
27
|
-
if (typeof renderNumber ===
|
|
26
|
+
if (typeof renderNumber === 'function') {
|
|
28
27
|
numberComponent = renderNumber(num, key);
|
|
29
28
|
}
|
|
30
29
|
else {
|
|
31
30
|
// 默认以span包围,且数字不足10的时候有前置0
|
|
32
|
-
numberComponent = (
|
|
31
|
+
numberComponent = (_jsx("span", Object.assign({ css: numberStyle }, { children: num < 10 ? `0${num}` : num })));
|
|
33
32
|
}
|
|
34
|
-
content.push(
|
|
33
|
+
content.push(_jsx(React.Fragment, { children: numberComponent }, i));
|
|
35
34
|
// 添加分隔符,最后一个数字不需要分隔符
|
|
36
35
|
if (i !== format.length - 1) {
|
|
37
36
|
let seperatorComponent;
|
|
38
|
-
if (typeof renderSeperator ===
|
|
37
|
+
if (typeof renderSeperator === 'function') {
|
|
39
38
|
seperatorComponent = renderSeperator(num, key);
|
|
40
39
|
}
|
|
41
40
|
else {
|
|
42
|
-
seperatorComponent = seperator ? (
|
|
41
|
+
seperatorComponent = seperator ? (_jsx("span", Object.assign({ css: seperatorStyle }, { children: seperator }))) : null;
|
|
43
42
|
}
|
|
44
|
-
content.push(
|
|
43
|
+
content.push(_jsx(React.Fragment, { children: seperatorComponent }, `s${i}`));
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -64,5 +63,5 @@ export function Countdowner(props) {
|
|
|
64
63
|
instance = null;
|
|
65
64
|
};
|
|
66
65
|
}, [format, remain]);
|
|
67
|
-
return (
|
|
66
|
+
return (_jsx(RowStart, Object.assign({}, extra, { css: containerStyle }, { children: content })));
|
|
68
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { Theme, Interpolation } from "@emotion/react";
|
|
4
4
|
import { DialogType, AnimationStatus } from "./style";
|
|
5
5
|
export interface WrapperProps {
|
|
6
6
|
type?: DialogType;
|
|
@@ -13,4 +13,4 @@ export interface WrapperProps {
|
|
|
13
13
|
boxStyle?: Interpolation<Theme>;
|
|
14
14
|
maskStyle?: Interpolation<Theme>;
|
|
15
15
|
}
|
|
16
|
-
export declare function Wrapper(props: WrapperProps): jsx.JSX.Element;
|
|
16
|
+
export declare function Wrapper(props: WrapperProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
package/build/Dialog/Wrapper.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from "@emotion/react";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
3
2
|
import { Overlay } from "../Overlay";
|
|
4
3
|
import { style, getAnimation } from "./style";
|
|
5
4
|
export function Wrapper(props) {
|
|
@@ -27,11 +26,9 @@ export function Wrapper(props) {
|
|
|
27
26
|
onBlankClick === null || onBlankClick === void 0 ? void 0 : onBlankClick(event);
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
} }, children)));
|
|
29
|
+
return (_jsxs(Overlay, Object.assign({ css: { overflow: "hidden" }, centerContent: type === "center", maskColor: "transparent", fullScreen: true, onClick: showMask ? undefined : blankClick }, { children: [showMask && _jsx("div", { css: maskCss, onClick: blankClick }), _jsx("div", Object.assign({ css: [boxCss, boxStyle, animation], onAnimationEnd: (event) => {
|
|
30
|
+
if (status === "hide" && event.animationName === keyframes.name) {
|
|
31
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
32
|
+
}
|
|
33
|
+
} }, { children: children }))] })));
|
|
37
34
|
}
|
package/build/Dialog/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DialogType } from
|
|
3
|
-
import { WrapperProps } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DialogType } from './style';
|
|
3
|
+
import { WrapperProps } from './Wrapper';
|
|
4
4
|
export interface ShowDialogOption extends WrapperProps {
|
|
5
5
|
blankClosable?: boolean;
|
|
6
6
|
content?: React.ReactNode;
|