@autobest-ui/components 2.13.11 → 2.14.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 (91) hide show
  1. package/esm/carousel/index.d.ts +4 -0
  2. package/esm/carousel/index.js +10 -1
  3. package/esm/checkbox/Checkbox.js +3 -19
  4. package/esm/checkbox/style/index.css +1 -1
  5. package/esm/index.d.ts +6 -0
  6. package/esm/index.js +4 -1
  7. package/esm/input/Adorn.d.ts +4 -0
  8. package/esm/input/Adorn.js +7 -3
  9. package/esm/input/Input.d.ts +1 -0
  10. package/esm/input/Input.js +5 -1
  11. package/esm/input/TextArea.d.ts +1 -0
  12. package/esm/input/TextArea.js +4 -1
  13. package/esm/input-number/index.d.ts +1 -0
  14. package/esm/input-number/index.js +5 -1
  15. package/esm/input-phone/index.d.ts +1 -0
  16. package/esm/input-phone/index.js +1 -0
  17. package/esm/lazy-image/index.d.ts +10 -30
  18. package/esm/lazy-image/index.js +30 -51
  19. package/esm/lazy-image/style/index.css +1 -1
  20. package/esm/loading-container/index.d.ts +1 -19
  21. package/esm/loading-container/index.js +16 -122
  22. package/esm/loading-icon/index.d.ts +1 -1
  23. package/esm/loading-icon/index.js +3 -21
  24. package/esm/move/index.d.ts +10 -0
  25. package/esm/move/index.js +12 -7
  26. package/esm/radio/Radio.js +10 -7
  27. package/esm/radio/RadioGroup.js +3 -6
  28. package/esm/radio/style/index.css +1 -1
  29. package/esm/radio/type.d.ts +0 -2
  30. package/esm/read-more/index.d.ts +92 -0
  31. package/esm/read-more/index.js +377 -0
  32. package/esm/read-more/style/index.css +1 -0
  33. package/esm/read-more-html/index.d.ts +89 -0
  34. package/esm/read-more-html/index.js +362 -0
  35. package/esm/read-more-html/style/index.css +1 -0
  36. package/esm/select/index.d.ts +0 -3
  37. package/esm/select/index.js +4 -25
  38. package/esm/select/style/index.css +1 -1
  39. package/esm/show-more/index.d.ts +27 -12
  40. package/esm/show-more/index.js +87 -41
  41. package/esm/show-more/style/index.css +1 -1
  42. package/esm/style.css +1 -1
  43. package/esm/table/style/index.css +1 -1
  44. package/esm/trigger/index.d.ts +3 -10
  45. package/esm/trigger/index.js +19 -39
  46. package/lib/carousel/index.d.ts +4 -0
  47. package/lib/carousel/index.js +10 -1
  48. package/lib/checkbox/Checkbox.js +3 -19
  49. package/lib/checkbox/style/index.css +1 -1
  50. package/lib/index.d.ts +6 -0
  51. package/lib/index.js +20 -0
  52. package/lib/input/Adorn.d.ts +4 -0
  53. package/lib/input/Adorn.js +7 -3
  54. package/lib/input/Input.d.ts +1 -0
  55. package/lib/input/Input.js +5 -1
  56. package/lib/input/TextArea.d.ts +1 -0
  57. package/lib/input/TextArea.js +4 -1
  58. package/lib/input-number/index.d.ts +1 -0
  59. package/lib/input-number/index.js +5 -1
  60. package/lib/input-phone/index.d.ts +1 -0
  61. package/lib/input-phone/index.js +1 -0
  62. package/lib/lazy-image/index.d.ts +10 -30
  63. package/lib/lazy-image/index.js +30 -51
  64. package/lib/lazy-image/style/index.css +1 -1
  65. package/lib/loading-container/index.d.ts +1 -19
  66. package/lib/loading-container/index.js +16 -125
  67. package/lib/loading-icon/index.d.ts +1 -1
  68. package/lib/loading-icon/index.js +3 -21
  69. package/lib/move/index.d.ts +10 -0
  70. package/lib/move/index.js +12 -7
  71. package/lib/radio/Radio.js +10 -7
  72. package/lib/radio/RadioGroup.js +3 -6
  73. package/lib/radio/style/index.css +1 -1
  74. package/lib/radio/type.d.ts +0 -2
  75. package/lib/read-more/index.d.ts +92 -0
  76. package/lib/read-more/index.js +388 -0
  77. package/lib/read-more/style/index.css +1 -0
  78. package/lib/read-more-html/index.d.ts +89 -0
  79. package/lib/read-more-html/index.js +373 -0
  80. package/lib/read-more-html/style/index.css +1 -0
  81. package/lib/select/index.d.ts +0 -3
  82. package/lib/select/index.js +4 -25
  83. package/lib/select/style/index.css +1 -1
  84. package/lib/show-more/index.d.ts +27 -12
  85. package/lib/show-more/index.js +86 -40
  86. package/lib/show-more/style/index.css +1 -1
  87. package/lib/style.css +1 -1
  88. package/lib/table/style/index.css +1 -1
  89. package/lib/trigger/index.d.ts +3 -10
  90. package/lib/trigger/index.js +19 -39
  91. package/package.json +3 -3
@@ -7,25 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var __assign = void 0 && (void 0).__assign || function () {
11
- __assign = Object.assign || function (t) {
12
- for (var s, i = 1, n = arguments.length; i < n; i++) {
13
- s = arguments[i];
14
- for (var p in s) {
15
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
16
- }
17
- }
18
- return t;
19
- };
20
- return __assign.apply(this, arguments);
21
- };
22
10
  var cls = 'ab-svg-loading';
23
11
  var LoadingIcon = function LoadingIcon(props) {
24
- var className = props.className,
25
- upperRef = props.upperRef;
12
+ var className = props.className;
26
13
  return /*#__PURE__*/_react.default.createElement("span", {
27
- className: (0, _classnames.default)(className, cls),
28
- ref: upperRef
14
+ className: (0, _classnames.default)(className, cls)
29
15
  }, /*#__PURE__*/_react.default.createElement("svg", {
30
16
  xmlns: "http://www.w3.org/2000/svg",
31
17
  width: "24",
@@ -74,9 +60,5 @@ var LoadingIcon = function LoadingIcon(props) {
74
60
  fill: "#fff"
75
61
  })));
76
62
  };
77
- var _default = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
78
- return /*#__PURE__*/_react.default.createElement(LoadingIcon, __assign({}, props, {
79
- upperRef: ref
80
- }));
81
- }));
63
+ var _default = /*#__PURE__*/_react.default.memo(LoadingIcon);
82
64
  exports.default = _default;
@@ -36,6 +36,14 @@ export interface MoveProps {
36
36
  * 点击的回调函数, 如果移动,则不是click
37
37
  */
38
38
  onClick?: (event: any) => void;
39
+ /**
40
+ * 禁止水平方向的移动
41
+ */
42
+ horizontalMoveDisabled?: boolean;
43
+ /**
44
+ * 禁止垂直方向的移动
45
+ */
46
+ verticalMoveDisabled?: boolean;
39
47
  }
40
48
  declare class Move extends React.Component<MoveProps> {
41
49
  readonly prefixCls = "ab-move";
@@ -46,6 +54,8 @@ declare class Move extends React.Component<MoveProps> {
46
54
  maxScalable: number;
47
55
  horizontalPlacement: string;
48
56
  verticalPlacement: string;
57
+ horizontalMoveDisabled: boolean;
58
+ verticalMoveDisabled: boolean;
49
59
  };
50
60
  prevElementSize: {
51
61
  width: number;
package/lib/move/index.js CHANGED
@@ -215,13 +215,16 @@ var Move = /** @class */function (_super) {
215
215
  if (_this.isTouchScale && event.touches.length <= 1) {
216
216
  return;
217
217
  }
218
+ var _a = _this.props,
219
+ horizontalMoveDisabled = _a.horizontalMoveDisabled,
220
+ verticalMoveDisabled = _a.verticalMoveDisabled;
218
221
  _this.moveObj = {
219
222
  left: event.touches ? event.touches[0].pageX : event.clientX,
220
223
  top: event.touches ? event.touches[0].pageY : event.clientY
221
224
  };
222
225
  _this.currentObj = {
223
- left: _this.prevObj.left + _this.moveObj.left - _this.startObj.left,
224
- top: _this.prevObj.top + _this.moveObj.top - _this.startObj.top
226
+ left: horizontalMoveDisabled ? _this.prevObj.left : _this.prevObj.left + _this.moveObj.left - _this.startObj.left,
227
+ top: verticalMoveDisabled ? _this.prevObj.top : _this.prevObj.top + _this.moveObj.top - _this.startObj.top
225
228
  };
226
229
  _this.setElementInfo(element);
227
230
  };
@@ -233,6 +236,10 @@ var Move = /** @class */function (_super) {
233
236
  if (event.stopPropagation) {
234
237
  event.stopPropagation();
235
238
  }
239
+ var onClick = _this.props.onClick;
240
+ if (onClick && _this.currentObj.left === _this.prevObj.left && _this.currentObj.top === _this.prevObj.top && _this.prevScaleSize === _this.currentScaleSize) {
241
+ onClick(event);
242
+ }
236
243
  var _a = _this.checkRange(),
237
244
  nextX = _a.nextX,
238
245
  nextY = _a.nextY,
@@ -247,10 +254,6 @@ var Move = /** @class */function (_super) {
247
254
  _this.currentScaleSize = nextScaleSize;
248
255
  _this.setElementInfo(element);
249
256
  }
250
- var onClick = _this.props.onClick;
251
- if (onClick && _this.currentObj.left === _this.prevObj.left && _this.currentObj.top === _this.prevObj.top && _this.prevScaleSize === _this.currentScaleSize) {
252
- onClick(event);
253
- }
254
257
  };
255
258
  _this.onTransitionEnd = function () {
256
259
  var element = _this.getDomNode();
@@ -385,7 +388,9 @@ var Move = /** @class */function (_super) {
385
388
  minScalable: 1,
386
389
  maxScalable: 1,
387
390
  horizontalPlacement: 'left',
388
- verticalPlacement: 'top'
391
+ verticalPlacement: 'top',
392
+ horizontalMoveDisabled: false,
393
+ verticalMoveDisabled: false
389
394
  };
390
395
  return Move;
391
396
  }(_react.default.Component);
@@ -60,13 +60,14 @@ var Radio = function Radio(props) {
60
60
  if (mergedProps.disabled) {
61
61
  return;
62
62
  }
63
+ var checkedValue = ev.target.value;
63
64
  if (onChange) {
64
- onChange(value, mergedProps.name, ev.target.checked);
65
+ onChange(checkedValue, mergedProps.name, ev.target.checked);
65
66
  return;
66
67
  }
67
68
  // radioGroup
68
69
  if (groupContext.onChange) {
69
- groupContext.onChange(value, mergedProps.name);
70
+ groupContext.onChange(checkedValue, mergedProps.name);
70
71
  return;
71
72
  }
72
73
  setChecked(!checked);
@@ -84,6 +85,7 @@ var Radio = function Radio(props) {
84
85
  },
85
86
  type: "radio",
86
87
  checked: checked,
88
+ value: value,
87
89
  onChange: onRadioChange
88
90
  }, mergedProps)), /*#__PURE__*/_react.default.createElement("span", {
89
91
  className: "".concat(cls, "-control"),
@@ -96,21 +98,22 @@ var Radio = function Radio(props) {
96
98
  className: "".concat(cls, "-outer"),
97
99
  focusable: "false",
98
100
  "aria-hidden": "true",
99
- viewBox: "0 0 20 20"
101
+ viewBox: "0 0 512 512"
100
102
  }, /*#__PURE__*/_react.default.createElement("path", {
101
- stroke: "none",
102
- d: "M10 0C4.48 0 0 4.48 0 10s4.48 10 10 10 10-4.48 10-10S15.52 0 10 0zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
103
+ d: "M448,256c0-106-86-192-192-192S64,150,64,256s86,192,192,192S448,362,448,256Z",
104
+ strokeWidth: "1.5em",
105
+ fill: "#fff"
103
106
  })), /*#__PURE__*/_react.default.createElement("svg", {
104
107
  className: "".concat(cls, "-dot"),
105
108
  focusable: "false",
106
109
  "aria-hidden": "true",
107
110
  viewBox: "0 0 24 24"
108
111
  }, /*#__PURE__*/_react.default.createElement("path", {
109
- d: "M12 6a6 6 0 100 12 6 6 0 000-12Z"
112
+ d: "M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"
110
113
  }))), children);
111
114
  };
112
115
  Radio.defaultProps = {
113
- size: 13
116
+ size: 16
114
117
  };
115
118
  var _default = Radio;
116
119
  exports.default = _default;
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
10
  var _utils = require("@autobest-ui/utils");
12
11
  var _context = require("./context");
13
12
  var _Radio = _interopRequireDefault(require("./Radio"));
@@ -106,12 +105,10 @@ var RadioGroup = /** @class */function (_super) {
106
105
  return null;
107
106
  };
108
107
  RadioGroup.prototype.render = function () {
109
- var _a = this.props,
110
- _b = _a.direction,
111
- direction = _b === void 0 ? 'horizontal' : _b,
112
- className = _a.className;
108
+ var _a = this.props.direction,
109
+ direction = _a === void 0 ? 'horizontal' : _a;
113
110
  return /*#__PURE__*/_react.default.createElement("div", {
114
- className: (0, _classnames.default)(className, "".concat(cls, "-group-").concat(direction))
111
+ className: "".concat(cls, "-group-").concat(direction)
115
112
  }, 'options' in this.props ? this.renderRadioList() : this.renderRadioGroup());
116
113
  };
117
114
  return RadioGroup;
@@ -1 +1 @@
1
- .ab-radio{position:relative;display:inline-flex;align-items:center;cursor:pointer}.ab-radio:hover .ab-radio-control{color:#4f4f4f}.ab-radio input{cursor:inherit;position:absolute;margin:0;padding:0;opacity:0;top:50%;left:0;transform:translateY(-50%);z-index:1}.ab-radio-checked:hover .ab-radio-control{color:#005cc8}.ab-radio-checked .ab-radio-control{color:#0075ff}.ab-radio-checked .ab-radio-control svg{display:inline-block}.ab-radio-disabled{cursor:not-allowed}.ab-radio-disabled .ab-radio-control,.ab-radio-disabled:hover .ab-radio-control{color:#d1d1d1}.ab-radio-control{margin-right:.06rem;position:relative;color:#767676;flex-shrink:0}.ab-radio-control svg{width:1em;height:1em;user-select:none;flex-shrink:0;fill:currentcolor;stroke:currentcolor;overflow:visible}.ab-radio-dot,.ab-radio-outer{position:absolute;left:0;top:0}.ab-radio-dot{display:none}.ab-radio-group-horizontal{display:flex}.ab-radio-group-horizontal .ab-radio-item{margin-right:.2rem}.ab-radio-group-horizontal .ab-radio-item:last-child{margin-right:0}.ab-radio-group-vertical{display:flex;flex-direction:column;align-items:flex-start}.ab-radio-group-vertical .ab-radio-item{margin-bottom:.15rem}.ab-radio-group-vertical .ab-radio-item:last-child{margin-bottom:0}
1
+ .ab-radio{position:relative;overflow:hidden;display:inline-flex;align-items:center;cursor:pointer;font-size:.14rem}.ab-radio:hover .ab-radio-control{color:#4f4f4f}.ab-radio input{cursor:inherit;position:absolute;margin:0;padding:0;opacity:0;top:0;left:0;z-index:1}.ab-radio-checked:hover .ab-radio-control{color:#005cc8}.ab-radio-checked .ab-radio-control{color:#0075ff}.ab-radio-checked .ab-radio-control svg{display:inline-block}.ab-radio-disabled{cursor:not-allowed}.ab-radio-disabled .ab-radio-control,.ab-radio-disabled:hover .ab-radio-control{color:#d1d1d1}.ab-radio-control{margin-right:.06rem;position:relative;color:#767676}.ab-radio-control svg{width:1em;height:1em;user-select:none;flex-shrink:0;fill:currentcolor;stroke:currentcolor}.ab-radio-dot,.ab-radio-outer{position:absolute;left:0;top:0}.ab-radio-dot{display:none}.ab-radio-group-horizontal{display:flex}.ab-radio-group-horizontal .ab-radio-item{margin-right:.2rem}.ab-radio-group-horizontal .ab-radio-item:last-child{margin-right:0}.ab-radio-group-vertical{display:flex;flex-direction:column}.ab-radio-group-vertical .ab-radio-item{margin-bottom:.15rem}.ab-radio-group-vertical .ab-radio-item:last-child{margin-bottom:0}
@@ -1,4 +1,3 @@
1
- import { ReactChild } from 'react';
2
1
  export declare type RadioValue = string | number;
3
2
  export interface RadioProps {
4
3
  name?: string;
@@ -9,7 +8,6 @@ export interface RadioProps {
9
8
  size?: number;
10
9
  onChange?: (value: RadioValue, name?: string, checked?: boolean) => void;
11
10
  className?: string;
12
- children?: ReactChild | ReactChild[];
13
11
  }
14
12
  export declare type RadioOptionItem = Pick<RadioProps, 'disabled' | 'name' | 'value'>;
15
13
  export interface RadioGroupProps extends Pick<RadioProps, 'value' | 'name' | 'disabled' | 'className' | 'size'> {
@@ -0,0 +1,92 @@
1
+ import React, { Component } from 'react';
2
+ export interface ReadMoreProps {
3
+ /**
4
+ * 需要显示的内容
5
+ */
6
+ children: React.ReactChild[] | React.ReactChild;
7
+ /**
8
+ * 整体样式
9
+ */
10
+ className?: string;
11
+ /**
12
+ * 需要忽略的类名数组,例如 ['mc_title']
13
+ */
14
+ ignoreClassList?: string[];
15
+ /**
16
+ * 展开文本
17
+ */
18
+ expandText?: string;
19
+ /**
20
+ * 折叠文本, 展开后点击收起的文字
21
+ */
22
+ collapseText?: string;
23
+ /**
24
+ * 初始时,显示的行数
25
+ */
26
+ lines?: number;
27
+ /**
28
+ * 是否执行resizeObserver监听宽度变化
29
+ */
30
+ isResizeObserver?: boolean;
31
+ /**
32
+ * 垂直方向触发换行的判定阈值 (默认 1px), 当一行中有字体,大小不同时,需要根据情况动态触发换行
33
+ */
34
+ lineThreshold?: number;
35
+ /**
36
+ * [不推荐]设置Wrap最大高度, 用于解决初始化时页面抖动问题,建议通过屏幕大小动态设置className
37
+ */
38
+ defaultWrapMaxHeight?: number;
39
+ /**
40
+ * 右下角按钮宽度
41
+ */
42
+ buttonWidth?: number;
43
+ /**
44
+ * 默认是否折叠
45
+ */
46
+ defaultCollapsed?: boolean;
47
+ /**
48
+ * 点击展开/收起前的回调函数,返回false时阻止change
49
+ */
50
+ onBeforeChange?: (isCollapsed: boolean) => Promise<boolean>;
51
+ /**
52
+ * 点击展开/收起后的回调函数
53
+ */
54
+ onAfterChange?: (isCollapsed: boolean) => void;
55
+ }
56
+ interface ReadMoreState {
57
+ wrapStyle: React.CSSProperties;
58
+ }
59
+ declare class ReadMore extends Component<ReadMoreProps, ReadMoreState> {
60
+ static defaultProps: {
61
+ onAfterChange: () => void;
62
+ isResizeObserver: boolean;
63
+ defaultCollapsed: boolean;
64
+ expandText: string;
65
+ buttonWidth: number;
66
+ collapseText: string;
67
+ lineThreshold: number;
68
+ lines: number;
69
+ };
70
+ cacheWrapWidth: number;
71
+ isCollapsed: boolean;
72
+ resizeObserver: ResizeObserver;
73
+ originalContent: string;
74
+ wrapRef: React.RefObject<HTMLDivElement>;
75
+ prefixCls: string;
76
+ constructor(props: ReadMoreProps);
77
+ componentDidMount(): void;
78
+ componentDidUpdate(prevProps: ReadMoreProps): void;
79
+ componentWillUnmount(): void;
80
+ /**
81
+ * 计算高度并设置样式
82
+ */
83
+ delayCalculate(): void;
84
+ /**
85
+ * 创建Show More/Show Less 按钮
86
+ */
87
+ getButtonElement: (wrapElement: HTMLDivElement, isCollapsed: boolean) => HTMLSpanElement;
88
+ applyToggle: (wrapElement: HTMLDivElement, node: any, index: number) => void;
89
+ onResizeObserver: () => void;
90
+ render(): JSX.Element;
91
+ }
92
+ export default ReadMore;