@douyinfe/semi-ui 2.38.3-alpha.2 → 2.38.3-alpha.4

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.
@@ -146,16 +146,16 @@ export declare function withError(props: ModalReactProps): {
146
146
  style?: React.CSSProperties;
147
147
  className?: string;
148
148
  motion?: boolean;
149
- getPopupContainer?: () => HTMLElement;
150
- footer?: React.ReactNode;
151
- header?: React.ReactNode;
152
- direction?: any;
153
149
  width?: string | number;
154
150
  height?: string | number;
151
+ footer?: React.ReactNode;
152
+ header?: React.ReactNode;
155
153
  mask?: boolean;
156
154
  visible?: boolean;
157
155
  content?: React.ReactNode;
158
156
  icon: string | number | boolean | React.ReactFragment | JSX.Element;
157
+ getPopupContainer?: () => HTMLElement;
158
+ direction?: any;
159
159
  onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
160
160
  zIndex?: number;
161
161
  closeOnEsc?: boolean;
@@ -16,7 +16,7 @@ var _resizeObserver = _interopRequireDefault(require("../resizeObserver"));
16
16
  var _intersectionObserver = _interopRequireDefault(require("./intersectionObserver"));
17
17
  var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/overflowList/foundation"));
18
18
  require("@douyinfe/semi-foundation/lib/cjs/overflowList/overflowList.css");
19
- var _utils = require("../_utils");
19
+ var _fastCopy = _interopRequireDefault(require("fast-copy"));
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
  /* eslint-disable arrow-body-style */
22
22
 
@@ -212,8 +212,8 @@ class OverflowList extends _baseComponent.default {
212
212
  maxCount = Math.min(maxCount, Math.floor(prevState.containerWidth / _constants.numbers.MINIMUM_HTML_ELEMENT_WIDTH));
213
213
  }
214
214
  const isCollapseFromStart = props.collapseFrom === Boundary.START;
215
- const visible = isCollapseFromStart ? (0, _utils.cloneDeep)(props.items).reverse().slice(0, maxCount) : props.items.slice(0, maxCount);
216
- const overflow = isCollapseFromStart ? (0, _utils.cloneDeep)(props.items).reverse().slice(maxCount) : props.items.slice(maxCount);
215
+ const visible = isCollapseFromStart ? (0, _fastCopy.default)(props.items).reverse().slice(0, maxCount) : props.items.slice(0, maxCount);
216
+ const overflow = isCollapseFromStart ? (0, _fastCopy.default)(props.items).reverse().slice(maxCount) : props.items.slice(maxCount);
217
217
  newState.visible = visible;
218
218
  newState.overflow = overflow;
219
219
  newState.maxCount = maxCount;
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _merge2 = _interopRequireDefault(require("lodash/merge"));
8
7
  var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
8
+ var _merge2 = _interopRequireDefault(require("lodash/merge"));
9
9
  var _omit2 = _interopRequireDefault(require("lodash/omit"));
10
10
  var _set2 = _interopRequireDefault(require("lodash/set"));
11
11
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
@@ -82,6 +82,12 @@ class TableCell extends _baseComponent.default {
82
82
  expandIcon
83
83
  } = props;
84
84
  const cellInSelectionColumn = (0, _utils.isSelectionColumn)(column);
85
+ const {
86
+ shouldCellUpdate
87
+ } = column;
88
+ if (typeof shouldCellUpdate === 'function') {
89
+ return shouldCellUpdate(nextProps, props);
90
+ }
85
91
  // The expand button may be in a separate column or in the first data column
86
92
  const columnHasExpandIcon = (0, _utils.isExpandedColumn)(column) || expandIcon;
87
93
  if ((cellInSelectionColumn || columnHasExpandIcon) && !(0, _isEqual2.default)(nextProps, this.props)) {
@@ -8,6 +8,7 @@ import { ArrayElement } from '../_base/base';
8
8
  import { strings } from '@douyinfe/semi-foundation/lib/cjs/table/constants';
9
9
  import { BaseRowKeyType, BaseSortOrder, BaseGroupBy, BaseGroupByFn, BaseFixed, BaseAlign, BaseChangeInfoSorter, BaseSorter, BaseFilter, BaseChangeInfoFilter, BaseIncludeGroupRecord, BaseEllipsis } from '@douyinfe/semi-foundation/lib/cjs/table/foundation';
10
10
  import { ScrollDirection, CSSDirection } from 'react-window';
11
+ import { TableCellProps } from './TableCell';
11
12
  export interface TableProps<RecordType extends Record<string, any> = any> extends BaseProps {
12
13
  bordered?: boolean;
13
14
  children?: ReactNode;
@@ -90,6 +91,10 @@ export interface ColumnProps<RecordType extends Record<string, any> = any> {
90
91
  onFilterDropdownVisibleChange?: OnFilterDropdownVisibleChange;
91
92
  onHeaderCell?: OnHeaderCell<RecordType>;
92
93
  ellipsis?: BaseEllipsis;
94
+ /**
95
+ * self control whether to update cell for performance reasons
96
+ */
97
+ shouldCellUpdate?: (props: TableCellProps, prevProps: TableCellProps) => boolean;
93
98
  }
94
99
  export type Align = BaseAlign;
95
100
  export type SortOrder = BaseSortOrder;
@@ -146,16 +146,16 @@ export declare function withError(props: ModalReactProps): {
146
146
  style?: React.CSSProperties;
147
147
  className?: string;
148
148
  motion?: boolean;
149
- getPopupContainer?: () => HTMLElement;
150
- footer?: React.ReactNode;
151
- header?: React.ReactNode;
152
- direction?: any;
153
149
  width?: string | number;
154
150
  height?: string | number;
151
+ footer?: React.ReactNode;
152
+ header?: React.ReactNode;
155
153
  mask?: boolean;
156
154
  visible?: boolean;
157
155
  content?: React.ReactNode;
158
156
  icon: string | number | boolean | React.ReactFragment | JSX.Element;
157
+ getPopupContainer?: () => HTMLElement;
158
+ direction?: any;
159
159
  onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
160
160
  zIndex?: number;
161
161
  closeOnEsc?: boolean;
@@ -11,7 +11,7 @@ import ResizeObserver from '../resizeObserver';
11
11
  import IntersectionObserver from './intersectionObserver';
12
12
  import OverflowListFoundation from '@douyinfe/semi-foundation/lib/es/overflowList/foundation';
13
13
  import '@douyinfe/semi-foundation/lib/es/overflowList/overflowList.css';
14
- import { cloneDeep } from '../_utils';
14
+ import copy from 'fast-copy';
15
15
  const prefixCls = cssClasses.PREFIX;
16
16
  const Boundary = strings.BOUNDARY_MAP;
17
17
  const OverflowDirection = strings.OVERFLOW_DIR;
@@ -204,8 +204,8 @@ class OverflowList extends BaseComponent {
204
204
  maxCount = Math.min(maxCount, Math.floor(prevState.containerWidth / numbers.MINIMUM_HTML_ELEMENT_WIDTH));
205
205
  }
206
206
  const isCollapseFromStart = props.collapseFrom === Boundary.START;
207
- const visible = isCollapseFromStart ? cloneDeep(props.items).reverse().slice(0, maxCount) : props.items.slice(0, maxCount);
208
- const overflow = isCollapseFromStart ? cloneDeep(props.items).reverse().slice(maxCount) : props.items.slice(maxCount);
207
+ const visible = isCollapseFromStart ? copy(props.items).reverse().slice(0, maxCount) : props.items.slice(0, maxCount);
208
+ const overflow = isCollapseFromStart ? copy(props.items).reverse().slice(maxCount) : props.items.slice(maxCount);
209
209
  newState.visible = visible;
210
210
  newState.overflow = overflow;
211
211
  newState.maxCount = maxCount;
@@ -1,5 +1,5 @@
1
- import _merge from "lodash/merge";
2
1
  import _isEqual from "lodash/isEqual";
2
+ import _merge from "lodash/merge";
3
3
  import _omit from "lodash/omit";
4
4
  import _set from "lodash/set";
5
5
  import _noop from "lodash/noop";
@@ -72,6 +72,12 @@ export default class TableCell extends BaseComponent {
72
72
  expandIcon
73
73
  } = props;
74
74
  const cellInSelectionColumn = isSelectionColumn(column);
75
+ const {
76
+ shouldCellUpdate
77
+ } = column;
78
+ if (typeof shouldCellUpdate === 'function') {
79
+ return shouldCellUpdate(nextProps, props);
80
+ }
75
81
  // The expand button may be in a separate column or in the first data column
76
82
  const columnHasExpandIcon = isExpandedColumn(column) || expandIcon;
77
83
  if ((cellInSelectionColumn || columnHasExpandIcon) && !_isEqual(nextProps, this.props)) {
@@ -8,6 +8,7 @@ import { ArrayElement } from '../_base/base';
8
8
  import { strings } from '@douyinfe/semi-foundation/lib/es/table/constants';
9
9
  import { BaseRowKeyType, BaseSortOrder, BaseGroupBy, BaseGroupByFn, BaseFixed, BaseAlign, BaseChangeInfoSorter, BaseSorter, BaseFilter, BaseChangeInfoFilter, BaseIncludeGroupRecord, BaseEllipsis } from '@douyinfe/semi-foundation/lib/es/table/foundation';
10
10
  import { ScrollDirection, CSSDirection } from 'react-window';
11
+ import { TableCellProps } from './TableCell';
11
12
  export interface TableProps<RecordType extends Record<string, any> = any> extends BaseProps {
12
13
  bordered?: boolean;
13
14
  children?: ReactNode;
@@ -90,6 +91,10 @@ export interface ColumnProps<RecordType extends Record<string, any> = any> {
90
91
  onFilterDropdownVisibleChange?: OnFilterDropdownVisibleChange;
91
92
  onHeaderCell?: OnHeaderCell<RecordType>;
92
93
  ellipsis?: BaseEllipsis;
94
+ /**
95
+ * self control whether to update cell for performance reasons
96
+ */
97
+ shouldCellUpdate?: (props: TableCellProps, prevProps: TableCellProps) => boolean;
93
98
  }
94
99
  export type Align = BaseAlign;
95
100
  export type SortOrder = BaseSortOrder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.38.3-alpha.2",
3
+ "version": "2.38.3-alpha.4",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,17 +17,18 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.38.3-alpha.2",
21
- "@douyinfe/semi-animation-react": "2.38.3-alpha.2",
22
- "@douyinfe/semi-foundation": "2.38.3-alpha.2",
23
- "@douyinfe/semi-icons": "2.38.3-alpha.2",
24
- "@douyinfe/semi-illustrations": "2.38.3-alpha.2",
25
- "@douyinfe/semi-theme-default": "2.38.3-alpha.2",
20
+ "@douyinfe/semi-animation": "2.38.3-alpha.4",
21
+ "@douyinfe/semi-animation-react": "2.38.3-alpha.4",
22
+ "@douyinfe/semi-foundation": "2.38.3-alpha.4",
23
+ "@douyinfe/semi-icons": "2.38.3-alpha.4",
24
+ "@douyinfe/semi-illustrations": "2.38.3-alpha.4",
25
+ "@douyinfe/semi-theme-default": "2.38.3-alpha.4",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
29
29
  "date-fns": "^2.29.3",
30
30
  "date-fns-tz": "^1.3.8",
31
+ "fast-copy": "^3.0.1",
31
32
  "lodash": "^4.17.21",
32
33
  "prop-types": "^15.7.2",
33
34
  "react-resizable": "^1.8.0",
@@ -69,7 +70,7 @@
69
70
  ],
70
71
  "author": "",
71
72
  "license": "MIT",
72
- "gitHead": "2b95b13c9f2ddd1205647aef6f25ce70ea6e17a2",
73
+ "gitHead": "02d808a3ef1998dba39f5c204b5aec6a11335837",
73
74
  "devDependencies": {
74
75
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
76
  "@babel/plugin-transform-runtime": "^7.15.8",