@autobest-ui/components 2.9.2 → 2.10.0-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.
Files changed (107) hide show
  1. package/esm/affix/index.d.ts +3 -3
  2. package/esm/affix/index.js +2 -2
  3. package/esm/carousel/index.d.ts +2 -2
  4. package/esm/carousel/index.js +1 -1
  5. package/esm/checkbox/Checkbox.d.ts +60 -0
  6. package/esm/checkbox/Checkbox.js +120 -0
  7. package/esm/checkbox/CheckboxGroup.d.ts +16 -0
  8. package/esm/checkbox/CheckboxGroup.js +57 -0
  9. package/esm/checkbox/index.d.ts +4 -52
  10. package/esm/checkbox/index.js +2 -114
  11. package/esm/checkbox/style/index.css +1 -1
  12. package/esm/ellipsis/index.d.ts +1 -8
  13. package/esm/ellipsis/index.js +9 -9
  14. package/esm/ellipsis/style/index.css +1 -1
  15. package/esm/index.d.ts +6 -3
  16. package/esm/index.js +4 -2
  17. package/esm/input/Input.d.ts +13 -1
  18. package/esm/input/Input.js +64 -4
  19. package/esm/input/TextArea.d.ts +8 -0
  20. package/esm/input/TextArea.js +43 -12
  21. package/esm/input-number/getParserOriginalValue.d.ts +26 -0
  22. package/esm/input-number/getParserOriginalValue.js +73 -0
  23. package/esm/input-number/index.d.ts +20 -7
  24. package/esm/input-number/index.js +60 -48
  25. package/esm/modal/index.d.ts +3 -3
  26. package/esm/modal/index.js +2 -2
  27. package/esm/move/index.d.ts +6 -6
  28. package/esm/move/index.js +5 -5
  29. package/esm/popover/index.d.ts +1 -1
  30. package/esm/popover/index.js +7 -2
  31. package/esm/radio/Radio.d.ts +4 -0
  32. package/esm/radio/Radio.js +80 -0
  33. package/esm/radio/RadioGroup.d.ts +16 -0
  34. package/esm/radio/RadioGroup.js +106 -0
  35. package/esm/radio/context.d.ts +5 -0
  36. package/esm/radio/context.js +4 -0
  37. package/esm/radio/index.d.ts +3 -0
  38. package/esm/radio/index.js +2 -0
  39. package/esm/radio/interface.d.ts +17 -0
  40. package/esm/radio/interface.js +1 -0
  41. package/esm/radio/style/index.css +1 -0
  42. package/esm/select/index.d.ts +2 -2
  43. package/esm/select/index.js +1 -1
  44. package/esm/style.css +1 -1
  45. package/esm/table/body/CheckIcon.js +1 -1
  46. package/esm/table/header/CheckIcon.js +1 -1
  47. package/esm/table/index.d.ts +2 -2
  48. package/esm/table/index.js +2 -1
  49. package/esm/table/style/index.css +1 -1
  50. package/esm/tabs/index.d.ts +2 -2
  51. package/esm/tabs/index.js +1 -1
  52. package/esm/trigger/index.d.ts +5 -5
  53. package/esm/trigger/index.js +5 -5
  54. package/lib/affix/index.d.ts +3 -3
  55. package/lib/affix/index.js +2 -2
  56. package/lib/carousel/index.d.ts +2 -2
  57. package/lib/carousel/index.js +1 -1
  58. package/lib/checkbox/Checkbox.d.ts +60 -0
  59. package/lib/checkbox/Checkbox.js +128 -0
  60. package/lib/checkbox/CheckboxGroup.d.ts +16 -0
  61. package/lib/checkbox/CheckboxGroup.js +65 -0
  62. package/lib/checkbox/index.d.ts +4 -52
  63. package/lib/checkbox/index.js +13 -115
  64. package/lib/checkbox/style/index.css +1 -1
  65. package/lib/ellipsis/index.d.ts +1 -8
  66. package/lib/ellipsis/index.js +9 -9
  67. package/lib/ellipsis/style/index.css +1 -1
  68. package/lib/index.d.ts +6 -3
  69. package/lib/index.js +40 -2
  70. package/lib/input/Input.d.ts +13 -1
  71. package/lib/input/Input.js +64 -4
  72. package/lib/input/TextArea.d.ts +8 -0
  73. package/lib/input/TextArea.js +43 -12
  74. package/lib/input-number/getParserOriginalValue.d.ts +26 -0
  75. package/lib/input-number/getParserOriginalValue.js +79 -0
  76. package/lib/input-number/index.d.ts +20 -7
  77. package/lib/input-number/index.js +59 -47
  78. package/lib/modal/index.d.ts +3 -3
  79. package/lib/modal/index.js +2 -2
  80. package/lib/move/index.d.ts +6 -6
  81. package/lib/move/index.js +5 -5
  82. package/lib/popover/index.d.ts +1 -1
  83. package/lib/popover/index.js +7 -2
  84. package/lib/radio/Radio.d.ts +4 -0
  85. package/lib/radio/Radio.js +91 -0
  86. package/lib/radio/RadioGroup.d.ts +16 -0
  87. package/lib/radio/RadioGroup.js +117 -0
  88. package/lib/radio/context.d.ts +5 -0
  89. package/lib/radio/context.js +15 -0
  90. package/lib/radio/index.d.ts +3 -0
  91. package/lib/radio/index.js +20 -0
  92. package/lib/radio/interface.d.ts +17 -0
  93. package/lib/radio/interface.js +5 -0
  94. package/lib/radio/style/index.css +1 -0
  95. package/lib/select/index.d.ts +2 -2
  96. package/lib/select/index.js +1 -1
  97. package/lib/style.css +1 -1
  98. package/lib/table/body/CheckIcon.js +2 -2
  99. package/lib/table/header/CheckIcon.js +2 -2
  100. package/lib/table/index.d.ts +2 -2
  101. package/lib/table/index.js +2 -1
  102. package/lib/table/style/index.css +1 -1
  103. package/lib/tabs/index.d.ts +2 -2
  104. package/lib/tabs/index.js +1 -1
  105. package/lib/trigger/index.d.ts +5 -5
  106. package/lib/trigger/index.js +5 -5
  107. package/package.json +5 -4
@@ -160,11 +160,11 @@ var Affix = /** @class */function (_super) {
160
160
  };
161
161
  Affix.prototype.componentWillUnmount = function () {
162
162
  if (this.scrollHandler) {
163
- this.scrollHandler.remove();
163
+ this.scrollHandler();
164
164
  this.scrollHandler = null;
165
165
  }
166
166
  if (this.resizeHandler) {
167
- this.resizeHandler.remove();
167
+ this.resizeHandler();
168
168
  this.resizeHandler = null;
169
169
  }
170
170
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { AddListenerEventHandler } from '@autobest-ui/utils';
2
+ import { AddListenerEventRemoveHandler } from '@autobest-ui/utils';
3
3
  export interface CarouselProps {
4
4
  children: React.ReactElement[] | React.ReactElement;
5
5
  /**
@@ -74,7 +74,7 @@ declare class Carousel extends React.Component<CarouselProps, CarouselStates> {
74
74
  fadeEffect: boolean;
75
75
  monitorWindowResize: boolean;
76
76
  };
77
- resizeHandler: AddListenerEventHandler | null;
77
+ resizeHandler: AddListenerEventRemoveHandler | null;
78
78
  constructor(props: any);
79
79
  componentDidMount(): void;
80
80
  componentDidUpdate(prevProps: CarouselProps): void;
@@ -317,7 +317,7 @@ var Carousel = /** @class */function (_super) {
317
317
  clearTimeout(this.autoplayTimer);
318
318
  clearTimeout(this.fadeEffectTimer);
319
319
  if (this.resizeHandler) {
320
- this.resizeHandler.remove();
320
+ this.resizeHandler();
321
321
  this.resizeHandler = null;
322
322
  }
323
323
  if (this.intersectionObserver) {
@@ -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,128 @@
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 __extends = void 0 && (void 0).__extends || function () {
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
+ theme = _b.theme;
60
+ var visible = _this.state.visible;
61
+ var innerStyle = {
62
+ width: "".concat(size, "px"),
63
+ height: "".concat(size, "px")
64
+ };
65
+ var iconStyle = {
66
+ width: "".concat(size * 6 / 16, "px"),
67
+ height: "".concat(size * 10 / 16, "px")
68
+ };
69
+ return /*#__PURE__*/_react.default.createElement("span", {
70
+ className: (0, _classnames.default)(cls, className, "".concat(cls, "-").concat(theme), (_a = {}, _a["".concat(cls, "-checked")] = visible, _a["".concat(cls, "-disabled")] = disabled, _a))
71
+ }, /*#__PURE__*/_react.default.createElement("input", {
72
+ className: "".concat(cls, "-input"),
73
+ type: "checkbox",
74
+ onChange: _this.onVisibleChange
75
+ }), /*#__PURE__*/_react.default.createElement("span", {
76
+ className: "".concat(cls, "-inner"),
77
+ style: innerStyle
78
+ }, /*#__PURE__*/_react.default.createElement("span", {
79
+ className: "".concat(cls, "-icon"),
80
+ style: iconStyle
81
+ })));
82
+ };
83
+ _this.onClick = function (e) {
84
+ e.stopPropagation();
85
+ };
86
+ _this.state = {
87
+ visible: props.checked || props.defaultChecked
88
+ };
89
+ return _this;
90
+ }
91
+ Checkbox.getDerivedStateFromProps = function (nextProps, prevState) {
92
+ // 如果父级传了 checked 则更新 state
93
+ if ('checked' in nextProps && nextProps.checked !== prevState.visible) {
94
+ return {
95
+ visible: nextProps.checked
96
+ };
97
+ }
98
+ return null;
99
+ };
100
+ Checkbox.prototype.render = function () {
101
+ var _a;
102
+ var _b = this.props,
103
+ className = _b.className,
104
+ disabled = _b.disabled,
105
+ children = _b.children,
106
+ reverse = _b.reverse;
107
+ // 只渲染复选框
108
+ if (!children) {
109
+ return this.renderBox();
110
+ }
111
+ return /*#__PURE__*/_react.default.createElement("label", {
112
+ onClick: this.onClick,
113
+ className: (0, _classnames.default)("".concat(cls, "-wrap"), className, (_a = {}, _a["".concat(cls, "-reverse")] = reverse, _a["".concat(cls, "-disabled")] = disabled, _a))
114
+ }, this.renderBox(), children ? /*#__PURE__*/_react.default.createElement("span", {
115
+ className: "".concat(cls, "-content")
116
+ }, children) : null);
117
+ };
118
+ Checkbox.defaultProps = {
119
+ size: 16,
120
+ disabled: false,
121
+ defaultChecked: false,
122
+ reverse: false,
123
+ theme: 'white'
124
+ };
125
+ return Checkbox;
126
+ }(_react.default.Component);
127
+ var _default = Checkbox;
128
+ exports.default = _default;
@@ -0,0 +1,16 @@
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
+ value?: string | number;
7
+ checked: boolean;
8
+ }
9
+ export interface CheckboxGroupProps extends CommonCheckboxProps {
10
+ className?: string;
11
+ name?: string;
12
+ onChange: (options: CheckboxGroupOptionItem[], name?: string) => void;
13
+ options: CheckboxGroupOptionItem[];
14
+ }
15
+ declare const CheckboxGroup: FC<CheckboxGroupProps>;
16
+ export default CheckboxGroup;
@@ -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;
@@ -1,52 +1,4 @@
1
- import React 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
- 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';
@@ -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.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- var __extends = void 0 && (void 0).__extends || function () {
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
- Checkbox.getDerivedStateFromProps = function (nextProps, prevState) {
88
- // 如果父级传了 checked 则更新 state
89
- if ('checked' in nextProps && nextProps.checked !== prevState.visible) {
90
- return {
91
- visible: nextProps.checked
92
- };
93
- }
94
- return null;
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}
@@ -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?: EllipsisLinesType;
22
- /**
23
- * 移动端限制显示的行数,若不传值,则移动端会不做行数限值,显示全
24
- */
25
- mobileLines?: EllipsisLinesType;
18
+ lines?: number;
26
19
  /**
27
20
  * title属性
28
21
  */
@@ -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
- _c = props.lines,
30
- lines = _c === void 0 ? 0 : _c,
31
- title = props.title,
32
- _d = props.mobileLines,
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}.ab-ellipsis.ab-ellipsis-line1{-webkit-line-clamp:1}.ab-ellipsis.ab-ellipsis-line2{-webkit-line-clamp:2}.ab-ellipsis.ab-ellipsis-line3{-webkit-line-clamp:3}.ab-ellipsis.ab-ellipsis-line4{-webkit-line-clamp:4}.ab-ellipsis.ab-ellipsis-line5{-webkit-line-clamp:5}.ab-ellipsis.ab-ellipsis-line6{-webkit-line-clamp:6}.ab-ellipsis.ab-ellipsis-line7{-webkit-line-clamp:7}.ab-ellipsis.ab-ellipsis-line8{-webkit-line-clamp:8}.ab-ellipsis.ab-ellipsis-line9{-webkit-line-clamp:9}@media only screen and (max-width:767px){.ab-ellipsis.ab-ellipsis-line1,.ab-ellipsis.ab-ellipsis-line2,.ab-ellipsis.ab-ellipsis-line3,.ab-ellipsis.ab-ellipsis-line4,.ab-ellipsis.ab-ellipsis-line5,.ab-ellipsis.ab-ellipsis-line6,.ab-ellipsis.ab-ellipsis-line7,.ab-ellipsis.ab-ellipsis-line8,.ab-ellipsis.ab-ellipsis-line9{-webkit-line-clamp:unset}.ab-ellipsis.ab-ellipsis-m-line1{-webkit-line-clamp:1}.ab-ellipsis.ab-ellipsis-m-line2{-webkit-line-clamp:2}.ab-ellipsis.ab-ellipsis-m-line3{-webkit-line-clamp:3}.ab-ellipsis.ab-ellipsis-m-line4{-webkit-line-clamp:4}.ab-ellipsis.ab-ellipsis-m-line5{-webkit-line-clamp:5}.ab-ellipsis.ab-ellipsis-m-line6{-webkit-line-clamp:6}.ab-ellipsis.ab-ellipsis-m-line7{-webkit-line-clamp:7}.ab-ellipsis.ab-ellipsis-m-line8{-webkit-line-clamp:8}.ab-ellipsis.ab-ellipsis-m-line9{-webkit-line-clamp:9}}
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, EllipsisLinesType } from './ellipsis';
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 { default as Checkbox } from './checkbox';
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';
@@ -56,3 +56,6 @@ export type { LoadingIconProps } from './loading-icon';
56
56
  export { default as LoadingIcon } from './loading-icon';
57
57
  export type { TriggerProps, TriggerType, TriggerPlacement, ArrowStyleProps } from './trigger';
58
58
  export { default as Trigger } from './trigger';
59
+ export { composeRef, supportRef, fillRef } from './trigger/ref';
60
+ export type { RadioProps, RadioGroupProps, RadioValue, RadioOptionItem } from './radio';
61
+ export { Radio, RadioGroup } from './radio';