@nutui/nutui-react 2.0.0-alpha.4 → 2.0.0-alpha.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # v2.0.0-alpha.5
2
+ `2023-05-10`
3
+
4
+ * 🛠 refactor: checkbox (#974) @oasis-cloud
5
+ * 🛠 refactor: circleprogress-v2.0 (#949) @junjun666
6
+ * 🛠 refactor: ellipsis-v2.0 (#963) @junjun666
7
+ * 🛠 refactor: empty-v2.0 (#977) @junjun666
8
+ * 🛠 refactor: swipe (#958) @justExplore
9
+ * 🛠 refactor:avatar-v2.0 (#970) @junjun666
10
+ * 📖 docs: 增加 icon 的复制功能 (#973) @oasis-cloud
11
+ * :sparkles: feat: cellgroup组件增加单元格之间是否展示分割线props (#961) @拧巴的猫
12
+ * :bug: fix: tabbar 通过 Tabbar.Item 方式使用未加载 item 的样式 (#972) @oasis-cloud
13
+ * :bug: fix: 修复elevator小程序快速滑动后闪动问题 (#984) @拧巴的猫
14
+
15
+
1
16
  # v2.0.0-alpha.4
2
17
  `2023-05-05`
3
18
 
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["children", "prefixCls", "size", "shape", "bgColor", "color", "url", "alt", "icon", "className", "style", "activeAvatar", "onActiveAvatar", "onError"];
4
+ var _excluded = ["children", "size", "shape", "background", "color", "src", "alt", "icon", "fit", "className", "style", "onClick", "onError"];
5
5
  function ownKeys(object, enumerableOnly) {
6
6
  var keys = Object.keys(object);
7
7
  if (Object.getOwnPropertySymbols) {
@@ -25,41 +25,42 @@ function _objectSpread(target) {
25
25
  }
26
26
  import React__default, { useState, useRef, useContext, useEffect } from "react";
27
27
  import classNames from "classnames";
28
- import { A as AvatarContext } from "./AvatarContext.js";
29
- import { c as cn } from "./bem.js";
28
+ import { A as AvatarContext } from "./context.js";
29
+ import { My } from "@nutui/icons-react";
30
+ import Image from "./Image.js";
30
31
  import { C as ComponentDefaults } from "./typings.js";
31
- import "@bem-react/classname";
32
32
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
33
33
  size: "",
34
+ shape: "round",
34
35
  icon: "",
35
- bgColor: "#eee",
36
+ background: "#eee",
36
37
  color: "#666",
37
- prefixCls: "nut-avatar",
38
- url: "",
38
+ fit: "cover",
39
+ src: "",
39
40
  alt: ""
40
41
  });
42
+ var classPrefix = "nut-avatar";
41
43
  var Avatar = function Avatar2(props) {
42
44
  var _parent$propAvatarGro, _parent$propAvatarGro2, _classNames, _parent$propAvatarGro3, _parent$propAvatarGro4, _parent$propAvatarGro5, _parent$propAvatarGro6, _parent$propAvatarGro7, _parent$propAvatarGro9, _parent$propAvatarGro10, _parent$propAvatarGro11, _parent$propAvatarGro12, _parent$propAvatarGro13, _parent$propAvatarGro14, _parent$propAvatarGro15;
43
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, prefixCls = _defaultProps$props.prefixCls, size = _defaultProps$props.size, shape = _defaultProps$props.shape, bgColor = _defaultProps$props.bgColor, color = _defaultProps$props.color, url = _defaultProps$props.url, alt = _defaultProps$props.alt, icon = _defaultProps$props.icon, className = _defaultProps$props.className, style = _defaultProps$props.style, activeAvatar = _defaultProps$props.activeAvatar, onActiveAvatar = _defaultProps$props.onActiveAvatar, onError = _defaultProps$props.onError, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
45
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, size = _defaultProps$props.size, shape = _defaultProps$props.shape, background = _defaultProps$props.background, color = _defaultProps$props.color, src = _defaultProps$props.src, alt = _defaultProps$props.alt, icon = _defaultProps$props.icon, fit = _defaultProps$props.fit, className = _defaultProps$props.className, style = _defaultProps$props.style, onClick = _defaultProps$props.onClick, onError = _defaultProps$props.onError, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
44
46
  var _useState = useState(0), _useState2 = _slicedToArray(_useState, 2), maxSum = _useState2[0], setMaxSum = _useState2[1];
45
47
  var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), showMax = _useState4[0], setShowMax = _useState4[1];
46
48
  var _useState5 = useState(1), _useState6 = _slicedToArray(_useState5, 2), avatarIndex = _useState6[0], setAvatarIndex = _useState6[1];
47
49
  var avatarRef = useRef(null);
48
50
  var parent = useContext(AvatarContext);
49
- var b = cn("avatar");
50
- var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat(size || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || "normal"), true), _defineProperty(_classNames, "nut-avatar-".concat(shape || (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || "round"), true), _classNames));
51
- var cls = classNames(b(""), classes, className);
52
51
  var sizeValue = ["large", "normal", "small"];
52
+ var classes = classNames((_classNames = {}, _defineProperty(_classNames, "nut-avatar-".concat((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro = parent.propAvatarGroup) === null || _parent$propAvatarGro === void 0 ? void 0 : _parent$propAvatarGro.size) || size || "normal"), true), _defineProperty(_classNames, "nut-avatar-".concat((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro2 = parent.propAvatarGroup) === null || _parent$propAvatarGro2 === void 0 ? void 0 : _parent$propAvatarGro2.shape) || shape), true), _classNames));
53
+ var cls = classNames(classPrefix, classes, className);
53
54
  var styles = _objectSpread({
54
55
  width: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
55
56
  height: sizeValue.indexOf(size) > -1 ? "" : "".concat(size, "px"),
56
- backgroundColor: "".concat(bgColor),
57
+ backgroundColor: "".concat(background),
57
58
  color: "".concat(color),
58
- marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.span ? "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro4 = parent.propAvatarGroup) === null || _parent$propAvatarGro4 === void 0 ? void 0 : _parent$propAvatarGro4.span, "px") : "",
59
- zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.zIndex) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
59
+ marginLeft: avatarIndex !== 1 && parent !== null && parent !== void 0 && (_parent$propAvatarGro3 = parent.propAvatarGroup) !== null && _parent$propAvatarGro3 !== void 0 && _parent$propAvatarGro3.gap ? "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro4 = parent.propAvatarGroup) === null || _parent$propAvatarGro4 === void 0 ? void 0 : _parent$propAvatarGro4.gap, "px") : "",
60
+ zIndex: (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro5 = parent.propAvatarGroup) === null || _parent$propAvatarGro5 === void 0 ? void 0 : _parent$propAvatarGro5.level) === "right" ? "".concat(Math.abs(maxSum - avatarIndex)) : ""
60
61
  }, style);
61
62
  var maxStyles = {
62
- backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBgColor),
63
+ backgroundColor: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro6 = parent.propAvatarGroup) === null || _parent$propAvatarGro6 === void 0 ? void 0 : _parent$propAvatarGro6.maxBackground),
63
64
  color: "".concat(parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro7 = parent.propAvatarGroup) === null || _parent$propAvatarGro7 === void 0 ? void 0 : _parent$propAvatarGro7.maxColor)
64
65
  };
65
66
  useEffect(function() {
@@ -77,40 +78,44 @@ var Avatar = function Avatar2(props) {
77
78
  }
78
79
  }
79
80
  var index = Number(avatarRef === null || avatarRef === void 0 ? void 0 : (_avatarRef$current = avatarRef.current) === null || _avatarRef$current === void 0 ? void 0 : (_avatarRef$current$da = _avatarRef$current.dataset) === null || _avatarRef$current$da === void 0 ? void 0 : _avatarRef$current$da.index);
80
- var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.maxCount;
81
+ var maxCount = parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro8 = parent.propAvatarGroup) === null || _parent$propAvatarGro8 === void 0 ? void 0 : _parent$propAvatarGro8.max;
81
82
  setMaxSum(children2.length);
82
83
  setAvatarIndex(index);
83
84
  if (index === children2.length && index !== maxCount && children2.length > maxCount) {
84
85
  setShowMax(true);
85
86
  }
86
87
  };
87
- var errorEvent = function errorEvent2(e) {
88
+ var errorEvent = function errorEvent2() {
88
89
  if (props.onError) {
89
- props.onError(e);
90
+ props.onError();
90
91
  }
91
92
  };
92
93
  var clickAvatar = function clickAvatar2(e) {
93
- activeAvatar && activeAvatar(e);
94
- onActiveAvatar && onActiveAvatar(e);
94
+ onClick && onClick(e);
95
95
  };
96
- return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro10 = parent.propAvatarGroup) === null || _parent$propAvatarGro10 === void 0 ? void 0 : _parent$propAvatarGro10.maxCount)) && React__default.createElement("div", _objectSpread(_objectSpread({
96
+ return React__default.createElement(React__default.Fragment, null, (showMax || !(parent !== null && parent !== void 0 && (_parent$propAvatarGro9 = parent.propAvatarGroup) !== null && _parent$propAvatarGro9 !== void 0 && _parent$propAvatarGro9.max) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro10 = parent.propAvatarGroup) === null || _parent$propAvatarGro10 === void 0 ? void 0 : _parent$propAvatarGro10.max)) && React__default.createElement("div", _objectSpread(_objectSpread({
97
97
  className: cls
98
98
  }, rest), {}, {
99
99
  style: !showMax ? styles : maxStyles,
100
100
  onClick: clickAvatar,
101
101
  ref: avatarRef
102
- }), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.maxCount) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro12 = parent.propAvatarGroup) === null || _parent$propAvatarGro12 === void 0 ? void 0 : _parent$propAvatarGro12.maxCount)) && React__default.createElement(React__default.Fragment, null, url && React__default.createElement("img", {
102
+ }), (!(parent !== null && parent !== void 0 && (_parent$propAvatarGro11 = parent.propAvatarGroup) !== null && _parent$propAvatarGro11 !== void 0 && _parent$propAvatarGro11.max) || avatarIndex <= (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro12 = parent.propAvatarGroup) === null || _parent$propAvatarGro12 === void 0 ? void 0 : _parent$propAvatarGro12.max)) && React__default.createElement(React__default.Fragment, null, src && React__default.createElement(Image, {
103
103
  className: "avatar-img",
104
- src: url,
104
+ src,
105
105
  alt,
106
+ style: {
107
+ objectFit: fit
108
+ },
106
109
  onError: errorEvent
107
110
  }), React__default.isValidElement(icon) ? React__default.cloneElement(icon, _objectSpread(_objectSpread({}, icon.props), {}, {
108
111
  className: "".concat(icon.props.className || "", " icon")
109
112
  })) : null, children && React__default.createElement("span", {
110
113
  className: "text"
111
- }, children)), showMax && React__default.createElement("div", {
114
+ }, children), !src && !icon && !children && React__default.createElement(My, {
115
+ className: "icon"
116
+ })), showMax && React__default.createElement("div", {
112
117
  className: "text"
113
- }, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.maxCount)))));
118
+ }, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.max)))));
114
119
  };
115
120
  Avatar.defaultProps = defaultProps;
116
121
  Avatar.displayName = "NutAvatar";
@@ -22,27 +22,22 @@ function _objectSpread(target) {
22
22
  }
23
23
  import React__default, { useRef } from "react";
24
24
  import classNames from "classnames";
25
- import { A as AvatarContext } from "./AvatarContext.js";
26
- import { c as cn } from "./bem.js";
27
- import { useConfig } from "./ConfigProvider.js";
28
- import "@bem-react/classname";
29
- var defaultProps = {
25
+ import { A as AvatarContext } from "./context.js";
26
+ import { C as ComponentDefaults } from "./typings.js";
27
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
30
28
  maxContent: "",
31
- maxCount: "",
32
- maxBgColor: "#eee",
29
+ max: "",
30
+ maxBackground: "#eee",
33
31
  maxColor: "#666",
34
- size: "",
35
- shape: "",
36
- span: "-8",
37
- zIndex: "left"
38
- };
32
+ gap: "-8",
33
+ level: "left"
34
+ });
35
+ var classPrefix = "nut-avatar-group";
39
36
  var AvatarGroup = function AvatarGroup2(props) {
40
- useConfig();
41
37
  var propAvatarGroup = _objectSpread(_objectSpread({}, defaultProps), props);
42
38
  var className = propAvatarGroup.className, style = propAvatarGroup.style, children = propAvatarGroup.children;
43
39
  var avatarGroupRef = useRef(null);
44
- var b = cn("avatar-group");
45
- var cls = classNames(b(""), className);
40
+ var cls = classNames(classPrefix, className);
46
41
  var parentAvatar = {
47
42
  propAvatarGroup,
48
43
  avatarGroupRef
@@ -1,9 +1,8 @@
1
1
  import { C as Checkbox } from "./checkbox2.js";
2
2
  import "react";
3
3
  import "@nutui/icons-react";
4
+ import "classnames";
4
5
  import "./CheckboxGroup.js";
5
- import "./bem.js";
6
- import "@bem-react/classname";
7
6
  import "./typings.js";
8
7
  import "./use-props-value.js";
9
8
  export {
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- var _excluded = ["className", "disabled", "onChange", "value", "defaultValue", "max", "textPosition", "direction", "options"], _excluded2 = ["label", "value", "disabled", "onChange"];
5
+ var _excluded = ["className", "disabled", "onChange", "value", "defaultValue", "max", "labelPosition", "direction", "options"], _excluded2 = ["label", "value", "disabled", "onChange"];
6
6
  function ownKeys(object, enumerableOnly) {
7
7
  var keys = Object.keys(object);
8
8
  if (Object.getOwnPropertySymbols) {
@@ -25,52 +25,51 @@ function _objectSpread(target) {
25
25
  return target;
26
26
  }
27
27
  import React__default, { useImperativeHandle, useCallback } from "react";
28
- import { c as cn } from "./bem.js";
28
+ import classNames from "classnames";
29
29
  import { C as Checkbox, a as Context } from "./checkbox2.js";
30
30
  import { u as usePropsValue } from "./use-props-value.js";
31
- import "@bem-react/classname";
32
31
  import "@nutui/icons-react";
33
32
  import "./CheckboxGroup.js";
34
33
  import "./typings.js";
35
34
  var defaultProps = {
36
- disabled: false,
37
35
  max: void 0,
38
- textPosition: "right",
36
+ labelPosition: "right",
39
37
  direction: "vertical",
40
38
  onChange: function onChange(value) {
41
39
  },
42
40
  options: []
43
41
  };
42
+ var classPrefix = "nut-checkboxgroup";
44
43
  var CheckboxGroup = React__default.forwardRef(function(props, ref) {
44
+ var _classNames;
45
45
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children;
46
- var b = cn("checkboxgroup");
47
- var className = props.className, disabled = props.disabled, onChange2 = props.onChange, value = props.value, defaultValue = props.defaultValue, max = props.max, textPosition = props.textPosition, direction = props.direction, options = props.options, rest = _objectWithoutProperties(props, _excluded);
46
+ var className = props.className, disabled = props.disabled, onChange2 = props.onChange, value = props.value, defaultValue = props.defaultValue, max = props.max, labelPosition = props.labelPosition, direction = props.direction, options = props.options, rest = _objectWithoutProperties(props, _excluded);
48
47
  useImperativeHandle(ref, function() {
49
48
  return {
50
- toggleAll: function toggleAll(state) {
49
+ toggle: function toggle(state) {
51
50
  if (state === false) {
52
51
  setValue([]);
53
52
  } else {
54
53
  var childrenLabel = [];
55
54
  React__default.Children.map(children, function(child) {
56
55
  var childProps = child.props;
57
- childrenLabel.push(childProps.label || child.children);
56
+ childrenLabel.push(childProps.value);
58
57
  });
59
58
  setValue(childrenLabel);
60
59
  }
61
60
  },
62
- toggleReverse: function toggleReverse() {
61
+ reverse: function reverse() {
63
62
  var childrenLabel = [];
64
63
  React__default.Children.map(children, function(child) {
65
64
  var childProps = child.props;
66
- childrenLabel.push(childProps.label || child.children);
65
+ childrenLabel.push(childProps.value);
67
66
  });
68
- var reverse = childrenLabel.filter(function(c) {
67
+ var reverse2 = childrenLabel.filter(function(c) {
69
68
  return (_value === null || _value === void 0 ? void 0 : _value.findIndex(function(v) {
70
69
  return v === c;
71
70
  })) === -1;
72
71
  });
73
- setValue(reverse);
72
+ setValue(reverse2);
74
73
  }
75
74
  };
76
75
  });
@@ -85,32 +84,31 @@ var CheckboxGroup = React__default.forwardRef(function(props, ref) {
85
84
  var label = _ref.label, value2 = _ref.value, disabled2 = _ref.disabled, onChange22 = _ref.onChange, rest2 = _objectWithoutProperties(_ref, _excluded2);
86
85
  return React__default.createElement(Checkbox, _objectSpread({
87
86
  key: value2 === null || value2 === void 0 ? void 0 : value2.toString(),
88
- children: label,
89
- label: value2
87
+ label,
88
+ disabled: disabled2,
89
+ value: value2
90
90
  }, rest2));
91
91
  });
92
92
  }, [options, max]);
93
93
  return React__default.createElement(Context.Provider, {
94
94
  value: {
95
- textPosition: textPosition || "left",
95
+ labelPosition: labelPosition || "right",
96
96
  disabled,
97
97
  max,
98
- checkedValue: _value,
98
+ value: _value,
99
99
  check: function check(value2) {
100
100
  var combined = [].concat(_toConsumableArray(_value), [value2]);
101
101
  setValue(combined);
102
- onChange2 && onChange2(combined);
103
102
  },
104
103
  uncheck: function uncheck(value2) {
105
104
  var reduced = _value.filter(function(item) {
106
105
  return item !== value2;
107
106
  });
108
107
  setValue(reduced);
109
- onChange2 && onChange2(reduced);
110
108
  }
111
109
  }
112
110
  }, React__default.createElement("div", _objectSpread({
113
- className: "".concat(b(), " nut-checkboxgroup--").concat(props.direction, " ").concat(className || "")
111
+ className: classNames(classPrefix, (_classNames = {}, _defineProperty(_classNames, "nut-checkboxgroup--".concat(props.direction), props.direction), _defineProperty(_classNames, "className", className), _classNames))
114
112
  }, rest), options !== null && options !== void 0 && options.length ? renderOptions() : children));
115
113
  });
116
114
  CheckboxGroup.defaultProps = defaultProps;
@@ -1,5 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["children", "content", "className", "direction", "rows", "expandText", "collapseText", "symbol", "lineHeight", "onClick", "onChange"];
3
5
  function ownKeys(object, enumerableOnly) {
4
6
  var keys = Object.keys(object);
5
7
  if (Object.getOwnPropertySymbols) {
@@ -21,9 +23,10 @@ function _objectSpread(target) {
21
23
  }
22
24
  return target;
23
25
  }
24
- import React__default, { useState, useRef, useLayoutEffect, useEffect } from "react";
25
- import { useConfig } from "./ConfigProvider.js";
26
- var defaultProps = {
26
+ import React__default, { useState, useRef, useLayoutEffect } from "react";
27
+ import classNames from "classnames";
28
+ import { C as ComponentDefaults } from "./typings.js";
29
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
27
30
  content: "",
28
31
  direction: "end",
29
32
  rows: 1,
@@ -31,21 +34,19 @@ var defaultProps = {
31
34
  collapseText: "",
32
35
  symbol: "...",
33
36
  lineHeight: "20"
34
- };
37
+ });
38
+ var classPrefix = "nut-ellipsis";
35
39
  var Ellipsis = function Ellipsis2(props) {
36
40
  var _ellipsis$current, _ellipsis$current2;
37
- useConfig();
38
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, content = _defaultProps$props.content, direction = _defaultProps$props.direction, rows = _defaultProps$props.rows, expandText = _defaultProps$props.expandText, collapseText = _defaultProps$props.collapseText, symbol = _defaultProps$props.symbol, lineHeight = _defaultProps$props.lineHeight, onClick = _defaultProps$props.onClick, onChange = _defaultProps$props.onChange;
41
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, content = _defaultProps$props.content, className = _defaultProps$props.className, direction = _defaultProps$props.direction, rows = _defaultProps$props.rows, expandText = _defaultProps$props.expandText, collapseText = _defaultProps$props.collapseText, symbol = _defaultProps$props.symbol, lineHeight = _defaultProps$props.lineHeight, onClick = _defaultProps$props.onClick, onChange = _defaultProps$props.onChange, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
39
42
  var container = null;
40
43
  var maxHeight = 0;
41
44
  var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), exceeded = _useState2[0], setExceeded = _useState2[1];
42
45
  var _useState3 = useState(false), _useState4 = _slicedToArray(_useState3, 2), expanded = _useState4[0], setExpanded = _useState4[1];
43
46
  var ellipsis = useRef();
44
47
  var root = useRef(null);
48
+ var classes = classNames(classPrefix, className);
45
49
  useLayoutEffect(function() {
46
- createContainer();
47
- }, []);
48
- useEffect(function() {
49
50
  if (content) {
50
51
  createContainer();
51
52
  }
@@ -153,11 +154,11 @@ var Ellipsis = function Ellipsis2(props) {
153
154
  var handleClick = function handleClick2() {
154
155
  onClick && onClick();
155
156
  };
156
- return React__default.createElement("div", {
157
- className: "nut-ellipsis",
157
+ return React__default.createElement("div", _objectSpread({
158
+ className: classes,
158
159
  onClick: handleClick,
159
160
  ref: root
160
- }, React__default.createElement("div", null, !exceeded ? content : null, exceeded && !expanded ? React__default.createElement(React__default.Fragment, null, (_ellipsis$current = ellipsis.current) === null || _ellipsis$current === void 0 ? void 0 : _ellipsis$current.leading, expandText ? React__default.createElement("span", {
161
+ }, rest), React__default.createElement("div", null, !exceeded ? content : null, exceeded && !expanded ? React__default.createElement(React__default.Fragment, null, (_ellipsis$current = ellipsis.current) === null || _ellipsis$current === void 0 ? void 0 : _ellipsis$current.leading, expandText ? React__default.createElement("span", {
161
162
  className: "nut-ellipsis-text",
162
163
  onClick: function onClick2(e) {
163
164
  e.stopPropagation();
package/dist/esm/Empty.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["image", "imageSize", "description", "children", "className"];
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["image", "imageSize", "description", "children", "className", "status"];
5
5
  function ownKeys(object, enumerableOnly) {
6
6
  var keys = Object.keys(object);
7
7
  if (Object.getOwnPropertySymbols) {
@@ -24,35 +24,29 @@ function _objectSpread(target) {
24
24
  return target;
25
25
  }
26
26
  import React__default, { useState, useEffect } from "react";
27
- import { c as cn } from "./bem.js";
28
27
  import { useConfig } from "./ConfigProvider.js";
29
- import "@bem-react/classname";
28
+ import { C as ComponentDefaults } from "./typings.js";
30
29
  var defaultStatus = {
31
30
  empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
32
31
  error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
33
32
  network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
34
33
  };
35
- var defaultProps = {
34
+ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
36
35
  description: "",
37
- image: "empty",
38
36
  imageSize: "",
39
- className: ""
40
- };
37
+ status: "empty"
38
+ });
39
+ var classPrefix = "nut-empty";
41
40
  var Empty = function Empty2(props) {
42
41
  var _useConfig = useConfig(), locale = _useConfig.locale;
43
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), image = _defaultProps$props.image, imageSize = _defaultProps$props.imageSize, description = _defaultProps$props.description, children = _defaultProps$props.children, className = _defaultProps$props.className, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
42
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), image = _defaultProps$props.image, imageSize = _defaultProps$props.imageSize, description = _defaultProps$props.description, children = _defaultProps$props.children, className = _defaultProps$props.className, status = _defaultProps$props.status, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
44
43
  var _useState = useState({}), _useState2 = _slicedToArray(_useState, 2), imgStyle = _useState2[0], setImgStyle = _useState2[1];
45
- var b = cn("empty");
46
- var imageNode = image;
47
- if (typeof image === "string") {
48
- var isHttpUrl = image.startsWith("https://") || image.startsWith("http://") || image.startsWith("//");
49
- var imageUrl = isHttpUrl ? image : defaultStatus[image];
50
- imageNode = React__default.createElement("img", {
51
- className: "img",
52
- src: imageUrl,
53
- alt: "empty"
54
- });
55
- }
44
+ var imageUrl = image || defaultStatus[status];
45
+ var imageNode = typeof imageUrl === "string" ? React__default.createElement("img", {
46
+ className: "img",
47
+ src: imageUrl,
48
+ alt: "empty"
49
+ }) : imageUrl;
56
50
  useEffect(function() {
57
51
  setImgStyle(function() {
58
52
  if (!imageSize) {
@@ -71,15 +65,13 @@ var Empty = function Empty2(props) {
71
65
  });
72
66
  }, [imageSize]);
73
67
  return React__default.createElement("div", _objectSpread({
74
- className: "".concat(b(), " ").concat(className)
68
+ className: "".concat(classPrefix, " ").concat(className)
75
69
  }, rest), React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
76
- className: b("image"),
70
+ className: "".concat(classPrefix, "__image"),
77
71
  style: imgStyle
78
72
  }, imageNode), typeof description === "string" ? React__default.createElement("div", {
79
- className: b("description")
80
- }, description || locale.noData) : {
81
- description
82
- }, children));
73
+ className: "".concat(classPrefix, "__description")
74
+ }, description || locale.noData) : description, children));
83
75
  };
84
76
  Empty.defaultProps = defaultProps;
85
77
  Empty.displayName = "NutEmpty";
@@ -77,7 +77,7 @@ var Skeleton = function Skeleton2(props) {
77
77
  className: "nut-skeleton-content"
78
78
  }, avatar && React__default.createElement(Avatar, {
79
79
  className: avatarClass,
80
- bgColor: "rgb(239, 239, 239)",
80
+ background: "rgb(239, 239, 239)",
81
81
  shape: avatarShape,
82
82
  style: getStyle()
83
83
  }), row === 1 && React__default.createElement("div", {
package/dist/esm/Swipe.js CHANGED
@@ -21,7 +21,7 @@ function _objectSpread(target) {
21
21
  }
22
22
  return target;
23
23
  }
24
- import React__default, { forwardRef, useRef, useState, useMemo, useCallback, useImperativeHandle, useEffect } from "react";
24
+ import React__default, { forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect } from "react";
25
25
  import classNames from "classnames";
26
26
  import { c as cn } from "./bem.js";
27
27
  import { u as useTouch } from "./use-touch.js";
@@ -36,9 +36,7 @@ function preventDefault(event, isStopPropagation) {
36
36
  }
37
37
  }
38
38
  var defaultProps = {
39
- name: "",
40
- leftWidth: 0,
41
- rightWidth: 0
39
+ name: ""
42
40
  };
43
41
  var Swipe = forwardRef(function(props, instanceRef) {
44
42
  var swipeBem = cn("swipe");
@@ -60,12 +58,8 @@ var Swipe = forwardRef(function(props, instanceRef) {
60
58
  transform: "translate3d(".concat(state.offset, "px, 0, 0)"),
61
59
  transitionDuration: state.dragging ? "0s" : ".6s"
62
60
  };
63
- var leftWidth = useMemo(function() {
64
- return props.leftWidth ? props.leftWidth : actionWidth.left;
65
- }, [props.leftWidth, actionWidth.left]);
66
- var rightWidth = useMemo(function() {
67
- return props.rightWidth ? props.rightWidth : actionWidth.right;
68
- }, [props.rightWidth, actionWidth.right]);
61
+ var leftWidth = actionWidth.left;
62
+ var rightWidth = actionWidth.right;
69
63
  var _onTouchStart = function onTouchStart(event) {
70
64
  if (!props.disabled) {
71
65
  startOffset.current = state.offset;
@@ -1,2 +1,2 @@
1
-
1
+ import '../../TabbarItem/style'
2
2
  import '../../../packages/tabbar/tabbar.scss'
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- var _excluded = ["children", "className", "style", "title", "description"];
3
+ var _excluded = ["children", "className", "style", "title", "description", "divider"];
4
4
  function ownKeys(object, enumerableOnly) {
5
5
  var keys = Object.keys(object);
6
6
  if (Object.getOwnPropertySymbols) {
@@ -27,11 +27,12 @@ import classNames from "classnames";
27
27
  import { C as ComponentDefaults } from "./typings.js";
28
28
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
29
29
  title: "",
30
- description: ""
30
+ description: "",
31
+ divider: true
31
32
  });
32
33
  var classPrefix = "nut-cell-group";
33
34
  var CellGroup = function CellGroup2(props) {
34
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, style = _defaultProps$props.style, title = _defaultProps$props.title, description = _defaultProps$props.description, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
35
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), children = _defaultProps$props.children, className = _defaultProps$props.className, style = _defaultProps$props.style, title = _defaultProps$props.title, description = _defaultProps$props.description, divider = _defaultProps$props.divider, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
35
36
  return React__default.createElement("div", _objectSpread({
36
37
  className: classNames(classPrefix, className)
37
38
  }, rest), title ? React__default.createElement("div", {
@@ -39,7 +40,7 @@ var CellGroup = function CellGroup2(props) {
39
40
  }, title) : null, description ? React__default.createElement("div", {
40
41
  className: "".concat(classPrefix, "__description")
41
42
  }, description) : null, React__default.createElement("div", {
42
- className: "".concat(classPrefix, "__wrap")
43
+ className: "".concat(classPrefix, "__wrap ").concat(divider ? "".concat(classPrefix, "__wrap--divider") : "")
43
44
  }, children));
44
45
  };
45
46
  CellGroup.defaultProps = defaultProps;