@douyinfe/semi-ui 2.38.2-alpha.1 → 2.38.2-alpha.2-patch-modal

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 (41) hide show
  1. package/dist/css/semi.css +45 -2
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +78 -88
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/collapsible/index.d.ts +2 -0
  8. package/lib/cjs/collapsible/index.js +19 -11
  9. package/lib/cjs/dropdown/dropdownItem.js +11 -1
  10. package/lib/cjs/form/baseForm.d.ts +1 -1
  11. package/lib/cjs/form/field.d.ts +1 -1
  12. package/lib/cjs/input/textarea.js +1 -1
  13. package/lib/cjs/modal/Modal.js +9 -6
  14. package/lib/cjs/modal/ModalContent.js +5 -4
  15. package/lib/cjs/modal/confirm.d.ts +3 -3
  16. package/lib/cjs/scrollList/scrollItem.js +1 -1
  17. package/lib/cjs/select/option.js +2 -1
  18. package/lib/cjs/spin/icon.js +14 -51
  19. package/lib/cjs/table/Body/index.js +1 -1
  20. package/lib/cjs/table/TableCell.js +7 -1
  21. package/lib/cjs/table/interface.d.ts +9 -0
  22. package/lib/cjs/treeSelect/index.d.ts +1 -1
  23. package/lib/cjs/treeSelect/index.js +2 -2
  24. package/lib/es/collapsible/index.d.ts +2 -0
  25. package/lib/es/collapsible/index.js +19 -11
  26. package/lib/es/dropdown/dropdownItem.js +11 -1
  27. package/lib/es/form/baseForm.d.ts +1 -1
  28. package/lib/es/form/field.d.ts +1 -1
  29. package/lib/es/input/textarea.js +1 -1
  30. package/lib/es/modal/Modal.js +9 -6
  31. package/lib/es/modal/ModalContent.js +5 -4
  32. package/lib/es/modal/confirm.d.ts +3 -3
  33. package/lib/es/scrollList/scrollItem.js +1 -1
  34. package/lib/es/select/option.js +2 -1
  35. package/lib/es/spin/icon.js +14 -51
  36. package/lib/es/table/Body/index.js +1 -1
  37. package/lib/es/table/TableCell.js +7 -1
  38. package/lib/es/table/interface.d.ts +9 -0
  39. package/lib/es/treeSelect/index.d.ts +1 -1
  40. package/lib/es/treeSelect/index.js +2 -2
  41. package/package.json +8 -8
@@ -278,20 +278,21 @@ export default class ModalContent extends BaseComponent {
278
278
  this.foundation.destroy();
279
279
  }
280
280
  render() {
281
- const _a = this.props,
281
+ var _a;
282
+ const _b = this.props,
282
283
  {
283
284
  maskClosable,
284
285
  className,
285
286
  getPopupContainer,
286
287
  maskFixed,
287
288
  getContainerContext
288
- } = _a,
289
- rest = __rest(_a, ["maskClosable", "className", "getPopupContainer", "maskFixed", "getContainerContext"]);
289
+ } = _b,
290
+ rest = __rest(_b, ["maskClosable", "className", "getPopupContainer", "maskFixed", "getContainerContext"]);
290
291
  const {
291
292
  direction
292
293
  } = this.context;
293
294
  const classList = cls(className, {
294
- [`${cssClasses.DIALOG}-popup`]: getPopupContainer && !maskFixed,
295
+ [`${cssClasses.DIALOG}-popup`]: getPopupContainer && getPopupContainer() !== ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body) && !maskFixed,
295
296
  [`${cssClasses.DIALOG}-fixed`]: maskFixed,
296
297
  [`${cssClasses.DIALOG}-rtl`]: direction === 'rtl'
297
298
  });
@@ -145,11 +145,11 @@ export declare function withError(props: ModalReactProps): {
145
145
  size?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").Size;
146
146
  style?: React.CSSProperties;
147
147
  className?: string;
148
+ motion?: boolean;
148
149
  getPopupContainer?: () => HTMLElement;
149
150
  footer?: React.ReactNode;
150
151
  header?: React.ReactNode;
151
152
  direction?: any;
152
- motion?: boolean;
153
153
  width?: string | number;
154
154
  height?: string | number;
155
155
  mask?: boolean;
@@ -204,10 +204,10 @@ export declare function withError(props: ModalReactProps): {
204
204
  title?: string;
205
205
  name?: string;
206
206
  value?: string | number | readonly string[];
207
- form?: string;
208
- slot?: string;
209
207
  onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
210
208
  onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
209
+ form?: string;
210
+ slot?: string;
211
211
  hidden?: boolean;
212
212
  color?: string;
213
213
  content?: string;
@@ -243,8 +243,8 @@ export default class ScrollItem extends BaseComponent {
243
243
  key: prefixKey + index
244
244
  }, events, {
245
245
  className: cls,
246
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
246
247
  role: "option",
247
- "aria-selected": selected,
248
248
  "aria-disabled": item.disabled
249
249
  }), text)
250
250
  );
@@ -102,7 +102,8 @@ class Option extends PureComponent {
102
102
  value,
103
103
  label,
104
104
  children
105
- }, rest), e)
105
+ }, rest), e),
106
+ className
106
107
  }, rest));
107
108
  }
108
109
  const config = {
@@ -8,64 +8,27 @@ var __rest = this && this.__rest || function (s, e) {
8
8
  };
9
9
  /* eslint-disable no-unused-vars */
10
10
  import React from 'react';
11
- import isNullOrUndefined from '@douyinfe/semi-foundation/lib/es/utils/isNullOrUndefined';
12
- let _id = -1;
13
11
  function Icon() {
14
12
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
13
  const {
16
- id: propsId,
14
+ id,
17
15
  className
18
16
  } = props,
19
17
  rest = __rest(props, ["id", "className"]);
20
- let _propsId = propsId;
21
- if (isNullOrUndefined(_propsId)) {
22
- _id++;
23
- _propsId = _id;
24
- }
25
- const id = `linearGradient-${_propsId}`;
26
18
  return /*#__PURE__*/React.createElement("svg", Object.assign({}, rest, {
27
19
  className: className,
28
- width: "48",
29
- height: "48",
30
- viewBox: "0 0 36 36",
31
- version: "1.1",
32
- xmlns: "http://www.w3.org/2000/svg",
33
- "aria-hidden": true,
34
- "data-icon": "spin"
35
- }), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
36
- x1: "0%",
37
- y1: "100%",
38
- x2: "100%",
39
- y2: "100%",
40
- id: id
41
- }, /*#__PURE__*/React.createElement("stop", {
42
- stopColor: "currentColor",
43
- stopOpacity: "0",
44
- offset: "0%"
45
- }), /*#__PURE__*/React.createElement("stop", {
46
- stopColor: "currentColor",
47
- stopOpacity: "0.50",
48
- offset: "39.9430698%"
49
- }), /*#__PURE__*/React.createElement("stop", {
50
- stopColor: "currentColor",
51
- offset: "100%"
52
- }))), /*#__PURE__*/React.createElement("g", {
53
- stroke: "none",
54
- strokeWidth: "1",
55
- fill: "none",
56
- fillRule: "evenodd"
57
- }, /*#__PURE__*/React.createElement("rect", {
58
- fillOpacity: "0.01",
59
- fill: "none",
60
- x: "0",
61
- y: "0",
62
- width: "36",
63
- height: "36"
64
- }), /*#__PURE__*/React.createElement("path", {
65
- d: "M34,18 C34,9.163444 26.836556,2 18,2 C11.6597233,2 6.18078805,5.68784135 3.59122325,11.0354951",
66
- stroke: `url(#${id})`,
67
- strokeWidth: "4",
68
- strokeLinecap: "round"
69
- })));
20
+ width: "100%",
21
+ height: "100%",
22
+ viewBox: "0 0 100 100"
23
+ }), /*#__PURE__*/React.createElement("circle", {
24
+ cx: "50",
25
+ cy: "50",
26
+ r: "35",
27
+ stroke: "currentColor",
28
+ strokeWidth: "11",
29
+ strokeLinecap: "round",
30
+ strokeMiterlimit: "10",
31
+ fill: "none"
32
+ }));
70
33
  }
71
34
  export default Icon;
@@ -496,7 +496,7 @@ class Body extends BaseComponent {
496
496
  if (props.virtualized) {
497
497
  getVirtualizedListRef(this.listRef);
498
498
  } else {
499
- console.warn('getVirtualizedListRef only works with virtualized. ' + 'See https://semi.design/zh-CN/show/table for more information.');
499
+ console.warn('getVirtualizedListRef only works with virtualized. ' + 'See https://semi.design/en-US/show/table for more information.');
500
500
  }
501
501
  }
502
502
  this.foundation = new BodyFoundation(this.adapter);
@@ -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;
@@ -211,6 +216,10 @@ export interface RowSelectionProps<RecordType> {
211
216
  onChange?: RowSelectionOnChange<RecordType>;
212
217
  onSelect?: RowSelectionOnSelect<RecordType>;
213
218
  onSelectAll?: RowSelectionOnSelectAll<RecordType>;
219
+ /**
220
+ * self control whether to update cell for performance reasons
221
+ */
222
+ shouldCellUpdate?: (props: TableCellProps, prevProps: TableCellProps) => boolean;
214
223
  }
215
224
  export type GetCheckboxProps<RecordType> = (record: RecordType) => CheckboxProps;
216
225
  export type RowSelectionOnChange<RecordType> = (selectedRowKeys?: (string | number)[], selectedRows?: RecordType[]) => void;
@@ -228,7 +228,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
228
228
  renderArrow: () => JSX.Element;
229
229
  renderClearBtn: () => JSX.Element;
230
230
  renderSelection: () => JSX.Element;
231
- renderTagItem: (key: string, idx: number) => string | number | boolean | React.ReactFragment | JSX.Element;
231
+ renderTagItem: (key: string, idx: number) => any;
232
232
  renderTagInput: () => JSX.Element;
233
233
  renderInput: () => JSX.Element;
234
234
  renderEmpty: () => JSX.Element;
@@ -192,7 +192,7 @@ class TreeSelect extends BaseComponent {
192
192
  } = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
193
193
  index,
194
194
  onClose
195
- }) : null;
195
+ }) : {};
196
196
  if (_isNull(content) || _isUndefined(content)) {
197
197
  return;
198
198
  }
@@ -490,7 +490,7 @@ class TreeSelect extends BaseComponent {
490
490
  } = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
491
491
  index: idx,
492
492
  onClose
493
- }) : null;
493
+ }) : {};
494
494
  if (isRenderInTag) {
495
495
  return /*#__PURE__*/React.createElement(Tag, Object.assign({}, tagProps), content);
496
496
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.38.2-alpha.1",
3
+ "version": "2.38.2-alpha.2-patch-modal",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.38.2-alpha.1",
21
- "@douyinfe/semi-animation-react": "2.38.2-alpha.1",
22
- "@douyinfe/semi-foundation": "2.38.2-alpha.1",
23
- "@douyinfe/semi-icons": "2.38.2-alpha.1",
24
- "@douyinfe/semi-illustrations": "2.38.2-alpha.1",
25
- "@douyinfe/semi-theme-default": "2.38.2-alpha.1",
20
+ "@douyinfe/semi-animation": "2.38.2-alpha.2-patch-modal",
21
+ "@douyinfe/semi-animation-react": "2.38.2-alpha.2-patch-modal",
22
+ "@douyinfe/semi-foundation": "2.38.2-alpha.2-patch-modal",
23
+ "@douyinfe/semi-icons": "2.38.2-alpha.2-patch-modal",
24
+ "@douyinfe/semi-illustrations": "2.38.2-alpha.2-patch-modal",
25
+ "@douyinfe/semi-theme-default": "2.38.2-alpha.2-patch-modal",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "cb42a0565bba8660255835264d23dfcba6ff4aa3",
72
+ "gitHead": "0b01c3ee2c2e054522e1022f24f64fcc1b6ce6ac",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",