@autobest-ui/components 2.9.0 → 2.9.2-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/checkbox/Checkbox.d.ts +60 -0
- package/esm/checkbox/Checkbox.js +120 -0
- package/esm/checkbox/CheckboxGroup.d.ts +15 -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 -6
- package/esm/ellipsis/index.js +9 -9
- package/esm/ellipsis/style/index.css +1 -1
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/loading-icon/index.d.ts +2 -1
- package/esm/loading-icon/index.js +4 -2
- package/esm/select/style/index.css +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.js +1 -0
- package/esm/table/style/index.css +1 -1
- package/lib/checkbox/Checkbox.d.ts +60 -0
- package/lib/checkbox/Checkbox.js +128 -0
- package/lib/checkbox/CheckboxGroup.d.ts +15 -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 -6
- package/lib/ellipsis/index.js +9 -9
- package/lib/ellipsis/style/index.css +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +8 -2
- package/lib/loading-icon/index.d.ts +2 -1
- package/lib/loading-icon/index.js +4 -2
- package/lib/select/style/index.css +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.js +1 -0
- package/lib/table/style/index.css +1 -1
- package/package.json +4 -5
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { MouseEvent } from 'react';
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
children?: React.ReactChild | React.ReactChild[];
|
|
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
|
+
* 主题样式
|
|
35
|
+
* white为选中时白底红箭头
|
|
36
|
+
* blue为选中时蓝底白箭头
|
|
37
|
+
*/
|
|
38
|
+
theme?: 'white' | 'blue';
|
|
39
|
+
}
|
|
40
|
+
interface CheckboxState {
|
|
41
|
+
visible: boolean;
|
|
42
|
+
}
|
|
43
|
+
declare class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
|
|
44
|
+
static defaultProps: {
|
|
45
|
+
size: number;
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
defaultChecked: boolean;
|
|
48
|
+
reverse: boolean;
|
|
49
|
+
theme: string;
|
|
50
|
+
};
|
|
51
|
+
constructor(props: any);
|
|
52
|
+
static getDerivedStateFromProps(nextProps: CheckboxProps, prevState: CheckboxState): {
|
|
53
|
+
visible: boolean;
|
|
54
|
+
};
|
|
55
|
+
onVisibleChange: () => void;
|
|
56
|
+
renderBox: () => JSX.Element;
|
|
57
|
+
onClick: (e: MouseEvent<HTMLLabelElement>) => void;
|
|
58
|
+
render(): JSX.Element;
|
|
59
|
+
}
|
|
60
|
+
export default Checkbox;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __extends = this && this.__extends || function () {
|
|
2
|
+
var _extendStatics = function extendStatics(d, b) {
|
|
3
|
+
_extendStatics = Object.setPrototypeOf || {
|
|
4
|
+
__proto__: []
|
|
5
|
+
} instanceof Array && function (d, b) {
|
|
6
|
+
d.__proto__ = b;
|
|
7
|
+
} || function (d, b) {
|
|
8
|
+
for (var p in b) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return _extendStatics(d, b);
|
|
13
|
+
};
|
|
14
|
+
return function (d, b) {
|
|
15
|
+
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
16
|
+
_extendStatics(d, b);
|
|
17
|
+
function __() {
|
|
18
|
+
this.constructor = d;
|
|
19
|
+
}
|
|
20
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
21
|
+
};
|
|
22
|
+
}();
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
var cls = 'ab-checkbox';
|
|
26
|
+
var Checkbox = /** @class */function (_super) {
|
|
27
|
+
__extends(Checkbox, _super);
|
|
28
|
+
function Checkbox(props) {
|
|
29
|
+
var _this = _super.call(this, props) || this;
|
|
30
|
+
_this.onVisibleChange = function () {
|
|
31
|
+
var _a = _this.props,
|
|
32
|
+
disabled = _a.disabled,
|
|
33
|
+
onChange = _a.onChange,
|
|
34
|
+
name = _a.name;
|
|
35
|
+
if (disabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var visible = !_this.state.visible;
|
|
39
|
+
if (!('checked' in _this.props)) {
|
|
40
|
+
_this.setState({
|
|
41
|
+
visible: visible
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
onChange(visible, name);
|
|
45
|
+
};
|
|
46
|
+
_this.renderBox = function () {
|
|
47
|
+
var _a;
|
|
48
|
+
var _b = _this.props,
|
|
49
|
+
className = _b.className,
|
|
50
|
+
disabled = _b.disabled,
|
|
51
|
+
size = _b.size,
|
|
52
|
+
theme = _b.theme;
|
|
53
|
+
var visible = _this.state.visible;
|
|
54
|
+
var innerStyle = {
|
|
55
|
+
width: "".concat(size, "px"),
|
|
56
|
+
height: "".concat(size, "px")
|
|
57
|
+
};
|
|
58
|
+
var iconStyle = {
|
|
59
|
+
width: "".concat(size * 6 / 16, "px"),
|
|
60
|
+
height: "".concat(size * 10 / 16, "px")
|
|
61
|
+
};
|
|
62
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
63
|
+
className: classNames(cls, className, "".concat(cls, "-").concat(theme), (_a = {}, _a["".concat(cls, "-checked")] = visible, _a["".concat(cls, "-disabled")] = disabled, _a))
|
|
64
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
65
|
+
className: "".concat(cls, "-input"),
|
|
66
|
+
type: "checkbox",
|
|
67
|
+
onChange: _this.onVisibleChange
|
|
68
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
className: "".concat(cls, "-inner"),
|
|
70
|
+
style: innerStyle
|
|
71
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
72
|
+
className: "".concat(cls, "-icon"),
|
|
73
|
+
style: iconStyle
|
|
74
|
+
})));
|
|
75
|
+
};
|
|
76
|
+
_this.onClick = function (e) {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
};
|
|
79
|
+
_this.state = {
|
|
80
|
+
visible: props.checked || props.defaultChecked
|
|
81
|
+
};
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
Checkbox.getDerivedStateFromProps = function (nextProps, prevState) {
|
|
85
|
+
// 如果父级传了 checked 则更新 state
|
|
86
|
+
if ('checked' in nextProps && nextProps.checked !== prevState.visible) {
|
|
87
|
+
return {
|
|
88
|
+
visible: nextProps.checked
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
};
|
|
93
|
+
Checkbox.prototype.render = function () {
|
|
94
|
+
var _a;
|
|
95
|
+
var _b = this.props,
|
|
96
|
+
className = _b.className,
|
|
97
|
+
disabled = _b.disabled,
|
|
98
|
+
children = _b.children,
|
|
99
|
+
reverse = _b.reverse;
|
|
100
|
+
// 只渲染复选框
|
|
101
|
+
if (!children) {
|
|
102
|
+
return this.renderBox();
|
|
103
|
+
}
|
|
104
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
105
|
+
onClick: this.onClick,
|
|
106
|
+
className: classNames("".concat(cls, "-wrap"), className, (_a = {}, _a["".concat(cls, "-reverse")] = reverse, _a["".concat(cls, "-disabled")] = disabled, _a))
|
|
107
|
+
}, this.renderBox(), children ? /*#__PURE__*/React.createElement("span", {
|
|
108
|
+
className: "".concat(cls, "-content")
|
|
109
|
+
}, children) : null);
|
|
110
|
+
};
|
|
111
|
+
Checkbox.defaultProps = {
|
|
112
|
+
size: 16,
|
|
113
|
+
disabled: false,
|
|
114
|
+
defaultChecked: false,
|
|
115
|
+
reverse: false,
|
|
116
|
+
theme: 'white'
|
|
117
|
+
};
|
|
118
|
+
return Checkbox;
|
|
119
|
+
}(React.Component);
|
|
120
|
+
export default Checkbox;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CheckboxProps } from './Checkbox';
|
|
3
|
+
declare type CommonCheckboxProps = Partial<Pick<CheckboxProps, 'theme' | 'reverse' | 'disabled'>>;
|
|
4
|
+
export interface CheckboxGroupOptionItem extends CommonCheckboxProps {
|
|
5
|
+
name: string;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CheckboxGroupProps extends CommonCheckboxProps {
|
|
9
|
+
className?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
onChange: (options: CheckboxGroupOptionItem[], name?: string) => void;
|
|
12
|
+
options: CheckboxGroupOptionItem[];
|
|
13
|
+
}
|
|
14
|
+
declare const CheckboxGroup: FC<CheckboxGroupProps>;
|
|
15
|
+
export default CheckboxGroup;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { isEmptyArray, isUndef } from '@autobest-ui/utils';
|
|
16
|
+
import Checkbox from './Checkbox';
|
|
17
|
+
function getCheckboxProp(checkboxProp, checkboxGroupProp) {
|
|
18
|
+
return isUndef(checkboxProp) ? checkboxGroupProp : checkboxProp;
|
|
19
|
+
}
|
|
20
|
+
var cls = 'ab-checkbox';
|
|
21
|
+
var CheckboxGroup = function CheckboxGroup(_a) {
|
|
22
|
+
var onChange = _a.onChange,
|
|
23
|
+
groupName = _a.name,
|
|
24
|
+
options = _a.options,
|
|
25
|
+
className = _a.className,
|
|
26
|
+
disabled = _a.disabled,
|
|
27
|
+
reverse = _a.reverse,
|
|
28
|
+
theme = _a.theme;
|
|
29
|
+
if (isEmptyArray(options)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
var onCheckboxChange = function onCheckboxChange(checked, name) {
|
|
33
|
+
var newOptions = options.map(function (item) {
|
|
34
|
+
if (item.name === name) {
|
|
35
|
+
return __assign(__assign({}, item), {
|
|
36
|
+
checked: checked
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return item;
|
|
40
|
+
});
|
|
41
|
+
onChange(newOptions, groupName);
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: classNames("".concat(cls, "-group"), className)
|
|
45
|
+
}, options.map(function (item) {
|
|
46
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
47
|
+
key: item.name,
|
|
48
|
+
name: item.name,
|
|
49
|
+
reverse: getCheckboxProp(item.reverse, reverse),
|
|
50
|
+
theme: getCheckboxProp(item.theme, theme),
|
|
51
|
+
disabled: getCheckboxProp(item.disabled, disabled),
|
|
52
|
+
checked: item.checked,
|
|
53
|
+
onChange: onCheckboxChange
|
|
54
|
+
}, item.name);
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
export default CheckboxGroup;
|
package/esm/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/esm/checkbox/index.js
CHANGED
|
@@ -1,114 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
_extendStatics = Object.setPrototypeOf || {
|
|
4
|
-
__proto__: []
|
|
5
|
-
} instanceof Array && function (d, b) {
|
|
6
|
-
d.__proto__ = b;
|
|
7
|
-
} || function (d, b) {
|
|
8
|
-
for (var p in b) {
|
|
9
|
-
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
return _extendStatics(d, b);
|
|
13
|
-
};
|
|
14
|
-
return function (d, b) {
|
|
15
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
16
|
-
_extendStatics(d, b);
|
|
17
|
-
function __() {
|
|
18
|
-
this.constructor = d;
|
|
19
|
-
}
|
|
20
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
21
|
-
};
|
|
22
|
-
}();
|
|
23
|
-
import React from 'react';
|
|
24
|
-
import classNames from 'classnames';
|
|
25
|
-
var cls = 'ab-checkbox';
|
|
26
|
-
var Checkbox = /** @class */function (_super) {
|
|
27
|
-
__extends(Checkbox, _super);
|
|
28
|
-
function Checkbox(props) {
|
|
29
|
-
var _this = _super.call(this, props) || this;
|
|
30
|
-
_this.onVisibleChange = function () {
|
|
31
|
-
var _a = _this.props,
|
|
32
|
-
disabled = _a.disabled,
|
|
33
|
-
onChange = _a.onChange,
|
|
34
|
-
name = _a.name;
|
|
35
|
-
if (disabled) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
var visible = !_this.state.visible;
|
|
39
|
-
if (!('checked' in _this.props)) {
|
|
40
|
-
_this.setState({
|
|
41
|
-
visible: visible
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
onChange(visible, name);
|
|
45
|
-
};
|
|
46
|
-
_this.renderBox = function () {
|
|
47
|
-
var _a;
|
|
48
|
-
var _b = _this.props,
|
|
49
|
-
className = _b.className,
|
|
50
|
-
disabled = _b.disabled,
|
|
51
|
-
size = _b.size;
|
|
52
|
-
var visible = _this.state.visible;
|
|
53
|
-
var innerStyle = {
|
|
54
|
-
width: "".concat(size, "px"),
|
|
55
|
-
height: "".concat(size, "px")
|
|
56
|
-
};
|
|
57
|
-
var iconStyle = {
|
|
58
|
-
width: "".concat(size * 6 / 16, "px"),
|
|
59
|
-
height: "".concat(size * 10 / 16, "px")
|
|
60
|
-
};
|
|
61
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
62
|
-
className: classNames(cls, className, (_a = {}, _a["".concat(cls, "-checked")] = visible, _a["".concat(cls, "-disabled")] = disabled, _a))
|
|
63
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
64
|
-
className: "".concat(cls, "-input"),
|
|
65
|
-
type: "checkbox",
|
|
66
|
-
onChange: _this.onVisibleChange
|
|
67
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
68
|
-
className: "".concat(cls, "-inner"),
|
|
69
|
-
style: innerStyle
|
|
70
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
71
|
-
className: "".concat(cls, "-icon"),
|
|
72
|
-
style: iconStyle
|
|
73
|
-
})));
|
|
74
|
-
};
|
|
75
|
-
_this.state = {
|
|
76
|
-
visible: props.checked || props.defaultChecked
|
|
77
|
-
};
|
|
78
|
-
return _this;
|
|
79
|
-
}
|
|
80
|
-
Checkbox.getDerivedStateFromProps = function (nextProps, prevState) {
|
|
81
|
-
// 如果父级传了 checked 则更新 state
|
|
82
|
-
if ('checked' in nextProps && nextProps.checked !== prevState.visible) {
|
|
83
|
-
return {
|
|
84
|
-
visible: nextProps.checked
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
};
|
|
89
|
-
Checkbox.prototype.render = function () {
|
|
90
|
-
var _a;
|
|
91
|
-
var _b = this.props,
|
|
92
|
-
className = _b.className,
|
|
93
|
-
disabled = _b.disabled,
|
|
94
|
-
children = _b.children,
|
|
95
|
-
reverse = _b.reverse;
|
|
96
|
-
// 只渲染复选框
|
|
97
|
-
if (!children) {
|
|
98
|
-
return this.renderBox();
|
|
99
|
-
}
|
|
100
|
-
return /*#__PURE__*/React.createElement("label", {
|
|
101
|
-
className: classNames("".concat(cls, "-wrap"), className, (_a = {}, _a["".concat(cls, "-reverse")] = reverse, _a["".concat(cls, "-disabled")] = disabled, _a))
|
|
102
|
-
}, this.renderBox(), children ? /*#__PURE__*/React.createElement("span", {
|
|
103
|
-
className: "".concat(cls, "-content")
|
|
104
|
-
}, children) : null);
|
|
105
|
-
};
|
|
106
|
-
Checkbox.defaultProps = {
|
|
107
|
-
size: 16,
|
|
108
|
-
disabled: false,
|
|
109
|
-
defaultChecked: false,
|
|
110
|
-
reverse: false
|
|
111
|
-
};
|
|
112
|
-
return Checkbox;
|
|
113
|
-
}(React.Component);
|
|
114
|
-
export default Checkbox;
|
|
1
|
+
export { default as Checkbox } from './Checkbox';
|
|
2
|
+
export { default as CheckboxGroup } from './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/esm/ellipsis/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare type EllipsisLinesType = 1 | 2 | 3 | 4 | 5;
|
|
3
2
|
export interface EllipsisProps {
|
|
4
3
|
/**
|
|
5
4
|
* 需要显示的文本
|
|
@@ -16,11 +15,7 @@ export interface EllipsisProps {
|
|
|
16
15
|
/**
|
|
17
16
|
* 桌面端限制显示的行数,若不传值,则桌面端会不做行数限值,显示全
|
|
18
17
|
*/
|
|
19
|
-
lines?:
|
|
20
|
-
/**
|
|
21
|
-
* 移动端限制显示的行数,若不传值,则移动端会不做行数限值,显示全
|
|
22
|
-
*/
|
|
23
|
-
mobileLines?: EllipsisLinesType;
|
|
18
|
+
lines?: number;
|
|
24
19
|
/**
|
|
25
20
|
* title属性
|
|
26
21
|
*/
|
package/esm/ellipsis/index.js
CHANGED
|
@@ -15,34 +15,34 @@ import classNames from 'classnames';
|
|
|
15
15
|
import { isElement, isFragment } from 'react-is';
|
|
16
16
|
var cls = 'ab-ellipsis';
|
|
17
17
|
function Ellipsis(props) {
|
|
18
|
-
var _a, _b;
|
|
19
18
|
var children = props.children,
|
|
20
19
|
maxHeight = props.maxHeight,
|
|
21
20
|
className = props.className,
|
|
22
|
-
|
|
23
|
-
lines =
|
|
24
|
-
title = props.title
|
|
25
|
-
|
|
26
|
-
mobileLines = _d === void 0 ? 0 : _d;
|
|
27
|
-
var wrapCls = classNames(cls, className, (_a = {}, _a["".concat(cls, "-line").concat(lines)] = lines > 0, _a), (_b = {}, _b["".concat(cls, "-m-line").concat(mobileLines)] = mobileLines > 0, _b));
|
|
21
|
+
_a = props.lines,
|
|
22
|
+
lines = _a === void 0 ? 0 : _a,
|
|
23
|
+
title = props.title;
|
|
24
|
+
var wrapCls = classNames(cls, className);
|
|
28
25
|
var style = maxHeight ? {
|
|
29
26
|
maxHeight: maxHeight
|
|
30
27
|
} : null;
|
|
31
28
|
var titleParam = title ? {
|
|
32
29
|
title: title
|
|
33
30
|
} : null;
|
|
31
|
+
var lineStyle = lines > 0 ? {
|
|
32
|
+
'-webkit-line-clamp': "".concat(lines)
|
|
33
|
+
} : null;
|
|
34
34
|
// 当children是单个标签元素时(非文本元素),将直接在该标签上加上style, className,title属性
|
|
35
35
|
if (!isFragment(children) && isElement(children)) {
|
|
36
36
|
var child = children;
|
|
37
37
|
return /*#__PURE__*/React.cloneElement(child, __assign(__assign({}, titleParam), {
|
|
38
38
|
className: classNames(wrapCls, child.props.className),
|
|
39
|
-
style: __assign(__assign({}, style), child.props.style)
|
|
39
|
+
style: __assign(__assign(__assign({}, style), lineStyle), child.props.style)
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
return /*#__PURE__*/React.createElement("span", __assign({
|
|
43
43
|
className: wrapCls
|
|
44
44
|
}, titleParam, {
|
|
45
|
-
style: style
|
|
45
|
+
style: __assign(__assign({}, style), lineStyle)
|
|
46
46
|
}), children);
|
|
47
47
|
}
|
|
48
48
|
export default /*#__PURE__*/React.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/esm/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';
|
|
@@ -34,8 +34,8 @@ export type { LazyImageProps } from './lazy-image';
|
|
|
34
34
|
export { default as LazyImage } from './lazy-image';
|
|
35
35
|
export type { LinkItemProps, LinkListProps, LinkItemSubInfoProps } from './link-list';
|
|
36
36
|
export { default as LinkList } from './link-list';
|
|
37
|
-
export type { CheckboxProps } from './checkbox';
|
|
38
|
-
export {
|
|
37
|
+
export type { CheckboxProps, CheckboxGroupProps } from './checkbox';
|
|
38
|
+
export { Checkbox, CheckboxGroup, CheckboxGroupOptionItem } from './checkbox';
|
|
39
39
|
export type { ScriptAttributes, ScriptProps } from './script';
|
|
40
40
|
export { default as Script } from './script';
|
|
41
41
|
export type { MessageProps, MessageConfig, MessageResult } from './message';
|
package/esm/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { Input, TextArea } from './input';
|
|
|
16
16
|
export { default as InputNumber } from './input-number';
|
|
17
17
|
export { default as LazyImage } from './lazy-image';
|
|
18
18
|
export { default as LinkList } from './link-list';
|
|
19
|
-
export {
|
|
19
|
+
export { Checkbox, CheckboxGroup } from './checkbox';
|
|
20
20
|
export { default as Script } from './script';
|
|
21
21
|
export { default as message, Message } from './message';
|
|
22
22
|
export { default as Table } from './table';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
export interface LoadingIconProps {
|
|
3
3
|
className?: string;
|
|
4
|
+
style?: CSSProperties;
|
|
4
5
|
}
|
|
5
6
|
declare const _default: React.MemoExoticComponent<(props: LoadingIconProps) => JSX.Element>;
|
|
6
7
|
export default _default;
|
|
@@ -2,9 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
var cls = 'ab-svg-loading';
|
|
4
4
|
var LoadingIcon = function LoadingIcon(props) {
|
|
5
|
-
var className = props.className
|
|
5
|
+
var className = props.className,
|
|
6
|
+
style = props.style;
|
|
6
7
|
return /*#__PURE__*/React.createElement("span", {
|
|
7
|
-
className: classNames(className, cls)
|
|
8
|
+
className: classNames(className, cls),
|
|
9
|
+
style: style
|
|
8
10
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
9
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
10
12
|
width: "24",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-trigger-wrap{position:absolute;top:0;left:0;z-index:101}.ab-trigger-wrap.ab-trigger-hidden{display:none}.ab-trigger-mask{position:fixed;top:0;left:0;bottom:0;right:0;z-index:101;background-color:transparent;display:none}.ab-trigger-mask.ab-trigger-mask-show{display:block}.ab-trigger-fade-appear,.ab-trigger-fade-enter,.ab-trigger-fade-hr-appear,.ab-trigger-fade-hr-enter{opacity:0}.ab-trigger-fade-appear,.ab-trigger-fade-enter{transform:scale(.7)}.ab-trigger-fade-hr-appear,.ab-trigger-fade-hr-enter{opacity:0;transform:scaleY(.7)}.ab-trigger-fade-appear-active,.ab-trigger-fade-enter-active,.ab-trigger-fade-hr-appear-active,.ab-trigger-fade-hr-enter-active{opacity:1;transition:opacity .2s,transform .2s}.ab-trigger-fade-appear-active,.ab-trigger-fade-enter-active{transform:scale(1)}.ab-trigger-fade-hr-appear-active,.ab-trigger-fade-hr-enter-active{transform:scaleY(1)}.ab-trigger-fade-exit,.ab-trigger-fade-hr-exit{opacity:1}.ab-trigger-fade-exit-active,.ab-trigger-fade-hr-exit-active{opacity:0;transition:opacity .2s,transform .2s}.ab-trigger-fade-exit-active{transform:scale(.7)}.ab-trigger-fade-hr-exit-active{transform:scaleY(.7)}.ab-trigger-fade-exit-done,.ab-trigger-fade-hr-exit-done{display:none}.ab-select-wrap{min-width:177px;background-color:#fff;background-clip:padding-box;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);display:flex}.ab-select-wrap.ab-trigger-fade-hr-exit-done{display:none}.ab-select-inner{flex:1;width:100%;overflow:auto}.ab-select-bottom,.ab-select-content,.ab-select-title{display:flex}.ab-select-title{padding:.09rem 0;background-color:transparent;cursor:context-menu;border-bottom:1px solid #d7d7d7;font-weight:700;color:#606060;font-size:.12rem;margin:0 .1rem}.ab-select-col{font-size:.12rem;padding-right:.07rem;flex:auto}.ab-select-col:last-child{padding-right:0}.ab-select-col>li{padding:.08rem .11rem;cursor:pointer}.ab-select-col>li:hover{background-color:#eee}.ab-select-col>li.ab-select-active{background-color:#e6f7ff}.ab-select-col>li.ab-select-unselect{background-color:transparent;cursor:context-menu}.ab-select-input-group{position:relative;overflow:hidden}.ab-select-input-control{appearance:none;outline:0;user-select:none;width:100%;border:1px solid #ccc;border-radius:2px;resize:none;transition:.2s;background-color:#fff;text-overflow:ellipsis;padding:.08rem .28rem .07rem .07rem;font-size:.14rem;white-space:nowrap;overflow:hidden;max-width:100
|
|
1
|
+
.ab-trigger-wrap{position:absolute;top:0;left:0;z-index:101}.ab-trigger-wrap.ab-trigger-hidden{display:none}.ab-trigger-mask{position:fixed;top:0;left:0;bottom:0;right:0;z-index:101;background-color:transparent;display:none}.ab-trigger-mask.ab-trigger-mask-show{display:block}.ab-trigger-fade-appear,.ab-trigger-fade-enter,.ab-trigger-fade-hr-appear,.ab-trigger-fade-hr-enter{opacity:0}.ab-trigger-fade-appear,.ab-trigger-fade-enter{transform:scale(.7)}.ab-trigger-fade-hr-appear,.ab-trigger-fade-hr-enter{opacity:0;transform:scaleY(.7)}.ab-trigger-fade-appear-active,.ab-trigger-fade-enter-active,.ab-trigger-fade-hr-appear-active,.ab-trigger-fade-hr-enter-active{opacity:1;transition:opacity .2s,transform .2s}.ab-trigger-fade-appear-active,.ab-trigger-fade-enter-active{transform:scale(1)}.ab-trigger-fade-hr-appear-active,.ab-trigger-fade-hr-enter-active{transform:scaleY(1)}.ab-trigger-fade-exit,.ab-trigger-fade-hr-exit{opacity:1}.ab-trigger-fade-exit-active,.ab-trigger-fade-hr-exit-active{opacity:0;transition:opacity .2s,transform .2s}.ab-trigger-fade-exit-active{transform:scale(.7)}.ab-trigger-fade-hr-exit-active{transform:scaleY(.7)}.ab-trigger-fade-exit-done,.ab-trigger-fade-hr-exit-done{display:none}.ab-select-wrap{min-width:177px;background-color:#fff;background-clip:padding-box;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);display:flex}.ab-select-wrap.ab-trigger-fade-hr-exit-done{display:none}.ab-select-inner{flex:1;width:100%;overflow:auto}.ab-select-bottom,.ab-select-content,.ab-select-title{display:flex}.ab-select-title{padding:.09rem 0;background-color:transparent;cursor:context-menu;border-bottom:1px solid #d7d7d7;font-weight:700;color:#606060;font-size:.12rem;margin:0 .1rem}.ab-select-col{font-size:.12rem;padding-right:.07rem;flex:auto}.ab-select-col:last-child{padding-right:0}.ab-select-col>li{padding:.08rem .11rem;cursor:pointer}.ab-select-col>li:hover{background-color:#eee}.ab-select-col>li.ab-select-active{background-color:#e6f7ff}.ab-select-col>li.ab-select-unselect{background-color:transparent;cursor:context-menu}.ab-select-input-group{position:relative;overflow:hidden;cursor:pointer}.ab-select-input-control{appearance:none;outline:0;user-select:none;width:100%;border:1px solid #ccc;border-radius:2px;resize:none;transition:.2s;background-color:#fff;text-overflow:ellipsis;padding:.08rem .28rem .07rem .07rem;font-size:.14rem;white-space:nowrap;overflow:hidden;max-width:100%}.ab-select-input-control.ab-select-focused{box-shadow:0 0 4px rgba(52,143,238,.8);border-color:rgba(52,143,238,.8)}.ab-select-input-control.ab-select-empty{color:#888}.ab-select-input-control.error{background-color:#fffacd}.ab-select-icon{position:absolute;right:.21rem;top:50%;color:#ccc;font-size:0;transform:translate(100%,-50%);transition:transform .2s}.ab-select-icon svg{font-size:.12rem}.ab-select-active .ab-select-icon{transform:translate(100%,-50%) rotate(180deg)}@media only screen and (max-width:767px){.ab-select-content{display:block}.ab-select-input-control{padding:.1rem .05rem;font-size:.14rem}.ab-select-col{padding-right:0}}
|