clxx 2.0.6 → 2.0.8
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/README.md +0 -1
- package/build/Clickable/index.d.ts +1 -1
- package/build/Clickable/index.js +14 -9
- package/build/Dialog/style.d.ts +2 -2
- package/build/Flex/index.d.ts +1 -1
- package/build/Flex/index.js +2 -2
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/utils/Countdown.d.ts +3 -3
- package/build/utils/ago.d.ts +1 -1
- package/build/utils/createApp.d.ts +3 -3
- package/build/utils/createApp.js +3 -3
- package/build/utils/request.d.ts +4 -4
- package/package.json +7 -9
package/README.md
CHANGED
package/build/Clickable/index.js
CHANGED
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
-
import { useCallback, useRef, useState, useEffect, } from
|
|
14
|
-
import { is } from
|
|
13
|
+
import { useCallback, useRef, useState, useEffect, } from 'react';
|
|
14
|
+
import { is } from '../utils/is';
|
|
15
15
|
export function Clickable(props) {
|
|
16
16
|
let { children, bubble = true, className, activeClassName, style, activeStyle, disable = false } = props, attrs = __rest(props, ["children", "bubble", "className", "activeClassName", "style", "activeStyle", "disable"]);
|
|
17
17
|
// 如果激活样式和激活类都不存在,则设置激活默认样式
|
|
@@ -20,9 +20,14 @@ export function Clickable(props) {
|
|
|
20
20
|
opacity: 0.6,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const touchable = is(
|
|
23
|
+
const touchable = is('touchable');
|
|
24
24
|
const [boxClass, setBoxClass] = useState(className);
|
|
25
25
|
const [boxStyle, setBoxStyle] = useState(style);
|
|
26
|
+
// 监控属性的更新
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setBoxClass(className);
|
|
29
|
+
setBoxStyle(style);
|
|
30
|
+
}, [className, style]);
|
|
26
31
|
// 标记是否正处于触摸状态
|
|
27
32
|
const touchRef = useRef(false);
|
|
28
33
|
const onStart = (event) => {
|
|
@@ -33,13 +38,13 @@ export function Clickable(props) {
|
|
|
33
38
|
event.stopPropagation();
|
|
34
39
|
}
|
|
35
40
|
// 激活目标样式
|
|
36
|
-
if (typeof activeClassName ===
|
|
37
|
-
setBoxClass(typeof boxClass ===
|
|
41
|
+
if (typeof activeClassName === 'string') {
|
|
42
|
+
setBoxClass(typeof boxClass === 'string'
|
|
38
43
|
? `${boxClass} ${activeClassName}`
|
|
39
44
|
: activeClassName);
|
|
40
45
|
}
|
|
41
|
-
if (typeof activeStyle ===
|
|
42
|
-
setBoxStyle(typeof boxStyle ===
|
|
46
|
+
if (typeof activeStyle === 'object') {
|
|
47
|
+
setBoxStyle(typeof boxStyle === 'object'
|
|
43
48
|
? Object.assign(Object.assign({}, boxStyle), activeStyle) : activeStyle);
|
|
44
49
|
}
|
|
45
50
|
}
|
|
@@ -56,9 +61,9 @@ export function Clickable(props) {
|
|
|
56
61
|
useEffect(() => {
|
|
57
62
|
if (!disable && !touchable) {
|
|
58
63
|
const doc = document.documentElement;
|
|
59
|
-
doc.addEventListener(
|
|
64
|
+
doc.addEventListener('mouseup', onEnd);
|
|
60
65
|
return () => {
|
|
61
|
-
doc.removeEventListener(
|
|
66
|
+
doc.removeEventListener('mouseup', onEnd);
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
69
|
}, [disable, touchable, onEnd]);
|
package/build/Dialog/style.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Keyframes } from "@emotion/serialize";
|
|
2
2
|
export declare const maskHide: Keyframes;
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type DialogType = "center" | "pullUp" | "pullDown" | "pullLeft" | "pullRight";
|
|
4
|
+
export type AnimationStatus = "show" | "hide";
|
|
5
5
|
export declare function getAnimation(type: DialogType, status: AnimationStatus): {
|
|
6
6
|
keyframes: Keyframes;
|
|
7
7
|
animation: import("@emotion/utils").SerializedStyles;
|
package/build/Flex/index.d.ts
CHANGED
package/build/Flex/index.js
CHANGED
|
@@ -11,9 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
13
|
export function Flex(props) {
|
|
14
|
-
const { children, alignItems =
|
|
14
|
+
const { children, alignItems = 'center', alignContent, justifyContent, flexFlow, flexWrap, flexDirection } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection"]);
|
|
15
15
|
return (_jsx("div", Object.assign({ css: {
|
|
16
|
-
display:
|
|
16
|
+
display: 'flex',
|
|
17
17
|
alignItems,
|
|
18
18
|
alignContent,
|
|
19
19
|
justifyContent,
|
package/build/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { setContextValue, getContextValue } from "./context";
|
|
|
3
3
|
export { jsonp } from "./utils/jsonp";
|
|
4
4
|
export { uniqKey } from "./utils/uniqKey";
|
|
5
5
|
export { ago } from "./utils/ago";
|
|
6
|
-
export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption } from "./utils/request";
|
|
6
|
+
export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption, registerHostAlias } from "./utils/request";
|
|
7
7
|
export { calendarTable } from "./utils/calendarTable";
|
|
8
8
|
export { Countdown } from "./utils/Countdown";
|
|
9
9
|
export { defaultScroll } from "./utils/defaultScroll";
|
package/build/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { setContextValue, getContextValue } from "./context";
|
|
|
3
3
|
export { jsonp } from "./utils/jsonp";
|
|
4
4
|
export { uniqKey } from "./utils/uniqKey";
|
|
5
5
|
export { ago } from "./utils/ago";
|
|
6
|
-
export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption } from "./utils/request";
|
|
6
|
+
export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption, registerHostAlias } from "./utils/request";
|
|
7
7
|
export { calendarTable } from "./utils/calendarTable";
|
|
8
8
|
export { Countdown } from "./utils/Countdown";
|
|
9
9
|
export { defaultScroll } from "./utils/defaultScroll";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type CountdownValueIndex = "d" | "h" | "i" | "s";
|
|
2
|
+
export type CountdownValue = {
|
|
3
3
|
[key in CountdownValueIndex]?: number;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type UpdateCallback = (value: CountdownValue) => void;
|
|
6
6
|
export interface CountdownOption {
|
|
7
7
|
remain?: number | string;
|
|
8
8
|
onUpdate?: UpdateCallback;
|
package/build/utils/ago.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { History } from 'history';
|
|
3
3
|
import { ContainerProps } from '../Container';
|
|
4
4
|
import { ContextValue } from '../context';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type RouteMethod = 'browser' | 'hash' | 'memory';
|
|
6
|
+
export type AwaitValue<T> = T | Promise<T>;
|
|
7
7
|
export interface CreateAppOption extends Omit<ContainerProps, 'children'>, ContextValue {
|
|
8
8
|
onBeforeRenderPage?: (pathname?: string) => AwaitValue<void>;
|
|
9
9
|
onAfterRenderPage?: (pathname?: string) => AwaitValue<void>;
|
|
10
|
-
|
|
10
|
+
onLoadingPage?: (pathname?: string) => AwaitValue<React.ReactNode>;
|
|
11
11
|
renderPage?: (pathname?: string) => AwaitValue<React.ReactNode>;
|
|
12
12
|
routeMethod?: RouteMethod;
|
|
13
13
|
defaultRoute?: string;
|
package/build/utils/createApp.js
CHANGED
|
@@ -51,7 +51,7 @@ export function createApp(option) {
|
|
|
51
51
|
'designWidth',
|
|
52
52
|
'globalStyle',
|
|
53
53
|
]);
|
|
54
|
-
const { onBeforeRenderPage, onAfterRenderPage,
|
|
54
|
+
const { onBeforeRenderPage, onAfterRenderPage, onLoadingPage, renderPage } = option;
|
|
55
55
|
// 设置上下文属性
|
|
56
56
|
setContextValue(context);
|
|
57
57
|
/**
|
|
@@ -70,8 +70,8 @@ export function createApp(option) {
|
|
|
70
70
|
pathname = option.defaultRoute.replace(pathReg, '');
|
|
71
71
|
}
|
|
72
72
|
// 如果有loading,要先显示loading
|
|
73
|
-
if (typeof
|
|
74
|
-
setPage(yield (
|
|
73
|
+
if (typeof onLoadingPage === 'function') {
|
|
74
|
+
setPage(yield (onLoadingPage === null || onLoadingPage === void 0 ? void 0 : onLoadingPage(pathname)));
|
|
75
75
|
}
|
|
76
76
|
// 加载页面之前可能会存在的逻辑
|
|
77
77
|
yield (onBeforeRenderPage === null || onBeforeRenderPage === void 0 ? void 0 : onBeforeRenderPage(pathname));
|
package/build/utils/request.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* params: 请求体为URLSearchParams,data为JSON对象或URLSearchParams
|
|
8
8
|
* buffer: 请求体data只能为ArrayBuffer、TypeArray、DataView
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type SendType = "normal" | "text" | "form" | "json" | "blob" | "params" | "buffer";
|
|
11
|
+
export type SendDataType = BodyInit | Record<string, any>;
|
|
12
12
|
/**
|
|
13
13
|
* 请求对象参数
|
|
14
14
|
*/
|
|
@@ -20,8 +20,8 @@ export interface RequestOption extends RequestInit {
|
|
|
20
20
|
transmitPageParam?: boolean;
|
|
21
21
|
timeout?: number;
|
|
22
22
|
}
|
|
23
|
-
export
|
|
24
|
-
export
|
|
23
|
+
export type BuildUrlOption = Pick<RequestOption, "url" | "data" | "disableUrlCache" | "transmitPageParam" | "sendType">;
|
|
24
|
+
export type StandardAjaxResult = {
|
|
25
25
|
code: number;
|
|
26
26
|
message?: string;
|
|
27
27
|
data?: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clxx",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Basic JS library for mobile devices",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"module": "./build/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"start": "tsc -w --pretty",
|
|
12
|
-
"build": "
|
|
12
|
+
"build": "rm -rfv ./build && tsc"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -33,20 +33,18 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@emotion/react": "^11.10.
|
|
36
|
+
"@emotion/react": "^11.10.6",
|
|
37
37
|
"dayjs": "^1.11.5",
|
|
38
38
|
"history": "^5.3.0",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
|
-
"react-dom": "^18.2.0"
|
|
42
|
-
"swiper": "^8.3.2"
|
|
41
|
+
"react-dom": "^18.2.0"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@types/lodash": "^4.14.182",
|
|
46
|
-
"@types/react": "^18.0.
|
|
47
|
-
"@types/react-dom": "^18.0.
|
|
48
|
-
"@types/swiper": "^6.0.0",
|
|
45
|
+
"@types/react": "^18.0.37",
|
|
46
|
+
"@types/react-dom": "^18.0.11",
|
|
49
47
|
"csstype": "^3.1.0",
|
|
50
|
-
"typescript": "^4.
|
|
48
|
+
"typescript": "^4.9.5"
|
|
51
49
|
}
|
|
52
50
|
}
|