@douyinfe/semi-ui 2.57.0-beta.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.
- package/README.md +1 -1
- package/dist/css/semi.css +21 -3
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +99 -92
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/form/hoc/withField.js +11 -4
- package/lib/cjs/image/image.js +7 -3
- package/lib/cjs/image/interface.d.ts +2 -0
- package/lib/cjs/input/index.js +3 -3
- package/lib/cjs/input/textarea.js +4 -2
- package/lib/cjs/navigation/Item.js +1 -1
- package/lib/cjs/table/Body/BaseRow.d.ts +0 -2
- package/lib/cjs/table/Body/BaseRow.js +5 -10
- package/lib/cjs/table/ColGroup.d.ts +2 -2
- package/lib/cjs/table/interface.d.ts +17 -16
- package/lib/cjs/tagInput/index.js +8 -3
- package/lib/cjs/tooltip/index.js +10 -1
- package/lib/cjs/treeSelect/index.js +44 -39
- package/lib/es/form/hoc/withField.js +11 -4
- package/lib/es/image/image.js +7 -3
- package/lib/es/image/interface.d.ts +2 -0
- package/lib/es/input/index.js +3 -3
- package/lib/es/input/textarea.js +4 -2
- package/lib/es/navigation/Item.js +1 -1
- package/lib/es/table/Body/BaseRow.d.ts +0 -2
- package/lib/es/table/Body/BaseRow.js +5 -8
- package/lib/es/table/ColGroup.d.ts +2 -2
- package/lib/es/table/interface.d.ts +17 -16
- package/lib/es/tagInput/index.js +8 -3
- package/lib/es/tooltip/index.js +11 -2
- package/lib/es/treeSelect/index.js +44 -39
- package/package.json +8 -8
|
@@ -13,7 +13,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
13
13
|
}
|
|
14
14
|
return t;
|
|
15
15
|
};
|
|
16
|
-
import 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
|
-
|
|
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?:
|
|
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
|
|
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?:
|
|
193
|
+
table?: TableComponent<any>;
|
|
193
194
|
header?: {
|
|
194
|
-
outer?:
|
|
195
|
-
wrapper?:
|
|
196
|
-
row?:
|
|
197
|
-
cell?:
|
|
195
|
+
outer?: TableComponent<any>;
|
|
196
|
+
wrapper?: TableComponent<any>;
|
|
197
|
+
row?: TableComponent<any>;
|
|
198
|
+
cell?: TableComponent<any>;
|
|
198
199
|
};
|
|
199
200
|
body?: {
|
|
200
|
-
outer?:
|
|
201
|
-
wrapper?:
|
|
202
|
-
row?:
|
|
203
|
-
cell?:
|
|
201
|
+
outer?: TableComponent<any>;
|
|
202
|
+
wrapper?: TableComponent<any>;
|
|
203
|
+
row?: TableComponent<any>;
|
|
204
|
+
cell?: TableComponent<any>;
|
|
204
205
|
colgroup?: {
|
|
205
|
-
wrapper?:
|
|
206
|
-
col?:
|
|
206
|
+
wrapper?: TableComponent<any>;
|
|
207
|
+
col?: TableComponent<any>;
|
|
207
208
|
};
|
|
208
209
|
};
|
|
209
210
|
footer?: {
|
|
210
|
-
wrapper?:
|
|
211
|
-
row?:
|
|
212
|
-
cell?:
|
|
213
|
-
outer?:
|
|
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> {
|
package/lib/es/tagInput/index.js
CHANGED
|
@@ -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/lib/es/tooltip/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
17
|
import React, { isValidElement, cloneElement } from 'react';
|
|
18
|
-
import ReactDOM from 'react-dom';
|
|
18
|
+
import ReactDOM, { findDOMNode } from 'react-dom';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
20
|
import PropTypes from 'prop-types';
|
|
21
21
|
import { BASE_CLASS_PREFIX } from '@douyinfe/semi-foundation/lib/es/base/constants';
|
|
@@ -28,7 +28,7 @@ import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
|
28
28
|
import '@douyinfe/semi-foundation/lib/es/tooltip/tooltip.css';
|
|
29
29
|
import BaseComponent from '../_base/baseComponent';
|
|
30
30
|
import { isHTMLElement } from '../_base/reactUtils';
|
|
31
|
-
import { getActiveElement, getDefaultPropsFromGlobalConfig, getFocusableElements, stopPropagation } from '../_utils';
|
|
31
|
+
import { getActiveElement, getDefaultPropsFromGlobalConfig, getFocusableElements, runAfterTicks, stopPropagation } from '../_utils';
|
|
32
32
|
import Portal from '../_portal/index';
|
|
33
33
|
import ConfigContext from '../configProvider/context';
|
|
34
34
|
import TriangleArrow from './TriangleArrow';
|
|
@@ -536,6 +536,15 @@ export default class Tooltip extends BaseComponent {
|
|
|
536
536
|
this.mounted = true;
|
|
537
537
|
this.getPopupContainer = this.props.getPopupContainer || this.context.getPopupContainer || defaultGetContainer;
|
|
538
538
|
this.foundation.init();
|
|
539
|
+
runAfterTicks(() => {
|
|
540
|
+
let triggerEle = this.triggerEl.current;
|
|
541
|
+
if (triggerEle) {
|
|
542
|
+
if (!(triggerEle instanceof HTMLElement)) {
|
|
543
|
+
triggerEle = findDOMNode(triggerEle);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
this.foundation.updateStateIfCursorOnTrigger(triggerEle);
|
|
547
|
+
}, 1);
|
|
539
548
|
}
|
|
540
549
|
componentWillUnmount() {
|
|
541
550
|
this.mounted = false;
|
|
@@ -358,15 +358,17 @@ class TreeSelect extends BaseComponent {
|
|
|
358
358
|
leafOnly,
|
|
359
359
|
searchPosition,
|
|
360
360
|
triggerRender,
|
|
361
|
-
borderless
|
|
361
|
+
borderless,
|
|
362
|
+
checkRelation
|
|
362
363
|
} = _a,
|
|
363
|
-
rest = __rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless"]);
|
|
364
|
+
rest = __rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless", "checkRelation"]);
|
|
364
365
|
const {
|
|
365
366
|
inputValue,
|
|
366
367
|
selectedKeys,
|
|
367
368
|
checkedKeys,
|
|
368
369
|
keyEntities,
|
|
369
|
-
isFocus
|
|
370
|
+
isFocus,
|
|
371
|
+
realCheckedKeys
|
|
370
372
|
} = this.state;
|
|
371
373
|
const filterable = Boolean(filterTreeNode);
|
|
372
374
|
const useCustomTrigger = typeof triggerRender === 'function';
|
|
@@ -394,31 +396,45 @@ class TreeSelect extends BaseComponent {
|
|
|
394
396
|
[`${prefixcls}-with-suffix`]: suffix,
|
|
395
397
|
[`${prefixcls}-with-suffix`]: suffix
|
|
396
398
|
}, className);
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
399
|
+
let inner;
|
|
400
|
+
if (useCustomTrigger) {
|
|
401
|
+
let triggerRenderKeys = [];
|
|
402
|
+
if (multiple) {
|
|
403
|
+
if (checkRelation === 'related') {
|
|
404
|
+
triggerRenderKeys = normalizeKeyList([...checkedKeys], keyEntities, leafOnly, true);
|
|
405
|
+
} else if (checkRelation === 'unRelated') {
|
|
406
|
+
triggerRenderKeys = [...realCheckedKeys];
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
triggerRenderKeys = selectedKeys;
|
|
410
|
+
}
|
|
411
|
+
inner = /*#__PURE__*/React.createElement(Trigger, {
|
|
412
|
+
inputValue: inputValue,
|
|
413
|
+
value: triggerRenderKeys.map(key => _get(keyEntities, [key, 'data'])),
|
|
414
|
+
disabled: disabled,
|
|
415
|
+
placeholder: placeholder,
|
|
416
|
+
onClear: this.handleClear,
|
|
417
|
+
componentName: 'TreeSelect',
|
|
418
|
+
triggerRender: triggerRender,
|
|
419
|
+
componentProps: Object.assign({}, this.props),
|
|
420
|
+
onSearch: this.search,
|
|
421
|
+
onRemove: this.removeTag
|
|
422
|
+
});
|
|
423
|
+
} else {
|
|
424
|
+
inner = [/*#__PURE__*/React.createElement(Fragment, {
|
|
425
|
+
key: 'prefix'
|
|
426
|
+
}, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/React.createElement(Fragment, {
|
|
427
|
+
key: 'selection'
|
|
428
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
429
|
+
className: `${prefixcls}-selection`
|
|
430
|
+
}, this.renderSelectContent())), /*#__PURE__*/React.createElement(Fragment, {
|
|
431
|
+
key: 'suffix'
|
|
432
|
+
}, suffix ? this.renderSuffix() : null), /*#__PURE__*/React.createElement(Fragment, {
|
|
433
|
+
key: 'clearBtn'
|
|
434
|
+
}, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/React.createElement(Fragment, {
|
|
435
|
+
key: 'arrow'
|
|
436
|
+
}, this.renderArrow())];
|
|
437
|
+
}
|
|
422
438
|
const tabIndex = disabled ? null : 0;
|
|
423
439
|
/**
|
|
424
440
|
* Reasons for disabling the a11y eslint rule:
|
|
@@ -882,7 +898,6 @@ class TreeSelect extends BaseComponent {
|
|
|
882
898
|
};
|
|
883
899
|
}
|
|
884
900
|
static getDerivedStateFromProps(props, prevState) {
|
|
885
|
-
var _a;
|
|
886
901
|
const {
|
|
887
902
|
prevProps,
|
|
888
903
|
rePosKey
|
|
@@ -945,16 +960,6 @@ class TreeSelect extends BaseComponent {
|
|
|
945
960
|
newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
946
961
|
} else if (!prevProps && props.value) {
|
|
947
962
|
newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
948
|
-
} else if (!isExpandControlled && needUpdateTreeData && props.value) {
|
|
949
|
-
// 当 treeData 已经设置具体的值,并且设置了 props.loadData ,则认为 treeData 的更新是因为 loadData 导致的
|
|
950
|
-
// 如果是因为 loadData 导致 treeData改变, 此时在这里重新计算 key 会导致为未选中的展开项目被收起
|
|
951
|
-
// 所以此时不需要重新计算 expandedKeys,因为在点击展开按钮时候已经把被展开的项添加到 expandedKeys 中
|
|
952
|
-
// When treeData has a specific value and props.loadData is set, it is considered that the update of treeData is caused by loadData
|
|
953
|
-
// If the treeData is changed because of loadData, recalculating the key here will cause the unselected expanded items to be collapsed
|
|
954
|
-
// So there is no need to recalculate expandedKeys at this time, because the expanded item has been added to expandedKeys when the expand button is clicked
|
|
955
|
-
if (!(prevState.treeData && ((_a = prevState.treeData) === null || _a === void 0 ? void 0 : _a.length) > 0 && props.loadData)) {
|
|
956
|
-
newState.expandedKeys = calcExpandedKeysForValues(props.value, keyEntities, props.multiple, valueEntities);
|
|
957
|
-
}
|
|
958
963
|
}
|
|
959
964
|
if (!newState.expandedKeys) {
|
|
960
965
|
delete newState.expandedKeys;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
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.
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.
|
|
25
|
-
"@douyinfe/semi-foundation": "2.
|
|
26
|
-
"@douyinfe/semi-icons": "2.
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.
|
|
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": "
|
|
78
|
+
"gitHead": "bd0c5bf8924d1e971746ba88f83c2c8857d307f7",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|