@ebscn/ui 1.0.3-beta.1 → 1.0.3-beta.2
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/cjs/components/common-input/common-input.css +28 -0
- package/cjs/components/common-input/common-input.d.ts +27 -0
- package/cjs/components/common-input/common-input.js +88 -0
- package/cjs/components/common-input/index.d.ts +4 -0
- package/cjs/components/common-input/index.js +9 -0
- package/cjs/components/fene-input/fene-input.css +35 -0
- package/cjs/components/fene-input/fene-input.d.ts +14 -0
- package/cjs/components/fene-input/fene-input.js +63 -0
- package/cjs/components/fene-input/index.d.ts +4 -0
- package/cjs/components/fene-input/index.js +9 -0
- package/cjs/components/input/index.d.ts +4 -0
- package/cjs/components/input/index.js +9 -0
- package/cjs/components/input/input.css +96 -0
- package/cjs/components/input/input.d.ts +41 -0
- package/cjs/components/input/input.js +161 -0
- package/cjs/components/marketTag/marketTag.css +4 -4
- package/cjs/components/money-input/index.d.ts +4 -0
- package/cjs/components/money-input/index.js +9 -0
- package/cjs/components/money-input/money-input.css +35 -0
- package/cjs/components/money-input/money-input.d.ts +27 -0
- package/cjs/components/money-input/money-input.js +111 -0
- package/cjs/components/passcode-input/index.d.ts +4 -0
- package/cjs/components/passcode-input/index.js +9 -0
- package/cjs/components/passcode-input/passcode-input.css +136 -0
- package/cjs/components/passcode-input/passcode-input.d.ts +40 -0
- package/cjs/components/passcode-input/passcode-input.js +136 -0
- package/cjs/components/pay-input/index.d.ts +4 -0
- package/cjs/components/pay-input/index.js +10 -0
- package/cjs/components/pay-input/pay-input.css +136 -0
- package/cjs/components/pay-input/pay-input.d.ts +14 -0
- package/cjs/components/pay-input/pay-input.js +126 -0
- package/cjs/components/virtual-input/index.d.ts +4 -0
- package/cjs/components/virtual-input/index.js +9 -0
- package/cjs/components/virtual-input/virtual-input.css +99 -0
- package/cjs/components/virtual-input/virtual-input.d.ts +45 -0
- package/cjs/components/virtual-input/virtual-input.js +145 -0
- package/cjs/index.d.ts +5 -0
- package/cjs/index.js +41 -1
- package/es/components/common-input/common-input.css +28 -0
- package/es/components/common-input/common-input.d.ts +27 -0
- package/es/components/common-input/common-input.js +80 -0
- package/es/components/common-input/index.d.ts +4 -0
- package/es/components/common-input/index.js +3 -0
- package/es/components/fene-input/fene-input.css +35 -0
- package/es/components/fene-input/fene-input.d.ts +14 -0
- package/es/components/fene-input/fene-input.js +56 -0
- package/es/components/fene-input/index.d.ts +4 -0
- package/es/components/fene-input/index.js +3 -0
- package/es/components/input/index.d.ts +4 -0
- package/es/components/input/index.js +3 -0
- package/es/components/input/input.css +96 -0
- package/es/components/input/input.d.ts +41 -0
- package/es/components/input/input.js +152 -0
- package/es/components/marketTag/marketTag.css +4 -4
- package/es/components/money-input/index.d.ts +4 -0
- package/es/components/money-input/index.js +3 -0
- package/es/components/money-input/money-input.css +35 -0
- package/es/components/money-input/money-input.d.ts +27 -0
- package/es/components/money-input/money-input.js +103 -0
- package/es/components/passcode-input/index.d.ts +4 -0
- package/es/components/passcode-input/index.js +3 -0
- package/es/components/passcode-input/passcode-input.css +136 -0
- package/es/components/passcode-input/passcode-input.d.ts +40 -0
- package/es/components/passcode-input/passcode-input.js +127 -0
- package/es/components/pay-input/index.d.ts +4 -0
- package/es/components/pay-input/index.js +3 -0
- package/es/components/pay-input/pay-input.css +136 -0
- package/es/components/pay-input/pay-input.d.ts +14 -0
- package/es/components/pay-input/pay-input.js +115 -0
- package/es/components/virtual-input/index.d.ts +4 -0
- package/es/components/virtual-input/index.js +3 -0
- package/es/components/virtual-input/virtual-input.css +99 -0
- package/es/components/virtual-input/virtual-input.d.ts +45 -0
- package/es/components/virtual-input/virtual-input.js +134 -0
- package/es/index.d.ts +5 -0
- package/es/index.js +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import { VirtualInputProps } from "../virtual-input/virtual-input";
|
|
4
|
+
type tipProps = {
|
|
5
|
+
isShowTip: boolean;
|
|
6
|
+
tipComponent: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
type unitProps = {
|
|
9
|
+
isShowUnit: boolean;
|
|
10
|
+
unitComponent: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type MoneyInputProps = {
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onChange?: (val: string) => void;
|
|
16
|
+
isShowUnit?: boolean;
|
|
17
|
+
isShowLine: boolean;
|
|
18
|
+
tipProps?: tipProps;
|
|
19
|
+
unitProps?: unitProps;
|
|
20
|
+
clearable: boolean;
|
|
21
|
+
inputProps?: VirtualInputProps;
|
|
22
|
+
inputleftComponent?: React.ReactNode;
|
|
23
|
+
prefixComponent?: React.ReactNode;
|
|
24
|
+
suffixComponent?: React.ReactNode;
|
|
25
|
+
} & NativeProps;
|
|
26
|
+
export declare function MoneyInput(p: MoneyInputProps): JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MoneyInput = MoneyInput;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _nativeProps = require("../../utils/native-props");
|
|
9
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
10
|
+
var _tip = _interopRequireDefault(require("./demos/component/tip"));
|
|
11
|
+
var _usePropsValue = require("@ebscn/ui/utils/use-props-value");
|
|
12
|
+
var _virtualInput = require("../virtual-input/virtual-input");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
// import cns from "classnames";
|
|
17
|
+
// import { useEffect, useRef } from "react";
|
|
18
|
+
// import React from "react";
|
|
19
|
+
// import { VirtualInputProps, VirtualInput } from "../virtual-input/virtual-input";
|
|
20
|
+
// import { NativeProps, withNativeProps } from '../../utils/native-props'
|
|
21
|
+
// import { mergeProps } from '../../utils/with-default-props'
|
|
22
|
+
// import TitleLeft from "./demos/component/title-left";
|
|
23
|
+
// import TitleRight from "./demos/component/title-right";
|
|
24
|
+
// import InputLeft from "./demos/component/input-left";
|
|
25
|
+
// import InputRight from "./demos/component/input-right";
|
|
26
|
+
// import Tip from "./demos/component/tip";
|
|
27
|
+
// import Footer from "./demos/component/footer";
|
|
28
|
+
// import Content from "./demos/component/content";
|
|
29
|
+
// const classPrefix = 'ebscn-money-input'
|
|
30
|
+
// export type MoneyInputProps = {
|
|
31
|
+
// titleLeftComponent?: React.ReactNode
|
|
32
|
+
// titleRightComponent?: React.ReactNode
|
|
33
|
+
// inputProps?: VirtualInputProps
|
|
34
|
+
// inputleftComponent?: React.ReactNode
|
|
35
|
+
// inputrightComponent?: React.ReactNode
|
|
36
|
+
// tipComponent?: React.ReactNode
|
|
37
|
+
// contentComponent?: React.ReactNode
|
|
38
|
+
// footerComponent?: React.ReactNode
|
|
39
|
+
// } & NativeProps;
|
|
40
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
41
|
+
__assign = Object.assign || function (t) {
|
|
42
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
43
|
+
s = arguments[i];
|
|
44
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
};
|
|
48
|
+
return __assign.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
var classPrefix = 'ebscn-money-input';
|
|
51
|
+
var defaultProps = {
|
|
52
|
+
// inputleftComponent: <InputLeft></InputLeft>,
|
|
53
|
+
tipComponent: _react.default.createElement(_tip.default, null),
|
|
54
|
+
defaultValue: ''
|
|
55
|
+
};
|
|
56
|
+
function MoneyInput(p) {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
var props = (0, _withDefaultProps.mergeProps)(p, defaultProps);
|
|
59
|
+
var _d = (0, _usePropsValue.usePropsValue)(props),
|
|
60
|
+
value = _d[0],
|
|
61
|
+
setValue = _d[1];
|
|
62
|
+
var _e = (0, _react.useState)('#ebebeb'),
|
|
63
|
+
color = _e[0],
|
|
64
|
+
setColor = _e[1];
|
|
65
|
+
var _f = (0, _react.useState)(false),
|
|
66
|
+
showTip = _f[0],
|
|
67
|
+
setShowTip = _f[1];
|
|
68
|
+
var _g = (0, _react.useState)(true),
|
|
69
|
+
clearable = _g[0],
|
|
70
|
+
setClearable = _g[1];
|
|
71
|
+
console.log(p, 'CommonProp');
|
|
72
|
+
function changeColor(isShowLine, color) {
|
|
73
|
+
if (isShowLine) {
|
|
74
|
+
setColor(color);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// const {titleLeftComponent,inputProps,} = props
|
|
78
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
79
|
+
className: "".concat(classPrefix)
|
|
80
|
+
}, _react.default.createElement("div", {
|
|
81
|
+
className: "".concat(classPrefix, "-middleArea"),
|
|
82
|
+
style: {
|
|
83
|
+
'borderBottomColor': "".concat(((_a = props.tipProps) === null || _a === void 0 ? void 0 : _a.isShowTip) ? 'red' : color)
|
|
84
|
+
}
|
|
85
|
+
}, _react.default.createElement("div", {
|
|
86
|
+
className: "".concat(classPrefix, "-middleArea-inputArea")
|
|
87
|
+
}, props.prefixComponent, props.inputleftComponent, _react.default.createElement(_virtualInput.VirtualInput, __assign({
|
|
88
|
+
onFocus: function () {
|
|
89
|
+
changeColor(props.isShowLine, 'blue');
|
|
90
|
+
},
|
|
91
|
+
onBlur: function () {
|
|
92
|
+
changeColor(props.isShowLine, '#ebebeb');
|
|
93
|
+
},
|
|
94
|
+
value: value
|
|
95
|
+
}, props.inputProps, {
|
|
96
|
+
onChange: function (val) {
|
|
97
|
+
var _a;
|
|
98
|
+
console.log((_a = props.tipProps) === null || _a === void 0 ? void 0 : _a.isShowTip, 'isShowTIP');
|
|
99
|
+
// props.tipProps?.isShowTip ? setColor('red') : setColor('blue')
|
|
100
|
+
setValue(val);
|
|
101
|
+
}
|
|
102
|
+
}, props.inputProps)), props.suffixComponent), ((_b = props.unitProps) === null || _b === void 0 ? void 0 : _b.isShowUnit) ? _react.default.createElement("div", {
|
|
103
|
+
className: "".concat(classPrefix, "-middleArea-unitBox")
|
|
104
|
+
}, _react.default.createElement("div", {
|
|
105
|
+
className: "".concat(classPrefix, "-middleArea-unitBox-line")
|
|
106
|
+
}), _react.default.createElement("div", {
|
|
107
|
+
className: "".concat(classPrefix, "-middleArea-unitBox-unit")
|
|
108
|
+
}, props.unitProps.unitComponent)) : _react.default.createElement(_react.default.Fragment, null)), ((_c = props.tipProps) === null || _c === void 0 ? void 0 : _c.isShowTip) ? _react.default.createElement("div", {
|
|
109
|
+
className: "".concat(classPrefix, "-tipArea")
|
|
110
|
+
}, props.tipProps.tipComponent) : _react.default.createElement(_react.default.Fragment, null)));
|
|
111
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("./passcode-input.css");
|
|
8
|
+
var _passcodeInput2 = require("./passcode-input");
|
|
9
|
+
var _default = exports.default = _passcodeInput2.PasscodeInput;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
.ebscn-passcode-input {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
--cell-size: 50px;
|
|
5
|
+
--cell-gap: 10px;
|
|
6
|
+
--dot-size: 10px;
|
|
7
|
+
--border-radius: 12px;
|
|
8
|
+
}
|
|
9
|
+
.ebscn-passcode-input-cell-container {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
vertical-align: top;
|
|
12
|
+
}
|
|
13
|
+
.ebscn-passcode-input-cell {
|
|
14
|
+
flex: none;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
font-size: var(--adm-font-size-10);
|
|
20
|
+
width: var(--cell-size);
|
|
21
|
+
height: var(--cell-size);
|
|
22
|
+
background: var(--adm-color-background);
|
|
23
|
+
background-color: #f5f5f5;
|
|
24
|
+
}
|
|
25
|
+
.ebscn-passcode-input:not(.ebscn-passcode-input-seperated) {
|
|
26
|
+
border-radius: var(--border-radius);
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
border: 1px solid var(--border-color);
|
|
29
|
+
}
|
|
30
|
+
.ebscn-passcode-input:not(.ebscn-passcode-input-seperated) .ebscn-passcode-input-cell:not(:last-child) {
|
|
31
|
+
border-right: 1px solid var(--border-color);
|
|
32
|
+
}
|
|
33
|
+
.ebscn-passcode-input:not(.ebscn-passcode-input-seperated).ebscn-passcode-input-focused {
|
|
34
|
+
border-color: var(--adm-color-primary);
|
|
35
|
+
box-shadow: 0 0 2px 0 var(--adm-color-primary);
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
.ebscn-passcode-input:not(.ebscn-passcode-input-seperated).ebscn-passcode-input-error {
|
|
39
|
+
border-color: var(--adm-color-danger);
|
|
40
|
+
box-shadow: 0 0 2px 0 var(--adm-color-danger);
|
|
41
|
+
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
42
|
+
}
|
|
43
|
+
.ebscn-passcode-input.ebscn-passcode-input-seperated .ebscn-passcode-input-cell {
|
|
44
|
+
border-radius: var(--border-radius);
|
|
45
|
+
border: 1px solid var(--border-color);
|
|
46
|
+
}
|
|
47
|
+
.ebscn-passcode-input.ebscn-passcode-input-seperated .ebscn-passcode-input-cell:not(:last-child) {
|
|
48
|
+
margin-right: var(--cell-gap);
|
|
49
|
+
}
|
|
50
|
+
.ebscn-passcode-input.ebscn-passcode-input-seperated .ebscn-passcode-input-cell-focused {
|
|
51
|
+
border-color: var(--adm-color-primary);
|
|
52
|
+
box-shadow: 0 0 2px 0 var(--adm-color-primary);
|
|
53
|
+
}
|
|
54
|
+
.ebscn-passcode-input-seperated.ebscn-passcode-input-focused {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
57
|
+
.ebscn-passcode-input.ebscn-passcode-input-seperated.ebscn-passcode-input-error {
|
|
58
|
+
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
59
|
+
}
|
|
60
|
+
.ebscn-passcode-input.ebscn-passcode-input-seperated.ebscn-passcode-input-error .ebscn-passcode-input-cell {
|
|
61
|
+
border-color: var(--adm-color-danger);
|
|
62
|
+
box-shadow: 0 0 2px 0 var(--adm-color-danger);
|
|
63
|
+
}
|
|
64
|
+
.ebscn-passcode-input-cell-dot::before {
|
|
65
|
+
content: '';
|
|
66
|
+
width: var(--dot-size);
|
|
67
|
+
height: var(--dot-size);
|
|
68
|
+
border-radius: 100%;
|
|
69
|
+
background: var(--adm-color-text);
|
|
70
|
+
}
|
|
71
|
+
.ebscn-passcode-input-cell-caret::after {
|
|
72
|
+
content: '';
|
|
73
|
+
width: 2px;
|
|
74
|
+
height: 1.1em;
|
|
75
|
+
margin-left: 1px;
|
|
76
|
+
background: var(--adm-color-primary);
|
|
77
|
+
animation: 1s linear infinite adm-caret-blink;
|
|
78
|
+
}
|
|
79
|
+
.ebscn-passcode-input > .ebscn-passcode-input-native-input {
|
|
80
|
+
position: absolute;
|
|
81
|
+
left: -200vw;
|
|
82
|
+
top: 0;
|
|
83
|
+
display: block;
|
|
84
|
+
width: 50px;
|
|
85
|
+
height: 20px;
|
|
86
|
+
opacity: 0.5;
|
|
87
|
+
}
|
|
88
|
+
@keyframes adm-shake-horizontal {
|
|
89
|
+
0% {
|
|
90
|
+
transform: translateX(0);
|
|
91
|
+
}
|
|
92
|
+
10% {
|
|
93
|
+
transform: translateX(-4px);
|
|
94
|
+
}
|
|
95
|
+
20% {
|
|
96
|
+
transform: translateX(5px);
|
|
97
|
+
}
|
|
98
|
+
30% {
|
|
99
|
+
transform: translateX(-1px);
|
|
100
|
+
}
|
|
101
|
+
40% {
|
|
102
|
+
transform: translateX(8px);
|
|
103
|
+
}
|
|
104
|
+
50% {
|
|
105
|
+
transform: translateX(0);
|
|
106
|
+
}
|
|
107
|
+
60% {
|
|
108
|
+
transform: translateX(-8px);
|
|
109
|
+
}
|
|
110
|
+
70% {
|
|
111
|
+
transform: translateX(1px);
|
|
112
|
+
}
|
|
113
|
+
80% {
|
|
114
|
+
transform: translateX(-5px);
|
|
115
|
+
}
|
|
116
|
+
90% {
|
|
117
|
+
transform: translateX(4px);
|
|
118
|
+
}
|
|
119
|
+
100% {
|
|
120
|
+
transform: translateX(0);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
@keyframes adm-caret-blink {
|
|
124
|
+
from {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
}
|
|
127
|
+
60% {
|
|
128
|
+
opacity: 1;
|
|
129
|
+
}
|
|
130
|
+
80% {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
to {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import { NativeProps } from '../../utils/native-props';
|
|
4
|
+
import type { NumberKeyboardProps } from '../number-keyboard';
|
|
5
|
+
export type PasscodeInputProps = {
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onChange?: (val: string) => void;
|
|
9
|
+
length?: number;
|
|
10
|
+
plain?: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
caret?: boolean;
|
|
13
|
+
seperated?: boolean;
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
onFocus?: () => void;
|
|
16
|
+
keyboard?: ReactElement<NumberKeyboardProps>;
|
|
17
|
+
onFill?: (val: string) => void;
|
|
18
|
+
} & NativeProps<'--cell-gap' | '--cell-size' | '--dot-size' | '--border-color' | '--border-radius'>;
|
|
19
|
+
export type PasscodeInputRef = {
|
|
20
|
+
focus: () => void;
|
|
21
|
+
blur: () => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const PasscodeInput: React.ForwardRefExoticComponent<{
|
|
24
|
+
value?: string | undefined;
|
|
25
|
+
defaultValue?: string | undefined;
|
|
26
|
+
onChange?: ((val: string) => void) | undefined;
|
|
27
|
+
length?: number | undefined;
|
|
28
|
+
plain?: boolean | undefined;
|
|
29
|
+
error?: boolean | undefined;
|
|
30
|
+
caret?: boolean | undefined;
|
|
31
|
+
seperated?: boolean | undefined;
|
|
32
|
+
onBlur?: (() => void) | undefined;
|
|
33
|
+
onFocus?: (() => void) | undefined;
|
|
34
|
+
keyboard?: React.ReactElement<NumberKeyboardProps, string | React.JSXElementConstructor<any>> | undefined;
|
|
35
|
+
onFill?: ((val: string) => void) | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
className?: string | undefined;
|
|
38
|
+
style?: (React.CSSProperties & Partial<Record<"--border-color" | "--dot-size" | "--border-radius" | "--cell-gap" | "--cell-size", string>>) | undefined;
|
|
39
|
+
tabIndex?: number | undefined;
|
|
40
|
+
} & React.AriaAttributes & React.RefAttributes<PasscodeInputRef>>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PasscodeInput = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
9
|
+
var _nativeProps = require("../../utils/native-props");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _bound = require("../../utils/bound");
|
|
12
|
+
var _usePropsValue = require("../../utils/use-props-value");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
var classPrefix = 'ebscn-passcode-input';
|
|
17
|
+
var defaultProps = {
|
|
18
|
+
defaultValue: '',
|
|
19
|
+
length: 6,
|
|
20
|
+
plain: false,
|
|
21
|
+
error: false,
|
|
22
|
+
seperated: false,
|
|
23
|
+
caret: true
|
|
24
|
+
};
|
|
25
|
+
var PasscodeInput = exports.PasscodeInput = (0, _react.forwardRef)(function (p, ref) {
|
|
26
|
+
var _a;
|
|
27
|
+
var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
28
|
+
// 防止 length 值不合法
|
|
29
|
+
var cellLength = props.length > 0 && props.length < Infinity ? Math.floor(props.length) : defaultProps.length;
|
|
30
|
+
var _b = (0, _react.useState)(false),
|
|
31
|
+
focused = _b[0],
|
|
32
|
+
setFocused = _b[1];
|
|
33
|
+
var _c = (0, _usePropsValue.usePropsValue)(props),
|
|
34
|
+
value = _c[0],
|
|
35
|
+
setValue = _c[1];
|
|
36
|
+
var rootRef = (0, _react.useRef)(null);
|
|
37
|
+
var nativeInputRef = (0, _react.useRef)(null);
|
|
38
|
+
(0, _react.useEffect)(function () {
|
|
39
|
+
var _a;
|
|
40
|
+
if (value.length >= cellLength) {
|
|
41
|
+
(_a = props.onFill) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
42
|
+
}
|
|
43
|
+
}, [value, cellLength]);
|
|
44
|
+
var onFocus = function () {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
if (!props.keyboard) {
|
|
47
|
+
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
48
|
+
}
|
|
49
|
+
setFocused(true);
|
|
50
|
+
(_b = props.onFocus) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
51
|
+
};
|
|
52
|
+
(0, _react.useEffect)(function () {
|
|
53
|
+
if (!focused) return;
|
|
54
|
+
var timeout = window.setTimeout(function () {
|
|
55
|
+
var _a;
|
|
56
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
57
|
+
block: 'center',
|
|
58
|
+
inline: 'center',
|
|
59
|
+
behavior: 'smooth'
|
|
60
|
+
});
|
|
61
|
+
}, 100);
|
|
62
|
+
return function () {
|
|
63
|
+
window.clearTimeout(timeout);
|
|
64
|
+
};
|
|
65
|
+
}, [focused]);
|
|
66
|
+
var onBlur = function () {
|
|
67
|
+
var _a;
|
|
68
|
+
setFocused(false);
|
|
69
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
70
|
+
};
|
|
71
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
72
|
+
return {
|
|
73
|
+
focus: function () {
|
|
74
|
+
var _a;
|
|
75
|
+
return (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
76
|
+
},
|
|
77
|
+
blur: function () {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
80
|
+
(_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
var renderCells = function () {
|
|
85
|
+
var _a;
|
|
86
|
+
var cells = [];
|
|
87
|
+
var chars = value.split('');
|
|
88
|
+
var caretIndex = chars.length; // 光标位置index等于当前文字长度
|
|
89
|
+
var focusedIndex = (0, _bound.bound)(chars.length, 0, cellLength - 1);
|
|
90
|
+
for (var i = 0; i < cellLength; i++) {
|
|
91
|
+
cells.push(_react.default.createElement("div", {
|
|
92
|
+
className: (0, _classnames.default)("".concat(classPrefix, "-cell"), (_a = {}, _a["".concat(classPrefix, "-cell-caret")] = props.caret && caretIndex === i && focused, _a["".concat(classPrefix, "-cell-focused")] = focusedIndex === i && focused, _a["".concat(classPrefix, "-cell-dot")] = !props.plain && chars[i], _a)),
|
|
93
|
+
key: i
|
|
94
|
+
}, chars[i] && props.plain ? chars[i] : ''));
|
|
95
|
+
}
|
|
96
|
+
return cells;
|
|
97
|
+
};
|
|
98
|
+
var cls = (0, _classnames.default)(classPrefix, (_a = {}, _a["".concat(classPrefix, "-focused")] = focused, _a["".concat(classPrefix, "-error")] = props.error, _a["".concat(classPrefix, "-seperated")] = props.seperated, _a));
|
|
99
|
+
return _react.default.createElement(_react.default.Fragment, null, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
100
|
+
ref: rootRef,
|
|
101
|
+
tabIndex: 0,
|
|
102
|
+
className: cls,
|
|
103
|
+
onFocus: onFocus,
|
|
104
|
+
onBlur: onBlur,
|
|
105
|
+
role: 'button'
|
|
106
|
+
}, _react.default.createElement("div", {
|
|
107
|
+
className: "".concat(classPrefix, "-cell-container")
|
|
108
|
+
}, renderCells()), _react.default.createElement("input", {
|
|
109
|
+
ref: nativeInputRef,
|
|
110
|
+
className: "".concat(classPrefix, "-native-input"),
|
|
111
|
+
value: value,
|
|
112
|
+
type: 'text',
|
|
113
|
+
pattern: '[0-9]*',
|
|
114
|
+
inputMode: 'numeric',
|
|
115
|
+
onChange: function (e) {
|
|
116
|
+
setValue(e.target.value.slice(0, props.length));
|
|
117
|
+
},
|
|
118
|
+
"aria-hidden": true
|
|
119
|
+
}))), props.keyboard && _react.default.cloneElement(props.keyboard, {
|
|
120
|
+
visible: focused,
|
|
121
|
+
onInput: function (v) {
|
|
122
|
+
if (value.length < cellLength) {
|
|
123
|
+
setValue((value + v).slice(0, props.length));
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
onDelete: function () {
|
|
127
|
+
setValue(value.slice(0, -1));
|
|
128
|
+
},
|
|
129
|
+
onClose: function () {
|
|
130
|
+
var _a;
|
|
131
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
132
|
+
},
|
|
133
|
+
onClean: function () {},
|
|
134
|
+
onConfirm: function () {}
|
|
135
|
+
}));
|
|
136
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _payInput = _interopRequireDefault(require("./pay-input"));
|
|
8
|
+
require("./pay-input.css");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
var _default = exports.default = _payInput.default;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
.ebscn-pay-input {
|
|
2
|
+
background: #ffffff;
|
|
3
|
+
border-radius: 10px 10px 0px 0px;
|
|
4
|
+
padding: 0 16px;
|
|
5
|
+
padding-bottom: 216px;
|
|
6
|
+
}
|
|
7
|
+
.ebscn-pay-input-topArea {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
height: 65px;
|
|
12
|
+
}
|
|
13
|
+
.ebscn-pay-input-topArea-cancel {
|
|
14
|
+
position: absolute;
|
|
15
|
+
left: 10px;
|
|
16
|
+
align-self: center;
|
|
17
|
+
background: url('./images/common_icon_cancel.png') no-repeat center / 100%;
|
|
18
|
+
height: 28px;
|
|
19
|
+
width: 28px;
|
|
20
|
+
}
|
|
21
|
+
.ebscn-pay-input-topArea-title {
|
|
22
|
+
align-self: center;
|
|
23
|
+
font-size: 18px;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
text-align: center;
|
|
26
|
+
color: #333333;
|
|
27
|
+
}
|
|
28
|
+
.ebscn-pay-input-moneyBox {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
.ebscn-pay-input-moneyBox-moneyTitle {
|
|
34
|
+
margin-top: 13.5px;
|
|
35
|
+
margin-bottom: 8px;
|
|
36
|
+
font-size: 16px;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
color: #333333;
|
|
39
|
+
line-height: 22px;
|
|
40
|
+
}
|
|
41
|
+
.ebscn-pay-input-moneyBox-moneyArea {
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
.ebscn-pay-input-moneyBox-moneyArea-moneyTip {
|
|
45
|
+
font-size: 28px;
|
|
46
|
+
font-family: GD;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
color: #333333;
|
|
49
|
+
line-height: 50px;
|
|
50
|
+
}
|
|
51
|
+
.ebscn-pay-input-moneyBox-moneyArea-moneyText {
|
|
52
|
+
margin-left: 10px;
|
|
53
|
+
margin-bottom: 31px;
|
|
54
|
+
font-size: 28px;
|
|
55
|
+
font-family: GD;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
color: #333333;
|
|
58
|
+
line-height: 50px;
|
|
59
|
+
}
|
|
60
|
+
.ebscn-pay-input-moneyBox-cashCard {
|
|
61
|
+
width: 100%;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
margin-bottom: 32px;
|
|
66
|
+
}
|
|
67
|
+
.ebscn-pay-input-moneyBox-cashCard div:first-child {
|
|
68
|
+
font-size: 16px;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
color: #666666;
|
|
71
|
+
line-height: 22px;
|
|
72
|
+
}
|
|
73
|
+
.ebscn-pay-input-moneyBox-cashCard div:nth-child(2) {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: row;
|
|
76
|
+
}
|
|
77
|
+
.ebscn-pay-input-moneyBox-cashCard div:nth-child(2)-cardIcon {
|
|
78
|
+
margin-top: 3px;
|
|
79
|
+
width: 20px;
|
|
80
|
+
height: 20px;
|
|
81
|
+
}
|
|
82
|
+
.ebscn-pay-input-moneyBox-cashCard div:nth-child(2)-cardText {
|
|
83
|
+
margin-left: 8px;
|
|
84
|
+
font-size: 16px;
|
|
85
|
+
font-family: PingFang SC, PingFang SC-Regular;
|
|
86
|
+
font-weight: 400;
|
|
87
|
+
color: #333333;
|
|
88
|
+
line-height: 22px;
|
|
89
|
+
}
|
|
90
|
+
.ebscn-pay-input-password {
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
padding: 0 16px;
|
|
94
|
+
}
|
|
95
|
+
.ebscn-pay-input-inputBox {
|
|
96
|
+
width: 100%;
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: row;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
}
|
|
101
|
+
.ebscn-pay-input-inputBox .pwdItem {
|
|
102
|
+
width: 47px;
|
|
103
|
+
height: 47px;
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
background: #f5f5f5;
|
|
108
|
+
border-radius: 8px;
|
|
109
|
+
}
|
|
110
|
+
.ebscn-pay-input-inputBox .pwdItem .circle {
|
|
111
|
+
font-size: 40px;
|
|
112
|
+
}
|
|
113
|
+
.ebscn-pay-input-pwdTip {
|
|
114
|
+
margin-top: 13px;
|
|
115
|
+
margin-bottom: 23px;
|
|
116
|
+
position: relative;
|
|
117
|
+
right: 0;
|
|
118
|
+
font-size: 17px;
|
|
119
|
+
font-weight: 400;
|
|
120
|
+
text-align: right;
|
|
121
|
+
color: #4c7cf1;
|
|
122
|
+
line-height: 24px;
|
|
123
|
+
}
|
|
124
|
+
.ebscn-pay-input-forgetpassword {
|
|
125
|
+
color: #4c7cf1;
|
|
126
|
+
font-size: 17px;
|
|
127
|
+
text-align: right;
|
|
128
|
+
line-height: 24px;
|
|
129
|
+
margin-top: 17.5px;
|
|
130
|
+
margin-bottom: 12px;
|
|
131
|
+
}
|
|
132
|
+
.ebscn-pay-input :global .adm-passcode-input-cell {
|
|
133
|
+
width: 94px;
|
|
134
|
+
height: 94px;
|
|
135
|
+
background-color: #f5f5f5;
|
|
136
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NativeProps } from '@ebscn/ui/utils/native-props';
|
|
3
|
+
export type PayInputProps = {
|
|
4
|
+
money: string;
|
|
5
|
+
bankInfo: {
|
|
6
|
+
bankImg: string;
|
|
7
|
+
bankName: string;
|
|
8
|
+
bank_code: string;
|
|
9
|
+
accountNo: string;
|
|
10
|
+
};
|
|
11
|
+
onCancel: Function;
|
|
12
|
+
onSubmit: Function;
|
|
13
|
+
} & NativeProps;
|
|
14
|
+
export default function PayInput(props: PayInputProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|