@para-ui/core 4.0.61 → 4.0.63

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 (74) hide show
  1. package/Anchor/index.js +2 -1
  2. package/Argv/index.js +3 -2
  3. package/AutoButton/index.js +3 -2
  4. package/AutoTips/index.js +248 -7
  5. package/Breadcrumbs/index.js +2 -1
  6. package/Button/index.js +3 -2
  7. package/ButtonGroup/index.js +3 -2
  8. package/Card/index.js +33 -23
  9. package/Cascader/index.js +4 -3
  10. package/ComboSelect/index.js +4 -3
  11. package/CopyText/index.js +2 -1
  12. package/CycleSelector/index.js +3 -2
  13. package/DatePicker/index.js +6 -5
  14. package/Descriptions/index.js +3 -2
  15. package/Desktop/index.js +6 -5
  16. package/Drawer/index.js +3 -2
  17. package/DynamicMultiBox/index.js +211 -25
  18. package/DynamicMultiBox/interface.d.ts +30 -0
  19. package/Form/index.js +5 -4
  20. package/FormItem/index.js +5 -4
  21. package/FunctionModal/index.js +5 -4
  22. package/InputCode/index.js +3 -2
  23. package/InputLang/index.d.ts +2 -0
  24. package/InputLang/index.js +12 -3
  25. package/Menu/index.js +2 -1
  26. package/Modal/index.js +3 -2
  27. package/MultiBox/index.js +6 -5
  28. package/OperateBtn/index.js +3 -2
  29. package/PageHeader/index.js +3 -2
  30. package/Pagination/index.js +3 -2
  31. package/PopConfirm/index.js +3 -2
  32. package/PopMenu/index.js +2 -1
  33. package/QuickReply/index.js +3 -2
  34. package/README.md +9 -0
  35. package/Result/index.js +2 -1
  36. package/Search/index.js +2 -1
  37. package/Select/index.js +2 -1
  38. package/SelectInput/index.js +2 -1
  39. package/Selector/index.js +2 -1
  40. package/SelectorPicker/index.js +2 -1
  41. package/SingleBox/index.js +6 -5
  42. package/Stepper/index.js +2 -1
  43. package/Table/index.js +3 -2
  44. package/Tabs/index.js +8 -7
  45. package/Tag/index.js +2 -1
  46. package/TextField/index.js +2 -1
  47. package/TimePicker/index.js +6 -5
  48. package/Title/index.js +2 -1
  49. package/ToggleButton/index.js +3 -2
  50. package/Transfer/index.js +3 -2
  51. package/Tree/index.js +4 -3
  52. package/Upload/index.js +3 -2
  53. package/Utils/Hooks/useResizeObserver.d.ts +2 -0
  54. package/_verture/{index-7d115f38.js → index-0163a7b0.js} +2 -2
  55. package/_verture/{index-2055d357.js → index-09404080.js} +1 -1
  56. package/_verture/{index-3f811a6c.js → index-78f0f0e7.js} +1 -1
  57. package/_verture/{index-6bbcdc7f.js → index-98ae8a30.js} +1 -1
  58. package/_verture/useResizeObserver-edda059a.js +69 -0
  59. package/index.js +7 -6
  60. package/package.json +1 -1
  61. package/umd/AutoButton.js +1 -1
  62. package/umd/AutoTips.js +1 -1
  63. package/umd/Breadcrumbs.js +1 -1
  64. package/umd/Card.js +1 -1
  65. package/umd/ComboSelect.js +3 -3
  66. package/umd/DynamicMultiBox.js +3 -3
  67. package/umd/Form.js +1 -1
  68. package/umd/FormItem.js +1 -1
  69. package/umd/InputLang.js +1 -1
  70. package/umd/Selector.js +1 -1
  71. package/umd/SelectorPicker.js +1 -1
  72. package/umd/Table.js +1 -1
  73. package/_verture/index-f62daef9.js +0 -298
  74. /package/_verture/{modalContext-15114682.js → modalContext-e3beaf4b.js} +0 -0
@@ -1,298 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useRef, useEffect, useState, useMemo } from 'react';
3
- import { Tooltip } from '../Tooltip/index.js';
4
- import { $ as $prefixCls } from './constant-5317fc89.js';
5
- import { isIE } from '@paraview/lib';
6
- import { s as styleInject } from './style-inject.es-300983ab.js';
7
-
8
- /**
9
- * @author linhd
10
- * @date 2024/12/23 10:45
11
- * @description 监听元素发生变化
12
- */
13
- const useResizeObserver = props => {
14
- const constData = useRef({});
15
- useEffect(() => {
16
- resizeObserverDom();
17
- return () => {
18
- clearInterval(constData.current.resizeTimer);
19
- clearTimeout(constData.current.resizeLimit);
20
- };
21
- }, [props.dom]);
22
- // 判断宽高发生变化
23
- const isChangeSize = rect => {
24
- const width = rect.width;
25
- const height = rect.height;
26
- if (width === constData.current.width && height === constData.current.height) {
27
- return;
28
- }
29
- constData.current.width = width;
30
- constData.current.height = height;
31
- clearTimeout(constData.current.resizeLimit);
32
- constData.current.resizeLimit = setTimeout(() => {
33
- props.cb();
34
- }, 100);
35
- };
36
- // 监听表格容器宽高发生变化
37
- const resizeObserverDom = () => {
38
- const dom = props.dom;
39
- if (!dom) return;
40
- if (window.ResizeObserver === undefined) {
41
- clearInterval(constData.current.resizeTimer);
42
- constData.current.resizeTimer = setInterval(() => {
43
- const tableRefEleRect = dom.getBoundingClientRect();
44
- isChangeSize(tableRefEleRect);
45
- });
46
- } else {
47
- // 创建一个ResizeObserver实例并传入回调函数
48
- const resizeObserver = new ResizeObserver(entries => {
49
- var _a;
50
- const contentRect = (_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect;
51
- isChangeSize(contentRect);
52
- });
53
- // 开始观察元素
54
- resizeObserver.observe(dom);
55
- }
56
- };
57
- };
58
-
59
- var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2021/11/1 20:28\n* @description 文字隐藏...\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-tips-multiline {\n max-width: 100%;\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-auto-tips-multiline > .auto-tips-multiline-content-box {\n position: relative;\n}\n.paraui-v4-auto-tips-multiline > .auto-tips-multiline-content-box > .auto-tips-multiline-content > .last-line {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.paraui-v4-auto-tips-multiline > .auto-tips-multiline-content-box > .hidden {\n opacity: 0;\n visibility: hidden;\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: -100000;\n}\n.paraui-v4-auto-tips-multiline.paraui-v4-auto-tips-multiline-safari > .auto-tips-multiline-content-box > .auto-tips-multiline-content > .last-line::before {\n content: \"\";\n display: block;\n}\n\n.paraui-v4-auto-tips-multiline-tooltip .component-tooltip-inner {\n max-height: 80vh;\n overflow: auto;\n}";
60
- styleInject(css_248z$1);
61
-
62
- const AutoTipsMultiline = props => {
63
- const {
64
- children,
65
- arrow = false,
66
- placement = 'bottom-start',
67
- tips = '',
68
- className = '',
69
- interactive = true,
70
- tipMaxWidth,
71
- line = 2,
72
- refresh,
73
- style
74
- } = props;
75
- const boxRef = useRef(null);
76
- const singleWordRefs = useRef([]);
77
- const [lineClamp, setLineClamp] = useState();
78
- const constData = useRef({
79
- line,
80
- tips
81
- });
82
- constData.current.line = line;
83
- constData.current.tips = tips;
84
- const [tTips, setTTips] = useState('');
85
- useResizeObserver({
86
- dom: boxRef.current,
87
- cb: () => calcLine()
88
- });
89
- useEffect(() => {
90
- calcLine();
91
- }, [children, refresh]);
92
- // 计算行数
93
- const calcLine = () => {
94
- var _a;
95
- if (!children) return;
96
- const lineArr = [];
97
- let showTooltip = false;
98
- const boxRefWidth = ((_a = boxRef === null || boxRef === void 0 ? void 0 : boxRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
99
- let addWidth = 0;
100
- let linePos = 0;
101
- for (let i = 0; i < singleWordRefs.current.length; i++) {
102
- const dom = singleWordRefs.current[i];
103
- const offsetWidth = dom.offsetWidth;
104
- addWidth += offsetWidth;
105
- // 累计宽度超出了一行宽度
106
- if (addWidth > boxRefWidth) {
107
- if (lineArr.length < constData.current.line - 1) {
108
- lineArr.push(children.slice(linePos, i));
109
- linePos = i;
110
- addWidth = offsetWidth; // 重置宽度
111
- // 最后一个字
112
- if (i === singleWordRefs.current.length - 1) {
113
- if (lineArr.length < constData.current.line) {
114
- // 没超出行数
115
- lineArr.push(children.slice(linePos, children.length));
116
- } else {
117
- showTooltip = true;
118
- setTTips(constData.current.tips || children);
119
- lineArr.push(children.slice(linePos, children.length));
120
- }
121
- }
122
- } else {
123
- // 超出
124
- showTooltip = true;
125
- setTTips(constData.current.tips || children);
126
- lineArr.push(children.slice(linePos, children.length));
127
- break;
128
- }
129
- } else {
130
- // 未超过且是最后一个字符
131
- if (i === singleWordRefs.current.length - 1) {
132
- lineArr.push(children.slice(linePos, children.length));
133
- }
134
- }
135
- }
136
- setLineClamp({
137
- lineArr,
138
- showTooltip
139
- });
140
- };
141
- /**
142
- * 描述文字span包裹
143
- */
144
- const descriptionRender = useMemo(() => {
145
- singleWordRefs.current = [];
146
- return jsx("div", Object.assign({
147
- className: 'hidden'
148
- }, {
149
- children: children === null || children === void 0 ? void 0 : children.split('').map((word, wIdx) => jsx("span", Object.assign({
150
- ref: dom => dom && singleWordRefs.current.push(dom)
151
- }, {
152
- children: word
153
- }), wIdx))
154
- }));
155
- }, [children]);
156
- // 判断浏览器是否是safari
157
- const isSafari = () => {
158
- const userAgent = navigator.userAgent;
159
- if (userAgent.indexOf('Safari') > -1) {
160
- return true;
161
- }
162
- };
163
- // 处理class
164
- const handClass = () => {
165
- let str = "".concat($prefixCls, "-auto-tips-multiline");
166
- if (isSafari()) str += " ".concat($prefixCls, "-auto-tips-multiline-safari");
167
- if (className) str += " ".concat(className);
168
- return str;
169
- };
170
- return jsx("div", Object.assign({
171
- ref: boxRef,
172
- className: handClass(),
173
- style: style
174
- }, {
175
- children: jsx(Tooltip, Object.assign({
176
- arrow: arrow,
177
- title: tTips,
178
- placement: placement,
179
- interactive: interactive,
180
- boundariesElement: 'viewport',
181
- overlayClassName: "".concat($prefixCls, "-auto-tips-multiline-tooltip")
182
- }, {
183
- children: jsxs("div", Object.assign({
184
- className: "auto-tips-multiline-content-box"
185
- }, {
186
- children: [jsx("div", Object.assign({
187
- className: 'auto-tips-multiline-content'
188
- }, {
189
- children: lineClamp === null || lineClamp === void 0 ? void 0 : lineClamp.lineArr.map((line, lIdx) => {
190
- let str = 'line-text';
191
- if (lIdx === lineClamp.lineArr.length - 1) str += ' last-line';
192
- return jsx("div", Object.assign({
193
- className: str
194
- }, {
195
- children: line
196
- }), lIdx);
197
- })
198
- })), descriptionRender]
199
- }))
200
- }))
201
- }));
202
- };
203
-
204
- var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2021/11/1 20:28\n* @description 文字隐藏...\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-tips {\n max-width: 100%;\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-auto-tips > .auto-tips-content {\n display: inline;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-auto-tips.paraui-v4-auto-tips-safari > .auto-tips-content::before {\n content: \"\";\n display: block;\n}\n\n.paraui-v4-auto-tips-tooltip .component-tooltip-inner {\n max-height: 80vh;\n overflow: auto;\n}";
205
- styleInject(css_248z);
206
-
207
- const AutoTips = props => {
208
- const {
209
- children,
210
- arrow = false,
211
- placement = 'bottom-start',
212
- tips = '',
213
- className = '',
214
- beyondText = true,
215
- interactive = true,
216
- tipMaxWidth,
217
- style
218
- } = props;
219
- const tipsElm = useRef();
220
- const textElm = useRef();
221
- const [tTips, setTTips] = useState('');
222
- useEffect(() => {
223
- setTTips(tips);
224
- }, [tips]);
225
- // 鼠标移入事件
226
- const mouseHover = () => {
227
- let val = '';
228
- const tipsEle = tipsElm.current;
229
- const tipsEleRect = tipsEle.getBoundingClientRect();
230
- const textEleRect = textElm.current.getBoundingClientRect();
231
- if (tipsElm.current) {
232
- if (isIE()) {
233
- if (tipsEleRect.width > textEleRect.width) {
234
- if (tips) {
235
- val = tips;
236
- } else {
237
- val = beyondText ? tipsEle.innerText : children;
238
- }
239
- }
240
- } else {
241
- // mac:safari,firefox,chrome
242
- // windows: firefox,chrome
243
- if (textEleRect.width > tipsEleRect.width) {
244
- if (tips) {
245
- val = tips;
246
- } else {
247
- val = beyondText ? tipsEle.innerText : children;
248
- }
249
- }
250
- }
251
- }
252
- setTTips(val);
253
- };
254
- // 处理最大宽度
255
- /*const handMaxWidth = () => {
256
- if (tipMaxWidth) return tipMaxWidth;
257
- return tipsElm && tipsElm.current ? tipsElm.current.offsetWidth : 0;
258
- }*/
259
- // 判断浏览器是否是safari
260
- const isSafari = () => {
261
- const userAgent = navigator.userAgent;
262
- if (/^((?!chrome|android).)*safari/i.test(userAgent)) {
263
- return true;
264
- }
265
- };
266
- // 处理class
267
- const handClass = () => {
268
- let str = "".concat($prefixCls, "-auto-tips");
269
- if (isSafari()) str += " ".concat($prefixCls, "-auto-tips-safari");
270
- if (className) str += " ".concat(className);
271
- return str;
272
- };
273
- return jsx(Tooltip, Object.assign({
274
- arrow: arrow,
275
- title: tTips,
276
- placement: placement,
277
- interactive: interactive,
278
- boundariesElement: 'viewport',
279
- overlayClassName: "".concat($prefixCls, "-auto-tips-tooltip"),
280
- maxWidth: tipMaxWidth
281
- }, {
282
- children: jsx("div", Object.assign({
283
- ref: tipsElm,
284
- className: handClass(),
285
- onMouseOver: mouseHover,
286
- style: style
287
- }, {
288
- children: jsx("div", Object.assign({
289
- className: "auto-tips-content",
290
- ref: textElm
291
- }, {
292
- children: children
293
- }))
294
- }))
295
- }));
296
- };
297
-
298
- export { AutoTips as A, AutoTipsMultiline as a, useResizeObserver as u };