@autobest-ui/components 2.9.2 → 2.10.1-alpha.0
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/esm/affix/index.d.ts +3 -3
- package/esm/affix/index.js +2 -2
- package/esm/carousel/index.d.ts +2 -2
- package/esm/carousel/index.js +1 -1
- package/esm/checkbox/Checkbox.d.ts +60 -0
- package/esm/checkbox/Checkbox.js +120 -0
- package/esm/checkbox/CheckboxGroup.d.ts +16 -0
- package/esm/checkbox/CheckboxGroup.js +57 -0
- package/esm/checkbox/index.d.ts +4 -52
- package/esm/checkbox/index.js +2 -114
- package/esm/checkbox/style/index.css +1 -1
- package/esm/ellipsis/index.d.ts +1 -8
- package/esm/ellipsis/index.js +9 -9
- package/esm/ellipsis/style/index.css +1 -1
- package/esm/index.d.ts +8 -3
- package/esm/index.js +5 -2
- package/esm/input/Input.d.ts +13 -1
- package/esm/input/Input.js +66 -4
- package/esm/input/TextArea.d.ts +8 -0
- package/esm/input/TextArea.js +43 -12
- package/esm/input-number/getParserOriginalValue.d.ts +26 -0
- package/esm/input-number/getParserOriginalValue.js +73 -0
- package/esm/input-number/index.d.ts +20 -7
- package/esm/input-number/index.js +60 -48
- package/esm/input-phone/format.d.ts +23 -0
- package/esm/input-phone/format.js +81 -0
- package/esm/input-phone/index.d.ts +65 -0
- package/esm/input-phone/index.js +190 -0
- package/esm/input-phone/style/index.css +1 -0
- package/esm/modal/index.d.ts +3 -3
- package/esm/modal/index.js +2 -2
- package/esm/move/index.d.ts +6 -6
- package/esm/move/index.js +5 -5
- package/esm/popover/index.d.ts +1 -1
- package/esm/popover/index.js +7 -2
- package/esm/radio/Radio.d.ts +4 -0
- package/esm/radio/Radio.js +80 -0
- package/esm/radio/RadioGroup.d.ts +16 -0
- package/esm/radio/RadioGroup.js +106 -0
- package/esm/radio/context.d.ts +5 -0
- package/esm/radio/context.js +4 -0
- package/esm/radio/index.d.ts +3 -0
- package/esm/radio/index.js +2 -0
- package/esm/radio/interface.d.ts +17 -0
- package/esm/radio/interface.js +1 -0
- package/esm/radio/style/index.css +1 -0
- package/esm/select/index.d.ts +2 -2
- package/esm/select/index.js +1 -1
- package/esm/style.css +1 -1
- package/esm/table/body/CheckIcon.js +1 -1
- package/esm/table/header/CheckIcon.js +1 -1
- package/esm/table/index.d.ts +2 -2
- package/esm/table/index.js +2 -1
- package/esm/table/style/index.css +1 -1
- package/esm/tabs/index.d.ts +2 -2
- package/esm/tabs/index.js +1 -1
- package/esm/trigger/index.d.ts +5 -5
- package/esm/trigger/index.js +5 -5
- package/lib/affix/index.d.ts +3 -3
- package/lib/affix/index.js +2 -2
- package/lib/carousel/index.d.ts +2 -2
- package/lib/carousel/index.js +1 -1
- package/lib/checkbox/Checkbox.d.ts +60 -0
- package/lib/checkbox/Checkbox.js +128 -0
- package/lib/checkbox/CheckboxGroup.d.ts +16 -0
- package/lib/checkbox/CheckboxGroup.js +65 -0
- package/lib/checkbox/index.d.ts +4 -52
- package/lib/checkbox/index.js +13 -115
- package/lib/checkbox/style/index.css +1 -1
- package/lib/ellipsis/index.d.ts +1 -8
- package/lib/ellipsis/index.js +9 -9
- package/lib/ellipsis/style/index.css +1 -1
- package/lib/index.d.ts +8 -3
- package/lib/index.js +47 -2
- package/lib/input/Input.d.ts +13 -1
- package/lib/input/Input.js +66 -4
- package/lib/input/TextArea.d.ts +8 -0
- package/lib/input/TextArea.js +43 -12
- package/lib/input-number/getParserOriginalValue.d.ts +26 -0
- package/lib/input-number/getParserOriginalValue.js +79 -0
- package/lib/input-number/index.d.ts +20 -7
- package/lib/input-number/index.js +59 -47
- package/lib/input-phone/format.d.ts +23 -0
- package/lib/input-phone/format.js +90 -0
- package/lib/input-phone/index.d.ts +65 -0
- package/lib/input-phone/index.js +198 -0
- package/lib/input-phone/style/index.css +1 -0
- package/lib/modal/index.d.ts +3 -3
- package/lib/modal/index.js +2 -2
- package/lib/move/index.d.ts +6 -6
- package/lib/move/index.js +5 -5
- package/lib/popover/index.d.ts +1 -1
- package/lib/popover/index.js +7 -2
- package/lib/radio/Radio.d.ts +4 -0
- package/lib/radio/Radio.js +91 -0
- package/lib/radio/RadioGroup.d.ts +16 -0
- package/lib/radio/RadioGroup.js +117 -0
- package/lib/radio/context.d.ts +5 -0
- package/lib/radio/context.js +15 -0
- package/lib/radio/index.d.ts +3 -0
- package/lib/radio/index.js +20 -0
- package/lib/radio/interface.d.ts +17 -0
- package/lib/radio/interface.js +5 -0
- package/lib/radio/style/index.css +1 -0
- package/lib/select/index.d.ts +2 -2
- package/lib/select/index.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/body/CheckIcon.js +2 -2
- package/lib/table/header/CheckIcon.js +2 -2
- package/lib/table/index.d.ts +2 -2
- package/lib/table/index.js +2 -1
- package/lib/table/style/index.css +1 -1
- package/lib/tabs/index.d.ts +2 -2
- package/lib/tabs/index.js +1 -1
- package/lib/trigger/index.d.ts +5 -5
- package/lib/trigger/index.js +5 -5
- package/package.json +5 -4
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _utils = require("@autobest-ui/utils");
|
|
11
|
+
var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
12
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
13
|
+
__assign = Object.assign || function (t) {
|
|
14
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
+
s = arguments[i];
|
|
16
|
+
for (var p in s) {
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
return __assign.apply(this, arguments);
|
|
23
|
+
};
|
|
24
|
+
function getCheckboxProp(checkboxProp, checkboxGroupProp) {
|
|
25
|
+
return (0, _utils.isUndef)(checkboxProp) ? checkboxGroupProp : checkboxProp;
|
|
26
|
+
}
|
|
27
|
+
var cls = 'ab-checkbox';
|
|
28
|
+
var CheckboxGroup = function CheckboxGroup(_a) {
|
|
29
|
+
var onChange = _a.onChange,
|
|
30
|
+
groupName = _a.name,
|
|
31
|
+
options = _a.options,
|
|
32
|
+
className = _a.className,
|
|
33
|
+
disabled = _a.disabled,
|
|
34
|
+
reverse = _a.reverse,
|
|
35
|
+
theme = _a.theme;
|
|
36
|
+
if ((0, _utils.isEmptyArray)(options)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
var onCheckboxChange = function onCheckboxChange(checked, name) {
|
|
40
|
+
var newOptions = options.map(function (item) {
|
|
41
|
+
if (item.name === name) {
|
|
42
|
+
return __assign(__assign({}, item), {
|
|
43
|
+
checked: checked
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return item;
|
|
47
|
+
});
|
|
48
|
+
onChange(newOptions, groupName);
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
|
+
className: (0, _classnames.default)("".concat(cls, "-group"), className)
|
|
52
|
+
}, options.map(function (item) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
54
|
+
key: item.name,
|
|
55
|
+
name: item.name,
|
|
56
|
+
reverse: getCheckboxProp(item.reverse, reverse),
|
|
57
|
+
theme: getCheckboxProp(item.theme, theme),
|
|
58
|
+
disabled: getCheckboxProp(item.disabled, disabled),
|
|
59
|
+
checked: item.checked,
|
|
60
|
+
onChange: onCheckboxChange
|
|
61
|
+
}, item.name);
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var _default = CheckboxGroup;
|
|
65
|
+
exports.default = _default;
|
package/lib/checkbox/index.d.ts
CHANGED
|
@@ -1,52 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* checked变化的回调函数, 参数 checked: boolean
|
|
6
|
-
*/
|
|
7
|
-
onChange: (checked: boolean, name?: string | number) => void;
|
|
8
|
-
/**
|
|
9
|
-
* 是否选中
|
|
10
|
-
*/
|
|
11
|
-
checked?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* 初始是否选中
|
|
14
|
-
*/
|
|
15
|
-
defaultChecked?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* checkbox样式
|
|
18
|
-
*/
|
|
19
|
-
className?: string;
|
|
20
|
-
name?: string | number;
|
|
21
|
-
/**
|
|
22
|
-
* 勾选框尺寸,单位px
|
|
23
|
-
*/
|
|
24
|
-
size?: number;
|
|
25
|
-
/**
|
|
26
|
-
* 是否禁用
|
|
27
|
-
*/
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* 掉转文字和勾选框位置
|
|
31
|
-
*/
|
|
32
|
-
reverse?: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface CheckboxState {
|
|
35
|
-
visible: boolean;
|
|
36
|
-
}
|
|
37
|
-
declare class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
38
|
-
static defaultProps: {
|
|
39
|
-
size: number;
|
|
40
|
-
disabled: boolean;
|
|
41
|
-
defaultChecked: boolean;
|
|
42
|
-
reverse: boolean;
|
|
43
|
-
};
|
|
44
|
-
constructor(props: any);
|
|
45
|
-
static getDerivedStateFromProps(nextProps: CheckboxProps, prevState: CheckboxState): {
|
|
46
|
-
visible: boolean;
|
|
47
|
-
};
|
|
48
|
-
onVisibleChange: () => void;
|
|
49
|
-
renderBox: () => JSX.Element;
|
|
50
|
-
render(): JSX.Element;
|
|
51
|
-
}
|
|
52
|
-
export default Checkbox;
|
|
1
|
+
export type { CheckboxProps } from './Checkbox';
|
|
2
|
+
export { default as Checkbox } from './Checkbox';
|
|
3
|
+
export type { CheckboxGroupProps, CheckboxGroupOptionItem } from './CheckboxGroup';
|
|
4
|
+
export { default as CheckboxGroup } from './CheckboxGroup';
|
package/lib/checkbox/index.js
CHANGED
|
@@ -4,119 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _extendStatics = function extendStatics(d, b) {
|
|
12
|
-
_extendStatics = Object.setPrototypeOf || {
|
|
13
|
-
__proto__: []
|
|
14
|
-
} instanceof Array && function (d, b) {
|
|
15
|
-
d.__proto__ = b;
|
|
16
|
-
} || function (d, b) {
|
|
17
|
-
for (var p in b) {
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return _extendStatics(d, b);
|
|
22
|
-
};
|
|
23
|
-
return function (d, b) {
|
|
24
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
25
|
-
_extendStatics(d, b);
|
|
26
|
-
function __() {
|
|
27
|
-
this.constructor = d;
|
|
28
|
-
}
|
|
29
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
-
};
|
|
31
|
-
}();
|
|
32
|
-
var cls = 'ab-checkbox';
|
|
33
|
-
var Checkbox = /** @class */function (_super) {
|
|
34
|
-
__extends(Checkbox, _super);
|
|
35
|
-
function Checkbox(props) {
|
|
36
|
-
var _this = _super.call(this, props) || this;
|
|
37
|
-
_this.onVisibleChange = function () {
|
|
38
|
-
var _a = _this.props,
|
|
39
|
-
disabled = _a.disabled,
|
|
40
|
-
onChange = _a.onChange,
|
|
41
|
-
name = _a.name;
|
|
42
|
-
if (disabled) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
var visible = !_this.state.visible;
|
|
46
|
-
if (!('checked' in _this.props)) {
|
|
47
|
-
_this.setState({
|
|
48
|
-
visible: visible
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
onChange(visible, name);
|
|
52
|
-
};
|
|
53
|
-
_this.renderBox = function () {
|
|
54
|
-
var _a;
|
|
55
|
-
var _b = _this.props,
|
|
56
|
-
className = _b.className,
|
|
57
|
-
disabled = _b.disabled,
|
|
58
|
-
size = _b.size;
|
|
59
|
-
var visible = _this.state.visible;
|
|
60
|
-
var innerStyle = {
|
|
61
|
-
width: "".concat(size, "px"),
|
|
62
|
-
height: "".concat(size, "px")
|
|
63
|
-
};
|
|
64
|
-
var iconStyle = {
|
|
65
|
-
width: "".concat(size * 6 / 16, "px"),
|
|
66
|
-
height: "".concat(size * 10 / 16, "px")
|
|
67
|
-
};
|
|
68
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
69
|
-
className: (0, _classnames.default)(cls, className, (_a = {}, _a["".concat(cls, "-checked")] = visible, _a["".concat(cls, "-disabled")] = disabled, _a))
|
|
70
|
-
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
71
|
-
className: "".concat(cls, "-input"),
|
|
72
|
-
type: "checkbox",
|
|
73
|
-
onChange: _this.onVisibleChange
|
|
74
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
75
|
-
className: "".concat(cls, "-inner"),
|
|
76
|
-
style: innerStyle
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
78
|
-
className: "".concat(cls, "-icon"),
|
|
79
|
-
style: iconStyle
|
|
80
|
-
})));
|
|
81
|
-
};
|
|
82
|
-
_this.state = {
|
|
83
|
-
visible: props.checked || props.defaultChecked
|
|
84
|
-
};
|
|
85
|
-
return _this;
|
|
7
|
+
Object.defineProperty(exports, "Checkbox", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _Checkbox.default;
|
|
86
11
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Checkbox.prototype.render = function () {
|
|
97
|
-
var _a;
|
|
98
|
-
var _b = this.props,
|
|
99
|
-
className = _b.className,
|
|
100
|
-
disabled = _b.disabled,
|
|
101
|
-
children = _b.children,
|
|
102
|
-
reverse = _b.reverse;
|
|
103
|
-
// 只渲染复选框
|
|
104
|
-
if (!children) {
|
|
105
|
-
return this.renderBox();
|
|
106
|
-
}
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement("label", {
|
|
108
|
-
className: (0, _classnames.default)("".concat(cls, "-wrap"), className, (_a = {}, _a["".concat(cls, "-reverse")] = reverse, _a["".concat(cls, "-disabled")] = disabled, _a))
|
|
109
|
-
}, this.renderBox(), children ? /*#__PURE__*/_react.default.createElement("span", {
|
|
110
|
-
className: "".concat(cls, "-content")
|
|
111
|
-
}, children) : null);
|
|
112
|
-
};
|
|
113
|
-
Checkbox.defaultProps = {
|
|
114
|
-
size: 16,
|
|
115
|
-
disabled: false,
|
|
116
|
-
defaultChecked: false,
|
|
117
|
-
reverse: false
|
|
118
|
-
};
|
|
119
|
-
return Checkbox;
|
|
120
|
-
}(_react.default.Component);
|
|
121
|
-
var _default = Checkbox;
|
|
122
|
-
exports.default = _default;
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "CheckboxGroup", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _CheckboxGroup.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
20
|
+
var _CheckboxGroup = _interopRequireDefault(require("./CheckboxGroup"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-checkbox{display:inline-block;position:relative;font-size:0;cursor:pointer}.ab-checkbox-input{position:absolute;opacity:0;margin:0;padding:0;width:100%;height:100%;cursor:pointer;z-index:2}.ab-checkbox-inner{display:inline-block;position:relative;width:.16rem;height:.16rem;transition:.3s;border:.02rem solid #b0b0b0;border-radius:.02rem;background-color:#fff}.ab-checkbox-icon{visibility:hidden;position:absolute;width:.06rem;height:.1rem;left:20%;top:40%;transform:rotate(45deg) scale(0) translate(-50%,-50%);transition:.2s;border:.02rem solid #e84040;border-top:none;border-left:none}.ab-checkbox.ab-checkbox-checked .ab-checkbox-icon{visibility:visible;transform:rotate(45deg) scale(1) translate(-50%,-50%)}.ab-checkbox.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-inner{border-color:#f0f0f0;background-color:#f5f5f5}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-icon{border-color:#cecece}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none}.ab-checkbox-wrap{display:inline-block;position:relative;cursor:pointer}.ab-checkbox-wrap .ab-checkbox{position:absolute;transform:translateY(-50%);top:50%;left:0}.ab-checkbox-wrap:hover .ab-checkbox-content{text-decoration:underline}.ab-checkbox-content{padding-left:.24rem;display:inline-block}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox{left:auto;right:0}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox-content{padding-left:0;padding-right:.24rem}.ab-checkbox-wrap.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox-wrap.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none}
|
|
1
|
+
.ab-checkbox{display:inline-block;position:relative;font-size:0;cursor:pointer}.ab-checkbox-input{position:absolute;opacity:0;margin:0;padding:0;width:100%;height:100%;cursor:pointer;z-index:2}.ab-checkbox-white .ab-checkbox-icon{border-color:#e84040}.ab-checkbox-blue .ab-checkbox-icon{border-color:#fff}.ab-checkbox-blue .ab-checkbox-inner{transition:none}.ab-checkbox-blue.ab-checkbox-checked .ab-checkbox-inner{border:.01rem solid #0075ff;background-color:#0075ff}.ab-checkbox-inner{display:inline-block;position:relative;width:.16rem;height:.16rem;transition:.3s;border:.02rem solid #b0b0b0;border-radius:.02rem;background-color:#fff}.ab-checkbox-icon{visibility:hidden;position:absolute;width:.06rem;height:.1rem;left:20%;top:40%;transform:rotate(45deg) scale(0) translate(-50%,-50%);transition:.2s;border:.02rem solid #e84040;border-top:none;border-left:none}.ab-checkbox.ab-checkbox-checked .ab-checkbox-icon{visibility:visible;transform:rotate(45deg) scale(1) translate(-50%,-50%)}.ab-checkbox.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-inner{border-color:#f0f0f0;background-color:#f5f5f5}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-icon{border-color:#cecece}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none}.ab-checkbox-wrap{display:inline-block;position:relative;cursor:pointer}.ab-checkbox-wrap .ab-checkbox{position:absolute;transform:translateY(-50%);top:50%;left:0}.ab-checkbox-wrap:hover .ab-checkbox-content{text-decoration:underline}.ab-checkbox-wrap:hover .ab-checkbox-blue+.ab-checkbox-content{text-decoration:none}.ab-checkbox-content{padding-left:.24rem;display:inline-block}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox{left:auto;right:0}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox-content{padding-left:0;padding-right:.24rem}.ab-checkbox-wrap.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox-wrap.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none}.ab-checkbox-group{display:flex;flex-wrap:wrap}.ab-checkbox-group .ab-checkbox-wrap{margin-right:.15rem}
|
package/lib/ellipsis/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare type LessThan<N extends number, A extends any[] = []> = N extends A['length'] ? A[number] : LessThan<N, [...A, A['length']]>;
|
|
3
|
-
declare type NumericRange<F extends number, T extends number> = Exclude<T | LessThan<T>, LessThan<F>>;
|
|
4
|
-
export declare type EllipsisLinesType = NumericRange<1, 10>;
|
|
5
2
|
export interface EllipsisProps {
|
|
6
3
|
/**
|
|
7
4
|
* 需要显示的文本
|
|
@@ -18,11 +15,7 @@ export interface EllipsisProps {
|
|
|
18
15
|
/**
|
|
19
16
|
* 桌面端限制显示的行数,若不传值,则桌面端会不做行数限值,显示全
|
|
20
17
|
*/
|
|
21
|
-
lines?:
|
|
22
|
-
/**
|
|
23
|
-
* 移动端限制显示的行数,若不传值,则移动端会不做行数限值,显示全
|
|
24
|
-
*/
|
|
25
|
-
mobileLines?: EllipsisLinesType;
|
|
18
|
+
lines?: number;
|
|
26
19
|
/**
|
|
27
20
|
* title属性
|
|
28
21
|
*/
|
package/lib/ellipsis/index.js
CHANGED
|
@@ -22,34 +22,34 @@ var __assign = void 0 && (void 0).__assign || function () {
|
|
|
22
22
|
};
|
|
23
23
|
var cls = 'ab-ellipsis';
|
|
24
24
|
function Ellipsis(props) {
|
|
25
|
-
var _a, _b;
|
|
26
25
|
var children = props.children,
|
|
27
26
|
maxHeight = props.maxHeight,
|
|
28
27
|
className = props.className,
|
|
29
|
-
|
|
30
|
-
lines =
|
|
31
|
-
title = props.title
|
|
32
|
-
|
|
33
|
-
mobileLines = _d === void 0 ? 0 : _d;
|
|
34
|
-
var wrapCls = (0, _classnames.default)(cls, className, (_a = {}, _a["".concat(cls, "-line").concat(lines)] = lines > 0, _a), (_b = {}, _b["".concat(cls, "-m-line").concat(mobileLines)] = mobileLines > 0, _b));
|
|
28
|
+
_a = props.lines,
|
|
29
|
+
lines = _a === void 0 ? 0 : _a,
|
|
30
|
+
title = props.title;
|
|
31
|
+
var wrapCls = (0, _classnames.default)(cls, className);
|
|
35
32
|
var style = maxHeight ? {
|
|
36
33
|
maxHeight: maxHeight
|
|
37
34
|
} : null;
|
|
38
35
|
var titleParam = title ? {
|
|
39
36
|
title: title
|
|
40
37
|
} : null;
|
|
38
|
+
var lineStyle = lines > 0 ? {
|
|
39
|
+
'-webkit-line-clamp': "".concat(lines)
|
|
40
|
+
} : null;
|
|
41
41
|
// 当children是单个标签元素时(非文本元素),将直接在该标签上加上style, className,title属性
|
|
42
42
|
if (!(0, _reactIs.isFragment)(children) && (0, _reactIs.isElement)(children)) {
|
|
43
43
|
var child = children;
|
|
44
44
|
return /*#__PURE__*/_react.default.cloneElement(child, __assign(__assign({}, titleParam), {
|
|
45
45
|
className: (0, _classnames.default)(wrapCls, child.props.className),
|
|
46
|
-
style: __assign(__assign({}, style), child.props.style)
|
|
46
|
+
style: __assign(__assign(__assign({}, style), lineStyle), child.props.style)
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
49
|
return /*#__PURE__*/_react.default.createElement("span", __assign({
|
|
50
50
|
className: wrapCls
|
|
51
51
|
}, titleParam, {
|
|
52
|
-
style: style
|
|
52
|
+
style: __assign(__assign({}, style), lineStyle)
|
|
53
53
|
}), children);
|
|
54
54
|
}
|
|
55
55
|
var _default = /*#__PURE__*/_react.default.memo(Ellipsis);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-ellipsis{overflow:hidden;display:block;display:-webkit-box;-webkit-box-orient:vertical}
|
|
1
|
+
.ab-ellipsis{overflow:hidden;display:block;display:-webkit-box;-webkit-box-orient:vertical}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { AccordionProps } from './accordion';
|
|
2
2
|
export { default as Accordion } from './accordion';
|
|
3
|
-
export type { EllipsisProps
|
|
3
|
+
export type { EllipsisProps } from './ellipsis';
|
|
4
4
|
export { default as Ellipsis } from './ellipsis';
|
|
5
5
|
export type { AffixProps, GetFixedStateParams } from './affix';
|
|
6
6
|
export { default as Affix } from './affix';
|
|
@@ -30,12 +30,14 @@ export type { InputValue, InputProps, TextAreaProps } from './input';
|
|
|
30
30
|
export { Input, TextArea } from './input';
|
|
31
31
|
export type { InputNumberProps } from './input-number';
|
|
32
32
|
export { default as InputNumber } from './input-number';
|
|
33
|
+
export type { InputPhoneProps } from './input-phone';
|
|
34
|
+
export { default as InputPhone } from './input-phone';
|
|
33
35
|
export type { LazyImageProps } from './lazy-image';
|
|
34
36
|
export { default as LazyImage } from './lazy-image';
|
|
35
37
|
export type { LinkItemProps, LinkListProps, LinkItemSubInfoProps } from './link-list';
|
|
36
38
|
export { default as LinkList } from './link-list';
|
|
37
|
-
export type { CheckboxProps } from './checkbox';
|
|
38
|
-
export {
|
|
39
|
+
export type { CheckboxProps, CheckboxGroupProps, CheckboxGroupOptionItem } from './checkbox';
|
|
40
|
+
export { Checkbox, CheckboxGroup } from './checkbox';
|
|
39
41
|
export type { ScriptAttributes, ScriptProps } from './script';
|
|
40
42
|
export { default as Script } from './script';
|
|
41
43
|
export type { MessageProps, MessageConfig, MessageResult } from './message';
|
|
@@ -56,3 +58,6 @@ export type { LoadingIconProps } from './loading-icon';
|
|
|
56
58
|
export { default as LoadingIcon } from './loading-icon';
|
|
57
59
|
export type { TriggerProps, TriggerType, TriggerPlacement, ArrowStyleProps } from './trigger';
|
|
58
60
|
export { default as Trigger } from './trigger';
|
|
61
|
+
export { composeRef, supportRef, fillRef } from './trigger/ref';
|
|
62
|
+
export type { RadioProps, RadioGroupProps, RadioValue, RadioOptionItem } from './radio';
|
|
63
|
+
export { Radio, RadioGroup } from './radio';
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,13 @@ Object.defineProperty(exports, "Carousel", {
|
|
|
26
26
|
Object.defineProperty(exports, "Checkbox", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return _checkbox.
|
|
29
|
+
return _checkbox.Checkbox;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "CheckboxGroup", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _checkbox.CheckboxGroup;
|
|
30
36
|
}
|
|
31
37
|
});
|
|
32
38
|
Object.defineProperty(exports, "Collapse", {
|
|
@@ -77,6 +83,12 @@ Object.defineProperty(exports, "InputNumber", {
|
|
|
77
83
|
return _inputNumber.default;
|
|
78
84
|
}
|
|
79
85
|
});
|
|
86
|
+
Object.defineProperty(exports, "InputPhone", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function get() {
|
|
89
|
+
return _inputPhone.default;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
80
92
|
Object.defineProperty(exports, "LazyImage", {
|
|
81
93
|
enumerable: true,
|
|
82
94
|
get: function get() {
|
|
@@ -137,6 +149,18 @@ Object.defineProperty(exports, "Popover", {
|
|
|
137
149
|
return _popover.default;
|
|
138
150
|
}
|
|
139
151
|
});
|
|
152
|
+
Object.defineProperty(exports, "Radio", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function get() {
|
|
155
|
+
return _radio.Radio;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "RadioGroup", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function get() {
|
|
161
|
+
return _radio.RadioGroup;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
140
164
|
Object.defineProperty(exports, "Script", {
|
|
141
165
|
enumerable: true,
|
|
142
166
|
get: function get() {
|
|
@@ -185,12 +209,30 @@ Object.defineProperty(exports, "Trigger", {
|
|
|
185
209
|
return _trigger.default;
|
|
186
210
|
}
|
|
187
211
|
});
|
|
212
|
+
Object.defineProperty(exports, "composeRef", {
|
|
213
|
+
enumerable: true,
|
|
214
|
+
get: function get() {
|
|
215
|
+
return _ref.composeRef;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
Object.defineProperty(exports, "fillRef", {
|
|
219
|
+
enumerable: true,
|
|
220
|
+
get: function get() {
|
|
221
|
+
return _ref.fillRef;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
188
224
|
Object.defineProperty(exports, "message", {
|
|
189
225
|
enumerable: true,
|
|
190
226
|
get: function get() {
|
|
191
227
|
return _message.default;
|
|
192
228
|
}
|
|
193
229
|
});
|
|
230
|
+
Object.defineProperty(exports, "supportRef", {
|
|
231
|
+
enumerable: true,
|
|
232
|
+
get: function get() {
|
|
233
|
+
return _ref.supportRef;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
194
236
|
var _accordion = _interopRequireDefault(require("./accordion"));
|
|
195
237
|
var _ellipsis = _interopRequireDefault(require("./ellipsis"));
|
|
196
238
|
var _affix = _interopRequireDefault(require("./affix"));
|
|
@@ -207,9 +249,10 @@ var _guide = _interopRequireDefault(require("./guide"));
|
|
|
207
249
|
var _drawer = _interopRequireDefault(require("./drawer"));
|
|
208
250
|
var _input = require("./input");
|
|
209
251
|
var _inputNumber = _interopRequireDefault(require("./input-number"));
|
|
252
|
+
var _inputPhone = _interopRequireDefault(require("./input-phone"));
|
|
210
253
|
var _lazyImage = _interopRequireDefault(require("./lazy-image"));
|
|
211
254
|
var _linkList = _interopRequireDefault(require("./link-list"));
|
|
212
|
-
var _checkbox =
|
|
255
|
+
var _checkbox = require("./checkbox");
|
|
213
256
|
var _script = _interopRequireDefault(require("./script"));
|
|
214
257
|
var _message = _interopRequireWildcard(require("./message"));
|
|
215
258
|
var _table = _interopRequireDefault(require("./table"));
|
|
@@ -220,5 +263,7 @@ var _loadingContainer = _interopRequireDefault(require("./loading-container"));
|
|
|
220
263
|
var _loadingBar = _interopRequireDefault(require("./loading-bar"));
|
|
221
264
|
var _loadingIcon = _interopRequireDefault(require("./loading-icon"));
|
|
222
265
|
var _trigger = _interopRequireDefault(require("./trigger"));
|
|
266
|
+
var _ref = require("./trigger/ref");
|
|
267
|
+
var _radio = require("./radio");
|
|
223
268
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
224
269
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/lib/input/Input.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AdornProps } from './Adorn';
|
|
3
3
|
export declare type InputValue = string | File | undefined;
|
|
4
|
-
export interface InputProps<T = InputValue> extends Omit<AdornProps, 'prefixCls' | 'children' | 'onBlur' | 'onFocus'>, Pick<React.InputHTMLAttributes<any>, 'placeholder' | 'style' | 'maxLength' | 'type' | 'accept'> {
|
|
4
|
+
export interface InputProps<T = InputValue> extends Omit<AdornProps, 'prefixCls' | 'children' | 'onBlur' | 'onFocus'>, Pick<React.InputHTMLAttributes<any>, 'placeholder' | 'style' | 'maxLength' | 'type' | 'accept' | 'title' | 'aria-label' | 'onKeyUp' | 'autoComplete'> {
|
|
5
5
|
/**
|
|
6
6
|
* 输入框默认值,用于非受控组件,配合ref使用
|
|
7
7
|
*/
|
|
@@ -34,6 +34,11 @@ export interface InputProps<T = InputValue> extends Omit<AdornProps, 'prefixCls'
|
|
|
34
34
|
* 用户触发keydown时的回调,主要用于键盘监听
|
|
35
35
|
*/
|
|
36
36
|
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>, name?: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 在网络慢时,组件已经渲染js文件还未加载,用户此时修改input框会不触发onChange事件
|
|
39
|
+
* 需要在组件加载后检测输入框内容,触发一次onChange
|
|
40
|
+
*/
|
|
41
|
+
checkValueOnMounted?: boolean;
|
|
37
42
|
}
|
|
38
43
|
interface InputStates {
|
|
39
44
|
value: string | undefined;
|
|
@@ -50,12 +55,19 @@ export declare class InputNotRef extends React.Component<InputPropsWithRef, Inpu
|
|
|
50
55
|
static defaultProps: {
|
|
51
56
|
defaultValue: string;
|
|
52
57
|
type: string;
|
|
58
|
+
checkValueOnMounted: boolean;
|
|
53
59
|
};
|
|
54
60
|
constructor(props: InputPropsWithRef);
|
|
55
61
|
static getDerivedStateFromProps(nextProps: InputPropsWithRef, prevStates: InputStates): InputStates;
|
|
56
62
|
componentDidMount(): void;
|
|
57
63
|
isFileUpload: () => boolean;
|
|
58
64
|
getFileInfo: (element: HTMLInputElement) => File;
|
|
65
|
+
/**
|
|
66
|
+
* 在触发了onChange的前提下,如果当前为失焦状态,则触发一次onBlur
|
|
67
|
+
* @param value
|
|
68
|
+
*/
|
|
69
|
+
onBlurOnMounted: (value: any) => void;
|
|
70
|
+
checkCurrentValue: () => void;
|
|
59
71
|
/**
|
|
60
72
|
* 修改value值的回调
|
|
61
73
|
* @param ev
|
package/lib/input/Input.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.InputNotRef = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _utils = require("@autobest-ui/utils");
|
|
10
|
+
var _components = require("@autobest-ui/components");
|
|
10
11
|
var _Adorn = _interopRequireDefault(require("./Adorn"));
|
|
11
12
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
12
13
|
var _extendStatics = function extendStatics(d, b) {
|
|
@@ -54,6 +55,53 @@ var InputNotRef = /** @class */function (_super) {
|
|
|
54
55
|
_this.getFileInfo = function (element) {
|
|
55
56
|
return element && element.files && element.files.length ? element.files[0] : undefined;
|
|
56
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* 在触发了onChange的前提下,如果当前为失焦状态,则触发一次onBlur
|
|
60
|
+
* @param value
|
|
61
|
+
*/
|
|
62
|
+
_this.onBlurOnMounted = function (value) {
|
|
63
|
+
var _a = _this.props,
|
|
64
|
+
onBlur = _a.onBlur,
|
|
65
|
+
autoFocus = _a.autoFocus,
|
|
66
|
+
name = _a.name;
|
|
67
|
+
if (!onBlur || autoFocus || document.activeElement === _this.inputRef.current) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
onBlur(value, name);
|
|
71
|
+
};
|
|
72
|
+
_this.checkCurrentValue = function () {
|
|
73
|
+
if (!_this.inputRef.current) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (_this.isFileUpload()) {
|
|
77
|
+
var file = _this.getFileInfo(_this.inputRef.current);
|
|
78
|
+
if (file) {
|
|
79
|
+
var _a = _this.props,
|
|
80
|
+
name_1 = _a.name,
|
|
81
|
+
onChange = _a.onChange;
|
|
82
|
+
if (onChange) {
|
|
83
|
+
onChange(file, name_1);
|
|
84
|
+
}
|
|
85
|
+
_this.onBlurOnMounted(file);
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var value = _this.inputRef.current.value;
|
|
90
|
+
if (!(0, _utils.isBlank)(value) && _this.state.value !== value) {
|
|
91
|
+
var _b = _this.props,
|
|
92
|
+
name_2 = _b.name,
|
|
93
|
+
onChange = _b.onChange;
|
|
94
|
+
if (onChange) {
|
|
95
|
+
onChange(value, name_2);
|
|
96
|
+
_this.onBlurOnMounted(value);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
_this.setState({
|
|
100
|
+
value: value
|
|
101
|
+
});
|
|
102
|
+
_this.onBlurOnMounted(value);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
57
105
|
/**
|
|
58
106
|
* 修改value值的回调
|
|
59
107
|
* @param ev
|
|
@@ -145,6 +193,10 @@ var InputNotRef = /** @class */function (_super) {
|
|
|
145
193
|
}
|
|
146
194
|
element.focus();
|
|
147
195
|
}
|
|
196
|
+
if (this.props.checkValueOnMounted) {
|
|
197
|
+
// ssr在网络慢时,用户在js文件加载完前修改input框的会导致不触发onChange
|
|
198
|
+
this.checkCurrentValue();
|
|
199
|
+
}
|
|
148
200
|
};
|
|
149
201
|
InputNotRef.prototype.render = function () {
|
|
150
202
|
var cls = this.prefixCls;
|
|
@@ -158,7 +210,11 @@ var InputNotRef = /** @class */function (_super) {
|
|
|
158
210
|
className = _a.className,
|
|
159
211
|
prefix = _a.prefix,
|
|
160
212
|
suffix = _a.suffix,
|
|
161
|
-
maxLength = _a.maxLength
|
|
213
|
+
maxLength = _a.maxLength,
|
|
214
|
+
title = _a.title,
|
|
215
|
+
onKeyUp = _a.onKeyUp,
|
|
216
|
+
name = _a.name,
|
|
217
|
+
autoComplete = _a.autoComplete;
|
|
162
218
|
var value = this.state.value;
|
|
163
219
|
var isFileUpload = this.isFileUpload();
|
|
164
220
|
return /*#__PURE__*/_react.default.createElement(_Adorn.default, {
|
|
@@ -171,21 +227,27 @@ var InputNotRef = /** @class */function (_super) {
|
|
|
171
227
|
suffix: suffix
|
|
172
228
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
173
229
|
className: "".concat(cls, "-control"),
|
|
174
|
-
ref: (0,
|
|
230
|
+
ref: (0, _components.composeRef)(this.inputRef, upperRef),
|
|
175
231
|
type: type,
|
|
176
232
|
placeholder: placeholder,
|
|
177
233
|
disabled: disabled,
|
|
178
234
|
accept: accept,
|
|
179
235
|
maxLength: maxLength,
|
|
180
236
|
style: style,
|
|
237
|
+
name: name,
|
|
181
238
|
value: isFileUpload ? undefined : value || '',
|
|
182
239
|
onChange: this.onChange,
|
|
183
|
-
onKeyDown: this.onKeyDown
|
|
240
|
+
onKeyDown: this.onKeyDown,
|
|
241
|
+
title: title,
|
|
242
|
+
onKeyUp: onKeyUp,
|
|
243
|
+
"aria-label": this.props['aria-label'],
|
|
244
|
+
autoComplete: autoComplete
|
|
184
245
|
}));
|
|
185
246
|
};
|
|
186
247
|
InputNotRef.defaultProps = {
|
|
187
248
|
defaultValue: '',
|
|
188
|
-
type: 'text'
|
|
249
|
+
type: 'text',
|
|
250
|
+
checkValueOnMounted: false
|
|
189
251
|
};
|
|
190
252
|
return InputNotRef;
|
|
191
253
|
}(_react.default.Component);
|
package/lib/input/TextArea.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export interface TextAreaProps extends Omit<AdornProps, 'prefixCls' | 'children'
|
|
|
33
33
|
* 用户触发keydown时的回调,主要用于键盘监听
|
|
34
34
|
*/
|
|
35
35
|
onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>, name?: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* 在网络慢时,组件已经渲染js文件还未加载,用户此时修改input框会不触发onChange事件
|
|
38
|
+
* 需要在组件加载后检测输入框内容,触发一次onChange
|
|
39
|
+
*/
|
|
40
|
+
checkValueOnMounted?: boolean;
|
|
36
41
|
}
|
|
37
42
|
interface TextareaStates {
|
|
38
43
|
value: string | undefined;
|
|
@@ -51,10 +56,13 @@ export declare class TextAreaNotRef extends React.Component<TextAreaPropsWithRef
|
|
|
51
56
|
defaultValue: string;
|
|
52
57
|
rows: number;
|
|
53
58
|
maxlength: number;
|
|
59
|
+
checkValueOnMounted: boolean;
|
|
54
60
|
};
|
|
55
61
|
constructor(props: TextAreaPropsWithRef);
|
|
56
62
|
static getDerivedStateFromProps(nextProps: TextAreaPropsWithRef, prevStates: TextareaStates): TextareaStates;
|
|
57
63
|
componentDidMount(): void;
|
|
64
|
+
changeValue: (value: any, onBlurAfterChange?: boolean) => void;
|
|
65
|
+
checkCurrentValue: () => void;
|
|
58
66
|
/**
|
|
59
67
|
* 修改value值的回调
|
|
60
68
|
* @param ev
|