@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
@@ -9,6 +9,8 @@ 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';
12
14
  const prefixcls = cssClasses.PREFIX_OPTION;
13
15
  export default class Item extends PureComponent {
14
16
  constructor() {
@@ -129,72 +131,106 @@ export default class Item extends PureComponent {
129
131
  });
130
132
  return content;
131
133
  };
132
- this.renderFlattenOption = data => {
134
+ this.renderFlattenOptionItem = (data, index, style) => {
135
+ var _a;
133
136
  const {
134
137
  multiple,
135
138
  selectedKeys,
136
139
  checkedKeys,
137
140
  halfCheckedKeys,
138
141
  keyword,
139
- filterRender
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
140
205
  } = this.props;
141
206
  const content = /*#__PURE__*/React.createElement("ul", {
142
207
  className: `${prefixcls}-list`,
143
208
  key: 'flatten-list'
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
- });
179
- }
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
- }));
209
+ }, virtualize ? this.renderVirtualizeList(data) : data.map(item => this.renderFlattenOptionItem(item)));
196
210
  return content;
197
211
  };
212
+ this.renderVirtualizeList = visibleOptions => {
213
+ var _a;
214
+ const {
215
+ direction
216
+ } = this.context;
217
+ const {
218
+ virtualize
219
+ } = this.props;
220
+ return /*#__PURE__*/React.createElement(List, {
221
+ height: virtualize.height,
222
+ itemCount: visibleOptions.length,
223
+ itemSize: virtualize.itemSize,
224
+ itemData: {
225
+ visibleOptions,
226
+ renderOption: this.renderFlattenOptionItem
227
+ },
228
+ width: (_a = virtualize.width) !== null && _a !== void 0 ? _a : '100%',
229
+ style: {
230
+ direction
231
+ }
232
+ }, VirtualRow);
233
+ };
198
234
  }
199
235
  renderItem(renderData) {
200
236
  let content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -323,7 +359,8 @@ Item.propTypes = {
323
359
  halfCheckedKeys: PropTypes.object,
324
360
  onItemCheckboxClick: PropTypes.func,
325
361
  separator: PropTypes.string,
326
- keyword: PropTypes.string
362
+ keyword: PropTypes.string,
363
+ virtualize: PropTypes.object
327
364
  };
328
365
  Item.defaultProps = {
329
366
  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,14 @@
1
+ const VirtualRow = _ref => {
2
+ let {
3
+ index,
4
+ data,
5
+ style
6
+ } = _ref;
7
+ const {
8
+ visibleOptions,
9
+ renderOption
10
+ } = data;
11
+ const option = visibleOptions[index];
12
+ return renderOption(option, index, style);
13
+ };
14
+ export default VirtualRow;
@@ -37,7 +37,11 @@ class DropdownItem extends BaseComponent {
37
37
  const events = {};
38
38
  if (!disabled) {
39
39
  ['onClick', 'onMouseEnter', 'onMouseLeave', 'onContextMenu'].forEach(eventName => {
40
- events[eventName] = this.props[eventName];
40
+ if (eventName === "onClick") {
41
+ events["onMouseDown"] = this.props[eventName];
42
+ } else {
43
+ events[eventName] = this.props[eventName];
44
+ }
41
45
  });
42
46
  }
43
47
  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/es/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;
@@ -113,20 +113,25 @@ const ResizableTable = function () {
113
113
  };
114
114
  const resizableRender = function (col, index) {
115
115
  let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
116
+ let originalHeaderCellProps = arguments.length > 3 ? arguments[3] : undefined;
116
117
  return Object.assign(Object.assign({}, col), {
117
- onHeaderCell: column => ({
118
- width: column.width,
119
- onResize: handleResize(column),
120
- onResizeStart: handleResizeStart(column),
121
- onResizeStop: handleResizeStop(column)
122
- })
118
+ onHeaderCell: column => {
119
+ return Object.assign(Object.assign({}, originalHeaderCellProps), {
120
+ width: column.width,
121
+ onResize: handleResize(column),
122
+ onResizeStart: handleResizeStart(column),
123
+ onResizeStop: handleResizeStop(column)
124
+ });
125
+ }
123
126
  });
124
127
  };
125
128
  const assignResizableRender = function () {
126
129
  let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
127
130
  let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
128
131
  return Array.isArray(columns) && columns.length ? columns.map((col, index) => {
129
- Object.assign(col, resizableRender(col, index, level));
132
+ var _a, _b;
133
+ const originalHeaderCellProps = (_b = (_a = col.onHeaderCell) === null || _a === void 0 ? void 0 : _a.call(col, col, index, level)) !== null && _b !== void 0 ? _b : {};
134
+ Object.assign(col, resizableRender(col, index, level, originalHeaderCellProps));
130
135
  const children = col[childrenColumnName];
131
136
  if (Array.isArray(children) && children.length) {
132
137
  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:
@@ -209,8 +209,8 @@ export default class Base extends Component {
209
209
  * 获取文本的缩略class和style
210
210
  *
211
211
  * 截断类型:
212
- * - CSS 截断,仅在 rows=1 且没有 expandable、pos、suffix 时生效
213
- * - JS 截断,应对 CSS 无法阶段的场景
212
+ * - 当设置中间截断(pos='middle')、可展开(expandable)、有后缀(suffix 非空)、可复制(copyable),启用 JS 截断策略
213
+ * - 非以上场景,启用 CSS 截断策略
214
214
  * 相关变量
215
215
  * props:
216
216
  * - ellipsis:
@@ -226,8 +226,8 @@ export default class Base extends Component {
226
226
  * Get the abbreviated class and style of the text
227
227
  *
228
228
  * Truncation type:
229
- * -CSS truncation, which only takes effect when rows = 1 and there is no expandable, pos, suffix
230
- * -JS truncation, dealing with scenarios where CSS cannot stage
229
+ * -When setting middle ellipsis (pos='middle')、expandable、suffix is not empty、copyable, the JS ellipsis strategy is enabled
230
+ * -Otherwise, enable the CSS ellipsis strategy
231
231
  * related variables
232
232
  * props:
233
233
  * -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.42.3",
3
+ "version": "2.43.0-alpha.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.42.3",
24
- "@douyinfe/semi-animation-react": "2.42.3",
25
- "@douyinfe/semi-foundation": "2.42.3",
26
- "@douyinfe/semi-icons": "2.42.3",
27
- "@douyinfe/semi-illustrations": "2.42.3",
28
- "@douyinfe/semi-theme-default": "2.42.3",
23
+ "@douyinfe/semi-animation": "2.43.0-alpha.0",
24
+ "@douyinfe/semi-animation-react": "2.43.0-alpha.0",
25
+ "@douyinfe/semi-foundation": "2.43.0-alpha.0",
26
+ "@douyinfe/semi-icons": "2.43.0-alpha.0",
27
+ "@douyinfe/semi-illustrations": "2.43.0-alpha.0",
28
+ "@douyinfe/semi-theme-default": "2.43.0-alpha.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "40c69cde208e15c628fe69ae326fa31a1629a693",
78
+ "gitHead": "fcc62b3fcb6a4247854f4a81471cef9259ffc284",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",