diginet-core-ui 1.3.45 → 1.3.47
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/assets/images/menu/dhr/MHRM09N1025.svg +12 -0
- package/components/avatar/index.js +138 -187
- package/components/form-control/dropdown/index.js +20 -15
- package/components/form-control/radio/index.js +126 -113
- package/components/rating/index.js +150 -141
- package/components/typography/index.js +18 -74
- package/package.json +1 -1
- package/readme.md +13 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M30.7901 28.13C30.7901 27.5 30.2701 26.99 29.6401 26.99H19.2301C18.5901 26.99 18.0801 27.5 18.0801 28.13C18.0801 28.76 18.6001 29.27 19.2301 29.27H29.6401C30.2701 29.27 30.7901 28.76 30.7901 28.13Z" fill="#FF8C00"/>
|
|
3
|
+
<path d="M29.6401 22.41H19.2301C18.5901 22.41 18.0801 22.92 18.0801 23.55C18.0801 24.18 18.6001 24.69 19.2301 24.69H29.6401C30.2801 24.69 30.7901 24.18 30.7901 23.55C30.7901 22.92 30.2701 22.41 29.6401 22.41Z" fill="#FF8C00"/>
|
|
4
|
+
<path d="M19.2301 31.56C18.5901 31.56 18.0801 32.07 18.0801 32.7C18.0801 33.33 18.6001 33.84 19.2301 33.84H25.0201C25.6601 33.84 26.1701 33.33 26.1701 32.7C26.1701 32.07 25.6501 31.56 25.0201 31.56H19.2301Z" fill="#FF8C00"/>
|
|
5
|
+
<path d="M10.0601 25.8101H11.2001V23.5701H10.2401V22.8501C10.8601 22.7501 11.1701 22.6401 11.5201 22.4301H12.3901V25.8201H13.3301V26.7601H10.0601V25.8101Z" fill="#FF8C00"/>
|
|
6
|
+
<path d="M14.8801 25.9401C14.8801 25.4501 15.2401 25.0501 15.7801 25.0501C16.3201 25.0501 16.6801 25.4501 16.6801 25.9401C16.6801 26.4301 16.3201 26.8301 15.7801 26.8301C15.2401 26.8301 14.8801 26.4301 14.8801 25.9401Z" fill="#FF8C00"/>
|
|
7
|
+
<path d="M9.92011 33.17C11.0901 32.23 11.9401 31.5 11.9401 30.91C11.9401 30.52 11.6901 30.34 11.3001 30.34C10.9801 30.34 10.7201 30.55 10.4901 30.75L9.86011 30.12C10.3401 29.64 10.7801 29.42 11.4701 29.42C12.4101 29.42 13.0601 29.98 13.0601 30.84C13.0601 31.54 12.3301 32.3 11.6101 32.9C11.8501 32.87 12.1801 32.85 12.4001 32.85H13.2801V33.83H9.92011V33.17Z" fill="#FF8C00"/>
|
|
8
|
+
<path d="M14.8801 33.03C14.8801 32.54 15.2401 32.14 15.7801 32.14C16.3201 32.14 16.6801 32.54 16.6801 33.03C16.6801 33.52 16.3201 33.92 15.7801 33.92C15.2401 33.92 14.8801 33.53 14.8801 33.03Z" fill="#FF8C00"/>
|
|
9
|
+
<path d="M34.74 9.52L25.35 0.26C25.17 0.1 24.93 0 24.7 0H8.26C6.47 0 5 1.45 5 3.22V35.78C5 37.55 6.47 39 8.26 39H31.73C33.53 39 34.99 37.55 34.99 35.78V10.16C35 9.93 34.9 9.69 34.74 9.52ZM25.61 3.09L26.05 3.52L31.42 8.82L31.86 9.26H27.03C26.25 9.26 25.6 8.63 25.6 7.85V3.09H25.61ZM33.16 35.78C33.16 36.56 32.52 37.19 31.73 37.19H8.26C7.48 37.19 6.83 36.56 6.83 35.78V3.22C6.83 2.44 7.47 1.81 8.26 1.81H23.77V7.85C23.77 9.62 25.24 11.07 27.03 11.07H31.22L32.9 11.06H33.16V35.78Z" fill="#2680EB"/>
|
|
10
|
+
<path d="M13.6299 9.34994C13.1999 8.87994 13.2199 8.14994 13.6899 7.71994L15.6799 5.85994C15.7899 5.75994 15.9199 5.67994 16.0599 5.61994C16.4999 5.44994 16.9899 5.56994 17.3099 5.90994L17.6599 6.28994C17.8699 6.50994 17.9099 6.82994 17.7999 7.08994L14.7799 9.91994C14.4999 10.0199 14.1899 9.93994 13.9899 9.72994L13.6299 9.34994ZM20.5499 10.0499C20.5399 10.0399 20.5499 10.0399 20.5499 10.0499L17.5299 12.8599C17.5299 12.8599 17.5299 12.8599 17.5399 12.8699C17.4299 13.1299 17.4699 13.4499 17.6799 13.6699L18.0299 14.0499C18.3499 14.3899 18.8399 14.5099 19.2799 14.3399C19.4199 14.2899 19.5499 14.2099 19.6599 14.0999L21.6499 12.2399C22.1099 11.8099 22.1399 11.0799 21.6999 10.6199L21.3499 10.2399C21.1299 10.0199 20.8299 9.94994 20.5499 10.0499ZM16.3199 12.6799C16.3799 12.6599 16.4299 12.6199 16.4799 12.5799L16.5799 12.4899C16.7199 12.5999 16.8999 12.6299 17.0699 12.5699C17.0999 12.5599 17.1199 12.5499 17.1499 12.5299L20.2399 9.64994C20.2999 9.56994 20.3399 9.46994 20.3399 9.36994C20.3399 9.23994 20.2999 9.10994 20.2099 9.01994L18.8099 7.51994C18.6399 7.33994 18.3699 7.31994 18.1799 7.44994L15.1299 10.2899C15.0599 10.3699 15.0099 10.4799 15.0099 10.5899C15.0099 10.6999 15.0399 10.7999 15.0999 10.8899L14.9999 10.9799C14.8999 11.0699 14.8499 11.1899 14.8399 11.3199C14.8399 11.4099 14.8599 11.4899 14.8999 11.5699L13.4399 12.9399C13.3899 12.9199 13.3399 12.9099 13.2899 12.9099C13.1599 12.9099 13.0299 12.9499 12.9399 13.0399L9.15988 16.5699C8.95988 16.7499 8.94988 17.0699 9.13988 17.2599L9.81988 17.9999C9.90988 18.0899 10.0299 18.1499 10.1599 18.1599C10.2299 18.1599 10.2899 18.1499 10.3499 18.1299C10.4099 18.1099 10.4599 18.0699 10.5099 18.0299L14.2899 14.4999C14.4299 14.3699 14.4799 14.1799 14.4299 13.9999L15.8899 12.6299C15.9599 12.6799 16.0499 12.6999 16.1399 12.7099C16.1899 12.7099 16.2599 12.6999 16.3199 12.6799Z" fill="#FF4444"/>
|
|
11
|
+
<path d="M21.4599 16.6599H15.0699C14.7699 16.6599 14.5299 16.8999 14.5299 17.1999V18.0199C14.5299 18.3199 14.7699 18.5599 15.0699 18.5599H21.4599C21.7599 18.5599 21.9999 18.3199 21.9999 18.0199V17.1999C21.9999 16.8999 21.7599 16.6599 21.4599 16.6599Z" fill="#FF4444"/>
|
|
12
|
+
</svg>
|
|
@@ -27,59 +27,6 @@ const {
|
|
|
27
27
|
const existed = {},
|
|
28
28
|
urlAvatar = {},
|
|
29
29
|
popupHandler = {};
|
|
30
|
-
|
|
31
|
-
const getDirection = direction => {
|
|
32
|
-
switch (direction) {
|
|
33
|
-
case 'top':
|
|
34
|
-
return {
|
|
35
|
-
anchorOrigin: {
|
|
36
|
-
vertical: 'top',
|
|
37
|
-
horizontal: 'center'
|
|
38
|
-
},
|
|
39
|
-
transformOrigin: {
|
|
40
|
-
vertical: 'bottom',
|
|
41
|
-
horizontal: 'center'
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
case 'left':
|
|
46
|
-
return {
|
|
47
|
-
anchorOrigin: {
|
|
48
|
-
vertical: 'center',
|
|
49
|
-
horizontal: 'left'
|
|
50
|
-
},
|
|
51
|
-
transformOrigin: {
|
|
52
|
-
vertical: 'center',
|
|
53
|
-
horizontal: 'right'
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
case 'right':
|
|
58
|
-
return {
|
|
59
|
-
anchorOrigin: {
|
|
60
|
-
vertical: 'center',
|
|
61
|
-
horizontal: 'right'
|
|
62
|
-
},
|
|
63
|
-
transformOrigin: {
|
|
64
|
-
vertical: 'center',
|
|
65
|
-
horizontal: 'left'
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
default:
|
|
70
|
-
return {
|
|
71
|
-
anchorOrigin: {
|
|
72
|
-
vertical: 'bottom',
|
|
73
|
-
horizontal: 'center'
|
|
74
|
-
},
|
|
75
|
-
transformOrigin: {
|
|
76
|
-
vertical: 'top',
|
|
77
|
-
horizontal: 'center'
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
30
|
const blurKeyframe = keyframes`
|
|
84
31
|
0% { -webkit-filter: blur(4px);}
|
|
85
32
|
25% { -webkit-filter: blur(3px);}
|
|
@@ -109,7 +56,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
109
56
|
readOnly,
|
|
110
57
|
disabled,
|
|
111
58
|
lazyLoading,
|
|
112
|
-
|
|
59
|
+
id
|
|
113
60
|
}, reference) => {
|
|
114
61
|
if (!defaultSrc) defaultSrc = AvatarDefault;
|
|
115
62
|
const ref = useRef(null);
|
|
@@ -128,6 +75,14 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
128
75
|
setIsInView(true);
|
|
129
76
|
});
|
|
130
77
|
|
|
78
|
+
const _ActionIconCSS = ActionIconCSS(actionIconWidth);
|
|
79
|
+
|
|
80
|
+
const _AvatarPreviewCSS = AvatarPreviewCSS(readOnly);
|
|
81
|
+
|
|
82
|
+
const _AvatarContainerCSS = AvatarContainerCSS(_AvatarPreviewCSS.name, _ActionIconCSS.name);
|
|
83
|
+
|
|
84
|
+
const _AvatarRootCSS = AvatarRootCSS(width, height, outlined);
|
|
85
|
+
|
|
131
86
|
const _isMobile = isMobile.any();
|
|
132
87
|
|
|
133
88
|
const triggerInput = e => {
|
|
@@ -204,36 +159,31 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
204
159
|
};
|
|
205
160
|
|
|
206
161
|
const renderImage = () => {
|
|
162
|
+
const _image = jsx(Fragment, null, !onLoaded && jsx("img", {
|
|
163
|
+
src: defaultSrc,
|
|
164
|
+
alt: '',
|
|
165
|
+
style: {
|
|
166
|
+
objectFit: 'cover'
|
|
167
|
+
}
|
|
168
|
+
}), jsx("img", {
|
|
169
|
+
css: blurAnimationCSS,
|
|
170
|
+
src: srcState,
|
|
171
|
+
alt: srcState,
|
|
172
|
+
style: {
|
|
173
|
+
objectFit: 'cover'
|
|
174
|
+
},
|
|
175
|
+
onLoad: () => setOnLoaded(true)
|
|
176
|
+
}));
|
|
177
|
+
|
|
207
178
|
if (lazyLoading) {
|
|
208
|
-
return isInView ?
|
|
209
|
-
src:
|
|
210
|
-
alt: '',
|
|
211
|
-
style: {
|
|
212
|
-
objectFit: 'cover'
|
|
213
|
-
}
|
|
214
|
-
}), jsx("img", {
|
|
215
|
-
css: blurAnimation,
|
|
216
|
-
src: srcState || defaultSrc,
|
|
217
|
-
alt: srcState || defaultSrc,
|
|
218
|
-
style: {
|
|
219
|
-
objectFit: 'cover'
|
|
220
|
-
},
|
|
221
|
-
onLoad: () => setOnLoaded(true)
|
|
222
|
-
})) : jsx("img", {
|
|
223
|
-
src: AvatarDefault,
|
|
179
|
+
return isInView ? _image : jsx("img", {
|
|
180
|
+
src: defaultSrc,
|
|
224
181
|
alt: '',
|
|
225
182
|
style: {
|
|
226
183
|
objectFit: 'cover'
|
|
227
184
|
}
|
|
228
185
|
});
|
|
229
|
-
} else return
|
|
230
|
-
css: blurAnimation,
|
|
231
|
-
src: srcState || defaultSrc,
|
|
232
|
-
alt: srcState || defaultSrc,
|
|
233
|
-
style: {
|
|
234
|
-
objectFit: 'cover'
|
|
235
|
-
}
|
|
236
|
-
});
|
|
186
|
+
} else return _image;
|
|
237
187
|
};
|
|
238
188
|
|
|
239
189
|
const showMoreInfo = () => {
|
|
@@ -268,16 +218,19 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
268
218
|
urlAvatar[unique] = src;
|
|
269
219
|
img.src = src;
|
|
270
220
|
img.alt = '';
|
|
271
|
-
setSrcState(src);
|
|
272
|
-
existed[unique] = true;
|
|
273
221
|
|
|
274
222
|
img.onerror = () => {
|
|
275
223
|
setSrcState(null);
|
|
276
224
|
existed[unique] = false;
|
|
277
225
|
};
|
|
226
|
+
|
|
227
|
+
img.onload = () => {
|
|
228
|
+
setSrcState(src);
|
|
229
|
+
existed[unique] = true;
|
|
230
|
+
};
|
|
278
231
|
}
|
|
279
232
|
}
|
|
280
|
-
}, [src
|
|
233
|
+
}, [src]);
|
|
281
234
|
useImperativeHandle(reference, () => {
|
|
282
235
|
const currentRef = ref.current || {};
|
|
283
236
|
const _instance = {}; // methods
|
|
@@ -287,89 +240,87 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
287
240
|
currentRef.instance = _instance;
|
|
288
241
|
return currentRef;
|
|
289
242
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}), [maxSizeError]);
|
|
367
|
-
return jsx(Fragment, null, AvatarView, ModalView, hoverAble && MoreInfoView, !disabled && !readOnly && PopupView);
|
|
243
|
+
return useMemo(() => {
|
|
244
|
+
return jsx(Fragment, null, jsx("div", {
|
|
245
|
+
css: _AvatarContainerCSS,
|
|
246
|
+
ref: ref,
|
|
247
|
+
id: unique,
|
|
248
|
+
className: disabled ? 'disabled' : ''
|
|
249
|
+
}, jsx("div", {
|
|
250
|
+
css: _AvatarRootCSS,
|
|
251
|
+
className: ['DGN-UI-Avatar', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
252
|
+
id: id
|
|
253
|
+
}, jsx("input", {
|
|
254
|
+
ref: inputRef,
|
|
255
|
+
type: "file",
|
|
256
|
+
title: '',
|
|
257
|
+
accept: 'image/*',
|
|
258
|
+
onChange: onChangeAvatar
|
|
259
|
+
}), jsx("div", {
|
|
260
|
+
css: _AvatarPreviewCSS,
|
|
261
|
+
onClick: _onClick,
|
|
262
|
+
ref: avatarRef,
|
|
263
|
+
onMouseEnter: _onMouseEnter,
|
|
264
|
+
onMouseLeave: _onMouseLeave,
|
|
265
|
+
tabIndex: "-1",
|
|
266
|
+
onBlur: closeMoreInfo
|
|
267
|
+
}, renderImage())), !readOnly && !disabled && jsx("span", {
|
|
268
|
+
css: _ActionIconCSS
|
|
269
|
+
}, jsx(ButtonIcon, {
|
|
270
|
+
viewType: 'ghost',
|
|
271
|
+
name: 'Edit',
|
|
272
|
+
width: actionIconWidth,
|
|
273
|
+
height: actionIconHeight,
|
|
274
|
+
className: 'icon-edit',
|
|
275
|
+
onClick: triggerInput
|
|
276
|
+
}), clearAble && srcState && jsx(ButtonIcon, {
|
|
277
|
+
viewType: 'ghost',
|
|
278
|
+
name: 'Delete',
|
|
279
|
+
width: actionIconWidth,
|
|
280
|
+
height: actionIconHeight,
|
|
281
|
+
className: 'icon-delete',
|
|
282
|
+
onClick: onRemoveAvatar,
|
|
283
|
+
style: {
|
|
284
|
+
marginTop: '8px'
|
|
285
|
+
}
|
|
286
|
+
}))), jsx(ModalSample, {
|
|
287
|
+
open: viewAvatar,
|
|
288
|
+
onClose: () => setViewAvatar(false),
|
|
289
|
+
width: 'max-content'
|
|
290
|
+
}, jsx("img", {
|
|
291
|
+
src: urlAvatar[unique],
|
|
292
|
+
alt: "",
|
|
293
|
+
style: {
|
|
294
|
+
objectFit: 'cover',
|
|
295
|
+
maxHeight: '100%',
|
|
296
|
+
maxWidth: '100%',
|
|
297
|
+
margin: 'auto',
|
|
298
|
+
display: 'block'
|
|
299
|
+
}
|
|
300
|
+
})), hoverAble && jsx(Popover, {
|
|
301
|
+
arrow: true,
|
|
302
|
+
open: viewMoreInfo,
|
|
303
|
+
pressESCToClose: false,
|
|
304
|
+
bgColor: fillTooltip,
|
|
305
|
+
anchor: avatarRef,
|
|
306
|
+
fullScreen: false,
|
|
307
|
+
width: 'max-content',
|
|
308
|
+
direction: direction
|
|
309
|
+
}, jsx("div", {
|
|
310
|
+
css: MoreInfoCSS
|
|
311
|
+
}, typeof data === 'function' ? data() : renderData())), !disabled && !readOnly && jsx(Popup, {
|
|
312
|
+
getPopup: func => popupHandler[unique] = func,
|
|
313
|
+
type: 'info',
|
|
314
|
+
title: maxSizeError,
|
|
315
|
+
icon: 'danger',
|
|
316
|
+
fullScreen: true
|
|
317
|
+
}));
|
|
318
|
+
}, [width, height, readOnly, disabled, clearAble, maxSize, matchType, hoverAble, outlined, actionIconWidth, actionIconHeight, lazyLoading, defaultSrc, direction, data, maxSizeError, srcState, isInView, onLoaded, viewAvatar, viewMoreInfo]);
|
|
368
319
|
}));
|
|
369
320
|
|
|
370
|
-
const
|
|
371
|
-
${flexCol}
|
|
372
|
-
${positionAbsolute}
|
|
321
|
+
const ActionIconCSS = actionIconWidth => css`
|
|
322
|
+
${flexCol};
|
|
323
|
+
${positionAbsolute};
|
|
373
324
|
right: ${-actionIconWidth}px;
|
|
374
325
|
min-width: ${actionIconWidth}px;
|
|
375
326
|
transition: opacity 0.5s;
|
|
@@ -377,48 +328,48 @@ const ActionIcon = actionIconWidth => css`
|
|
|
377
328
|
z-index: 9002;
|
|
378
329
|
`;
|
|
379
330
|
|
|
380
|
-
const
|
|
381
|
-
${displayBlock}
|
|
382
|
-
${positionRelative}
|
|
383
|
-
${overflowHidden}
|
|
331
|
+
const AvatarPreviewCSS = readOnly => css`
|
|
332
|
+
${displayBlock};
|
|
333
|
+
${positionRelative};
|
|
334
|
+
${overflowHidden};
|
|
384
335
|
width: 100%;
|
|
385
336
|
height: 100%;
|
|
386
337
|
border-radius: 50%;
|
|
387
338
|
cursor: ${readOnly ? 'initial' : 'pointer'};
|
|
388
339
|
`;
|
|
389
340
|
|
|
390
|
-
const
|
|
391
|
-
${inlineFlex}
|
|
392
|
-
${positionRelative}
|
|
393
|
-
${alignCenter}
|
|
341
|
+
const AvatarContainerCSS = (AvatarPreviewCSSName, ActionIconCSSName) => css`
|
|
342
|
+
${inlineFlex};
|
|
343
|
+
${positionRelative};
|
|
344
|
+
${alignCenter};
|
|
394
345
|
&.disabled {
|
|
395
|
-
.css-${
|
|
346
|
+
.css-${AvatarPreviewCSSName} {
|
|
396
347
|
${pointerEventsNone}
|
|
397
348
|
cursor: inherit;
|
|
398
349
|
}
|
|
399
|
-
.css-${
|
|
350
|
+
.css-${ActionIconCSSName} {
|
|
400
351
|
display: none !important;
|
|
401
352
|
}
|
|
402
353
|
}
|
|
403
354
|
&:hover {
|
|
404
|
-
.css-${
|
|
355
|
+
.css-${ActionIconCSSName} {
|
|
405
356
|
opacity: 1;
|
|
406
357
|
}
|
|
407
358
|
}
|
|
408
359
|
`;
|
|
409
360
|
|
|
410
|
-
const
|
|
411
|
-
${displayBlock}
|
|
412
|
-
${positionRelative}
|
|
413
|
-
${overflowHidden}
|
|
414
|
-
${userSelectNone}
|
|
415
|
-
${borderNone}
|
|
416
|
-
${parseWidthHeight(width, height)}
|
|
361
|
+
const AvatarRootCSS = (width, height, outlined) => css`
|
|
362
|
+
${displayBlock};
|
|
363
|
+
${positionRelative};
|
|
364
|
+
${overflowHidden};
|
|
365
|
+
${userSelectNone};
|
|
366
|
+
${borderNone};
|
|
367
|
+
${parseWidthHeight(width, height)};
|
|
417
368
|
border: ${typeof outlined === 'boolean' && outlined ? `1px solid ${white}` : outlined};
|
|
418
369
|
border-radius: 50%;
|
|
419
370
|
box-sizing: content-box;
|
|
420
371
|
input {
|
|
421
|
-
${displayNone}
|
|
372
|
+
${displayNone};
|
|
422
373
|
}
|
|
423
374
|
img {
|
|
424
375
|
width: 100%;
|
|
@@ -426,12 +377,12 @@ const AvatarRoot = (width, height, outlined) => css`
|
|
|
426
377
|
}
|
|
427
378
|
`;
|
|
428
379
|
|
|
429
|
-
const
|
|
430
|
-
${displayBlock}
|
|
431
|
-
${positionRelative}
|
|
380
|
+
const MoreInfoCSS = css`
|
|
381
|
+
${displayBlock};
|
|
382
|
+
${positionRelative};
|
|
432
383
|
padding: 8px;
|
|
433
384
|
`;
|
|
434
|
-
const
|
|
385
|
+
const blurAnimationCSS = css`
|
|
435
386
|
animation: ${blurKeyframe} 1s ease;
|
|
436
387
|
`;
|
|
437
388
|
Avatar.defaultProps = {
|
|
@@ -445,7 +396,7 @@ Avatar.defaultProps = {
|
|
|
445
396
|
actionIconWidth: 24,
|
|
446
397
|
actionIconHeight: 24,
|
|
447
398
|
className: '',
|
|
448
|
-
direction: '
|
|
399
|
+
direction: 'bottom',
|
|
449
400
|
maxSizeError: `File ${getGlobal(['errorDefault', 'maxSize'])}`,
|
|
450
401
|
wrongTypeError: `File ${getGlobal(['errorDefault', 'fileType'])}`,
|
|
451
402
|
matchType: /^image\/(gif|jpe?g|tiff?|png|webp|bmp|svg(\+xml)?)$/i,
|
|
@@ -505,7 +456,7 @@ Avatar.propTypes = {
|
|
|
505
456
|
defaultSrc: PropTypes.string,
|
|
506
457
|
|
|
507
458
|
/** the direction to display more info */
|
|
508
|
-
direction: PropTypes.oneOf(['top', '
|
|
459
|
+
direction: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
509
460
|
|
|
510
461
|
/**
|
|
511
462
|
* data to display when hoverAble is true<br />
|
|
@@ -105,6 +105,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
105
105
|
children,
|
|
106
106
|
dropdownItemStyle
|
|
107
107
|
}, reference) => {
|
|
108
|
+
if (multiple && selectBox === undefined) selectBox = true;
|
|
108
109
|
const dropdownRef = useRef(null);
|
|
109
110
|
const timerRef = useRef(null);
|
|
110
111
|
const formRef = useRef(null);
|
|
@@ -169,14 +170,6 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
setOpenState(true);
|
|
172
|
-
setTimeout(() => {
|
|
173
|
-
showDropdown();
|
|
174
|
-
setTimeout(() => {
|
|
175
|
-
if (children && boxRef.current && boxRef.current.querySelector('input')) {
|
|
176
|
-
boxRef.current.querySelector('input').focus();
|
|
177
|
-
}
|
|
178
|
-
}, 10);
|
|
179
|
-
}, timing[unique + 'Box'] ? 200 : 0);
|
|
180
173
|
}
|
|
181
174
|
} else if (multiple || itemMode === 'treeview') {
|
|
182
175
|
if (searchRef.current) {
|
|
@@ -607,7 +600,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
607
600
|
}
|
|
608
601
|
|
|
609
602
|
const dropdownItem = document.createElement('div');
|
|
610
|
-
dropdownItem.className = `css-${_DropdownItemCSS.name}`;
|
|
603
|
+
dropdownItem.className = `DGN-UI-Dropdown-Item css-${_DropdownItemCSS.name}`;
|
|
611
604
|
dropdownItem.tabIndex = -1;
|
|
612
605
|
dropdownItem.addEventListener('click', () => onChangeValue(displayText, value, icon, data, i));
|
|
613
606
|
dropdownItem.addEventListener('keypress', e => {
|
|
@@ -952,6 +945,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
952
945
|
|
|
953
946
|
e && e.target && e.target.blur();
|
|
954
947
|
updatePositionDropdown();
|
|
948
|
+
onInput === null || onInput === void 0 ? void 0 : onInput({ ...(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current),
|
|
949
|
+
target: {
|
|
950
|
+
value: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.value
|
|
951
|
+
}
|
|
952
|
+
});
|
|
955
953
|
!!onChange && onChange({
|
|
956
954
|
value: currentValue[unique]
|
|
957
955
|
});
|
|
@@ -1035,7 +1033,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1035
1033
|
}
|
|
1036
1034
|
|
|
1037
1035
|
if (!isSearch[unique]) {
|
|
1038
|
-
inputRef.current.value =
|
|
1036
|
+
inputRef.current.value = source;
|
|
1039
1037
|
}
|
|
1040
1038
|
}
|
|
1041
1039
|
};
|
|
@@ -1130,13 +1128,18 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1130
1128
|
|
|
1131
1129
|
currentRef.showDropdown = () => showDropdown();
|
|
1132
1130
|
|
|
1133
|
-
currentRef.onClear = onClear
|
|
1131
|
+
currentRef.onClear = onClear;
|
|
1132
|
+
currentRef.setPreviousValue = setPreviousValue;
|
|
1133
|
+
|
|
1134
|
+
currentRef.setValue = value => {
|
|
1134
1135
|
if (allValue[unique][allValue[unique].length - 1] !== value) {
|
|
1135
1136
|
allValue[unique].push(value);
|
|
1136
1137
|
}
|
|
1137
1138
|
|
|
1138
1139
|
setValueIntoInput(value);
|
|
1139
|
-
}
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
currentRef.DOM = dropdownRef.current;
|
|
1140
1143
|
return currentRef;
|
|
1141
1144
|
});
|
|
1142
1145
|
useEffect(() => {
|
|
@@ -1298,7 +1301,6 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1298
1301
|
!!onLoadMore && dataSource.length < total && boxRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
1299
1302
|
} else {
|
|
1300
1303
|
isSearch[unique] = false;
|
|
1301
|
-
renderDropdown();
|
|
1302
1304
|
}
|
|
1303
1305
|
} else {
|
|
1304
1306
|
if (!multiple && !disabled && !readOnly) {
|
|
@@ -1406,6 +1408,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1406
1408
|
...errorStyle
|
|
1407
1409
|
}
|
|
1408
1410
|
}, error), [error, disabled, errorStyle]);
|
|
1411
|
+
const dropdownComp = useMemo(() => {
|
|
1412
|
+
return openState ? /*#__PURE__*/createPortal(showDropdown(), document.body) : null;
|
|
1413
|
+
}, [openState, dataSource]);
|
|
1409
1414
|
/* End component */
|
|
1410
1415
|
|
|
1411
1416
|
return jsx(Fragment, null, jsx("div", {
|
|
@@ -1413,7 +1418,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1413
1418
|
css: DropdownRootCSS(viewType, multiple, placeholder, itemMultipleSize, renderSelectedItem, loading, showClear),
|
|
1414
1419
|
className: ['DGN-UI-Dropdown', className, error && 'error', loading && 'dgn-dropdown-loading', disabled ? 'disabled' : readOnly && 'readOnly'].join(' ').trim().replace(/\s+/g, ' '),
|
|
1415
1420
|
style: style
|
|
1416
|
-
}, labelComp, inputComp, errorComp),
|
|
1421
|
+
}, labelComp, inputComp, errorComp), dropdownComp);
|
|
1417
1422
|
}));
|
|
1418
1423
|
/* Start styled */
|
|
1419
1424
|
|
|
@@ -1756,7 +1761,7 @@ Dropdown.defaultProps = {
|
|
|
1756
1761
|
required: false,
|
|
1757
1762
|
multiple: false,
|
|
1758
1763
|
allowSearch: false,
|
|
1759
|
-
|
|
1764
|
+
closeAfterSelect: true,
|
|
1760
1765
|
inputProps: {},
|
|
1761
1766
|
formStyle: {},
|
|
1762
1767
|
dataSource: [],
|