pay-sdk-react 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -19
- package/README.zh-CN.md +37 -19
- package/dist/css/index.css +703 -1
- package/dist/css/index.min.css +1 -0
- package/dist/es/Airwallex/airwallex-button.js +56 -36
- package/dist/es/Airwallex/airwallex-modal.js +41 -34
- package/dist/es/Airwallex/airwallex-popup.js +43 -38
- package/dist/es/Airwallex/airwallex.js +26 -28
- package/dist/es/Airwallex/index.js +1 -1
- package/dist/es/Airwallex/style/index.css +335 -1
- package/dist/es/Airwallex/style/index.min.css +1 -0
- package/dist/es/Alipay/alipay-button.js +39 -24
- package/dist/es/Alipay/alipay-modal.js +37 -31
- package/dist/es/Alipay/alipay.js +22 -15
- package/dist/es/Alipay/index.d.ts +4 -4
- package/dist/es/Alipay/index.js +5 -5
- package/dist/es/Alipay/style/index.css +18 -1
- package/dist/es/Alipay/style/index.min.css +1 -0
- package/dist/es/Button/button.js +62 -37
- package/dist/es/Button/index.d.ts +2 -2
- package/dist/es/Button/index.js +2 -2
- package/dist/es/Button/style/index.css +95 -1
- package/dist/es/Button/style/index.min.css +1 -0
- package/dist/es/FullScreenLoading/index.js +40 -40
- package/dist/es/FullScreenLoading/interface.d.ts +2 -2
- package/dist/es/FullScreenLoading/style/index.css +239 -1
- package/dist/es/FullScreenLoading/style/index.min.css +1 -0
- package/dist/es/MAlipay/index.js +1 -1
- package/dist/es/MAlipay/m-alipay-auto-submit.js +9 -11
- package/dist/es/MAlipay/m-alipay-button.js +71 -51
- package/dist/es/MAlipay/style/index.css +252 -1
- package/dist/es/MAlipay/style/index.min.css +1 -0
- package/dist/es/MWeChat/index.d.ts +2 -2
- package/dist/es/MWeChat/index.js +2 -2
- package/dist/es/MWeChat/m-wechat-button.js +70 -50
- package/dist/es/MWeChat/style/index.css +252 -1
- package/dist/es/MWeChat/style/index.min.css +1 -0
- package/dist/es/Mask/index.d.ts +2 -2
- package/dist/es/Mask/index.js +2 -2
- package/dist/es/Mask/mask.js +48 -45
- package/dist/es/Mask/style/index.css +11 -1
- package/dist/es/Mask/style/index.min.css +1 -0
- package/dist/es/PayButton/index.js +2 -2
- package/dist/es/PayButton/interface.d.ts +9 -9
- package/dist/es/PayButton/interface.js +1 -1
- package/dist/es/PayMask/index.d.ts +2 -2
- package/dist/es/PayMask/index.js +2 -2
- package/dist/es/PayMask/interface.d.ts +8 -2
- package/dist/es/PayMask/pay-mask.js +48 -40
- package/dist/es/PayMask/style/index.css +62 -1
- package/dist/es/PayMask/style/index.min.css +1 -0
- package/dist/es/Paypal/index.d.ts +2 -2
- package/dist/es/Paypal/index.js +2 -2
- package/dist/es/Paypal/paypal-button.js +55 -36
- package/dist/es/Paypal/style/index.css +207 -1
- package/dist/es/Paypal/style/index.min.css +1 -0
- package/dist/es/Payssion/index.d.ts +2 -2
- package/dist/es/Payssion/index.js +2 -2
- package/dist/es/Payssion/payssion-button.js +56 -37
- package/dist/es/Payssion/style/index.css +157 -1
- package/dist/es/Payssion/style/index.min.css +1 -0
- package/dist/es/Stripe/index.d.ts +5 -5
- package/dist/es/Stripe/index.js +6 -6
- package/dist/es/Stripe/stripe-button.js +47 -33
- package/dist/es/Stripe/stripe-modal.js +38 -32
- package/dist/es/Stripe/stripe-popup.js +42 -37
- package/dist/es/Stripe/stripe.js +15 -15
- package/dist/es/Stripe/style/index.css +365 -1
- package/dist/es/Stripe/style/index.min.css +1 -0
- package/dist/es/Wechat/index.d.ts +4 -4
- package/dist/es/Wechat/index.js +5 -5
- package/dist/es/Wechat/style/index.css +25 -1
- package/dist/es/Wechat/style/index.min.css +1 -0
- package/dist/es/Wechat/wechat-button.js +38 -23
- package/dist/es/Wechat/wechat-modal.js +37 -31
- package/dist/es/Wechat/wechat.js +16 -12
- package/dist/es/confirm-modal/index.js +42 -39
- package/dist/es/confirm-modal/interface.d.ts +8 -2
- package/dist/es/confirm-modal/style/index.css +95 -1
- package/dist/es/confirm-modal/style/index.min.css +1 -0
- package/dist/es/dot-loading/dot-loading.js +25 -23
- package/dist/es/dot-loading/index.d.ts +2 -2
- package/dist/es/dot-loading/index.js +2 -2
- package/dist/es/dot-loading/style/index.css +3 -1
- package/dist/es/dot-loading/style/index.min.css +1 -0
- package/dist/es/hooks/use-initialized.js +2 -2
- package/dist/es/hooks/use-inner-visible.js +8 -4
- package/dist/es/hooks/use-lock-scroll.d.ts +2 -2
- package/dist/es/hooks/use-lock-scroll.js +30 -34
- package/dist/es/hooks/use-touch.d.ts +1 -1
- package/dist/es/hooks/use-touch.js +35 -31
- package/dist/es/hooks/usePayWindowOpen.d.ts +16 -10
- package/dist/es/hooks/usePayWindowOpen.js +81 -37
- package/dist/es/icons/IconAlipay/index.js +18 -16
- package/dist/es/icons/IconClose/index.js +24 -22
- package/dist/es/icons/IconPaypalText/index.js +24 -22
- package/dist/es/icons/IconPaypalWhite/index.js +19 -17
- package/dist/es/icons/IconPayssionPay/index.js +47 -45
- package/dist/es/icons/IconStripe/index.js +19 -17
- package/dist/es/icons/IconStripeText/index.js +19 -17
- package/dist/es/icons/IconWechatPay/index.js +18 -16
- package/dist/es/icons/interface.d.ts +1 -1
- package/dist/es/icons/style/index.css +45 -1
- package/dist/es/icons/style/index.min.css +1 -0
- package/dist/es/pay-modal/index.d.ts +2 -2
- package/dist/es/pay-modal/index.js +2 -2
- package/dist/es/pay-modal/pay-modal.js +45 -48
- package/dist/es/pay-modal/style/index.css +95 -1
- package/dist/es/pay-modal/style/index.min.css +1 -0
- package/dist/es/pay-popup/index.js +51 -53
- package/dist/es/pay-popup/interface.d.ts +6 -6
- package/dist/es/pay-popup/style/index.css +145 -1
- package/dist/es/pay-popup/style/index.min.css +1 -0
- package/dist/es/shared/enums/index.d.ts +21 -0
- package/dist/es/shared/enums/index.js +24 -1
- package/dist/es/shared/index.d.ts +1 -1
- package/dist/es/shared/index.js +1 -1
- package/dist/es/utils/can-use-dom.js +1 -1
- package/dist/es/utils/classNames.js +15 -11
- package/dist/es/utils/dom.js +18 -18
- package/dist/es/utils/get-container.js +2 -2
- package/dist/es/utils/get-scroll-parent.js +8 -9
- package/dist/es/utils/is.d.ts +10 -1
- package/dist/es/utils/is.js +68 -34
- package/dist/es/utils/native-props.d.ts +2 -2
- package/dist/es/utils/native-props.js +7 -9
- package/dist/es/utils/omit.js +3 -5
- package/dist/es/utils/qrcode.js +5 -5
- package/dist/es/utils/render-to-container.d.ts +1 -1
- package/dist/es/utils/render-to-container.js +4 -4
- package/dist/es/utils/should-render.d.ts +1 -1
- package/dist/es/utils/should-render.js +4 -4
- package/dist/es/utils/supports-passive.js +8 -7
- package/dist/es/utils/warning.js +0 -1
- package/dist/es/utils/with-default-props.js +6 -4
- package/dist/es/utils/with-stop-propagation.d.ts +3 -3
- package/dist/es/utils/with-stop-propagation.js +27 -14
- package/dist/lib/Airwallex/airwallex-button.js +12 -15
- package/dist/lib/Airwallex/airwallex-modal.js +11 -14
- package/dist/lib/Airwallex/airwallex-popup.js +16 -23
- package/dist/lib/Airwallex/airwallex.js +20 -25
- package/dist/lib/Airwallex/index.js +1 -1
- package/dist/lib/Airwallex/style/index.css +335 -1
- package/dist/lib/Airwallex/style/index.min.css +1 -0
- package/dist/lib/Alipay/alipay-button.js +12 -15
- package/dist/lib/Alipay/alipay-modal.js +9 -12
- package/dist/lib/Alipay/alipay.js +19 -23
- package/dist/lib/Alipay/index.js +1 -1
- package/dist/lib/Alipay/style/index.css +18 -1
- package/dist/lib/Alipay/style/index.min.css +1 -0
- package/dist/lib/Button/button.js +13 -13
- package/dist/lib/Button/index.js +1 -1
- package/dist/lib/Button/style/index.css +95 -1
- package/dist/lib/Button/style/index.min.css +1 -0
- package/dist/lib/FullScreenLoading/index.js +28 -29
- package/dist/lib/FullScreenLoading/style/index.css +239 -1
- package/dist/lib/FullScreenLoading/style/index.min.css +1 -0
- package/dist/lib/MAlipay/index.js +1 -1
- package/dist/lib/MAlipay/m-alipay-auto-submit.js +3 -4
- package/dist/lib/MAlipay/m-alipay-button.js +34 -44
- package/dist/lib/MAlipay/style/index.css +252 -1
- package/dist/lib/MAlipay/style/index.min.css +1 -0
- package/dist/lib/MWeChat/index.js +2 -2
- package/dist/lib/MWeChat/m-wechat-button.js +34 -44
- package/dist/lib/MWeChat/style/index.css +252 -1
- package/dist/lib/MWeChat/style/index.min.css +1 -0
- package/dist/lib/Mask/index.js +1 -1
- package/dist/lib/Mask/mask.js +6 -11
- package/dist/lib/Mask/style/index.css +11 -1
- package/dist/lib/Mask/style/index.min.css +1 -0
- package/dist/lib/PayButton/index.js +10 -10
- package/dist/lib/PayMask/index.js +1 -1
- package/dist/lib/PayMask/pay-mask.js +26 -24
- package/dist/lib/PayMask/style/index.css +62 -1
- package/dist/lib/PayMask/style/index.min.css +1 -0
- package/dist/lib/Paypal/index.js +2 -2
- package/dist/lib/Paypal/paypal-button.js +17 -22
- package/dist/lib/Paypal/style/index.css +207 -1
- package/dist/lib/Paypal/style/index.min.css +1 -0
- package/dist/lib/Payssion/index.js +2 -2
- package/dist/lib/Payssion/payssion-button.js +17 -22
- package/dist/lib/Payssion/style/index.css +157 -1
- package/dist/lib/Payssion/style/index.min.css +1 -0
- package/dist/lib/Stripe/index.js +1 -1
- package/dist/lib/Stripe/stripe-button.js +14 -17
- package/dist/lib/Stripe/stripe-modal.js +10 -13
- package/dist/lib/Stripe/stripe-popup.js +16 -23
- package/dist/lib/Stripe/stripe.js +8 -11
- package/dist/lib/Stripe/style/index.css +365 -1
- package/dist/lib/Stripe/style/index.min.css +1 -0
- package/dist/lib/Wechat/index.js +1 -1
- package/dist/lib/Wechat/style/index.css +25 -1
- package/dist/lib/Wechat/style/index.min.css +1 -0
- package/dist/lib/Wechat/wechat-button.js +12 -15
- package/dist/lib/Wechat/wechat-modal.js +9 -12
- package/dist/lib/Wechat/wechat.js +11 -12
- package/dist/lib/confirm-modal/index.js +24 -28
- package/dist/lib/confirm-modal/style/index.css +95 -1
- package/dist/lib/confirm-modal/style/index.min.css +1 -0
- package/dist/lib/dot-loading/dot-loading.js +3 -4
- package/dist/lib/dot-loading/index.js +1 -1
- package/dist/lib/dot-loading/style/index.css +3 -1
- package/dist/lib/dot-loading/style/index.min.css +1 -0
- package/dist/lib/hooks/use-lock-scroll.js +11 -12
- package/dist/lib/hooks/use-touch.js +10 -10
- package/dist/lib/hooks/usePayWindowOpen.js +63 -21
- package/dist/lib/icons/IconAlipay/index.js +6 -6
- package/dist/lib/icons/IconClose/index.js +8 -8
- package/dist/lib/icons/IconPaypalText/index.js +7 -7
- package/dist/lib/icons/IconPaypalWhite/index.js +6 -6
- package/dist/lib/icons/IconPayssionPay/index.js +13 -13
- package/dist/lib/icons/IconStripe/index.js +6 -6
- package/dist/lib/icons/IconStripeText/index.js +6 -6
- package/dist/lib/icons/IconWechatPay/index.js +6 -6
- package/dist/lib/icons/index.js +2 -2
- package/dist/lib/icons/style/index.css +45 -1
- package/dist/lib/icons/style/index.min.css +1 -0
- package/dist/lib/index.js +2 -2
- package/dist/lib/pay-modal/index.js +1 -1
- package/dist/lib/pay-modal/pay-modal.js +24 -30
- package/dist/lib/pay-modal/style/index.css +95 -1
- package/dist/lib/pay-modal/style/index.min.css +1 -0
- package/dist/lib/pay-popup/index.js +24 -28
- package/dist/lib/pay-popup/style/index.css +145 -1
- package/dist/lib/pay-popup/style/index.min.css +1 -0
- package/dist/lib/shared/enums/index.js +23 -1
- package/dist/lib/utils/can-use-dom.js +1 -1
- package/dist/lib/utils/classNames.js +6 -7
- package/dist/lib/utils/dom.js +9 -11
- package/dist/lib/utils/get-scroll-parent.js +2 -3
- package/dist/lib/utils/getPrefixCls.js +1 -1
- package/dist/lib/utils/is.js +32 -17
- package/dist/lib/utils/native-props.js +10 -10
- package/dist/lib/utils/omit.js +3 -6
- package/dist/lib/utils/qrcode.js +1 -1
- package/dist/lib/utils/supports-passive.js +4 -3
- package/dist/lib/utils/warning.js +2 -6
- package/dist/lib/utils/with-default-props.js +4 -8
- package/dist/lib/utils/with-stop-propagation.js +6 -9
- package/dist/umd/pay-sdk-react.umd.js +218 -130
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +6 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
var _exportNames = {};
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
8
10
|
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
9
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
12
|
var _ahooks = require("ahooks");
|
|
@@ -33,13 +35,6 @@ Object.keys(_interface).forEach(function (key) {
|
|
|
33
35
|
});
|
|
34
36
|
});
|
|
35
37
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
36
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
37
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
38
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
39
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
40
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
41
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
42
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
43
38
|
const classPrefix = (0, _getPrefixCls.getPrefixCls)('popup');
|
|
44
39
|
const defaultPopupBaseProps = {
|
|
45
40
|
closeOnMaskClick: true,
|
|
@@ -53,16 +48,17 @@ const defaultPopupBaseProps = {
|
|
|
53
48
|
stopPropagation: ['click'],
|
|
54
49
|
visible: false
|
|
55
50
|
};
|
|
56
|
-
const defaultProps =
|
|
51
|
+
const defaultProps = {
|
|
52
|
+
...defaultPopupBaseProps,
|
|
57
53
|
closeOnSwipe: false,
|
|
58
54
|
position: 'bottom',
|
|
59
55
|
round: false
|
|
60
|
-
}
|
|
56
|
+
};
|
|
61
57
|
const PayPopup = p => {
|
|
62
58
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
63
|
-
const bodyCls = (0, _classNames.default)(
|
|
64
|
-
[
|
|
65
|
-
[
|
|
59
|
+
const bodyCls = (0, _classNames.default)(`${classPrefix}-body`, props.bodyClassName, `${classPrefix}-body-position-${props.position}`, {
|
|
60
|
+
[`${classPrefix}-body-with-close`]: props.showCloseButton,
|
|
61
|
+
[`${classPrefix}-body-round`]: props.round
|
|
66
62
|
});
|
|
67
63
|
const [active, setActive] = (0, _react.useState)(props.visible);
|
|
68
64
|
const ref = (0, _react.useRef)(null);
|
|
@@ -95,10 +91,9 @@ const PayPopup = p => {
|
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
});
|
|
98
|
-
const bind = (0, _react2.useDrag)(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} = _ref;
|
|
94
|
+
const bind = (0, _react2.useDrag)(({
|
|
95
|
+
swipe: [, swipeY]
|
|
96
|
+
}) => {
|
|
102
97
|
if (!props.closeOnSwipe) return;
|
|
103
98
|
if (swipeY === 1 && props.position === 'bottom' || swipeY === -1 && props.position === 'top') {
|
|
104
99
|
var _props$onClose;
|
|
@@ -109,7 +104,7 @@ const PayPopup = p => {
|
|
|
109
104
|
enabled: ['top', 'bottom'].includes(props.position)
|
|
110
105
|
});
|
|
111
106
|
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && props.visible);
|
|
112
|
-
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react.default.createElement("div",
|
|
107
|
+
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
113
108
|
className: classPrefix,
|
|
114
109
|
onClick: props.onClick,
|
|
115
110
|
style: {
|
|
@@ -133,31 +128,32 @@ const PayPopup = p => {
|
|
|
133
128
|
disableBodyScroll: false,
|
|
134
129
|
stopPropagation: props.stopPropagation
|
|
135
130
|
}), /*#__PURE__*/_react.default.createElement(_web.animated.div, {
|
|
136
|
-
className: (0, _classNames.default)(
|
|
137
|
-
[
|
|
138
|
-
[
|
|
131
|
+
className: (0, _classNames.default)(`${classPrefix}-body`, `${classPrefix}-body-position-${props.position}`, {
|
|
132
|
+
[`${classPrefix}-body-with-close`]: props.showCloseButton,
|
|
133
|
+
[`${classPrefix}-body-round`]: props.round
|
|
139
134
|
}, bodyCls),
|
|
140
|
-
style:
|
|
135
|
+
style: {
|
|
136
|
+
...props.bodyStyle,
|
|
141
137
|
pointerEvents: percent.to(v => v === 0 ? 'unset' : 'none'),
|
|
142
138
|
transform: percent.to(v => {
|
|
143
139
|
if (props.position === 'bottom') {
|
|
144
|
-
return
|
|
140
|
+
return `translate(0, ${v}%)`;
|
|
145
141
|
}
|
|
146
142
|
if (props.position === 'top') {
|
|
147
|
-
return
|
|
143
|
+
return `translate(0, -${v}%)`;
|
|
148
144
|
}
|
|
149
145
|
if (props.position === 'left') {
|
|
150
|
-
return
|
|
146
|
+
return `translate(-${v}%, 0)`;
|
|
151
147
|
}
|
|
152
148
|
if (props.position === 'right') {
|
|
153
|
-
return
|
|
149
|
+
return `translate(${v}%, 0)`;
|
|
154
150
|
}
|
|
155
151
|
return 'none';
|
|
156
152
|
})
|
|
157
|
-
}
|
|
153
|
+
},
|
|
158
154
|
ref: ref
|
|
159
155
|
}, props.showCloseButton && /*#__PURE__*/_react.default.createElement("a", {
|
|
160
|
-
className: (0, _classNames.default)(
|
|
156
|
+
className: (0, _classNames.default)(`${classPrefix}-close-icon`, `${classPrefix}-close-button`),
|
|
161
157
|
onClick: () => {
|
|
162
158
|
var _props$onClose3;
|
|
163
159
|
(_props$onClose3 = props.onClose) === null || _props$onClose3 === void 0 || _props$onClose3.call(props);
|
|
@@ -165,7 +161,7 @@ const PayPopup = p => {
|
|
|
165
161
|
role: "button",
|
|
166
162
|
"aria-label": 'close'
|
|
167
163
|
}, props.closeIcon), /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
-
className:
|
|
164
|
+
className: `${classPrefix}-content`
|
|
169
165
|
}, props.children)))));
|
|
170
166
|
return /*#__PURE__*/_react.default.createElement(_shouldRender.ShouldRender, {
|
|
171
167
|
active: active,
|
|
@@ -1 +1,145 @@
|
|
|
1
|
-
.pay-mask
|
|
1
|
+
.pay-mask {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: 1000;
|
|
4
|
+
left: 0;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
}
|
|
12
|
+
.pay-icon {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
color: inherit;
|
|
15
|
+
width: 16px;
|
|
16
|
+
vertical-align: -2px;
|
|
17
|
+
stroke: currentColor;
|
|
18
|
+
}
|
|
19
|
+
.pay-icon[fill='currentColor'] {
|
|
20
|
+
fill: currentColor;
|
|
21
|
+
stroke: none;
|
|
22
|
+
}
|
|
23
|
+
.pay-icon[stroke='currentColor'] {
|
|
24
|
+
stroke: currentColor;
|
|
25
|
+
fill: none;
|
|
26
|
+
}
|
|
27
|
+
.pay-icon[fill='currentColor'][stroke='currentColor'] {
|
|
28
|
+
fill: currentColor;
|
|
29
|
+
stroke: currentColor;
|
|
30
|
+
}
|
|
31
|
+
.pay-icon-paypal-text {
|
|
32
|
+
width: 64px;
|
|
33
|
+
height: 26px;
|
|
34
|
+
max-width: 72px;
|
|
35
|
+
max-height: 32px;
|
|
36
|
+
}
|
|
37
|
+
.pay-icon-close {
|
|
38
|
+
width: 18px;
|
|
39
|
+
height: 18px;
|
|
40
|
+
}
|
|
41
|
+
.pay-icon-stripe-text {
|
|
42
|
+
width: 24px;
|
|
43
|
+
height: 24px;
|
|
44
|
+
}
|
|
45
|
+
.pay-icon-alipay {
|
|
46
|
+
width: 20px;
|
|
47
|
+
height: 20px;
|
|
48
|
+
}
|
|
49
|
+
.pay-icon-wechat-pay {
|
|
50
|
+
width: 20px;
|
|
51
|
+
height: 20px;
|
|
52
|
+
}
|
|
53
|
+
.pay-icon-payssion-pay {
|
|
54
|
+
width: 36px;
|
|
55
|
+
height: 20px;
|
|
56
|
+
}
|
|
57
|
+
.pay-popup {
|
|
58
|
+
position: fixed;
|
|
59
|
+
z-index: 1001;
|
|
60
|
+
}
|
|
61
|
+
/* Base container for the animated popup body */
|
|
62
|
+
.pay-popup-body {
|
|
63
|
+
position: fixed;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
background-color: #ffffff;
|
|
67
|
+
z-index: 1010;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
}
|
|
70
|
+
/* --- Sizing and Positioning --- */
|
|
71
|
+
.pay-popup-body.pay-popup-body-position-bottom {
|
|
72
|
+
width: 100%;
|
|
73
|
+
left: 0;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
}
|
|
76
|
+
.pay-popup-body.pay-popup-body-position-top {
|
|
77
|
+
width: 100%;
|
|
78
|
+
left: 0;
|
|
79
|
+
top: 0;
|
|
80
|
+
}
|
|
81
|
+
.pay-popup-body.pay-popup-body-position-left {
|
|
82
|
+
height: 100%;
|
|
83
|
+
width: 80vw;
|
|
84
|
+
left: 0;
|
|
85
|
+
top: 0;
|
|
86
|
+
}
|
|
87
|
+
.pay-popup-body.pay-popup-body-position-right {
|
|
88
|
+
height: 100%;
|
|
89
|
+
width: 80vw;
|
|
90
|
+
right: 0;
|
|
91
|
+
top: 0;
|
|
92
|
+
}
|
|
93
|
+
/* --- Round Corners Modifier --- */
|
|
94
|
+
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom {
|
|
95
|
+
border-radius: 16px 16px 0 0;
|
|
96
|
+
}
|
|
97
|
+
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top {
|
|
98
|
+
border-radius: 0 0 16px 16px;
|
|
99
|
+
}
|
|
100
|
+
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left {
|
|
101
|
+
border-radius: 0 16px 16px 0;
|
|
102
|
+
}
|
|
103
|
+
.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right {
|
|
104
|
+
border-radius: 16px 0 0 16px;
|
|
105
|
+
}
|
|
106
|
+
/* --- Close Icon --- */
|
|
107
|
+
.pay-popup-close-icon {
|
|
108
|
+
position: absolute;
|
|
109
|
+
z-index: 1;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
padding: 4px;
|
|
112
|
+
font-size: 18px;
|
|
113
|
+
line-height: 1;
|
|
114
|
+
color: #999;
|
|
115
|
+
}
|
|
116
|
+
.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,
|
|
117
|
+
.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon {
|
|
118
|
+
top: 8px;
|
|
119
|
+
right: 8px;
|
|
120
|
+
}
|
|
121
|
+
.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon {
|
|
122
|
+
bottom: 8px;
|
|
123
|
+
right: 8px;
|
|
124
|
+
}
|
|
125
|
+
.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon {
|
|
126
|
+
top: 8px;
|
|
127
|
+
left: 8px;
|
|
128
|
+
}
|
|
129
|
+
/* --- Content Area --- */
|
|
130
|
+
.pay-popup-content {
|
|
131
|
+
flex: 1;
|
|
132
|
+
overflow-y: auto;
|
|
133
|
+
-webkit-overflow-scrolling: touch;
|
|
134
|
+
}
|
|
135
|
+
/* --- Padding adjustment when close icon is visible --- */
|
|
136
|
+
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,
|
|
137
|
+
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content {
|
|
138
|
+
padding-top: 40px;
|
|
139
|
+
}
|
|
140
|
+
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content {
|
|
141
|
+
padding-top: 40px;
|
|
142
|
+
}
|
|
143
|
+
.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content {
|
|
144
|
+
padding-bottom: 40px;
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-icon{display:inline-block;color:inherit;width:16px;vertical-align:-2px;stroke:currentColor}.pay-icon[fill=currentColor]{fill:currentColor;stroke:none}.pay-icon[stroke=currentColor]{stroke:currentColor;fill:none}.pay-icon[fill=currentColor][stroke=currentColor]{fill:currentColor;stroke:currentColor}.pay-icon-paypal-text{width:64px;height:26px;max-width:72px;max-height:32px}.pay-icon-close{width:18px;height:18px}.pay-icon-stripe-text{width:24px;height:24px}.pay-icon-alipay{width:20px;height:20px}.pay-icon-wechat-pay{width:20px;height:20px}.pay-icon-payssion-pay{width:36px;height:20px}.pay-popup{position:fixed;z-index:1001}.pay-popup-body{position:fixed;display:flex;flex-direction:column;background-color:#fff;z-index:1010;box-sizing:border-box}.pay-popup-body.pay-popup-body-position-bottom{width:100%;left:0;bottom:0}.pay-popup-body.pay-popup-body-position-top{width:100%;left:0;top:0}.pay-popup-body.pay-popup-body-position-left{height:100%;width:80vw;left:0;top:0}.pay-popup-body.pay-popup-body-position-right{height:100%;width:80vw;right:0;top:0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom{border-radius:16px 16px 0 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top{border-radius:0 0 16px 16px}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left{border-radius:0 16px 16px 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right{border-radius:16px 0 0 16px}.pay-popup-close-icon{position:absolute;z-index:1;cursor:pointer;padding:4px;font-size:18px;line-height:1;color:#999}.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon{top:8px;right:8px}.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon{bottom:8px;right:8px}.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon{top:8px;left:8px}.pay-popup-content{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content{padding-bottom:40px}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PaymentMethod = void 0;
|
|
6
|
+
exports.PaymentMethod = exports.OpenPayUrlMode = void 0;
|
|
7
7
|
let PaymentMethod = exports.PaymentMethod = /*#__PURE__*/function (PaymentMethod) {
|
|
8
8
|
/**
|
|
9
9
|
* @zh 微信(pc)
|
|
@@ -61,4 +61,26 @@ let PaymentMethod = exports.PaymentMethod = /*#__PURE__*/function (PaymentMethod
|
|
|
61
61
|
*/
|
|
62
62
|
PaymentMethod["Airwallex"] = "airwallex";
|
|
63
63
|
return PaymentMethod;
|
|
64
|
+
}({});
|
|
65
|
+
/**
|
|
66
|
+
* @zh 支付页面打开模式枚举
|
|
67
|
+
* @en Payment page opening mode enum
|
|
68
|
+
*/
|
|
69
|
+
let OpenPayUrlMode = exports.OpenPayUrlMode = /*#__PURE__*/function (OpenPayUrlMode) {
|
|
70
|
+
/**
|
|
71
|
+
* @zh 新页面或弹窗模式 - 使用 window.open() 打开新页面或弹窗,支持智能设备检测
|
|
72
|
+
* @en New page or popup mode - Use window.open() to open new page or popup, supports smart device detection
|
|
73
|
+
*/
|
|
74
|
+
OpenPayUrlMode["Window"] = "window";
|
|
75
|
+
/**
|
|
76
|
+
* @zh 新页面模式 - 使用 window.location.href 跳转到新页面
|
|
77
|
+
* @en New page mode - Use window.location.href to navigate to new page
|
|
78
|
+
*/
|
|
79
|
+
OpenPayUrlMode["Href"] = "href";
|
|
80
|
+
/**
|
|
81
|
+
* @zh 替换页面模式 - 使用 window.location.replace 替换当前页面
|
|
82
|
+
* @en Replace page mode - Use window.location.replace to replace current page
|
|
83
|
+
*/
|
|
84
|
+
OpenPayUrlMode["Replace"] = "replace";
|
|
85
|
+
return OpenPayUrlMode;
|
|
64
86
|
}({});
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.canUseDom = void 0;
|
|
7
|
-
const canUseDom = exports.canUseDom = !!(typeof window !==
|
|
7
|
+
const canUseDom = exports.canUseDom = !!(typeof window !== 'undefined' && typeof document !== 'undefined' && window.document && window.document.createElement);
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = _default;
|
|
7
8
|
var _is = require("./is");
|
|
8
9
|
var _warning = _interopRequireDefault(require("./warning"));
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _default() {
|
|
12
|
-
const length = arguments.length;
|
|
10
|
+
function _default(...args) {
|
|
11
|
+
const length = args.length;
|
|
13
12
|
let classNames = [];
|
|
14
13
|
for (let i = 0; i < length; i++) {
|
|
15
|
-
const v =
|
|
14
|
+
const v = args[i];
|
|
16
15
|
if (!v) {
|
|
17
16
|
continue;
|
|
18
17
|
}
|
|
@@ -27,8 +26,8 @@ function _default() {
|
|
|
27
26
|
}
|
|
28
27
|
});
|
|
29
28
|
} else {
|
|
30
|
-
(0, _warning.default)(true,
|
|
29
|
+
(0, _warning.default)(true, 'arguments must be one of string/array/object.');
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
return [...new Set(classNames)].join(
|
|
32
|
+
return [...new Set(classNames)].join(' ');
|
|
34
33
|
}
|
package/dist/lib/utils/dom.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.open = exports.on = exports.off = exports.location = exports.localStorag
|
|
|
7
7
|
const NOOP = () => {};
|
|
8
8
|
const isServerRendering = exports.isServerRendering = function () {
|
|
9
9
|
try {
|
|
10
|
-
return !(typeof window !==
|
|
10
|
+
return !(typeof window !== 'undefined' && document !== undefined);
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
12
|
} catch (e) {
|
|
13
13
|
return true;
|
|
@@ -36,24 +36,23 @@ const location = exports.location = function () {
|
|
|
36
36
|
return NOOP;
|
|
37
37
|
}
|
|
38
38
|
return function (action, value) {
|
|
39
|
-
if (action ===
|
|
39
|
+
if (action === 'replace') {
|
|
40
40
|
window.location.replace(value);
|
|
41
41
|
}
|
|
42
|
-
if (action ===
|
|
42
|
+
if (action === 'href') {
|
|
43
43
|
window.location.href = value;
|
|
44
44
|
}
|
|
45
|
-
if (action ===
|
|
45
|
+
if (action === 'reload') {
|
|
46
46
|
window.location.reload();
|
|
47
47
|
}
|
|
48
|
-
if (action ===
|
|
48
|
+
if (action === 'protocol') {
|
|
49
49
|
return window.location.protocol;
|
|
50
50
|
}
|
|
51
|
-
if (action ===
|
|
51
|
+
if (action === 'host') {
|
|
52
52
|
return window.location.host;
|
|
53
53
|
}
|
|
54
|
-
if (action ===
|
|
55
|
-
|
|
56
|
-
return (_window$location$sear = window.location.search) !== null && _window$location$sear !== void 0 ? _window$location$sear : "";
|
|
54
|
+
if (action === 'search') {
|
|
55
|
+
return window.location.search ?? '';
|
|
57
56
|
}
|
|
58
57
|
};
|
|
59
58
|
}();
|
|
@@ -61,8 +60,7 @@ const open = exports.open = function () {
|
|
|
61
60
|
if (isServerRendering) {
|
|
62
61
|
return NOOP;
|
|
63
62
|
}
|
|
64
|
-
return function (url) {
|
|
65
|
-
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "_blank";
|
|
63
|
+
return function (url, target = '_blank') {
|
|
66
64
|
window.open(url, target);
|
|
67
65
|
};
|
|
68
66
|
}();
|
|
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getScrollParent = getScrollParent;
|
|
7
7
|
var _canUseDom = require("./can-use-dom");
|
|
8
8
|
const defaultRoot = _canUseDom.canUseDom ? window : undefined;
|
|
9
|
-
const overflowStylePatterns = [
|
|
9
|
+
const overflowStylePatterns = ['scroll', 'auto', 'overlay'];
|
|
10
10
|
function isElement(node) {
|
|
11
11
|
const ELEMENT_NODE_TYPE = 1;
|
|
12
12
|
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
13
13
|
}
|
|
14
|
-
function getScrollParent(el) {
|
|
15
|
-
let root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRoot;
|
|
14
|
+
function getScrollParent(el, root = defaultRoot) {
|
|
16
15
|
let node = el;
|
|
17
16
|
while (node && node !== root && isElement(node)) {
|
|
18
17
|
if (node === document.body) {
|
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getPrefixCls = getPrefixCls;
|
|
7
7
|
function getPrefixCls(componentName, customPrefix) {
|
|
8
|
-
return
|
|
8
|
+
return `${customPrefix || 'pay'}-${componentName}`;
|
|
9
9
|
}
|
package/dist/lib/utils/is.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -19,7 +20,7 @@ exports.isFunction = isFunction;
|
|
|
19
20
|
exports.isIOS = isIOS;
|
|
20
21
|
exports.isImageLinkAvailable = isImageLinkAvailable;
|
|
21
22
|
exports.isLink = void 0;
|
|
22
|
-
exports.
|
|
23
|
+
exports.isMobileDevice = isMobileDevice;
|
|
23
24
|
exports.isNull = isNull;
|
|
24
25
|
exports.isNullOrUndefined = isNullOrUndefined;
|
|
25
26
|
exports.isNumber = isNumber;
|
|
@@ -29,33 +30,35 @@ exports.isReactComponent = void 0;
|
|
|
29
30
|
exports.isRegExp = isRegExp;
|
|
30
31
|
exports.isSmsCode = isSmsCode;
|
|
31
32
|
exports.isString = isString;
|
|
33
|
+
exports.isTouchDevice = isTouchDevice;
|
|
32
34
|
exports.isUndefined = isUndefined;
|
|
33
35
|
exports.isUsPhoneNumber = isUsPhoneNumber;
|
|
34
36
|
exports.isWindow = isWindow;
|
|
37
|
+
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
35
38
|
var _react = require("react");
|
|
36
39
|
var _canUseDom = require("./can-use-dom");
|
|
37
40
|
var _dom = require("./dom");
|
|
38
41
|
const opt = Object.prototype.toString;
|
|
39
42
|
function isArray(obj) {
|
|
40
|
-
return opt.call(obj) ===
|
|
43
|
+
return opt.call(obj) === '[object Array]';
|
|
41
44
|
}
|
|
42
45
|
function isObject(obj) {
|
|
43
|
-
return opt.call(obj) ===
|
|
46
|
+
return opt.call(obj) === '[object Object]';
|
|
44
47
|
}
|
|
45
48
|
function isString(obj) {
|
|
46
|
-
return opt.call(obj) ===
|
|
49
|
+
return opt.call(obj) === '[object String]';
|
|
47
50
|
}
|
|
48
51
|
function isNumber(obj) {
|
|
49
|
-
return opt.call(obj) ===
|
|
52
|
+
return opt.call(obj) === '[object Number]' && obj === obj;
|
|
50
53
|
}
|
|
51
54
|
function isRegExp(obj) {
|
|
52
|
-
return opt.call(obj) ===
|
|
55
|
+
return opt.call(obj) === '[object RegExp]';
|
|
53
56
|
}
|
|
54
57
|
function isFile(obj) {
|
|
55
|
-
return opt.call(obj) ===
|
|
58
|
+
return opt.call(obj) === '[object File]';
|
|
56
59
|
}
|
|
57
60
|
function isBlob(obj) {
|
|
58
|
-
return opt.call(obj) ===
|
|
61
|
+
return opt.call(obj) === '[object Blob]';
|
|
59
62
|
}
|
|
60
63
|
function isHex(color) {
|
|
61
64
|
return /^#[a-fA-F0-9]{3}$|#[a-fA-F0-9]{6}$/.test(color);
|
|
@@ -79,7 +82,7 @@ function isNullOrUndefined(obj) {
|
|
|
79
82
|
return obj === null || obj === undefined;
|
|
80
83
|
}
|
|
81
84
|
function isFunction(obj) {
|
|
82
|
-
return typeof obj ===
|
|
85
|
+
return typeof obj === 'function';
|
|
83
86
|
}
|
|
84
87
|
function isEmptyObject(obj) {
|
|
85
88
|
return isObject(obj) && Object.keys(obj).length === 0;
|
|
@@ -88,7 +91,7 @@ function isEmptyReactNode(content, trim) {
|
|
|
88
91
|
if (content === null || content === undefined || content === false) {
|
|
89
92
|
return true;
|
|
90
93
|
}
|
|
91
|
-
if (typeof content ===
|
|
94
|
+
if (typeof content === 'string' && (trim ? (0, _trim.default)(content).call(content) === '' : content === '')) {
|
|
92
95
|
return true;
|
|
93
96
|
}
|
|
94
97
|
return false;
|
|
@@ -100,10 +103,10 @@ function isWindow(el) {
|
|
|
100
103
|
return el === window;
|
|
101
104
|
}
|
|
102
105
|
function isBoolean(value) {
|
|
103
|
-
return typeof value ===
|
|
106
|
+
return typeof value === 'boolean';
|
|
104
107
|
}
|
|
105
108
|
const isReactComponent = element => {
|
|
106
|
-
return element && /*#__PURE__*/(0, _react.isValidElement)(element) && typeof element.type ===
|
|
109
|
+
return element && /*#__PURE__*/(0, _react.isValidElement)(element) && typeof element.type === 'function';
|
|
107
110
|
};
|
|
108
111
|
exports.isReactComponent = isReactComponent;
|
|
109
112
|
const isClassComponent = element => {
|
|
@@ -114,11 +117,11 @@ const isClassComponent = element => {
|
|
|
114
117
|
// element 是合成的 dom 元素或者字符串,数字等
|
|
115
118
|
exports.isClassComponent = isClassComponent;
|
|
116
119
|
const isDOMElement = element => {
|
|
117
|
-
return /*#__PURE__*/(0, _react.isValidElement)(element) && typeof element.type ===
|
|
120
|
+
return /*#__PURE__*/(0, _react.isValidElement)(element) && typeof element.type === 'string';
|
|
118
121
|
};
|
|
119
122
|
exports.isDOMElement = isDOMElement;
|
|
120
123
|
const isLink = text => {
|
|
121
|
-
return isString(text) && (text.startsWith(
|
|
124
|
+
return isString(text) && (text.startsWith('http') || text.startsWith('https'));
|
|
122
125
|
};
|
|
123
126
|
exports.isLink = isLink;
|
|
124
127
|
async function isImageLinkAvailable(url) {
|
|
@@ -129,8 +132,20 @@ async function isImageLinkAvailable(url) {
|
|
|
129
132
|
img.src = url;
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @zh 检测是否为移动设备
|
|
138
|
+
* @en Detect if it's a mobile device
|
|
139
|
+
*/
|
|
140
|
+
function isMobileDevice() {
|
|
141
|
+
return _dom.clientWindow && /Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|Mobile|IEMobile|Opera Mini/i.test(_dom.clientWindow === null || _dom.clientWindow === void 0 ? void 0 : _dom.clientWindow.navigator.userAgent);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @zh 检测是否为触摸设备
|
|
145
|
+
* @en Detect if it's a touch device
|
|
146
|
+
*/
|
|
147
|
+
function isTouchDevice() {
|
|
148
|
+
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
134
149
|
}
|
|
135
150
|
function isEmail(email) {
|
|
136
151
|
const emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
|
@@ -145,7 +160,7 @@ function isUsPhoneNumber(phone) {
|
|
|
145
160
|
return phoneRegex.test(phone);
|
|
146
161
|
}
|
|
147
162
|
function isPromise(obj) {
|
|
148
|
-
return !!obj && typeof obj ===
|
|
163
|
+
return !!obj && typeof obj === 'object' && typeof obj.then === 'function';
|
|
149
164
|
}
|
|
150
165
|
|
|
151
166
|
/**
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.withNativeProps = withNativeProps;
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _classNames = _interopRequireDefault(require("./classNames"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
10
|
function withNativeProps(props, element) {
|
|
16
|
-
const p =
|
|
11
|
+
const p = {
|
|
12
|
+
...element.props
|
|
13
|
+
};
|
|
17
14
|
if (props.className) {
|
|
18
15
|
p.className = (0, _classNames.default)(element.props.className, props.className);
|
|
19
16
|
}
|
|
20
17
|
if (props.style) {
|
|
21
|
-
p.style =
|
|
18
|
+
p.style = {
|
|
19
|
+
...p.style,
|
|
20
|
+
...props.style
|
|
21
|
+
};
|
|
22
22
|
}
|
|
23
23
|
if (props.tabIndex !== undefined) {
|
|
24
24
|
p.tabIndex = props.tabIndex;
|
|
25
25
|
}
|
|
26
26
|
for (const key in props) {
|
|
27
|
-
if (!
|
|
28
|
-
if (key.startsWith(
|
|
27
|
+
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
28
|
+
if (key.startsWith('data-') || key.startsWith('aria-')) {
|
|
29
29
|
p[key] = props[key];
|
|
30
30
|
}
|
|
31
31
|
}
|
package/dist/lib/utils/omit.js
CHANGED
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = omit;
|
|
7
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
11
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
7
|
// delete keys from object
|
|
13
8
|
function omit(obj, keys) {
|
|
14
|
-
const clone =
|
|
9
|
+
const clone = {
|
|
10
|
+
...obj
|
|
11
|
+
};
|
|
15
12
|
keys.forEach(key => {
|
|
16
13
|
if (key in clone) {
|
|
17
14
|
delete clone[key];
|
package/dist/lib/utils/qrcode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
8
|
var _qrcode = _interopRequireDefault(require("qrcode"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/**
|
|
10
10
|
* 根据入参生成一个二维码
|
|
11
11
|
* @param url 要生成二维码的url
|