diginet-core-ui 1.3.80 → 1.3.81
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/components/avatar/index.js +10 -9
- package/components/button/icon.js +7 -4
- package/components/button/index.js +37 -23
- package/components/divider/index.js +56 -55
- package/components/form-control/attachment/index.js +234 -416
- package/components/form-control/date-range-picker/index.js +57 -57
- package/components/index.js +1 -1
- package/components/popover/body.js +9 -9
- package/components/popover/footer.js +7 -7
- package/components/popover/header.js +8 -8
- package/components/popover/index.js +17 -15
- package/components/popup/v2/index.js +122 -144
- package/components/progress/circular.js +1 -1
- package/global/index.js +1 -1
- package/icons/basic.js +52 -0
- package/package.json +1 -1
- package/readme.md +10 -0
- package/components/divider/style.js +0 -12
|
@@ -1,77 +1,44 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon, HelperText, Label, LinearProgress, List, ListItem, ListItemText, ModalSample, Notify, Popover, Popup, ScrollBar, Slider, SliderItem, Typography } from "../..";
|
|
5
|
+
import { getGlobal } from "../../../global";
|
|
6
|
+
import { Another, Compressed, Image, Pdf, Presentation, Sheet, Word } from "../../../icons";
|
|
4
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { forwardRef, Fragment, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
5
9
|
import ReactDOM from 'react-dom';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Pdf, Word, Sheet, Presentation, Compressed, Image, Another, View, Download, Delete, Attachment as AttachmentIcon } from "../../../icons";
|
|
10
|
+
import { alignCenter, border, borderBox, borderRadius4px, borderRadius50, breakWord, cursorPointer, displayBlock, displayInlineBlock, displayNone, ellipsis, flexCol, flexRow, flexWrap, justifyBetween, justifyCenter, justifyStart, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textCenter, userSelectNone } from "../../../styles/general";
|
|
11
|
+
import { useTheme } from "../../../theme";
|
|
9
12
|
import { classNames, date as moment, getFileType } from "../../../utils";
|
|
10
|
-
import { getGlobal } from "../../../global";
|
|
11
|
-
import { useTheme, makeStyles } from "../../../theme";
|
|
12
|
-
import { alignCenter, border, borderBox, borderRadius4px, breakWord, cursorPointer, displayBlock, displayInlineBlock, displayNone, ellipsis, flexCol, flexRow, flexWrap, justifyBetween, justifyCenter, justifyStart, parseHeight, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textUppercase, userSelectNone } from "../../../styles/general";
|
|
13
|
-
const theme = useTheme();
|
|
14
13
|
const {
|
|
15
14
|
colors: {
|
|
16
15
|
system: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dark
|
|
16
|
+
rest: systemRest,
|
|
17
|
+
white: systemWhite,
|
|
18
|
+
dark: systemDark
|
|
21
19
|
},
|
|
22
20
|
semantic: {
|
|
23
|
-
success
|
|
24
|
-
danger
|
|
21
|
+
success: semanticSuccess
|
|
25
22
|
},
|
|
26
23
|
fill: {
|
|
27
24
|
hover: fillHover,
|
|
28
|
-
pressed,
|
|
29
|
-
focus
|
|
25
|
+
pressed: fillPressed,
|
|
26
|
+
focus: fillFocus
|
|
30
27
|
},
|
|
31
28
|
line: {
|
|
32
|
-
normal
|
|
33
|
-
hover: lineHover
|
|
29
|
+
normal: lineNormal
|
|
34
30
|
},
|
|
35
31
|
text: {
|
|
36
|
-
sub
|
|
32
|
+
sub: textSub
|
|
37
33
|
}
|
|
38
34
|
},
|
|
39
35
|
typography: {
|
|
40
|
-
heading5,
|
|
41
36
|
paragraph1,
|
|
42
37
|
paragraph2,
|
|
43
38
|
paragraph3
|
|
44
39
|
},
|
|
45
40
|
spacing
|
|
46
|
-
} =
|
|
47
|
-
const useStyles = makeStyles({
|
|
48
|
-
listItem: {
|
|
49
|
-
'&.DGN-UI-List-Item': {
|
|
50
|
-
'.DGN-UI-List-Item-Icon': {
|
|
51
|
-
minWidth: '28px',
|
|
52
|
-
svg: {
|
|
53
|
-
visibility: 'hidden',
|
|
54
|
-
transform: 'rotate(-90deg)'
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
'&.DGN-Active': {
|
|
58
|
-
'.DGN-UI-List-Item-Icon': {
|
|
59
|
-
svg: {
|
|
60
|
-
visibility: 'visible',
|
|
61
|
-
transform: 'rotate(90deg)'
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
'&.DGN-Decrease': {
|
|
65
|
-
'.DGN-UI-List-Item-Icon': {
|
|
66
|
-
svg: {
|
|
67
|
-
transform: 'rotate(-90deg)'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
41
|
+
} = useTheme();
|
|
75
42
|
const icons = {
|
|
76
43
|
pdf: jsx(Pdf, {
|
|
77
44
|
width: '100%',
|
|
@@ -106,11 +73,6 @@ const oldAttached = [];
|
|
|
106
73
|
const allNewAttached = new FormData();
|
|
107
74
|
const attached = [];
|
|
108
75
|
const chosenItems = [];
|
|
109
|
-
let timer = null;
|
|
110
|
-
let prevent = false;
|
|
111
|
-
let existClickOutOfItem = false;
|
|
112
|
-
let maxSize = Infinity;
|
|
113
|
-
let divideSize = null;
|
|
114
76
|
const getType = data => {
|
|
115
77
|
if (data.type !== undefined) {
|
|
116
78
|
var _type$match;
|
|
@@ -193,30 +155,28 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
193
155
|
uploadErrorInfo,
|
|
194
156
|
viewType
|
|
195
157
|
}, reference) => {
|
|
196
|
-
const classes = useStyles();
|
|
197
158
|
const ref = useRef(null);
|
|
198
|
-
const [open, setOpen] = useState(false);
|
|
199
|
-
const [popup, setPopup] = useState(false);
|
|
200
|
-
const [popover, setPopover] = useState(false);
|
|
201
|
-
const [viewTypeState, setViewTypeState] = useState(viewType);
|
|
202
159
|
const attachTextRef = useRef(null);
|
|
203
160
|
const attachmentHandleIconRef = useRef(null);
|
|
204
|
-
const sortIconRef = useRef(null);
|
|
205
|
-
const attachmentImageIconRef = useRef(null);
|
|
206
161
|
const attachmentInputRef = useRef(null);
|
|
207
|
-
const attachmentImageRef = useRef(null);
|
|
208
162
|
const attachedRef = useRef(null);
|
|
209
163
|
const newAttachedRef = useRef([]);
|
|
210
164
|
const popupRef = useRef(null);
|
|
211
165
|
const popoverRef = useRef(null);
|
|
212
166
|
const isDeleteAll = useRef(false);
|
|
213
|
-
const
|
|
167
|
+
const notifyRef = useRef(null);
|
|
214
168
|
const removedAttachedRef = useRef([]);
|
|
169
|
+
const prevent = useRef(null);
|
|
170
|
+
const existClickOutOfItem = useRef(null);
|
|
171
|
+
const divideSize = useRef(null);
|
|
172
|
+
const maxSize = useRef(Infinity);
|
|
173
|
+
const timer = useRef(null);
|
|
174
|
+
const [showModal, setShowModal] = useState(false);
|
|
175
|
+
const [showPopup, setShowPopup] = useState(false);
|
|
176
|
+
const [viewTypeState, setViewTypeState] = useState(viewType);
|
|
177
|
+
const [isEmpty, setIsEmpty] = useState(null);
|
|
215
178
|
|
|
216
179
|
// Start handler
|
|
217
|
-
const onShowSortPopover = () => {
|
|
218
|
-
setPopover(true);
|
|
219
|
-
};
|
|
220
180
|
const onSortElement = (e, type) => {
|
|
221
181
|
let multi = 1;
|
|
222
182
|
const currentActive = popoverRef.current.querySelector('.DGN-Active');
|
|
@@ -276,24 +236,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
276
236
|
attachedList.forEach(el => {
|
|
277
237
|
attachedRef.current.appendChild(el);
|
|
278
238
|
});
|
|
279
|
-
setPopover(false);
|
|
280
239
|
};
|
|
281
240
|
const afterChangeFile = (length = 0) => {
|
|
282
|
-
|
|
283
|
-
if (!length) {
|
|
284
|
-
if (!attachmentImageRef.current.classList.contains('hint-center')) {
|
|
285
|
-
attachmentImageRef.current.classList.add('hint-center');
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
attachmentImageRef.current.classList.remove('hint-center');
|
|
289
|
-
}
|
|
290
|
-
if ((_sortIconRef$current = sortIconRef.current) !== null && _sortIconRef$current !== void 0 && _sortIconRef$current.element) {
|
|
291
|
-
if (length > 1) {
|
|
292
|
-
sortIconRef.current.element.style.display = null;
|
|
293
|
-
} else {
|
|
294
|
-
sortIconRef.current.element.style.display = 'none';
|
|
295
|
-
}
|
|
296
|
-
}
|
|
241
|
+
setIsEmpty(!length);
|
|
297
242
|
};
|
|
298
243
|
const onChangeFiles = async e => {
|
|
299
244
|
if (readOnly || disabled) return;
|
|
@@ -301,19 +246,19 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
301
246
|
let files = e.target.files;
|
|
302
247
|
const lengthAttached = attached.length;
|
|
303
248
|
for (let i = 0; i < files.length; i++) {
|
|
304
|
-
if (i + 1 > maxFile - lengthAttached || files[i].size > maxSize || checkExistingFile(files[i]) || !checkAcceptFileType(files[i])) {
|
|
249
|
+
if (i + 1 > maxFile - lengthAttached || files[i].size > maxSize.current || checkExistingFile(files[i]) || !checkAcceptFileType(files[i])) {
|
|
305
250
|
if (i + 1 > maxFile - lengthAttached) {
|
|
306
251
|
var _files$i;
|
|
307
|
-
|
|
308
|
-
} else if (files[i].size > maxSize) {
|
|
252
|
+
notifyRef.current.instance.show(`${(_files$i = files[i]) === null || _files$i === void 0 ? void 0 : _files$i.name} - ${uploadErrorInfo['maxFile']}`);
|
|
253
|
+
} else if (files[i].size > maxSize.current) {
|
|
309
254
|
var _files$i2;
|
|
310
|
-
|
|
255
|
+
notifyRef.current.instance.show(`${(_files$i2 = files[i]) === null || _files$i2 === void 0 ? void 0 : _files$i2.name} - ${uploadErrorInfo['maxSize']}`);
|
|
311
256
|
} else if (!checkAcceptFileType(files[i])) {
|
|
312
257
|
var _files$i3;
|
|
313
|
-
|
|
258
|
+
notifyRef.current.instance.show(`${(_files$i3 = files[i]) === null || _files$i3 === void 0 ? void 0 : _files$i3.name} - ${uploadErrorInfo['fileType']}`);
|
|
314
259
|
} else {
|
|
315
260
|
var _files$i4;
|
|
316
|
-
|
|
261
|
+
notifyRef.current.instance.show(`${(_files$i4 = files[i]) === null || _files$i4 === void 0 ? void 0 : _files$i4.name} - ${uploadErrorInfo['existingFile']}`);
|
|
317
262
|
}
|
|
318
263
|
files = removeFileOutInputFiles(i, true);
|
|
319
264
|
i--;
|
|
@@ -465,8 +410,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
465
410
|
if (!size && size !== 0) return 'unknown';
|
|
466
411
|
let totalSize;
|
|
467
412
|
let unitSizeName;
|
|
468
|
-
if (divideSize) {
|
|
469
|
-
totalSize = size / divideSize;
|
|
413
|
+
if (divideSize.current) {
|
|
414
|
+
totalSize = size / divideSize.current;
|
|
470
415
|
unitSizeName = unitSize.toUpperCase();
|
|
471
416
|
while (totalSize < 0.01 && unitSizeName !== 'B') {
|
|
472
417
|
[unitSizeName, totalSize] = getNewUnitSize(unitSizeName, totalSize, 1);
|
|
@@ -486,10 +431,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
486
431
|
return totalSize + ' ' + unitSizeName;
|
|
487
432
|
};
|
|
488
433
|
const onShowPopup = () => {
|
|
489
|
-
|
|
434
|
+
setShowPopup(true);
|
|
490
435
|
};
|
|
491
436
|
const onClosePopup = () => {
|
|
492
|
-
|
|
437
|
+
setShowPopup(false);
|
|
493
438
|
if (isDeleteAll.current) {
|
|
494
439
|
isDeleteAll.current = false;
|
|
495
440
|
chosenItems.length = 0;
|
|
@@ -554,23 +499,16 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
554
499
|
onView(node, AttachmentID);
|
|
555
500
|
};
|
|
556
501
|
const onView = (node, AttachmentID) => {
|
|
557
|
-
if (timer) {
|
|
558
|
-
prevent = true;
|
|
559
|
-
clearTimeout(timer);
|
|
560
|
-
// if (existClickOutOfItem) {
|
|
561
|
-
// removeAllChosenItems();
|
|
562
|
-
// attachedRef.current.querySelectorAll('.chosen').forEach(itemEl => {
|
|
563
|
-
// itemEl.classList.remove('chosen');
|
|
564
|
-
// })
|
|
565
|
-
// }
|
|
502
|
+
if (timer.current) {
|
|
503
|
+
prevent.current = true;
|
|
504
|
+
clearTimeout(timer.current);
|
|
566
505
|
}
|
|
567
|
-
|
|
568
506
|
const index = Array.from(attachedRef.current.children).indexOf(node);
|
|
569
507
|
if (onViewProp) onViewProp(AttachmentID, index);else {
|
|
570
|
-
|
|
508
|
+
setShowModal(true);
|
|
571
509
|
}
|
|
572
510
|
setTimeout(() => {
|
|
573
|
-
prevent = false;
|
|
511
|
+
prevent.current = false;
|
|
574
512
|
}, 110);
|
|
575
513
|
};
|
|
576
514
|
const onDownload = (url, name) => {
|
|
@@ -646,16 +584,21 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
646
584
|
}
|
|
647
585
|
return false;
|
|
648
586
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
587
|
+
|
|
588
|
+
// const checkExistingFileInData = newFile => {
|
|
589
|
+
// const files = data;
|
|
590
|
+
|
|
591
|
+
// if (files && files.length) {
|
|
592
|
+
// const length = files.length;
|
|
593
|
+
|
|
594
|
+
// for (let i = 0; i < length; i++) {
|
|
595
|
+
// if (parseStringify2(newFile) === parseStringify2(files[i], true)) return true;
|
|
596
|
+
// }
|
|
597
|
+
// }
|
|
598
|
+
|
|
599
|
+
// return false;
|
|
600
|
+
// };
|
|
601
|
+
|
|
659
602
|
const checkAcceptFileType = newFile => {
|
|
660
603
|
if (!accept || !accept.length) return true;
|
|
661
604
|
const type = typeof accept === 'string' ? accept : accept.join('-');
|
|
@@ -670,8 +613,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
670
613
|
const ctrlKey = e.ctrlKey;
|
|
671
614
|
const shiftKey = e.shiftKey;
|
|
672
615
|
const itemEl = e.currentTarget;
|
|
673
|
-
timer = setTimeout(() => {
|
|
674
|
-
if (!prevent) {
|
|
616
|
+
timer.current = setTimeout(() => {
|
|
617
|
+
if (!prevent.current) {
|
|
675
618
|
const index = Array.from(attachedRef.current.children).indexOf(itemEl.parentNode);
|
|
676
619
|
if (shiftKey && !ctrlKey) {
|
|
677
620
|
let startIndex = chosenItems[chosenItems.length - 1] || 0;
|
|
@@ -713,15 +656,15 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
713
656
|
itemEl.classList.add('chosen');
|
|
714
657
|
}
|
|
715
658
|
// Add event listener click out of item
|
|
716
|
-
if (!existClickOutOfItem) {
|
|
717
|
-
existClickOutOfItem = true;
|
|
659
|
+
if (!existClickOutOfItem.current) {
|
|
660
|
+
existClickOutOfItem.current = true;
|
|
718
661
|
attachmentHandleIconRef.current.style.display = 'block';
|
|
719
662
|
document.addEventListener('keydown', onKeyDown);
|
|
720
663
|
document.addEventListener('click', clickOutOfItem);
|
|
721
664
|
}
|
|
722
665
|
checkChosenMultiple();
|
|
723
666
|
}
|
|
724
|
-
prevent = false;
|
|
667
|
+
prevent.current = false;
|
|
725
668
|
}, 100);
|
|
726
669
|
};
|
|
727
670
|
const removeActiveChosenItem = () => {
|
|
@@ -846,7 +789,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
846
789
|
};
|
|
847
790
|
const removeAllChosenItems = () => {
|
|
848
791
|
chosenItems.length = 0;
|
|
849
|
-
existClickOutOfItem = false;
|
|
792
|
+
existClickOutOfItem.current = false;
|
|
850
793
|
attachmentHandleIconRef.current.style.display = null;
|
|
851
794
|
document.removeEventListener('keydown', onKeyDown);
|
|
852
795
|
document.removeEventListener('click', clickOutOfItem);
|
|
@@ -859,10 +802,13 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
859
802
|
type: fileInfo.type,
|
|
860
803
|
webkitRelativePath: fileInfo.webkitRelativePath
|
|
861
804
|
});
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
805
|
+
|
|
806
|
+
// const parseStringify2 = (fileInfo, inData) =>
|
|
807
|
+
// JSON.stringify({
|
|
808
|
+
// name: fileInfo?.[inData ? 'FileName' : 'name'],
|
|
809
|
+
// size: fileInfo?.[inData ? 'FileSize' : 'size'],
|
|
810
|
+
// });
|
|
811
|
+
|
|
866
812
|
const mountDomain = item => {
|
|
867
813
|
if (!item) return item;
|
|
868
814
|
const cloneItem = JSON.parse(JSON.stringify(item));
|
|
@@ -894,29 +840,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
894
840
|
attached.length = 0;
|
|
895
841
|
}
|
|
896
842
|
return () => {
|
|
897
|
-
existClickOutOfItem = false;
|
|
843
|
+
existClickOutOfItem.current = false;
|
|
898
844
|
};
|
|
899
845
|
}, []);
|
|
900
|
-
useEffect(() => {
|
|
901
|
-
let el = null;
|
|
902
|
-
if (error) {
|
|
903
|
-
attachTextRef.current.style.color = danger;
|
|
904
|
-
ref.current.style.borderColor = danger;
|
|
905
|
-
el = document.createElement('p');
|
|
906
|
-
el.classList.add('attachment-error');
|
|
907
|
-
el.innerHTML = error;
|
|
908
|
-
attachTextRef.current.parentNode.insertAdjacentElement('afterend', el);
|
|
909
|
-
}
|
|
910
|
-
return () => {
|
|
911
|
-
if (attachTextRef.current && ref.current) {
|
|
912
|
-
attachTextRef.current.style.color = null;
|
|
913
|
-
ref.current.style.borderColor = null;
|
|
914
|
-
}
|
|
915
|
-
if (el) {
|
|
916
|
-
el.remove();
|
|
917
|
-
}
|
|
918
|
-
};
|
|
919
|
-
}, [error]);
|
|
920
846
|
useEffect(() => {
|
|
921
847
|
setViewTypeState(viewType);
|
|
922
848
|
}, [viewType]);
|
|
@@ -929,22 +855,22 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
929
855
|
useEffect(() => {
|
|
930
856
|
switch (true) {
|
|
931
857
|
case /^B$/i.test(unitSize):
|
|
932
|
-
divideSize = 1;
|
|
858
|
+
divideSize.current = 1;
|
|
933
859
|
break;
|
|
934
860
|
case /KB/i.test(unitSize):
|
|
935
|
-
divideSize = 1024;
|
|
861
|
+
divideSize.current = 1024;
|
|
936
862
|
break;
|
|
937
863
|
case /MB/i.test(unitSize):
|
|
938
|
-
divideSize = 1024 ** 2;
|
|
864
|
+
divideSize.current = 1024 ** 2;
|
|
939
865
|
break;
|
|
940
866
|
case /GB/i.test(unitSize):
|
|
941
|
-
divideSize = 1024 ** 3;
|
|
867
|
+
divideSize.current = 1024 ** 3;
|
|
942
868
|
break;
|
|
943
869
|
case /TB/i.test(unitSize):
|
|
944
|
-
divideSize = 1024 ** 4;
|
|
870
|
+
divideSize.current = 1024 ** 4;
|
|
945
871
|
break;
|
|
946
872
|
default:
|
|
947
|
-
divideSize = null;
|
|
873
|
+
divideSize.current = null;
|
|
948
874
|
break;
|
|
949
875
|
}
|
|
950
876
|
attachmentInputRef.current.addEventListener('change', onChangeFiles);
|
|
@@ -955,11 +881,11 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
955
881
|
useEffect(() => {
|
|
956
882
|
if (maxSizeProp) {
|
|
957
883
|
if (!isNaN(maxSizeProp)) {
|
|
958
|
-
maxSize = maxSizeProp * 1024 * 1024;
|
|
884
|
+
maxSize.current = maxSizeProp * 1024 * 1024;
|
|
959
885
|
} else {
|
|
960
886
|
const numberSize = maxSizeProp.match(/\d+/g);
|
|
961
887
|
const unitMaxSize = maxSizeProp.match(/\D+/g);
|
|
962
|
-
maxSize = getBit(numberSize, unitMaxSize);
|
|
888
|
+
maxSize.current = getBit(numberSize, unitMaxSize);
|
|
963
889
|
}
|
|
964
890
|
}
|
|
965
891
|
attachmentInputRef.current.multiple = multiple;
|
|
@@ -972,7 +898,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
972
898
|
attachmentInputRef.current.removeEventListener('change', onChangeFiles);
|
|
973
899
|
attachmentInputRef.current.accept = null;
|
|
974
900
|
}
|
|
975
|
-
maxSize = Infinity;
|
|
901
|
+
maxSize.current = Infinity;
|
|
976
902
|
};
|
|
977
903
|
}, [maxFile, maxSizeProp, multiple, accept]);
|
|
978
904
|
useEffect(() => {
|
|
@@ -983,36 +909,38 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
983
909
|
// Load files data was uploaded
|
|
984
910
|
const length = data.length;
|
|
985
911
|
for (let i = 0; i < length; i++) {
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
912
|
+
const newAttach = getItemHTMLFromData(data[i], i);
|
|
913
|
+
if (Object.prototype.toString.call(data[i]) === '[object File]') {
|
|
914
|
+
allNewAttached.append('files', data[i]);
|
|
915
|
+
newAttachedRef.current.push(data[i]);
|
|
916
|
+
attached.push(data[i]);
|
|
991
917
|
} else {
|
|
918
|
+
const item = mountDomain(data[i]);
|
|
992
919
|
oldAttached.push(item);
|
|
920
|
+
attached.push(item);
|
|
993
921
|
}
|
|
994
|
-
attached.push(item);
|
|
995
922
|
const newElement = document.createElement('div');
|
|
996
923
|
newElement.className = 'attachment-row';
|
|
997
924
|
ReactDOM.render(newAttach, attachedRef.current.appendChild(newElement));
|
|
998
925
|
}
|
|
999
926
|
}
|
|
1000
|
-
if (newAttachedRef.current) {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
927
|
+
// if (newAttachedRef.current) {
|
|
928
|
+
// const length = newAttachedRef.current.length;
|
|
929
|
+
|
|
930
|
+
// for (let i = length - 1; i >= 0; i--) {
|
|
931
|
+
// const item = newAttachedRef.current[i];
|
|
932
|
+
// if (checkExistingFileInData(item)) {
|
|
933
|
+
// newAttachedRef.current.splice(i, 1);
|
|
934
|
+
// } else {
|
|
935
|
+
// const newAttach = getItemHTMLFromData(item, i);
|
|
936
|
+
// allNewAttached.append('files', item);
|
|
937
|
+
// attached.push(item);
|
|
938
|
+
// const newElement = document.createElement('div');
|
|
939
|
+
// newElement.className = 'attachment-row';
|
|
940
|
+
// ReactDOM.render(newAttach, attachedRef.current.appendChild(newElement));
|
|
941
|
+
// }
|
|
942
|
+
// }
|
|
943
|
+
// }
|
|
1016
944
|
return () => {
|
|
1017
945
|
if (attachedRef.current) {
|
|
1018
946
|
attachedRef.current.innerHTML = null;
|
|
@@ -1065,66 +993,82 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1065
993
|
className: 'DGN-UI-Attachment-Header'
|
|
1066
994
|
}, jsx("div", {
|
|
1067
995
|
css: AttachmentInfoCSS
|
|
1068
|
-
}, jsx(
|
|
1069
|
-
|
|
996
|
+
}, jsx(Label, {
|
|
997
|
+
uppercase: true,
|
|
998
|
+
required: required,
|
|
999
|
+
disabled: disabled,
|
|
1000
|
+
type: 'h5',
|
|
1001
|
+
color: textSub,
|
|
1070
1002
|
ref: attachTextRef
|
|
1071
|
-
}, label,
|
|
1072
|
-
style: {
|
|
1073
|
-
color: danger
|
|
1074
|
-
}
|
|
1075
|
-
}, " *"))), jsx("div", {
|
|
1003
|
+
}, label), error ? jsx(HelperText, null, error) : null), jsx("div", {
|
|
1076
1004
|
css: AttachmentHeaderIconCSS
|
|
1077
1005
|
}, jsx("div", {
|
|
1078
1006
|
css: AttachmentHandleIconCSS,
|
|
1079
1007
|
ref: attachmentHandleIconRef
|
|
1080
|
-
}, jsx(
|
|
1008
|
+
}, jsx(ButtonIcon, {
|
|
1009
|
+
viewType: 'ghost',
|
|
1081
1010
|
className: 'view',
|
|
1011
|
+
name: 'view',
|
|
1082
1012
|
onClick: () => onGetViewItem()
|
|
1083
|
-
}, jsx(
|
|
1084
|
-
|
|
1085
|
-
viewBox: true
|
|
1086
|
-
})), jsx("span", {
|
|
1013
|
+
}), jsx(ButtonIcon, {
|
|
1014
|
+
viewType: 'ghost',
|
|
1087
1015
|
className: 'download',
|
|
1016
|
+
name: 'download',
|
|
1088
1017
|
onClick: onDownloadMultiple
|
|
1089
|
-
}, jsx(
|
|
1090
|
-
|
|
1091
|
-
viewBox: true
|
|
1092
|
-
})), !readOnly && jsx("span", {
|
|
1018
|
+
}), !readOnly ? jsx(ButtonIcon, {
|
|
1019
|
+
viewType: 'ghost',
|
|
1093
1020
|
className: 'delete',
|
|
1021
|
+
name: 'delete',
|
|
1094
1022
|
onClick: onShowPopup
|
|
1095
|
-
}, jsx(
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
}))), jsx("div", {
|
|
1099
|
-
css: AttachmentImageCSS,
|
|
1100
|
-
ref: attachmentImageRef
|
|
1101
|
-
}, !(readOnly || disabled) && jsx("div", {
|
|
1023
|
+
}) : null), jsx("div", {
|
|
1024
|
+
css: isEmpty ? AttachmentImageEmptyCSS : AttachmentImageCSS
|
|
1025
|
+
}, !(readOnly || disabled) ? jsx("div", {
|
|
1102
1026
|
css: AttachmentImageCenterCSS
|
|
1103
|
-
}, jsx(
|
|
1104
|
-
css:
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1027
|
+
}, jsx(ButtonIcon, {
|
|
1028
|
+
css: isEmpty && ButtonAttachmentCSS,
|
|
1029
|
+
circular: isEmpty,
|
|
1030
|
+
viewType: isEmpty ? 'text' : 'ghost',
|
|
1031
|
+
name: 'Attachment',
|
|
1032
|
+
size: isEmpty ? 'extraGiant' : 'medium',
|
|
1108
1033
|
onClick: triggerClickInput
|
|
1109
|
-
}, jsx(
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1034
|
+
}), isEmpty ? jsx(Typography, {
|
|
1035
|
+
css: userSelectNone,
|
|
1036
|
+
type: 'p3',
|
|
1037
|
+
color: systemRest
|
|
1038
|
+
}, hintText) : null) : null), allowSort && !isEmpty ? jsx(Popover, {
|
|
1039
|
+
ref: popoverRef,
|
|
1040
|
+
anchor: jsx(ButtonIcon, {
|
|
1041
|
+
viewType: 'ghost',
|
|
1042
|
+
name: 'Sort',
|
|
1043
|
+
style: {
|
|
1044
|
+
marginRight: 8
|
|
1045
|
+
}
|
|
1046
|
+
}),
|
|
1047
|
+
width: 'max-content',
|
|
1048
|
+
removeAfterClose: false,
|
|
1049
|
+
anchorOrigin: {
|
|
1050
|
+
vertical: 'bottom',
|
|
1051
|
+
horizontal: 'right'
|
|
1121
1052
|
},
|
|
1122
|
-
|
|
1123
|
-
|
|
1053
|
+
transformOrigin: {
|
|
1054
|
+
vertical: 'top',
|
|
1055
|
+
horizontal: 'right'
|
|
1056
|
+
}
|
|
1057
|
+
}, jsx(List, null, jsx(ListItem, {
|
|
1058
|
+
onClick: e => onSortElement(e, 'filename')
|
|
1059
|
+
}, jsx(ListItemText, null, "By name")), jsx(ListItem, {
|
|
1060
|
+
onClick: e => onSortElement(e, 'filetype')
|
|
1061
|
+
}, jsx(ListItemText, null, "By type")), jsx(ListItem, {
|
|
1062
|
+
onClick: e => onSortElement(e, 'filesize')
|
|
1063
|
+
}, jsx(ListItemText, null, "By size")), jsx(ListItem, {
|
|
1064
|
+
onClick: e => onSortElement(e, 'datetime')
|
|
1065
|
+
}, jsx(ListItemText, null, "By date")), jsx(ListItem, {
|
|
1066
|
+
onClick: e => onSortElement(e, 'username')
|
|
1067
|
+
}, jsx(ListItemText, null, "By owner")))) : null, !isEmpty ? jsx(ButtonIcon, {
|
|
1124
1068
|
viewType: 'ghost',
|
|
1125
1069
|
name: viewTypeState === 'detail' ? 'IconView' : 'ListView',
|
|
1126
1070
|
onClick: () => setViewTypeState(viewTypeState === 'icon' ? 'detail' : 'icon')
|
|
1127
|
-
}))), [allowSort, disabled, readOnly, label, required, hintText, viewTypeState]);
|
|
1071
|
+
}) : null)), [error, allowSort, disabled, readOnly, label, required, hintText, domain, viewTypeState, isEmpty]);
|
|
1128
1072
|
const AttachmentInputView = useMemo(() => jsx("div", {
|
|
1129
1073
|
css: AttachmentInputCSS,
|
|
1130
1074
|
className: 'DGN-UI-Attachment-Input'
|
|
@@ -1137,83 +1081,36 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1137
1081
|
...inputProps
|
|
1138
1082
|
})), [inputProps]);
|
|
1139
1083
|
const AttachedView = useMemo(() => jsx(ScrollBar, {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
marginRight: 5,
|
|
1143
|
-
paddingTop: 0,
|
|
1144
|
-
paddingBottom: 0,
|
|
1145
|
-
paddingRight: 7,
|
|
1146
|
-
overflowY: 'overlay'
|
|
1147
|
-
}
|
|
1084
|
+
css: AttachmentListCSS,
|
|
1085
|
+
className: 'DGN-UI-Attachment-List'
|
|
1148
1086
|
}, jsx("div", {
|
|
1149
1087
|
css: AttachedCSS,
|
|
1150
1088
|
ref: attachedRef,
|
|
1151
1089
|
className: viewTypeState === 'icon' ? 'icon-view' : ''
|
|
1152
1090
|
})), [viewTypeState]);
|
|
1153
|
-
const PopoverView = useMemo(() => {
|
|
1154
|
-
return jsx(Popover, {
|
|
1155
|
-
open: popover,
|
|
1156
|
-
ref: popoverRef,
|
|
1157
|
-
anchor: sortIconRef,
|
|
1158
|
-
width: 'max-content',
|
|
1159
|
-
removeAfterClose: false,
|
|
1160
|
-
anchorOrigin: {
|
|
1161
|
-
vertical: 'bottom',
|
|
1162
|
-
horizontal: 'right'
|
|
1163
|
-
},
|
|
1164
|
-
transformOrigin: {
|
|
1165
|
-
vertical: 'top',
|
|
1166
|
-
horizontal: 'right'
|
|
1167
|
-
},
|
|
1168
|
-
onClose: () => setPopover(false)
|
|
1169
|
-
}, jsx(List, null, jsx(ListItem, {
|
|
1170
|
-
className: classes.listItem,
|
|
1171
|
-
button: true,
|
|
1172
|
-
onClick: e => onSortElement(e, 'filename')
|
|
1173
|
-
}, jsx(ListItemText, null, "By name")), jsx(ListItem, {
|
|
1174
|
-
className: classes.listItem,
|
|
1175
|
-
button: true,
|
|
1176
|
-
onClick: e => onSortElement(e, 'filetype')
|
|
1177
|
-
}, jsx(ListItemText, null, "By type")), jsx(ListItem, {
|
|
1178
|
-
className: classes.listItem,
|
|
1179
|
-
button: true,
|
|
1180
|
-
onClick: e => onSortElement(e, 'filesize')
|
|
1181
|
-
}, jsx(ListItemText, null, "By size")), jsx(ListItem, {
|
|
1182
|
-
className: classes.listItem,
|
|
1183
|
-
button: true,
|
|
1184
|
-
onClick: e => onSortElement(e, 'datetime')
|
|
1185
|
-
}, jsx(ListItemText, null, "By date")), jsx(ListItem, {
|
|
1186
|
-
className: classes.listItem,
|
|
1187
|
-
button: true,
|
|
1188
|
-
onClick: e => onSortElement(e, 'username')
|
|
1189
|
-
}, jsx(ListItemText, null, "By owner"))));
|
|
1190
|
-
}, [popover]);
|
|
1191
1091
|
const PopupView = useMemo(() => jsx(Popup, {
|
|
1192
|
-
open:
|
|
1092
|
+
open: showPopup,
|
|
1193
1093
|
ref: popupRef,
|
|
1194
|
-
type: '
|
|
1195
|
-
|
|
1196
|
-
title: deleteNotifyText,
|
|
1197
|
-
fullScreen: true,
|
|
1094
|
+
type: 'yesno',
|
|
1095
|
+
description: deleteNotifyText,
|
|
1198
1096
|
pressESCToClose: true,
|
|
1199
|
-
autoFocusOKButton: true,
|
|
1200
1097
|
onClose: onClosePopup,
|
|
1201
1098
|
onConfirm: onRemoveMultiple,
|
|
1202
1099
|
onCancel: onClosePopup
|
|
1203
|
-
}), [deleteNotifyText, onChange, onRemoveProp,
|
|
1100
|
+
}), [deleteNotifyText, onChange, onRemoveProp, showPopup]);
|
|
1204
1101
|
const ModalView = useMemo(() => {
|
|
1205
|
-
if (!chosenItems.length) return
|
|
1102
|
+
if (!chosenItems.length) return setShowModal(false);
|
|
1206
1103
|
const index = chosenItems[0];
|
|
1207
1104
|
const data = mountDomain(attached[index]);
|
|
1208
1105
|
// let data = oldAttached[index] || allNewAttached.getAll('files')[index-oldAttached.length];
|
|
1209
1106
|
return jsx(ModalSample, {
|
|
1210
|
-
open:
|
|
1107
|
+
open: showModal,
|
|
1211
1108
|
title: data.FileName,
|
|
1212
|
-
onClose: () =>
|
|
1109
|
+
onClose: () => setShowModal(false)
|
|
1213
1110
|
}, jsx(Slider, null, jsx(SliderItem, {
|
|
1214
1111
|
url: data.URL
|
|
1215
1112
|
})));
|
|
1216
|
-
}, [domain,
|
|
1113
|
+
}, [domain, showModal]);
|
|
1217
1114
|
// End view
|
|
1218
1115
|
|
|
1219
1116
|
useImperativeHandle(reference, () => {
|
|
@@ -1243,37 +1140,20 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1243
1140
|
className: classNames('DGN-UI-Attachment', disabled && 'disabled', className),
|
|
1244
1141
|
style: style,
|
|
1245
1142
|
onDragEnter: onDragFileStart
|
|
1246
|
-
}, AttachHeaderView, AttachmentInputView, AttachedView,
|
|
1247
|
-
|
|
1143
|
+
}, AttachHeaderView, AttachmentInputView, AttachedView, PopupView, ModalView, jsx(Notify, {
|
|
1144
|
+
ref: notifyRef,
|
|
1248
1145
|
progressing: true,
|
|
1249
1146
|
autoDisappear: true,
|
|
1250
|
-
position: {
|
|
1251
|
-
vertical: 'bottom',
|
|
1252
|
-
horizontal: 'center'
|
|
1253
|
-
},
|
|
1254
1147
|
color: 'danger'
|
|
1255
1148
|
}));
|
|
1256
1149
|
}));
|
|
1257
|
-
const ViewAttachTypeCSS = css`
|
|
1258
|
-
${cursorPointer};
|
|
1259
|
-
${parseHeight(24)};
|
|
1260
|
-
color: ${rest};
|
|
1261
|
-
&:hover {
|
|
1262
|
-
color: ${active};
|
|
1263
|
-
}
|
|
1264
|
-
`;
|
|
1265
1150
|
const AttachmentHandleIconCSS = css`
|
|
1266
1151
|
${displayNone};
|
|
1267
1152
|
${parseHeight(24)};
|
|
1268
|
-
margin-right: ${spacing([2
|
|
1269
|
-
border-right: 1px solid ${
|
|
1270
|
-
|
|
1271
|
-
${
|
|
1272
|
-
margin-right: ${spacing([2.5])};
|
|
1273
|
-
color: ${rest};
|
|
1274
|
-
&:hover {
|
|
1275
|
-
color: ${active};
|
|
1276
|
-
}
|
|
1153
|
+
margin-right: ${spacing([2])};
|
|
1154
|
+
border-right: 1px solid ${lineNormal};
|
|
1155
|
+
button {
|
|
1156
|
+
margin-right: ${spacing([2])};
|
|
1277
1157
|
}
|
|
1278
1158
|
`;
|
|
1279
1159
|
const AttachmentHeaderCSS = css`
|
|
@@ -1281,26 +1161,12 @@ const AttachmentHeaderCSS = css`
|
|
|
1281
1161
|
${alignCenter};
|
|
1282
1162
|
${justifyBetween};
|
|
1283
1163
|
${borderBox};
|
|
1284
|
-
${
|
|
1164
|
+
${parseWidth('100%')};
|
|
1285
1165
|
padding: ${spacing([4, 4])};
|
|
1286
|
-
.css-${AttachmentHandleIconCSS.name}, .css-${ViewAttachTypeCSS.name} {
|
|
1287
|
-
z-index: 1;
|
|
1288
|
-
}
|
|
1289
1166
|
`;
|
|
1290
1167
|
const AttachmentInfoCSS = css`
|
|
1291
1168
|
${flexRow};
|
|
1292
|
-
${
|
|
1293
|
-
${alignCenter};
|
|
1294
|
-
margin: 0;
|
|
1295
|
-
& + p.attachment-error {
|
|
1296
|
-
color: ${danger};
|
|
1297
|
-
}
|
|
1298
|
-
`;
|
|
1299
|
-
const AttachmentTextCSS = css`
|
|
1300
|
-
${userSelectNone};
|
|
1301
|
-
${textUppercase};
|
|
1302
|
-
${heading5};
|
|
1303
|
-
color: ${sub};
|
|
1169
|
+
gap: ${spacing([2])};
|
|
1304
1170
|
`;
|
|
1305
1171
|
const AttachmentHeaderIconCSS = css`
|
|
1306
1172
|
${flexRow};
|
|
@@ -1312,106 +1178,59 @@ const AttachmentInputCSS = css`
|
|
|
1312
1178
|
${parseWidthHeight('100%', '100%')};
|
|
1313
1179
|
top: 0;
|
|
1314
1180
|
left: 0;
|
|
1315
|
-
z-index: 4;
|
|
1316
1181
|
input {
|
|
1317
1182
|
${positionRelative};
|
|
1318
1183
|
${parseWidthHeight('100%', 'calc(100% + 20px)')};
|
|
1319
1184
|
opacity: 0;
|
|
1320
|
-
top: ${spacing([-5])};
|
|
1321
|
-
font-size: 0px;
|
|
1322
1185
|
}
|
|
1323
1186
|
`;
|
|
1324
1187
|
const AttachmentImageCenterCSS = css`
|
|
1325
|
-
${
|
|
1188
|
+
${flexCol};
|
|
1326
1189
|
${justifyCenter};
|
|
1327
1190
|
${alignCenter};
|
|
1328
1191
|
${parseWidthHeight('100%', '100%')};
|
|
1329
1192
|
`;
|
|
1330
|
-
const
|
|
1331
|
-
${
|
|
1332
|
-
|
|
1333
|
-
`;
|
|
1334
|
-
const AttachmentImageIconCSS = css`
|
|
1335
|
-
${parseWidthHeight(24, 24)};
|
|
1336
|
-
margin-bottom: 0;
|
|
1337
|
-
z-index: 3;
|
|
1338
|
-
svg {
|
|
1339
|
-
color: ${rest};
|
|
1340
|
-
}
|
|
1341
|
-
&:hover {
|
|
1342
|
-
border-color: ${lineHover};
|
|
1343
|
-
svg {
|
|
1344
|
-
color: ${active};
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
`;
|
|
1348
|
-
const AttachmentImageTextCSS = css`
|
|
1349
|
-
${displayNone};
|
|
1350
|
-
${userSelectNone};
|
|
1351
|
-
${paragraph3};
|
|
1352
|
-
color: ${rest};
|
|
1193
|
+
const ButtonAttachmentCSS = css`
|
|
1194
|
+
border: 1px dashed ${lineNormal} !important;
|
|
1195
|
+
margin: ${spacing([0, 'auto', 4])};
|
|
1353
1196
|
`;
|
|
1354
1197
|
const AttachmentImageCSS = css`
|
|
1355
|
-
margin-right:
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
z-index: 1;
|
|
1363
|
-
.css-${AttachmentImageTextCSS.name} {
|
|
1364
|
-
${displayBlock};
|
|
1365
|
-
}
|
|
1366
|
-
.css-${AttachmentImageIconCSS.name} {
|
|
1367
|
-
${flexRow};
|
|
1368
|
-
${justifyCenter};
|
|
1369
|
-
${alignCenter};
|
|
1370
|
-
${parseWidthHeight(64, 64)};
|
|
1371
|
-
margin: 0 auto 8px auto;
|
|
1372
|
-
border: 1px dashed ${normal};
|
|
1373
|
-
border-radius: 50%;
|
|
1374
|
-
svg {
|
|
1375
|
-
${parseWidthHeight(40, 40)};
|
|
1376
|
-
}
|
|
1377
|
-
&:hover {
|
|
1378
|
-
border-color: ${lineHover};
|
|
1379
|
-
background-color: ${fillHover};
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1198
|
+
margin-right: ${spacing([2])};
|
|
1199
|
+
`;
|
|
1200
|
+
const AttachmentImageEmptyCSS = css`
|
|
1201
|
+
${positionAbsolute};
|
|
1202
|
+
${parseWidthHeight('100%', '100%')};
|
|
1203
|
+
top: 0;
|
|
1204
|
+
left: 0;
|
|
1383
1205
|
`;
|
|
1384
1206
|
const AttachedItemInfoCSS = css`
|
|
1385
1207
|
${flexRow};
|
|
1386
1208
|
${alignCenter};
|
|
1387
1209
|
${borderRadius4px};
|
|
1388
1210
|
${userSelectNone};
|
|
1211
|
+
${parseMinWidth('calc(50% - 10px)')};
|
|
1389
1212
|
margin-right: ${spacing([2])};
|
|
1390
|
-
min-width: calc(50% - 10px);
|
|
1391
1213
|
`;
|
|
1392
1214
|
const AttachedItemInfoIconCSS = css`
|
|
1393
1215
|
${flexRow};
|
|
1394
1216
|
${positionRelative};
|
|
1395
|
-
${
|
|
1396
|
-
max-height: 16px;
|
|
1397
|
-
max-width: 14px;
|
|
1217
|
+
${parseMaxWidthHeight(14, 16)};
|
|
1398
1218
|
padding: ${spacing([1, 1.25])};
|
|
1399
1219
|
box-sizing: content-box;
|
|
1400
1220
|
&.new-file:after {
|
|
1401
1221
|
content: '';
|
|
1402
1222
|
${positionAbsolute};
|
|
1403
|
-
${
|
|
1223
|
+
${borderRadius50};
|
|
1224
|
+
${parseWidthHeight(4, 4)};
|
|
1404
1225
|
top: 4.5px;
|
|
1405
1226
|
left: -2px;
|
|
1406
|
-
|
|
1407
|
-
background: ${success};
|
|
1227
|
+
background: ${semanticSuccess};
|
|
1408
1228
|
}
|
|
1409
1229
|
`;
|
|
1410
1230
|
const AttachedItemInfoNameCSS = css`
|
|
1411
1231
|
${paragraph1};
|
|
1412
|
-
${cursorPointer};
|
|
1413
1232
|
${ellipsis};
|
|
1414
|
-
color: ${
|
|
1233
|
+
color: ${systemDark};
|
|
1415
1234
|
margin-left: ${spacing([3])};
|
|
1416
1235
|
padding-top: ${spacing([0.25])};
|
|
1417
1236
|
box-sizing: content-box;
|
|
@@ -1421,23 +1240,22 @@ const AttachedItemOwnerCSS = css`
|
|
|
1421
1240
|
${flexRow};
|
|
1422
1241
|
${positionRelative};
|
|
1423
1242
|
${alignCenter};
|
|
1424
|
-
${cursorPointer};
|
|
1425
1243
|
${userSelectNone};
|
|
1426
|
-
|
|
1427
|
-
color: ${
|
|
1244
|
+
${parseHeight('100%')};
|
|
1245
|
+
color: ${textSub};
|
|
1428
1246
|
.detail-info {
|
|
1429
1247
|
${flexRow};
|
|
1430
|
-
|
|
1248
|
+
${parseMinWidth(333)};
|
|
1431
1249
|
.username {
|
|
1432
1250
|
${displayInlineBlock};
|
|
1433
1251
|
${ellipsis};
|
|
1434
|
-
|
|
1435
|
-
|
|
1252
|
+
${parseMinWidth(120)};
|
|
1253
|
+
${parseMaxWidth(120)};
|
|
1436
1254
|
}
|
|
1437
1255
|
.datetime {
|
|
1438
1256
|
${displayInlineBlock};
|
|
1439
|
-
|
|
1440
|
-
max-
|
|
1257
|
+
${parseMinWidth('max-content')};
|
|
1258
|
+
${parseMaxWidth('max-content')};
|
|
1441
1259
|
}
|
|
1442
1260
|
.filesize {
|
|
1443
1261
|
float: right;
|
|
@@ -1452,22 +1270,22 @@ const AttachedLinearCSS = css`
|
|
|
1452
1270
|
${alignCenter};
|
|
1453
1271
|
${parseWidthHeight('100%', '100%')};
|
|
1454
1272
|
top: 0;
|
|
1455
|
-
background: ${
|
|
1273
|
+
background: ${systemWhite};
|
|
1456
1274
|
`;
|
|
1457
1275
|
const AttachedItemCSS = css`
|
|
1458
1276
|
${flexRow};
|
|
1459
1277
|
${justifyBetween};
|
|
1460
|
-
${alignCenter};
|
|
1461
1278
|
${positionRelative};
|
|
1462
1279
|
${borderRadius4px};
|
|
1280
|
+
${cursorPointer};
|
|
1463
1281
|
${parseHeight(24)};
|
|
1464
1282
|
padding: ${spacing([0, 2])};
|
|
1465
1283
|
transition: padding 0.5s ease;
|
|
1466
1284
|
`;
|
|
1467
1285
|
const AttachedCSS = css`
|
|
1468
1286
|
${positionRelative};
|
|
1469
|
-
|
|
1470
|
-
|
|
1287
|
+
${parseHeight('100%')};
|
|
1288
|
+
${parseMaxHeight(152)};
|
|
1471
1289
|
margin-left: ${spacing([2])};
|
|
1472
1290
|
margin-right: ${spacing([2])};
|
|
1473
1291
|
z-index: 1;
|
|
@@ -1487,10 +1305,10 @@ const AttachedCSS = css`
|
|
|
1487
1305
|
content: '';
|
|
1488
1306
|
flex: auto;
|
|
1489
1307
|
}
|
|
1490
|
-
|
|
1308
|
+
${parseMaxHeight(200)};
|
|
1309
|
+
${parseWidth('max-content')};
|
|
1310
|
+
${parseMaxWidth('calc(100% - 26px)')};
|
|
1491
1311
|
margin-left: 0;
|
|
1492
|
-
width: max-content;
|
|
1493
|
-
max-width: calc(100% - 26px);
|
|
1494
1312
|
.attachment-row {
|
|
1495
1313
|
${positionRelative};
|
|
1496
1314
|
margin-left: ${spacing([4])};
|
|
@@ -1506,17 +1324,16 @@ const AttachedCSS = css`
|
|
|
1506
1324
|
${positionRelative};
|
|
1507
1325
|
${textCenter};
|
|
1508
1326
|
${ellipsis};
|
|
1509
|
-
|
|
1510
|
-
|
|
1327
|
+
${parseWidth('max-content')};
|
|
1328
|
+
${parseMaxWidth(80)};
|
|
1329
|
+
${parseMinWidth(70)};
|
|
1511
1330
|
margin-left: auto;
|
|
1512
1331
|
margin-right: auto;
|
|
1513
|
-
min-width: 70px;
|
|
1514
1332
|
.css-${AttachedItemInfoIconCSS.name} {
|
|
1515
1333
|
${displayBlock};
|
|
1516
1334
|
${parseWidthHeight(40, 40)};
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
margin: 4px auto 2px;
|
|
1335
|
+
${parseMaxWidthHeight(40, 40)};
|
|
1336
|
+
margin: ${spacing([1, 'auto', 0.5])};
|
|
1520
1337
|
padding: 0;
|
|
1521
1338
|
&.new-file:after {
|
|
1522
1339
|
${parseWidthHeight(8, 8)};
|
|
@@ -1528,9 +1345,9 @@ const AttachedCSS = css`
|
|
|
1528
1345
|
${paragraph3};
|
|
1529
1346
|
${textCenter};
|
|
1530
1347
|
${breakWord};
|
|
1348
|
+
${parseMaxWidth('100%')};
|
|
1531
1349
|
margin: ${spacing([0, 2])};
|
|
1532
1350
|
display: -webkit-box;
|
|
1533
|
-
max-width: 100%;
|
|
1534
1351
|
white-space: pre-wrap;
|
|
1535
1352
|
-webkit-line-clamp: 2;
|
|
1536
1353
|
-webkit-box-orient: vertical;
|
|
@@ -1556,21 +1373,22 @@ const AttachedCSS = css`
|
|
|
1556
1373
|
min-width: 684px;
|
|
1557
1374
|
}
|
|
1558
1375
|
`;
|
|
1376
|
+
const AttachmentListCSS = css`
|
|
1377
|
+
${borderBox};
|
|
1378
|
+
margin-right: ${spacing([1.25])};
|
|
1379
|
+
padding: ${spacing([0, 1.75, 0])};
|
|
1380
|
+
overflow-y: overlay;
|
|
1381
|
+
`;
|
|
1559
1382
|
const AttachmentRootCSS = css`
|
|
1560
1383
|
${flexCol};
|
|
1561
1384
|
${flexWrap};
|
|
1562
1385
|
${justifyStart};
|
|
1563
1386
|
${positionRelative};
|
|
1564
1387
|
${borderRadius4px};
|
|
1565
|
-
${
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
background-color: ${
|
|
1569
|
-
&:hover:not(.disabled) {
|
|
1570
|
-
.css-${AttachmentImageIconCSS.name} {
|
|
1571
|
-
${cursorPointer};
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1388
|
+
${borderBox};
|
|
1389
|
+
${border(1, lineNormal)};
|
|
1390
|
+
${parseMinHeight(280)};
|
|
1391
|
+
background-color: ${systemWhite};
|
|
1574
1392
|
.css-${AttachedCSS.name} {
|
|
1575
1393
|
&:not(.disabled) {
|
|
1576
1394
|
.css-${AttachedItemCSS.name} {
|
|
@@ -1581,15 +1399,15 @@ const AttachmentRootCSS = css`
|
|
|
1581
1399
|
}
|
|
1582
1400
|
}
|
|
1583
1401
|
&:active {
|
|
1584
|
-
background-color: ${
|
|
1402
|
+
background-color: ${fillPressed};
|
|
1585
1403
|
.css-${AttachedLinearCSS.name} {
|
|
1586
|
-
background-color: ${
|
|
1404
|
+
background-color: ${fillPressed};
|
|
1587
1405
|
}
|
|
1588
1406
|
}
|
|
1589
1407
|
&.chosen {
|
|
1590
|
-
background-color: ${
|
|
1408
|
+
background-color: ${fillFocus};
|
|
1591
1409
|
.css-${AttachedItemInfoCSS.name}, .css-${AttachedItemOwnerCSS.name} {
|
|
1592
|
-
background-color: ${
|
|
1410
|
+
background-color: ${fillFocus};
|
|
1593
1411
|
}
|
|
1594
1412
|
}
|
|
1595
1413
|
}
|
|
@@ -1602,10 +1420,10 @@ const AttachmentRootCSS = css`
|
|
|
1602
1420
|
}
|
|
1603
1421
|
@media (max-width: 716px) {
|
|
1604
1422
|
.css-${AttachedCSS.name}:not(.icon-view) {
|
|
1605
|
-
|
|
1423
|
+
${parseMinWidth(575)};
|
|
1606
1424
|
}
|
|
1607
1425
|
.css-${AttachedItemInfoCSS.name} {
|
|
1608
|
-
|
|
1426
|
+
${parseMaxWidth('calc(40% - 10px)')};
|
|
1609
1427
|
}
|
|
1610
1428
|
}
|
|
1611
1429
|
`;
|