@douyinfe/semi-ui 2.4.1 → 2.5.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/button/index.tsx +1 -1
- package/cascader/__test__/cascader.test.js +24 -0
- package/cascader/_story/cascader.stories.js +73 -0
- package/cascader/index.tsx +5 -2
- package/datePicker/_story/v2/FixInputRangeFocus.jsx +25 -0
- package/datePicker/_story/v2/index.js +2 -1
- package/datePicker/datePicker.tsx +3 -0
- package/dist/css/semi.css +56 -29
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +523 -227
- 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/form/__test__/formApi.test.js +182 -0
- package/form/_story/FormApi/arrayDemo.jsx +4 -7
- package/form/_story/Layout/slotDemo.jsx +2 -2
- package/form/_story/demo.jsx +18 -1
- package/form/_story/form.stories.js +6 -6
- package/form/baseForm.tsx +2 -2
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/button/Button.d.ts +4 -4
- package/lib/cjs/button/buttonGroup.d.ts +2 -2
- package/lib/cjs/button/index.d.ts +5 -6
- package/lib/cjs/cascader/index.js +6 -0
- package/lib/cjs/datePicker/datePicker.js +4 -0
- package/lib/cjs/dropdown/index.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +2 -2
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/iconButton/index.d.ts +2 -2
- package/lib/cjs/select/index.d.ts +3 -3
- package/lib/cjs/select/index.js +32 -28
- package/lib/cjs/select/option.js +2 -2
- package/lib/cjs/select/virtualRow.js +2 -2
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/table/Table.js +8 -2
- package/lib/cjs/table/interface.d.ts +1 -0
- package/lib/cjs/tabs/interface.d.ts +1 -1
- package/lib/cjs/tooltip/index.d.ts +1 -1
- package/lib/cjs/tooltip/index.js +12 -4
- package/lib/cjs/tree/index.d.ts +2 -0
- package/lib/cjs/tree/index.js +15 -8
- package/lib/cjs/treeSelect/index.d.ts +2 -0
- package/lib/cjs/treeSelect/index.js +64 -27
- package/lib/cjs/upload/fileCard.js +31 -22
- package/lib/cjs/upload/index.d.ts +6 -0
- package/lib/cjs/upload/index.js +15 -8
- package/lib/cjs/upload/interface.d.ts +8 -6
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/button/Button.d.ts +4 -4
- package/lib/es/button/buttonGroup.d.ts +2 -2
- package/lib/es/button/index.d.ts +5 -6
- package/lib/es/cascader/index.js +5 -0
- package/lib/es/datePicker/datePicker.js +4 -0
- package/lib/es/dropdown/index.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/baseForm.js +2 -2
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/iconButton/index.d.ts +2 -2
- package/lib/es/select/index.d.ts +3 -3
- package/lib/es/select/index.js +30 -26
- package/lib/es/select/option.js +2 -2
- package/lib/es/select/virtualRow.js +2 -2
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/Table.js +10 -2
- package/lib/es/table/interface.d.ts +1 -0
- package/lib/es/tabs/interface.d.ts +1 -1
- package/lib/es/tooltip/index.d.ts +1 -1
- package/lib/es/tooltip/index.js +12 -4
- package/lib/es/tree/index.d.ts +2 -0
- package/lib/es/tree/index.js +15 -8
- package/lib/es/treeSelect/index.d.ts +2 -0
- package/lib/es/treeSelect/index.js +64 -27
- package/lib/es/upload/fileCard.js +31 -24
- package/lib/es/upload/index.d.ts +6 -0
- package/lib/es/upload/index.js +14 -8
- package/lib/es/upload/interface.d.ts +8 -6
- package/package.json +9 -9
- package/select/index.tsx +18 -19
- package/select/option.tsx +2 -2
- package/select/virtualRow.tsx +2 -2
- package/table/Table.tsx +7 -2
- package/table/_story/Perf/Virtualized/index.jsx +6 -0
- package/table/_story/table.stories.js +1 -2
- package/table/_story/v2/FixedHeaderMerge/index.jsx +98 -0
- package/table/_story/v2/FixedResizable/index.jsx +114 -0
- package/table/_story/v2/defaultFilteredValue.tsx +114 -0
- package/table/_story/v2/index.js +5 -0
- package/table/interface.ts +1 -0
- package/tabs/interface.ts +1 -1
- package/tooltip/__test__/tooltip.test.js +48 -4
- package/tooltip/_story/tooltip.stories.js +718 -559
- package/tooltip/index.tsx +6 -6
- package/tree/__test__/treeMultiple.test.js +94 -0
- package/tree/_story/tree.stories.js +169 -0
- package/tree/index.tsx +12 -5
- package/treeSelect/__test__/treeMultiple.test.js +94 -0
- package/treeSelect/_story/treeSelect.stories.js +242 -0
- package/treeSelect/index.tsx +72 -40
- package/upload/_story/upload.stories.js +22 -6
- package/upload/fileCard.tsx +23 -23
- package/upload/index.tsx +15 -6
- package/upload/interface.ts +7 -5
|
@@ -30,7 +30,7 @@ var _semiIcons = require("@douyinfe/semi-icons");
|
|
|
30
30
|
|
|
31
31
|
var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
|
|
32
32
|
|
|
33
|
-
var _index = _interopRequireDefault(require("../
|
|
33
|
+
var _index = _interopRequireDefault(require("../button/index"));
|
|
34
34
|
|
|
35
35
|
var _index2 = _interopRequireDefault(require("../progress/index"));
|
|
36
36
|
|
|
@@ -200,6 +200,7 @@ class FileCard extends _react.PureComponent {
|
|
|
200
200
|
onPreviewClick,
|
|
201
201
|
showPicInfo,
|
|
202
202
|
renderPicInfo,
|
|
203
|
+
renderPicPreviewIcon,
|
|
203
204
|
renderThumbnail,
|
|
204
205
|
name,
|
|
205
206
|
index
|
|
@@ -207,6 +208,7 @@ class FileCard extends _react.PureComponent {
|
|
|
207
208
|
const showProgress = status === _constants.strings.FILE_STATUS_UPLOADING && percent !== 100;
|
|
208
209
|
const showRetry = status === _constants.strings.FILE_STATUS_UPLOAD_FAIL && this.props.showRetry;
|
|
209
210
|
const showReplace = status === _constants.strings.FILE_STATUS_SUCCESS && this.props.showReplace;
|
|
211
|
+
const showPreview = status === _constants.strings.FILE_STATUS_SUCCESS && !this.props.showReplace;
|
|
210
212
|
const filePicCardCls = (0, _classnames.default)({
|
|
211
213
|
["".concat(prefixCls, "-picture-file-card")]: true,
|
|
212
214
|
["".concat(prefixCls, "-picture-file-card-disabled")]: disabled,
|
|
@@ -214,7 +216,6 @@ class FileCard extends _react.PureComponent {
|
|
|
214
216
|
["".concat(prefixCls, "-picture-file-card-error")]: status === _constants.strings.FILE_STATUS_UPLOAD_FAIL,
|
|
215
217
|
["".concat(prefixCls, "-picture-file-card-uploading")]: showProgress
|
|
216
218
|
});
|
|
217
|
-
const closeCls = "".concat(prefixCls, "-picture-file-card-close");
|
|
218
219
|
|
|
219
220
|
const retry = /*#__PURE__*/_react.default.createElement("div", {
|
|
220
221
|
role: "button",
|
|
@@ -240,6 +241,19 @@ class FileCard extends _react.PureComponent {
|
|
|
240
241
|
className: "".concat(prefixCls, "-picture-file-card-icon-replace")
|
|
241
242
|
})));
|
|
242
243
|
|
|
244
|
+
const preview = /*#__PURE__*/_react.default.createElement("div", {
|
|
245
|
+
className: "".concat(prefixCls, "-picture-file-card-preview")
|
|
246
|
+
}, typeof renderPicPreviewIcon === 'function' ? renderPicPreviewIcon(this.props) : null);
|
|
247
|
+
|
|
248
|
+
const close = /*#__PURE__*/_react.default.createElement("div", {
|
|
249
|
+
role: "button",
|
|
250
|
+
tabIndex: 0,
|
|
251
|
+
className: "".concat(prefixCls, "-picture-file-card-close"),
|
|
252
|
+
onClick: e => this.onRemove(e)
|
|
253
|
+
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClear, {
|
|
254
|
+
className: "".concat(prefixCls, "-picture-file-card-icon-close")
|
|
255
|
+
}));
|
|
256
|
+
|
|
243
257
|
const picInfo = typeof renderPicInfo === 'function' ? renderPicInfo(this.props) : /*#__PURE__*/_react.default.createElement("div", {
|
|
244
258
|
className: "".concat(prefixCls, "-picture-file-card-pic-info")
|
|
245
259
|
}, index + 1);
|
|
@@ -258,14 +272,7 @@ class FileCard extends _react.PureComponent {
|
|
|
258
272
|
size: "small",
|
|
259
273
|
orbitStroke: '#FFF',
|
|
260
274
|
"aria-label": "uploading file progress"
|
|
261
|
-
}) : null, showRetry ? retry : null, showReplace && replace, showPicInfo && picInfo, !disabled &&
|
|
262
|
-
className: closeCls,
|
|
263
|
-
onClick: e => this.onRemove(e)
|
|
264
|
-
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
|
|
265
|
-
tabIndex: 0,
|
|
266
|
-
role: "button",
|
|
267
|
-
size: "extra-small"
|
|
268
|
-
})), this.renderPicValidateMsg());
|
|
275
|
+
}) : null, showRetry ? retry : null, showReplace && replace, showPreview && preview, showPicInfo && picInfo, !disabled && close, this.renderPicValidateMsg());
|
|
269
276
|
}
|
|
270
277
|
|
|
271
278
|
renderFile(locale) {
|
|
@@ -280,7 +287,8 @@ class FileCard extends _react.PureComponent {
|
|
|
280
287
|
previewFile,
|
|
281
288
|
status,
|
|
282
289
|
style,
|
|
283
|
-
onPreviewClick
|
|
290
|
+
onPreviewClick,
|
|
291
|
+
renderFileOperation
|
|
284
292
|
} = this.props;
|
|
285
293
|
const fileCardCls = (0, _classnames.default)({
|
|
286
294
|
["".concat(prefixCls, "-file-card")]: true,
|
|
@@ -310,6 +318,14 @@ class FileCard extends _react.PureComponent {
|
|
|
310
318
|
previewContent = previewFile(this.props);
|
|
311
319
|
}
|
|
312
320
|
|
|
321
|
+
const operation = typeof renderFileOperation === 'function' ? renderFileOperation(this.props) : /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
322
|
+
onClick: e => this.onRemove(e),
|
|
323
|
+
type: "tertiary",
|
|
324
|
+
icon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, null),
|
|
325
|
+
theme: "borderless",
|
|
326
|
+
size: "small",
|
|
327
|
+
className: closeCls
|
|
328
|
+
});
|
|
313
329
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
314
330
|
role: "listitem",
|
|
315
331
|
className: fileCardCls,
|
|
@@ -352,29 +368,22 @@ class FileCard extends _react.PureComponent {
|
|
|
352
368
|
tabIndex: 0,
|
|
353
369
|
className: "".concat(infoCls, "-retry"),
|
|
354
370
|
onClick: e => this.onRetry(e)
|
|
355
|
-
}, locale.retry) : null)),
|
|
356
|
-
onClick: e => this.onRemove(e),
|
|
357
|
-
type: "tertiary",
|
|
358
|
-
icon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, null),
|
|
359
|
-
theme: "borderless",
|
|
360
|
-
size: "small",
|
|
361
|
-
className: closeCls
|
|
362
|
-
}));
|
|
371
|
+
}, locale.retry) : null)), operation);
|
|
363
372
|
}
|
|
364
373
|
|
|
365
374
|
onRemove(e) {
|
|
366
375
|
e.stopPropagation();
|
|
367
|
-
this.props.onRemove(
|
|
376
|
+
this.props.onRemove();
|
|
368
377
|
}
|
|
369
378
|
|
|
370
379
|
onReplace(e) {
|
|
371
380
|
e.stopPropagation();
|
|
372
|
-
this.props.onReplace(
|
|
381
|
+
this.props.onReplace();
|
|
373
382
|
}
|
|
374
383
|
|
|
375
384
|
onRetry(e) {
|
|
376
385
|
e.stopPropagation();
|
|
377
|
-
this.props.onRetry(
|
|
386
|
+
this.props.onRetry();
|
|
378
387
|
}
|
|
379
388
|
|
|
380
389
|
render() {
|
|
@@ -29,6 +29,7 @@ export interface UploadProps {
|
|
|
29
29
|
fileList?: Array<FileItem>;
|
|
30
30
|
fileName?: string;
|
|
31
31
|
headers?: Record<string, any> | ((file: File) => Record<string, string>);
|
|
32
|
+
hotSpotLocation?: 'start' | 'end';
|
|
32
33
|
itemStyle?: CSSProperties;
|
|
33
34
|
limit?: number;
|
|
34
35
|
listType?: UploadListType;
|
|
@@ -56,6 +57,8 @@ export interface UploadProps {
|
|
|
56
57
|
renderFileItem?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
57
58
|
renderPicInfo?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
58
59
|
renderThumbnail?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
60
|
+
renderPicPreviewIcon?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
61
|
+
renderFileOperation?: (fileItem: RenderFileItemProps) => ReactNode;
|
|
59
62
|
showClear?: boolean;
|
|
60
63
|
showPicInfo?: boolean;
|
|
61
64
|
showReplace?: boolean;
|
|
@@ -99,6 +102,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
99
102
|
fileList: PropTypes.Requireable<any[]>;
|
|
100
103
|
fileName: PropTypes.Requireable<string>;
|
|
101
104
|
headers: PropTypes.Requireable<object>;
|
|
105
|
+
hotSpotLocation: PropTypes.Requireable<string>;
|
|
102
106
|
itemStyle: PropTypes.Requireable<object>;
|
|
103
107
|
limit: PropTypes.Requireable<number>;
|
|
104
108
|
listType: PropTypes.Requireable<"picture" | "list">;
|
|
@@ -124,6 +128,8 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
124
128
|
prompt: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
125
129
|
promptPosition: PropTypes.Requireable<"left" | "right" | "bottom">;
|
|
126
130
|
renderFileItem: PropTypes.Requireable<(...args: any[]) => any>;
|
|
131
|
+
renderPicPreviewIcon: PropTypes.Requireable<(...args: any[]) => any>;
|
|
132
|
+
renderFileOperation: PropTypes.Requireable<(...args: any[]) => any>;
|
|
127
133
|
renderPicInfo: PropTypes.Requireable<(...args: any[]) => any>;
|
|
128
134
|
renderThumbnail: PropTypes.Requireable<(...args: any[]) => any>;
|
|
129
135
|
showClear: PropTypes.Requireable<boolean>;
|
package/lib/cjs/upload/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
16
16
|
|
|
17
17
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
18
18
|
|
|
19
|
+
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
20
|
+
|
|
19
21
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
20
22
|
|
|
21
23
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -136,14 +138,14 @@ class Upload extends _baseComponent.default {
|
|
|
136
138
|
previewFile,
|
|
137
139
|
listType,
|
|
138
140
|
itemStyle,
|
|
139
|
-
showRetry,
|
|
140
141
|
showPicInfo,
|
|
141
142
|
renderPicInfo,
|
|
143
|
+
renderPicPreviewIcon,
|
|
144
|
+
renderFileOperation,
|
|
142
145
|
renderFileItem,
|
|
143
146
|
renderThumbnail,
|
|
144
147
|
disabled,
|
|
145
|
-
onPreviewClick
|
|
146
|
-
showReplace
|
|
148
|
+
onPreviewClick
|
|
147
149
|
} = this.props;
|
|
148
150
|
|
|
149
151
|
const onRemove = () => this.remove(file);
|
|
@@ -156,20 +158,20 @@ class Upload extends _baseComponent.default {
|
|
|
156
158
|
this.replace(index);
|
|
157
159
|
};
|
|
158
160
|
|
|
159
|
-
const fileCardProps = (0, _assign.default)((0, _assign.default)({}, file), {
|
|
161
|
+
const fileCardProps = (0, _assign.default)((0, _assign.default)((0, _assign.default)({}, (0, _pick2.default)(this.props, ['showRetry', 'showReplace', ''])), file), {
|
|
160
162
|
previewFile,
|
|
161
163
|
listType,
|
|
162
164
|
onRemove,
|
|
163
165
|
onRetry,
|
|
164
166
|
index,
|
|
165
167
|
key: uid || (0, _concat.default)(_context = "".concat(name)).call(_context, index),
|
|
166
|
-
showRetry: typeof file.showRetry !== 'undefined' ? file.showRetry : showRetry,
|
|
167
168
|
style: itemStyle,
|
|
168
169
|
disabled,
|
|
169
170
|
showPicInfo,
|
|
170
171
|
renderPicInfo,
|
|
172
|
+
renderPicPreviewIcon,
|
|
173
|
+
renderFileOperation,
|
|
171
174
|
renderThumbnail,
|
|
172
|
-
showReplace: typeof file.showReplace !== 'undefined' ? file.showReplace : showReplace,
|
|
173
175
|
onReplace,
|
|
174
176
|
onPreviewClick: typeof onPreviewClick !== 'undefined' ? () => this.foundation.handlePreviewClick(file) : undefined
|
|
175
177
|
});
|
|
@@ -211,7 +213,8 @@ class Upload extends _baseComponent.default {
|
|
|
211
213
|
limit,
|
|
212
214
|
disabled,
|
|
213
215
|
children,
|
|
214
|
-
draggable
|
|
216
|
+
draggable,
|
|
217
|
+
hotSpotLocation
|
|
215
218
|
} = this.props;
|
|
216
219
|
const {
|
|
217
220
|
fileList: stateFileList,
|
|
@@ -269,7 +272,7 @@ class Upload extends _baseComponent.default {
|
|
|
269
272
|
className: mainCls,
|
|
270
273
|
role: "list",
|
|
271
274
|
"aria-label": "picture list"
|
|
272
|
-
}, (0, _map.default)(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)), showAddTriggerInList ? addContent : null)));
|
|
275
|
+
}, showAddTriggerInList && hotSpotLocation === 'start' ? addContent : null, (0, _map.default)(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)), showAddTriggerInList && hotSpotLocation === 'end' ? addContent : null)));
|
|
273
276
|
};
|
|
274
277
|
|
|
275
278
|
this.renderFileListDefault = () => {
|
|
@@ -609,6 +612,7 @@ Upload.propTypes = {
|
|
|
609
612
|
fileList: _propTypes.default.array,
|
|
610
613
|
fileName: _propTypes.default.string,
|
|
611
614
|
headers: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.func]),
|
|
615
|
+
hotSpotLocation: _propTypes.default.oneOf(['start', 'end']),
|
|
612
616
|
itemStyle: _propTypes.default.object,
|
|
613
617
|
limit: _propTypes.default.number,
|
|
614
618
|
listType: _propTypes.default.oneOf(_constants.strings.LIST_TYPE),
|
|
@@ -634,6 +638,8 @@ Upload.propTypes = {
|
|
|
634
638
|
prompt: _propTypes.default.node,
|
|
635
639
|
promptPosition: _propTypes.default.oneOf(_constants.strings.PROMPT_POSITION),
|
|
636
640
|
renderFileItem: _propTypes.default.func,
|
|
641
|
+
renderPicPreviewIcon: _propTypes.default.func,
|
|
642
|
+
renderFileOperation: _propTypes.default.func,
|
|
637
643
|
renderPicInfo: _propTypes.default.func,
|
|
638
644
|
renderThumbnail: _propTypes.default.func,
|
|
639
645
|
showClear: _propTypes.default.bool,
|
|
@@ -653,6 +659,7 @@ Upload.defaultProps = {
|
|
|
653
659
|
defaultFileList: [],
|
|
654
660
|
disabled: false,
|
|
655
661
|
listType: 'list',
|
|
662
|
+
hotSpotLocation: 'end',
|
|
656
663
|
multiple: false,
|
|
657
664
|
onAcceptInvalid: _noop2.default,
|
|
658
665
|
onChange: _noop2.default,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { BaseFileItem } from '@douyinfe/semi-foundation/lib/cjs/upload/foundation';
|
|
3
3
|
import { strings } from '@douyinfe/semi-foundation/lib/cjs/upload/constants';
|
|
4
4
|
import { ArrayElement } from '../_base/base';
|
|
@@ -45,14 +45,16 @@ export interface RenderFileItemProps extends FileItem {
|
|
|
45
45
|
index?: number;
|
|
46
46
|
previewFile?: (fileItem: RenderFileItemProps) => ReactNode;
|
|
47
47
|
listType: UploadListType;
|
|
48
|
-
onRemove: (
|
|
49
|
-
onRetry: (
|
|
50
|
-
onReplace: (
|
|
48
|
+
onRemove: () => void;
|
|
49
|
+
onRetry: () => void;
|
|
50
|
+
onReplace: () => void;
|
|
51
51
|
key: string;
|
|
52
52
|
showPicInfo?: boolean;
|
|
53
53
|
renderPicInfo?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
renderPicPreviewIcon?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
55
|
+
renderFileOperation?: (fileItem: RenderFileItemProps) => ReactNode;
|
|
56
|
+
showRetry?: boolean;
|
|
57
|
+
showReplace?: boolean;
|
|
56
58
|
style?: CSSProperties;
|
|
57
59
|
disabled: boolean;
|
|
58
60
|
onPreviewClick: () => void;
|
|
@@ -113,7 +113,7 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
113
113
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
114
114
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
115
115
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
116
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
117
117
|
placeholder: PropTypes.Requireable<string>;
|
|
118
118
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
119
119
|
onChangeWithObject: PropTypes.Requireable<boolean>;
|
|
@@ -46,15 +46,15 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
46
46
|
disabled: PropTypes.Requireable<boolean>;
|
|
47
47
|
prefixCls: PropTypes.Requireable<string>;
|
|
48
48
|
style: PropTypes.Requireable<object>;
|
|
49
|
-
size: PropTypes.Requireable<
|
|
50
|
-
type: PropTypes.Requireable<
|
|
49
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
50
|
+
type: PropTypes.Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
|
|
51
51
|
block: PropTypes.Requireable<boolean>;
|
|
52
52
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
53
|
onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
54
|
circle: PropTypes.Requireable<boolean>;
|
|
55
55
|
loading: PropTypes.Requireable<boolean>;
|
|
56
|
-
htmlType: PropTypes.Requireable<
|
|
57
|
-
theme: PropTypes.Requireable<
|
|
56
|
+
htmlType: PropTypes.Requireable<"button" | "reset" | "submit">;
|
|
57
|
+
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
58
58
|
className: PropTypes.Requireable<string>;
|
|
59
59
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
60
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -16,8 +16,8 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
16
16
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
17
17
|
disabled: PropTypes.Requireable<boolean>;
|
|
18
18
|
type: PropTypes.Requireable<string>;
|
|
19
|
-
size: PropTypes.Requireable<
|
|
20
|
-
theme: PropTypes.Requireable<
|
|
19
|
+
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
20
|
+
theme: PropTypes.Requireable<"solid" | "light" | "borderless">;
|
|
21
21
|
'aria-label': PropTypes.Requireable<string>;
|
|
22
22
|
};
|
|
23
23
|
static defaultProps: {
|
package/lib/es/button/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonProps as BaseButtonProps } from './Button';
|
|
3
2
|
import { IconButtonProps } from '../iconButton';
|
|
4
3
|
export { ButtonProps as BaseButtonProps, HtmlType, Size, Theme, Type } from './Button';
|
|
5
4
|
export { HorizontalPaddingType } from '../iconButton';
|
|
6
5
|
export { ButtonGroupProps } from './buttonGroup';
|
|
7
6
|
export { SplitButtonGroupProps } from './splitButtonGroup';
|
|
8
|
-
export interface ButtonProps extends IconButtonProps
|
|
7
|
+
export interface ButtonProps extends IconButtonProps {
|
|
9
8
|
}
|
|
10
9
|
declare class Button extends React.PureComponent<ButtonProps> {
|
|
11
10
|
static propTypes: {
|
|
@@ -18,18 +17,18 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
18
17
|
noHorizontalPadding: import("prop-types").Requireable<string | boolean | any[]>;
|
|
19
18
|
children: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
20
19
|
theme: import("prop-types").Requireable<string>;
|
|
21
|
-
iconPosition: import("prop-types").Requireable<
|
|
20
|
+
iconPosition: import("prop-types").Requireable<"left" | "right">;
|
|
22
21
|
className: import("prop-types").Requireable<string>;
|
|
23
22
|
onMouseEnter: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
24
23
|
onMouseLeave: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
25
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
26
|
-
size: import("prop-types").Requireable<
|
|
27
|
-
type: import("prop-types").Requireable<
|
|
25
|
+
size: import("prop-types").Requireable<"default" | "small" | "large">;
|
|
26
|
+
type: import("prop-types").Requireable<"warning" | "primary" | "tertiary" | "secondary" | "danger">;
|
|
28
27
|
block: import("prop-types").Requireable<boolean>;
|
|
29
28
|
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
30
29
|
onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
31
30
|
circle: import("prop-types").Requireable<boolean>;
|
|
32
|
-
htmlType: import("prop-types").Requireable<
|
|
31
|
+
htmlType: import("prop-types").Requireable<"button" | "reset" | "submit">;
|
|
33
32
|
'aria-label': import("prop-types").Requireable<string>;
|
|
34
33
|
};
|
|
35
34
|
constructor(props?: {});
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import _isFunction from "lodash/isFunction";
|
|
|
5
5
|
import _isEmpty from "lodash/isEmpty";
|
|
6
6
|
import _isString from "lodash/isString";
|
|
7
7
|
import _isEqual from "lodash/isEqual";
|
|
8
|
+
import _isSet from "lodash/isSet";
|
|
8
9
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
9
10
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
10
11
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
@@ -722,6 +723,10 @@ class Cascader extends BaseComponent {
|
|
|
722
723
|
realKeys = formatKeys;
|
|
723
724
|
}
|
|
724
725
|
|
|
726
|
+
if (_isSet(realKeys)) {
|
|
727
|
+
realKeys = [...realKeys];
|
|
728
|
+
}
|
|
729
|
+
|
|
725
730
|
const calRes = calcCheckedKeys(_flatten(realKeys), keyEntities);
|
|
726
731
|
const checkedKeys = new _Set(calRes.checkedKeys);
|
|
727
732
|
const halfCheckedKeys = new _Set(calRes.halfCheckedKeys); // disableStrictly
|
|
@@ -58,7 +58,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
58
58
|
render: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
59
59
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
60
60
|
visible: PropTypes.Requireable<boolean>;
|
|
61
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
61
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
62
62
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
63
63
|
mouseEnterDelay: PropTypes.Requireable<number>;
|
|
64
64
|
mouseLeaveDelay: PropTypes.Requireable<number>;
|
|
@@ -80,7 +80,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
80
80
|
emptyContent?: React.ReactNode;
|
|
81
81
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
82
82
|
zIndex?: number;
|
|
83
|
-
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
|
|
83
|
+
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
84
84
|
onSearch?: (value: string) => void;
|
|
85
85
|
dropdownClassName?: string;
|
|
86
86
|
dropdownStyle?: React.CSSProperties;
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -77,8 +77,8 @@ class Form extends BaseComponent {
|
|
|
77
77
|
notifySubmitFail: (errors, values) => {
|
|
78
78
|
this.props.onSubmitFail(errors, values);
|
|
79
79
|
},
|
|
80
|
-
forceUpdate:
|
|
81
|
-
this.forceUpdate();
|
|
80
|
+
forceUpdate: callback => {
|
|
81
|
+
this.forceUpdate(callback);
|
|
82
82
|
},
|
|
83
83
|
notifyChange: formState => {
|
|
84
84
|
this.props.onChange(formState);
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
28
28
|
emptyContent?: import("react").ReactNode;
|
|
29
29
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
30
30
|
zIndex?: number;
|
|
31
|
-
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
|
|
31
|
+
position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
|
|
32
32
|
onSearch?: (value: string) => void;
|
|
33
33
|
dropdownClassName?: string;
|
|
34
34
|
dropdownStyle?: import("react").CSSProperties;
|
|
@@ -19,7 +19,7 @@ export interface IconButtonProps extends ButtonProps {
|
|
|
19
19
|
}
|
|
20
20
|
declare class IconButton extends PureComponent<IconButtonProps> {
|
|
21
21
|
static defaultProps: {
|
|
22
|
-
iconPosition:
|
|
22
|
+
iconPosition: "left";
|
|
23
23
|
prefixCls: string;
|
|
24
24
|
loading: boolean;
|
|
25
25
|
noHorizontalPadding: boolean;
|
|
@@ -36,7 +36,7 @@ declare class IconButton extends PureComponent<IconButtonProps> {
|
|
|
36
36
|
noHorizontalPadding: PropTypes.Requireable<string | boolean | any[]>;
|
|
37
37
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
38
38
|
theme: PropTypes.Requireable<string>;
|
|
39
|
-
iconPosition: PropTypes.Requireable<
|
|
39
|
+
iconPosition: PropTypes.Requireable<"left" | "right">;
|
|
40
40
|
className: PropTypes.Requireable<string>;
|
|
41
41
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
42
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
package/lib/es/select/index.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
165
165
|
emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
166
166
|
onDropdownVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
167
167
|
zIndex: PropTypes.Requireable<number>;
|
|
168
|
-
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
|
|
168
|
+
position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
|
|
169
169
|
onSearch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
170
170
|
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
171
171
|
dropdownClassName: PropTypes.Requireable<string>;
|
|
@@ -243,8 +243,8 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
243
243
|
renderOption(option: OptionProps, optionIndex: number, style?: React.CSSProperties): any;
|
|
244
244
|
renderCreateOption(option: OptionProps, isFocused: boolean, optionIndex: number, style: React.CSSProperties): JSX.Element;
|
|
245
245
|
onOptionHover(optionIndex: number): void;
|
|
246
|
-
renderWithGroup(
|
|
247
|
-
renderVirtualizeList(
|
|
246
|
+
renderWithGroup(visibleOptions: OptionProps[]): JSX.Element[];
|
|
247
|
+
renderVirtualizeList(visibleOptions: OptionProps[]): JSX.Element;
|
|
248
248
|
renderOptions(children?: React.ReactNode): JSX.Element;
|
|
249
249
|
renderSingleSelection(selections: Map<OptionProps['label'], any>, filterable: boolean): JSX.Element;
|
|
250
250
|
renderMultipleSelection(selections: Map<OptionProps['label'], any>, filterable: boolean): JSX.Element;
|
package/lib/es/select/index.js
CHANGED
|
@@ -285,11 +285,19 @@ class Select extends BaseComponent {
|
|
|
285
285
|
el.focus();
|
|
286
286
|
} catch (error) {}
|
|
287
287
|
},
|
|
288
|
-
updateScrollTop:
|
|
289
|
-
var
|
|
288
|
+
updateScrollTop: index => {
|
|
289
|
+
var _context10, _context11;
|
|
290
290
|
|
|
291
291
|
// eslint-disable-next-line max-len
|
|
292
|
-
let
|
|
292
|
+
let optionClassName = ".".concat(prefixcls, "-option-selected");
|
|
293
|
+
|
|
294
|
+
if (index !== undefined) {
|
|
295
|
+
var _context9;
|
|
296
|
+
|
|
297
|
+
optionClassName = _concatInstanceProperty(_context9 = ".".concat(prefixcls, "-option:nth-child(")).call(_context9, index, ")");
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
let destNode = document.querySelector(_concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = "#".concat(prefixcls, "-")).call(_context11, this.selectOptionListID, " ")).call(_context10, optionClassName));
|
|
293
301
|
|
|
294
302
|
if (_Array$isArray(destNode)) {
|
|
295
303
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -317,11 +325,11 @@ class Select extends BaseComponent {
|
|
|
317
325
|
}
|
|
318
326
|
|
|
319
327
|
componentDidUpdate(prevProps, prevState) {
|
|
320
|
-
var
|
|
328
|
+
var _context12, _context13;
|
|
321
329
|
|
|
322
|
-
const prevChildrenKeys = _mapInstanceProperty(
|
|
330
|
+
const prevChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(prevProps.children)).call(_context12, child => child.key);
|
|
323
331
|
|
|
324
|
-
const nowChildrenKeys = _mapInstanceProperty(
|
|
332
|
+
const nowChildrenKeys = _mapInstanceProperty(_context13 = React.Children.toArray(this.props.children)).call(_context13, child => child.key);
|
|
325
333
|
|
|
326
334
|
let isOptionsChanged = false;
|
|
327
335
|
|
|
@@ -515,34 +523,30 @@ class Select extends BaseComponent {
|
|
|
515
523
|
this.foundation.handleOptionMouseEnter(optionIndex);
|
|
516
524
|
}
|
|
517
525
|
|
|
518
|
-
renderWithGroup(
|
|
526
|
+
renderWithGroup(visibleOptions) {
|
|
519
527
|
const content = [];
|
|
520
528
|
const groupStatus = new _Map();
|
|
521
529
|
|
|
522
|
-
_forEachInstanceProperty(
|
|
530
|
+
_forEachInstanceProperty(visibleOptions).call(visibleOptions, (option, optionIndex) => {
|
|
523
531
|
const parentGroup = option._parentGroup;
|
|
524
532
|
const optionContent = this.renderOption(option, optionIndex);
|
|
525
533
|
|
|
526
|
-
if (parentGroup && groupStatus.has(parentGroup.label)) {
|
|
527
|
-
// group content already insert
|
|
528
|
-
content.push(optionContent);
|
|
529
|
-
} else if (parentGroup) {
|
|
534
|
+
if (parentGroup && !groupStatus.has(parentGroup.label)) {
|
|
535
|
+
// when use with OptionGroup and group content not already insert
|
|
530
536
|
const groupContent = /*#__PURE__*/React.createElement(OptionGroup, _Object$assign({}, parentGroup, {
|
|
531
537
|
key: parentGroup.label
|
|
532
538
|
}));
|
|
533
539
|
groupStatus.set(parentGroup.label, true);
|
|
534
540
|
content.push(groupContent);
|
|
535
|
-
content.push(optionContent);
|
|
536
|
-
} else {
|
|
537
|
-
// when not use with OptionGroup
|
|
538
|
-
content.push(optionContent);
|
|
539
541
|
}
|
|
542
|
+
|
|
543
|
+
content.push(optionContent);
|
|
540
544
|
});
|
|
541
545
|
|
|
542
546
|
return content;
|
|
543
547
|
}
|
|
544
548
|
|
|
545
|
-
renderVirtualizeList(
|
|
549
|
+
renderVirtualizeList(visibleOptions) {
|
|
546
550
|
const {
|
|
547
551
|
virtualize
|
|
548
552
|
} = this.props;
|
|
@@ -557,10 +561,10 @@ class Select extends BaseComponent {
|
|
|
557
561
|
return /*#__PURE__*/React.createElement(List, {
|
|
558
562
|
ref: this.virtualizeListRef,
|
|
559
563
|
height: height || numbers.LIST_HEIGHT,
|
|
560
|
-
itemCount:
|
|
564
|
+
itemCount: visibleOptions.length,
|
|
561
565
|
itemSize: itemSize,
|
|
562
566
|
itemData: {
|
|
563
|
-
|
|
567
|
+
visibleOptions,
|
|
564
568
|
renderOption: this.renderOption
|
|
565
569
|
},
|
|
566
570
|
width: width || '100%',
|
|
@@ -571,7 +575,7 @@ class Select extends BaseComponent {
|
|
|
571
575
|
}
|
|
572
576
|
|
|
573
577
|
renderOptions(children) {
|
|
574
|
-
var
|
|
578
|
+
var _context14;
|
|
575
579
|
|
|
576
580
|
const {
|
|
577
581
|
dropdownMinWidth,
|
|
@@ -591,12 +595,12 @@ class Select extends BaseComponent {
|
|
|
591
595
|
multiple
|
|
592
596
|
} = this.props; // Do a filter first, instead of directly judging in forEach, so that the focusIndex can correspond to
|
|
593
597
|
|
|
594
|
-
const
|
|
598
|
+
const visibleOptions = _filterInstanceProperty(options).call(options, item => item._show);
|
|
595
599
|
|
|
596
|
-
let listContent = this.renderWithGroup(
|
|
600
|
+
let listContent = this.renderWithGroup(visibleOptions);
|
|
597
601
|
|
|
598
602
|
if (virtualize) {
|
|
599
|
-
listContent = this.renderVirtualizeList(
|
|
603
|
+
listContent = this.renderVirtualizeList(visibleOptions);
|
|
600
604
|
}
|
|
601
605
|
|
|
602
606
|
const style = _Object$assign({
|
|
@@ -609,7 +613,7 @@ class Select extends BaseComponent {
|
|
|
609
613
|
});
|
|
610
614
|
const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
|
|
611
615
|
return /*#__PURE__*/React.createElement("div", {
|
|
612
|
-
id: _concatInstanceProperty(
|
|
616
|
+
id: _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
|
|
613
617
|
className: dropdownClassName,
|
|
614
618
|
style: style
|
|
615
619
|
}, outerTopSlot, /*#__PURE__*/React.createElement("div", {
|
|
@@ -840,7 +844,7 @@ class Select extends BaseComponent {
|
|
|
840
844
|
}
|
|
841
845
|
|
|
842
846
|
renderSelection() {
|
|
843
|
-
var
|
|
847
|
+
var _context15;
|
|
844
848
|
|
|
845
849
|
const {
|
|
846
850
|
disabled,
|
|
@@ -924,7 +928,7 @@ class Select extends BaseComponent {
|
|
|
924
928
|
role: "combobox",
|
|
925
929
|
"aria-disabled": disabled,
|
|
926
930
|
"aria-expanded": isOpen,
|
|
927
|
-
"aria-controls": _concatInstanceProperty(
|
|
931
|
+
"aria-controls": _concatInstanceProperty(_context15 = "".concat(prefixcls, "-")).call(_context15, this.selectOptionListID),
|
|
928
932
|
"aria-haspopup": "listbox",
|
|
929
933
|
"aria-label": "select value",
|
|
930
934
|
"aria-invalid": this.props['aria-invalid'],
|
package/lib/es/select/option.js
CHANGED
|
@@ -36,9 +36,9 @@ class Option extends PureComponent {
|
|
|
36
36
|
const {
|
|
37
37
|
props
|
|
38
38
|
} = this;
|
|
39
|
-
const
|
|
39
|
+
const isDisabled = props.disabled;
|
|
40
40
|
|
|
41
|
-
if (!
|
|
41
|
+
if (!isDisabled) {
|
|
42
42
|
props.onSelect(_Object$assign(_Object$assign({}, rest), {
|
|
43
43
|
value,
|
|
44
44
|
label: label || children
|