@douyinfe/semi-ui 2.57.0 → 2.58.0-beta.0

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.
@@ -217,7 +217,7 @@ class NavItem extends _baseComponent.default {
217
217
  onMouseEnter: onMouseEnter,
218
218
  onMouseLeave: onMouseLeave,
219
219
  onKeyPress: this.handleKeyPress
220
- }), itemChildren);
220
+ }, this.getDataAttr(this.props)), itemChildren);
221
221
  }
222
222
  // Display Tooltip when disabled and SubNav
223
223
  if (isCollapsed && !isInSubNav && !isSubNav || isCollapsed && isSubNav && disabled) {
@@ -158,11 +158,9 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
158
158
  disabled: boolean;
159
159
  };
160
160
  get adapter(): TableRowAdapter<BaseRowProps>;
161
- ref: React.MutableRefObject<any>;
162
161
  constructor(props: BaseRowProps);
163
162
  componentDidMount(): void;
164
163
  shouldComponentUpdate(nextProps: BaseRowProps): boolean;
165
- _cacheNode: (node: any) => void;
166
164
  renderExpandIcon: (record: Record<string, any>) => React.ReactNode;
167
165
  renderCells(): React.ReactNode[];
168
166
  handleMouseEnter: (e: React.MouseEvent) => void;
@@ -11,7 +11,7 @@ var _stubTrue2 = _interopRequireDefault(require("lodash/stubTrue"));
11
11
  var _get2 = _interopRequireDefault(require("lodash/get"));
12
12
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
13
13
  var _each2 = _interopRequireDefault(require("lodash/each"));
14
- var _react = _interopRequireWildcard(require("react"));
14
+ var _react = _interopRequireDefault(require("react"));
15
15
  var _classnames = _interopRequireDefault(require("classnames"));
16
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
  var _constants = require("@douyinfe/semi-foundation/lib/cjs/table/constants");
@@ -20,8 +20,6 @@ var _tableRowFoundation = _interopRequireDefault(require("@douyinfe/semi-foundat
20
20
  var _utils = require("@douyinfe/semi-foundation/lib/cjs/table/utils");
21
21
  var _baseComponent = _interopRequireDefault(require("../../_base/baseComponent"));
22
22
  var _TableCell = _interopRequireDefault(require("../TableCell"));
23
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
24
  var __rest = void 0 && (void 0).__rest || function (s, e) {
27
25
  var t = {};
@@ -98,9 +96,6 @@ class TableRow extends _baseComponent.default {
98
96
  }
99
97
  constructor(props) {
100
98
  super(props);
101
- this._cacheNode = node => {
102
- this.ref.current = node;
103
- };
104
99
  // Pass true to render the tree-shaped expand button
105
100
  this.renderExpandIcon = record => {
106
101
  const {
@@ -129,7 +124,6 @@ class TableRow extends _baseComponent.default {
129
124
  customRowProps.onClick(e);
130
125
  }
131
126
  };
132
- this.ref = /*#__PURE__*/(0, _react.createRef)();
133
127
  this.foundation = new _tableRowFoundation.default(this.adapter);
134
128
  }
135
129
  componentDidMount() {
@@ -270,7 +264,8 @@ class TableRow extends _baseComponent.default {
270
264
  expandableRow,
271
265
  level,
272
266
  expandedRow,
273
- isSection
267
+ isSection,
268
+ rowKey
274
269
  } = this.props;
275
270
  const BodyRow = components.body.row;
276
271
  const _a = onRow(record, index) || {},
@@ -281,7 +276,7 @@ class TableRow extends _baseComponent.default {
281
276
  rowProps = __rest(_a, ["className", "style"]);
282
277
  this.adapter.setCache('customRowProps', Object.assign({}, rowProps));
283
278
  const baseRowStyle = Object.assign(Object.assign({}, style), customStyle);
284
- const rowCls = typeof replaceClassName === 'string' && replaceClassName.length ? replaceClassName : (0, _classnames.default)(className, `${prefixCls}-row`, {
279
+ const rowCls = typeof replaceClassName === 'string' && replaceClassName.length ? (0, _classnames.default)(replaceClassName, customClassName) : (0, _classnames.default)(className, `${prefixCls}-row`, {
285
280
  [`${prefixCls}-row-selected`]: selected,
286
281
  [`${prefixCls}-row-expanded`]: expanded,
287
282
  [`${prefixCls}-row-hovered`]: hovered,
@@ -309,7 +304,7 @@ class TableRow extends _baseComponent.default {
309
304
  }, ariaProps, rowProps, {
310
305
  style: baseRowStyle,
311
306
  className: rowCls,
312
- ref: this._cacheNode,
307
+ "data-row-key": rowKey,
313
308
  onMouseEnter: this.handleMouseEnter,
314
309
  onMouseLeave: this.handleMouseLeave,
315
310
  onClick: this.handleClick
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { ColumnProps } from './interface';
3
+ import { ColumnProps, TableComponents } from './interface';
4
4
  export interface ColGroupProps {
5
5
  columns?: ColumnProps[];
6
6
  prefixCls?: string;
7
7
  className?: string;
8
8
  style?: React.CSSProperties;
9
- components?: Record<string, any>;
9
+ components?: TableComponents['body'];
10
10
  }
11
11
  export default class ColGroup extends React.PureComponent<ColGroupProps> {
12
12
  static propTypes: {
@@ -173,7 +173,7 @@ export interface OnRowReturnObject extends Omit<React.DetailedHTMLProps<React.HT
173
173
  style?: React.CSSProperties;
174
174
  onClick?: (e: React.MouseEvent) => void;
175
175
  }
176
- export interface OnGroupedRowReturnObject extends Omit<React.HTMLAttributes<HTMLTableRowElement>, 'className'> {
176
+ export interface OnGroupedRowReturnObject extends React.HTMLAttributes<HTMLTableRowElement> {
177
177
  [x: string]: any;
178
178
  style?: React.CSSProperties;
179
179
  onClick?: (e: React.MouseEvent) => void;
@@ -188,29 +188,30 @@ export interface Data {
188
188
  [x: string]: any;
189
189
  key?: string | number;
190
190
  }
191
+ export type TableComponent<P> = React.ComponentType<P> | React.ForwardRefExoticComponent<P> | keyof React.ReactHTML;
191
192
  export interface TableComponents {
192
- table?: ReactNode;
193
+ table?: TableComponent<any>;
193
194
  header?: {
194
- outer?: ReactNode;
195
- wrapper?: ReactNode;
196
- row?: ReactNode;
197
- cell?: ReactNode;
195
+ outer?: TableComponent<any>;
196
+ wrapper?: TableComponent<any>;
197
+ row?: TableComponent<any>;
198
+ cell?: TableComponent<any>;
198
199
  };
199
200
  body?: {
200
- outer?: ReactNode;
201
- wrapper?: ReactNode;
202
- row?: ReactNode;
203
- cell?: ReactNode;
201
+ outer?: TableComponent<any>;
202
+ wrapper?: TableComponent<any>;
203
+ row?: TableComponent<any>;
204
+ cell?: TableComponent<any>;
204
205
  colgroup?: {
205
- wrapper?: ReactNode;
206
- col?: ReactNode;
206
+ wrapper?: TableComponent<any>;
207
+ col?: TableComponent<any>;
207
208
  };
208
209
  };
209
210
  footer?: {
210
- wrapper?: ReactNode;
211
- row?: ReactNode;
212
- cell?: ReactNode;
213
- outer?: ReactNode;
211
+ wrapper?: TableComponent<any>;
212
+ row?: TableComponent<any>;
213
+ cell?: TableComponent<any>;
214
+ outer?: TableComponent<any>;
214
215
  };
215
216
  }
216
217
  export interface RowSelectionProps<RecordType> {
@@ -448,9 +448,12 @@ class TagInput extends _baseComponent.default {
448
448
  className,
449
449
  disabled,
450
450
  placeholder,
451
- validateStatus
451
+ validateStatus,
452
+ prefix,
453
+ insetLabel,
454
+ suffix
452
455
  } = _a,
453
- rest = __rest(_a, ["size", "style", "className", "disabled", "placeholder", "validateStatus"]);
456
+ rest = __rest(_a, ["size", "style", "className", "disabled", "placeholder", "validateStatus", "prefix", "insetLabel", "suffix"]);
454
457
  const {
455
458
  focusing,
456
459
  hovering,
@@ -465,7 +468,9 @@ class TagInput extends _baseComponent.default {
465
468
  [`${prefixCls}-error`]: validateStatus === 'error',
466
469
  [`${prefixCls}-warning`]: validateStatus === 'warning',
467
470
  [`${prefixCls}-small`]: size === 'small',
468
- [`${prefixCls}-large`]: size === 'large'
471
+ [`${prefixCls}-large`]: size === 'large',
472
+ [`${prefixCls}-with-prefix`]: !!prefix || !!insetLabel,
473
+ [`${prefixCls}-with-suffix`]: !!suffix
469
474
  });
470
475
  const inputCls = (0, _classnames.default)(`${prefixCls}-wrapper-input`, `${prefixCls}-wrapper-input-${size}`);
471
476
  const wrapperCls = (0, _classnames.default)(`${prefixCls}-wrapper`);
@@ -210,7 +210,7 @@ export default class NavItem extends BaseComponent {
210
210
  onMouseEnter: onMouseEnter,
211
211
  onMouseLeave: onMouseLeave,
212
212
  onKeyPress: this.handleKeyPress
213
- }), itemChildren);
213
+ }, this.getDataAttr(this.props)), itemChildren);
214
214
  }
215
215
  // Display Tooltip when disabled and SubNav
216
216
  if (isCollapsed && !isInSubNav && !isSubNav || isCollapsed && isSubNav && disabled) {
@@ -158,11 +158,9 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
158
158
  disabled: boolean;
159
159
  };
160
160
  get adapter(): TableRowAdapter<BaseRowProps>;
161
- ref: React.MutableRefObject<any>;
162
161
  constructor(props: BaseRowProps);
163
162
  componentDidMount(): void;
164
163
  shouldComponentUpdate(nextProps: BaseRowProps): boolean;
165
- _cacheNode: (node: any) => void;
166
164
  renderExpandIcon: (record: Record<string, any>) => React.ReactNode;
167
165
  renderCells(): React.ReactNode[];
168
166
  handleMouseEnter: (e: React.MouseEvent) => void;
@@ -13,7 +13,7 @@ var __rest = this && this.__rest || function (s, e) {
13
13
  }
14
14
  return t;
15
15
  };
16
- import React, { createRef } from 'react';
16
+ import React from 'react';
17
17
  import classnames from 'classnames';
18
18
  import PropTypes from 'prop-types';
19
19
  import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/table/constants';
@@ -88,9 +88,6 @@ export default class TableRow extends BaseComponent {
88
88
  }
89
89
  constructor(props) {
90
90
  super(props);
91
- this._cacheNode = node => {
92
- this.ref.current = node;
93
- };
94
91
  // Pass true to render the tree-shaped expand button
95
92
  this.renderExpandIcon = record => {
96
93
  const {
@@ -119,7 +116,6 @@ export default class TableRow extends BaseComponent {
119
116
  customRowProps.onClick(e);
120
117
  }
121
118
  };
122
- this.ref = /*#__PURE__*/createRef();
123
119
  this.foundation = new TableRowFoundation(this.adapter);
124
120
  }
125
121
  componentDidMount() {
@@ -260,7 +256,8 @@ export default class TableRow extends BaseComponent {
260
256
  expandableRow,
261
257
  level,
262
258
  expandedRow,
263
- isSection
259
+ isSection,
260
+ rowKey
264
261
  } = this.props;
265
262
  const BodyRow = components.body.row;
266
263
  const _a = onRow(record, index) || {},
@@ -271,7 +268,7 @@ export default class TableRow extends BaseComponent {
271
268
  rowProps = __rest(_a, ["className", "style"]);
272
269
  this.adapter.setCache('customRowProps', Object.assign({}, rowProps));
273
270
  const baseRowStyle = Object.assign(Object.assign({}, style), customStyle);
274
- const rowCls = typeof replaceClassName === 'string' && replaceClassName.length ? replaceClassName : classnames(className, `${prefixCls}-row`, {
271
+ const rowCls = typeof replaceClassName === 'string' && replaceClassName.length ? classnames(replaceClassName, customClassName) : classnames(className, `${prefixCls}-row`, {
275
272
  [`${prefixCls}-row-selected`]: selected,
276
273
  [`${prefixCls}-row-expanded`]: expanded,
277
274
  [`${prefixCls}-row-hovered`]: hovered,
@@ -299,7 +296,7 @@ export default class TableRow extends BaseComponent {
299
296
  }, ariaProps, rowProps, {
300
297
  style: baseRowStyle,
301
298
  className: rowCls,
302
- ref: this._cacheNode,
299
+ "data-row-key": rowKey,
303
300
  onMouseEnter: this.handleMouseEnter,
304
301
  onMouseLeave: this.handleMouseLeave,
305
302
  onClick: this.handleClick
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { ColumnProps } from './interface';
3
+ import { ColumnProps, TableComponents } from './interface';
4
4
  export interface ColGroupProps {
5
5
  columns?: ColumnProps[];
6
6
  prefixCls?: string;
7
7
  className?: string;
8
8
  style?: React.CSSProperties;
9
- components?: Record<string, any>;
9
+ components?: TableComponents['body'];
10
10
  }
11
11
  export default class ColGroup extends React.PureComponent<ColGroupProps> {
12
12
  static propTypes: {
@@ -173,7 +173,7 @@ export interface OnRowReturnObject extends Omit<React.DetailedHTMLProps<React.HT
173
173
  style?: React.CSSProperties;
174
174
  onClick?: (e: React.MouseEvent) => void;
175
175
  }
176
- export interface OnGroupedRowReturnObject extends Omit<React.HTMLAttributes<HTMLTableRowElement>, 'className'> {
176
+ export interface OnGroupedRowReturnObject extends React.HTMLAttributes<HTMLTableRowElement> {
177
177
  [x: string]: any;
178
178
  style?: React.CSSProperties;
179
179
  onClick?: (e: React.MouseEvent) => void;
@@ -188,29 +188,30 @@ export interface Data {
188
188
  [x: string]: any;
189
189
  key?: string | number;
190
190
  }
191
+ export type TableComponent<P> = React.ComponentType<P> | React.ForwardRefExoticComponent<P> | keyof React.ReactHTML;
191
192
  export interface TableComponents {
192
- table?: ReactNode;
193
+ table?: TableComponent<any>;
193
194
  header?: {
194
- outer?: ReactNode;
195
- wrapper?: ReactNode;
196
- row?: ReactNode;
197
- cell?: ReactNode;
195
+ outer?: TableComponent<any>;
196
+ wrapper?: TableComponent<any>;
197
+ row?: TableComponent<any>;
198
+ cell?: TableComponent<any>;
198
199
  };
199
200
  body?: {
200
- outer?: ReactNode;
201
- wrapper?: ReactNode;
202
- row?: ReactNode;
203
- cell?: ReactNode;
201
+ outer?: TableComponent<any>;
202
+ wrapper?: TableComponent<any>;
203
+ row?: TableComponent<any>;
204
+ cell?: TableComponent<any>;
204
205
  colgroup?: {
205
- wrapper?: ReactNode;
206
- col?: ReactNode;
206
+ wrapper?: TableComponent<any>;
207
+ col?: TableComponent<any>;
207
208
  };
208
209
  };
209
210
  footer?: {
210
- wrapper?: ReactNode;
211
- row?: ReactNode;
212
- cell?: ReactNode;
213
- outer?: ReactNode;
211
+ wrapper?: TableComponent<any>;
212
+ row?: TableComponent<any>;
213
+ cell?: TableComponent<any>;
214
+ outer?: TableComponent<any>;
214
215
  };
215
216
  }
216
217
  export interface RowSelectionProps<RecordType> {
@@ -441,9 +441,12 @@ class TagInput extends BaseComponent {
441
441
  className,
442
442
  disabled,
443
443
  placeholder,
444
- validateStatus
444
+ validateStatus,
445
+ prefix,
446
+ insetLabel,
447
+ suffix
445
448
  } = _a,
446
- rest = __rest(_a, ["size", "style", "className", "disabled", "placeholder", "validateStatus"]);
449
+ rest = __rest(_a, ["size", "style", "className", "disabled", "placeholder", "validateStatus", "prefix", "insetLabel", "suffix"]);
447
450
  const {
448
451
  focusing,
449
452
  hovering,
@@ -458,7 +461,9 @@ class TagInput extends BaseComponent {
458
461
  [`${prefixCls}-error`]: validateStatus === 'error',
459
462
  [`${prefixCls}-warning`]: validateStatus === 'warning',
460
463
  [`${prefixCls}-small`]: size === 'small',
461
- [`${prefixCls}-large`]: size === 'large'
464
+ [`${prefixCls}-large`]: size === 'large',
465
+ [`${prefixCls}-with-prefix`]: !!prefix || !!insetLabel,
466
+ [`${prefixCls}-with-suffix`]: !!suffix
462
467
  });
463
468
  const inputCls = cls(`${prefixCls}-wrapper-input`, `${prefixCls}-wrapper-input-${size}`);
464
469
  const wrapperCls = cls(`${prefixCls}-wrapper`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.57.0",
3
+ "version": "2.58.0-beta.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.57.0",
24
- "@douyinfe/semi-animation-react": "2.57.0",
25
- "@douyinfe/semi-foundation": "2.57.0",
26
- "@douyinfe/semi-icons": "2.57.0",
27
- "@douyinfe/semi-illustrations": "2.57.0",
28
- "@douyinfe/semi-theme-default": "2.57.0",
23
+ "@douyinfe/semi-animation": "2.58.0-beta.0",
24
+ "@douyinfe/semi-animation-react": "2.58.0-beta.0",
25
+ "@douyinfe/semi-foundation": "2.58.0-beta.0",
26
+ "@douyinfe/semi-icons": "2.58.0-beta.0",
27
+ "@douyinfe/semi-illustrations": "2.58.0-beta.0",
28
+ "@douyinfe/semi-theme-default": "2.58.0-beta.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "57571d206421c8044245b6eaf70b49cce034f939",
78
+ "gitHead": "bd0c5bf8924d1e971746ba88f83c2c8857d307f7",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",