@douyinfe/semi-ui 2.52.0-beta.1 → 2.52.1
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/dist/css/semi.css +1 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +145 -994
- 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/cascader/index.d.ts +3 -2
- package/lib/cjs/cascader/index.js +31 -21
- package/lib/cjs/datePicker/datePicker.js +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +20 -16
- package/lib/cjs/form/hoc/withField.d.ts +3 -3
- package/lib/cjs/modal/Modal.js +2 -2
- package/lib/cjs/resizeObserver/index.d.ts +0 -1
- package/lib/cjs/resizeObserver/index.js +2 -3
- package/lib/cjs/select/option.js +2 -1
- package/lib/cjs/table/ResizableTable.js +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/cascader/index.d.ts +3 -2
- package/lib/es/cascader/index.js +31 -21
- package/lib/es/datePicker/datePicker.js +1 -1
- package/lib/es/datePicker/yearAndMonth.js +20 -16
- package/lib/es/form/hoc/withField.d.ts +3 -3
- package/lib/es/modal/Modal.js +2 -2
- package/lib/es/resizeObserver/index.d.ts +0 -1
- package/lib/es/resizeObserver/index.js +0 -1
- package/lib/es/select/option.js +2 -1
- package/lib/es/table/ResizableTable.js +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/package.json +8 -9
- package/dist/umd/semi-ui.min.js.LICENSE.txt +0 -5
|
@@ -191,9 +191,10 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
191
191
|
componentWillUnmount(): void;
|
|
192
192
|
componentDidUpdate(prevProps: CascaderProps): void;
|
|
193
193
|
handleInputChange: (value: string) => void;
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
handleTagRemoveInTrigger: (pos: string) => void;
|
|
195
|
+
handleTagClose: (tagChildren: React.ReactNode, e: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
|
|
196
196
|
renderTagItem: (nodeKey: string, idx: number) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
197
|
+
onRemoveInTagInput: (v: string) => void;
|
|
197
198
|
renderTagInput(): JSX.Element;
|
|
198
199
|
renderInput(): JSX.Element;
|
|
199
200
|
handleItemClick: (e: MouseEvent | KeyboardEvent, item: Entity | Data) => void;
|
|
@@ -43,14 +43,13 @@ class Cascader extends _baseComponent.default {
|
|
|
43
43
|
this.handleInputChange = value => {
|
|
44
44
|
this.foundation.handleInputChange(value);
|
|
45
45
|
};
|
|
46
|
-
this.
|
|
47
|
-
this.foundation.
|
|
46
|
+
this.handleTagRemoveInTrigger = pos => {
|
|
47
|
+
this.foundation.handleTagRemoveInTrigger(pos);
|
|
48
48
|
};
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.handleTagRemove(null, keyEntities[key].valuePath);
|
|
49
|
+
this.handleTagClose = (tagChildren, e, tagKey) => {
|
|
50
|
+
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
this.foundation.handleTagRemoveByKey(tagKey);
|
|
54
53
|
};
|
|
55
54
|
this.renderTagItem = (nodeKey, idx) => {
|
|
56
55
|
const {
|
|
@@ -78,18 +77,18 @@ class Cascader extends _baseComponent.default {
|
|
|
78
77
|
size: size === 'default' ? 'large' : size,
|
|
79
78
|
key: `tag-${nodeKey}-${idx}`,
|
|
80
79
|
color: "white",
|
|
80
|
+
tagKey: nodeKey,
|
|
81
81
|
className: tagCls,
|
|
82
82
|
closable: true,
|
|
83
|
-
onClose:
|
|
84
|
-
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
85
|
-
e.preventDefault();
|
|
86
|
-
this.handleTagRemove(e, keyEntities[nodeKey].valuePath);
|
|
87
|
-
}
|
|
83
|
+
onClose: this.handleTagClose
|
|
88
84
|
}, keyEntities[nodeKey].data[displayProp]);
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
87
|
return null;
|
|
92
88
|
};
|
|
89
|
+
this.onRemoveInTagInput = v => {
|
|
90
|
+
this.foundation.handleTagRemoveByKey(v);
|
|
91
|
+
};
|
|
93
92
|
this.handleItemClick = (e, item) => {
|
|
94
93
|
this.foundation.handleItemClick(e, item);
|
|
95
94
|
};
|
|
@@ -289,6 +288,7 @@ class Cascader extends _baseComponent.default {
|
|
|
289
288
|
}, labelNode);
|
|
290
289
|
};
|
|
291
290
|
this.renderCustomTrigger = () => {
|
|
291
|
+
var _a;
|
|
292
292
|
const {
|
|
293
293
|
disabled,
|
|
294
294
|
triggerRender,
|
|
@@ -299,17 +299,26 @@ class Cascader extends _baseComponent.default {
|
|
|
299
299
|
inputValue,
|
|
300
300
|
inputPlaceHolder,
|
|
301
301
|
resolvedCheckedKeys,
|
|
302
|
-
checkedKeys
|
|
302
|
+
checkedKeys,
|
|
303
|
+
keyEntities
|
|
303
304
|
} = this.state;
|
|
304
305
|
let realValue;
|
|
305
306
|
if (multiple) {
|
|
306
307
|
if (this.mergeType === _constants.strings.NONE_MERGE_TYPE) {
|
|
307
|
-
realValue =
|
|
308
|
+
realValue = new Set();
|
|
309
|
+
checkedKeys.forEach(key => {
|
|
310
|
+
var _a;
|
|
311
|
+
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
312
|
+
});
|
|
308
313
|
} else {
|
|
309
|
-
realValue =
|
|
314
|
+
realValue = new Set();
|
|
315
|
+
resolvedCheckedKeys.forEach(key => {
|
|
316
|
+
var _a;
|
|
317
|
+
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
318
|
+
});
|
|
310
319
|
}
|
|
311
320
|
} else {
|
|
312
|
-
realValue = [...selectedKeys][0];
|
|
321
|
+
realValue = (_a = keyEntities[[...selectedKeys][0]]) === null || _a === void 0 ? void 0 : _a.pos;
|
|
313
322
|
}
|
|
314
323
|
return /*#__PURE__*/_react.default.createElement(_trigger.default, {
|
|
315
324
|
value: realValue,
|
|
@@ -322,7 +331,7 @@ class Cascader extends _baseComponent.default {
|
|
|
322
331
|
componentName: 'Cascader',
|
|
323
332
|
componentProps: Object.assign({}, this.props),
|
|
324
333
|
onSearch: this.handleInputChange,
|
|
325
|
-
onRemove: this.
|
|
334
|
+
onRemove: this.handleTagRemoveInTrigger
|
|
326
335
|
});
|
|
327
336
|
};
|
|
328
337
|
this.handleMouseOver = () => {
|
|
@@ -353,11 +362,12 @@ class Cascader extends _baseComponent.default {
|
|
|
353
362
|
selectedKeys,
|
|
354
363
|
isOpen,
|
|
355
364
|
isHovering,
|
|
356
|
-
checkedKeys
|
|
365
|
+
checkedKeys,
|
|
366
|
+
inputValue
|
|
357
367
|
} = this.state;
|
|
358
368
|
const hasValue = selectedKeys.size;
|
|
359
369
|
const multipleWithHaveValue = multiple && checkedKeys.size;
|
|
360
|
-
return showClear && (hasValue || multipleWithHaveValue) && !disabled && (isOpen || isHovering);
|
|
370
|
+
return showClear && (inputValue || hasValue || multipleWithHaveValue) && !disabled && (isOpen || isHovering);
|
|
361
371
|
};
|
|
362
372
|
this.renderClearBtn = () => {
|
|
363
373
|
const clearCls = (0, _classnames.default)(`${prefixcls}-clearbtn`);
|
|
@@ -806,11 +816,11 @@ class Cascader extends _baseComponent.default {
|
|
|
806
816
|
showRestTagsPopover: showRestTagsPopover,
|
|
807
817
|
restTagsPopoverProps: restTagsPopoverProps,
|
|
808
818
|
maxTagCount: maxTagCount,
|
|
809
|
-
renderTagItem:
|
|
819
|
+
renderTagItem: this.renderTagItem,
|
|
810
820
|
inputValue: inputValue,
|
|
811
821
|
onInputChange: this.handleInputChange,
|
|
812
822
|
// TODO Modify logic, not modify type
|
|
813
|
-
onRemove:
|
|
823
|
+
onRemove: this.onRemoveInTagInput,
|
|
814
824
|
placeholder: placeholder,
|
|
815
825
|
expandRestTagsOnClick: false
|
|
816
826
|
});
|
|
@@ -471,7 +471,7 @@ class DatePicker extends _baseComponent.default {
|
|
|
471
471
|
return /range/i.test(type) && !(0, _isFunction2.default)(triggerRender);
|
|
472
472
|
}
|
|
473
473
|
componentDidUpdate(prevProps) {
|
|
474
|
-
if (prevProps.value
|
|
474
|
+
if (!(0, _isEqual2.default)(prevProps.value, this.props.value)) {
|
|
475
475
|
this.foundation.initFromProps(Object.assign({}, this.props));
|
|
476
476
|
} else if (this.props.timeZone !== prevProps.timeZone) {
|
|
477
477
|
this.foundation.initFromProps({
|
|
@@ -48,16 +48,6 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
48
48
|
currentYear,
|
|
49
49
|
currentMonth
|
|
50
50
|
} = props;
|
|
51
|
-
const currentLeftYear = currentYear.left || now.getFullYear();
|
|
52
|
-
const currentLeftMonth = currentMonth.left || now.getMonth() + 1;
|
|
53
|
-
currentYear = {
|
|
54
|
-
left: currentLeftYear,
|
|
55
|
-
right: currentLeftYear
|
|
56
|
-
};
|
|
57
|
-
currentMonth = {
|
|
58
|
-
left: currentLeftMonth,
|
|
59
|
-
right: currentMonth.right || currentLeftMonth + 1
|
|
60
|
-
};
|
|
61
51
|
this.state = {
|
|
62
52
|
years: (0, _index2.getYears)(props.startYear, props.endYear).map(year => ({
|
|
63
53
|
value: year,
|
|
@@ -67,8 +57,14 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
67
57
|
value: idx + 1,
|
|
68
58
|
month: idx + 1
|
|
69
59
|
})),
|
|
70
|
-
currentYear
|
|
71
|
-
|
|
60
|
+
currentYear: {
|
|
61
|
+
left: currentYear.left || now.getFullYear(),
|
|
62
|
+
right: currentYear.right || now.getFullYear()
|
|
63
|
+
},
|
|
64
|
+
currentMonth: {
|
|
65
|
+
left: currentMonth.left || now.getMonth() + 1,
|
|
66
|
+
right: currentMonth.right || now.getMonth() + 2
|
|
67
|
+
}
|
|
72
68
|
};
|
|
73
69
|
this.yearRef = /*#__PURE__*/_react.default.createRef();
|
|
74
70
|
this.monthRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -105,11 +101,19 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
105
101
|
}
|
|
106
102
|
static getDerivedStateFromProps(props, state) {
|
|
107
103
|
const willUpdateStates = {};
|
|
108
|
-
if (!(0, _isEqual2.default)(props.currentYear, state.currentYear)
|
|
109
|
-
|
|
104
|
+
if (!(0, _isEqual2.default)(props.currentYear, state.currentYear)) {
|
|
105
|
+
const nowYear = new Date().getFullYear();
|
|
106
|
+
willUpdateStates.currentYear = {
|
|
107
|
+
left: props.currentYear.left || nowYear,
|
|
108
|
+
right: props.currentYear.right || nowYear
|
|
109
|
+
};
|
|
110
110
|
}
|
|
111
|
-
if (!(0, _isEqual2.default)(props.currentMonth, state.currentMonth)
|
|
112
|
-
|
|
111
|
+
if (!(0, _isEqual2.default)(props.currentMonth, state.currentMonth)) {
|
|
112
|
+
const nowMonth = new Date().getMonth();
|
|
113
|
+
willUpdateStates.currentMonth = {
|
|
114
|
+
left: props.currentMonth.left || nowMonth + 1,
|
|
115
|
+
right: props.currentMonth.right || nowMonth + 2
|
|
116
|
+
};
|
|
113
117
|
}
|
|
114
118
|
return willUpdateStates;
|
|
115
119
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WithFieldOption } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
|
|
3
|
-
import { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
4
|
-
import { Subtract } from 'utility-types';
|
|
2
|
+
import type { WithFieldOption } from '@douyinfe/semi-foundation/lib/cjs/form/interface';
|
|
3
|
+
import type { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
4
|
+
import type { Subtract } from 'utility-types';
|
|
5
5
|
/**
|
|
6
6
|
* withFiled is used to inject components
|
|
7
7
|
* 1. Takes over the value and onChange of the component and synchronizes them to Form Foundation
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -36,6 +36,7 @@ exports.destroyFns = destroyFns;
|
|
|
36
36
|
class Modal extends _baseComponent.default {
|
|
37
37
|
constructor(props) {
|
|
38
38
|
super(props);
|
|
39
|
+
this.bodyOverflow = null;
|
|
39
40
|
this.handleCancel = e => {
|
|
40
41
|
this.foundation.handleCancel(e);
|
|
41
42
|
};
|
|
@@ -182,7 +183,6 @@ class Modal extends _baseComponent.default {
|
|
|
182
183
|
};
|
|
183
184
|
this.foundation = new _modalFoundation.default(this.adapter);
|
|
184
185
|
this.modalRef = /*#__PURE__*/_react.default.createRef();
|
|
185
|
-
this.bodyOverflow = '';
|
|
186
186
|
this.scrollBarWidth = 0;
|
|
187
187
|
this.originBodyWidth = '100%';
|
|
188
188
|
}
|
|
@@ -203,7 +203,7 @@ class Modal extends _baseComponent.default {
|
|
|
203
203
|
const {
|
|
204
204
|
getPopupContainer
|
|
205
205
|
} = this.props;
|
|
206
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
206
|
+
if (!getPopupContainer && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
|
|
207
207
|
document.body.style.overflow = this.bodyOverflow;
|
|
208
208
|
document.body.style.width = this.originBodyWidth;
|
|
209
209
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
5
4
|
/** A parallel type to `ResizeObserverEntry` (from resize-observer-polyfill). */
|
|
6
5
|
export interface ResizeEntry {
|
|
7
6
|
contentRect: DOMRectReadOnly;
|
|
@@ -8,7 +8,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _reactDom = require("react-dom");
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
11
|
-
var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill"));
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
12
|
class ReactResizeObserver extends _baseComponent.default {
|
|
14
13
|
constructor(props) {
|
|
@@ -32,7 +31,7 @@ class ReactResizeObserver extends _baseComponent.default {
|
|
|
32
31
|
ref.current = node;
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
|
-
this.observer = new
|
|
34
|
+
this.observer = new ResizeObserver(props.onResize);
|
|
36
35
|
}
|
|
37
36
|
componentDidMount() {
|
|
38
37
|
this.observeElement();
|
|
@@ -51,7 +50,7 @@ class ReactResizeObserver extends _baseComponent.default {
|
|
|
51
50
|
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
52
51
|
const element = this.getElement();
|
|
53
52
|
if (!this.observer) {
|
|
54
|
-
this.observer = new
|
|
53
|
+
this.observer = new ResizeObserver(this.props.onResize);
|
|
55
54
|
}
|
|
56
55
|
if (!(element && element instanceof Element)) {
|
|
57
56
|
// stop everything if not defined
|
package/lib/cjs/select/option.js
CHANGED
|
@@ -67,7 +67,7 @@ const ResizableTable = function () {
|
|
|
67
67
|
width: _constants.numbers.DEFAULT_WIDTH_COLUMN_EXPAND
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
if (props.rowSelection && !(0, _find2.default)(rawColumns, item => item.key === _constants.strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
70
|
+
if (props.rowSelection && !(0, _get2.default)(props.rowSelection, 'hidden') && !(0, _find2.default)(rawColumns, item => item.key === _constants.strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
71
71
|
newColumns.unshift({
|
|
72
72
|
width: (0, _get2.default)(props, 'rowSelection.width', _constants.numbers.DEFAULT_WIDTH_COLUMN_SELECTION),
|
|
73
73
|
key: _constants.strings.DEFAULT_KEY_COLUMN_SELECTION
|
|
@@ -12,7 +12,7 @@ export interface Panel {
|
|
|
12
12
|
panelHeader?: React.ReactNode | React.ReactNode[];
|
|
13
13
|
panelFooter?: React.ReactNode | React.ReactNode[];
|
|
14
14
|
}
|
|
15
|
-
export type BaseValueType = string | number | Date;
|
|
15
|
+
export type BaseValueType = string | number | Date | undefined;
|
|
16
16
|
export type Type = 'time' | 'timeRange';
|
|
17
17
|
export type TimePickerProps = {
|
|
18
18
|
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
@@ -191,9 +191,10 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
191
191
|
componentWillUnmount(): void;
|
|
192
192
|
componentDidUpdate(prevProps: CascaderProps): void;
|
|
193
193
|
handleInputChange: (value: string) => void;
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
handleTagRemoveInTrigger: (pos: string) => void;
|
|
195
|
+
handleTagClose: (tagChildren: React.ReactNode, e: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
|
|
196
196
|
renderTagItem: (nodeKey: string, idx: number) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
197
|
+
onRemoveInTagInput: (v: string) => void;
|
|
197
198
|
renderTagInput(): JSX.Element;
|
|
198
199
|
renderInput(): JSX.Element;
|
|
199
200
|
handleItemClick: (e: MouseEvent | KeyboardEvent, item: Entity | Data) => void;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -34,14 +34,13 @@ class Cascader extends BaseComponent {
|
|
|
34
34
|
this.handleInputChange = value => {
|
|
35
35
|
this.foundation.handleInputChange(value);
|
|
36
36
|
};
|
|
37
|
-
this.
|
|
38
|
-
this.foundation.
|
|
37
|
+
this.handleTagRemoveInTrigger = pos => {
|
|
38
|
+
this.foundation.handleTagRemoveInTrigger(pos);
|
|
39
39
|
};
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.handleTagRemove(null, keyEntities[key].valuePath);
|
|
40
|
+
this.handleTagClose = (tagChildren, e, tagKey) => {
|
|
41
|
+
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
this.foundation.handleTagRemoveByKey(tagKey);
|
|
45
44
|
};
|
|
46
45
|
this.renderTagItem = (nodeKey, idx) => {
|
|
47
46
|
const {
|
|
@@ -69,18 +68,18 @@ class Cascader extends BaseComponent {
|
|
|
69
68
|
size: size === 'default' ? 'large' : size,
|
|
70
69
|
key: `tag-${nodeKey}-${idx}`,
|
|
71
70
|
color: "white",
|
|
71
|
+
tagKey: nodeKey,
|
|
72
72
|
className: tagCls,
|
|
73
73
|
closable: true,
|
|
74
|
-
onClose:
|
|
75
|
-
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
76
|
-
e.preventDefault();
|
|
77
|
-
this.handleTagRemove(e, keyEntities[nodeKey].valuePath);
|
|
78
|
-
}
|
|
74
|
+
onClose: this.handleTagClose
|
|
79
75
|
}, keyEntities[nodeKey].data[displayProp]);
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
return null;
|
|
83
79
|
};
|
|
80
|
+
this.onRemoveInTagInput = v => {
|
|
81
|
+
this.foundation.handleTagRemoveByKey(v);
|
|
82
|
+
};
|
|
84
83
|
this.handleItemClick = (e, item) => {
|
|
85
84
|
this.foundation.handleItemClick(e, item);
|
|
86
85
|
};
|
|
@@ -280,6 +279,7 @@ class Cascader extends BaseComponent {
|
|
|
280
279
|
}, labelNode);
|
|
281
280
|
};
|
|
282
281
|
this.renderCustomTrigger = () => {
|
|
282
|
+
var _a;
|
|
283
283
|
const {
|
|
284
284
|
disabled,
|
|
285
285
|
triggerRender,
|
|
@@ -290,17 +290,26 @@ class Cascader extends BaseComponent {
|
|
|
290
290
|
inputValue,
|
|
291
291
|
inputPlaceHolder,
|
|
292
292
|
resolvedCheckedKeys,
|
|
293
|
-
checkedKeys
|
|
293
|
+
checkedKeys,
|
|
294
|
+
keyEntities
|
|
294
295
|
} = this.state;
|
|
295
296
|
let realValue;
|
|
296
297
|
if (multiple) {
|
|
297
298
|
if (this.mergeType === strings.NONE_MERGE_TYPE) {
|
|
298
|
-
realValue =
|
|
299
|
+
realValue = new Set();
|
|
300
|
+
checkedKeys.forEach(key => {
|
|
301
|
+
var _a;
|
|
302
|
+
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
303
|
+
});
|
|
299
304
|
} else {
|
|
300
|
-
realValue =
|
|
305
|
+
realValue = new Set();
|
|
306
|
+
resolvedCheckedKeys.forEach(key => {
|
|
307
|
+
var _a;
|
|
308
|
+
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
309
|
+
});
|
|
301
310
|
}
|
|
302
311
|
} else {
|
|
303
|
-
realValue = [...selectedKeys][0];
|
|
312
|
+
realValue = (_a = keyEntities[[...selectedKeys][0]]) === null || _a === void 0 ? void 0 : _a.pos;
|
|
304
313
|
}
|
|
305
314
|
return /*#__PURE__*/React.createElement(Trigger, {
|
|
306
315
|
value: realValue,
|
|
@@ -313,7 +322,7 @@ class Cascader extends BaseComponent {
|
|
|
313
322
|
componentName: 'Cascader',
|
|
314
323
|
componentProps: Object.assign({}, this.props),
|
|
315
324
|
onSearch: this.handleInputChange,
|
|
316
|
-
onRemove: this.
|
|
325
|
+
onRemove: this.handleTagRemoveInTrigger
|
|
317
326
|
});
|
|
318
327
|
};
|
|
319
328
|
this.handleMouseOver = () => {
|
|
@@ -344,11 +353,12 @@ class Cascader extends BaseComponent {
|
|
|
344
353
|
selectedKeys,
|
|
345
354
|
isOpen,
|
|
346
355
|
isHovering,
|
|
347
|
-
checkedKeys
|
|
356
|
+
checkedKeys,
|
|
357
|
+
inputValue
|
|
348
358
|
} = this.state;
|
|
349
359
|
const hasValue = selectedKeys.size;
|
|
350
360
|
const multipleWithHaveValue = multiple && checkedKeys.size;
|
|
351
|
-
return showClear && (hasValue || multipleWithHaveValue) && !disabled && (isOpen || isHovering);
|
|
361
|
+
return showClear && (inputValue || hasValue || multipleWithHaveValue) && !disabled && (isOpen || isHovering);
|
|
352
362
|
};
|
|
353
363
|
this.renderClearBtn = () => {
|
|
354
364
|
const clearCls = cls(`${prefixcls}-clearbtn`);
|
|
@@ -797,11 +807,11 @@ class Cascader extends BaseComponent {
|
|
|
797
807
|
showRestTagsPopover: showRestTagsPopover,
|
|
798
808
|
restTagsPopoverProps: restTagsPopoverProps,
|
|
799
809
|
maxTagCount: maxTagCount,
|
|
800
|
-
renderTagItem:
|
|
810
|
+
renderTagItem: this.renderTagItem,
|
|
801
811
|
inputValue: inputValue,
|
|
802
812
|
onInputChange: this.handleInputChange,
|
|
803
813
|
// TODO Modify logic, not modify type
|
|
804
|
-
onRemove:
|
|
814
|
+
onRemove: this.onRemoveInTagInput,
|
|
805
815
|
placeholder: placeholder,
|
|
806
816
|
expandRestTagsOnClick: false
|
|
807
817
|
});
|
|
@@ -463,7 +463,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
463
463
|
return /range/i.test(type) && !_isFunction(triggerRender);
|
|
464
464
|
}
|
|
465
465
|
componentDidUpdate(prevProps) {
|
|
466
|
-
if (prevProps.value
|
|
466
|
+
if (!_isEqual(prevProps.value, this.props.value)) {
|
|
467
467
|
this.foundation.initFromProps(Object.assign({}, this.props));
|
|
468
468
|
} else if (this.props.timeZone !== prevProps.timeZone) {
|
|
469
469
|
this.foundation.initFromProps({
|
|
@@ -41,16 +41,6 @@ class YearAndMonth extends BaseComponent {
|
|
|
41
41
|
currentYear,
|
|
42
42
|
currentMonth
|
|
43
43
|
} = props;
|
|
44
|
-
const currentLeftYear = currentYear.left || now.getFullYear();
|
|
45
|
-
const currentLeftMonth = currentMonth.left || now.getMonth() + 1;
|
|
46
|
-
currentYear = {
|
|
47
|
-
left: currentLeftYear,
|
|
48
|
-
right: currentLeftYear
|
|
49
|
-
};
|
|
50
|
-
currentMonth = {
|
|
51
|
-
left: currentLeftMonth,
|
|
52
|
-
right: currentMonth.right || currentLeftMonth + 1
|
|
53
|
-
};
|
|
54
44
|
this.state = {
|
|
55
45
|
years: getYears(props.startYear, props.endYear).map(year => ({
|
|
56
46
|
value: year,
|
|
@@ -60,8 +50,14 @@ class YearAndMonth extends BaseComponent {
|
|
|
60
50
|
value: idx + 1,
|
|
61
51
|
month: idx + 1
|
|
62
52
|
})),
|
|
63
|
-
currentYear
|
|
64
|
-
|
|
53
|
+
currentYear: {
|
|
54
|
+
left: currentYear.left || now.getFullYear(),
|
|
55
|
+
right: currentYear.right || now.getFullYear()
|
|
56
|
+
},
|
|
57
|
+
currentMonth: {
|
|
58
|
+
left: currentMonth.left || now.getMonth() + 1,
|
|
59
|
+
right: currentMonth.right || now.getMonth() + 2
|
|
60
|
+
}
|
|
65
61
|
};
|
|
66
62
|
this.yearRef = /*#__PURE__*/React.createRef();
|
|
67
63
|
this.monthRef = /*#__PURE__*/React.createRef();
|
|
@@ -98,11 +94,19 @@ class YearAndMonth extends BaseComponent {
|
|
|
98
94
|
}
|
|
99
95
|
static getDerivedStateFromProps(props, state) {
|
|
100
96
|
const willUpdateStates = {};
|
|
101
|
-
if (!_isEqual(props.currentYear, state.currentYear)
|
|
102
|
-
|
|
97
|
+
if (!_isEqual(props.currentYear, state.currentYear)) {
|
|
98
|
+
const nowYear = new Date().getFullYear();
|
|
99
|
+
willUpdateStates.currentYear = {
|
|
100
|
+
left: props.currentYear.left || nowYear,
|
|
101
|
+
right: props.currentYear.right || nowYear
|
|
102
|
+
};
|
|
103
103
|
}
|
|
104
|
-
if (!_isEqual(props.currentMonth, state.currentMonth)
|
|
105
|
-
|
|
104
|
+
if (!_isEqual(props.currentMonth, state.currentMonth)) {
|
|
105
|
+
const nowMonth = new Date().getMonth();
|
|
106
|
+
willUpdateStates.currentMonth = {
|
|
107
|
+
left: props.currentMonth.left || nowMonth + 1,
|
|
108
|
+
right: props.currentMonth.right || nowMonth + 2
|
|
109
|
+
};
|
|
106
110
|
}
|
|
107
111
|
return willUpdateStates;
|
|
108
112
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WithFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
|
|
3
|
-
import { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
4
|
-
import { Subtract } from 'utility-types';
|
|
2
|
+
import type { WithFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
|
|
3
|
+
import type { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
4
|
+
import type { Subtract } from 'utility-types';
|
|
5
5
|
/**
|
|
6
6
|
* withFiled is used to inject components
|
|
7
7
|
* 1. Takes over the value and onChange of the component and synchronizes them to Form Foundation
|
package/lib/es/modal/Modal.js
CHANGED
|
@@ -26,6 +26,7 @@ export const destroyFns = [];
|
|
|
26
26
|
class Modal extends BaseComponent {
|
|
27
27
|
constructor(props) {
|
|
28
28
|
super(props);
|
|
29
|
+
this.bodyOverflow = null;
|
|
29
30
|
this.handleCancel = e => {
|
|
30
31
|
this.foundation.handleCancel(e);
|
|
31
32
|
};
|
|
@@ -172,7 +173,6 @@ class Modal extends BaseComponent {
|
|
|
172
173
|
};
|
|
173
174
|
this.foundation = new ModalFoundation(this.adapter);
|
|
174
175
|
this.modalRef = /*#__PURE__*/React.createRef();
|
|
175
|
-
this.bodyOverflow = '';
|
|
176
176
|
this.scrollBarWidth = 0;
|
|
177
177
|
this.originBodyWidth = '100%';
|
|
178
178
|
}
|
|
@@ -193,7 +193,7 @@ class Modal extends BaseComponent {
|
|
|
193
193
|
const {
|
|
194
194
|
getPopupContainer
|
|
195
195
|
} = this.props;
|
|
196
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
196
|
+
if (!getPopupContainer && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
|
|
197
197
|
document.body.style.overflow = this.bodyOverflow;
|
|
198
198
|
document.body.style.width = this.originBodyWidth;
|
|
199
199
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
5
4
|
/** A parallel type to `ResizeObserverEntry` (from resize-observer-polyfill). */
|
|
6
5
|
export interface ResizeEntry {
|
|
7
6
|
contentRect: DOMRectReadOnly;
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { findDOMNode } from 'react-dom';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
5
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
6
5
|
export default class ReactResizeObserver extends BaseComponent {
|
|
7
6
|
constructor(props) {
|
|
8
7
|
super(props);
|
package/lib/es/select/option.js
CHANGED
|
@@ -57,7 +57,7 @@ const ResizableTable = function () {
|
|
|
57
57
|
width: numbers.DEFAULT_WIDTH_COLUMN_EXPAND
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
if (props.rowSelection && !_find(rawColumns, item => item.key === strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
60
|
+
if (props.rowSelection && !_get(props.rowSelection, 'hidden') && !_find(rawColumns, item => item.key === strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
61
61
|
newColumns.unshift({
|
|
62
62
|
width: _get(props, 'rowSelection.width', numbers.DEFAULT_WIDTH_COLUMN_SELECTION),
|
|
63
63
|
key: strings.DEFAULT_KEY_COLUMN_SELECTION
|
|
@@ -12,7 +12,7 @@ export interface Panel {
|
|
|
12
12
|
panelHeader?: React.ReactNode | React.ReactNode[];
|
|
13
13
|
panelFooter?: React.ReactNode | React.ReactNode[];
|
|
14
14
|
}
|
|
15
|
-
export type BaseValueType = string | number | Date;
|
|
15
|
+
export type BaseValueType = string | number | Date | undefined;
|
|
16
16
|
export type Type = 'time' | 'timeRange';
|
|
17
17
|
export type TimePickerProps = {
|
|
18
18
|
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.52.
|
|
3
|
+
"version": "2.52.1",
|
|
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.52.
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.52.
|
|
25
|
-
"@douyinfe/semi-foundation": "2.52.
|
|
26
|
-
"@douyinfe/semi-icons": "2.52.
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.52.
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.52.
|
|
23
|
+
"@douyinfe/semi-animation": "2.52.1",
|
|
24
|
+
"@douyinfe/semi-animation-react": "2.52.1",
|
|
25
|
+
"@douyinfe/semi-foundation": "2.52.1",
|
|
26
|
+
"@douyinfe/semi-icons": "2.52.1",
|
|
27
|
+
"@douyinfe/semi-illustrations": "2.52.1",
|
|
28
|
+
"@douyinfe/semi-theme-default": "2.52.1",
|
|
29
29
|
"async-validator": "^3.5.0",
|
|
30
30
|
"classnames": "^2.2.6",
|
|
31
31
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"prop-types": "^15.7.2",
|
|
36
36
|
"react-resizable": "^3.0.5",
|
|
37
37
|
"react-window": "^1.8.2",
|
|
38
|
-
"resize-observer-polyfill": "^1.5.1",
|
|
39
38
|
"scroll-into-view-if-needed": "^2.2.24",
|
|
40
39
|
"utility-types": "^3.10.0"
|
|
41
40
|
},
|
|
@@ -75,7 +74,7 @@
|
|
|
75
74
|
],
|
|
76
75
|
"author": "",
|
|
77
76
|
"license": "MIT",
|
|
78
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "aca346e8bf01599b2f0aa4aa3c1976638f87cdfb",
|
|
79
78
|
"devDependencies": {
|
|
80
79
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
80
|
"@babel/plugin-transform-runtime": "^7.15.8",
|