@chaoswise/ui 3.1.9 → 3.1.11

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 (60) hide show
  1. package/lib/AbreastLayout/index.js +20 -23
  2. package/lib/Antd5/config-provider/index.js +10 -6
  3. package/lib/Antd5/dropdown/dropdown.js +1 -1
  4. package/lib/Antd5/menu/menu.js +1 -1
  5. package/lib/Antd5/splitter/SplitBar.js +20 -10
  6. package/lib/Antd5/splitter/hooks/useItems.js +6 -3
  7. package/lib/Antd5/typography/hooks/useCopyClick.js +2 -2
  8. package/lib/Antd5/upload/Upload.js +1 -1
  9. package/lib/BasicLayout/index.js +29 -29
  10. package/lib/Button/index.js +0 -3
  11. package/lib/CWCascader/index.js +0 -5
  12. package/lib/CWCascader/rc-cascader/OptionList/Column.js +1 -1
  13. package/lib/CWColorPicker/SketchPicker/components/common/Checkboard.js +8 -10
  14. package/lib/CWColorPicker/SketchPicker/components/common/Raised.js +6 -9
  15. package/lib/CWColorPicker/SketchPicker/components/sketch/index.js +7 -9
  16. package/lib/CWColorPicker/index.js +2 -4
  17. package/lib/CWMessage/MessageContent/TabList/index.js +1 -1
  18. package/lib/CWMessage/MessageContent/index.js +1 -1
  19. package/lib/CWMessage/index.js +6 -14
  20. package/lib/CWRadioTabs/index.js +2 -5
  21. package/lib/CWRangePicker/Refresh/index.js +2 -1
  22. package/lib/CWRangePicker/TimeSpan/index.js +2 -1
  23. package/lib/CWRangePicker/index.js +0 -5
  24. package/lib/CWSelect/index.js +2 -4
  25. package/lib/CWTable/CWTable.js +29 -18
  26. package/lib/CWTable/index.js +0 -12
  27. package/lib/CWTree/index.js +188 -149
  28. package/lib/CWTree/index.style.js +4 -2
  29. package/lib/CWTree/utils/index.js +148 -53
  30. package/lib/CardSelect/index.js +8 -12
  31. package/lib/ChangeIcon/index.js +3 -5
  32. package/lib/Collapse/index.js +9 -13
  33. package/lib/CustomScrollBar/index.js +6 -13
  34. package/lib/EchartsBase/index.js +0 -3
  35. package/lib/Empty/index.js +0 -4
  36. package/lib/Flow/Flow.js +0 -3
  37. package/lib/Header/index.js +17 -20
  38. package/lib/LayoutWrapper/Footer.js +3 -8
  39. package/lib/LayoutWrapper/index.js +2 -58
  40. package/lib/Modal/assets/Close.js +0 -8
  41. package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +3 -3
  42. package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +2 -2
  43. package/lib/QuickTransfer/index.js +9 -11
  44. package/lib/QuickTransfer/utils.js +50 -29
  45. package/lib/ScrollLoad/index.js +17 -19
  46. package/lib/SearchBar/index.js +2 -5
  47. package/lib/SiderMenu/index.js +2 -4
  48. package/lib/SimpleCard/index.js +5 -12
  49. package/lib/SimplePagination/index.js +6 -8
  50. package/lib/SingleSpa/index.js +2 -2
  51. package/lib/Tag/CheckableTag.js +8 -10
  52. package/lib/Tag/index.js +0 -1
  53. package/lib/TimeRangeSlider/index.js +0 -3
  54. package/lib/TimeZoneSelect/index.js +2 -2
  55. package/lib/Tooltip/index.js +9 -6
  56. package/lib/TooltipText/index.js +2 -4
  57. package/lib/UniversalLayout/index.js +5 -7
  58. package/lib/WangEditor/index.js +10 -11
  59. package/lib/useChartTheme/index.js +3 -2
  60. package/package.json +3 -2
@@ -12,13 +12,13 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
12
12
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
13
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
14
14
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
15
- import React, { forwardRef, useState, useEffect, useMemo } from "react";
15
+ import React, { useState, useEffect } from "react";
16
16
  import { EllipsisOutlined } from "@ant-design/icons";
17
17
  import PropTypes from "prop-types";
18
18
  import classnames from "classnames";
19
19
  import useConfigContext from "../useConfigContext";
20
20
  import useStyle from "./index.style";
21
- var CWRadioTabs = /*#__PURE__*/forwardRef(function (props, ref) {
21
+ var CWRadioTabs = function CWRadioTabs(props) {
22
22
  var _dataSource$find;
23
23
  var _props$dataSource = props.dataSource,
24
24
  dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
@@ -102,9 +102,6 @@ var CWRadioTabs = /*#__PURE__*/forwardRef(function (props, ref) {
102
102
  }, dropdownOption), /*#__PURE__*/React.createElement(_Radio.Button, {
103
103
  value: "more"
104
104
  }, /*#__PURE__*/React.createElement(EllipsisOutlined, null)))), props.children));
105
- });
106
- CWRadioTabs.defaultProps = {
107
- size: "default"
108
105
  };
109
106
  CWRadioTabs.propTypes = {
110
107
  /**
@@ -1,4 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ import _Space from "@chaoswise/ui/lib/Space";
2
3
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
3
4
  import _Button from "@chaoswise/ui/lib/Button";
4
5
  var _excluded = ["value", "key"];
@@ -143,7 +144,7 @@ var Refresh = /*#__PURE__*/forwardRef(function (props, ref) {
143
144
  onAutoRefresh: onAutoRefresh
144
145
  };
145
146
  });
146
- return wrapCSSVar((showRefresh || showAutoRefresh) && /*#__PURE__*/React.createElement(_Button.Group, {
147
+ return wrapCSSVar((showRefresh || showAutoRefresh) && /*#__PURE__*/React.createElement(_Space.Compact, {
147
148
  className: classnames(hashId, cssVarCls, "".concat(prefixCls, "-cw-range-picker-refresh-wrapper"))
148
149
  }, showRefresh && /*#__PURE__*/React.createElement(_Tooltip, {
149
150
  title: intl.get("1d0f3c0c-188f-4f83-bff0-2792dffcdc2d").d("刷新")
@@ -1,3 +1,4 @@
1
+ import _Space from "@chaoswise/ui/lib/Space";
1
2
  import _Tooltip from "@chaoswise/ui/lib/Tooltip";
2
3
  import _Button from "@chaoswise/ui/lib/Button";
3
4
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -71,7 +72,7 @@ var TimeSpan = function TimeSpan(props) {
71
72
  }
72
73
  };
73
74
  var showTimeSpan = showForwardBtn || showBackwardBtn || showEnlargeBtn;
74
- return wrapCSSVar(isHasDate && showTimeSpan && /*#__PURE__*/React.createElement(_Button.Group, {
75
+ return wrapCSSVar(isHasDate && showTimeSpan && /*#__PURE__*/React.createElement(_Space.Compact, {
75
76
  className: classnames(hashId, cssVarCls, "".concat(prefixCls, "-cw-range-picker-time-span-wrapper"))
76
77
  }, /*#__PURE__*/React.createElement(_Tooltip, {
77
78
  title: forwardTitle
@@ -686,11 +686,6 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
686
686
  ref: refreshRef
687
687
  }))));
688
688
  });
689
- CWRangePicker.defaultProps = {
690
- moreItemDropdownPosition: "left",
691
- format: "YYYY/MM/DD HH:mm:ss",
692
- rangePickerFormat: "YYYY/MM/DD"
693
- };
694
689
  CWRangePicker.propTypes = {
695
690
  /**
696
691
  * 默认value
@@ -26,7 +26,6 @@ import { DndProvider } from "react-dnd";
26
26
  import { cloneComProps } from "../utils";
27
27
  import update from "immutability-helper";
28
28
  import PropTypes from "prop-types";
29
- import { useIntl } from "../locales";
30
29
  import useStyle from "./index.style";
31
30
 
32
31
  /**
@@ -73,7 +72,6 @@ var CWSelect = /*#__PURE__*/forwardRef(function (props, ref) {
73
72
  children = props.children,
74
73
  maxCount = props.maxCount,
75
74
  rest = _objectWithoutProperties(props, _excluded);
76
- var intl = useIntl();
77
75
  var _useConfigContext = useConfigContext(),
78
76
  getPrefixCls = _useConfigContext.getPrefixCls;
79
77
  var prefixCls = getPrefixCls("select");
@@ -341,9 +339,9 @@ var CWSelect = /*#__PURE__*/forwardRef(function (props, ref) {
341
339
  menuItemSelectedIcon: null,
342
340
  onSelect: onSelect,
343
341
  onDeselect: onDeselect,
344
- dropdownRender: dropdownRender,
345
342
  labelInValue: labelInValue,
346
- maxCount: maxCount
343
+ maxCount: maxCount,
344
+ popupRender: dropdownRender
347
345
  }, rest), children)));
348
346
  });
349
347
 
@@ -26,21 +26,24 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
26
26
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
27
27
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
28
28
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
29
- import React, { useState, useEffect, useRef, useMemo, forwardRef } from "react";
29
+ import React, { useState, useEffect, useRef, useMemo, useCallback, forwardRef } from "react";
30
30
  import Icon, { LoadingOutlined, DownOutlined, RightOutlined } from "@ant-design/icons";
31
31
  import classnames from "classnames";
32
32
  import ResizeObserver from "resize-observer-polyfill";
33
33
  import { merge } from "lodash-es";
34
34
  import { HeaderCell } from "./header";
35
35
  import useStyle from "./index.style";
36
+ // 在组件外部定义默认数组,确保引用稳定
37
+ var DEFAULT_DATA_SOURCE = [];
38
+ var DEFAULT_COLUMNS = [];
36
39
  var CWTable = function CWTable(_ref, ref) {
37
40
  var _ref$columns = _ref.columns,
38
- columns = _ref$columns === void 0 ? [] : _ref$columns,
41
+ columns = _ref$columns === void 0 ? DEFAULT_COLUMNS : _ref$columns,
39
42
  _ref$lazyLoading = _ref.lazyLoading,
40
43
  lazyLoading = _ref$lazyLoading === void 0 ? false : _ref$lazyLoading,
41
44
  loadData = _ref.loadData,
42
45
  _ref$dataSource = _ref.dataSource,
43
- dataSource = _ref$dataSource === void 0 ? [] : _ref$dataSource,
46
+ dataSource = _ref$dataSource === void 0 ? DEFAULT_DATA_SOURCE : _ref$dataSource,
44
47
  rowSelection = _ref.rowSelection,
45
48
  _ref$pagination = _ref.pagination,
46
49
  pagination = _ref$pagination === void 0 ? false : _ref$pagination,
@@ -159,20 +162,28 @@ var CWTable = function CWTable(_ref, ref) {
159
162
  colsFilterTitle = columnFilter.colsFilterTitle,
160
163
  _columnFilter$isShowS = columnFilter.isShowSelectAll,
161
164
  isShowSelectAll = _columnFilter$isShowS === void 0 ? false : _columnFilter$isShowS;
162
- var getDataSource = function getDataSource() {
163
- var _dataSource = _toConsumableArray(dataSource);
164
- if (frontPagination) {
165
- var _current = pagination.current,
166
- _pageSize = pagination.pageSize,
167
- _total = pagination.total;
168
- var current = _current || pageInfo.current;
169
- var pageSize = _pageSize || pageInfo.pageSize;
170
- var total = _total || dataSource.length;
171
- _dataSource = _dataSource.slice((current - 1) * pageSize, current * pageSize > total ? total : current * pageSize);
165
+ var getDataSource = useCallback(function () {
166
+ // 如果不是前端分页,直接使用原数据
167
+ if (!frontPagination) {
168
+ setFinalDataSource(_toConsumableArray(dataSource));
169
+ return;
172
170
  }
173
- setFinalDataSource(_dataSource);
174
- };
175
- useEffect(getDataSource, [frontPagination, pagination, pageInfo, dataSource]);
171
+
172
+ // 前端分页逻辑
173
+ var _ref2 = pagination || {},
174
+ paginationCurrent = _ref2.current,
175
+ paginationPageSize = _ref2.pageSize,
176
+ paginationTotal = _ref2.total;
177
+ var current = paginationCurrent || pageInfo.current;
178
+ var pageSize = paginationPageSize || pageInfo.pageSize;
179
+ var total = paginationTotal || dataSource.length;
180
+
181
+ // 计算分页范围
182
+ var startIndex = (current - 1) * pageSize;
183
+ var endIndex = Math.min(startIndex + pageSize, total);
184
+ setFinalDataSource(dataSource.slice(startIndex, endIndex));
185
+ }, [frontPagination, pagination, pageInfo, dataSource]);
186
+ useEffect(getDataSource, [getDataSource]);
176
187
  useEffect(function () {
177
188
  if (!autoHeight) {
178
189
  return;
@@ -380,8 +391,8 @@ var CWTable = function CWTable(_ref, ref) {
380
391
  });
381
392
  };
382
393
  var handleResize = function handleResize(index) {
383
- return function (e, _ref2, isDragEnd) {
384
- var size = _ref2.size;
394
+ return function (e, _ref3, isDragEnd) {
395
+ var size = _ref3.size;
385
396
  var nextColumns = _toConsumableArray(resizeColsRef.current);
386
397
  nextColumns[index] = _objectSpread(_objectSpread({}, nextColumns[index]), {}, {
387
398
  width: size.width
@@ -202,16 +202,4 @@ Table.propTypes = {
202
202
  */
203
203
  onColumnsResizeEnd: PropTypes.func
204
204
  };
205
- Table.defaultProps = {
206
- autoHeight: false,
207
- lazyLoading: false,
208
- dataSource: [],
209
- pagination: false,
210
- showHeader: true,
211
- bordered: false,
212
- size: "default",
213
- columnFilter: false,
214
- frontPagination: false,
215
- tableHeader: null
216
- };
217
205
  export default Table;