@trionesdev/antd-taro-react 0.0.2-beta.2 → 0.0.2-beta.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/Button/button.d.ts +2 -1
- package/dist/Button/style.scss +49 -45
- package/dist/Calendar/style.scss +4 -4
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +22 -19
- package/dist/CalendarDatetimePicker/style.scss +12 -4
- package/dist/CalendarPicker/calendar-picker.js +2 -1
- package/dist/CalendarPicker/style.scss +5 -5
- package/dist/Form/FormItem/form-item-input.d.ts +15 -0
- package/dist/Form/FormItem/form-item-input.js +39 -0
- package/dist/Form/FormItem/form-item-label.d.ts +13 -0
- package/dist/Form/FormItem/form-item-label.js +35 -0
- package/dist/Form/FormItem/form-item.d.ts +22 -0
- package/dist/Form/FormItem/form-item.js +73 -0
- package/dist/Form/FormItem/index.d.ts +5 -0
- package/dist/Form/FormItem/index.js +3 -0
- package/dist/Form/index.d.ts +8 -1
- package/dist/Form/index.js +5 -1
- package/dist/Form/style.scss +78 -0
- package/dist/ImagesPreview/ImagesPreview.js +2 -1
- package/dist/ImagesWall/ImagesWall.js +1 -1
- package/dist/Input/index.d.ts +17 -2
- package/dist/Input/index.js +13 -1
- package/dist/Input/index.scss +267 -0
- package/dist/Input/input-affix-wrapper.d.ts +13 -0
- package/dist/Input/input-affix-wrapper.js +37 -0
- package/dist/Input/input-digit.d.ts +7 -0
- package/dist/Input/input-digit.js +53 -0
- package/dist/Input/input-number.d.ts +7 -0
- package/dist/Input/input-number.js +50 -0
- package/dist/Input/input-opt.d.ts +16 -0
- package/dist/Input/input-opt.js +87 -0
- package/dist/Input/input-password.d.ts +8 -0
- package/dist/Input/input-password.js +49 -0
- package/dist/Input/input.d.ts +3 -0
- package/dist/Input/input.js +7 -0
- package/dist/Input/taro-input.d.ts +8 -0
- package/dist/Input/taro-input.js +54 -0
- package/dist/Input/textarea.d.ts +15 -0
- package/dist/Input/textarea.js +52 -0
- package/dist/Input/types.d.ts +19 -0
- package/dist/Input/types.js +2 -0
- package/dist/Popup/Popup.d.ts +3 -0
- package/dist/Popup/Popup.js +29 -0
- package/dist/Popup/index.d.ts +2 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Progress/Progress.d.ts +2 -1
- package/dist/Progress/Progress.js +3 -0
- package/dist/Progress/ProgressCircle.d.ts +1 -1
- package/dist/Progress/ProgressCircle.js +21 -26
- package/dist/Progress/ProgressLine.d.ts +1 -1
- package/dist/Progress/types.d.ts +2 -0
- package/dist/SideBar/style.scss +6 -6
- package/dist/VerificationCodeInput/index.d.ts +2 -2
- package/dist/VerificationCodeInput/index.js +1 -1
- package/dist/VerificationCodeInput/style.scss +20 -0
- package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
- package/dist/VerificationCodeInput/verification-code-input.js +99 -0
- package/dist/index.d.ts +1 -1
- package/dist/style/variable.scss +19 -0
- package/dist/types.d.ts +0 -1
- package/package.json +21 -21
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
9
|
+
import "./index.scss";
|
|
10
|
+
var cls = 'triones-antm-pot';
|
|
11
|
+
var inputCls = 'triones-antm-input';
|
|
12
|
+
var InputOPTItem = function InputOPTItem(_ref) {
|
|
13
|
+
var index = _ref.index,
|
|
14
|
+
focusIndex = _ref.focusIndex,
|
|
15
|
+
value = _ref.value,
|
|
16
|
+
onFocus = _ref.onFocus;
|
|
17
|
+
var ref = React.useRef(null);
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
ref: ref,
|
|
20
|
+
className: classNames("".concat(inputCls), "".concat(cls, "-item"), "".concat(inputCls, "-outlined")),
|
|
21
|
+
onClick: function onClick() {
|
|
22
|
+
onFocus === null || onFocus === void 0 || onFocus(index);
|
|
23
|
+
}
|
|
24
|
+
}, value);
|
|
25
|
+
};
|
|
26
|
+
export var InputOPT = function InputOPT(_ref2) {
|
|
27
|
+
var className = _ref2.className,
|
|
28
|
+
style = _ref2.style,
|
|
29
|
+
_ref2$length = _ref2.length,
|
|
30
|
+
length = _ref2$length === void 0 ? 6 : _ref2$length,
|
|
31
|
+
value = _ref2.value,
|
|
32
|
+
_onChange = _ref2.onChange;
|
|
33
|
+
var inputRef = useRef();
|
|
34
|
+
var _useState = useState(value || ''),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
inputValue = _useState2[0],
|
|
37
|
+
setInputValue = _useState2[1];
|
|
38
|
+
var _React$useState = React.useState(Array.from({
|
|
39
|
+
length: length
|
|
40
|
+
}).map(function () {
|
|
41
|
+
return '';
|
|
42
|
+
})),
|
|
43
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
44
|
+
optValue = _React$useState2[0],
|
|
45
|
+
setOptValue = _React$useState2[1];
|
|
46
|
+
var _useState3 = useState(0),
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
focusIndex = _useState4[0],
|
|
49
|
+
setFocusIndex = _useState4[1];
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
setOptValue(Array.from(inputValue !== null && inputValue !== void 0 ? inputValue : ''));
|
|
52
|
+
}, [inputValue]);
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classNames(cls, className),
|
|
55
|
+
style: style
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: classNames("".concat(cls, "-wrapper")),
|
|
58
|
+
onClick: function onClick() {
|
|
59
|
+
var _inputRef$current;
|
|
60
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
61
|
+
}
|
|
62
|
+
}, Array.from({
|
|
63
|
+
length: length
|
|
64
|
+
}).map(function (_, index) {
|
|
65
|
+
return /*#__PURE__*/React.createElement(InputOPTItem, {
|
|
66
|
+
key: index,
|
|
67
|
+
index: index,
|
|
68
|
+
focusIndex: focusIndex,
|
|
69
|
+
value: (optValue === null || optValue === void 0 ? void 0 : optValue[index]) || '',
|
|
70
|
+
onFocus: function onFocus(index) {
|
|
71
|
+
setFocusIndex(index);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
})), /*#__PURE__*/React.createElement("input", {
|
|
75
|
+
ref: inputRef,
|
|
76
|
+
className: "".concat(cls, "-input"),
|
|
77
|
+
type: "number",
|
|
78
|
+
value: inputValue,
|
|
79
|
+
onChange: function onChange(e) {
|
|
80
|
+
if (e.target.value.length > length) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
setInputValue(e.target.value);
|
|
84
|
+
_onChange === null || _onChange === void 0 || _onChange(e.target.value);
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { TaroInputProps } from "./taro-input";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export type InputPasswordProps = Omit<TaroInputProps, 'type'> & {
|
|
5
|
+
iconRender?: (visible: boolean) => React.ReactNode;
|
|
6
|
+
visibilityToggle?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const InputPassword: FC<InputPasswordProps>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var _excluded = ["iconRender", "visibilityToggle", "suffix"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { TaroInput } from "./taro-input";
|
|
13
|
+
import { EyeInvisibleOutline, EyeOutline } from "@trionesdev/antd-mobile-icons-react";
|
|
14
|
+
import React from "react";
|
|
15
|
+
export var InputPassword = function InputPassword(_ref) {
|
|
16
|
+
var iconRender = _ref.iconRender,
|
|
17
|
+
_ref$visibilityToggle = _ref.visibilityToggle,
|
|
18
|
+
visibilityToggle = _ref$visibilityToggle === void 0 ? true : _ref$visibilityToggle,
|
|
19
|
+
suffix = _ref.suffix,
|
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _useState = useState(false),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
visible = _useState2[0],
|
|
24
|
+
setVisible = _useState2[1];
|
|
25
|
+
var toggleRender = function toggleRender() {
|
|
26
|
+
if (iconRender) {
|
|
27
|
+
return iconRender(visible);
|
|
28
|
+
} else {
|
|
29
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, visible ? /*#__PURE__*/React.createElement(EyeOutline, {
|
|
30
|
+
onClick: function onClick() {
|
|
31
|
+
return setVisible(false);
|
|
32
|
+
}
|
|
33
|
+
}) : /*#__PURE__*/React.createElement(EyeInvisibleOutline, {
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return setVisible(true);
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/React.createElement(TaroInput, _extends({}, rest, {
|
|
41
|
+
password: visible ? false : true,
|
|
42
|
+
suffix: /*#__PURE__*/React.createElement(React.Fragment, null, ' ', visibilityToggle && /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
style: {
|
|
44
|
+
paddingLeft: 4,
|
|
45
|
+
paddingRight: 4
|
|
46
|
+
}
|
|
47
|
+
}, toggleRender()), " ", suffix, ' ')
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
2
|
+
import { TaroInput } from "./taro-input";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export var Input = function Input(_ref) {
|
|
5
|
+
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
6
|
+
return /*#__PURE__*/React.createElement(TaroInput, rest);
|
|
7
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputProps as InternalTaroInputProps } from '@tarojs/components';
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
import { InputProps } from "./types";
|
|
4
|
+
export type TaroInputProps = Omit<InputProps, 'type'> & {
|
|
5
|
+
type?: keyof InternalTaroInputProps.Type;
|
|
6
|
+
password?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const TaroInput: FC<TaroInputProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _excluded = ["value", "onChange", "type", "size"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import { Input as InternalTaroInput } from '@tarojs/components';
|
|
12
|
+
import React, { useEffect } from "react";
|
|
13
|
+
import { InputAffixWrapper } from "./input-affix-wrapper";
|
|
14
|
+
export var TaroInput = function TaroInput(_ref) {
|
|
15
|
+
var value = _ref.value,
|
|
16
|
+
onChange = _ref.onChange,
|
|
17
|
+
type = _ref.type,
|
|
18
|
+
_ref$size = _ref.size,
|
|
19
|
+
size = _ref$size === void 0 ? 'middle' : _ref$size,
|
|
20
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _React$useState = React.useState(value),
|
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23
|
+
innerValue = _React$useState2[0],
|
|
24
|
+
setInnerValue = _React$useState2[1];
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
if (value !== innerValue) {
|
|
27
|
+
setInnerValue(value);
|
|
28
|
+
}
|
|
29
|
+
}, [value]);
|
|
30
|
+
return /*#__PURE__*/React.createElement(InputAffixWrapper, _extends({}, rest, {
|
|
31
|
+
className: rest.className,
|
|
32
|
+
style: rest.style,
|
|
33
|
+
prefix: rest.prefix,
|
|
34
|
+
suffix: rest.suffix,
|
|
35
|
+
allowClear: rest.allowClear,
|
|
36
|
+
value: innerValue,
|
|
37
|
+
onClear: function onClear() {
|
|
38
|
+
setInnerValue(null);
|
|
39
|
+
}
|
|
40
|
+
}), /*#__PURE__*/React.createElement(InternalTaroInput, {
|
|
41
|
+
style: {
|
|
42
|
+
flex: 1
|
|
43
|
+
},
|
|
44
|
+
type: type,
|
|
45
|
+
defaultValue: rest.defaultValue,
|
|
46
|
+
value: innerValue,
|
|
47
|
+
placeholder: rest.placeholder,
|
|
48
|
+
password: rest.password,
|
|
49
|
+
onInput: function onInput(e) {
|
|
50
|
+
setInnerValue(e.target.value);
|
|
51
|
+
onChange === null || onChange === void 0 || onChange(e.target.value);
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { variantType } from './types';
|
|
3
|
+
export type InputTextareaProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
variant?: variantType;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
allowClear?: boolean;
|
|
10
|
+
rows?: number;
|
|
11
|
+
value?: any;
|
|
12
|
+
defaultValue?: any;
|
|
13
|
+
onChange?: (e: any) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const Textarea: FC<InputTextareaProps>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useEffect } from 'react';
|
|
12
|
+
import { Textarea as TaroTextarea } from "@tarojs/components";
|
|
13
|
+
import { inputCls } from "./types";
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
export var Textarea = function Textarea(_ref) {
|
|
16
|
+
var className = _ref.className,
|
|
17
|
+
style = _ref.style,
|
|
18
|
+
variant = _ref.variant,
|
|
19
|
+
placeholder = _ref.placeholder,
|
|
20
|
+
disabled = _ref.disabled,
|
|
21
|
+
allowClear = _ref.allowClear,
|
|
22
|
+
rows = _ref.rows,
|
|
23
|
+
value = _ref.value,
|
|
24
|
+
defaultValue = _ref.defaultValue,
|
|
25
|
+
onChange = _ref.onChange;
|
|
26
|
+
var _React$useState = React.useState(value),
|
|
27
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
28
|
+
internalValue = _React$useState2[0],
|
|
29
|
+
setInternalValue = _React$useState2[1];
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
if (value === undefined) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (value === internalValue) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setInternalValue(value);
|
|
38
|
+
}, [value]);
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: classNames("".concat(inputCls, "-textarea"), _defineProperty({}, "".concat(inputCls, "-").concat(variant), variant), className),
|
|
41
|
+
style: style
|
|
42
|
+
}, /*#__PURE__*/React.createElement(TaroTextarea, {
|
|
43
|
+
placeholder: placeholder,
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
defaultValue: defaultValue,
|
|
46
|
+
value: internalValue,
|
|
47
|
+
onInput: function onInput(e) {
|
|
48
|
+
setInternalValue(e.target.value);
|
|
49
|
+
onChange === null || onChange === void 0 || onChange(e.target.value);
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SizeType } from "@trionesdev/antd-mobile-base-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const inputCls = "triones-antm-input";
|
|
4
|
+
export declare const inputAffixWrapperCls = "triones-antm-input-affix-wrapper";
|
|
5
|
+
export type InputProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
size?: SizeType;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
allowClear?: boolean;
|
|
12
|
+
prefix?: React.ReactNode;
|
|
13
|
+
suffix?: React.ReactNode;
|
|
14
|
+
variant?: variantType;
|
|
15
|
+
defaultValue?: any;
|
|
16
|
+
value?: any;
|
|
17
|
+
onChange?: (e: any) => void;
|
|
18
|
+
};
|
|
19
|
+
export type variantType = 'outlined' | 'borderless' | 'filled' | 'underlined' | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var _excluded = ["open"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import { PopupModal } from "@trionesdev/antd-mobile-base-react";
|
|
12
|
+
import React, { useEffect } from "react";
|
|
13
|
+
import { RootPortal } from "@tarojs/components";
|
|
14
|
+
export var Popup = function Popup(_ref) {
|
|
15
|
+
var open = _ref.open,
|
|
16
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
var _React$useState = React.useState(false),
|
|
18
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19
|
+
rendered = _React$useState2[0],
|
|
20
|
+
setRendered = _React$useState2[1];
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (open) {
|
|
23
|
+
setRendered(true);
|
|
24
|
+
}
|
|
25
|
+
}, [open]);
|
|
26
|
+
return rendered && /*#__PURE__*/React.createElement(RootPortal, null, /*#__PURE__*/React.createElement(PopupModal, _extends({}, rest, {
|
|
27
|
+
open: open
|
|
28
|
+
})));
|
|
29
|
+
};
|
package/dist/Popup/index.d.ts
CHANGED
package/dist/Popup/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Popup } from "
|
|
1
|
+
import { Popup } from "./Popup";
|
|
2
2
|
export default Popup;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { Size } from "
|
|
2
|
+
import { Size } from "./types";
|
|
3
3
|
import "./style.scss";
|
|
4
4
|
import { PercentPositionAlign, ProgressStatus } from "./types";
|
|
5
5
|
import "./style.scss";
|
|
@@ -29,6 +29,7 @@ export type ProgressProps = {
|
|
|
29
29
|
* @description 进度条的色彩
|
|
30
30
|
*/
|
|
31
31
|
strokeColor?: string;
|
|
32
|
+
strokeWidth?: number;
|
|
32
33
|
status?: ProgressStatus;
|
|
33
34
|
/**
|
|
34
35
|
* @description 进度数值位置
|
|
@@ -18,6 +18,8 @@ export var Progress = function Progress(_ref) {
|
|
|
18
18
|
railColor = _ref$railColor === void 0 ? '#E5E5E5' : _ref$railColor,
|
|
19
19
|
_ref$strokeColor = _ref.strokeColor,
|
|
20
20
|
strokeColor = _ref$strokeColor === void 0 ? '#1777FF' : _ref$strokeColor,
|
|
21
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
22
|
+
strokeWidth = _ref$strokeWidth === void 0 ? 6 : _ref$strokeWidth,
|
|
21
23
|
status = _ref.status,
|
|
22
24
|
percentPositionAlign = _ref.percentPositionAlign;
|
|
23
25
|
var handleComputedStrokeColor = function handleComputedStrokeColor() {
|
|
@@ -47,6 +49,7 @@ export var Progress = function Progress(_ref) {
|
|
|
47
49
|
size: size,
|
|
48
50
|
railColor: railColor,
|
|
49
51
|
strokeColor: handleComputedStrokeColor(),
|
|
52
|
+
strokeWidth: strokeWidth,
|
|
50
53
|
showInfo: showInfo,
|
|
51
54
|
status: status
|
|
52
55
|
});
|
|
@@ -24,7 +24,7 @@ export var ProgressCircle = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
24
|
status = _ref.status;
|
|
25
25
|
var clsPrefix = 'triones-antm-progress-circle';
|
|
26
26
|
var canvasRef = useRef(("canvas_" + Math.random()).replace('.', ''));
|
|
27
|
-
var
|
|
27
|
+
var computedDiameter = useMemo(function () {
|
|
28
28
|
switch (size) {
|
|
29
29
|
case 'small':
|
|
30
30
|
return 50;
|
|
@@ -36,31 +36,27 @@ export var ProgressCircle = /*#__PURE__*/memo(function (_ref) {
|
|
|
36
36
|
return size || 50;
|
|
37
37
|
}
|
|
38
38
|
}, [size]);
|
|
39
|
-
var computedHeight = useMemo(function () {
|
|
40
|
-
switch (size) {
|
|
41
|
-
case 'small':
|
|
42
|
-
return 50;
|
|
43
|
-
case 'middle':
|
|
44
|
-
return 100;
|
|
45
|
-
case 'large':
|
|
46
|
-
return 150;
|
|
47
|
-
default:
|
|
48
|
-
return 50;
|
|
49
|
-
}
|
|
50
|
-
}, [size]);
|
|
51
39
|
var style = {
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
40
|
+
width: computedDiameter,
|
|
41
|
+
height: computedDiameter
|
|
54
42
|
};
|
|
55
|
-
var
|
|
56
|
-
var iconSize = (
|
|
43
|
+
var computedIconSize = function computedIconSize() {
|
|
44
|
+
var iconSize = (computedDiameter - strokeWidth) / 2 / 3;
|
|
57
45
|
if (iconSize < 24) {
|
|
58
46
|
return 24;
|
|
59
47
|
}
|
|
60
48
|
return iconSize;
|
|
61
49
|
};
|
|
50
|
+
var computePercentSize = function computePercentSize() {
|
|
51
|
+
var percentSize = (computedDiameter - strokeWidth) / 2 / 3;
|
|
52
|
+
if (percentSize < 10) {
|
|
53
|
+
return 10;
|
|
54
|
+
}
|
|
55
|
+
return percentSize || 10;
|
|
56
|
+
};
|
|
62
57
|
var handleIndicator = function handleIndicator() {
|
|
63
|
-
var iconSize =
|
|
58
|
+
var iconSize = computedIconSize();
|
|
59
|
+
var percentSize = computePercentSize();
|
|
64
60
|
var indicatorColor = '#333';
|
|
65
61
|
if (status === 'exception') {
|
|
66
62
|
indicatorColor = exceptionColor;
|
|
@@ -72,7 +68,7 @@ export var ProgressCircle = /*#__PURE__*/memo(function (_ref) {
|
|
|
72
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
69
|
style: {
|
|
74
70
|
color: indicatorColor,
|
|
75
|
-
fontSize:
|
|
71
|
+
fontSize: percentSize
|
|
76
72
|
}
|
|
77
73
|
}, format(percent));
|
|
78
74
|
}
|
|
@@ -95,21 +91,20 @@ export var ProgressCircle = /*#__PURE__*/memo(function (_ref) {
|
|
|
95
91
|
return /*#__PURE__*/React.createElement("div", {
|
|
96
92
|
style: {
|
|
97
93
|
color: indicatorColor,
|
|
98
|
-
fontSize:
|
|
94
|
+
fontSize: percentSize
|
|
99
95
|
}
|
|
100
96
|
}, percent, "%");
|
|
101
97
|
};
|
|
102
98
|
var handleDraw = function handleDraw() {
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
var radius = (Math.min(computedWidth, computedHeight) - strokeWidth) / 2;
|
|
99
|
+
var centerX = computedDiameter / 2;
|
|
100
|
+
var centerY = computedDiameter / 2;
|
|
101
|
+
var radius = (Math.min(computedDiameter, computedDiameter) - strokeWidth) / 2;
|
|
107
102
|
var sweepAngle = (percent ? percent / 100 : 0) * 2 * Math.PI;
|
|
108
103
|
var startAngle = -Math.PI / 2; // 从顶部开始
|
|
109
104
|
|
|
110
105
|
// 创建画布上下文,不能使用Taro.createCanvasContext(),否则h5下会报错
|
|
111
106
|
var ctx = createCanvasContext(canvasRef.current, _this);
|
|
112
|
-
ctx.clearRect(0, 0,
|
|
107
|
+
ctx.clearRect(0, 0, computedDiameter, computedDiameter);
|
|
113
108
|
|
|
114
109
|
//region 画背景圈
|
|
115
110
|
ctx.beginPath();
|
|
@@ -141,7 +136,7 @@ export var ProgressCircle = /*#__PURE__*/memo(function (_ref) {
|
|
|
141
136
|
}, /*#__PURE__*/React.createElement(Canvas, {
|
|
142
137
|
style: style,
|
|
143
138
|
canvasId: canvasRef.current
|
|
144
|
-
}), showInfo &&
|
|
139
|
+
}), showInfo && computedDiameter > 20 && /*#__PURE__*/React.createElement("div", {
|
|
145
140
|
className: "".concat(clsPrefix, "-indicator")
|
|
146
141
|
}, handleIndicator()));
|
|
147
142
|
});
|
package/dist/Progress/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SizeType } from "@trionesdev/antd-mobile-base-react";
|
|
2
|
+
export type Size = SizeType | number;
|
|
1
3
|
export type ProgressStatus = 'normal' | 'active' | 'success' | 'exception';
|
|
2
4
|
export type PercentPositionAlign = 'start' | 'end';
|
|
3
5
|
export declare const successColor = "#53C31B";
|
package/dist/SideBar/style.scss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
2
|
|
|
3
3
|
$trionesSideBarCls: 'triones-antm-sidebar';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ $trionesSideBarCls: 'triones-antm-sidebar';
|
|
|
9
9
|
|
|
10
10
|
&-tabs {
|
|
11
11
|
min-width: 0;
|
|
12
|
-
background-color:
|
|
12
|
+
background-color: variable.$trionesColorFill;
|
|
13
13
|
overflow: auto;
|
|
14
14
|
scrollbar-width: thin;
|
|
15
15
|
flex-shrink: 0;
|
|
@@ -17,12 +17,12 @@ $trionesSideBarCls: 'triones-antm-sidebar';
|
|
|
17
17
|
|
|
18
18
|
&-tab {
|
|
19
19
|
cursor: pointer;
|
|
20
|
-
padding:
|
|
21
|
-
color:
|
|
20
|
+
padding: variable.$trionesPadding variable.$trionesPadding;
|
|
21
|
+
color: variable.$trionesColorTextSecondary;
|
|
22
22
|
|
|
23
23
|
&-active {
|
|
24
|
-
color:
|
|
25
|
-
background-color:
|
|
24
|
+
color: variable.$trionesColorPrimaryText;
|
|
25
|
+
background-color: variable.$trionesColorBgBase;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { VerificationCodeInput,
|
|
2
|
-
export type {
|
|
1
|
+
import { VerificationCodeInput, VerificationCodeInputProps } from "./verification-code-input";
|
|
2
|
+
export type { VerificationCodeInputProps };
|
|
3
3
|
export default VerificationCodeInput;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { VerificationCodeInput } from "
|
|
1
|
+
import { VerificationCodeInput } from "./verification-code-input";
|
|
2
2
|
export default VerificationCodeInput;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
|
+
|
|
3
|
+
$verificationCodeInputCls: 'triones-antm-verification-code-input';
|
|
4
|
+
|
|
5
|
+
.#{$verificationCodeInputCls} {
|
|
6
|
+
&-send {
|
|
7
|
+
padding-inline: variable.$trionesPaddingContentHorizontal;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
|
|
10
|
+
&:hover {
|
|
11
|
+
color: variable.$trionesColorPrimary;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&-counting {
|
|
16
|
+
padding-inline: variable.$trionesPaddingContentHorizontal;
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
color: variable.$trionesColorTextDisabled;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InputProps } from '..';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
export type VerificationCodeInputProps = Omit<InputProps, 'suffix'> & {
|
|
5
|
+
/**
|
|
6
|
+
* @description 发送文本
|
|
7
|
+
* @default 获取验证码
|
|
8
|
+
*/
|
|
9
|
+
sendText?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @description 重新发送文本
|
|
12
|
+
* @default 重新发送
|
|
13
|
+
*/
|
|
14
|
+
resendText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @description 等待时间
|
|
17
|
+
*/
|
|
18
|
+
waitSeconds?: number;
|
|
19
|
+
/**
|
|
20
|
+
* @description 发送事件
|
|
21
|
+
*/
|
|
22
|
+
onSend?: () => Promise<boolean>;
|
|
23
|
+
};
|
|
24
|
+
export declare const VerificationCodeInput: FC<VerificationCodeInputProps>;
|