diginet-core-ui 1.3.73 → 1.3.74
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/MHRP29N0026.svg +13 -0
- package/assets/images/menu/dhr/MHRP29N0027.svg +14 -0
- package/assets/images/menu/dhr/MHRP29N0028.svg +15 -0
- package/components/accordion/details.js +19 -10
- package/components/accordion/group.js +15 -6
- package/components/accordion/index.js +20 -11
- package/components/accordion/summary.js +18 -9
- package/components/avatar/index.js +1 -1
- package/components/badge/index.js +17 -9
- package/components/button/icon.js +33 -25
- package/components/button/index.js +25 -17
- package/components/card/body.js +12 -4
- package/components/card/extra.js +12 -4
- package/components/card/footer.js +12 -4
- package/components/card/header.js +12 -4
- package/components/card/index.js +12 -4
- package/components/chip/index.js +6 -6
- package/components/form-control/attachment/index.js +197 -192
- package/components/form-control/date-picker/index.js +4 -2
- package/components/form-control/date-range-picker/index.js +15 -8
- package/components/form-control/dropdown/index.js +34 -13
- package/components/form-control/input-base/index.js +505 -483
- package/components/form-control/label/index.js +27 -21
- package/components/form-control/text-input/index.js +4 -1
- package/components/grid/Col.js +8 -7
- package/components/grid/Container.js +16 -15
- package/components/grid/Row.js +16 -15
- package/components/grid/index.js +17 -36
- package/components/image/index.js +164 -0
- package/components/index.js +3 -1
- package/components/modal/body.js +12 -9
- package/components/modal/footer.js +22 -11
- package/components/modal/header.js +25 -13
- package/components/modal/index.js +32 -30
- package/components/modal/modal.js +29 -25
- package/components/others/option-wrapper/index.js +5 -18
- package/components/paging/page-info.js +45 -33
- package/components/paging/page-selector2.js +45 -33
- package/components/popover/body.js +14 -6
- package/components/popover/footer.js +15 -6
- package/components/popover/header.js +17 -7
- package/components/popover/index.js +242 -109
- package/components/status/index.js +12 -4
- package/components/tab/tab-container.js +29 -27
- package/components/tab/tab-header.js +33 -28
- package/components/tab/tab-panel.js +31 -27
- package/components/tab/tab.js +45 -35
- package/components/tree-view/index.js +108 -73
- package/components/typography/index.js +36 -25
- package/icons/basic.js +248 -0
- package/icons/effect.js +44 -36
- package/package.json +1 -1
- package/readme.md +40 -0
- package/styles/general.js +23 -0
- package/theme/index.js +1 -1
- package/theme/set-theme.js +2 -1
- package/utils/index.js +13 -10
- package/utils/useMediaQuery.js +4 -2
|
@@ -7,10 +7,10 @@ import ReactDOM from 'react-dom';
|
|
|
7
7
|
import { jsx, css } from '@emotion/core';
|
|
8
8
|
import { ModalSample, Popup, Popover, List, ListItem, ListItemText, Slider, SliderItem, ScrollBar, LinearProgress, ButtonIcon, Notify } from '../../';
|
|
9
9
|
import { Pdf, Word, Sheet, Presentation, Compressed, Image, Another, View, Download, Delete, Attachment as AttachmentIcon } from '../../../icons';
|
|
10
|
-
import { date as moment, getFileType } from '../../../utils';
|
|
10
|
+
import { classNames, date as moment, getFileType } from '../../../utils';
|
|
11
11
|
import { getGlobal } from '../../../global';
|
|
12
12
|
import { useTheme, makeStyles } from '../../../theme';
|
|
13
|
-
import { alignCenter, border, borderBox, borderRadius4px, cursorPointer, displayBlock, displayInlineBlock, displayNone, ellipsis, flexCol, flexRow, flexWrap, justifyBetween, justifyCenter, justifyStart, parseHeight, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textUppercase, userSelectNone } from '../../../styles/general';
|
|
13
|
+
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';
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
16
16
|
colors: {
|
|
@@ -43,8 +43,7 @@ const {
|
|
|
43
43
|
paragraph2,
|
|
44
44
|
paragraph3
|
|
45
45
|
},
|
|
46
|
-
spacing
|
|
47
|
-
|
|
46
|
+
spacing
|
|
48
47
|
} = theme;
|
|
49
48
|
const useStyles = makeStyles({
|
|
50
49
|
listItem: {
|
|
@@ -113,34 +112,101 @@ let prevent = false;
|
|
|
113
112
|
let existClickOutOfItem = false;
|
|
114
113
|
let maxSize = Infinity;
|
|
115
114
|
let divideSize = null;
|
|
115
|
+
|
|
116
|
+
const getType = data => {
|
|
117
|
+
if (data.type !== undefined) {
|
|
118
|
+
var _type$match;
|
|
119
|
+
|
|
120
|
+
const pattern = /word|sheet|presentation|pdf|image|compressed/i;
|
|
121
|
+
let type = data.type;
|
|
122
|
+
|
|
123
|
+
if (!type) {
|
|
124
|
+
if (/rar/.test(data.name)) {
|
|
125
|
+
type = 'compressed';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return ((_type$match = type.match(pattern)) === null || _type$match === void 0 ? void 0 : _type$match[0]) || 'default';
|
|
130
|
+
} else {
|
|
131
|
+
var _data$FileName;
|
|
132
|
+
|
|
133
|
+
const FileExt = (_data$FileName = data.FileName) === null || _data$FileName === void 0 ? void 0 : _data$FileName.slice(data.FileName.lastIndexOf('.'));
|
|
134
|
+
return getFileType(FileExt, 'default');
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const getDateTime = date => {
|
|
139
|
+
if (String(date) === 'Invalid Date') return 'unknown'; // const d = ('0' + date.getDate()).slice(-2);
|
|
140
|
+
// const m = ('0' + (date.getMonth() + 1)).slice(-2);
|
|
141
|
+
// const y = date.getFullYear();
|
|
142
|
+
// const t = date.toTimeString().slice(0, 8);
|
|
143
|
+
|
|
144
|
+
return jsx(Fragment, null, moment(date).format('DD/MM/YYYY, HH:mm:ss'), ' ', jsx("span", {
|
|
145
|
+
style: {
|
|
146
|
+
display: 'none'
|
|
147
|
+
}
|
|
148
|
+
}, date.getMilliseconds()));
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const getNewUnitSize = (sizeName, totalSize, num) => {
|
|
152
|
+
if (sizeName === 'B' && num === 1 || sizeName === 'TB' && num === -1) return [sizeName, totalSize];
|
|
153
|
+
const arraySize = ['TB', 'GB', 'MB', 'KB', 'B'];
|
|
154
|
+
const index = arraySize.indexOf(sizeName);
|
|
155
|
+
const newTotalSize = totalSize * Math.pow(1024, num); // newTotalSize = Math.round(newTotalSize*100)/100;
|
|
156
|
+
|
|
157
|
+
return [arraySize[index + num], newTotalSize];
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const getBit = (size, unit) => {
|
|
161
|
+
switch (true) {
|
|
162
|
+
case /^B$/i.test(unit):
|
|
163
|
+
return size * 1;
|
|
164
|
+
|
|
165
|
+
case /KB/i.test(unit):
|
|
166
|
+
return size * 1024;
|
|
167
|
+
|
|
168
|
+
case /MB/i.test(unit):
|
|
169
|
+
return size * 1024 ** 2;
|
|
170
|
+
|
|
171
|
+
case /GB/i.test(unit):
|
|
172
|
+
return size * 1024 ** 3;
|
|
173
|
+
|
|
174
|
+
case /TB/i.test(unit):
|
|
175
|
+
return size * 1024 ** 4;
|
|
176
|
+
|
|
177
|
+
default:
|
|
178
|
+
return size * 1024 * 1024;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
116
182
|
const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
117
|
-
|
|
118
|
-
|
|
183
|
+
accept,
|
|
184
|
+
allowSort,
|
|
119
185
|
className,
|
|
186
|
+
data,
|
|
120
187
|
deleteNotifyText,
|
|
121
|
-
ownerName,
|
|
122
|
-
hintText,
|
|
123
|
-
multiple,
|
|
124
188
|
disabled,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
189
|
+
domain,
|
|
190
|
+
error,
|
|
191
|
+
hintText,
|
|
192
|
+
id,
|
|
193
|
+
inputProps,
|
|
194
|
+
isStripDomain,
|
|
195
|
+
label,
|
|
131
196
|
maxFile,
|
|
132
197
|
maxSize: maxSizeProp,
|
|
198
|
+
multiple,
|
|
199
|
+
onChange,
|
|
200
|
+
onDownload: onDownloadProp,
|
|
201
|
+
onRemove: onRemoveProp,
|
|
202
|
+
onView: onViewProp,
|
|
203
|
+
ownerName,
|
|
204
|
+
readOnly,
|
|
205
|
+
required,
|
|
206
|
+
style,
|
|
133
207
|
unitSize,
|
|
134
|
-
accept,
|
|
135
208
|
uploadErrorInfo,
|
|
136
|
-
|
|
137
|
-
isStripDomain,
|
|
138
|
-
style,
|
|
139
|
-
inputProps,
|
|
140
|
-
required,
|
|
141
|
-
error,
|
|
142
|
-
readOnly,
|
|
143
|
-
id
|
|
209
|
+
viewType
|
|
144
210
|
}, reference) => {
|
|
145
211
|
const classes = useStyles();
|
|
146
212
|
const ref = useRef(null);
|
|
@@ -159,7 +225,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
159
225
|
const popupRef = useRef(null);
|
|
160
226
|
const popoverRef = useRef(null);
|
|
161
227
|
const isDeleteAll = useRef(false);
|
|
162
|
-
const PushNotify = useRef(null);
|
|
228
|
+
const PushNotify = useRef(null);
|
|
229
|
+
const removedAttachedRef = useRef([]); // Start handler
|
|
163
230
|
|
|
164
231
|
const onShowSortPopover = () => {
|
|
165
232
|
setPopover(true);
|
|
@@ -367,28 +434,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
367
434
|
ReactDOM.render(newAttach, attachedRef.current.appendChild(newElement));
|
|
368
435
|
};
|
|
369
436
|
|
|
370
|
-
const getType = data => {
|
|
371
|
-
if (data.type !== undefined) {
|
|
372
|
-
var _type$match;
|
|
373
|
-
|
|
374
|
-
const pattern = /word|sheet|presentation|pdf|image|compressed/i;
|
|
375
|
-
let type = data.type;
|
|
376
|
-
|
|
377
|
-
if (!type) {
|
|
378
|
-
if (/rar/.test(data.name)) {
|
|
379
|
-
type = 'compressed';
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return ((_type$match = type.match(pattern)) === null || _type$match === void 0 ? void 0 : _type$match[0]) || 'default';
|
|
384
|
-
} else {
|
|
385
|
-
var _data$FileName;
|
|
386
|
-
|
|
387
|
-
const FileExt = (_data$FileName = data.FileName) === null || _data$FileName === void 0 ? void 0 : _data$FileName.slice(data.FileName.lastIndexOf('.'));
|
|
388
|
-
return getFileType(FileExt, 'default');
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
|
|
392
437
|
const getItemDetailHTML = (data, i) => {
|
|
393
438
|
const date = new Date();
|
|
394
439
|
data.CreateDate = date.toISOString();
|
|
@@ -464,23 +509,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
464
509
|
}, calculateSize(data.FileSize || data.size)))));
|
|
465
510
|
};
|
|
466
511
|
|
|
467
|
-
const getDateTime = date => {
|
|
468
|
-
if (String(date) === 'Invalid Date') return 'unknown'; // const d = ('0' + date.getDate()).slice(-2);
|
|
469
|
-
// const m = ('0' + (date.getMonth() + 1)).slice(-2);
|
|
470
|
-
// const y = date.getFullYear();
|
|
471
|
-
// const t = date.toTimeString().slice(0, 8);
|
|
472
|
-
|
|
473
|
-
return jsx(Fragment, null, moment(date).format('DD/MM/YYYY, HH:mm:ss'), ' ', jsx("span", {
|
|
474
|
-
style: {
|
|
475
|
-
display: 'none'
|
|
476
|
-
}
|
|
477
|
-
}, date.getMilliseconds()));
|
|
478
|
-
};
|
|
479
|
-
|
|
480
512
|
const calculateSize = size => {
|
|
481
513
|
if (!size && size !== 0) return 'unknown';
|
|
482
|
-
let totalSize
|
|
483
|
-
let unitSizeName
|
|
514
|
+
let totalSize;
|
|
515
|
+
let unitSizeName;
|
|
484
516
|
|
|
485
517
|
if (divideSize) {
|
|
486
518
|
totalSize = size / divideSize;
|
|
@@ -507,37 +539,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
507
539
|
return totalSize + ' ' + unitSizeName;
|
|
508
540
|
};
|
|
509
541
|
|
|
510
|
-
const getNewUnitSize = (sizeName, totalSize, num) => {
|
|
511
|
-
if (sizeName === 'B' && num === 1 || sizeName === 'TB' && num === -1) return [sizeName, totalSize];
|
|
512
|
-
const arraySize = ['TB', 'GB', 'MB', 'KB', 'B'];
|
|
513
|
-
const index = arraySize.indexOf(sizeName);
|
|
514
|
-
const newTotalSize = totalSize * Math.pow(1024, num); // newTotalSize = Math.round(newTotalSize*100)/100;
|
|
515
|
-
|
|
516
|
-
return [arraySize[index + num], newTotalSize];
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
const getBit = (size, unit) => {
|
|
520
|
-
switch (true) {
|
|
521
|
-
case /^B$/i.test(unit):
|
|
522
|
-
return size * 1;
|
|
523
|
-
|
|
524
|
-
case /KB/i.test(unit):
|
|
525
|
-
return size * 1024;
|
|
526
|
-
|
|
527
|
-
case /MB/i.test(unit):
|
|
528
|
-
return size * 1024 ** 2;
|
|
529
|
-
|
|
530
|
-
case /GB/i.test(unit):
|
|
531
|
-
return size * 1024 ** 3;
|
|
532
|
-
|
|
533
|
-
case /TB/i.test(unit):
|
|
534
|
-
return size * 1024 ** 4;
|
|
535
|
-
|
|
536
|
-
default:
|
|
537
|
-
return size * 1024 * 1024;
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
|
|
541
542
|
const onShowPopup = () => {
|
|
542
543
|
setPopup(true);
|
|
543
544
|
};
|
|
@@ -554,7 +555,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
554
555
|
|
|
555
556
|
const onDownloadMultiple = () => {
|
|
556
557
|
const index = chosenItems[0];
|
|
557
|
-
let file
|
|
558
|
+
let file;
|
|
558
559
|
|
|
559
560
|
if (index < oldAttached.length) {
|
|
560
561
|
file = mountDomain(oldAttached[index]);
|
|
@@ -568,7 +569,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
568
569
|
|
|
569
570
|
const onRemoveMultiple = () => {
|
|
570
571
|
const nodeList = attachedRef.current.querySelectorAll('.chosen');
|
|
571
|
-
const
|
|
572
|
+
const recentRemovedAttached = [];
|
|
572
573
|
nodeList.forEach(itemEl => {
|
|
573
574
|
const parent = itemEl.parentNode;
|
|
574
575
|
const index = Array.from(attachedRef.current.children).indexOf(parent);
|
|
@@ -580,7 +581,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
580
581
|
oldAttached.splice(oldAttached.findIndex(attach => attach.FileName === deletedFile.FileName && attach.CreateDate === deletedFile.CreateDate), 1);
|
|
581
582
|
}
|
|
582
583
|
|
|
583
|
-
|
|
584
|
+
removedAttachedRef.current.push(deletedFile);
|
|
585
|
+
recentRemovedAttached.push(deletedFile);
|
|
584
586
|
parent.remove();
|
|
585
587
|
});
|
|
586
588
|
|
|
@@ -592,11 +594,12 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
592
594
|
if (onChange) onChange({
|
|
593
595
|
element: nodeList,
|
|
594
596
|
attached,
|
|
595
|
-
|
|
597
|
+
recentRemovedAttached,
|
|
598
|
+
removedAttached: removedAttachedRef.current,
|
|
596
599
|
oldAttached,
|
|
597
600
|
allNewAttached: allNewAttached.getAll('files')
|
|
598
601
|
});
|
|
599
|
-
!!
|
|
602
|
+
!!onRemoveProp && onRemoveProp(recentRemovedAttached);
|
|
600
603
|
onClosePopup();
|
|
601
604
|
};
|
|
602
605
|
|
|
@@ -629,7 +632,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
629
632
|
}
|
|
630
633
|
|
|
631
634
|
const index = Array.from(attachedRef.current.children).indexOf(node);
|
|
632
|
-
if (
|
|
635
|
+
if (onViewProp) onViewProp(AttachmentID, index);else {
|
|
633
636
|
setOpen(true);
|
|
634
637
|
}
|
|
635
638
|
setTimeout(() => {
|
|
@@ -650,7 +653,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
650
653
|
a.click();
|
|
651
654
|
window.URL.revokeObjectURL(url);
|
|
652
655
|
}).catch(() => alert('File not found'));
|
|
653
|
-
if (
|
|
656
|
+
if (onDownloadProp) onDownloadProp(url);
|
|
654
657
|
}; // const onRemove = (e, AttachmentID='') => {
|
|
655
658
|
// const parent = e.currentTarget.parentNode.parentNode.parentNode;
|
|
656
659
|
// const index = Array.from(attachedRef.current.children).indexOf(parent);
|
|
@@ -1027,7 +1030,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1027
1030
|
el = document.createElement('p');
|
|
1028
1031
|
el.classList.add('attachment-error');
|
|
1029
1032
|
el.innerHTML = error;
|
|
1030
|
-
attachTextRef.current.parentNode.insertAdjacentElement('
|
|
1033
|
+
attachTextRef.current.parentNode.insertAdjacentElement('afterend', el);
|
|
1031
1034
|
}
|
|
1032
1035
|
|
|
1033
1036
|
return () => {
|
|
@@ -1044,6 +1047,12 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1044
1047
|
useEffect(() => {
|
|
1045
1048
|
setViewTypeState(viewType);
|
|
1046
1049
|
}, [viewType]);
|
|
1050
|
+
useEffect(() => {
|
|
1051
|
+
attachmentInputRef.current.addEventListener('change', onChangeFiles);
|
|
1052
|
+
return () => {
|
|
1053
|
+
attachmentInputRef.current && attachmentInputRef.current.removeEventListener('change', onChangeFiles);
|
|
1054
|
+
};
|
|
1055
|
+
}, [readOnly, disabled, uploadErrorInfo, inputProps, isStripDomain, domain]);
|
|
1047
1056
|
useEffect(() => {
|
|
1048
1057
|
switch (true) {
|
|
1049
1058
|
case /^B$/i.test(unitSize):
|
|
@@ -1076,6 +1085,33 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1076
1085
|
attachmentInputRef.current && attachmentInputRef.current.removeEventListener('change', onChangeFiles);
|
|
1077
1086
|
};
|
|
1078
1087
|
}, [unitSize, onChange]);
|
|
1088
|
+
useEffect(() => {
|
|
1089
|
+
if (maxSizeProp) {
|
|
1090
|
+
if (!isNaN(maxSizeProp)) {
|
|
1091
|
+
maxSize = maxSizeProp * 1024 * 1024;
|
|
1092
|
+
} else {
|
|
1093
|
+
const numberSize = maxSizeProp.match(/\d+/g);
|
|
1094
|
+
const unitMaxSize = maxSizeProp.match(/\D+/g);
|
|
1095
|
+
maxSize = getBit(numberSize, unitMaxSize);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
attachmentInputRef.current.multiple = multiple;
|
|
1100
|
+
|
|
1101
|
+
if (accept && typeof accept === 'string') {
|
|
1102
|
+
attachmentInputRef.current.accept = `${accept}/*`.replace('/*/*', '/*');
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
attachmentInputRef.current.addEventListener('change', onChangeFiles);
|
|
1106
|
+
return () => {
|
|
1107
|
+
if (attachmentInputRef.current) {
|
|
1108
|
+
attachmentInputRef.current.removeEventListener('change', onChangeFiles);
|
|
1109
|
+
attachmentInputRef.current.accept = null;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
maxSize = Infinity;
|
|
1113
|
+
};
|
|
1114
|
+
}, [maxFile, maxSizeProp, multiple, accept]);
|
|
1079
1115
|
useEffect(() => {
|
|
1080
1116
|
var _newAttachedRef$curre;
|
|
1081
1117
|
|
|
@@ -1083,7 +1119,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1083
1119
|
afterChangeFile(((data === null || data === void 0 ? void 0 : data.length) || 0) + (((_newAttachedRef$curre = newAttachedRef.current) === null || _newAttachedRef$curre === void 0 ? void 0 : _newAttachedRef$curre.length) || 0));
|
|
1084
1120
|
|
|
1085
1121
|
if (data) {
|
|
1086
|
-
// Load files data was
|
|
1122
|
+
// Load files data was uploaded
|
|
1087
1123
|
const length = data.length;
|
|
1088
1124
|
|
|
1089
1125
|
for (let i = 0; i < length; i++) {
|
|
@@ -1160,33 +1196,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1160
1196
|
};
|
|
1161
1197
|
}
|
|
1162
1198
|
}, [inputProps]);
|
|
1163
|
-
useEffect(() => {
|
|
1164
|
-
if (maxSizeProp) {
|
|
1165
|
-
if (!isNaN(maxSizeProp)) {
|
|
1166
|
-
maxSize = maxSizeProp * 1024 * 1024;
|
|
1167
|
-
} else {
|
|
1168
|
-
const numberSize = maxSizeProp.match(/\d+/g);
|
|
1169
|
-
const unitMaxSize = maxSizeProp.match(/\D+/g);
|
|
1170
|
-
maxSize = getBit(numberSize, unitMaxSize);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
attachmentInputRef.current.multiple = multiple;
|
|
1175
|
-
|
|
1176
|
-
if (accept && typeof accept === 'string') {
|
|
1177
|
-
attachmentInputRef.current.accept = `${accept}/*`.replace('/*/*', '/*');
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
attachmentInputRef.current.addEventListener('change', onChangeFiles);
|
|
1181
|
-
return () => {
|
|
1182
|
-
if (attachmentInputRef.current) {
|
|
1183
|
-
attachmentInputRef.current.removeEventListener('change', onChangeFiles);
|
|
1184
|
-
attachmentInputRef.current.accept = null;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
maxSize = Infinity;
|
|
1188
|
-
};
|
|
1189
|
-
}, [maxFile, maxSizeProp, multiple, accept]);
|
|
1190
1199
|
|
|
1191
1200
|
const triggerClickInput = () => {
|
|
1192
1201
|
attachmentInputRef.current.click();
|
|
@@ -1342,7 +1351,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1342
1351
|
onClose: onClosePopup,
|
|
1343
1352
|
onConfirm: onRemoveMultiple,
|
|
1344
1353
|
onCancel: onClosePopup
|
|
1345
|
-
}), [deleteNotifyText, popup]);
|
|
1354
|
+
}), [deleteNotifyText, onChange, onRemoveProp, popup]);
|
|
1346
1355
|
const ModalView = useMemo(() => {
|
|
1347
1356
|
if (!chosenItems.length) return setOpen(false);
|
|
1348
1357
|
const index = chosenItems[0];
|
|
@@ -1355,11 +1364,12 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1355
1364
|
}, jsx(Slider, null, jsx(SliderItem, {
|
|
1356
1365
|
url: data.URL
|
|
1357
1366
|
})));
|
|
1358
|
-
}, [open]); // End view
|
|
1367
|
+
}, [domain, open]); // End view
|
|
1359
1368
|
|
|
1360
1369
|
useImperativeHandle(reference, () => {
|
|
1361
1370
|
stripDomain();
|
|
1362
1371
|
const currentRef = ref.current || {};
|
|
1372
|
+
currentRef.element = ref.current;
|
|
1363
1373
|
const _instance = {
|
|
1364
1374
|
oldAttached: oldAttached,
|
|
1365
1375
|
allNewAttached: allNewAttached,
|
|
@@ -1384,7 +1394,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1384
1394
|
ref: ref,
|
|
1385
1395
|
css: AttachmentRootCSS,
|
|
1386
1396
|
id: id,
|
|
1387
|
-
className:
|
|
1397
|
+
className: classNames('DGN-UI-Attachment', disabled && 'disabled', className),
|
|
1388
1398
|
style: style,
|
|
1389
1399
|
onDragEnter: onDragFileStart
|
|
1390
1400
|
}, AttachHeaderView, AttachmentInputView, AttachedView, PopoverView, PopupView, ModalView, jsx(Notify, {
|
|
@@ -1409,11 +1419,11 @@ const ViewAttachTypeCSS = css`
|
|
|
1409
1419
|
const AttachmentHandleIconCSS = css`
|
|
1410
1420
|
${displayNone};
|
|
1411
1421
|
${parseHeight(24)};
|
|
1412
|
-
margin-right:
|
|
1422
|
+
margin-right: ${spacing([2.5])};
|
|
1413
1423
|
border-right: 1px solid ${normal};
|
|
1414
1424
|
span {
|
|
1415
1425
|
${cursorPointer};
|
|
1416
|
-
margin-right:
|
|
1426
|
+
margin-right: ${spacing([2.5])};
|
|
1417
1427
|
color: ${rest};
|
|
1418
1428
|
&:hover {
|
|
1419
1429
|
color: ${active};
|
|
@@ -1453,26 +1463,23 @@ const AttachmentHeaderIconCSS = css`
|
|
|
1453
1463
|
const AttachmentInputCSS = css`
|
|
1454
1464
|
${displayNone};
|
|
1455
1465
|
${positionAbsolute};
|
|
1456
|
-
|
|
1457
|
-
height: 100%;
|
|
1466
|
+
${parseWidthHeight('100%', '100%')};
|
|
1458
1467
|
top: 0;
|
|
1459
1468
|
left: 0;
|
|
1460
1469
|
z-index: 4;
|
|
1461
1470
|
input {
|
|
1462
1471
|
${positionRelative};
|
|
1472
|
+
${parseWidthHeight('100%', 'calc(100% + 20px)')};
|
|
1463
1473
|
opacity: 0;
|
|
1464
|
-
top: -
|
|
1474
|
+
top: ${spacing([-5])};
|
|
1465
1475
|
font-size: 0px;
|
|
1466
|
-
width: 100%;
|
|
1467
|
-
height: calc(100% + 20px);
|
|
1468
1476
|
}
|
|
1469
1477
|
`;
|
|
1470
1478
|
const AttachmentImageCenterCSS = css`
|
|
1471
1479
|
${flexRow};
|
|
1472
1480
|
${justifyCenter};
|
|
1473
1481
|
${alignCenter};
|
|
1474
|
-
|
|
1475
|
-
height: 100%;
|
|
1482
|
+
${parseWidthHeight('100%', '100%')};
|
|
1476
1483
|
`;
|
|
1477
1484
|
const AttachmentImageContentCSS = css`
|
|
1478
1485
|
${textCenter};
|
|
@@ -1502,8 +1509,7 @@ const AttachmentImageCSS = css`
|
|
|
1502
1509
|
margin-right: 10px;
|
|
1503
1510
|
&.hint-center {
|
|
1504
1511
|
${positionAbsolute};
|
|
1505
|
-
|
|
1506
|
-
height: 100%;
|
|
1512
|
+
${parseWidthHeight('100%', '100%')};
|
|
1507
1513
|
top: 0;
|
|
1508
1514
|
left: 0;
|
|
1509
1515
|
margin-right: 0;
|
|
@@ -1534,8 +1540,7 @@ const AttachedItemInfoCSS = css`
|
|
|
1534
1540
|
${alignCenter};
|
|
1535
1541
|
${borderRadius4px};
|
|
1536
1542
|
${userSelectNone};
|
|
1537
|
-
|
|
1538
|
-
margin-right: 10px;
|
|
1543
|
+
margin-right: ${spacing([2])};
|
|
1539
1544
|
min-width: calc(50% - 10px);
|
|
1540
1545
|
`;
|
|
1541
1546
|
const AttachedItemInfoIconCSS = css`
|
|
@@ -1544,15 +1549,14 @@ const AttachedItemInfoIconCSS = css`
|
|
|
1544
1549
|
${cursorPointer};
|
|
1545
1550
|
max-height: 16px;
|
|
1546
1551
|
max-width: 14px;
|
|
1547
|
-
padding:
|
|
1552
|
+
padding: ${spacing([1, 1.25])};
|
|
1548
1553
|
box-sizing: content-box;
|
|
1549
1554
|
&.new-file:after {
|
|
1550
1555
|
content: '';
|
|
1551
1556
|
${positionAbsolute};
|
|
1557
|
+
${parseWidthHeight(4, 4)}
|
|
1552
1558
|
top: 4.5px;
|
|
1553
1559
|
left: -2px;
|
|
1554
|
-
width: 4px;
|
|
1555
|
-
height: 4px;
|
|
1556
1560
|
border-radius: 50%;
|
|
1557
1561
|
background: ${success};
|
|
1558
1562
|
}
|
|
@@ -1562,8 +1566,8 @@ const AttachedItemInfoNameCSS = css`
|
|
|
1562
1566
|
${cursorPointer};
|
|
1563
1567
|
${ellipsis};
|
|
1564
1568
|
color: ${dark};
|
|
1565
|
-
margin-left:
|
|
1566
|
-
padding-top:
|
|
1569
|
+
margin-left: ${spacing([3])};
|
|
1570
|
+
padding-top: ${spacing([0.25])};
|
|
1567
1571
|
box-sizing: content-box;
|
|
1568
1572
|
`;
|
|
1569
1573
|
const AttachedItemOwnerCSS = css`
|
|
@@ -1600,10 +1604,9 @@ const AttachedLinearCSS = css`
|
|
|
1600
1604
|
${flexRow};
|
|
1601
1605
|
${positionAbsolute};
|
|
1602
1606
|
${alignCenter};
|
|
1603
|
-
|
|
1607
|
+
${parseWidthHeight('100%', '100%')};
|
|
1604
1608
|
top: 0;
|
|
1605
|
-
background:
|
|
1606
|
-
height: 100%;
|
|
1609
|
+
background: ${white};
|
|
1607
1610
|
`;
|
|
1608
1611
|
const AttachedItemCSS = css`
|
|
1609
1612
|
${flexRow};
|
|
@@ -1619,13 +1622,13 @@ const AttachedCSS = css`
|
|
|
1619
1622
|
${positionRelative};
|
|
1620
1623
|
height: 100%;
|
|
1621
1624
|
max-height: 152px;
|
|
1622
|
-
margin-left:
|
|
1623
|
-
margin-right:
|
|
1625
|
+
margin-left: ${spacing([2])};
|
|
1626
|
+
margin-right: ${spacing([2])};
|
|
1624
1627
|
z-index: 1;
|
|
1625
1628
|
overflow-y: visible;
|
|
1626
1629
|
.attachment-row {
|
|
1627
1630
|
${displayBlock};
|
|
1628
|
-
margin-bottom:
|
|
1631
|
+
margin-bottom: ${spacing([2])};
|
|
1629
1632
|
&:last-child {
|
|
1630
1633
|
margin-bottom: 0;
|
|
1631
1634
|
}
|
|
@@ -1644,7 +1647,7 @@ const AttachedCSS = css`
|
|
|
1644
1647
|
max-width: calc(100% - 26px);
|
|
1645
1648
|
.attachment-row {
|
|
1646
1649
|
${positionRelative};
|
|
1647
|
-
margin-left:
|
|
1650
|
+
margin-left: ${spacing([4])};
|
|
1648
1651
|
overflow-y: visible;
|
|
1649
1652
|
}
|
|
1650
1653
|
.css-${AttachedItemCSS.name} {
|
|
@@ -1670,18 +1673,17 @@ const AttachedCSS = css`
|
|
|
1670
1673
|
margin: 4px auto 2px;
|
|
1671
1674
|
padding: 0;
|
|
1672
1675
|
&.new-file:after {
|
|
1676
|
+
${parseWidthHeight(8, 8)};
|
|
1673
1677
|
top: -1px;
|
|
1674
1678
|
left: -7px;
|
|
1675
|
-
width: 8px;
|
|
1676
|
-
height: 8px;
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1679
1681
|
.css-${AttachedItemInfoNameCSS.name} {
|
|
1680
1682
|
${paragraph3};
|
|
1681
1683
|
${textCenter};
|
|
1682
|
-
|
|
1684
|
+
${breakWord};
|
|
1685
|
+
margin: ${spacing([0, 2])};
|
|
1683
1686
|
display: -webkit-box;
|
|
1684
|
-
word-break: break-word;
|
|
1685
1687
|
max-width: 100%;
|
|
1686
1688
|
white-space: pre-wrap;
|
|
1687
1689
|
-webkit-line-clamp: 2;
|
|
@@ -1716,7 +1718,7 @@ const AttachmentRootCSS = css`
|
|
|
1716
1718
|
${borderRadius4px};
|
|
1717
1719
|
${border(1, normal)};
|
|
1718
1720
|
min-height: 165px;
|
|
1719
|
-
padding-bottom:
|
|
1721
|
+
padding-bottom: ${spacing([5])};
|
|
1720
1722
|
background-color: ${white};
|
|
1721
1723
|
&:hover:not(.disabled) {
|
|
1722
1724
|
.css-${AttachmentImageIconCSS.name} {
|
|
@@ -1762,19 +1764,22 @@ const AttachmentRootCSS = css`
|
|
|
1762
1764
|
}
|
|
1763
1765
|
`;
|
|
1764
1766
|
Attachment.defaultProps = {
|
|
1767
|
+
allowSort: true,
|
|
1768
|
+
className: '',
|
|
1769
|
+
data: [],
|
|
1765
1770
|
deleteNotifyText: getGlobal('deleteNotifyText'),
|
|
1766
|
-
|
|
1767
|
-
label: getGlobal('attachText'),
|
|
1771
|
+
disabled: false,
|
|
1768
1772
|
hintText: getGlobal('dropFileHere'),
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
allowSort: true,
|
|
1773
|
+
label: getGlobal('attachText'),
|
|
1774
|
+
maxFile: Infinity,
|
|
1772
1775
|
multiple: true,
|
|
1773
|
-
disabled: false,
|
|
1774
1776
|
readOnly: false,
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1777
|
+
uploadErrorInfo: {
|
|
1778
|
+
maxFile: getGlobal(['errorDefault', 'maxFile']),
|
|
1779
|
+
maxSize: getGlobal(['errorDefault', 'maxSize']),
|
|
1780
|
+
fileType: getGlobal(['errorDefault', 'fileType']),
|
|
1781
|
+
existingFile: getGlobal(['errorDefault', 'existingFile'])
|
|
1782
|
+
}
|
|
1778
1783
|
};
|
|
1779
1784
|
Attachment.propTypes = {
|
|
1780
1785
|
/** File types that can be accepted. */
|
|
@@ -1786,17 +1791,17 @@ Attachment.propTypes = {
|
|
|
1786
1791
|
/** Class for component. */
|
|
1787
1792
|
className: PropTypes.string,
|
|
1788
1793
|
|
|
1789
|
-
/** List attachment:<br />
|
|
1790
|
-
* [{<br />
|
|
1791
|
-
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1792
|
-
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
|
|
1793
|
-
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1794
|
-
* "FileSize": 248837,<br />
|
|
1795
|
-
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1796
|
-
* "CreateUserID": "LEMONADMIN",<br />
|
|
1797
|
-
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1798
|
-
* "UserName": "Quản trị hệ thống"<br />
|
|
1799
|
-
* }, ...]
|
|
1794
|
+
/** List attachment:<br />
|
|
1795
|
+
* [{<br />
|
|
1796
|
+
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1797
|
+
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
|
|
1798
|
+
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1799
|
+
* "FileSize": 248837,<br />
|
|
1800
|
+
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1801
|
+
* "CreateUserID": "LEMONADMIN",<br />
|
|
1802
|
+
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1803
|
+
* "UserName": "Quản trị hệ thống"<br />
|
|
1804
|
+
* }, ...]
|
|
1800
1805
|
*/
|
|
1801
1806
|
data: PropTypes.array,
|
|
1802
1807
|
|
|
@@ -1839,16 +1844,16 @@ Attachment.propTypes = {
|
|
|
1839
1844
|
/** Download attached event, if not it will use default. */
|
|
1840
1845
|
onDownload: PropTypes.func,
|
|
1841
1846
|
|
|
1842
|
-
/**
|
|
1843
|
-
* event when removed file(s)
|
|
1844
|
-
*
|
|
1845
|
-
* return data: {<br/>
|
|
1846
|
-
* attached: [Files] (insist old and all new files )<br/>
|
|
1847
|
-
* allNewAttached: [Files]<br/>
|
|
1848
|
-
* oldAttached: [Files]<br/>
|
|
1849
|
-
* removedAttached: [Files]<br/>
|
|
1850
|
-
* element: [NodeList (just removed)]<br/>
|
|
1851
|
-
* }
|
|
1847
|
+
/**
|
|
1848
|
+
* event when removed file(s)
|
|
1849
|
+
*
|
|
1850
|
+
* return data: {<br/>
|
|
1851
|
+
* attached: [Files] (insist old and all new files )<br/>
|
|
1852
|
+
* allNewAttached: [Files]<br/>
|
|
1853
|
+
* oldAttached: [Files]<br/>
|
|
1854
|
+
* removedAttached: [Files]<br/>
|
|
1855
|
+
* element: [NodeList (just removed)]<br/>
|
|
1856
|
+
* }
|
|
1852
1857
|
*/
|
|
1853
1858
|
onRemove: PropTypes.func,
|
|
1854
1859
|
|
|
@@ -541,8 +541,10 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
541
541
|
width: 'none'
|
|
542
542
|
}
|
|
543
543
|
}, jsx(InputBase, {
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
inputProps: {
|
|
545
|
+
placeholder: !readOnly && !disabled ? placeholder : '',
|
|
546
|
+
...inputProps
|
|
547
|
+
},
|
|
546
548
|
ref: ipConRef,
|
|
547
549
|
inputRef: ipRef,
|
|
548
550
|
disabled: disabled,
|