yootd 0.2.21 → 0.2.22

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.
@@ -115,7 +115,8 @@ var InternalUpload = function InternalUpload(props, ref) {
115
115
  url: item.filename,
116
116
  uid: file.uid,
117
117
  preview: item.filename,
118
- status: 'done'
118
+ status: 'done',
119
+ size: file.size
119
120
  });
120
121
  });
121
122
  onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(filteredList), _list));
@@ -142,7 +142,8 @@ var InternalUpload = function InternalUpload(props, ref) {
142
142
  url: item.filename,
143
143
  uid: file.uid,
144
144
  preview: item.filename,
145
- status: 'done'
145
+ status: 'done',
146
+ size: file.size
146
147
  });
147
148
  });
148
149
  onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(fileList), _fileList));
@@ -6,6 +6,7 @@ import { useBem } from "../hooks/useBem";
6
6
  import "./index.scss";
7
7
  export var WithSearchForm = function WithSearchForm(_ref) {
8
8
  var children = _ref.children;
9
+ var childrenArray = React.Children.toArray(children);
9
10
  var mb = useBem('WithSearchForm');
10
11
  // 外层dom实例
11
12
  var formRef = useRef(null);
@@ -13,7 +14,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
13
14
  var btnRef = useRef(null);
14
15
  // 传进来的children dom数组实例
15
16
  var childRefs = useRef([]);
16
- var _useState = useState(children.length),
17
+ var _useState = useState(childrenArray.length),
17
18
  _useState2 = _slicedToArray(_useState, 2),
18
19
  visibleCount = _useState2[0],
19
20
  setVisibleCount = _useState2[1];
@@ -23,7 +24,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
23
24
  isExpanded = _useState4[0],
24
25
  setIsExpanded = _useState4[1];
25
26
  // 计算出应该显示的children数量
26
- var _useState5 = useState(children.length),
27
+ var _useState5 = useState(childrenArray.length),
27
28
  _useState6 = _slicedToArray(_useState5, 2),
28
29
  calculatedCount = _useState6[0],
29
30
  setCalculatedCount = _useState6[1];
@@ -70,7 +71,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
70
71
  // 保存计算出的数量
71
72
  setCalculatedCount(itemCount);
72
73
  // 根据展开状态设置可见数量
73
- setVisibleCount(isExpanded ? children.length : itemCount);
74
+ setVisibleCount(isExpanded ? childrenArray.length : itemCount);
74
75
  };
75
76
  useEffect(function () {
76
77
  // 创建 ResizeObserver 实例
@@ -85,12 +86,12 @@ export var WithSearchForm = function WithSearchForm(_ref) {
85
86
  return function () {
86
87
  resizeObserver.disconnect();
87
88
  };
88
- }, [children, isExpanded]);
89
+ }, [childrenArray, isExpanded]);
89
90
 
90
91
  // 处理展开/收起的点击事件
91
92
  var handleExpandClick = function handleExpandClick() {
92
93
  setIsExpanded(!isExpanded);
93
- setVisibleCount(!isExpanded ? children.length : calculatedCount);
94
+ setVisibleCount(!isExpanded ? childrenArray.length : calculatedCount);
94
95
  };
95
96
  return /*#__PURE__*/React.createElement("div", {
96
97
  ref: formRef,
@@ -103,7 +104,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
103
104
  flexWrap: 'wrap',
104
105
  width: '100%'
105
106
  }
106
- }, children === null || children === void 0 ? void 0 : children.map(function (child, index) {
107
+ }, childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.map(function (child, index) {
107
108
  return /*#__PURE__*/React.createElement("div", {
108
109
  key: "measure-".concat(index),
109
110
  ref: function ref(el) {
@@ -113,7 +114,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
113
114
  display: 'inline-block'
114
115
  }
115
116
  }, child);
116
- })), children === null || children === void 0 ? void 0 : children.slice(0, visibleCount), /*#__PURE__*/React.createElement("div", {
117
+ })), childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.slice(0, visibleCount), /*#__PURE__*/React.createElement("div", {
117
118
  ref: btnRef
118
119
  }, /*#__PURE__*/React.createElement(Form.Item, {
119
120
  className: "mb-4"
@@ -123,7 +124,7 @@ export var WithSearchForm = function WithSearchForm(_ref) {
123
124
  }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
124
125
  type: "default",
125
126
  htmlType: "reset"
126
- }, "\u91CD\u7F6E"), (children === null || children === void 0 ? void 0 : children.length) > calculatedCount ? /*#__PURE__*/React.createElement("span", {
127
+ }, "\u91CD\u7F6E"), (childrenArray === null || childrenArray === void 0 ? void 0 : childrenArray.length) > calculatedCount ? /*#__PURE__*/React.createElement("span", {
127
128
  className: "".concat(mb.e('expanded')),
128
129
  onClick: handleExpandClick
129
130
  }, isExpanded ? '收起' : '展开', ' ', /*#__PURE__*/React.createElement(DownOutlined, {
@@ -1,3 +1,3 @@
1
1
  export interface WithSearchFormProps {
2
- children: ReactNode[];
2
+ children: ReactNode;
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "基于 Antd 二次开发的组件库",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",