@douyinfe/semi-ui 2.42.3 → 2.43.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.
Files changed (39) hide show
  1. package/dist/umd/semi-ui.js +26951 -26888
  2. package/dist/umd/semi-ui.js.map +1 -1
  3. package/dist/umd/semi-ui.min.js +1 -1
  4. package/dist/umd/semi-ui.min.js.map +1 -1
  5. package/lib/cjs/cascader/index.js +4 -2
  6. package/lib/cjs/cascader/item.d.ts +5 -1
  7. package/lib/cjs/cascader/item.js +92 -55
  8. package/lib/cjs/cascader/virtualRow.d.ts +8 -0
  9. package/lib/cjs/cascader/virtualRow.js +21 -0
  10. package/lib/cjs/dropdown/dropdownItem.js +5 -1
  11. package/lib/cjs/form/baseForm.d.ts +1 -1
  12. package/lib/cjs/form/field.d.ts +1 -1
  13. package/lib/cjs/modal/confirm.d.ts +3 -3
  14. package/lib/cjs/table/ResizableTable.js +12 -7
  15. package/lib/cjs/tree/interface.d.ts +1 -1
  16. package/lib/cjs/treeSelect/index.d.ts +1 -1
  17. package/lib/cjs/typography/base.d.ts +25 -4
  18. package/lib/cjs/typography/base.js +4 -4
  19. package/lib/cjs/typography/paragraph.d.ts +21 -0
  20. package/lib/cjs/typography/text.d.ts +21 -0
  21. package/lib/cjs/typography/title.d.ts +21 -0
  22. package/lib/es/cascader/index.js +4 -2
  23. package/lib/es/cascader/item.d.ts +5 -1
  24. package/lib/es/cascader/item.js +92 -55
  25. package/lib/es/cascader/virtualRow.d.ts +8 -0
  26. package/lib/es/cascader/virtualRow.js +14 -0
  27. package/lib/es/dropdown/dropdownItem.js +5 -1
  28. package/lib/es/form/baseForm.d.ts +1 -1
  29. package/lib/es/form/field.d.ts +1 -1
  30. package/lib/es/modal/confirm.d.ts +3 -3
  31. package/lib/es/table/ResizableTable.js +12 -7
  32. package/lib/es/tree/interface.d.ts +1 -1
  33. package/lib/es/treeSelect/index.d.ts +1 -1
  34. package/lib/es/typography/base.d.ts +25 -4
  35. package/lib/es/typography/base.js +4 -4
  36. package/lib/es/typography/paragraph.d.ts +21 -0
  37. package/lib/es/typography/text.d.ts +21 -0
  38. package/lib/es/typography/title.d.ts +21 -0
  39. package/package.json +8 -8
@@ -125,7 +125,8 @@ class Cascader extends _baseComponent.default {
125
125
  bottomSlot,
126
126
  showNext,
127
127
  multiple,
128
- filterRender
128
+ filterRender,
129
+ virtualizeInSearch
129
130
  } = this.props;
130
131
  const searchable = Boolean(filterTreeNode) && isSearching;
131
132
  const popoverCls = (0, _classnames.default)(dropdownClassName, `${prefixcls}-popover`);
@@ -153,7 +154,8 @@ class Cascader extends _baseComponent.default {
153
154
  multiple: multiple,
154
155
  checkedKeys: checkedKeys,
155
156
  halfCheckedKeys: halfCheckedKeys,
156
- filterRender: filterRender
157
+ filterRender: filterRender,
158
+ virtualize: virtualizeInSearch
157
159
  }), bottomSlot);
158
160
  return content;
159
161
  };
@@ -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 } from '@douyinfe/semi-foundation/lib/cjs/cascader/foundation';
5
+ import { BasicCascaderData, BasicEntity, ShowNextType, BasicData, Virtualize } from '@douyinfe/semi-foundation/lib/cjs/cascader/foundation';
6
6
  export interface CascaderData extends BasicCascaderData {
7
7
  label: React.ReactNode;
8
8
  }
@@ -52,6 +52,7 @@ export interface CascaderItemProps {
52
52
  checkedKeys: Set<string>;
53
53
  halfCheckedKeys: Set<string>;
54
54
  filterRender?: (props: FilterRenderProps) => ReactNode;
55
+ virtualize?: Virtualize;
55
56
  }
56
57
  export default class Item extends PureComponent<CascaderItemProps> {
57
58
  static contextType: React.Context<ContextValue>;
@@ -68,6 +69,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
68
69
  onItemCheckboxClick: PropTypes.Requireable<(...args: any[]) => any>;
69
70
  separator: PropTypes.Requireable<string>;
70
71
  keyword: PropTypes.Requireable<string>;
72
+ virtualize: PropTypes.Requireable<object>;
71
73
  };
72
74
  static defaultProps: {
73
75
  empty: boolean;
@@ -87,7 +89,9 @@ export default class Item extends PureComponent<CascaderItemProps> {
87
89
  };
88
90
  renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
89
91
  highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
92
+ renderFlattenOptionItem: (data: Data, index?: number, style?: any) => JSX.Element;
90
93
  renderFlattenOption: (data: Data[]) => JSX.Element;
94
+ renderVirtualizeList: (visibleOptions: any) => JSX.Element;
91
95
  renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
92
96
  renderEmpty(): JSX.Element;
93
97
  render(): JSX.Element;
@@ -15,6 +15,8 @@ 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"));
18
20
  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); }
19
21
  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; }
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -138,72 +140,106 @@ class Item extends _react.PureComponent {
138
140
  });
139
141
  return content;
140
142
  };
141
- this.renderFlattenOption = data => {
143
+ this.renderFlattenOptionItem = (data, index, style) => {
144
+ var _a;
142
145
  const {
143
146
  multiple,
144
147
  selectedKeys,
145
148
  checkedKeys,
146
149
  halfCheckedKeys,
147
150
  keyword,
148
- filterRender
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
149
214
  } = this.props;
150
215
  const content = /*#__PURE__*/_react.default.createElement("ul", {
151
216
  className: `${prefixcls}-list`,
152
217
  key: 'flatten-list'
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
- });
188
- }
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
- }));
218
+ }, virtualize ? this.renderVirtualizeList(data) : data.map(item => this.renderFlattenOptionItem(item)));
205
219
  return content;
206
220
  };
221
+ this.renderVirtualizeList = visibleOptions => {
222
+ var _a;
223
+ const {
224
+ direction
225
+ } = this.context;
226
+ const {
227
+ virtualize
228
+ } = this.props;
229
+ return /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
230
+ height: virtualize.height,
231
+ itemCount: visibleOptions.length,
232
+ itemSize: virtualize.itemSize,
233
+ itemData: {
234
+ visibleOptions,
235
+ renderOption: this.renderFlattenOptionItem
236
+ },
237
+ width: (_a = virtualize.width) !== null && _a !== void 0 ? _a : '100%',
238
+ style: {
239
+ direction
240
+ }
241
+ }, _virtualRow.default);
242
+ };
207
243
  }
208
244
  renderItem(renderData) {
209
245
  let content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -333,7 +369,8 @@ Item.propTypes = {
333
369
  halfCheckedKeys: _propTypes.default.object,
334
370
  onItemCheckboxClick: _propTypes.default.func,
335
371
  separator: _propTypes.default.string,
336
- keyword: _propTypes.default.string
372
+ keyword: _propTypes.default.string,
373
+ virtualize: _propTypes.default.object
337
374
  };
338
375
  Item.defaultProps = {
339
376
  empty: false
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface VirtualRowProps {
3
+ index: number;
4
+ data: Record<string, any>;
5
+ style?: React.CSSProperties;
6
+ }
7
+ declare const VirtualRow: ({ index, data, style }: VirtualRowProps) => any;
8
+ export default VirtualRow;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const VirtualRow = _ref => {
8
+ let {
9
+ index,
10
+ data,
11
+ style
12
+ } = _ref;
13
+ const {
14
+ visibleOptions,
15
+ renderOption
16
+ } = data;
17
+ const option = visibleOptions[index];
18
+ return renderOption(option, index, style);
19
+ };
20
+ var _default = VirtualRow;
21
+ exports.default = _default;
@@ -44,7 +44,11 @@ class DropdownItem extends _baseComponent.default {
44
44
  const events = {};
45
45
  if (!disabled) {
46
46
  ['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
47
- events[eventName] = this.props[eventName];
47
+ if (eventName === "onClick") {
48
+ events["onMouseDown"] = this.props[eventName];
49
+ } else {
50
+ events[eventName] = this.props[eventName];
51
+ }
48
52
  });
49
53
  }
50
54
  let tick = null;
@@ -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" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
143
+ } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "motion" | "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>;
@@ -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" | "motion" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
89
+ } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "motion" | "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>>;
@@ -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;
149
148
  getPopupContainer?: () => HTMLElement;
150
149
  footer?: React.ReactNode;
151
150
  header?: React.ReactNode;
152
151
  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
- onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
208
- onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
209
207
  form?: string;
210
208
  slot?: string;
209
+ onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement>;
210
+ onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement>;
211
211
  prefix?: string;
212
212
  dangerouslySetInnerHTML?: {
213
213
  __html: string | TrustedHTML;
@@ -123,20 +123,25 @@ const ResizableTable = function () {
123
123
  };
124
124
  const resizableRender = function (col, index) {
125
125
  let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
126
+ let originalHeaderCellProps = arguments.length > 3 ? arguments[3] : undefined;
126
127
  return Object.assign(Object.assign({}, col), {
127
- onHeaderCell: column => ({
128
- width: column.width,
129
- onResize: handleResize(column),
130
- onResizeStart: handleResizeStart(column),
131
- onResizeStop: handleResizeStop(column)
132
- })
128
+ onHeaderCell: column => {
129
+ return Object.assign(Object.assign({}, originalHeaderCellProps), {
130
+ width: column.width,
131
+ onResize: handleResize(column),
132
+ onResizeStart: handleResizeStart(column),
133
+ onResizeStop: handleResizeStop(column)
134
+ });
135
+ }
133
136
  });
134
137
  };
135
138
  const assignResizableRender = function () {
136
139
  let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
137
140
  let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
138
141
  return Array.isArray(columns) && columns.length ? columns.map((col, index) => {
139
- Object.assign(col, resizableRender(col, index, level));
142
+ var _a, _b;
143
+ const originalHeaderCellProps = (_b = (_a = col.onHeaderCell) === null || _a === void 0 ? void 0 : _a.call(col, col, index, level)) !== null && _b !== void 0 ? _b : {};
144
+ Object.assign(col, resizableRender(col, index, level, originalHeaderCellProps));
140
145
  const children = col[childrenColumnName];
141
146
  if (Array.isArray(children) && children.length) {
142
147
  col[childrenColumnName] = assignResizableRender(children, level + 1);
@@ -61,7 +61,7 @@ export interface TreeProps extends BasicTreeProps {
61
61
  onExpand?: (expandedKeys: string[], expandedOtherProps: ExpandedOtherProps) => void;
62
62
  onLoad?: (loadedKeys?: Set<string>, treeNode?: TreeNodeData) => void;
63
63
  onContextMenu?: (e: MouseEvent, node: TreeNodeData) => void;
64
- onSelect?: (selectedKeys: string, selected: boolean, selectedNode: TreeNodeData) => void;
64
+ onSelect?: (selectedKey: string, selected: boolean, selectedNode: TreeNodeData) => void;
65
65
  renderDraggingNode?: (nodeInstance: HTMLElement, node: TreeNodeData) => HTMLElement;
66
66
  renderFullLabel?: (renderFullLabelProps: RenderFullLabelProps) => ReactNode;
67
67
  renderLabel?: (label?: ReactNode, treeNode?: TreeNodeData) => ReactNode;
@@ -74,7 +74,7 @@ export interface TreeSelectProps extends Omit<BasicTreeSelectProps, OverrideComm
74
74
  stopPropagation?: boolean | string;
75
75
  restTagsPopoverProps?: PopoverProps;
76
76
  searchRender?: boolean | ((inputProps: InputProps) => React.ReactNode);
77
- onSelect?: (selectedKeys: string, selected: boolean, selectedNode: TreeNodeData) => void;
77
+ onSelect?: (selectedKey: string, selected: boolean, selectedNode: TreeNodeData) => void;
78
78
  renderSelectedItem?: RenderSelectedItem;
79
79
  getPopupContainer?: () => HTMLElement;
80
80
  triggerRender?: (props?: TriggerRenderProps) => React.ReactNode;
@@ -8,6 +8,27 @@ export interface BaseTypographyProps extends BaseProps {
8
8
  delete?: boolean;
9
9
  disabled?: boolean;
10
10
  icon?: React.ReactNode;
11
+ /**
12
+ * ellipsis 用于设置截断相关参数.
13
+ * Ellipsis is used to set ellipsis related parameters.
14
+ * ellipsis 仅支持纯文本的截断,不支持 reactNode 等复杂类型,请确保 children 传入内容类型为 string.
15
+ * Ellipsis only supports ellipsis of plain text, and does not support complex types such as reactNode.
16
+ * Please ensure that the content type of children is string.
17
+ * Semi 截断有两种策略, CSS 截断和 JS 截断。
18
+ * Semi ellipsis has two strategies, CSS ellipsis and JS ellipsis.
19
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
20
+ * - When setting middle ellipsis (pos='middle')、expandable、suffix is not empty string、copyable,
21
+ * the JS ellipsis strategy is enabled
22
+ * - 非以上场景,启用 CSS 截断策略
23
+ * - Otherwise, enable the CSS ellipsis strategy
24
+ *
25
+ * 通常来说 CSS 截断的性能优于 JS 截断。在 children 不变, 容器尺寸不变的情况下,CSS 截断只涉及 1-2 次计算,js 截断基于二分法,可能涉及多次计算。
26
+ * In general CSS ellipsis performs better than JS ellipsis. when the children and container size remain unchanged,
27
+ * CSS ellipsis only involves 1-2 calculations, while JS ellipsis is based on dichotomy and may require multiple calculations.
28
+ * 同时使用大量带有截断功能的 Typography 需注意性能消耗,如在 Table 中,可通过设置合理的页容量进行分页减少性能损耗
29
+ * Pay attention to performance consumption when using a large number of Typography with ellipsis. For example, in Table,
30
+ * you can reduce performance loss by setting a reasonable pageSize for paging
31
+ */
11
32
  ellipsis?: Ellipsis | boolean;
12
33
  mark?: boolean;
13
34
  underline?: boolean;
@@ -125,8 +146,8 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
125
146
  * 获取文本的缩略class和style
126
147
  *
127
148
  * 截断类型:
128
- * - CSS 截断,仅在 rows=1 且没有 expandable、pos、suffix 时生效
129
- * - JS 截断,应对 CSS 无法阶段的场景
149
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
150
+ * - 非以上场景,启用 CSS 截断策略
130
151
  * 相关变量
131
152
  * props:
132
153
  * - ellipsis:
@@ -142,8 +163,8 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
142
163
  * Get the abbreviated class and style of the text
143
164
  *
144
165
  * Truncation type:
145
- * -CSS truncation, which only takes effect when rows = 1 and there is no expandable, pos, suffix
146
- * -JS truncation, dealing with scenarios where CSS cannot stage
166
+ * -When setting middle ellipsis (pos='middle')、expandable、suffix is not empty、copyable, the JS ellipsis strategy is enabled
167
+ * -Otherwise, enable the CSS ellipsis strategy
147
168
  * related variables
148
169
  * props:
149
170
  * -ellipsis:
@@ -218,8 +218,8 @@ class Base extends _react.Component {
218
218
  * 获取文本的缩略class和style
219
219
  *
220
220
  * 截断类型:
221
- * - CSS 截断,仅在 rows=1 且没有 expandable、pos、suffix 时生效
222
- * - JS 截断,应对 CSS 无法阶段的场景
221
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
222
+ * - 非以上场景,启用 CSS 截断策略
223
223
  * 相关变量
224
224
  * props:
225
225
  * - ellipsis:
@@ -235,8 +235,8 @@ class Base extends _react.Component {
235
235
  * Get the abbreviated class and style of the text
236
236
  *
237
237
  * Truncation type:
238
- * -CSS truncation, which only takes effect when rows = 1 and there is no expandable, pos, suffix
239
- * -JS truncation, dealing with scenarios where CSS cannot stage
238
+ * -When setting middle ellipsis (pos='middle')、expandable、suffix is not empty、copyable, the JS ellipsis strategy is enabled
239
+ * -Otherwise, enable the CSS ellipsis strategy
240
240
  * related variables
241
241
  * props:
242
242
  * -ellipsis:
@@ -9,6 +9,27 @@ export interface ParagraphProps extends Omit<React.HTMLAttributes<HTMLParagraphE
9
9
  copyable?: CopyableConfig | boolean;
10
10
  delete?: boolean;
11
11
  disabled?: boolean;
12
+ /**
13
+ * ellipsis 用于设置截断相关参数.
14
+ * Ellipsis is used to set ellipsis related parameters.
15
+ * ellipsis 仅支持纯文本的截断,不支持 reactNode 等复杂类型,请确保 children 传入内容类型为 string.
16
+ * Ellipsis only supports ellipsis of plain text, and does not support complex types such as reactNode.
17
+ * Please ensure that the content type of children is string.
18
+ * Semi 截断有两种策略, CSS 截断和 JS 截断。
19
+ * Semi ellipsis has two strategies, CSS ellipsis and JS ellipsis.
20
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
21
+ * - When setting middle ellipsis (pos='middle')、expandable、suffix is not empty string、copyable,
22
+ * the JS ellipsis strategy is enabled
23
+ * - 非以上场景,启用 CSS 截断策略
24
+ * - Otherwise, enable the CSS ellipsis strategy
25
+ *
26
+ * 通常来说 CSS 截断的性能优于 JS 截断。在 children 不变, 容器尺寸不变的情况下,CSS 截断只涉及 1-2 次计算,js 截断基于二分法,可能涉及多次计算。
27
+ * In general CSS ellipsis performs better than JS ellipsis. when the children and container size remain unchanged,
28
+ * CSS ellipsis only involves 1-2 calculations, while JS ellipsis is based on dichotomy and may require multiple calculations.
29
+ * 同时使用大量带有截断功能的 Typography 需注意性能消耗,如在 Table 中,可通过设置合理的页容量进行分页减少性能损耗
30
+ * Pay attention to performance consumption when using a large number of Typography with ellipsis. For example, in Table,
31
+ * you can reduce performance loss by setting a reasonable pageSize for paging
32
+ */
12
33
  ellipsis?: Ellipsis | boolean;
13
34
  link?: LinkType;
14
35
  mark?: boolean;
@@ -11,6 +11,27 @@ export interface TextProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, O
11
11
  copyable?: CopyableConfig | boolean;
12
12
  delete?: boolean;
13
13
  disabled?: boolean;
14
+ /**
15
+ * ellipsis 用于设置截断相关参数.
16
+ * Ellipsis is used to set ellipsis related parameters.
17
+ * ellipsis 仅支持纯文本的截断,不支持 reactNode 等复杂类型,请确保 children 传入内容类型为 string.
18
+ * Ellipsis only supports ellipsis of plain text, and does not support complex types such as reactNode.
19
+ * Please ensure that the content type of children is string.
20
+ * Semi 截断有两种策略, CSS 截断和 JS 截断。
21
+ * Semi ellipsis has two strategies, CSS ellipsis and JS ellipsis.
22
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
23
+ * - When setting middle ellipsis (pos='middle')、expandable、suffix is not empty string、copyable,
24
+ * the JS ellipsis strategy is enabled
25
+ * - 非以上场景,启用 CSS 截断策略
26
+ * - Otherwise, enable the CSS ellipsis strategy
27
+ *
28
+ * 通常来说 CSS 截断的性能优于 JS 截断。在 children 不变, 容器尺寸不变的情况下,CSS 截断只涉及 1-2 次计算,js 截断基于二分法,可能涉及多次计算。
29
+ * In general CSS ellipsis performs better than JS ellipsis. when the children and container size remain unchanged,
30
+ * CSS ellipsis only involves 1-2 calculations, while JS ellipsis is based on dichotomy and may require multiple calculations.
31
+ * 同时使用大量带有截断功能的 Typography 需注意性能消耗,如在 Table 中,可通过设置合理的页容量进行分页减少性能损耗
32
+ * Pay attention to performance consumption when using a large number of Typography with ellipsis. For example, in Table,
33
+ * you can reduce performance loss by setting a reasonable pageSize for paging
34
+ */
14
35
  ellipsis?: Ellipsis | boolean;
15
36
  icon?: React.ReactNode | string;
16
37
  link?: LinkType;
@@ -18,6 +18,27 @@ export interface TitleProps extends Omit<React.HTMLAttributes<HTMLHeadingElement
18
18
  copyable?: CopyableConfig | boolean;
19
19
  delete?: boolean;
20
20
  disabled?: boolean;
21
+ /**
22
+ * ellipsis 用于设置截断相关参数.
23
+ * Ellipsis is used to set ellipsis related parameters.
24
+ * ellipsis 仅支持纯文本的截断,不支持 reactNode 等复杂类型,请确保 children 传入内容类型为 string.
25
+ * Ellipsis only supports ellipsis of plain text, and does not support complex types such as reactNode.
26
+ * Please ensure that the content type of children is string.
27
+ * Semi 截断有两种策略, CSS 截断和 JS 截断。
28
+ * Semi ellipsis has two strategies, CSS ellipsis and JS ellipsis.
29
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
30
+ * - When setting middle ellipsis (pos='middle')、expandable、suffix is not empty string、copyable,
31
+ * the JS ellipsis strategy is enabled
32
+ * - 非以上场景,启用 CSS 截断策略
33
+ * - Otherwise, enable the CSS ellipsis strategy
34
+ *
35
+ * 通常来说 CSS 截断的性能优于 JS 截断。在 children 不变, 容器尺寸不变的情况下,CSS 截断只涉及 1-2 次计算,js 截断基于二分法,可能涉及多次计算。
36
+ * In general CSS ellipsis performs better than JS ellipsis. when the children and container size remain unchanged,
37
+ * CSS ellipsis only involves 1-2 calculations, while JS ellipsis is based on dichotomy and may require multiple calculations.
38
+ * 同时使用大量带有截断功能的 Typography 需注意性能消耗,如在 Table 中,可通过设置合理的页容量进行分页减少性能损耗
39
+ * Pay attention to performance consumption when using a large number of Typography with ellipsis. For example, in Table,
40
+ * you can reduce performance loss by setting a reasonable pageSize for paging
41
+ */
21
42
  ellipsis?: Ellipsis | boolean;
22
43
  heading?: ArrayElement<typeof strings.HEADING>;
23
44
  link?: LinkType;
@@ -116,7 +116,8 @@ class Cascader extends BaseComponent {
116
116
  bottomSlot,
117
117
  showNext,
118
118
  multiple,
119
- filterRender
119
+ filterRender,
120
+ virtualizeInSearch
120
121
  } = this.props;
121
122
  const searchable = Boolean(filterTreeNode) && isSearching;
122
123
  const popoverCls = cls(dropdownClassName, `${prefixcls}-popover`);
@@ -144,7 +145,8 @@ class Cascader extends BaseComponent {
144
145
  multiple: multiple,
145
146
  checkedKeys: checkedKeys,
146
147
  halfCheckedKeys: halfCheckedKeys,
147
- filterRender: filterRender
148
+ filterRender: filterRender,
149
+ virtualize: virtualizeInSearch
148
150
  }), bottomSlot);
149
151
  return content;
150
152
  };
@@ -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 } from '@douyinfe/semi-foundation/lib/es/cascader/foundation';
5
+ import { BasicCascaderData, BasicEntity, ShowNextType, BasicData, Virtualize } from '@douyinfe/semi-foundation/lib/es/cascader/foundation';
6
6
  export interface CascaderData extends BasicCascaderData {
7
7
  label: React.ReactNode;
8
8
  }
@@ -52,6 +52,7 @@ export interface CascaderItemProps {
52
52
  checkedKeys: Set<string>;
53
53
  halfCheckedKeys: Set<string>;
54
54
  filterRender?: (props: FilterRenderProps) => ReactNode;
55
+ virtualize?: Virtualize;
55
56
  }
56
57
  export default class Item extends PureComponent<CascaderItemProps> {
57
58
  static contextType: React.Context<ContextValue>;
@@ -68,6 +69,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
68
69
  onItemCheckboxClick: PropTypes.Requireable<(...args: any[]) => any>;
69
70
  separator: PropTypes.Requireable<string>;
70
71
  keyword: PropTypes.Requireable<string>;
72
+ virtualize: PropTypes.Requireable<object>;
71
73
  };
72
74
  static defaultProps: {
73
75
  empty: boolean;
@@ -87,7 +89,9 @@ export default class Item extends PureComponent<CascaderItemProps> {
87
89
  };
88
90
  renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
89
91
  highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
92
+ renderFlattenOptionItem: (data: Data, index?: number, style?: any) => JSX.Element;
90
93
  renderFlattenOption: (data: Data[]) => JSX.Element;
94
+ renderVirtualizeList: (visibleOptions: any) => JSX.Element;
91
95
  renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
92
96
  renderEmpty(): JSX.Element;
93
97
  render(): JSX.Element;