@douyinfe/semi-ui 2.43.0-alpha.0 → 2.43.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/umd/semi-ui.js +26654 -26612
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/cascader/index.js +2 -4
- package/lib/cjs/cascader/item.d.ts +1 -5
- package/lib/cjs/cascader/item.js +55 -92
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/image/preview.js +1 -1
- package/lib/cjs/modal/confirm.d.ts +3 -3
- package/lib/cjs/tree/treeNode.js +3 -1
- package/lib/cjs/upload/index.d.ts +6 -0
- package/lib/cjs/upload/index.js +19 -0
- package/lib/es/cascader/index.js +2 -4
- package/lib/es/cascader/item.d.ts +1 -5
- package/lib/es/cascader/item.js +55 -92
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/image/preview.js +1 -1
- package/lib/es/modal/confirm.d.ts +3 -3
- package/lib/es/tree/treeNode.js +3 -1
- package/lib/es/upload/index.d.ts +6 -0
- package/lib/es/upload/index.js +19 -0
- package/package.json +8 -8
- package/lib/cjs/cascader/virtualRow.d.ts +0 -8
- package/lib/cjs/cascader/virtualRow.js +0 -21
- package/lib/es/cascader/virtualRow.d.ts +0 -8
- package/lib/es/cascader/virtualRow.js +0 -14
|
@@ -125,8 +125,7 @@ class Cascader extends _baseComponent.default {
|
|
|
125
125
|
bottomSlot,
|
|
126
126
|
showNext,
|
|
127
127
|
multiple,
|
|
128
|
-
filterRender
|
|
129
|
-
virtualizeInSearch
|
|
128
|
+
filterRender
|
|
130
129
|
} = this.props;
|
|
131
130
|
const searchable = Boolean(filterTreeNode) && isSearching;
|
|
132
131
|
const popoverCls = (0, _classnames.default)(dropdownClassName, `${prefixcls}-popover`);
|
|
@@ -154,8 +153,7 @@ class Cascader extends _baseComponent.default {
|
|
|
154
153
|
multiple: multiple,
|
|
155
154
|
checkedKeys: checkedKeys,
|
|
156
155
|
halfCheckedKeys: halfCheckedKeys,
|
|
157
|
-
filterRender: filterRender
|
|
158
|
-
virtualize: virtualizeInSearch
|
|
156
|
+
filterRender: filterRender
|
|
159
157
|
}), bottomSlot);
|
|
160
158
|
return content;
|
|
161
159
|
};
|
|
@@ -2,7 +2,7 @@ import React, { PureComponent, ReactNode } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ContextValue } from '../configProvider/context';
|
|
4
4
|
import { CheckboxEvent } from '../checkbox';
|
|
5
|
-
import { BasicCascaderData, BasicEntity, ShowNextType, BasicData
|
|
5
|
+
import { BasicCascaderData, BasicEntity, ShowNextType, BasicData } from '@douyinfe/semi-foundation/lib/cjs/cascader/foundation';
|
|
6
6
|
export interface CascaderData extends BasicCascaderData {
|
|
7
7
|
label: React.ReactNode;
|
|
8
8
|
}
|
|
@@ -52,7 +52,6 @@ export interface CascaderItemProps {
|
|
|
52
52
|
checkedKeys: Set<string>;
|
|
53
53
|
halfCheckedKeys: Set<string>;
|
|
54
54
|
filterRender?: (props: FilterRenderProps) => ReactNode;
|
|
55
|
-
virtualize?: Virtualize;
|
|
56
55
|
}
|
|
57
56
|
export default class Item extends PureComponent<CascaderItemProps> {
|
|
58
57
|
static contextType: React.Context<ContextValue>;
|
|
@@ -69,7 +68,6 @@ export default class Item extends PureComponent<CascaderItemProps> {
|
|
|
69
68
|
onItemCheckboxClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
70
69
|
separator: PropTypes.Requireable<string>;
|
|
71
70
|
keyword: PropTypes.Requireable<string>;
|
|
72
|
-
virtualize: PropTypes.Requireable<object>;
|
|
73
71
|
};
|
|
74
72
|
static defaultProps: {
|
|
75
73
|
empty: boolean;
|
|
@@ -89,9 +87,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
|
|
|
89
87
|
};
|
|
90
88
|
renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
|
|
91
89
|
highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
|
|
92
|
-
renderFlattenOptionItem: (data: Data, index?: number, style?: any) => JSX.Element;
|
|
93
90
|
renderFlattenOption: (data: Data[]) => JSX.Element;
|
|
94
|
-
renderVirtualizeList: (visibleOptions: any) => JSX.Element;
|
|
95
91
|
renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
|
|
96
92
|
renderEmpty(): JSX.Element;
|
|
97
93
|
render(): JSX.Element;
|
package/lib/cjs/cascader/item.js
CHANGED
|
@@ -15,8 +15,6 @@ var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer")
|
|
|
15
15
|
var _semiIcons = require("@douyinfe/semi-icons");
|
|
16
16
|
var _spin = _interopRequireDefault(require("../spin"));
|
|
17
17
|
var _checkbox = _interopRequireDefault(require("../checkbox"));
|
|
18
|
-
var _reactWindow = require("react-window");
|
|
19
|
-
var _virtualRow = _interopRequireDefault(require("./virtualRow"));
|
|
20
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -140,105 +138,71 @@ class Item extends _react.PureComponent {
|
|
|
140
138
|
});
|
|
141
139
|
return content;
|
|
142
140
|
};
|
|
143
|
-
this.
|
|
144
|
-
var _a;
|
|
141
|
+
this.renderFlattenOption = data => {
|
|
145
142
|
const {
|
|
146
143
|
multiple,
|
|
147
144
|
selectedKeys,
|
|
148
145
|
checkedKeys,
|
|
149
146
|
halfCheckedKeys,
|
|
150
147
|
keyword,
|
|
151
|
-
filterRender
|
|
152
|
-
virtualize
|
|
153
|
-
} = this.props;
|
|
154
|
-
const {
|
|
155
|
-
searchText,
|
|
156
|
-
key,
|
|
157
|
-
disabled,
|
|
158
|
-
pathData
|
|
159
|
-
} = data;
|
|
160
|
-
const selected = selectedKeys.has(key);
|
|
161
|
-
const className = (0, _classnames.default)(prefixcls, {
|
|
162
|
-
[`${prefixcls}-flatten`]: true && !filterRender,
|
|
163
|
-
[`${prefixcls}-disabled`]: disabled,
|
|
164
|
-
[`${prefixcls}-select`]: selected && !multiple
|
|
165
|
-
});
|
|
166
|
-
const onClick = e => {
|
|
167
|
-
this.onClick(e, data);
|
|
168
|
-
};
|
|
169
|
-
const onKeyPress = e => this.handleItemEnterPress(e, data);
|
|
170
|
-
const onCheck = e => this.onCheckboxChange(e, data);
|
|
171
|
-
if (filterRender) {
|
|
172
|
-
const props = {
|
|
173
|
-
className,
|
|
174
|
-
inputValue: keyword,
|
|
175
|
-
disabled,
|
|
176
|
-
data: pathData,
|
|
177
|
-
checkStatus: {
|
|
178
|
-
checked: checkedKeys.has(data.key),
|
|
179
|
-
halfChecked: halfCheckedKeys.has(data.key)
|
|
180
|
-
},
|
|
181
|
-
selected,
|
|
182
|
-
onClick,
|
|
183
|
-
onCheck
|
|
184
|
-
};
|
|
185
|
-
const item = filterRender(props);
|
|
186
|
-
const otherProps = virtualize ? {
|
|
187
|
-
key,
|
|
188
|
-
style: Object.assign(Object.assign({}, (_a = item.props.style) !== null && _a !== void 0 ? _a : {}), style)
|
|
189
|
-
} : {
|
|
190
|
-
key
|
|
191
|
-
};
|
|
192
|
-
return /*#__PURE__*/_react.default.cloneElement(item, otherProps);
|
|
193
|
-
}
|
|
194
|
-
return /*#__PURE__*/_react.default.createElement("li", {
|
|
195
|
-
role: 'menuitem',
|
|
196
|
-
className: className,
|
|
197
|
-
style: style,
|
|
198
|
-
key: key,
|
|
199
|
-
onClick: onClick,
|
|
200
|
-
onKeyPress: onKeyPress
|
|
201
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
202
|
-
className: `${prefixcls}-label`
|
|
203
|
-
}, !multiple && this.renderIcon('empty'), multiple && /*#__PURE__*/_react.default.createElement(_checkbox.default, {
|
|
204
|
-
onChange: onCheck,
|
|
205
|
-
disabled: disabled,
|
|
206
|
-
indeterminate: halfCheckedKeys.has(data.key),
|
|
207
|
-
checked: checkedKeys.has(data.key),
|
|
208
|
-
className: `${prefixcls}-label-checkbox`
|
|
209
|
-
}), this.highlight(searchText)));
|
|
210
|
-
};
|
|
211
|
-
this.renderFlattenOption = data => {
|
|
212
|
-
const {
|
|
213
|
-
virtualize
|
|
148
|
+
filterRender
|
|
214
149
|
} = this.props;
|
|
215
150
|
const content = /*#__PURE__*/_react.default.createElement("ul", {
|
|
216
151
|
className: `${prefixcls}-list`,
|
|
217
152
|
key: 'flatten-list'
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
153
|
+
}, data.map(item => {
|
|
154
|
+
const {
|
|
155
|
+
searchText,
|
|
156
|
+
key,
|
|
157
|
+
disabled,
|
|
158
|
+
pathData
|
|
159
|
+
} = item;
|
|
160
|
+
const selected = selectedKeys.has(key);
|
|
161
|
+
const className = (0, _classnames.default)(prefixcls, {
|
|
162
|
+
[`${prefixcls}-flatten`]: true && !filterRender,
|
|
163
|
+
[`${prefixcls}-disabled`]: disabled,
|
|
164
|
+
[`${prefixcls}-select`]: selected && !multiple
|
|
165
|
+
});
|
|
166
|
+
const onClick = e => {
|
|
167
|
+
this.onClick(e, item);
|
|
168
|
+
};
|
|
169
|
+
const onKeyPress = e => this.handleItemEnterPress(e, item);
|
|
170
|
+
const onCheck = e => this.onCheckboxChange(e, item);
|
|
171
|
+
if (filterRender) {
|
|
172
|
+
const props = {
|
|
173
|
+
className,
|
|
174
|
+
inputValue: keyword,
|
|
175
|
+
disabled,
|
|
176
|
+
data: pathData,
|
|
177
|
+
checkStatus: {
|
|
178
|
+
checked: checkedKeys.has(item.key),
|
|
179
|
+
halfChecked: halfCheckedKeys.has(item.key)
|
|
180
|
+
},
|
|
181
|
+
selected,
|
|
182
|
+
onClick,
|
|
183
|
+
onCheck
|
|
184
|
+
};
|
|
185
|
+
return /*#__PURE__*/_react.default.cloneElement(filterRender(props), {
|
|
186
|
+
key
|
|
187
|
+
});
|
|
240
188
|
}
|
|
241
|
-
|
|
189
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
190
|
+
role: 'menuitem',
|
|
191
|
+
className: className,
|
|
192
|
+
key: key,
|
|
193
|
+
onClick: onClick,
|
|
194
|
+
onKeyPress: onKeyPress
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
196
|
+
className: `${prefixcls}-label`
|
|
197
|
+
}, !multiple && this.renderIcon('empty'), multiple && /*#__PURE__*/_react.default.createElement(_checkbox.default, {
|
|
198
|
+
onChange: onCheck,
|
|
199
|
+
disabled: disabled,
|
|
200
|
+
indeterminate: halfCheckedKeys.has(item.key),
|
|
201
|
+
checked: checkedKeys.has(item.key),
|
|
202
|
+
className: `${prefixcls}-label-checkbox`
|
|
203
|
+
}), this.highlight(searchText)));
|
|
204
|
+
}));
|
|
205
|
+
return content;
|
|
242
206
|
};
|
|
243
207
|
}
|
|
244
208
|
renderItem(renderData) {
|
|
@@ -369,8 +333,7 @@ Item.propTypes = {
|
|
|
369
333
|
halfCheckedKeys: _propTypes.default.object,
|
|
370
334
|
onItemCheckboxClick: _propTypes.default.func,
|
|
371
335
|
separator: _propTypes.default.string,
|
|
372
|
-
keyword: _propTypes.default.string
|
|
373
|
-
virtualize: _propTypes.default.object
|
|
336
|
+
keyword: _propTypes.default.string
|
|
374
337
|
};
|
|
375
338
|
Item.defaultProps = {
|
|
376
339
|
empty: false
|
|
@@ -140,7 +140,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
140
140
|
preventScroll?: boolean;
|
|
141
141
|
showRestTagsPopover?: boolean;
|
|
142
142
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
143
|
-
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "
|
|
143
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
144
144
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
145
145
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
146
146
|
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>>;
|
package/lib/cjs/image/preview.js
CHANGED
|
@@ -46,8 +46,8 @@ class Preview extends _baseComponent.default {
|
|
|
46
46
|
if (item.isIntersecting && src) {
|
|
47
47
|
item.target.src = src;
|
|
48
48
|
item.target.removeAttribute("data-src");
|
|
49
|
+
this.previewObserver.unobserve(item.target);
|
|
49
50
|
}
|
|
50
|
-
this.previewObserver.unobserve(item.target);
|
|
51
51
|
});
|
|
52
52
|
}, {
|
|
53
53
|
root: document.querySelector(`#${this.previewGroupId}`),
|
|
@@ -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
|
mask?: boolean;
|
|
154
154
|
visible?: boolean;
|
|
155
155
|
zIndex?: number;
|
|
@@ -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
|
prefix?: string;
|
|
212
212
|
dangerouslySetInnerHTML?: {
|
|
213
213
|
__html: string | TrustedHTML;
|
package/lib/cjs/tree/treeNode.js
CHANGED
|
@@ -28,6 +28,7 @@ export interface UploadProps {
|
|
|
28
28
|
dragMainText?: ReactNode;
|
|
29
29
|
dragSubText?: ReactNode;
|
|
30
30
|
draggable?: boolean;
|
|
31
|
+
addOnPasting?: boolean;
|
|
31
32
|
fileList?: Array<FileItem>;
|
|
32
33
|
fileName?: string;
|
|
33
34
|
headers?: Record<string, any> | ((file: File) => Record<string, string>);
|
|
@@ -44,6 +45,7 @@ export interface UploadProps {
|
|
|
44
45
|
onClear?: () => void;
|
|
45
46
|
onDrop?: (e: Event, files: Array<File>, fileList: Array<FileItem>) => void;
|
|
46
47
|
onError?: (e: CustomError, file: File, fileList: Array<FileItem>, xhr: XMLHttpRequest) => void;
|
|
48
|
+
onPastingError?: (error: Error | PermissionStatus) => void;
|
|
47
49
|
onExceed?: (fileList: Array<File>) => void;
|
|
48
50
|
onFileChange?: (files: Array<File>) => void;
|
|
49
51
|
onOpenFileDialog?: () => void;
|
|
@@ -88,6 +90,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
88
90
|
static propTypes: {
|
|
89
91
|
accept: PropTypes.Requireable<string>;
|
|
90
92
|
action: PropTypes.Validator<string>;
|
|
93
|
+
addOnPasting: PropTypes.Requireable<boolean>;
|
|
91
94
|
afterUpload: PropTypes.Requireable<(...args: any[]) => any>;
|
|
92
95
|
beforeClear: PropTypes.Requireable<(...args: any[]) => any>;
|
|
93
96
|
beforeRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -128,6 +131,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
128
131
|
onRetry: PropTypes.Requireable<(...args: any[]) => any>;
|
|
129
132
|
onSizeError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
130
133
|
onSuccess: PropTypes.Requireable<(...args: any[]) => any>;
|
|
134
|
+
onPastingError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
131
135
|
previewFile: PropTypes.Requireable<(...args: any[]) => any>;
|
|
132
136
|
prompt: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
133
137
|
promptPosition: PropTypes.Requireable<"left" | "right" | "bottom">;
|
|
@@ -168,6 +172,8 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
168
172
|
foundation: UploadFoundation;
|
|
169
173
|
inputRef: RefObject<HTMLInputElement>;
|
|
170
174
|
replaceInputRef: RefObject<HTMLInputElement>;
|
|
175
|
+
pastingCb: null | ((params: any) => void);
|
|
176
|
+
componentDidMount(): void;
|
|
171
177
|
componentWillUnmount(): void;
|
|
172
178
|
onClick: () => void;
|
|
173
179
|
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
package/lib/cjs/upload/index.js
CHANGED
|
@@ -446,6 +446,19 @@ class Upload extends _baseComponent.default {
|
|
|
446
446
|
replaceInputKey: Math.random()
|
|
447
447
|
}));
|
|
448
448
|
},
|
|
449
|
+
isMac: () => {
|
|
450
|
+
return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
451
|
+
},
|
|
452
|
+
registerPastingHandler: cb => {
|
|
453
|
+
document.body.addEventListener('keydown', cb);
|
|
454
|
+
this.pastingCb = cb;
|
|
455
|
+
},
|
|
456
|
+
unRegisterPastingHandler: () => {
|
|
457
|
+
if (this.pastingCb) {
|
|
458
|
+
document.body.removeEventListener('keydown', this.pastingCb);
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
notifyPastingError: error => this.props.onPastingError(error),
|
|
449
462
|
updateDragAreaStatus: dragAreaStatus => this.setState({
|
|
450
463
|
dragAreaStatus
|
|
451
464
|
}),
|
|
@@ -470,6 +483,9 @@ class Upload extends _baseComponent.default {
|
|
|
470
483
|
notifyBeforeClear: fileList => this.props.beforeClear(fileList)
|
|
471
484
|
});
|
|
472
485
|
}
|
|
486
|
+
componentDidMount() {
|
|
487
|
+
this.foundation.init();
|
|
488
|
+
}
|
|
473
489
|
componentWillUnmount() {
|
|
474
490
|
this.foundation.destroy();
|
|
475
491
|
}
|
|
@@ -545,6 +561,7 @@ class Upload extends _baseComponent.default {
|
|
|
545
561
|
Upload.propTypes = {
|
|
546
562
|
accept: _propTypes.default.string,
|
|
547
563
|
action: _propTypes.default.string.isRequired,
|
|
564
|
+
addOnPasting: _propTypes.default.bool,
|
|
548
565
|
afterUpload: _propTypes.default.func,
|
|
549
566
|
beforeClear: _propTypes.default.func,
|
|
550
567
|
beforeRemove: _propTypes.default.func,
|
|
@@ -585,6 +602,7 @@ Upload.propTypes = {
|
|
|
585
602
|
onRetry: _propTypes.default.func,
|
|
586
603
|
onSizeError: _propTypes.default.func,
|
|
587
604
|
onSuccess: _propTypes.default.func,
|
|
605
|
+
onPastingError: _propTypes.default.func,
|
|
588
606
|
previewFile: _propTypes.default.func,
|
|
589
607
|
prompt: _propTypes.default.node,
|
|
590
608
|
promptPosition: _propTypes.default.oneOf(_constants.strings.PROMPT_POSITION),
|
|
@@ -629,6 +647,7 @@ Upload.defaultProps = {
|
|
|
629
647
|
onRetry: _noop2.default,
|
|
630
648
|
onSizeError: _noop2.default,
|
|
631
649
|
onSuccess: _noop2.default,
|
|
650
|
+
onPastingError: _noop2.default,
|
|
632
651
|
promptPosition: 'right',
|
|
633
652
|
showClear: true,
|
|
634
653
|
showPicInfo: false,
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -116,8 +116,7 @@ class Cascader extends BaseComponent {
|
|
|
116
116
|
bottomSlot,
|
|
117
117
|
showNext,
|
|
118
118
|
multiple,
|
|
119
|
-
filterRender
|
|
120
|
-
virtualizeInSearch
|
|
119
|
+
filterRender
|
|
121
120
|
} = this.props;
|
|
122
121
|
const searchable = Boolean(filterTreeNode) && isSearching;
|
|
123
122
|
const popoverCls = cls(dropdownClassName, `${prefixcls}-popover`);
|
|
@@ -145,8 +144,7 @@ class Cascader extends BaseComponent {
|
|
|
145
144
|
multiple: multiple,
|
|
146
145
|
checkedKeys: checkedKeys,
|
|
147
146
|
halfCheckedKeys: halfCheckedKeys,
|
|
148
|
-
filterRender: filterRender
|
|
149
|
-
virtualize: virtualizeInSearch
|
|
147
|
+
filterRender: filterRender
|
|
150
148
|
}), bottomSlot);
|
|
151
149
|
return content;
|
|
152
150
|
};
|
|
@@ -2,7 +2,7 @@ import React, { PureComponent, ReactNode } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ContextValue } from '../configProvider/context';
|
|
4
4
|
import { CheckboxEvent } from '../checkbox';
|
|
5
|
-
import { BasicCascaderData, BasicEntity, ShowNextType, BasicData
|
|
5
|
+
import { BasicCascaderData, BasicEntity, ShowNextType, BasicData } from '@douyinfe/semi-foundation/lib/es/cascader/foundation';
|
|
6
6
|
export interface CascaderData extends BasicCascaderData {
|
|
7
7
|
label: React.ReactNode;
|
|
8
8
|
}
|
|
@@ -52,7 +52,6 @@ export interface CascaderItemProps {
|
|
|
52
52
|
checkedKeys: Set<string>;
|
|
53
53
|
halfCheckedKeys: Set<string>;
|
|
54
54
|
filterRender?: (props: FilterRenderProps) => ReactNode;
|
|
55
|
-
virtualize?: Virtualize;
|
|
56
55
|
}
|
|
57
56
|
export default class Item extends PureComponent<CascaderItemProps> {
|
|
58
57
|
static contextType: React.Context<ContextValue>;
|
|
@@ -69,7 +68,6 @@ export default class Item extends PureComponent<CascaderItemProps> {
|
|
|
69
68
|
onItemCheckboxClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
70
69
|
separator: PropTypes.Requireable<string>;
|
|
71
70
|
keyword: PropTypes.Requireable<string>;
|
|
72
|
-
virtualize: PropTypes.Requireable<object>;
|
|
73
71
|
};
|
|
74
72
|
static defaultProps: {
|
|
75
73
|
empty: boolean;
|
|
@@ -89,9 +87,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
|
|
|
89
87
|
};
|
|
90
88
|
renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
|
|
91
89
|
highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
|
|
92
|
-
renderFlattenOptionItem: (data: Data, index?: number, style?: any) => JSX.Element;
|
|
93
90
|
renderFlattenOption: (data: Data[]) => JSX.Element;
|
|
94
|
-
renderVirtualizeList: (visibleOptions: any) => JSX.Element;
|
|
95
91
|
renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
|
|
96
92
|
renderEmpty(): JSX.Element;
|
|
97
93
|
render(): JSX.Element;
|
package/lib/es/cascader/item.js
CHANGED
|
@@ -9,8 +9,6 @@ import LocaleConsumer from '../locale/localeConsumer';
|
|
|
9
9
|
import { IconChevronRight, IconTick } from '@douyinfe/semi-icons';
|
|
10
10
|
import Spin from '../spin';
|
|
11
11
|
import Checkbox from '../checkbox';
|
|
12
|
-
import { FixedSizeList as List } from 'react-window';
|
|
13
|
-
import VirtualRow from './virtualRow';
|
|
14
12
|
const prefixcls = cssClasses.PREFIX_OPTION;
|
|
15
13
|
export default class Item extends PureComponent {
|
|
16
14
|
constructor() {
|
|
@@ -131,105 +129,71 @@ export default class Item extends PureComponent {
|
|
|
131
129
|
});
|
|
132
130
|
return content;
|
|
133
131
|
};
|
|
134
|
-
this.
|
|
135
|
-
var _a;
|
|
132
|
+
this.renderFlattenOption = data => {
|
|
136
133
|
const {
|
|
137
134
|
multiple,
|
|
138
135
|
selectedKeys,
|
|
139
136
|
checkedKeys,
|
|
140
137
|
halfCheckedKeys,
|
|
141
138
|
keyword,
|
|
142
|
-
filterRender
|
|
143
|
-
virtualize
|
|
144
|
-
} = this.props;
|
|
145
|
-
const {
|
|
146
|
-
searchText,
|
|
147
|
-
key,
|
|
148
|
-
disabled,
|
|
149
|
-
pathData
|
|
150
|
-
} = data;
|
|
151
|
-
const selected = selectedKeys.has(key);
|
|
152
|
-
const className = cls(prefixcls, {
|
|
153
|
-
[`${prefixcls}-flatten`]: true && !filterRender,
|
|
154
|
-
[`${prefixcls}-disabled`]: disabled,
|
|
155
|
-
[`${prefixcls}-select`]: selected && !multiple
|
|
156
|
-
});
|
|
157
|
-
const onClick = e => {
|
|
158
|
-
this.onClick(e, data);
|
|
159
|
-
};
|
|
160
|
-
const onKeyPress = e => this.handleItemEnterPress(e, data);
|
|
161
|
-
const onCheck = e => this.onCheckboxChange(e, data);
|
|
162
|
-
if (filterRender) {
|
|
163
|
-
const props = {
|
|
164
|
-
className,
|
|
165
|
-
inputValue: keyword,
|
|
166
|
-
disabled,
|
|
167
|
-
data: pathData,
|
|
168
|
-
checkStatus: {
|
|
169
|
-
checked: checkedKeys.has(data.key),
|
|
170
|
-
halfChecked: halfCheckedKeys.has(data.key)
|
|
171
|
-
},
|
|
172
|
-
selected,
|
|
173
|
-
onClick,
|
|
174
|
-
onCheck
|
|
175
|
-
};
|
|
176
|
-
const item = filterRender(props);
|
|
177
|
-
const otherProps = virtualize ? {
|
|
178
|
-
key,
|
|
179
|
-
style: Object.assign(Object.assign({}, (_a = item.props.style) !== null && _a !== void 0 ? _a : {}), style)
|
|
180
|
-
} : {
|
|
181
|
-
key
|
|
182
|
-
};
|
|
183
|
-
return /*#__PURE__*/React.cloneElement(item, otherProps);
|
|
184
|
-
}
|
|
185
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
186
|
-
role: 'menuitem',
|
|
187
|
-
className: className,
|
|
188
|
-
style: style,
|
|
189
|
-
key: key,
|
|
190
|
-
onClick: onClick,
|
|
191
|
-
onKeyPress: onKeyPress
|
|
192
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
193
|
-
className: `${prefixcls}-label`
|
|
194
|
-
}, !multiple && this.renderIcon('empty'), multiple && /*#__PURE__*/React.createElement(Checkbox, {
|
|
195
|
-
onChange: onCheck,
|
|
196
|
-
disabled: disabled,
|
|
197
|
-
indeterminate: halfCheckedKeys.has(data.key),
|
|
198
|
-
checked: checkedKeys.has(data.key),
|
|
199
|
-
className: `${prefixcls}-label-checkbox`
|
|
200
|
-
}), this.highlight(searchText)));
|
|
201
|
-
};
|
|
202
|
-
this.renderFlattenOption = data => {
|
|
203
|
-
const {
|
|
204
|
-
virtualize
|
|
139
|
+
filterRender
|
|
205
140
|
} = this.props;
|
|
206
141
|
const content = /*#__PURE__*/React.createElement("ul", {
|
|
207
142
|
className: `${prefixcls}-list`,
|
|
208
143
|
key: 'flatten-list'
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
144
|
+
}, data.map(item => {
|
|
145
|
+
const {
|
|
146
|
+
searchText,
|
|
147
|
+
key,
|
|
148
|
+
disabled,
|
|
149
|
+
pathData
|
|
150
|
+
} = item;
|
|
151
|
+
const selected = selectedKeys.has(key);
|
|
152
|
+
const className = cls(prefixcls, {
|
|
153
|
+
[`${prefixcls}-flatten`]: true && !filterRender,
|
|
154
|
+
[`${prefixcls}-disabled`]: disabled,
|
|
155
|
+
[`${prefixcls}-select`]: selected && !multiple
|
|
156
|
+
});
|
|
157
|
+
const onClick = e => {
|
|
158
|
+
this.onClick(e, item);
|
|
159
|
+
};
|
|
160
|
+
const onKeyPress = e => this.handleItemEnterPress(e, item);
|
|
161
|
+
const onCheck = e => this.onCheckboxChange(e, item);
|
|
162
|
+
if (filterRender) {
|
|
163
|
+
const props = {
|
|
164
|
+
className,
|
|
165
|
+
inputValue: keyword,
|
|
166
|
+
disabled,
|
|
167
|
+
data: pathData,
|
|
168
|
+
checkStatus: {
|
|
169
|
+
checked: checkedKeys.has(item.key),
|
|
170
|
+
halfChecked: halfCheckedKeys.has(item.key)
|
|
171
|
+
},
|
|
172
|
+
selected,
|
|
173
|
+
onClick,
|
|
174
|
+
onCheck
|
|
175
|
+
};
|
|
176
|
+
return /*#__PURE__*/React.cloneElement(filterRender(props), {
|
|
177
|
+
key
|
|
178
|
+
});
|
|
231
179
|
}
|
|
232
|
-
|
|
180
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
181
|
+
role: 'menuitem',
|
|
182
|
+
className: className,
|
|
183
|
+
key: key,
|
|
184
|
+
onClick: onClick,
|
|
185
|
+
onKeyPress: onKeyPress
|
|
186
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
187
|
+
className: `${prefixcls}-label`
|
|
188
|
+
}, !multiple && this.renderIcon('empty'), multiple && /*#__PURE__*/React.createElement(Checkbox, {
|
|
189
|
+
onChange: onCheck,
|
|
190
|
+
disabled: disabled,
|
|
191
|
+
indeterminate: halfCheckedKeys.has(item.key),
|
|
192
|
+
checked: checkedKeys.has(item.key),
|
|
193
|
+
className: `${prefixcls}-label-checkbox`
|
|
194
|
+
}), this.highlight(searchText)));
|
|
195
|
+
}));
|
|
196
|
+
return content;
|
|
233
197
|
};
|
|
234
198
|
}
|
|
235
199
|
renderItem(renderData) {
|
|
@@ -359,8 +323,7 @@ Item.propTypes = {
|
|
|
359
323
|
halfCheckedKeys: PropTypes.object,
|
|
360
324
|
onItemCheckboxClick: PropTypes.func,
|
|
361
325
|
separator: PropTypes.string,
|
|
362
|
-
keyword: PropTypes.string
|
|
363
|
-
virtualize: PropTypes.object
|
|
326
|
+
keyword: PropTypes.string
|
|
364
327
|
};
|
|
365
328
|
Item.defaultProps = {
|
|
366
329
|
empty: false
|
|
@@ -140,7 +140,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
140
140
|
preventScroll?: boolean;
|
|
141
141
|
showRestTagsPopover?: boolean;
|
|
142
142
|
restTagsPopoverProps?: import("../popover").PopoverProps;
|
|
143
|
-
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "
|
|
143
|
+
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
144
144
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
145
145
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
146
146
|
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>>;
|