@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.
- package/dist/css/semi.css +45 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +78 -88
- 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/collapsible/index.d.ts +2 -0
- package/lib/cjs/collapsible/index.js +19 -11
- package/lib/cjs/dropdown/dropdownItem.js +11 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/input/textarea.js +1 -1
- package/lib/cjs/modal/Modal.js +9 -6
- package/lib/cjs/modal/ModalContent.js +5 -4
- package/lib/cjs/modal/confirm.d.ts +3 -3
- package/lib/cjs/scrollList/scrollItem.js +1 -1
- package/lib/cjs/select/option.js +2 -1
- package/lib/cjs/spin/icon.js +14 -51
- package/lib/cjs/table/Body/index.js +1 -1
- package/lib/cjs/table/TableCell.js +7 -1
- package/lib/cjs/table/interface.d.ts +9 -0
- package/lib/cjs/treeSelect/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.js +2 -2
- package/lib/es/collapsible/index.d.ts +2 -0
- package/lib/es/collapsible/index.js +19 -11
- package/lib/es/dropdown/dropdownItem.js +11 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/input/textarea.js +1 -1
- package/lib/es/modal/Modal.js +9 -6
- package/lib/es/modal/ModalContent.js +5 -4
- package/lib/es/modal/confirm.d.ts +3 -3
- package/lib/es/scrollList/scrollItem.js +1 -1
- package/lib/es/select/option.js +2 -1
- package/lib/es/spin/icon.js +14 -51
- package/lib/es/table/Body/index.js +1 -1
- package/lib/es/table/TableCell.js +7 -1
- package/lib/es/table/interface.d.ts +9 -0
- package/lib/es/treeSelect/index.d.ts +1 -1
- package/lib/es/treeSelect/index.js +2 -2
- package/package.json +8 -8
|
@@ -21,6 +21,7 @@ interface CollapsibleState extends CollapsibleFoundationState {
|
|
|
21
21
|
domHeight: number;
|
|
22
22
|
visible: boolean;
|
|
23
23
|
isTransitioning: boolean;
|
|
24
|
+
cacheIsOpen: boolean;
|
|
24
25
|
}
|
|
25
26
|
declare class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleState> {
|
|
26
27
|
static defaultProps: {
|
|
@@ -36,6 +37,7 @@ declare class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleSta
|
|
|
36
37
|
private resizeObserver;
|
|
37
38
|
constructor(props: CollapsibleProps);
|
|
38
39
|
get adapter(): CollapsibleAdapter<CollapsibleProps, CollapsibleState>;
|
|
40
|
+
static getDerivedStateFromProps(props: CollapsibleProps, prevState: CollapsibleState): Partial<CollapsibleState>;
|
|
39
41
|
static getEntryInfo: (entry: ResizeObserverEntry) => {
|
|
40
42
|
isShown: boolean;
|
|
41
43
|
height: number;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
7
8
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/collapsible/foundation"));
|
|
@@ -36,7 +37,8 @@ class Collapsible extends _baseComponent.default {
|
|
|
36
37
|
domInRenderTree: false,
|
|
37
38
|
domHeight: 0,
|
|
38
39
|
visible: this.props.isOpen,
|
|
39
|
-
isTransitioning: false
|
|
40
|
+
isTransitioning: false,
|
|
41
|
+
cacheIsOpen: this.props.isOpen
|
|
40
42
|
};
|
|
41
43
|
this.foundation = new _foundation.default(this.adapter);
|
|
42
44
|
}
|
|
@@ -72,6 +74,20 @@ class Collapsible extends _baseComponent.default {
|
|
|
72
74
|
}
|
|
73
75
|
});
|
|
74
76
|
}
|
|
77
|
+
static getDerivedStateFromProps(props, prevState) {
|
|
78
|
+
const newState = {};
|
|
79
|
+
const isOpenChanged = props.isOpen !== prevState.cacheIsOpen;
|
|
80
|
+
if (isOpenChanged) {
|
|
81
|
+
if (props.isOpen || !props.motion) {
|
|
82
|
+
newState.visible = props.isOpen;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (props.motion && isOpenChanged) {
|
|
86
|
+
newState.isTransitioning = true;
|
|
87
|
+
}
|
|
88
|
+
newState.cacheIsOpen = props.isOpen;
|
|
89
|
+
return newState;
|
|
90
|
+
}
|
|
75
91
|
componentDidMount() {
|
|
76
92
|
super.componentDidMount();
|
|
77
93
|
this.resizeObserver = new ResizeObserver(this.handleResize);
|
|
@@ -83,22 +99,14 @@ class Collapsible extends _baseComponent.default {
|
|
|
83
99
|
}
|
|
84
100
|
}
|
|
85
101
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
86
|
-
const changedPropKeys = Object.keys(this.props).filter(key => !(0, _isEqual2.default)(this.props[key], prevProps[key]));
|
|
87
|
-
const changedStateKeys = Object.keys(this.state).filter(key => !(0, _isEqual2.default)(this.state[key], prevState[key]));
|
|
102
|
+
const changedPropKeys = Object.keys((0, _pick2.default)(this.props, ['reCalcKey'])).filter(key => !(0, _isEqual2.default)(this.props[key], prevProps[key]));
|
|
103
|
+
const changedStateKeys = Object.keys((0, _pick2.default)(this.state, ['domInRenderTree'])).filter(key => !(0, _isEqual2.default)(this.state[key], prevState[key]));
|
|
88
104
|
if (changedPropKeys.includes("reCalcKey")) {
|
|
89
105
|
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
90
106
|
}
|
|
91
107
|
if (changedStateKeys.includes("domInRenderTree") && this.state.domInRenderTree) {
|
|
92
108
|
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
93
109
|
}
|
|
94
|
-
if (changedPropKeys.includes("isOpen")) {
|
|
95
|
-
if (this.props.isOpen || !this.props.motion) {
|
|
96
|
-
this.foundation.updateVisible(this.props.isOpen);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (this.props.motion && prevProps.isOpen !== this.props.isOpen) {
|
|
100
|
-
this.foundation.updateIsTransitioning(true);
|
|
101
|
-
}
|
|
102
110
|
}
|
|
103
111
|
componentWillUnmount() {
|
|
104
112
|
super.componentWillUnmount();
|
|
@@ -44,7 +44,17 @@ class DropdownItem extends _baseComponent.default {
|
|
|
44
44
|
const events = {};
|
|
45
45
|
if (!disabled) {
|
|
46
46
|
['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
|
|
47
|
-
|
|
47
|
+
const isInAnotherDropdown = this.context.level !== 1;
|
|
48
|
+
if (isInAnotherDropdown && eventName === "onClick") {
|
|
49
|
+
events["onMouseDown"] = e => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
if (e.button === 0) {
|
|
52
|
+
(_b = (_a = this.props)[eventName]) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
events[eventName] = this.props[eventName];
|
|
57
|
+
}
|
|
48
58
|
});
|
|
49
59
|
}
|
|
50
60
|
let tick = null;
|
|
@@ -138,7 +138,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
138
138
|
preventScroll?: boolean;
|
|
139
139
|
showRestTagsPopover?: boolean;
|
|
140
140
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
141
|
-
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "
|
|
141
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
142
142
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
143
143
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
144
144
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
86
86
|
preventScroll?: boolean;
|
|
87
87
|
showRestTagsPopover?: boolean;
|
|
88
88
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
89
|
-
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "
|
|
89
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
90
90
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
91
91
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
92
92
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
@@ -130,7 +130,7 @@ class TextArea extends _baseComponent.default {
|
|
|
130
130
|
this._resizeListener && window.removeEventListener('resize', this._resizeListener);
|
|
131
131
|
}
|
|
132
132
|
componentDidUpdate(prevProps, prevState) {
|
|
133
|
-
if (this.props.value !== prevProps.value && this.props.autosize) {
|
|
133
|
+
if ((this.props.value !== prevProps.value || this.props.placeholder !== prevProps.placeholder) && this.props.autosize) {
|
|
134
134
|
this.foundation.resizeTextarea();
|
|
135
135
|
}
|
|
136
136
|
}
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -94,7 +94,8 @@ class Modal extends _baseComponent.default {
|
|
|
94
94
|
// return <ModalContent {...restProps} footer={renderFooter} onClose={this.handleCancel}/>;
|
|
95
95
|
// };
|
|
96
96
|
this.renderDialog = () => {
|
|
97
|
-
|
|
97
|
+
var _a;
|
|
98
|
+
let _b = this.props,
|
|
98
99
|
{
|
|
99
100
|
footer,
|
|
100
101
|
className,
|
|
@@ -105,15 +106,15 @@ class Modal extends _baseComponent.default {
|
|
|
105
106
|
zIndex,
|
|
106
107
|
getPopupContainer,
|
|
107
108
|
visible
|
|
108
|
-
} =
|
|
109
|
-
restProps = __rest(
|
|
109
|
+
} = _b,
|
|
110
|
+
restProps = __rest(_b, ["footer", "className", "motion", "maskStyle", "keepDOM", "style", "zIndex", "getPopupContainer", "visible"]);
|
|
110
111
|
let style = styleFromProps;
|
|
111
112
|
const maskStyle = maskStyleFromProps;
|
|
112
113
|
const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
|
|
113
114
|
let wrapperStyle = {
|
|
114
115
|
zIndex
|
|
115
116
|
};
|
|
116
|
-
if (getPopupContainer) {
|
|
117
|
+
if (getPopupContainer && getPopupContainer() !== ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
117
118
|
wrapperStyle = {
|
|
118
119
|
zIndex,
|
|
119
120
|
position: 'static'
|
|
@@ -184,20 +185,22 @@ class Modal extends _baseComponent.default {
|
|
|
184
185
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
185
186
|
getProps: () => this.props,
|
|
186
187
|
disabledBodyScroll: () => {
|
|
188
|
+
var _a;
|
|
187
189
|
const {
|
|
188
190
|
getPopupContainer
|
|
189
191
|
} = this.props;
|
|
190
192
|
this.bodyOverflow = document.body.style.overflow || '';
|
|
191
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
193
|
+
if ((!getPopupContainer || getPopupContainer() === ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) && this.bodyOverflow !== 'hidden') {
|
|
192
194
|
document.body.style.overflow = 'hidden';
|
|
193
195
|
document.body.style.width = `calc(${this.originBodyWidth || '100%'} - ${this.scrollBarWidth}px)`;
|
|
194
196
|
}
|
|
195
197
|
},
|
|
196
198
|
enabledBodyScroll: () => {
|
|
199
|
+
var _a;
|
|
197
200
|
const {
|
|
198
201
|
getPopupContainer
|
|
199
202
|
} = this.props;
|
|
200
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
203
|
+
if ((!getPopupContainer || getPopupContainer() === ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
|
|
201
204
|
document.body.style.overflow = this.bodyOverflow;
|
|
202
205
|
document.body.style.width = this.originBodyWidth;
|
|
203
206
|
}
|
|
@@ -287,20 +287,21 @@ class ModalContent extends _baseComponent.default {
|
|
|
287
287
|
this.foundation.destroy();
|
|
288
288
|
}
|
|
289
289
|
render() {
|
|
290
|
-
|
|
290
|
+
var _a;
|
|
291
|
+
const _b = this.props,
|
|
291
292
|
{
|
|
292
293
|
maskClosable,
|
|
293
294
|
className,
|
|
294
295
|
getPopupContainer,
|
|
295
296
|
maskFixed,
|
|
296
297
|
getContainerContext
|
|
297
|
-
} =
|
|
298
|
-
rest = __rest(
|
|
298
|
+
} = _b,
|
|
299
|
+
rest = __rest(_b, ["maskClosable", "className", "getPopupContainer", "maskFixed", "getContainerContext"]);
|
|
299
300
|
const {
|
|
300
301
|
direction
|
|
301
302
|
} = this.context;
|
|
302
303
|
const classList = (0, _classnames.default)(className, {
|
|
303
|
-
[`${_constants.cssClasses.DIALOG}-popup`]: getPopupContainer && !maskFixed,
|
|
304
|
+
[`${_constants.cssClasses.DIALOG}-popup`]: getPopupContainer && getPopupContainer() !== ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body) && !maskFixed,
|
|
304
305
|
[`${_constants.cssClasses.DIALOG}-fixed`]: maskFixed,
|
|
305
306
|
[`${_constants.cssClasses.DIALOG}-rtl`]: direction === 'rtl'
|
|
306
307
|
});
|
|
@@ -145,11 +145,11 @@ export declare function withError(props: ModalReactProps): {
|
|
|
145
145
|
size?: import("@douyinfe/semi-foundation/lib/cjs/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;
|
|
@@ -250,8 +250,8 @@ class ScrollItem extends _baseComponent.default {
|
|
|
250
250
|
key: prefixKey + index
|
|
251
251
|
}, events, {
|
|
252
252
|
className: cls,
|
|
253
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
253
254
|
role: "option",
|
|
254
|
-
"aria-selected": selected,
|
|
255
255
|
"aria-disabled": item.disabled
|
|
256
256
|
}), text)
|
|
257
257
|
);
|
package/lib/cjs/select/option.js
CHANGED
package/lib/cjs/spin/icon.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _isNullOrUndefined = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/isNullOrUndefined"));
|
|
9
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
9
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
11
10
|
var t = {};
|
|
@@ -17,64 +16,28 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
17
16
|
};
|
|
18
17
|
/* eslint-disable no-unused-vars */
|
|
19
18
|
|
|
20
|
-
let _id = -1;
|
|
21
19
|
function Icon() {
|
|
22
20
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
21
|
const {
|
|
24
|
-
id
|
|
22
|
+
id,
|
|
25
23
|
className
|
|
26
24
|
} = props,
|
|
27
25
|
rest = __rest(props, ["id", "className"]);
|
|
28
|
-
let _propsId = propsId;
|
|
29
|
-
if ((0, _isNullOrUndefined.default)(_propsId)) {
|
|
30
|
-
_id++;
|
|
31
|
-
_propsId = _id;
|
|
32
|
-
}
|
|
33
|
-
const id = `linearGradient-${_propsId}`;
|
|
34
26
|
return /*#__PURE__*/_react.default.createElement("svg", Object.assign({}, rest, {
|
|
35
27
|
className: className,
|
|
36
|
-
width: "
|
|
37
|
-
height: "
|
|
38
|
-
viewBox: "0 0
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, /*#__PURE__*/_react.default.createElement("stop", {
|
|
50
|
-
stopColor: "currentColor",
|
|
51
|
-
stopOpacity: "0",
|
|
52
|
-
offset: "0%"
|
|
53
|
-
}), /*#__PURE__*/_react.default.createElement("stop", {
|
|
54
|
-
stopColor: "currentColor",
|
|
55
|
-
stopOpacity: "0.50",
|
|
56
|
-
offset: "39.9430698%"
|
|
57
|
-
}), /*#__PURE__*/_react.default.createElement("stop", {
|
|
58
|
-
stopColor: "currentColor",
|
|
59
|
-
offset: "100%"
|
|
60
|
-
}))), /*#__PURE__*/_react.default.createElement("g", {
|
|
61
|
-
stroke: "none",
|
|
62
|
-
strokeWidth: "1",
|
|
63
|
-
fill: "none",
|
|
64
|
-
fillRule: "evenodd"
|
|
65
|
-
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
66
|
-
fillOpacity: "0.01",
|
|
67
|
-
fill: "none",
|
|
68
|
-
x: "0",
|
|
69
|
-
y: "0",
|
|
70
|
-
width: "36",
|
|
71
|
-
height: "36"
|
|
72
|
-
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
73
|
-
d: "M34,18 C34,9.163444 26.836556,2 18,2 C11.6597233,2 6.18078805,5.68784135 3.59122325,11.0354951",
|
|
74
|
-
stroke: `url(#${id})`,
|
|
75
|
-
strokeWidth: "4",
|
|
76
|
-
strokeLinecap: "round"
|
|
77
|
-
})));
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: "100%",
|
|
30
|
+
viewBox: "0 0 100 100"
|
|
31
|
+
}), /*#__PURE__*/_react.default.createElement("circle", {
|
|
32
|
+
cx: "50",
|
|
33
|
+
cy: "50",
|
|
34
|
+
r: "35",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: "11",
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeMiterlimit: "10",
|
|
39
|
+
fill: "none"
|
|
40
|
+
}));
|
|
78
41
|
}
|
|
79
42
|
var _default = Icon;
|
|
80
43
|
exports.default = _default;
|
|
@@ -503,7 +503,7 @@ class Body extends _baseComponent.default {
|
|
|
503
503
|
if (props.virtualized) {
|
|
504
504
|
getVirtualizedListRef(this.listRef);
|
|
505
505
|
} else {
|
|
506
|
-
console.warn('getVirtualizedListRef only works with virtualized. ' + 'See https://semi.design/
|
|
506
|
+
console.warn('getVirtualizedListRef only works with virtualized. ' + 'See https://semi.design/en-US/show/table for more information.');
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
this.foundation = new _bodyFoundation.default(this.adapter);
|
|
@@ -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;
|
|
@@ -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) =>
|
|
231
|
+
renderTagItem: (key: string, idx: number) => any;
|
|
232
232
|
renderTagInput: () => JSX.Element;
|
|
233
233
|
renderInput: () => JSX.Element;
|
|
234
234
|
renderEmpty: () => JSX.Element;
|
|
@@ -201,7 +201,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
201
201
|
} = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
|
|
202
202
|
index,
|
|
203
203
|
onClose
|
|
204
|
-
}) :
|
|
204
|
+
}) : {};
|
|
205
205
|
if ((0, _isNull2.default)(content) || (0, _isUndefined2.default)(content)) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
@@ -499,7 +499,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
499
499
|
} = item && treeNodeLabelProp in item ? renderSelectedItem(item, {
|
|
500
500
|
index: idx,
|
|
501
501
|
onClose
|
|
502
|
-
}) :
|
|
502
|
+
}) : {};
|
|
503
503
|
if (isRenderInTag) {
|
|
504
504
|
return /*#__PURE__*/_react.default.createElement(_index.default, Object.assign({}, tagProps), content);
|
|
505
505
|
} else {
|
|
@@ -21,6 +21,7 @@ interface CollapsibleState extends CollapsibleFoundationState {
|
|
|
21
21
|
domHeight: number;
|
|
22
22
|
visible: boolean;
|
|
23
23
|
isTransitioning: boolean;
|
|
24
|
+
cacheIsOpen: boolean;
|
|
24
25
|
}
|
|
25
26
|
declare class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleState> {
|
|
26
27
|
static defaultProps: {
|
|
@@ -36,6 +37,7 @@ declare class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleSta
|
|
|
36
37
|
private resizeObserver;
|
|
37
38
|
constructor(props: CollapsibleProps);
|
|
38
39
|
get adapter(): CollapsibleAdapter<CollapsibleProps, CollapsibleState>;
|
|
40
|
+
static getDerivedStateFromProps(props: CollapsibleProps, prevState: CollapsibleState): Partial<CollapsibleState>;
|
|
39
41
|
static getEntryInfo: (entry: ResizeObserverEntry) => {
|
|
40
42
|
isShown: boolean;
|
|
41
43
|
height: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _pick from "lodash/pick";
|
|
1
2
|
import _isEqual from "lodash/isEqual";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import CollapsibleFoundation from '@douyinfe/semi-foundation/lib/es/collapsible/foundation';
|
|
@@ -29,7 +30,8 @@ class Collapsible extends BaseComponent {
|
|
|
29
30
|
domInRenderTree: false,
|
|
30
31
|
domHeight: 0,
|
|
31
32
|
visible: this.props.isOpen,
|
|
32
|
-
isTransitioning: false
|
|
33
|
+
isTransitioning: false,
|
|
34
|
+
cacheIsOpen: this.props.isOpen
|
|
33
35
|
};
|
|
34
36
|
this.foundation = new CollapsibleFoundation(this.adapter);
|
|
35
37
|
}
|
|
@@ -65,6 +67,20 @@ class Collapsible extends BaseComponent {
|
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
69
|
}
|
|
70
|
+
static getDerivedStateFromProps(props, prevState) {
|
|
71
|
+
const newState = {};
|
|
72
|
+
const isOpenChanged = props.isOpen !== prevState.cacheIsOpen;
|
|
73
|
+
if (isOpenChanged) {
|
|
74
|
+
if (props.isOpen || !props.motion) {
|
|
75
|
+
newState.visible = props.isOpen;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (props.motion && isOpenChanged) {
|
|
79
|
+
newState.isTransitioning = true;
|
|
80
|
+
}
|
|
81
|
+
newState.cacheIsOpen = props.isOpen;
|
|
82
|
+
return newState;
|
|
83
|
+
}
|
|
68
84
|
componentDidMount() {
|
|
69
85
|
super.componentDidMount();
|
|
70
86
|
this.resizeObserver = new ResizeObserver(this.handleResize);
|
|
@@ -76,22 +92,14 @@ class Collapsible extends BaseComponent {
|
|
|
76
92
|
}
|
|
77
93
|
}
|
|
78
94
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
79
|
-
const changedPropKeys = Object.keys(this.props).filter(key => !_isEqual(this.props[key], prevProps[key]));
|
|
80
|
-
const changedStateKeys = Object.keys(this.state).filter(key => !_isEqual(this.state[key], prevState[key]));
|
|
95
|
+
const changedPropKeys = Object.keys(_pick(this.props, ['reCalcKey'])).filter(key => !_isEqual(this.props[key], prevProps[key]));
|
|
96
|
+
const changedStateKeys = Object.keys(_pick(this.state, ['domInRenderTree'])).filter(key => !_isEqual(this.state[key], prevState[key]));
|
|
81
97
|
if (changedPropKeys.includes("reCalcKey")) {
|
|
82
98
|
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
83
99
|
}
|
|
84
100
|
if (changedStateKeys.includes("domInRenderTree") && this.state.domInRenderTree) {
|
|
85
101
|
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
86
102
|
}
|
|
87
|
-
if (changedPropKeys.includes("isOpen")) {
|
|
88
|
-
if (this.props.isOpen || !this.props.motion) {
|
|
89
|
-
this.foundation.updateVisible(this.props.isOpen);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (this.props.motion && prevProps.isOpen !== this.props.isOpen) {
|
|
93
|
-
this.foundation.updateIsTransitioning(true);
|
|
94
|
-
}
|
|
95
103
|
}
|
|
96
104
|
componentWillUnmount() {
|
|
97
105
|
super.componentWillUnmount();
|
|
@@ -37,7 +37,17 @@ class DropdownItem extends BaseComponent {
|
|
|
37
37
|
const events = {};
|
|
38
38
|
if (!disabled) {
|
|
39
39
|
['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
|
|
40
|
-
|
|
40
|
+
const isInAnotherDropdown = this.context.level !== 1;
|
|
41
|
+
if (isInAnotherDropdown && eventName === "onClick") {
|
|
42
|
+
events["onMouseDown"] = e => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (e.button === 0) {
|
|
45
|
+
(_b = (_a = this.props)[eventName]) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
events[eventName] = this.props[eventName];
|
|
50
|
+
}
|
|
41
51
|
});
|
|
42
52
|
}
|
|
43
53
|
let tick = null;
|
|
@@ -138,7 +138,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
138
138
|
preventScroll?: boolean;
|
|
139
139
|
showRestTagsPopover?: boolean;
|
|
140
140
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
141
|
-
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "
|
|
141
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
142
142
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
143
143
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
144
144
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
86
86
|
preventScroll?: boolean;
|
|
87
87
|
showRestTagsPopover?: boolean;
|
|
88
88
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
89
|
-
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "
|
|
89
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
90
90
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
91
91
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
92
92
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
package/lib/es/input/textarea.js
CHANGED
|
@@ -122,7 +122,7 @@ class TextArea extends BaseComponent {
|
|
|
122
122
|
this._resizeListener && window.removeEventListener('resize', this._resizeListener);
|
|
123
123
|
}
|
|
124
124
|
componentDidUpdate(prevProps, prevState) {
|
|
125
|
-
if (this.props.value !== prevProps.value && this.props.autosize) {
|
|
125
|
+
if ((this.props.value !== prevProps.value || this.props.placeholder !== prevProps.placeholder) && this.props.autosize) {
|
|
126
126
|
this.foundation.resizeTextarea();
|
|
127
127
|
}
|
|
128
128
|
}
|
package/lib/es/modal/Modal.js
CHANGED
|
@@ -83,7 +83,8 @@ class Modal extends BaseComponent {
|
|
|
83
83
|
// return <ModalContent {...restProps} footer={renderFooter} onClose={this.handleCancel}/>;
|
|
84
84
|
// };
|
|
85
85
|
this.renderDialog = () => {
|
|
86
|
-
|
|
86
|
+
var _a;
|
|
87
|
+
let _b = this.props,
|
|
87
88
|
{
|
|
88
89
|
footer,
|
|
89
90
|
className,
|
|
@@ -94,15 +95,15 @@ class Modal extends BaseComponent {
|
|
|
94
95
|
zIndex,
|
|
95
96
|
getPopupContainer,
|
|
96
97
|
visible
|
|
97
|
-
} =
|
|
98
|
-
restProps = __rest(
|
|
98
|
+
} = _b,
|
|
99
|
+
restProps = __rest(_b, ["footer", "className", "motion", "maskStyle", "keepDOM", "style", "zIndex", "getPopupContainer", "visible"]);
|
|
99
100
|
let style = styleFromProps;
|
|
100
101
|
const maskStyle = maskStyleFromProps;
|
|
101
102
|
const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
|
|
102
103
|
let wrapperStyle = {
|
|
103
104
|
zIndex
|
|
104
105
|
};
|
|
105
|
-
if (getPopupContainer) {
|
|
106
|
+
if (getPopupContainer && getPopupContainer() !== ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
106
107
|
wrapperStyle = {
|
|
107
108
|
zIndex,
|
|
108
109
|
position: 'static'
|
|
@@ -173,20 +174,22 @@ class Modal extends BaseComponent {
|
|
|
173
174
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
174
175
|
getProps: () => this.props,
|
|
175
176
|
disabledBodyScroll: () => {
|
|
177
|
+
var _a;
|
|
176
178
|
const {
|
|
177
179
|
getPopupContainer
|
|
178
180
|
} = this.props;
|
|
179
181
|
this.bodyOverflow = document.body.style.overflow || '';
|
|
180
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
182
|
+
if ((!getPopupContainer || getPopupContainer() === ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) && this.bodyOverflow !== 'hidden') {
|
|
181
183
|
document.body.style.overflow = 'hidden';
|
|
182
184
|
document.body.style.width = `calc(${this.originBodyWidth || '100%'} - ${this.scrollBarWidth}px)`;
|
|
183
185
|
}
|
|
184
186
|
},
|
|
185
187
|
enabledBodyScroll: () => {
|
|
188
|
+
var _a;
|
|
186
189
|
const {
|
|
187
190
|
getPopupContainer
|
|
188
191
|
} = this.props;
|
|
189
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
192
|
+
if ((!getPopupContainer || getPopupContainer() === ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.body)) && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
|
|
190
193
|
document.body.style.overflow = this.bodyOverflow;
|
|
191
194
|
document.body.style.width = this.originBodyWidth;
|
|
192
195
|
}
|