@douyinfe/semi-ui 2.27.1-alpha.0 → 2.28.0-alpha.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/dist/css/semi.css +12 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +307 -245
- 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/carousel/index.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownItem.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownMenu.d.ts +1 -1
- package/lib/cjs/dropdown/index.d.ts +1 -1
- package/lib/cjs/form/hoc/withField.js +51 -31
- package/lib/cjs/image/preview.d.ts +1 -1
- package/lib/cjs/input/index.d.ts +1 -1
- package/lib/cjs/layout/Sider.d.ts +1 -0
- package/lib/cjs/layout/Sider.js +1 -0
- package/lib/cjs/layout/index.js +3 -1
- package/lib/cjs/modal/Modal.d.ts +0 -2
- package/lib/cjs/modal/Modal.js +4 -6
- package/lib/cjs/spin/index.d.ts +1 -1
- package/lib/cjs/table/TableHeaderRow.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/dropdown/dropdownItem.d.ts +1 -1
- package/lib/es/dropdown/dropdownMenu.d.ts +1 -1
- package/lib/es/dropdown/index.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +51 -31
- package/lib/es/image/preview.d.ts +1 -1
- package/lib/es/input/index.d.ts +1 -1
- package/lib/es/layout/Sider.d.ts +1 -0
- package/lib/es/layout/Sider.js +1 -0
- package/lib/es/layout/index.js +3 -1
- package/lib/es/modal/Modal.d.ts +0 -2
- package/lib/es/modal/Modal.js +4 -6
- package/lib/es/spin/index.d.ts +1 -1
- package/lib/es/table/TableHeaderRow.d.ts +1 -1
- package/package.json +8 -8
|
@@ -14,7 +14,7 @@ export interface CarouselState {
|
|
|
14
14
|
declare class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
15
15
|
static propTypes: {
|
|
16
16
|
activeIndex: PropTypes.Requireable<number>;
|
|
17
|
-
animation: PropTypes.Requireable<"
|
|
17
|
+
animation: PropTypes.Requireable<"slide" | "fade">;
|
|
18
18
|
arrowProps: PropTypes.Requireable<object>;
|
|
19
19
|
autoPlay: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
20
20
|
className: PropTypes.Requireable<string>;
|
|
@@ -17,7 +17,7 @@ export interface DropdownItemProps extends BaseProps {
|
|
|
17
17
|
icon?: React.ReactNode;
|
|
18
18
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
19
19
|
showTick?: boolean;
|
|
20
|
-
/**
|
|
20
|
+
/** internal prop, please do not use */
|
|
21
21
|
hover?: boolean;
|
|
22
22
|
}
|
|
23
23
|
declare class DropdownItem extends BaseComponent<DropdownItemProps> {
|
|
@@ -17,7 +17,7 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
17
17
|
getProps(): BaseProps;
|
|
18
18
|
getState(key: string): any;
|
|
19
19
|
getStates(): {};
|
|
20
|
-
setState(s: Pick<{},
|
|
20
|
+
setState<K extends never>(s: Pick<{}, K>, callback?: any): void;
|
|
21
21
|
getCache(c: string): any;
|
|
22
22
|
getCaches(): any;
|
|
23
23
|
setCache(key: any, value: any): void;
|
|
@@ -101,7 +101,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
101
101
|
getProps(): DropdownProps;
|
|
102
102
|
getState(key: string): any;
|
|
103
103
|
getStates(): DropdownState;
|
|
104
|
-
setState(s: Pick<DropdownState,
|
|
104
|
+
setState<K extends "popVisible">(s: Pick<DropdownState, K>, callback?: any): void;
|
|
105
105
|
getCache(c: string): any;
|
|
106
106
|
getCaches(): any;
|
|
107
107
|
setCache(key: any, value: any): void;
|
|
@@ -133,7 +133,8 @@ function withField(Component, opts) {
|
|
|
133
133
|
const [status, setStatus] = (0, _react.useState)(validateStatus); // use props.validateStatus to init
|
|
134
134
|
|
|
135
135
|
const rulesRef = (0, _react.useRef)(rules);
|
|
136
|
-
const validateRef = (0, _react.useRef)(validate);
|
|
136
|
+
const validateRef = (0, _react.useRef)(validate);
|
|
137
|
+
const validatePromise = (0, _react.useRef)(null); // notNotify is true means that the onChange of the Form does not need to be triggered
|
|
137
138
|
// notUpdate is true means that this operation does not need to trigger the forceUpdate
|
|
138
139
|
|
|
139
140
|
const updateTouched = (isTouched, callOpts) => {
|
|
@@ -187,16 +188,24 @@ function withField(Component, opts) {
|
|
|
187
188
|
const model = {
|
|
188
189
|
[field]: val
|
|
189
190
|
};
|
|
190
|
-
|
|
191
|
+
const rootPromise = new Promise((resolve, reject) => {
|
|
191
192
|
validator.validate(model, {
|
|
192
193
|
first: stopValidateWithError
|
|
193
194
|
}, // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
194
195
|
(errors, fields) => {}).then(res => {
|
|
195
|
-
|
|
196
|
+
if (validatePromise.current !== rootPromise) {
|
|
197
|
+
return;
|
|
198
|
+
} // validation passed
|
|
199
|
+
|
|
200
|
+
|
|
196
201
|
setStatus('success');
|
|
197
202
|
updateError(undefined, callOpts);
|
|
198
203
|
resolve({});
|
|
199
204
|
}).catch(err => {
|
|
205
|
+
if (validatePromise.current !== rootPromise) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
200
209
|
let {
|
|
201
210
|
errors,
|
|
202
211
|
fields
|
|
@@ -225,44 +234,55 @@ function withField(Component, opts) {
|
|
|
225
234
|
}
|
|
226
235
|
});
|
|
227
236
|
});
|
|
237
|
+
validatePromise.current = rootPromise;
|
|
238
|
+
return rootPromise;
|
|
228
239
|
}; // execute custom validate function
|
|
229
240
|
|
|
230
241
|
|
|
231
|
-
const _validate = (val, values, callOpts) =>
|
|
232
|
-
|
|
242
|
+
const _validate = (val, values, callOpts) => {
|
|
243
|
+
const rootPromise = new Promise(resolve => {
|
|
244
|
+
let maybePromisedErrors; // let errorThrowSync;
|
|
233
245
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
246
|
+
try {
|
|
247
|
+
maybePromisedErrors = validateRef.current(val, values);
|
|
248
|
+
} catch (err) {
|
|
249
|
+
// error throw by syncValidate
|
|
250
|
+
maybePromisedErrors = err;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (maybePromisedErrors === undefined) {
|
|
254
|
+
resolve({});
|
|
255
|
+
updateError(undefined, callOpts);
|
|
256
|
+
} else if ((0, _isPromise.default)(maybePromisedErrors)) {
|
|
257
|
+
maybePromisedErrors.then(result => {
|
|
258
|
+
// If the async validate is outdated (a newer validate occurs), the result should be discarded
|
|
259
|
+
if (validatePromise.current !== rootPromise) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
240
262
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
263
|
+
if ((0, _utils.isValid)(result)) {
|
|
264
|
+
// validate success,no need to do anything with result
|
|
265
|
+
updateError(undefined, callOpts);
|
|
266
|
+
resolve(null);
|
|
267
|
+
} else {
|
|
268
|
+
// validate failed
|
|
269
|
+
updateError(result, callOpts);
|
|
270
|
+
resolve(result);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
if ((0, _utils.isValid)(maybePromisedErrors)) {
|
|
248
275
|
updateError(undefined, callOpts);
|
|
249
276
|
resolve(null);
|
|
250
277
|
} else {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
resolve(result);
|
|
278
|
+
updateError(maybePromisedErrors, callOpts);
|
|
279
|
+
resolve(maybePromisedErrors);
|
|
254
280
|
}
|
|
255
|
-
});
|
|
256
|
-
} else {
|
|
257
|
-
if ((0, _utils.isValid)(maybePromisedErrors)) {
|
|
258
|
-
updateError(undefined, callOpts);
|
|
259
|
-
resolve(null);
|
|
260
|
-
} else {
|
|
261
|
-
updateError(maybePromisedErrors, callOpts);
|
|
262
|
-
resolve(maybePromisedErrors);
|
|
263
281
|
}
|
|
264
|
-
}
|
|
265
|
-
|
|
282
|
+
});
|
|
283
|
+
validatePromise.current = rootPromise;
|
|
284
|
+
return rootPromise;
|
|
285
|
+
};
|
|
266
286
|
|
|
267
287
|
const fieldValidate = (val, callOpts) => {
|
|
268
288
|
let finalVal = val;
|
|
@@ -59,7 +59,7 @@ export default class Preview extends BaseComponent<PreviewProps, PreviewState> {
|
|
|
59
59
|
getProps(): PreviewProps;
|
|
60
60
|
getState(key: string): any;
|
|
61
61
|
getStates(): PreviewState;
|
|
62
|
-
setState(s: Pick<PreviewState,
|
|
62
|
+
setState<K extends keyof PreviewState>(s: Pick<PreviewState, K>, callback?: any): void;
|
|
63
63
|
getCache(c: string): any;
|
|
64
64
|
getCaches(): any;
|
|
65
65
|
setCache(key: any, value: any): void;
|
package/lib/cjs/input/index.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
154
154
|
getProps(): InputProps;
|
|
155
155
|
getState(key: string): any;
|
|
156
156
|
getStates(): InputState;
|
|
157
|
-
setState(s: Pick<InputState,
|
|
157
|
+
setState<K extends keyof InputState>(s: Pick<InputState, K>, callback?: any): void;
|
|
158
158
|
getCache(c: string): any;
|
|
159
159
|
getCaches(): any;
|
|
160
160
|
setCache(key: any, value: any): void;
|
package/lib/cjs/layout/Sider.js
CHANGED
package/lib/cjs/layout/index.js
CHANGED
|
@@ -125,7 +125,9 @@ class Layout extends _react.default.Component {
|
|
|
125
125
|
siders
|
|
126
126
|
} = this.state;
|
|
127
127
|
const classString = (0, _classnames.default)(className, prefixCls, {
|
|
128
|
-
["".concat(prefixCls, "-has-sider")]: typeof hasSider === 'boolean'
|
|
128
|
+
["".concat(prefixCls, "-has-sider")]: typeof hasSider === 'boolean' && hasSider || siders.length > 0 || _react.default.Children.toArray(children).some(child => {
|
|
129
|
+
return /*#__PURE__*/_react.default.isValidElement(child) && child.type && child.type.type === "Sider";
|
|
130
|
+
})
|
|
129
131
|
});
|
|
130
132
|
const Tag = tagName;
|
|
131
133
|
return /*#__PURE__*/_react.default.createElement(_layoutContext.default.Provider, {
|
package/lib/cjs/modal/Modal.d.ts
CHANGED
|
@@ -74,8 +74,6 @@ declare class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
74
74
|
centered: boolean;
|
|
75
75
|
closable: boolean;
|
|
76
76
|
visible: boolean;
|
|
77
|
-
confirmLoading: boolean;
|
|
78
|
-
cancelLoading: boolean;
|
|
79
77
|
okType: string;
|
|
80
78
|
maskClosable: boolean;
|
|
81
79
|
hasCancel: boolean;
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -93,7 +93,7 @@ class Modal extends _baseComponent.default {
|
|
|
93
93
|
return /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
|
|
94
94
|
"aria-label": "cancel",
|
|
95
95
|
onClick: this.handleCancel,
|
|
96
|
-
loading: cancelLoading,
|
|
96
|
+
loading: cancelLoading === undefined ? this.state.onCancelReturnPromiseStatus === "pending" : cancelLoading,
|
|
97
97
|
type: "tertiary",
|
|
98
98
|
autoFocus: true
|
|
99
99
|
}, this.props.cancelButtonProps, {
|
|
@@ -108,7 +108,7 @@ class Modal extends _baseComponent.default {
|
|
|
108
108
|
"aria-label": "confirm",
|
|
109
109
|
type: okType,
|
|
110
110
|
theme: "solid",
|
|
111
|
-
loading: confirmLoading,
|
|
111
|
+
loading: confirmLoading === undefined ? this.state.onOKReturnPromiseStatus === "pending" : confirmLoading,
|
|
112
112
|
onClick: this.handleOk
|
|
113
113
|
}, this.props.okButtonProps, {
|
|
114
114
|
"x-semi-children-alias": "okText"
|
|
@@ -244,10 +244,10 @@ class Modal extends _baseComponent.default {
|
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
246
|
notifyCancel: e => {
|
|
247
|
-
this.props.onCancel(e);
|
|
247
|
+
return this.props.onCancel(e);
|
|
248
248
|
},
|
|
249
249
|
notifyOk: e => {
|
|
250
|
-
this.props.onOk(e);
|
|
250
|
+
return this.props.onOk(e);
|
|
251
251
|
},
|
|
252
252
|
notifyClose: () => {
|
|
253
253
|
this.props.afterClose();
|
|
@@ -380,8 +380,6 @@ Modal.defaultProps = {
|
|
|
380
380
|
centered: false,
|
|
381
381
|
closable: true,
|
|
382
382
|
visible: false,
|
|
383
|
-
confirmLoading: false,
|
|
384
|
-
cancelLoading: false,
|
|
385
383
|
okType: 'primary',
|
|
386
384
|
maskClosable: true,
|
|
387
385
|
hasCancel: true,
|
package/lib/cjs/spin/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare class Spin extends BaseComponent<SpinProps, SpinState> {
|
|
|
50
50
|
getProps(): SpinProps;
|
|
51
51
|
getState(key: string): any;
|
|
52
52
|
getStates(): SpinState;
|
|
53
|
-
setState(s: Pick<SpinState,
|
|
53
|
+
setState<K extends keyof SpinState>(s: Pick<SpinState, K>, callback?: any): void;
|
|
54
54
|
getCache(c: string): any;
|
|
55
55
|
getCaches(): any;
|
|
56
56
|
setCache(key: any, value: any): void;
|
|
@@ -46,7 +46,7 @@ export default class TableHeaderRow extends BaseComponent<TableHeaderRowProps, R
|
|
|
46
46
|
getProps(): TableHeaderRowProps;
|
|
47
47
|
getState(key: string): any;
|
|
48
48
|
getStates(): Record<string, any>;
|
|
49
|
-
setState(s: Pick<Record<string, any>,
|
|
49
|
+
setState<K extends string>(s: Pick<Record<string, any>, K>, callback?: any): void;
|
|
50
50
|
getCache(c: string): any;
|
|
51
51
|
getCaches(): any;
|
|
52
52
|
setCache(key: any, value: any): void;
|
|
@@ -14,7 +14,7 @@ export interface CarouselState {
|
|
|
14
14
|
declare class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
15
15
|
static propTypes: {
|
|
16
16
|
activeIndex: PropTypes.Requireable<number>;
|
|
17
|
-
animation: PropTypes.Requireable<"
|
|
17
|
+
animation: PropTypes.Requireable<"slide" | "fade">;
|
|
18
18
|
arrowProps: PropTypes.Requireable<object>;
|
|
19
19
|
autoPlay: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
20
20
|
className: PropTypes.Requireable<string>;
|
|
@@ -17,7 +17,7 @@ export interface DropdownItemProps extends BaseProps {
|
|
|
17
17
|
icon?: React.ReactNode;
|
|
18
18
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
19
19
|
showTick?: boolean;
|
|
20
|
-
/**
|
|
20
|
+
/** internal prop, please do not use */
|
|
21
21
|
hover?: boolean;
|
|
22
22
|
}
|
|
23
23
|
declare class DropdownItem extends BaseComponent<DropdownItemProps> {
|
|
@@ -17,7 +17,7 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
17
17
|
getProps(): BaseProps;
|
|
18
18
|
getState(key: string): any;
|
|
19
19
|
getStates(): {};
|
|
20
|
-
setState(s: Pick<{},
|
|
20
|
+
setState<K extends never>(s: Pick<{}, K>, callback?: any): void;
|
|
21
21
|
getCache(c: string): any;
|
|
22
22
|
getCaches(): any;
|
|
23
23
|
setCache(key: any, value: any): void;
|
|
@@ -101,7 +101,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
101
101
|
getProps(): DropdownProps;
|
|
102
102
|
getState(key: string): any;
|
|
103
103
|
getStates(): DropdownState;
|
|
104
|
-
setState(s: Pick<DropdownState,
|
|
104
|
+
setState<K extends "popVisible">(s: Pick<DropdownState, K>, callback?: any): void;
|
|
105
105
|
getCache(c: string): any;
|
|
106
106
|
getCaches(): any;
|
|
107
107
|
setCache(key: any, value: any): void;
|
|
@@ -108,7 +108,8 @@ function withField(Component, opts) {
|
|
|
108
108
|
const [status, setStatus] = useState(validateStatus); // use props.validateStatus to init
|
|
109
109
|
|
|
110
110
|
const rulesRef = useRef(rules);
|
|
111
|
-
const validateRef = useRef(validate);
|
|
111
|
+
const validateRef = useRef(validate);
|
|
112
|
+
const validatePromise = useRef(null); // notNotify is true means that the onChange of the Form does not need to be triggered
|
|
112
113
|
// notUpdate is true means that this operation does not need to trigger the forceUpdate
|
|
113
114
|
|
|
114
115
|
const updateTouched = (isTouched, callOpts) => {
|
|
@@ -162,16 +163,24 @@ function withField(Component, opts) {
|
|
|
162
163
|
const model = {
|
|
163
164
|
[field]: val
|
|
164
165
|
};
|
|
165
|
-
|
|
166
|
+
const rootPromise = new Promise((resolve, reject) => {
|
|
166
167
|
validator.validate(model, {
|
|
167
168
|
first: stopValidateWithError
|
|
168
169
|
}, // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
169
170
|
(errors, fields) => {}).then(res => {
|
|
170
|
-
|
|
171
|
+
if (validatePromise.current !== rootPromise) {
|
|
172
|
+
return;
|
|
173
|
+
} // validation passed
|
|
174
|
+
|
|
175
|
+
|
|
171
176
|
setStatus('success');
|
|
172
177
|
updateError(undefined, callOpts);
|
|
173
178
|
resolve({});
|
|
174
179
|
}).catch(err => {
|
|
180
|
+
if (validatePromise.current !== rootPromise) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
175
184
|
let {
|
|
176
185
|
errors,
|
|
177
186
|
fields
|
|
@@ -200,44 +209,55 @@ function withField(Component, opts) {
|
|
|
200
209
|
}
|
|
201
210
|
});
|
|
202
211
|
});
|
|
212
|
+
validatePromise.current = rootPromise;
|
|
213
|
+
return rootPromise;
|
|
203
214
|
}; // execute custom validate function
|
|
204
215
|
|
|
205
216
|
|
|
206
|
-
const _validate = (val, values, callOpts) =>
|
|
207
|
-
|
|
217
|
+
const _validate = (val, values, callOpts) => {
|
|
218
|
+
const rootPromise = new Promise(resolve => {
|
|
219
|
+
let maybePromisedErrors; // let errorThrowSync;
|
|
208
220
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
221
|
+
try {
|
|
222
|
+
maybePromisedErrors = validateRef.current(val, values);
|
|
223
|
+
} catch (err) {
|
|
224
|
+
// error throw by syncValidate
|
|
225
|
+
maybePromisedErrors = err;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (maybePromisedErrors === undefined) {
|
|
229
|
+
resolve({});
|
|
230
|
+
updateError(undefined, callOpts);
|
|
231
|
+
} else if (isPromise(maybePromisedErrors)) {
|
|
232
|
+
maybePromisedErrors.then(result => {
|
|
233
|
+
// If the async validate is outdated (a newer validate occurs), the result should be discarded
|
|
234
|
+
if (validatePromise.current !== rootPromise) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
215
237
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
238
|
+
if (isValid(result)) {
|
|
239
|
+
// validate success,no need to do anything with result
|
|
240
|
+
updateError(undefined, callOpts);
|
|
241
|
+
resolve(null);
|
|
242
|
+
} else {
|
|
243
|
+
// validate failed
|
|
244
|
+
updateError(result, callOpts);
|
|
245
|
+
resolve(result);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
if (isValid(maybePromisedErrors)) {
|
|
223
250
|
updateError(undefined, callOpts);
|
|
224
251
|
resolve(null);
|
|
225
252
|
} else {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
resolve(result);
|
|
253
|
+
updateError(maybePromisedErrors, callOpts);
|
|
254
|
+
resolve(maybePromisedErrors);
|
|
229
255
|
}
|
|
230
|
-
});
|
|
231
|
-
} else {
|
|
232
|
-
if (isValid(maybePromisedErrors)) {
|
|
233
|
-
updateError(undefined, callOpts);
|
|
234
|
-
resolve(null);
|
|
235
|
-
} else {
|
|
236
|
-
updateError(maybePromisedErrors, callOpts);
|
|
237
|
-
resolve(maybePromisedErrors);
|
|
238
256
|
}
|
|
239
|
-
}
|
|
240
|
-
|
|
257
|
+
});
|
|
258
|
+
validatePromise.current = rootPromise;
|
|
259
|
+
return rootPromise;
|
|
260
|
+
};
|
|
241
261
|
|
|
242
262
|
const fieldValidate = (val, callOpts) => {
|
|
243
263
|
let finalVal = val;
|
|
@@ -59,7 +59,7 @@ export default class Preview extends BaseComponent<PreviewProps, PreviewState> {
|
|
|
59
59
|
getProps(): PreviewProps;
|
|
60
60
|
getState(key: string): any;
|
|
61
61
|
getStates(): PreviewState;
|
|
62
|
-
setState(s: Pick<PreviewState,
|
|
62
|
+
setState<K extends keyof PreviewState>(s: Pick<PreviewState, K>, callback?: any): void;
|
|
63
63
|
getCache(c: string): any;
|
|
64
64
|
getCaches(): any;
|
|
65
65
|
setCache(key: any, value: any): void;
|
package/lib/es/input/index.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
154
154
|
getProps(): InputProps;
|
|
155
155
|
getState(key: string): any;
|
|
156
156
|
getStates(): InputState;
|
|
157
|
-
setState(s: Pick<InputState,
|
|
157
|
+
setState<K extends keyof InputState>(s: Pick<InputState, K>, callback?: any): void;
|
|
158
158
|
getCache(c: string): any;
|
|
159
159
|
getCaches(): any;
|
|
160
160
|
setCache(key: any, value: any): void;
|
package/lib/es/layout/Sider.d.ts
CHANGED
package/lib/es/layout/Sider.js
CHANGED
package/lib/es/layout/index.js
CHANGED
|
@@ -109,7 +109,9 @@ class Layout extends React.Component {
|
|
|
109
109
|
siders
|
|
110
110
|
} = this.state;
|
|
111
111
|
const classString = cls(className, prefixCls, {
|
|
112
|
-
["".concat(prefixCls, "-has-sider")]: typeof hasSider === 'boolean'
|
|
112
|
+
["".concat(prefixCls, "-has-sider")]: typeof hasSider === 'boolean' && hasSider || siders.length > 0 || React.Children.toArray(children).some(child => {
|
|
113
|
+
return /*#__PURE__*/React.isValidElement(child) && child.type && child.type.type === "Sider";
|
|
114
|
+
})
|
|
113
115
|
});
|
|
114
116
|
const Tag = tagName;
|
|
115
117
|
return /*#__PURE__*/React.createElement(LayoutContext.Provider, {
|
package/lib/es/modal/Modal.d.ts
CHANGED
|
@@ -74,8 +74,6 @@ declare class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
74
74
|
centered: boolean;
|
|
75
75
|
closable: boolean;
|
|
76
76
|
visible: boolean;
|
|
77
|
-
confirmLoading: boolean;
|
|
78
|
-
cancelLoading: boolean;
|
|
79
77
|
okType: string;
|
|
80
78
|
maskClosable: boolean;
|
|
81
79
|
hasCancel: boolean;
|
package/lib/es/modal/Modal.js
CHANGED
|
@@ -65,7 +65,7 @@ class Modal extends BaseComponent {
|
|
|
65
65
|
return /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
66
66
|
"aria-label": "cancel",
|
|
67
67
|
onClick: this.handleCancel,
|
|
68
|
-
loading: cancelLoading,
|
|
68
|
+
loading: cancelLoading === undefined ? this.state.onCancelReturnPromiseStatus === "pending" : cancelLoading,
|
|
69
69
|
type: "tertiary",
|
|
70
70
|
autoFocus: true
|
|
71
71
|
}, this.props.cancelButtonProps, {
|
|
@@ -80,7 +80,7 @@ class Modal extends BaseComponent {
|
|
|
80
80
|
"aria-label": "confirm",
|
|
81
81
|
type: okType,
|
|
82
82
|
theme: "solid",
|
|
83
|
-
loading: confirmLoading,
|
|
83
|
+
loading: confirmLoading === undefined ? this.state.onOKReturnPromiseStatus === "pending" : confirmLoading,
|
|
84
84
|
onClick: this.handleOk
|
|
85
85
|
}, this.props.okButtonProps, {
|
|
86
86
|
"x-semi-children-alias": "okText"
|
|
@@ -216,10 +216,10 @@ class Modal extends BaseComponent {
|
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
notifyCancel: e => {
|
|
219
|
-
this.props.onCancel(e);
|
|
219
|
+
return this.props.onCancel(e);
|
|
220
220
|
},
|
|
221
221
|
notifyOk: e => {
|
|
222
|
-
this.props.onOk(e);
|
|
222
|
+
return this.props.onOk(e);
|
|
223
223
|
},
|
|
224
224
|
notifyClose: () => {
|
|
225
225
|
this.props.afterClose();
|
|
@@ -352,8 +352,6 @@ Modal.defaultProps = {
|
|
|
352
352
|
centered: false,
|
|
353
353
|
closable: true,
|
|
354
354
|
visible: false,
|
|
355
|
-
confirmLoading: false,
|
|
356
|
-
cancelLoading: false,
|
|
357
355
|
okType: 'primary',
|
|
358
356
|
maskClosable: true,
|
|
359
357
|
hasCancel: true,
|
package/lib/es/spin/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ declare class Spin extends BaseComponent<SpinProps, SpinState> {
|
|
|
50
50
|
getProps(): SpinProps;
|
|
51
51
|
getState(key: string): any;
|
|
52
52
|
getStates(): SpinState;
|
|
53
|
-
setState(s: Pick<SpinState,
|
|
53
|
+
setState<K extends keyof SpinState>(s: Pick<SpinState, K>, callback?: any): void;
|
|
54
54
|
getCache(c: string): any;
|
|
55
55
|
getCaches(): any;
|
|
56
56
|
setCache(key: any, value: any): void;
|
|
@@ -46,7 +46,7 @@ export default class TableHeaderRow extends BaseComponent<TableHeaderRowProps, R
|
|
|
46
46
|
getProps(): TableHeaderRowProps;
|
|
47
47
|
getState(key: string): any;
|
|
48
48
|
getStates(): Record<string, any>;
|
|
49
|
-
setState(s: Pick<Record<string, any>,
|
|
49
|
+
setState<K extends string>(s: Pick<Record<string, any>, K>, callback?: any): void;
|
|
50
50
|
getCache(c: string): any;
|
|
51
51
|
getCaches(): any;
|
|
52
52
|
setCache(key: any, value: any): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"lib/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@douyinfe/semi-animation": "2.
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.
|
|
22
|
-
"@douyinfe/semi-foundation": "2.
|
|
23
|
-
"@douyinfe/semi-icons": "2.
|
|
24
|
-
"@douyinfe/semi-illustrations": "2.
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.
|
|
20
|
+
"@douyinfe/semi-animation": "2.28.0-alpha.0",
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.28.0-alpha.0",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.28.0-alpha.0",
|
|
23
|
+
"@douyinfe/semi-icons": "2.28.0-alpha.0",
|
|
24
|
+
"@douyinfe/semi-illustrations": "2.28.0-alpha.0",
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.28.0-alpha.0",
|
|
26
26
|
"async-validator": "^3.5.0",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "ee3933458b16abacd476c8ea1c28a245c9d85dc0",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|