@douyinfe/semi-ui 2.23.0-beta.0 → 2.23.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,7 +71,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
71
71
  selected: boolean;
72
72
  loading: boolean;
73
73
  };
74
- renderIcon: (type: string) => JSX.Element;
74
+ renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
75
75
  highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
76
76
  renderFlattenOption: (data: Data[]) => JSX.Element;
77
77
  renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
@@ -118,27 +118,33 @@ class Item extends _react.PureComponent {
118
118
  return state;
119
119
  };
120
120
 
121
- this.renderIcon = type => {
121
+ this.renderIcon = function (type) {
122
+ let haveMarginLeft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
123
+
124
+ const finalCls = style => {
125
+ return style + (haveMarginLeft ? " ".concat(prefixcls, "-icon-left") : '');
126
+ };
127
+
122
128
  switch (type) {
123
129
  case 'child':
124
130
  return /*#__PURE__*/_react.default.createElement(_semiIcons.IconChevronRight, {
125
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand")
131
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand"))
126
132
  });
127
133
 
128
134
  case 'tick':
129
135
  return /*#__PURE__*/_react.default.createElement(_semiIcons.IconTick, {
130
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active")
136
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active"))
131
137
  });
132
138
 
133
139
  case 'loading':
134
140
  return /*#__PURE__*/_react.default.createElement(_spin.default, {
135
- wrapperClassName: "".concat(prefixcls, "-spin-icon")
141
+ wrapperClassName: finalCls("".concat(prefixcls, "-spin-icon"))
136
142
  });
137
143
 
138
144
  case 'empty':
139
145
  return /*#__PURE__*/_react.default.createElement("span", {
140
146
  "aria-hidden": true,
141
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty")
147
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty"))
142
148
  });
143
149
 
144
150
  default:
@@ -288,7 +294,7 @@ class Item extends _react.PureComponent {
288
294
  indeterminate: halfCheckedKeys.has(item.key),
289
295
  checked: checkedKeys.has(item.key),
290
296
  className: "".concat(prefixcls, "-label-checkbox")
291
- }), /*#__PURE__*/_react.default.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child') : null);
297
+ }), /*#__PURE__*/_react.default.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child', true) : null);
292
298
  })));
293
299
 
294
300
  if (showChildItem) {
@@ -37,6 +37,12 @@ export interface TooltipProps extends BaseProps {
37
37
  onVisibleChange?: (visible: boolean) => void;
38
38
  onClickOutSide?: (e: React.MouseEvent) => void;
39
39
  spacing?: number;
40
+ margin?: number | {
41
+ marginLeft: number;
42
+ marginTop: number;
43
+ marginRight: number;
44
+ marginBottom: number;
45
+ };
40
46
  showArrow?: boolean | React.ReactNode;
41
47
  zIndex?: number;
42
48
  rePosKey?: string | number;
@@ -96,6 +102,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
96
102
  onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
97
103
  onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
98
104
  spacing: PropTypes.Requireable<number>;
105
+ margin: PropTypes.Requireable<NonNullable<number | object>>;
99
106
  showArrow: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
100
107
  zIndex: PropTypes.Requireable<number>;
101
108
  rePosKey: PropTypes.Requireable<NonNullable<string | number>>;
@@ -134,6 +141,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
134
141
  onVisibleChange: (...args: any[]) => void;
135
142
  onClickOutSide: (...args: any[]) => void;
136
143
  spacing: 8;
144
+ margin: 0;
137
145
  showArrow: boolean;
138
146
  wrapWhenSpecial: boolean;
139
147
  zIndex: 1060;
@@ -728,6 +728,7 @@ Tooltip.propTypes = {
728
728
  onVisibleChange: _propTypes.default.func,
729
729
  onClickOutSide: _propTypes.default.func,
730
730
  spacing: _propTypes.default.number,
731
+ margin: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.object]),
731
732
  showArrow: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.node]),
732
733
  zIndex: _propTypes.default.number,
733
734
  rePosKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
@@ -757,6 +758,7 @@ Tooltip.defaultProps = {
757
758
  onVisibleChange: _noop2.default,
758
759
  onClickOutSide: _noop2.default,
759
760
  spacing: _constants2.numbers.SPACING,
761
+ margin: _constants2.numbers.MARGIN,
760
762
  showArrow: true,
761
763
  wrapWhenSpecial: true,
762
764
  zIndex: _constants2.numbers.DEFAULT_Z_INDEX,
@@ -71,7 +71,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
71
71
  selected: boolean;
72
72
  loading: boolean;
73
73
  };
74
- renderIcon: (type: string) => JSX.Element;
74
+ renderIcon: (type: string, haveMarginLeft?: boolean) => JSX.Element;
75
75
  highlight: (searchText: React.ReactNode[]) => React.ReactNode[];
76
76
  renderFlattenOption: (data: Data[]) => JSX.Element;
77
77
  renderItem(renderData: Array<Entity>, content?: Array<React.ReactNode>): React.ReactNode[];
@@ -93,27 +93,33 @@ export default class Item extends PureComponent {
93
93
  return state;
94
94
  };
95
95
 
96
- this.renderIcon = type => {
96
+ this.renderIcon = function (type) {
97
+ let haveMarginLeft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
98
+
99
+ const finalCls = style => {
100
+ return style + (haveMarginLeft ? " ".concat(prefixcls, "-icon-left") : '');
101
+ };
102
+
97
103
  switch (type) {
98
104
  case 'child':
99
105
  return /*#__PURE__*/React.createElement(IconChevronRight, {
100
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand")
106
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-expand"))
101
107
  });
102
108
 
103
109
  case 'tick':
104
110
  return /*#__PURE__*/React.createElement(IconTick, {
105
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active")
111
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-active"))
106
112
  });
107
113
 
108
114
  case 'loading':
109
115
  return /*#__PURE__*/React.createElement(Spin, {
110
- wrapperClassName: "".concat(prefixcls, "-spin-icon")
116
+ wrapperClassName: finalCls("".concat(prefixcls, "-spin-icon"))
111
117
  });
112
118
 
113
119
  case 'empty':
114
120
  return /*#__PURE__*/React.createElement("span", {
115
121
  "aria-hidden": true,
116
- className: "".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty")
122
+ className: finalCls("".concat(prefixcls, "-icon ").concat(prefixcls, "-icon-empty"))
117
123
  });
118
124
 
119
125
  default:
@@ -261,7 +267,7 @@ export default class Item extends PureComponent {
261
267
  indeterminate: halfCheckedKeys.has(item.key),
262
268
  checked: checkedKeys.has(item.key),
263
269
  className: "".concat(prefixcls, "-label-checkbox")
264
- }), /*#__PURE__*/React.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child') : null);
270
+ }), /*#__PURE__*/React.createElement("span", null, label)), showExpand ? this.renderIcon(loading ? 'loading' : 'child', true) : null);
265
271
  })));
266
272
 
267
273
  if (showChildItem) {
@@ -37,6 +37,12 @@ export interface TooltipProps extends BaseProps {
37
37
  onVisibleChange?: (visible: boolean) => void;
38
38
  onClickOutSide?: (e: React.MouseEvent) => void;
39
39
  spacing?: number;
40
+ margin?: number | {
41
+ marginLeft: number;
42
+ marginTop: number;
43
+ marginRight: number;
44
+ marginBottom: number;
45
+ };
40
46
  showArrow?: boolean | React.ReactNode;
41
47
  zIndex?: number;
42
48
  rePosKey?: string | number;
@@ -96,6 +102,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
96
102
  onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
97
103
  onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
98
104
  spacing: PropTypes.Requireable<number>;
105
+ margin: PropTypes.Requireable<NonNullable<number | object>>;
99
106
  showArrow: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
100
107
  zIndex: PropTypes.Requireable<number>;
101
108
  rePosKey: PropTypes.Requireable<NonNullable<string | number>>;
@@ -134,6 +141,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
134
141
  onVisibleChange: (...args: any[]) => void;
135
142
  onClickOutSide: (...args: any[]) => void;
136
143
  spacing: 8;
144
+ margin: 0;
137
145
  showArrow: boolean;
138
146
  wrapWhenSpecial: boolean;
139
147
  zIndex: 1060;
@@ -695,6 +695,7 @@ Tooltip.propTypes = {
695
695
  onVisibleChange: PropTypes.func,
696
696
  onClickOutSide: PropTypes.func,
697
697
  spacing: PropTypes.number,
698
+ margin: PropTypes.oneOfType([PropTypes.number, PropTypes.object]),
698
699
  showArrow: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
699
700
  zIndex: PropTypes.number,
700
701
  rePosKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -724,6 +725,7 @@ Tooltip.defaultProps = {
724
725
  onVisibleChange: _noop,
725
726
  onClickOutSide: _noop,
726
727
  spacing: numbers.SPACING,
728
+ margin: numbers.MARGIN,
727
729
  showArrow: true,
728
730
  wrapWhenSpecial: true,
729
731
  zIndex: numbers.DEFAULT_Z_INDEX,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.23.0-beta.0",
3
+ "version": "2.23.0-beta.1",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -18,11 +18,11 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@douyinfe/semi-animation": "2.12.0",
21
- "@douyinfe/semi-animation-react": "2.23.0-beta.0",
22
- "@douyinfe/semi-foundation": "2.23.0-beta.0",
23
- "@douyinfe/semi-icons": "2.23.0-beta.0",
21
+ "@douyinfe/semi-animation-react": "2.23.0-beta.1",
22
+ "@douyinfe/semi-foundation": "2.23.0-beta.1",
23
+ "@douyinfe/semi-icons": "2.23.0-beta.1",
24
24
  "@douyinfe/semi-illustrations": "2.15.0",
25
- "@douyinfe/semi-theme-default": "2.23.0-beta.0",
25
+ "@douyinfe/semi-theme-default": "2.23.0-beta.1",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "043a62790406e9ee86cd77e91190be8245baa9f6",
72
+ "gitHead": "afe3b23c86641a627ade78ceb414d05223fc7354",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.23.0-beta.0",
78
+ "@douyinfe/semi-scss-compile": "2.23.0-beta.1",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "@types/react": ">=16.0.0",