@fle-ui/next 1.0.5-alpha.4 → 1.0.5-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@fle-ui/next.css +1859 -5161
- package/dist/@fle-ui/next.css.map +1 -1
- package/dist/@fle-ui/next.js +6349 -6355
- package/dist/@fle-ui/next.js.map +1 -1
- package/dist/@fle-ui/next.min.css +2 -2
- package/dist/@fle-ui/next.min.css.map +1 -1
- package/dist/@fle-ui/next.min.js +4 -4
- package/dist/@fle-ui/next.min.js.map +1 -1
- package/es/affix/style/index.css +0 -42
- package/es/alert/style/index.css +17 -59
- package/es/anchor/Anchor.d.ts +1 -1
- package/es/anchor/style/index.css +5 -47
- package/es/auto-complete/style/index.css +1 -43
- package/es/avatar/avatar.js +8 -4
- package/es/avatar/style/index.css +1 -43
- package/es/back-top/style/index.css +3 -45
- package/es/badge/style/index.css +23 -65
- package/es/breadcrumb/style/index.css +7 -49
- package/es/button/button.d.ts +1 -1
- package/es/button/button.js +11 -7
- package/es/button/style/index.css +156 -206
- package/es/calendar/style/index.css +8 -50
- package/es/card/style/index.css +17 -59
- package/es/carousel/style/index.css +1 -43
- package/es/cascader/index.d.ts +1 -1
- package/es/cascader/index.js +13 -9
- package/es/cascader/style/index.css +24 -66
- package/es/checkbox/Checkbox.js +8 -4
- package/es/checkbox/style/index.css +17 -59
- package/es/collapse/style/index.css +8 -50
- package/es/comment/style/index.css +5 -47
- package/es/config-provider/context.js +5 -1
- package/es/config-provider/style/index.css +0 -42
- package/es/date-picker/style/index.css +84 -126
- package/es/descriptions/style/index.css +8 -50
- package/es/divider/style/index.css +7 -49
- package/es/drawer/index.js +5 -1
- package/es/drawer/style/index.css +5 -47
- package/es/dropdown/style/index.css +17 -59
- package/es/empty/style/index.css +2 -44
- package/es/form/style/index.css +18 -60
- package/es/grid/col.js +5 -1
- package/es/grid/row.js +5 -1
- package/es/grid/style/index.css +0 -42
- package/es/icon/style/index.css +0 -42
- package/es/image/style/index.css +1 -43
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -2
- package/es/input/Password.d.ts +1 -1
- package/es/input/Password.js +9 -5
- package/es/input/Search.js +9 -5
- package/es/input/style/index.css +65 -107
- package/es/input-number/index.js +1 -1
- package/es/input-number/style/index.css +68 -110
- package/es/layout/Sider.js +11 -7
- package/es/layout/layout.js +6 -2
- package/es/layout/style/index.css +4 -46
- package/es/list/style/index.css +17 -59
- package/es/locale-provider/index.d.ts +2 -2
- package/es/locale-provider/style/index.css +0 -42
- package/es/mentions/index.d.ts +1 -1
- package/es/mentions/index.js +8 -4
- package/es/mentions/style/index.css +32 -74
- package/es/menu/style/index.css +46 -88
- package/es/message/style/index.css +5 -47
- package/es/modal/style/confirm.less +2 -2
- package/es/modal/style/css.js +2 -1
- package/es/modal/style/index.css +3 -45
- package/es/modal/style/index.js +2 -1
- package/es/modal/style/index.less +0 -1
- package/es/modal/style/modal.less +1 -1
- package/es/modal/style/rtl.less +2 -1
- package/es/notification/style/index.css +8 -50
- package/es/page-header/style/index.css +6 -48
- package/es/pagination/style/index.css +99 -118
- package/es/pagination/style/index.less +63 -22
- package/es/popconfirm/style/index.css +0 -42
- package/es/popover/index.js +5 -1
- package/es/popover/style/index.css +17 -59
- package/es/progress/style/index.css +17 -59
- package/es/radio/radio.js +9 -5
- package/es/radio/style/index.css +49 -91
- package/es/rate/index.js +5 -1
- package/es/rate/style/index.css +2 -44
- package/es/result/style/index.css +6 -48
- package/es/segmented/index.d.ts +1 -1
- package/es/segmented/index.js +6 -2
- package/es/segmented/style/index.css +3 -45
- package/es/select/style/index.css +32 -74
- package/es/skeleton/style/index.css +10 -52
- package/es/skeleton/style/index.less +3 -3
- package/es/slider/index.d.ts +1 -1
- package/es/slider/index.js +8 -4
- package/es/slider/style/index.css +22 -56
- package/es/slider/style/index.less +9 -0
- package/es/space/style/index.css +0 -42
- package/es/spin/style/index.css +4 -46
- package/es/statistic/style/index.css +3 -45
- package/es/steps/style/index.css +44 -86
- package/es/style/color/colors.less +6 -6
- package/es/style/index.css +13 -55
- package/es/style/themes/compact.less +6 -12
- package/es/style/themes/dark.less +106 -445
- package/es/style/themes/default.less +35 -61
- package/es/style/themes/index.less +2 -3
- package/es/style/themes/variable.less +39 -80
- package/es/switch/index.js +10 -6
- package/es/switch/style/index.css +6 -48
- package/es/table/hooks/useFilter/FilterDropdown.js +2 -16
- package/es/table/style/index.css +35 -77
- package/es/table/util.d.ts +1 -1
- package/es/tabs/style/index.css +22 -64
- package/es/tag/index.d.ts +1 -1
- package/es/tag/index.js +8 -4
- package/es/tag/style/index.css +39 -81
- package/es/time-picker/index.js +5 -1
- package/es/time-picker/style/index.css +0 -42
- package/es/timeline/index.d.ts +2 -2
- package/es/timeline/style/index.css +15 -57
- package/es/tooltip/index.d.ts +3 -3
- package/es/tooltip/index.js +9 -5
- package/es/tooltip/style/index.css +12 -54
- package/es/transfer/index.d.ts +3 -3
- package/es/transfer/style/index.css +28 -70
- package/es/tree/DirectoryTree.js +5 -1
- package/es/tree/index.d.ts +2 -2
- package/es/tree/style/index.css +29 -71
- package/es/tree-select/style/index.css +27 -69
- package/es/typography/Typography.js +6 -2
- package/es/typography/style/index.css +24 -66
- package/es/upload/Dragger.js +5 -1
- package/es/upload/Upload.js +10 -6
- package/es/upload/UploadList/index.js +13 -9
- package/es/upload/index.d.ts +1 -1
- package/es/upload/style/index.css +23 -65
- package/lib/affix/style/index.css +0 -42
- package/lib/alert/style/index.css +17 -59
- package/lib/anchor/Anchor.d.ts +1 -1
- package/lib/anchor/style/index.css +5 -47
- package/lib/auto-complete/style/index.css +1 -43
- package/lib/avatar/avatar.js +9 -5
- package/lib/avatar/style/index.css +1 -43
- package/lib/back-top/style/index.css +3 -45
- package/lib/badge/style/index.css +23 -65
- package/lib/breadcrumb/style/index.css +7 -49
- package/lib/button/button.d.ts +1 -1
- package/lib/button/button.js +13 -9
- package/lib/button/style/index.css +156 -206
- package/lib/calendar/style/index.css +8 -50
- package/lib/card/style/index.css +17 -59
- package/lib/carousel/style/index.css +1 -43
- package/lib/cascader/index.d.ts +1 -1
- package/lib/cascader/index.js +16 -12
- package/lib/cascader/style/index.css +24 -66
- package/lib/checkbox/Checkbox.js +10 -6
- package/lib/checkbox/style/index.css +17 -59
- package/lib/collapse/style/index.css +8 -50
- package/lib/comment/style/index.css +5 -47
- package/lib/config-provider/context.js +5 -1
- package/lib/config-provider/style/index.css +0 -42
- package/lib/date-picker/style/index.css +84 -126
- package/lib/descriptions/style/index.css +8 -50
- package/lib/divider/style/index.css +7 -49
- package/lib/drawer/index.js +5 -1
- package/lib/drawer/style/index.css +5 -47
- package/lib/dropdown/style/index.css +17 -59
- package/lib/empty/style/index.css +2 -44
- package/lib/form/style/index.css +18 -60
- package/lib/grid/col.js +5 -1
- package/lib/grid/row.js +5 -1
- package/lib/grid/style/index.css +0 -42
- package/lib/icon/style/index.css +0 -42
- package/lib/image/style/index.css +1 -43
- package/lib/index.d.ts +1 -2
- package/lib/index.js +0 -8
- package/lib/input/Password.d.ts +1 -1
- package/lib/input/Password.js +10 -6
- package/lib/input/Search.js +11 -7
- package/lib/input/style/index.css +65 -107
- package/lib/input-number/index.js +1 -1
- package/lib/input-number/style/index.css +68 -110
- package/lib/layout/Sider.js +13 -9
- package/lib/layout/layout.js +7 -3
- package/lib/layout/style/index.css +4 -46
- package/lib/list/style/index.css +17 -59
- package/lib/locale-provider/index.d.ts +2 -2
- package/lib/locale-provider/style/index.css +0 -42
- package/lib/mentions/index.d.ts +1 -1
- package/lib/mentions/index.js +10 -6
- package/lib/mentions/style/index.css +32 -74
- package/lib/menu/style/index.css +46 -88
- package/lib/message/style/index.css +5 -47
- package/lib/modal/style/confirm.less +2 -2
- package/lib/modal/style/index.css +3 -45
- package/lib/modal/style/index.less +0 -1
- package/lib/modal/style/modal.less +1 -1
- package/lib/modal/style/rtl.less +2 -1
- package/lib/notification/style/index.css +8 -50
- package/lib/page-header/style/index.css +6 -48
- package/lib/pagination/style/index.css +99 -118
- package/lib/pagination/style/index.less +63 -22
- package/lib/popconfirm/style/index.css +0 -42
- package/lib/popover/index.js +5 -1
- package/lib/popover/style/index.css +17 -59
- package/lib/progress/style/index.css +17 -59
- package/lib/radio/radio.js +11 -7
- package/lib/radio/style/index.css +49 -91
- package/lib/rate/index.js +5 -1
- package/lib/rate/style/index.css +2 -44
- package/lib/result/style/index.css +6 -48
- package/lib/segmented/index.d.ts +1 -1
- package/lib/segmented/index.js +7 -3
- package/lib/segmented/style/index.css +3 -45
- package/lib/select/style/index.css +32 -74
- package/lib/skeleton/style/index.css +10 -52
- package/lib/skeleton/style/index.less +3 -3
- package/lib/slider/index.d.ts +1 -1
- package/lib/slider/index.js +9 -5
- package/lib/slider/style/index.css +22 -56
- package/lib/slider/style/index.less +9 -0
- package/lib/space/style/index.css +0 -42
- package/lib/spin/style/index.css +4 -46
- package/lib/statistic/style/index.css +3 -45
- package/lib/steps/style/index.css +44 -86
- package/lib/style/color/colors.less +6 -6
- package/lib/style/index.css +13 -55
- package/lib/style/themes/compact.less +6 -12
- package/lib/style/themes/dark.less +106 -445
- package/lib/style/themes/default.less +35 -61
- package/lib/style/themes/index.less +2 -3
- package/lib/style/themes/variable.less +39 -80
- package/lib/switch/index.js +12 -8
- package/lib/switch/style/index.css +6 -48
- package/lib/table/hooks/useFilter/FilterDropdown.js +2 -16
- package/lib/table/style/index.css +35 -77
- package/lib/table/util.d.ts +1 -1
- package/lib/tabs/style/index.css +22 -64
- package/lib/tag/index.d.ts +1 -1
- package/lib/tag/index.js +9 -5
- package/lib/tag/style/index.css +39 -81
- package/lib/time-picker/index.js +5 -1
- package/lib/time-picker/style/index.css +0 -42
- package/lib/timeline/index.d.ts +2 -2
- package/lib/timeline/style/index.css +15 -57
- package/lib/tooltip/index.d.ts +3 -3
- package/lib/tooltip/index.js +11 -7
- package/lib/tooltip/style/index.css +12 -54
- package/lib/transfer/index.d.ts +3 -3
- package/lib/transfer/style/index.css +28 -70
- package/lib/tree/DirectoryTree.js +5 -1
- package/lib/tree/index.d.ts +2 -2
- package/lib/tree/style/index.css +29 -71
- package/lib/tree-select/style/index.css +27 -69
- package/lib/typography/Typography.js +7 -3
- package/lib/typography/style/index.css +24 -66
- package/lib/upload/Dragger.js +5 -1
- package/lib/upload/Upload.js +12 -8
- package/lib/upload/UploadList/index.js +16 -12
- package/lib/upload/index.d.ts +1 -1
- package/lib/upload/style/index.css +23 -65
- package/package.json +2 -2
- package/report.html +2 -2
- package/es/config-provider/renderEmpty.d.ts +0 -4
- package/es/config-provider/renderEmpty.js +0 -41
- package/es/pagination/MiniSelect.d.ts +0 -7
- package/es/pagination/MiniSelect.js +0 -12
- package/es/typography/util.d.ts +0 -11
- package/es/typography/util.js +0 -234
- package/es/version/index.d.ts +0 -2
- package/es/version/index.js +0 -4
- package/es/version/style/css.js +0 -2
- package/es/version/style/index.d.ts +0 -1
- package/es/version/style/index.js +0 -2
- package/es/version/version.d.ts +0 -2
- package/es/version/version.js +0 -1
- package/lib/config-provider/renderEmpty.d.ts +0 -4
- package/lib/config-provider/renderEmpty.js +0 -59
- package/lib/pagination/MiniSelect.d.ts +0 -7
- package/lib/pagination/MiniSelect.js +0 -30
- package/lib/typography/util.d.ts +0 -11
- package/lib/typography/util.js +0 -254
- package/lib/version/index.d.ts +0 -2
- package/lib/version/index.js +0 -15
- package/lib/version/style/css.js +0 -3
- package/lib/version/style/index.d.ts +0 -1
- package/lib/version/style/index.js +0 -3
- package/lib/version/version.d.ts +0 -2
- package/lib/version/version.js +0 -8
package/lib/typography/util.js
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
-
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
8
|
-
value: true
|
9
|
-
});
|
10
|
-
exports["default"] = void 0;
|
11
|
-
|
12
|
-
var _reactDom = require("react-dom");
|
13
|
-
|
14
|
-
var React = _interopRequireWildcard(require("react"));
|
15
|
-
|
16
|
-
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
|
17
|
-
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19
|
-
|
20
|
-
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; }
|
21
|
-
|
22
|
-
// We only handle element & text node.
|
23
|
-
var ELEMENT_NODE = 1;
|
24
|
-
var TEXT_NODE = 3;
|
25
|
-
var COMMENT_NODE = 8;
|
26
|
-
var ellipsisContainer;
|
27
|
-
var wrapperStyle = {
|
28
|
-
padding: 0,
|
29
|
-
margin: 0,
|
30
|
-
display: 'inline',
|
31
|
-
lineHeight: 'inherit'
|
32
|
-
};
|
33
|
-
|
34
|
-
function pxToNumber(value) {
|
35
|
-
if (!value) {
|
36
|
-
return 0;
|
37
|
-
}
|
38
|
-
|
39
|
-
var match = value.match(/^\d*(\.\d*)?/);
|
40
|
-
return match ? Number(match[0]) : 0;
|
41
|
-
}
|
42
|
-
|
43
|
-
function styleToString(style) {
|
44
|
-
// There are some different behavior between Firefox & Chrome.
|
45
|
-
// We have to handle this ourself.
|
46
|
-
var styleNames = Array.prototype.slice.apply(style);
|
47
|
-
return styleNames.map(function (name) {
|
48
|
-
return "".concat(name, ": ").concat(style.getPropertyValue(name), ";");
|
49
|
-
}).join('');
|
50
|
-
}
|
51
|
-
|
52
|
-
function mergeChildren(children) {
|
53
|
-
var childList = [];
|
54
|
-
children.forEach(function (child) {
|
55
|
-
var prevChild = childList[childList.length - 1];
|
56
|
-
|
57
|
-
if (typeof child === 'string' && typeof prevChild === 'string') {
|
58
|
-
childList[childList.length - 1] += child;
|
59
|
-
} else {
|
60
|
-
childList.push(child);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
return childList;
|
64
|
-
}
|
65
|
-
|
66
|
-
function resetDomStyles(target, origin) {
|
67
|
-
target.setAttribute('aria-hidden', 'true');
|
68
|
-
var originStyle = window.getComputedStyle(origin);
|
69
|
-
var originCSS = styleToString(originStyle); // Set shadow
|
70
|
-
|
71
|
-
target.setAttribute('style', originCSS);
|
72
|
-
target.style.position = 'fixed';
|
73
|
-
target.style.left = '0';
|
74
|
-
target.style.height = 'auto';
|
75
|
-
target.style.minHeight = 'auto';
|
76
|
-
target.style.maxHeight = 'auto';
|
77
|
-
target.style.top = '-999999px';
|
78
|
-
target.style.zIndex = '-1000'; // clean up css overflow
|
79
|
-
|
80
|
-
target.style.textOverflow = 'clip';
|
81
|
-
target.style.whiteSpace = 'normal';
|
82
|
-
target.style.webkitLineClamp = 'none';
|
83
|
-
}
|
84
|
-
|
85
|
-
function getRealLineHeight(originElement) {
|
86
|
-
var heightContainer = document.createElement('div');
|
87
|
-
resetDomStyles(heightContainer, originElement);
|
88
|
-
heightContainer.appendChild(document.createTextNode('text'));
|
89
|
-
document.body.appendChild(heightContainer);
|
90
|
-
var offsetHeight = heightContainer.offsetHeight;
|
91
|
-
var lineHeight = pxToNumber(window.getComputedStyle(originElement).lineHeight);
|
92
|
-
document.body.removeChild(heightContainer);
|
93
|
-
return offsetHeight > lineHeight ? offsetHeight : lineHeight;
|
94
|
-
}
|
95
|
-
|
96
|
-
var _default = function _default(originElement, option, content, fixedContent, ellipsisStr) {
|
97
|
-
if (!ellipsisContainer) {
|
98
|
-
ellipsisContainer = document.createElement('div');
|
99
|
-
ellipsisContainer.setAttribute('aria-hidden', 'true');
|
100
|
-
} // HMR will remove this from body which should patch back
|
101
|
-
|
102
|
-
|
103
|
-
if (!ellipsisContainer.parentNode) {
|
104
|
-
document.body.appendChild(ellipsisContainer);
|
105
|
-
}
|
106
|
-
|
107
|
-
var rows = option.rows,
|
108
|
-
_option$suffix = option.suffix,
|
109
|
-
suffix = _option$suffix === void 0 ? '' : _option$suffix; // Get origin style
|
110
|
-
|
111
|
-
var originStyle = window.getComputedStyle(originElement);
|
112
|
-
var lineHeight = getRealLineHeight(originElement);
|
113
|
-
var maxHeight = Math.floor(lineHeight) * (rows + 1) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom);
|
114
|
-
resetDomStyles(ellipsisContainer, originElement); // Render in the fake container
|
115
|
-
|
116
|
-
var contentList = mergeChildren((0, _toArray["default"])(content));
|
117
|
-
(0, _reactDom.render)( /*#__PURE__*/React.createElement("div", {
|
118
|
-
style: wrapperStyle
|
119
|
-
}, /*#__PURE__*/React.createElement("span", {
|
120
|
-
style: wrapperStyle
|
121
|
-
}, contentList, suffix), /*#__PURE__*/React.createElement("span", {
|
122
|
-
style: wrapperStyle
|
123
|
-
}, fixedContent)), ellipsisContainer); // wrap in an div for old version react
|
124
|
-
// Check if ellipsis in measure div is height enough for content
|
125
|
-
|
126
|
-
function inRange() {
|
127
|
-
return Math.ceil(ellipsisContainer.getBoundingClientRect().height) < maxHeight;
|
128
|
-
} // Skip ellipsis if already match
|
129
|
-
|
130
|
-
|
131
|
-
if (inRange()) {
|
132
|
-
(0, _reactDom.unmountComponentAtNode)(ellipsisContainer);
|
133
|
-
return {
|
134
|
-
content: content,
|
135
|
-
text: ellipsisContainer.innerHTML,
|
136
|
-
ellipsis: false
|
137
|
-
};
|
138
|
-
} // We should clone the childNode since they're controlled by React and we can't reuse it without warning
|
139
|
-
|
140
|
-
|
141
|
-
var childNodes = Array.prototype.slice.apply(ellipsisContainer.childNodes[0].childNodes[0].cloneNode(true).childNodes).filter(function (_ref) {
|
142
|
-
var nodeType = _ref.nodeType;
|
143
|
-
return nodeType !== COMMENT_NODE;
|
144
|
-
});
|
145
|
-
var fixedNodes = Array.prototype.slice.apply(ellipsisContainer.childNodes[0].childNodes[1].cloneNode(true).childNodes);
|
146
|
-
(0, _reactDom.unmountComponentAtNode)(ellipsisContainer); // ========================= Find match ellipsis content =========================
|
147
|
-
|
148
|
-
var ellipsisChildren = [];
|
149
|
-
ellipsisContainer.innerHTML = ''; // Create origin content holder
|
150
|
-
|
151
|
-
var ellipsisContentHolder = document.createElement('span');
|
152
|
-
ellipsisContainer.appendChild(ellipsisContentHolder);
|
153
|
-
var ellipsisTextNode = document.createTextNode(ellipsisStr + suffix);
|
154
|
-
ellipsisContentHolder.appendChild(ellipsisTextNode);
|
155
|
-
fixedNodes.forEach(function (childNode) {
|
156
|
-
ellipsisContainer.appendChild(childNode);
|
157
|
-
}); // Append before fixed nodes
|
158
|
-
|
159
|
-
function appendChildNode(node) {
|
160
|
-
ellipsisContentHolder.insertBefore(node, ellipsisTextNode);
|
161
|
-
} // Get maximum text
|
162
|
-
|
163
|
-
|
164
|
-
function measureText(textNode, fullText) {
|
165
|
-
var startLoc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
166
|
-
var endLoc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fullText.length;
|
167
|
-
var lastSuccessLoc = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
168
|
-
var midLoc = Math.floor((startLoc + endLoc) / 2);
|
169
|
-
var currentText = fullText.slice(0, midLoc);
|
170
|
-
textNode.textContent = currentText;
|
171
|
-
|
172
|
-
if (startLoc >= endLoc - 1) {
|
173
|
-
// Loop when step is small
|
174
|
-
for (var step = endLoc; step >= startLoc; step -= 1) {
|
175
|
-
var currentStepText = fullText.slice(0, step);
|
176
|
-
textNode.textContent = currentStepText;
|
177
|
-
|
178
|
-
if (inRange() || !currentStepText) {
|
179
|
-
return step === fullText.length ? {
|
180
|
-
finished: false,
|
181
|
-
reactNode: fullText
|
182
|
-
} : {
|
183
|
-
finished: true,
|
184
|
-
reactNode: currentStepText
|
185
|
-
};
|
186
|
-
}
|
187
|
-
}
|
188
|
-
}
|
189
|
-
|
190
|
-
if (inRange()) {
|
191
|
-
return measureText(textNode, fullText, midLoc, endLoc, midLoc);
|
192
|
-
}
|
193
|
-
|
194
|
-
return measureText(textNode, fullText, startLoc, midLoc, lastSuccessLoc);
|
195
|
-
}
|
196
|
-
|
197
|
-
function measureNode(childNode, index) {
|
198
|
-
var type = childNode.nodeType;
|
199
|
-
|
200
|
-
if (type === ELEMENT_NODE) {
|
201
|
-
// We don't split element, it will keep if whole element can be displayed.
|
202
|
-
appendChildNode(childNode);
|
203
|
-
|
204
|
-
if (inRange()) {
|
205
|
-
return {
|
206
|
-
finished: false,
|
207
|
-
reactNode: contentList[index]
|
208
|
-
};
|
209
|
-
} // Clean up if can not pull in
|
210
|
-
|
211
|
-
|
212
|
-
ellipsisContentHolder.removeChild(childNode);
|
213
|
-
return {
|
214
|
-
finished: true,
|
215
|
-
reactNode: null
|
216
|
-
};
|
217
|
-
}
|
218
|
-
|
219
|
-
if (type === TEXT_NODE) {
|
220
|
-
var fullText = childNode.textContent || '';
|
221
|
-
var textNode = document.createTextNode(fullText);
|
222
|
-
appendChildNode(textNode);
|
223
|
-
return measureText(textNode, fullText);
|
224
|
-
} // Not handle other type of content
|
225
|
-
// PS: This code should not be attached after react 16
|
226
|
-
|
227
|
-
/* istanbul ignore next */
|
228
|
-
|
229
|
-
|
230
|
-
return {
|
231
|
-
finished: false,
|
232
|
-
reactNode: null
|
233
|
-
};
|
234
|
-
}
|
235
|
-
|
236
|
-
childNodes.some(function (childNode, index) {
|
237
|
-
var _measureNode = measureNode(childNode, index),
|
238
|
-
finished = _measureNode.finished,
|
239
|
-
reactNode = _measureNode.reactNode;
|
240
|
-
|
241
|
-
if (reactNode) {
|
242
|
-
ellipsisChildren.push(reactNode);
|
243
|
-
}
|
244
|
-
|
245
|
-
return finished;
|
246
|
-
});
|
247
|
-
return {
|
248
|
-
content: ellipsisChildren,
|
249
|
-
text: ellipsisContainer.innerHTML,
|
250
|
-
ellipsis: true
|
251
|
-
};
|
252
|
-
};
|
253
|
-
|
254
|
-
exports["default"] = _default;
|
package/lib/version/index.d.ts
DELETED
package/lib/version/index.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports["default"] = void 0;
|
9
|
-
|
10
|
-
var _version = _interopRequireDefault(require("./version"));
|
11
|
-
|
12
|
-
/* eslint import/no-unresolved: 0 */
|
13
|
-
// @ts-ignore
|
14
|
-
var _default = _version["default"];
|
15
|
-
exports["default"] = _default;
|
package/lib/version/style/css.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
import '../../style/index.less';
|
package/lib/version/version.d.ts
DELETED