@hi-ui/hiui 4.1.20 → 4.1.22

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 (38) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/cjs/index.js +24 -11
  3. package/lib/esm/index.js +4 -4
  4. package/package.json +4 -3
  5. package/lib/cjs/_virtual/index.js +0 -18
  6. package/lib/cjs/node_modules/classnames/index.js +0 -76
  7. package/lib/cjs/packages/ui/ellipsis-tooltip/lib/esm/EllipsisTooltip.js +0 -130
  8. package/lib/cjs/packages/ui/ellipsis-tooltip/lib/esm/styles/index.scss.js +0 -42
  9. package/lib/cjs/packages/utils/classname/lib/esm/index.js +0 -45
  10. package/lib/esm/_virtual/index.js +0 -13
  11. package/lib/esm/node_modules/classnames/index.js +0 -69
  12. package/lib/esm/packages/ui/ellipsis-tooltip/lib/esm/EllipsisTooltip.js +0 -106
  13. package/lib/esm/packages/ui/ellipsis-tooltip/lib/esm/styles/index.scss.js +0 -25
  14. package/lib/esm/packages/utils/classname/lib/esm/index.js +0 -37
  15. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/LocaleContext.js +0 -0
  16. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/LocaleProvider.js +0 -0
  17. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/locale/en-US.js +0 -0
  18. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/locale/index.js +0 -0
  19. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/locale/zh-CN.js +0 -0
  20. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/locale/zh-HK.js +0 -0
  21. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/locale/zh-TW.js +0 -0
  22. /package/lib/cjs/{packages/ui → ui}/locale-context/lib/esm/types.js +0 -0
  23. /package/lib/cjs/{packages/utils → utils}/array-utils/lib/esm/index.js +0 -0
  24. /package/lib/cjs/{packages/utils → utils}/env/lib/esm/index.js +0 -0
  25. /package/lib/cjs/{packages/utils → utils}/object-utils/lib/esm/index.js +0 -0
  26. /package/lib/cjs/{packages/utils → utils}/type-assertion/lib/esm/index.js +0 -0
  27. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/LocaleContext.js +0 -0
  28. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/LocaleProvider.js +0 -0
  29. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/locale/en-US.js +0 -0
  30. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/locale/index.js +0 -0
  31. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/locale/zh-CN.js +0 -0
  32. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/locale/zh-HK.js +0 -0
  33. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/locale/zh-TW.js +0 -0
  34. /package/lib/esm/{packages/ui → ui}/locale-context/lib/esm/types.js +0 -0
  35. /package/lib/esm/{packages/utils → utils}/array-utils/lib/esm/index.js +0 -0
  36. /package/lib/esm/{packages/utils → utils}/env/lib/esm/index.js +0 -0
  37. /package/lib/esm/{packages/utils → utils}/object-utils/lib/esm/index.js +0 -0
  38. /package/lib/esm/{packages/utils → utils}/type-assertion/lib/esm/index.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @hi-ui/hiui
2
2
 
3
+ ## 4.1.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2435](https://github.com/XiaoMi/hiui/pull/2435) [`92d03cf74`](https://github.com/XiaoMi/hiui/commit/92d03cf7464ab19e08a912deb41984aa0d71340c) Thanks [@chownchen](https://github.com/chownchen)! - EllipsisTooltip: api and docs update
8
+
9
+ - Updated dependencies [[`c3e490027`](https://github.com/XiaoMi/hiui/commit/c3e49002752965c90fdf73f9be26d85b9252be19)]:
10
+ - @hi-ui/ellipsis-tooltip@4.1.0
11
+
12
+ ## 4.1.21
13
+
14
+ ### Patch Changes
15
+
16
+ - [#2429](https://github.com/XiaoMi/hiui/pull/2429) [`72e2adbbd`](https://github.com/XiaoMi/hiui/commit/72e2adbbd78911c14fa541492efb55873662657c) Thanks [@zyprepare](https://github.com/zyprepare)! - Upload 修复问题: maxSize 设置后,上传图片超出大小时无效果
17
+
18
+ - [#2431](https://github.com/XiaoMi/hiui/pull/2431) [`93489d394`](https://github.com/XiaoMi/hiui/commit/93489d394264189b783dde21169e6a3d458e9d6e) Thanks [@zyprepare](https://github.com/zyprepare)! - DatePicker 样式优化: 日历面板显示界面过小
19
+
20
+ - Updated dependencies [[`72e2adbbd`](https://github.com/XiaoMi/hiui/commit/72e2adbbd78911c14fa541492efb55873662657c), [`93489d394`](https://github.com/XiaoMi/hiui/commit/93489d394264189b783dde21169e6a3d458e9d6e)]:
21
+ - @hi-ui/upload@4.1.2
22
+ - @hi-ui/date-picker@4.0.15
23
+
3
24
  ## 4.1.20
4
25
 
5
26
  ### Patch Changes
package/lib/cjs/index.js CHANGED
@@ -51,9 +51,7 @@ var drawer = require('@hi-ui/drawer');
51
51
 
52
52
  var dropdown = require('@hi-ui/dropdown');
53
53
 
54
- require('./packages/ui/ellipsis-tooltip/lib/esm/styles/index.scss.js');
55
-
56
- var EllipsisTooltip = require('./packages/ui/ellipsis-tooltip/lib/esm/EllipsisTooltip.js');
54
+ var ellipsisTooltip = require('@hi-ui/ellipsis-tooltip');
57
55
 
58
56
  var emptyState = require('@hi-ui/empty-state');
59
57
 
@@ -71,9 +69,9 @@ var list = require('@hi-ui/list');
71
69
 
72
70
  var loading = require('@hi-ui/loading');
73
71
 
74
- var LocaleContext = require('./packages/ui/locale-context/lib/esm/LocaleContext.js');
72
+ var LocaleContext = require('./ui/locale-context/lib/esm/LocaleContext.js');
75
73
 
76
- var LocaleProvider = require('./packages/ui/locale-context/lib/esm/LocaleProvider.js');
74
+ var LocaleProvider = require('./ui/locale-context/lib/esm/LocaleProvider.js');
77
75
 
78
76
  var menu = require('@hi-ui/menu');
79
77
 
@@ -129,7 +127,7 @@ var timePicker = require('@hi-ui/time-picker');
129
127
 
130
128
  var timeline = require('@hi-ui/timeline');
131
129
 
132
- var Tooltip = require('@hi-ui/tooltip');
130
+ var tooltip = require('@hi-ui/tooltip');
133
131
 
134
132
  var transfer = require('@hi-ui/transfer');
135
133
 
@@ -193,6 +191,8 @@ var drawer__default = /*#__PURE__*/_interopDefaultLegacy(drawer);
193
191
 
194
192
  var dropdown__default = /*#__PURE__*/_interopDefaultLegacy(dropdown);
195
193
 
194
+ var ellipsisTooltip__default = /*#__PURE__*/_interopDefaultLegacy(ellipsisTooltip);
195
+
196
196
  var emptyState__default = /*#__PURE__*/_interopDefaultLegacy(emptyState);
197
197
 
198
198
  var filter__default = /*#__PURE__*/_interopDefaultLegacy(filter);
@@ -263,7 +263,7 @@ var timePicker__default = /*#__PURE__*/_interopDefaultLegacy(timePicker);
263
263
 
264
264
  var timeline__default = /*#__PURE__*/_interopDefaultLegacy(timeline);
265
265
 
266
- var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
266
+ var tooltip__default = /*#__PURE__*/_interopDefaultLegacy(tooltip);
267
267
 
268
268
  var transfer__default = /*#__PURE__*/_interopDefaultLegacy(transfer);
269
269
 
@@ -393,7 +393,12 @@ Object.defineProperty(exports, 'Dropdown', {
393
393
  return dropdown__default["default"];
394
394
  }
395
395
  });
396
- exports.EllipsisTooltip = EllipsisTooltip.EllipsisTooltip;
396
+ Object.defineProperty(exports, 'EllipsisTooltip', {
397
+ enumerable: true,
398
+ get: function get() {
399
+ return ellipsisTooltip__default["default"];
400
+ }
401
+ });
397
402
  Object.defineProperty(exports, 'EmptyState', {
398
403
  enumerable: true,
399
404
  get: function get() {
@@ -611,7 +616,7 @@ Object.defineProperty(exports, 'Timeline', {
611
616
  Object.defineProperty(exports, 'Tooltip', {
612
617
  enumerable: true,
613
618
  get: function get() {
614
- return Tooltip__default["default"];
619
+ return tooltip__default["default"];
615
620
  }
616
621
  });
617
622
  Object.defineProperty(exports, 'Transfer', {
@@ -818,6 +823,14 @@ Object.keys(dropdown).forEach(function (k) {
818
823
  }
819
824
  });
820
825
  });
826
+ Object.keys(ellipsisTooltip).forEach(function (k) {
827
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
828
+ enumerable: true,
829
+ get: function get() {
830
+ return ellipsisTooltip[k];
831
+ }
832
+ });
833
+ });
821
834
  Object.keys(emptyState).forEach(function (k) {
822
835
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
823
836
  enumerable: true,
@@ -1098,11 +1111,11 @@ Object.keys(timeline).forEach(function (k) {
1098
1111
  }
1099
1112
  });
1100
1113
  });
1101
- Object.keys(Tooltip).forEach(function (k) {
1114
+ Object.keys(tooltip).forEach(function (k) {
1102
1115
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
1103
1116
  enumerable: true,
1104
1117
  get: function get() {
1105
- return Tooltip[k];
1118
+ return tooltip[k];
1106
1119
  }
1107
1120
  });
1108
1121
  });
package/lib/esm/index.js CHANGED
@@ -43,8 +43,8 @@ export * from '@hi-ui/drawer';
43
43
  export { default as Drawer } from '@hi-ui/drawer';
44
44
  export * from '@hi-ui/dropdown';
45
45
  export { default as Dropdown } from '@hi-ui/dropdown';
46
- import './packages/ui/ellipsis-tooltip/lib/esm/styles/index.scss.js';
47
- export { EllipsisTooltip } from './packages/ui/ellipsis-tooltip/lib/esm/EllipsisTooltip.js';
46
+ export * from '@hi-ui/ellipsis-tooltip';
47
+ export { default as EllipsisTooltip } from '@hi-ui/ellipsis-tooltip';
48
48
  export * from '@hi-ui/empty-state';
49
49
  export { default as EmptyState } from '@hi-ui/empty-state';
50
50
  export * from '@hi-ui/filter';
@@ -61,8 +61,8 @@ export * from '@hi-ui/list';
61
61
  export { default as List } from '@hi-ui/list';
62
62
  export * from '@hi-ui/loading';
63
63
  export { default as Loading } from '@hi-ui/loading';
64
- export { getLanguage, useLocaleContext } from './packages/ui/locale-context/lib/esm/LocaleContext.js';
65
- export { LocaleProvider as LocaleContext, LocaleProvider } from './packages/ui/locale-context/lib/esm/LocaleProvider.js';
64
+ export { getLanguage, useLocaleContext } from './ui/locale-context/lib/esm/LocaleContext.js';
65
+ export { LocaleProvider as LocaleContext, LocaleProvider } from './ui/locale-context/lib/esm/LocaleProvider.js';
66
66
  export * from '@hi-ui/menu';
67
67
  export { default as Menu } from '@hi-ui/menu';
68
68
  export * from '@hi-ui/message';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/hiui",
3
- "version": "4.1.20",
3
+ "version": "4.1.22",
4
4
  "description": "The root-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -59,10 +59,11 @@
59
59
  "@hi-ui/checkbox": "^4.0.5",
60
60
  "@hi-ui/collapse": "^4.1.0",
61
61
  "@hi-ui/counter": "^4.0.5",
62
- "@hi-ui/date-picker": "^4.0.14",
62
+ "@hi-ui/date-picker": "^4.0.15",
63
63
  "@hi-ui/descriptions": "^4.1.1",
64
64
  "@hi-ui/drawer": "^4.0.7",
65
65
  "@hi-ui/dropdown": "^4.0.5",
66
+ "@hi-ui/ellipsis-tooltip": "^4.1.0",
66
67
  "@hi-ui/empty-state": "^4.0.4",
67
68
  "@hi-ui/filter": "^4.1.0",
68
69
  "@hi-ui/form": "^4.1.2",
@@ -106,7 +107,7 @@
106
107
  "@hi-ui/transfer": "^4.0.9",
107
108
  "@hi-ui/tree": "^4.2.0",
108
109
  "@hi-ui/tree-select": "^4.0.10",
109
- "@hi-ui/upload": "^4.1.1",
110
+ "@hi-ui/upload": "^4.1.2",
110
111
  "@hi-ui/watermark": "^4.0.4",
111
112
  "@hi-ui/zen-mode": "^4.0.4"
112
113
  },
@@ -1,18 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- 'use strict';
11
-
12
- Object.defineProperty(exports, '__esModule', {
13
- value: true
14
- });
15
- var classnames = {
16
- exports: {}
17
- };
18
- exports.classnames = classnames;
@@ -1,76 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- 'use strict';
11
-
12
- var _typeof = require("@babel/runtime/helpers/typeof");
13
-
14
- Object.defineProperty(exports, '__esModule', {
15
- value: true
16
- });
17
-
18
- var index = require('../../_virtual/index.js');
19
- /*!
20
- Copyright (c) 2018 Jed Watson.
21
- Licensed under the MIT License (MIT), see
22
- http://jedwatson.github.io/classnames
23
- */
24
-
25
-
26
- (function (module) {
27
- /* global define */
28
- (function () {
29
- var hasOwn = {}.hasOwnProperty;
30
-
31
- function classNames() {
32
- var classes = [];
33
-
34
- for (var i = 0; i < arguments.length; i++) {
35
- var arg = arguments[i];
36
- if (!arg) continue;
37
-
38
- var argType = _typeof(arg);
39
-
40
- if (argType === 'string' || argType === 'number') {
41
- classes.push(arg);
42
- } else if (Array.isArray(arg)) {
43
- if (arg.length) {
44
- var inner = classNames.apply(null, arg);
45
-
46
- if (inner) {
47
- classes.push(inner);
48
- }
49
- }
50
- } else if (argType === 'object') {
51
- if (arg.toString === Object.prototype.toString) {
52
- for (var key in arg) {
53
- if (hasOwn.call(arg, key) && arg[key]) {
54
- classes.push(key);
55
- }
56
- }
57
- } else {
58
- classes.push(arg.toString());
59
- }
60
- }
61
- }
62
-
63
- return classes.join(' ');
64
- }
65
-
66
- if (module.exports) {
67
- classNames["default"] = classNames;
68
- module.exports = classNames;
69
- } else {
70
- window.classNames = classNames;
71
- }
72
- })();
73
- })(index.classnames);
74
-
75
- var cx = index.classnames.exports;
76
- exports["default"] = cx;
@@ -1,130 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- 'use strict';
11
-
12
- var _typeof = require("@babel/runtime/helpers/typeof");
13
-
14
- Object.defineProperty(exports, '__esModule', {
15
- value: true
16
- });
17
-
18
- var tslib = require('tslib');
19
-
20
- var React = require('react');
21
-
22
- var index$2 = require('../../../../utils/classname/lib/esm/index.js');
23
-
24
- var index$1 = require('../../../../utils/env/lib/esm/index.js');
25
-
26
- var Tooltip = require('@hi-ui/tooltip');
27
-
28
- var index = require('../../../../../node_modules/classnames/index.js');
29
-
30
- function _interopDefaultLegacy(e) {
31
- return e && _typeof(e) === 'object' && 'default' in e ? e : {
32
- 'default': e
33
- };
34
- }
35
-
36
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
37
-
38
- var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
39
- /** @LICENSE
40
- * @hi-ui/ellipsis-tooltip
41
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/ellipsis-tooltip#readme
42
- *
43
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE file in the root directory of this source tree.
47
- */
48
-
49
-
50
- var ELLIPSIS_TOOLTIP_PREFIX = index$2.getPrefixCls('ellipsis-tooltip'); // 格式化子文本,超出规定字数时展示...
51
-
52
- var formatChildText = function formatChildText(text, maxTextCount) {
53
- var stringText = text === null || text === void 0 ? void 0 : text.toString();
54
- var canTooltip = maxTextCount > 0 && stringText.length > maxTextCount;
55
- return canTooltip ? stringText.slice(0, maxTextCount) + "..." : text;
56
- };
57
- /**
58
- * 这是一个文字超出后,展示省略号,并且鼠标悬停时出现全部描述的组件
59
- */
60
-
61
-
62
- var EllipsisTooltip = function EllipsisTooltip(_a) {
63
- var _cx;
64
-
65
- var _a$prefixCls = _a.prefixCls,
66
- prefixCls = _a$prefixCls === void 0 ? ELLIPSIS_TOOLTIP_PREFIX : _a$prefixCls,
67
- _a$role = _a.role,
68
- role = _a$role === void 0 ? 'ellipsis-tooltip' : _a$role,
69
- className = _a.className,
70
- children = _a.children,
71
- _a$numberOfLines = _a.numberOfLines,
72
- numberOfLines = _a$numberOfLines === void 0 ? 1 : _a$numberOfLines,
73
- _a$maxTextCount = _a.maxTextCount,
74
- maxTextCount = _a$maxTextCount === void 0 ? 0 : _a$maxTextCount,
75
- rest = tslib.__rest(_a, ["prefixCls", "role", "className", "children", "numberOfLines", "maxTextCount"]);
76
-
77
- var cls = index["default"](prefixCls, className, (_cx = {}, _cx[prefixCls + "--single"] = maxTextCount === 0 && (!numberOfLines || numberOfLines <= 1), _cx[prefixCls + "--multiple"] = numberOfLines > 1, _cx));
78
-
79
- var _useState = React.useState(true),
80
- disableTooltip = _useState[0],
81
- setDisableTooltip = _useState[1];
82
-
83
- var contentRef = React.useRef(null); // 检查文本超出省略号
84
-
85
- var handleCheckEllipsis = React.useCallback(function () {
86
- var _a, _b, _c;
87
-
88
- if (contentRef.current) {
89
- // 多行超出
90
- if (numberOfLines > 1) {
91
- var style = window.getComputedStyle(contentRef.current, null);
92
- var fontSize = style.fontSize;
93
- var lineHeight = style.lineHeight === 'normal' ? +fontSize : +style.lineHeight;
94
- var textLines = Math.round(+style.height / lineHeight);
95
- setDisableTooltip(textLines <= numberOfLines);
96
- } else {
97
- // 单行超出
98
- var rect = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
99
- var parentRect = (_c = (_b = contentRef.current) === null || _b === void 0 ? void 0 : _b.parentNode) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
100
- setDisableTooltip(+(rect === null || rect === void 0 ? void 0 : rect.width) <= parentRect.width);
101
- }
102
- }
103
- }, [numberOfLines]);
104
- React.useEffect(function () {
105
- // 当文字字数超出有配置时,单独处理
106
- if (maxTextCount > 0 && maxTextCount < (children === null || children === void 0 ? void 0 : children.length)) {
107
- setDisableTooltip(false);
108
- } else {
109
- handleCheckEllipsis();
110
- }
111
- }, [children, maxTextCount, handleCheckEllipsis]);
112
- return /*#__PURE__*/React__default["default"].createElement(Tooltip__default["default"], Object.assign({
113
- title: children,
114
- disabled: disableTooltip
115
- }, rest), /*#__PURE__*/React__default["default"].createElement("div", {
116
- role: role,
117
- className: cls,
118
- style: {
119
- WebkitLineClamp: numberOfLines > 1 ? numberOfLines : undefined
120
- }
121
- }, /*#__PURE__*/React__default["default"].createElement("span", {
122
- ref: contentRef
123
- }, formatChildText(children, maxTextCount))));
124
- };
125
-
126
- if (index$1.__DEV__) {
127
- EllipsisTooltip.displayName = 'EllipsisTooltip';
128
- }
129
-
130
- exports.EllipsisTooltip = EllipsisTooltip;
@@ -1,42 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- 'use strict';
11
-
12
- var _typeof = require("@babel/runtime/helpers/typeof");
13
-
14
- Object.defineProperty(exports, '__esModule', {
15
- value: true
16
- });
17
-
18
- var __styleInject__ = require('inject-head-style');
19
-
20
- function _interopDefaultLegacy(e) {
21
- return e && _typeof(e) === 'object' && 'default' in e ? e : {
22
- 'default': e
23
- };
24
- }
25
-
26
- var __styleInject____default = /*#__PURE__*/_interopDefaultLegacy(__styleInject__);
27
- /** @LICENSE
28
- * @hi-ui/ellipsis-tooltip
29
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/ellipsis-tooltip#readme
30
- *
31
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
32
- *
33
- * This source code is licensed under the MIT license found in the
34
- * LICENSE file in the root directory of this source tree.
35
- */
36
-
37
-
38
- var css_248z = ".hi-v4-ellipsis-tooltip.hi-v4-ellipsis-tooltip--single {overflow: hidden;white-space: nowrap;text-overflow: ellipsis; }.hi-v4-ellipsis-tooltip.hi-v4-ellipsis-tooltip--multiple {overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical; }";
39
-
40
- __styleInject____default["default"](css_248z);
41
-
42
- exports["default"] = css_248z;
@@ -1,45 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- 'use strict';
11
-
12
- Object.defineProperty(exports, '__esModule', {
13
- value: true
14
- });
15
-
16
- var index = require('../../../../../node_modules/classnames/index.js');
17
- /** @LICENSE
18
- * @hi-ui/classname
19
- * https://github.com/XiaoMi/hiui#readme
20
- *
21
- * Copyright (c) Flcwl <flcwl@vip.qq.com>.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */
26
-
27
- /**
28
- * 给组件选择器类添加上 hiui 版本控制
29
- *
30
- * @param cls 选择器类
31
- * @param componentPrefix 类前缀
32
- * @returns 带版本控制的选择器类
33
- */
34
-
35
-
36
- var getPrefixCls = function getPrefixCls(cls, componentPrefix) {
37
- if (componentPrefix === void 0) {
38
- componentPrefix = 'hi-v4';
39
- }
40
-
41
- return componentPrefix + "-" + cls;
42
- };
43
-
44
- exports.cx = index["default"];
45
- exports.getPrefixCls = getPrefixCls;
@@ -1,13 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- var classnames = {
11
- exports: {}
12
- };
13
- export { classnames as c };
@@ -1,69 +0,0 @@
1
- import _typeof from "@babel/runtime/helpers/esm/typeof";
2
-
3
- /** @LICENSE
4
- * @hi-ui/hiui
5
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
6
- *
7
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- import { c as classnames } from '../../_virtual/index.js';
13
- /*!
14
- Copyright (c) 2018 Jed Watson.
15
- Licensed under the MIT License (MIT), see
16
- http://jedwatson.github.io/classnames
17
- */
18
-
19
- (function (module) {
20
- /* global define */
21
- (function () {
22
- var hasOwn = {}.hasOwnProperty;
23
-
24
- function classNames() {
25
- var classes = [];
26
-
27
- for (var i = 0; i < arguments.length; i++) {
28
- var arg = arguments[i];
29
- if (!arg) continue;
30
-
31
- var argType = _typeof(arg);
32
-
33
- if (argType === 'string' || argType === 'number') {
34
- classes.push(arg);
35
- } else if (Array.isArray(arg)) {
36
- if (arg.length) {
37
- var inner = classNames.apply(null, arg);
38
-
39
- if (inner) {
40
- classes.push(inner);
41
- }
42
- }
43
- } else if (argType === 'object') {
44
- if (arg.toString === Object.prototype.toString) {
45
- for (var key in arg) {
46
- if (hasOwn.call(arg, key) && arg[key]) {
47
- classes.push(key);
48
- }
49
- }
50
- } else {
51
- classes.push(arg.toString());
52
- }
53
- }
54
- }
55
-
56
- return classes.join(' ');
57
- }
58
-
59
- if (module.exports) {
60
- classNames["default"] = classNames;
61
- module.exports = classNames;
62
- } else {
63
- window.classNames = classNames;
64
- }
65
- })();
66
- })(classnames);
67
-
68
- var cx = classnames.exports;
69
- export { cx as default };
@@ -1,106 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- import { __rest } from 'tslib';
11
- import React, { useState, useRef, useCallback, useEffect } from 'react';
12
- import { getPrefixCls } from '../../../../utils/classname/lib/esm/index.js';
13
- import { __DEV__ } from '../../../../utils/env/lib/esm/index.js';
14
- import Tooltip__default from '@hi-ui/tooltip';
15
- import cx from '../../../../../node_modules/classnames/index.js';
16
- /** @LICENSE
17
- * @hi-ui/ellipsis-tooltip
18
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/ellipsis-tooltip#readme
19
- *
20
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- */
25
-
26
- var ELLIPSIS_TOOLTIP_PREFIX = getPrefixCls('ellipsis-tooltip'); // 格式化子文本,超出规定字数时展示...
27
-
28
- var formatChildText = function formatChildText(text, maxTextCount) {
29
- var stringText = text === null || text === void 0 ? void 0 : text.toString();
30
- var canTooltip = maxTextCount > 0 && stringText.length > maxTextCount;
31
- return canTooltip ? stringText.slice(0, maxTextCount) + "..." : text;
32
- };
33
- /**
34
- * 这是一个文字超出后,展示省略号,并且鼠标悬停时出现全部描述的组件
35
- */
36
-
37
-
38
- var EllipsisTooltip = function EllipsisTooltip(_a) {
39
- var _cx;
40
-
41
- var _a$prefixCls = _a.prefixCls,
42
- prefixCls = _a$prefixCls === void 0 ? ELLIPSIS_TOOLTIP_PREFIX : _a$prefixCls,
43
- _a$role = _a.role,
44
- role = _a$role === void 0 ? 'ellipsis-tooltip' : _a$role,
45
- className = _a.className,
46
- children = _a.children,
47
- _a$numberOfLines = _a.numberOfLines,
48
- numberOfLines = _a$numberOfLines === void 0 ? 1 : _a$numberOfLines,
49
- _a$maxTextCount = _a.maxTextCount,
50
- maxTextCount = _a$maxTextCount === void 0 ? 0 : _a$maxTextCount,
51
- rest = __rest(_a, ["prefixCls", "role", "className", "children", "numberOfLines", "maxTextCount"]);
52
-
53
- var cls = cx(prefixCls, className, (_cx = {}, _cx[prefixCls + "--single"] = maxTextCount === 0 && (!numberOfLines || numberOfLines <= 1), _cx[prefixCls + "--multiple"] = numberOfLines > 1, _cx));
54
-
55
- var _useState = useState(true),
56
- disableTooltip = _useState[0],
57
- setDisableTooltip = _useState[1];
58
-
59
- var contentRef = useRef(null); // 检查文本超出省略号
60
-
61
- var handleCheckEllipsis = useCallback(function () {
62
- var _a, _b, _c;
63
-
64
- if (contentRef.current) {
65
- // 多行超出
66
- if (numberOfLines > 1) {
67
- var style = window.getComputedStyle(contentRef.current, null);
68
- var fontSize = style.fontSize;
69
- var lineHeight = style.lineHeight === 'normal' ? +fontSize : +style.lineHeight;
70
- var textLines = Math.round(+style.height / lineHeight);
71
- setDisableTooltip(textLines <= numberOfLines);
72
- } else {
73
- // 单行超出
74
- var rect = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
75
- var parentRect = (_c = (_b = contentRef.current) === null || _b === void 0 ? void 0 : _b.parentNode) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
76
- setDisableTooltip(+(rect === null || rect === void 0 ? void 0 : rect.width) <= parentRect.width);
77
- }
78
- }
79
- }, [numberOfLines]);
80
- useEffect(function () {
81
- // 当文字字数超出有配置时,单独处理
82
- if (maxTextCount > 0 && maxTextCount < (children === null || children === void 0 ? void 0 : children.length)) {
83
- setDisableTooltip(false);
84
- } else {
85
- handleCheckEllipsis();
86
- }
87
- }, [children, maxTextCount, handleCheckEllipsis]);
88
- return /*#__PURE__*/React.createElement(Tooltip__default, Object.assign({
89
- title: children,
90
- disabled: disableTooltip
91
- }, rest), /*#__PURE__*/React.createElement("div", {
92
- role: role,
93
- className: cls,
94
- style: {
95
- WebkitLineClamp: numberOfLines > 1 ? numberOfLines : undefined
96
- }
97
- }, /*#__PURE__*/React.createElement("span", {
98
- ref: contentRef
99
- }, formatChildText(children, maxTextCount))));
100
- };
101
-
102
- if (__DEV__) {
103
- EllipsisTooltip.displayName = 'EllipsisTooltip';
104
- }
105
-
106
- export { EllipsisTooltip };
@@ -1,25 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- import __styleInject__ from 'inject-head-style';
11
- /** @LICENSE
12
- * @hi-ui/ellipsis-tooltip
13
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/ellipsis-tooltip#readme
14
- *
15
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
16
- *
17
- * This source code is licensed under the MIT license found in the
18
- * LICENSE file in the root directory of this source tree.
19
- */
20
-
21
- var css_248z = ".hi-v4-ellipsis-tooltip.hi-v4-ellipsis-tooltip--single {overflow: hidden;white-space: nowrap;text-overflow: ellipsis; }.hi-v4-ellipsis-tooltip.hi-v4-ellipsis-tooltip--multiple {overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical; }";
22
-
23
- __styleInject__(css_248z);
24
-
25
- export { css_248z as default };
@@ -1,37 +0,0 @@
1
- /** @LICENSE
2
- * @hi-ui/hiui
3
- * https://github.com/XiaoMi/hiui/tree/master/packages/ui/hiui#readme
4
- *
5
- * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- export { default as cx } from '../../../../../node_modules/classnames/index.js';
11
- /** @LICENSE
12
- * @hi-ui/classname
13
- * https://github.com/XiaoMi/hiui#readme
14
- *
15
- * Copyright (c) Flcwl <flcwl@vip.qq.com>.
16
- *
17
- * This source code is licensed under the MIT license found in the
18
- * LICENSE file in the root directory of this source tree.
19
- */
20
-
21
- /**
22
- * 给组件选择器类添加上 hiui 版本控制
23
- *
24
- * @param cls 选择器类
25
- * @param componentPrefix 类前缀
26
- * @returns 带版本控制的选择器类
27
- */
28
-
29
- var getPrefixCls = function getPrefixCls(cls, componentPrefix) {
30
- if (componentPrefix === void 0) {
31
- componentPrefix = 'hi-v4';
32
- }
33
-
34
- return componentPrefix + "-" + cls;
35
- };
36
-
37
- export { getPrefixCls };