taro-react-uilib 1.0.2 → 1.0.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/dist/index.esm.js +2599 -41
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2604 -39
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2606 -42
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/components/alert.scss +4 -0
- package/dist/styles/components/bankicon.scss +4 -0
- package/dist/styles/components/button.scss +4 -6
- package/dist/styles/components/captcha.scss +2 -3
- package/dist/styles/components/confirm.scss +11 -0
- package/dist/styles/components/dialogcomponent.scss +191 -0
- package/dist/styles/components/dialogref.scss +214 -0
- package/dist/styles/components/{formInput.scss → forminput.scss} +8 -8
- package/dist/styles/components/index.scss +13 -4
- package/dist/styles/components/key.scss +27 -0
- package/dist/styles/components/loading.scss +1 -4
- package/dist/styles/components/mask.scss +2 -2
- package/dist/styles/components/numberkeyboard.scss +72 -0
- package/dist/styles/components/page.scss +17 -1
- package/dist/styles/components/passwordinput.scss +42 -0
- package/dist/styles/components/progress.scss +30 -0
- package/dist/styles/components/toast.scss +83 -0
- package/dist/styles/themes/base.scss +1 -1
- package/dist/styles/themes/default.scss +6 -0
- package/dist/styles/themes/variable.scss +25 -0
- package/lib/components/BankIcon/index.js +7 -7
- package/lib/components/BankIcon/index.js.map +1 -1
- package/lib/components/Button/index.js +22 -22
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Dialog/Alert/index.js +16 -15
- package/lib/components/Dialog/Alert/index.js.map +1 -1
- package/lib/components/Dialog/Confirm/index.js +43 -0
- package/lib/components/Dialog/Confirm/index.js.map +1 -0
- package/lib/components/Dialog/{Dialog → DialogComponent}/index.js +10 -10
- package/lib/components/Dialog/DialogComponent/index.js.map +1 -0
- package/lib/components/Dialog/index.js +3 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/DialogRef/index.js +55 -0
- package/lib/components/DialogRef/index.js.map +1 -0
- package/lib/components/FormInput/index.js +16 -16
- package/lib/components/FormInput/index.js.map +1 -1
- package/lib/components/Image/index.js +12 -6
- package/lib/components/Image/index.js.map +1 -1
- package/lib/components/NumberKeyboard/Key/index.js +9 -0
- package/lib/components/NumberKeyboard/Key/index.js.map +1 -0
- package/lib/components/NumberKeyboard/index.js +56 -0
- package/lib/components/NumberKeyboard/index.js.map +1 -0
- package/lib/components/PasswordInput/index.js +24 -0
- package/lib/components/PasswordInput/index.js.map +1 -0
- package/lib/components/Progress/index.js +20 -0
- package/lib/components/Progress/index.js.map +1 -0
- package/lib/components/Toast/Toast.js +37 -0
- package/lib/components/Toast/Toast.js.map +1 -0
- package/lib/components/Toast/index.js +48 -0
- package/lib/components/Toast/index.js.map +1 -0
- package/lib/index.js +15 -9
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
- package/types/components/BankIcon/index.d.ts +5 -5
- package/types/components/Button/index.d.ts +17 -17
- package/types/components/Dialog/Alert/index.d.ts +18 -2
- package/types/components/Dialog/Confirm/index.d.ts +37 -0
- package/types/components/Dialog/DialogComponent/index.d.ts +19 -0
- package/types/components/Dialog/index.d.ts +3 -1
- package/types/components/DialogRef/index.d.ts +30 -0
- package/types/components/NumberKeyboard/Key/index.d.ts +8 -0
- package/types/components/NumberKeyboard/index.d.ts +23 -0
- package/types/components/PasswordInput/index.d.ts +11 -0
- package/types/components/Progress/index.d.ts +12 -0
- package/types/components/Toast/Toast.d.ts +20 -0
- package/types/components/Toast/index.d.ts +5 -0
- package/types/index.d.ts +15 -9
- package/dist/styles/components/backIcon.scss +0 -10
- package/dist/styles/components/images/loading.png +0 -0
- package/lib/components/Dialog/Dialog/index.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Button from "../../Button";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
const Key = (props) => {
|
|
5
|
+
const { children, onClick } = props;
|
|
6
|
+
return (React.createElement(Button, { shape: "square", className: "number-keyboard-key", type: "default", onClick: onClick }, children));
|
|
7
|
+
};
|
|
8
|
+
export default Key;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/NumberKeyboard/Key/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AACrD,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,cAAc,CAAC;AAOtB,MAAM,GAAG,GAAiB,CAAC,KAAK,EAAE,EAAE;IAClC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAEpC,OAAO,CACL,oBAAC,MAAM,IACL,KAAK,EAAC,QAAQ,EACd,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAC,SAAS,EACd,OAAO,EAAE,OAAO,IAEf,QAAQ,CACF,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { CSSTransition } from "react-transition-group";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
import "./index.scss";
|
|
6
|
+
import Key from "./Key";
|
|
7
|
+
const NumberKeyboard = (props) => {
|
|
8
|
+
const { onBlur, show, maxLength = Number.MAX_SAFE_INTEGER, showClose = true, closeOnClickSpace = true, onClose, onChange, value, className, } = props;
|
|
9
|
+
const [input, setInput] = useState(value);
|
|
10
|
+
const keys = getKeys();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (closeOnClickSpace) {
|
|
13
|
+
document.addEventListener("click", handleClose);
|
|
14
|
+
}
|
|
15
|
+
return () => {
|
|
16
|
+
document.removeEventListener("click", handleClose);
|
|
17
|
+
};
|
|
18
|
+
}, []);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setInput(value);
|
|
21
|
+
}, [value]);
|
|
22
|
+
function handleClose(e) {
|
|
23
|
+
onClose && onClose(e);
|
|
24
|
+
onBlur && onBlur(e);
|
|
25
|
+
}
|
|
26
|
+
function handleKeyPress({ type, value }) {
|
|
27
|
+
if (type === "none")
|
|
28
|
+
return;
|
|
29
|
+
let newInput = input;
|
|
30
|
+
if (type === "delete") {
|
|
31
|
+
newInput = input.slice(0, input.length - 1);
|
|
32
|
+
}
|
|
33
|
+
else if (newInput.length < maxLength) {
|
|
34
|
+
newInput = input + value;
|
|
35
|
+
}
|
|
36
|
+
setInput(newInput);
|
|
37
|
+
onChange && onChange(newInput);
|
|
38
|
+
}
|
|
39
|
+
function getKeys() {
|
|
40
|
+
const keys = [];
|
|
41
|
+
for (let i = 1; i <= 9; i++) {
|
|
42
|
+
keys.push({ text: i, value: i, type: "number" });
|
|
43
|
+
}
|
|
44
|
+
keys.push({ text: "", value: "", type: "none" }, { text: 0, value: 0, type: "number" }, { text: "delete", value: "", type: "delete" });
|
|
45
|
+
return keys;
|
|
46
|
+
}
|
|
47
|
+
const keyboardcls = classNames("xh-number-keyboard", className);
|
|
48
|
+
return (React.createElement(CSSTransition, { classNames: "slide-up", in: show, unmountOnExit: true, timeout: 200 },
|
|
49
|
+
React.createElement(View, { className: keyboardcls },
|
|
50
|
+
React.createElement(View, { className: "xh-number-keyboard-header" }, showClose && (React.createElement(View, { className: "xh-number-keyboard-close", onClick: handleClose }, "\u5B8C\u6210"))),
|
|
51
|
+
React.createElement(View, { className: "xh-number-keyboard-body" }, keys.map((key, index) => (React.createElement(Key, { key: index, className: classNames({
|
|
52
|
+
"xh-number-keyboard-key-gray": key.type !== "number",
|
|
53
|
+
}), onClick: () => handleKeyPress(key) }, key.type === "delete" ? (React.createElement(View, { className: "xh-number-keyboard-delete" })) : (React.createElement(View, null, key.text)))))))));
|
|
54
|
+
};
|
|
55
|
+
export default NumberKeyboard;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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,QAAC,OAAO,EAAE,GAAG;QACvE,oBAAC,IAAI,IAAC,SAAS,EAAE,WAAW;YAC1B,oBAAC,IAAI,IAAC,SAAS,EAAC,2BAA2B,IACxC,SAAS,IAAI,CACZ,oBAAC,IAAI,IAAC,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAE,WAAW,mBAExD,CACR,CACI;YACP,oBAAC,IAAI,IAAC,SAAS,EAAC,yBAAyB,IACtC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACxB,oBAAC,GAAG,IACF,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,UAAU,CAAC;oBACpB,6BAA6B,EAAE,GAAG,CAAC,IAAI,KAAK,QAAQ;iBACrD,CAAC,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAEjC,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACvB,oBAAC,IAAI,IAAC,SAAS,EAAC,2BAA2B,GAAG,CAC/C,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,QAAE,GAAG,CAAC,IAAI,CAAQ,CACxB,CACG,CACP,CAAC,CACG,CACF,CACO,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { View } from "@tarojs/components";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
const PasswordInput = (props) => {
|
|
6
|
+
const { value, length, mask = true, onFocus, className } = props;
|
|
7
|
+
function renderInputs() {
|
|
8
|
+
const Inputs = [];
|
|
9
|
+
for (let i = 0; i < length; i++) {
|
|
10
|
+
const char = value[i];
|
|
11
|
+
Inputs.push(React.createElement(View, { key: i, className: "xh-password-input-item" }, mask ? (React.createElement(View, { className: classNames({ "xh-password-input-mask": char }) })) : (char)));
|
|
12
|
+
}
|
|
13
|
+
return Inputs;
|
|
14
|
+
}
|
|
15
|
+
function handlerClick(e) {
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
onFocus && onFocus(e);
|
|
18
|
+
}
|
|
19
|
+
const xhpasswordcls = classNames("xh-password-input", className);
|
|
20
|
+
return (React.createElement(View, { className: xhpasswordcls },
|
|
21
|
+
React.createElement(View, { className: "xh-password-input-list", onClick: handlerClick }, renderInputs())));
|
|
22
|
+
};
|
|
23
|
+
export default PasswordInput;
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PasswordInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAe,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,cAAc,CAAC;AAStB,MAAM,aAAa,GAA2B,CAAC,KAAK,EAAE,EAAE;IACtD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAEjE,SAAS,YAAY;QACnB,MAAM,MAAM,GAAQ,EAAE,CAAC;QAEvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEtB,MAAM,CAAC,IAAI,CACT,oBAAC,IAAI,IAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAC,wBAAwB,IAC7C,IAAI,CAAC,CAAC,CAAC,CACN,oBAAC,IAAI,IAAC,SAAS,EAAE,UAAU,CAAC,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC,GAAI,CACpE,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CACI,CACR,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,SAAS,YAAY,CAAC,CAAc;QAClC,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,MAAM,aAAa,GAAG,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAEjE,OAAO,CACL,oBAAC,IAAI,IAAC,SAAS,EAAE,aAAa;QAC5B,oBAAC,IAAI,IAAC,SAAS,EAAC,wBAAwB,EAAC,OAAO,EAAE,YAAY,IAC3D,YAAY,EAAE,CACV,CACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { View } from "@tarojs/components";
|
|
4
|
+
import { pxTransform } from "@tarojs/taro";
|
|
5
|
+
import "./index.scss";
|
|
6
|
+
const Progress = (props) => {
|
|
7
|
+
const { percent = 88, className, showPercent = false, doneColor = "", percentColor = "", height, } = props;
|
|
8
|
+
const progresslcs = classNames("xh-progress", className);
|
|
9
|
+
const showPercentcls = classNames("progress-bar");
|
|
10
|
+
const showbarPercentcls = classNames("progress-bar-percent");
|
|
11
|
+
return (React.createElement(View, { className: progresslcs },
|
|
12
|
+
React.createElement(View, { className: "progress", style: { height: height && `${pxTransform(height)}` } },
|
|
13
|
+
React.createElement(View, { style: {
|
|
14
|
+
width: `${percent}%`,
|
|
15
|
+
backgroundColor: doneColor,
|
|
16
|
+
color: percentColor,
|
|
17
|
+
}, className: showPercentcls }, showPercent && (React.createElement(View, { className: showbarPercentcls }, `${percent}%`))))));
|
|
18
|
+
};
|
|
19
|
+
export default Progress;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Progress/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,cAAc,CAAC;AAUtB,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IAClD,MAAM,EACJ,OAAO,GAAG,EAAE,EACZ,SAAS,EACT,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,EAAE,EACd,YAAY,GAAG,EAAE,EACjB,MAAM,GACP,GAAG,KAAK,CAAC;IACV,MAAM,WAAW,GAAG,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAEzD,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAC7D,OAAO,CACL,oBAAC,IAAI,IAAC,SAAS,EAAE,WAAW;QAC1B,oBAAC,IAAI,IACH,SAAS,EAAC,UAAU,EACpB,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE;YAErD,oBAAC,IAAI,IACH,KAAK,EAAE;oBACL,KAAK,EAAE,GAAG,OAAO,GAAG;oBACpB,eAAe,EAAE,SAAS;oBAC1B,KAAK,EAAE,YAAY;iBACpB,EACD,SAAS,EAAE,cAAc,IAExB,WAAW,IAAI,CACd,oBAAC,IAAI,IAAC,SAAS,EAAE,iBAAiB,IAAG,GAAG,OAAO,GAAG,CAAQ,CAC3D,CACI,CACF,CACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { View } from "@tarojs/components";
|
|
5
|
+
import { CSSTransition } from "react-transition-group";
|
|
6
|
+
import Mask from "../Mask";
|
|
7
|
+
import Image from "../Image";
|
|
8
|
+
import "./index.scss";
|
|
9
|
+
const ToastCom = (props) => {
|
|
10
|
+
const { title, className = "", icon = "success", image = "" } = props;
|
|
11
|
+
const toastcls = classNames("xh-toast", className);
|
|
12
|
+
// icon-success_toast
|
|
13
|
+
// icon-alert_toast
|
|
14
|
+
// icon-failure_toast
|
|
15
|
+
// icon-loading_toast
|
|
16
|
+
const classConfig = {
|
|
17
|
+
success: "icon-success_toast",
|
|
18
|
+
error: "icon-failure_toast",
|
|
19
|
+
loading: "icon-loading_toast",
|
|
20
|
+
};
|
|
21
|
+
const cls = classNames("iconfont", classConfig[icon]);
|
|
22
|
+
const showIcon = useMemo(() => {
|
|
23
|
+
if (image)
|
|
24
|
+
return React.createElement(Image, { src: image, width: 24, height: 24 });
|
|
25
|
+
if (icon)
|
|
26
|
+
return React.createElement("span", { className: cls });
|
|
27
|
+
}, [icon, image]);
|
|
28
|
+
const DialogMain = (React.createElement(View, { className: toastcls },
|
|
29
|
+
React.createElement(Mask, { mask: "transparent" }),
|
|
30
|
+
React.createElement(CSSTransition, { in: true, timeout: 200, classNames: "face", unmountOnExit: true },
|
|
31
|
+
React.createElement(View, { className: "xh-toast-content" },
|
|
32
|
+
showIcon,
|
|
33
|
+
React.createElement(View, null, title)))));
|
|
34
|
+
return ReactDOM.createPortal(DialogMain, document.body);
|
|
35
|
+
};
|
|
36
|
+
export default ToastCom;
|
|
37
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAA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,EAAC,kBAAkB;gBAC/B,QAAQ;gBACT,oBAAC,IAAI,QAAE,KAAK,CAAQ,CACf,CACO,CACX,CACR,CAAC;IAEF,OAAO,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import ReactDOM from "react-dom";
|
|
14
|
+
import { showToast } from "@tarojs/taro";
|
|
15
|
+
import ToastComponent from "./Toast";
|
|
16
|
+
import "./index.scss";
|
|
17
|
+
async function Toast(arg, ...rest) {
|
|
18
|
+
let defalutParam = {
|
|
19
|
+
title: "",
|
|
20
|
+
duration: 3000,
|
|
21
|
+
mask: true,
|
|
22
|
+
};
|
|
23
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
24
|
+
defalutParam.title = `${arg}`;
|
|
25
|
+
if (rest.length) {
|
|
26
|
+
defalutParam.duration = rest[0];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
defalutParam = Object.assign(Object.assign({}, defalutParam), arg);
|
|
31
|
+
}
|
|
32
|
+
return new Promise(() => {
|
|
33
|
+
if (process.env.TARO_ENV === "h5") {
|
|
34
|
+
const div = document.createElement("div");
|
|
35
|
+
const timer = setTimeout(() => {
|
|
36
|
+
// ReactDOM.unmountComponentAtNode(div);
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
}, defalutParam.duration);
|
|
39
|
+
const { title } = defalutParam, other = __rest(defalutParam, ["title"]);
|
|
40
|
+
ReactDOM.render(React.createElement(ToastComponent, Object.assign({ title: title }, other)), div);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
showToast(Object.assign({ icon: "none" }, defalutParam));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export default Toast;
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,cAA8B,MAAM,SAAS,CAAC;AACrD,OAAO,cAAc,CAAC;AAOtB,KAAK,UAAU,KAAK,CAClB,GAAiC,EACjC,GAAG,IAAI;IAEP,IAAI,YAAY,GAAG;QACjB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,IAAI;KACX,CAAC;IACF,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACtD,YAAY,CAAC,KAAK,GAAG,GAAG,GAAG,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,YAAY,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;SACjC;KACF;SAAM;QACL,YAAY,mCACP,YAAY,GACZ,GAAG,CACP,CAAC;KACH;IACD,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;QACtB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,EAAE;YACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAE1C,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,wCAAwC;gBACxC,YAAY,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC1B,MAAM,EAAE,KAAK,KAAe,YAAY,EAAtB,KAAK,UAAK,YAAY,EAAlC,SAAmB,CAAe,CAAC;YACzC,QAAQ,CAAC,MAAM,CAAC,oBAAC,cAAc,kBAAC,KAAK,EAAE,KAAK,IAAM,KAAK,EAAI,EAAE,GAAG,CAAC,CAAC;SACnE;aAAM;YACL,SAAS,iBACP,IAAI,EAAE,MAAM,IACT,YAAY,EACf,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,eAAe,KAAK,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
export { default as XHButton } from
|
|
2
|
-
export { default as XHPage } from
|
|
3
|
-
export { default as XHLoading } from
|
|
4
|
-
export { default as XHBankIcon } from
|
|
5
|
-
export { default as XHCaptcha } from
|
|
6
|
-
export { default as XHFormInput } from
|
|
7
|
-
export { default as XHList } from
|
|
8
|
-
export { default as XHMask } from
|
|
9
|
-
export { default as XHImage } from
|
|
1
|
+
export { default as XHButton } from "./components/Button";
|
|
2
|
+
export { default as XHPage } from "./components/Page";
|
|
3
|
+
export { default as XHLoading } from "./components/Loading";
|
|
4
|
+
export { default as XHBankIcon } from "./components/BankIcon";
|
|
5
|
+
export { default as XHCaptcha } from "./components/Captcha";
|
|
6
|
+
export { default as XHFormInput } from "./components/FormInput";
|
|
7
|
+
export { default as XHList } from "./components/List";
|
|
8
|
+
export { default as XHMask } from "./components/Mask";
|
|
9
|
+
export { default as XHImage } from "./components/Image";
|
|
10
|
+
export { default as XHDialog } from "./components/Dialog";
|
|
11
|
+
export { default as XHNumberKeyboard } from "./components/NumberKeyboard";
|
|
12
|
+
export { default as XHPasswordInput } from "./components/PasswordInput";
|
|
13
|
+
export { default as XHProgress } from "./components/Progress";
|
|
14
|
+
export { default as XHToast } from "./components/Toast";
|
|
15
|
+
export { default as XHDialogRef } from "./components/DialogRef";
|
|
10
16
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taro-react-uilib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "基于taro的跨端组件库",
|
|
5
5
|
"templateInfo": {
|
|
6
6
|
"name": "default",
|
|
@@ -112,7 +112,8 @@
|
|
|
112
112
|
"stylelint-config-standard": "20.0.0",
|
|
113
113
|
"stylelint-scss": "3.17.2",
|
|
114
114
|
"ts-jest": "26",
|
|
115
|
-
"typescript": "^4.1.0"
|
|
115
|
+
"typescript": "^4.1.0",
|
|
116
|
+
"@tarojs/plugin-html": "^3.4.13"
|
|
116
117
|
},
|
|
117
118
|
"peerDependencies": {
|
|
118
119
|
"@tarojs/components": "^3.0.8",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import bankImage from
|
|
3
|
-
import { XHComponentCommonProps } from
|
|
4
|
-
import
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import bankImage from "./bank";
|
|
3
|
+
import { XHComponentCommonProps } from "../../types";
|
|
4
|
+
import "./index.scss";
|
|
5
5
|
export declare type BankIconCode = keyof typeof bankImage;
|
|
6
6
|
export declare type XHListProps = {
|
|
7
7
|
code: BankIconCode;
|
|
8
|
-
size?:
|
|
8
|
+
size?: number;
|
|
9
9
|
} & XHComponentCommonProps;
|
|
10
10
|
declare const XHBankIcon: FC<XHListProps>;
|
|
11
11
|
export default XHBankIcon;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import { ButtonProps } from
|
|
3
|
-
import { ITouchEvent } from
|
|
4
|
-
import
|
|
5
|
-
export declare type ButtonType =
|
|
6
|
-
export declare type ButtonShape =
|
|
7
|
-
export declare type ButtonSize =
|
|
8
|
-
export declare type WechatOpenType =
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ButtonProps } from "@tarojs/components/types/Button";
|
|
3
|
+
import { ITouchEvent } from "@tarojs/components/types/common";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
export declare type ButtonType = "default" | "secondary" | "primary" | "warn";
|
|
6
|
+
export declare type ButtonShape = "square" | "round";
|
|
7
|
+
export declare type ButtonSize = "default" | "mini" | "full";
|
|
8
|
+
export declare type WechatOpenType = "contact"
|
|
9
9
|
/** 触发用户转发,使用前建议先阅读使用指引
|
|
10
10
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95
|
|
11
11
|
*/
|
|
12
|
-
|
|
|
12
|
+
| "share"
|
|
13
13
|
/** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息
|
|
14
14
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
|
|
15
15
|
*/
|
|
16
|
-
|
|
|
16
|
+
| "getPhoneNumber"
|
|
17
17
|
/** 获取用户信息,可以从 bindgetuserinfo 回调中获取到用户信息 */
|
|
18
|
-
|
|
|
18
|
+
| "getUserInfo"
|
|
19
19
|
/** 用户实名信息授权,已经弃用 */
|
|
20
|
-
|
|
|
20
|
+
| "getRealnameAuthInfo"
|
|
21
21
|
/** 打开APP,可以通过app-parameter属性设定向APP传的参数
|
|
22
22
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html
|
|
23
23
|
*/
|
|
24
|
-
|
|
|
24
|
+
| "launchApp"
|
|
25
25
|
/** 打开授权设置页 */
|
|
26
|
-
|
|
|
26
|
+
| "openSetting"
|
|
27
27
|
/** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */
|
|
28
|
-
|
|
|
28
|
+
| "feedback";
|
|
29
29
|
export declare type XhButtonProps = {
|
|
30
|
-
htmlType?:
|
|
30
|
+
htmlType?: "button" | "submit" | "reset";
|
|
31
31
|
type?: ButtonType;
|
|
32
32
|
size?: ButtonSize;
|
|
33
33
|
shape?: ButtonShape;
|
|
@@ -36,6 +36,6 @@ export declare type XhButtonProps = {
|
|
|
36
36
|
styleName?: string;
|
|
37
37
|
text?: string;
|
|
38
38
|
onClick?: (e: ITouchEvent | MouseEvent) => void;
|
|
39
|
-
} & Omit<ButtonProps,
|
|
39
|
+
} & Omit<ButtonProps, "type" | "size">;
|
|
40
40
|
declare const XhButton: FC<XhButtonProps>;
|
|
41
41
|
export default XhButton;
|
|
@@ -2,9 +2,25 @@ import { ReactNode } from "react";
|
|
|
2
2
|
import "./index.scss";
|
|
3
3
|
export declare type AlertProps = {
|
|
4
4
|
title?: string | ReactNode;
|
|
5
|
-
header?: string | ReactNode;
|
|
6
5
|
content?: string | ReactNode;
|
|
7
|
-
|
|
6
|
+
confirmText?: string | ReactNode;
|
|
7
|
+
} & {
|
|
8
|
+
/** 取消按钮的文字,最多 4 个字符 */
|
|
9
|
+
cancelText?: string;
|
|
10
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
11
|
+
complete?: (res: TaroGeneral.CallbackResult) => void;
|
|
12
|
+
/** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
|
13
|
+
confirmColor?: string;
|
|
14
|
+
/** 确认按钮的文字,最多 4 个字符 */
|
|
15
|
+
confirmText?: string;
|
|
16
|
+
/** 提示的内容 */
|
|
17
|
+
content?: string;
|
|
18
|
+
/** 接口调用失败的回调函数 */
|
|
19
|
+
fail?: (res: TaroGeneral.CallbackResult) => void;
|
|
20
|
+
/** 接口调用成功的回调函数 */
|
|
21
|
+
success?: () => void;
|
|
22
|
+
/** 提示的标题 */
|
|
23
|
+
title?: string;
|
|
8
24
|
};
|
|
9
25
|
declare const Alert: (props: AlertProps) => Promise<void>;
|
|
10
26
|
export default Alert;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
export declare type ConfirmProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
header?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
cancelText?: string;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
} & {
|
|
9
|
+
/** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
|
10
|
+
cancelColor?: string;
|
|
11
|
+
/** 取消按钮的文字,最多 4 个字符 */
|
|
12
|
+
cancelText?: string;
|
|
13
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
14
|
+
complete?: (res: TaroGeneral.CallbackResult) => void;
|
|
15
|
+
/** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
|
16
|
+
confirmColor?: string;
|
|
17
|
+
/** 确认按钮的文字,最多 4 个字符 */
|
|
18
|
+
confirmText?: string;
|
|
19
|
+
/** 提示的内容 */
|
|
20
|
+
content?: string;
|
|
21
|
+
/** 接口调用失败的回调函数 */
|
|
22
|
+
fail?: (res: TaroGeneral.CallbackResult) => void;
|
|
23
|
+
/** 接口调用成功的回调函数 */
|
|
24
|
+
success?: (result: ConfirmPropsResult) => void;
|
|
25
|
+
/** 提示的标题 */
|
|
26
|
+
title?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type ConfirmPropsResult = {
|
|
29
|
+
/** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
|
|
30
|
+
cancel: boolean;
|
|
31
|
+
/** 为 true 时,表示用户点击了确定按钮 */
|
|
32
|
+
confirm: boolean;
|
|
33
|
+
/** 调用结果 */
|
|
34
|
+
errMsg: string;
|
|
35
|
+
};
|
|
36
|
+
declare const Comfirm: (props: ConfirmProps) => Promise<ConfirmPropsResult>;
|
|
37
|
+
export default Comfirm;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "../../../types";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export declare type DialogProps = {
|
|
5
|
+
header?: string | ReactNode;
|
|
6
|
+
content: string | ReactNode;
|
|
7
|
+
footer?: string | ReactNode;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
} & XHComponentCommonProps;
|
|
10
|
+
export declare type DialogRef = {
|
|
11
|
+
close: () => void;
|
|
12
|
+
};
|
|
13
|
+
declare const DialogCom: React.ForwardRefExoticComponent<{
|
|
14
|
+
header?: string | ReactNode;
|
|
15
|
+
content: string | ReactNode;
|
|
16
|
+
footer?: string | ReactNode;
|
|
17
|
+
visible: boolean;
|
|
18
|
+
} & XHComponentCommonProps & React.RefAttributes<DialogRef>>;
|
|
19
|
+
export default DialogCom;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefObject } from "react";
|
|
2
|
-
import { DialogRef, DialogProps } from "./
|
|
2
|
+
import { DialogRef, DialogProps } from "./DialogComponent";
|
|
3
3
|
import { AlertProps } from "./Alert";
|
|
4
|
+
import { ConfirmProps, ConfirmPropsResult } from "./Confirm";
|
|
4
5
|
export interface DialogComponent<P = {}> extends ForwardRefExoticComponent<P> {
|
|
5
6
|
ref: RefObject<DialogRef>;
|
|
6
7
|
alert: (options: AlertProps) => Promise<void>;
|
|
8
|
+
confirm: (options: ConfirmProps) => Promise<ConfirmPropsResult>;
|
|
7
9
|
}
|
|
8
10
|
declare const Dialog: DialogComponent<DialogProps>;
|
|
9
11
|
export default Dialog;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "../../types";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export declare type DialogProps = {
|
|
5
|
+
header?: string | ReactNode;
|
|
6
|
+
content: string | ReactNode;
|
|
7
|
+
cancelText?: string;
|
|
8
|
+
confirmText?: string;
|
|
9
|
+
showCancel?: boolean;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
onComfirm?: () => void;
|
|
12
|
+
onCancel?: () => void;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
} & XHComponentCommonProps;
|
|
15
|
+
export declare type IDialogRef = {
|
|
16
|
+
close: () => void;
|
|
17
|
+
open: () => void;
|
|
18
|
+
};
|
|
19
|
+
declare const DialogCom: React.ForwardRefExoticComponent<{
|
|
20
|
+
header?: string | ReactNode;
|
|
21
|
+
content: string | ReactNode;
|
|
22
|
+
cancelText?: string | undefined;
|
|
23
|
+
confirmText?: string | undefined;
|
|
24
|
+
showCancel?: boolean | undefined;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
onComfirm?: (() => void) | undefined;
|
|
27
|
+
onCancel?: (() => void) | undefined;
|
|
28
|
+
onClose?: (() => void) | undefined;
|
|
29
|
+
} & XHComponentCommonProps & React.RefAttributes<IDialogRef>>;
|
|
30
|
+
export default DialogCom;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC, MouseEvent } from "react";
|
|
2
|
+
import "./index.scss";
|
|
3
|
+
import { XHComponentCommonProps } from "../../types";
|
|
4
|
+
export declare type NumberKeyboardType = "default" | "custom";
|
|
5
|
+
export declare type NumberKeyboardProps = {
|
|
6
|
+
show: boolean;
|
|
7
|
+
type?: NumberKeyboardType;
|
|
8
|
+
showClose?: boolean;
|
|
9
|
+
closeOnClickSpace?: boolean;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
onBlur?: (e: MouseEvent | Event) => void;
|
|
12
|
+
onClose?: (e: MouseEvent | Event) => void;
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
value: string;
|
|
15
|
+
} & XHComponentCommonProps;
|
|
16
|
+
export declare type KeyType = "number" | "delete" | "string" | "none";
|
|
17
|
+
export interface IKey {
|
|
18
|
+
text: number | string;
|
|
19
|
+
value: number | string;
|
|
20
|
+
type: KeyType;
|
|
21
|
+
}
|
|
22
|
+
declare const NumberKeyboard: FC<NumberKeyboardProps>;
|
|
23
|
+
export default NumberKeyboard;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "../../types";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export declare type PasswordInputProps = {
|
|
5
|
+
value: string;
|
|
6
|
+
length: number;
|
|
7
|
+
mask?: boolean;
|
|
8
|
+
onFocus?: (e: any) => void;
|
|
9
|
+
} & XHComponentCommonProps;
|
|
10
|
+
declare const PasswordInput: FC<PasswordInputProps>;
|
|
11
|
+
export default PasswordInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "../../types";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export declare type ProgressProps = {
|
|
5
|
+
percent: number;
|
|
6
|
+
showPercent?: boolean;
|
|
7
|
+
doneColor?: string;
|
|
8
|
+
percentColor?: string;
|
|
9
|
+
height?: number;
|
|
10
|
+
} & XHComponentCommonProps;
|
|
11
|
+
declare const Progress: React.FC<ProgressProps>;
|
|
12
|
+
export default Progress;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "../../types";
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
export declare type ToastProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
duration?: number;
|
|
7
|
+
/** 图标
|
|
8
|
+
* 可选值:
|
|
9
|
+
* - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
|
|
10
|
+
* - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
|
|
11
|
+
* - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
|
|
12
|
+
* - 'none': 不显示图标,此时 title 文本最多可显示两行 */
|
|
13
|
+
icon?: "success" | "error" | "loading" | "none";
|
|
14
|
+
/** 自定义图标的本地路径,image 的优先级高于 icon */
|
|
15
|
+
image?: string;
|
|
16
|
+
/** 是否显示透明蒙层,防止触摸穿透 */
|
|
17
|
+
mask?: boolean;
|
|
18
|
+
} & XHComponentCommonProps;
|
|
19
|
+
declare const ToastCom: FC<ToastProps>;
|
|
20
|
+
export default ToastCom;
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
export { default as XHButton } from
|
|
2
|
-
export { default as XHPage } from
|
|
3
|
-
export { default as XHLoading } from
|
|
4
|
-
export { default as XHBankIcon } from
|
|
5
|
-
export { default as XHCaptcha } from
|
|
6
|
-
export { default as XHFormInput } from
|
|
7
|
-
export { default as XHList } from
|
|
8
|
-
export { default as XHMask } from
|
|
9
|
-
export { default as XHImage } from
|
|
1
|
+
export { default as XHButton } from "./components/Button";
|
|
2
|
+
export { default as XHPage } from "./components/Page";
|
|
3
|
+
export { default as XHLoading } from "./components/Loading";
|
|
4
|
+
export { default as XHBankIcon } from "./components/BankIcon";
|
|
5
|
+
export { default as XHCaptcha } from "./components/Captcha";
|
|
6
|
+
export { default as XHFormInput } from "./components/FormInput";
|
|
7
|
+
export { default as XHList } from "./components/List";
|
|
8
|
+
export { default as XHMask } from "./components/Mask";
|
|
9
|
+
export { default as XHImage } from "./components/Image";
|
|
10
|
+
export { default as XHDialog } from "./components/Dialog";
|
|
11
|
+
export { default as XHNumberKeyboard } from "./components/NumberKeyboard";
|
|
12
|
+
export { default as XHPasswordInput } from "./components/PasswordInput";
|
|
13
|
+
export { default as XHProgress } from "./components/Progress";
|
|
14
|
+
export { default as XHToast } from "./components/Toast";
|
|
15
|
+
export { default as XHDialogRef } from "./components/DialogRef";
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,SAAS,GACV,MAAM,OAAO,CAAC;AACf,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC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