diginet-core-ui 1.3.56 → 1.3.57

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.
@@ -5,14 +5,47 @@ import { memo, useMemo, useEffect, useState, useRef, forwardRef, useImperativeHa
5
5
  import PropTypes from 'prop-types';
6
6
  import ReactDOM from 'react-dom';
7
7
  import { jsx, css } from '@emotion/core';
8
- import { color as colors } from '../../../styles/colors';
9
- import { typography } from '../../../styles/typography';
10
- import { ModalSample, Popup, Popover, List, ListItem, ListItemText, Slider, SliderItem, ScrollBar, LinearProgress, ButtonIcon } from '../../';
11
- import { Pdf, Word, Sheet, Presentation, Compressed, Image, Another, Info, View, Download, Delete, Attachment as AttachmentIcon } from '../../../icons';
8
+ import { ModalSample, Popup, Popover, List, ListItem, ListItemText, Slider, SliderItem, ScrollBar, LinearProgress, ButtonIcon, Notify } from '../../';
9
+ import { Pdf, Word, Sheet, Presentation, Compressed, Image, Another, View, Download, Delete, Attachment as AttachmentIcon } from '../../../icons';
12
10
  import { date as moment, getFileType } from '../../../utils';
13
11
  import { getGlobal } from '../../../global';
14
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';
15
14
  const theme = useTheme();
15
+ const {
16
+ colors: {
17
+ system: {
18
+ active,
19
+ rest,
20
+ white,
21
+ dark
22
+ },
23
+ semantic: {
24
+ success,
25
+ danger
26
+ },
27
+ fill: {
28
+ hover: fillHover,
29
+ pressed,
30
+ focus
31
+ },
32
+ line: {
33
+ normal,
34
+ hover: lineHover
35
+ },
36
+ text: {
37
+ sub
38
+ }
39
+ },
40
+ typography: {
41
+ heading5,
42
+ paragraph1,
43
+ paragraph2,
44
+ paragraph3
45
+ },
46
+ spacing // zIndex: zIndexCORE,
47
+
48
+ } = theme;
16
49
  const useStyles = makeStyles({
17
50
  listItem: {
18
51
  '&.DGN-UI-List-Item': {
@@ -41,7 +74,6 @@ const useStyles = makeStyles({
41
74
  }
42
75
  }
43
76
  });
44
- const classes = useStyles();
45
77
  const icons = {
46
78
  pdf: jsx(Pdf, {
47
79
  width: '100%',
@@ -81,38 +113,6 @@ let prevent = false;
81
113
  let existClickOutOfItem = false;
82
114
  let maxSize = Infinity;
83
115
  let divideSize = null;
84
- const errorDefault = getGlobal('errorDefault');
85
- const {
86
- heading5,
87
- paragraph1,
88
- paragraph2,
89
- paragraph3
90
- } = typography;
91
- const {
92
- system: {
93
- active,
94
- rest,
95
- white,
96
- dark
97
- },
98
- semantic: {
99
- success,
100
- danger,
101
- info
102
- },
103
- fill: {
104
- hover: fillHover,
105
- pressed,
106
- focus
107
- },
108
- line: {
109
- normal,
110
- hover: lineHover
111
- },
112
- text: {
113
- sub
114
- }
115
- } = colors;
116
116
  const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
117
117
  viewType,
118
118
  label,
@@ -127,7 +127,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
127
127
  onView: onViewItem,
128
128
  onDownload: onDownloadItem,
129
129
  onChange,
130
- onUploadError,
131
130
  data,
132
131
  maxFile,
133
132
  maxSize: maxSizeProp,
@@ -137,15 +136,13 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
137
136
  domain,
138
137
  isStripDomain,
139
138
  style,
140
- inputStyle,
141
139
  inputProps,
142
- refs,
143
140
  required,
144
141
  error,
145
- errorStyle,
146
142
  readOnly,
147
- ...props
143
+ id
148
144
  }, reference) => {
145
+ const classes = useStyles();
149
146
  const ref = useRef(null);
150
147
  const [open, setOpen] = useState(false);
151
148
  const [popup, setPopup] = useState(false);
@@ -162,450 +159,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
162
159
  const popupRef = useRef(null);
163
160
  const popoverRef = useRef(null);
164
161
  const isDeleteAll = useRef(false);
165
- const ViewAttachType = css`
166
- cursor: pointer;
167
- height: 24px;
168
- color: ${rest};
169
- &:hover {
170
- color: ${active};
171
- }
172
- `;
173
- const attachmentHandleIcon = css`
174
- display: none;
175
- height: 24px;
176
- margin-right: 10px;
177
- border-right: 1px solid ${normal};
178
- span {
179
- margin-right: 10px;
180
- color: ${rest};
181
- cursor: pointer;
182
- &:hover {
183
- color: ${active};
184
- }
185
- }
186
- `;
187
- const AttachmentHeader = css`
188
- /* position: relative; */
189
- height: 48px;
190
- display: flex;
191
- padding: 16px 24px;
192
- align-items: center;
193
- /* margin-bottom: 10px; */
194
- box-sizing: border-box;
195
- justify-content: space-between;
196
- .css-${attachmentHandleIcon.name}, .css-${ViewAttachType.name} {
197
- z-index: 1;
198
- }
199
- `;
200
- const AttachmentInfo = css`
201
- display: flex;
202
- position: relative;
203
- align-items: center;
204
- margin: 0;
205
- & + p.attachment-error {
206
- color: ${danger};
207
- }
208
- span {
209
- display: none;
210
- color: ${danger};
211
- margin: 10px;
212
- cursor: help;
213
- opacity: 0;
214
- ${paragraph1};
215
- span {
216
- display: block;
217
- position: absolute;
218
- opacity: 1;
219
- transform: scaleX(0) translateY(-50%);
220
- left: 80px;
221
- z-index: 4;
222
- width: max-content;
223
- height: max-content;
224
- max-height: 72px;
225
- overflow: auto;
226
- border: 1px solid ${danger};
227
- border-radius: 4px;
228
- padding: 5px 8px;
229
- transition: transform 0.3s linear 0.3s;
230
- transform-origin: left;
231
- &::-webkit-scrollbar {
232
- width: 4px;
233
- background-color: white !important;
234
- border-radius: 4px;
235
- }
236
- &::-webkit-scrollbar-thumb {
237
- border-radius: 10px;
238
- mix-blend-mode: normal;
239
- background-color: ${danger} !important;
240
- background-clip: content-box;
241
- }
242
- ul {
243
- display: contents;
244
- li {
245
- list-style: none;
246
- }
247
- }
248
- }
249
- &:hover {
250
- span {
251
- transform: scaleX(1) translateY(-50%);
252
- transition-delay: 0s;
253
- }
254
- }
255
- }
256
- `;
257
- const AttachmentText = css`
258
- ${heading5};
259
- text-transform: uppercase;
260
- color: ${sub};
261
- user-select: none;
262
- `;
263
- const AttachmentHeaderIcon = css`
264
- display: flex;
265
- align-items: center;
266
- `;
267
- const AttachmentInput = css`
268
- position: absolute;
269
- width: 100%;
270
- height: 100%;
271
- top: 0;
272
- left: 0;
273
- z-index: 4;
274
- display: none;
275
- input {
276
- position: relative;
277
- opacity: 0;
278
- top: -20px;
279
- font-size: 0px;
280
- width: 100%;
281
- height: calc(100% + 20px);
282
- }
283
- `;
284
- const AttachmentImageCenter = css`
285
- width: 100%;
286
- height: 100%;
287
- display: flex;
288
- justify-content: center;
289
- align-items: center;
290
- `;
291
- const AttachmentImageContent = css`
292
- display: grid;
293
- text-align: center;
294
- `;
295
- const AttachmentImageIcon = css`
296
- margin-bottom: 0;
297
- z-index: 3;
298
- width: 24px;
299
- height: 24px;
300
- svg {
301
- color: ${rest};
302
- }
303
- &:hover {
304
- border-color: ${lineHover};
305
- svg {
306
- color: ${active};
307
- }
308
- }
309
- `;
310
- const AttachmentImageText = css`
311
- display: none;
312
- ${paragraph3};
313
- color: ${rest};
314
- user-select: none;
315
- `;
316
- const AttachmentImage = css`
317
- margin-right: 10px;
318
- &.hint-center {
319
- position: absolute;
320
- width: 100%;
321
- height: 100%;
322
- top: 0;
323
- left: 0;
324
- margin-right: 0;
325
- z-index: 1;
326
- .css-${AttachmentImageText.name} {
327
- display: block;
328
- }
329
- .css-${AttachmentImageIcon.name} {
330
- display: flex;
331
- align-items: center;
332
- justify-content: center;
333
- width: 64px;
334
- height: 64px;
335
- margin: 0 auto 8px auto;
336
- border: 1px dashed ${normal};
337
- border-radius: 50%;
338
- svg {
339
- width: 40px;
340
- height: 40px;
341
- }
342
- &:hover {
343
- border-color: ${lineHover};
344
- background-color: ${fillHover};
345
- }
346
- }
347
- }
348
- `;
349
- const AttachedItemInfo = css`
350
- /* width: 40%; */
351
- /* max-width: 350px; */
352
- border-radius: 4px;
353
- min-width: 104px;
354
- display: flex;
355
- align-items: center;
356
- user-select: none;
357
- margin-right: 10px;
358
- min-width: calc(50% - 10px);
359
- `;
360
- const AttachedItemInfoIcon = css`
361
- display: flex;
362
- position: relative;
363
- max-height: 16px;
364
- max-width: 14px;
365
- padding: 4px 5px;
366
- cursor: pointer;
367
- box-sizing: content-box;
368
- &.new-file:after {
369
- content: '';
370
- position: absolute;
371
- top: 4.5px;
372
- left: -2px;
373
- width: 4px;
374
- height: 4px;
375
- border-radius: 50%;
376
- background: ${success};
377
- }
378
- `;
379
- const AttachedItemInfoName = css`
380
- ${paragraph1};
381
- color: ${dark};
382
- margin-left: 12px;
383
- padding-top: 1px;
384
- cursor: pointer;
385
- overflow: hidden;
386
- white-space: nowrap;
387
- text-overflow: ellipsis;
388
- box-sizing: content-box;
389
- `;
390
- const AttachedItemOwner = css`
391
- display: flex;
392
- position: relative;
393
- /* max-width: 50%; */
394
- height: 100%;
395
- align-items: center;
396
- ${paragraph2};
397
- color: ${sub};
398
- cursor: pointer;
399
- user-select: none;
400
- .detail-info {
401
- display: flex;
402
- min-width: 333px;
403
- .username {
404
- display: inline-block;
405
- /* width: 35%; */
406
- min-width: 120px;
407
- max-width: 120px;
408
- overflow: hidden;
409
- white-space: nowrap;
410
- text-overflow: ellipsis;
411
- }
412
- .datetime {
413
- display: inline-block;
414
- /* width: 45%; */
415
- min-width: max-content;
416
- max-width: max-content;
417
- }
418
- .filesize {
419
- /* width: 20%; */
420
- float: right;
421
- text-align: right;
422
- margin-left: auto;
423
- }
424
- }
425
- `;
426
- const AttachedLinear = css`
427
- position: absolute;
428
- width: 100%;
429
- top: 0;
430
- background: #fff;
431
- height: 100%;
432
- display: flex;
433
- align-items: center;
434
- `;
435
- const AttachedItem = css`
436
- height: 24px;
437
- display: flex;
438
- justify-content: space-between;
439
- align-items: center;
440
- padding: 0 8px;
441
- position: relative;
442
- transition: padding 0.5s ease;
443
- border-radius: 4px;
444
- `;
445
- const Attached = css`
446
- position: relative;
447
- /* width: calc(100% - 10px); */
448
- height: 100%;
449
- max-height: 152px;
450
- margin-left: 8px;
451
- margin-right: 8px;
452
- /* scroll-snap-type: mandatory;
453
- scroll-snap-type: y mandatory;
454
- scroll-snap-points-y: repeat(16px); */
455
- z-index: 1;
456
- /* transition: margin 0.5s ease; */
457
- overflow-y: visible;
458
- .attachment-row {
459
- display: block;
460
- margin-bottom: 8px;
461
- /* scroll-snap-align: start; */
462
- &:last-child {
463
- margin-bottom: 0;
464
- }
465
- /* overflow-y: hidden; */
466
- }
467
- &.icon-view {
468
- display: flex;
469
- flex-wrap: wrap;
470
- justify-content: space-between;
471
- &::after {
472
- content: '';
473
- flex: auto;
474
- }
475
- /* grid-template-columns: repeat(auto-fill, minmax(136px, auto)); */
476
- max-height: 200px;
477
- margin-left: 0;
478
- /* padding-left: 10px; */
479
- /* padding-right: 10px; */
480
- width: max-content;
481
- max-width: calc(100% - 26px);
482
- .attachment-row {
483
- position: relative;
484
- margin-left: 16px;
485
- overflow-y: visible;
486
- }
487
- .css-${AttachedItem.name} {
488
- display: block;
489
- height: 80px;
490
- width: 80px;
491
- padding: 0;
492
- position: initial;
493
- .css-${AttachedItemInfo.name} {
494
- position: relative;
495
- display: block;
496
- width: max-content;
497
- text-align: center;
498
- max-width: 80px;
499
- overflow: hidden;
500
- white-space: nowrap;
501
- text-overflow: ellipsis;
502
- margin-left: auto;
503
- margin-right: auto;
504
- min-width: 70px;
505
- .css-${AttachedItemInfoIcon.name} {
506
- height: 40px;
507
- width: 40px;
508
- max-height: 40px;
509
- max-width: 40px;
510
- margin: 4px auto 2px;
511
- padding: 0;
512
- display: block;
513
- &.new-file:after {
514
- top: -1px;
515
- left: -7px;
516
- width: 8px;
517
- height: 8px;
518
- }
519
- }
520
- .css-${AttachedItemInfoName.name} {
521
- ${paragraph3};
522
- margin: 0 8px;
523
- display: -webkit-box;
524
- word-break: break-word;
525
- max-width: 100%;
526
- white-space: pre-wrap;
527
- -webkit-line-clamp: 2;
528
- -webkit-box-orient: vertical;
529
- text-align: center;
530
- }
531
- }
532
- .css-${AttachedItemOwner.name} {
533
- position: inherit;
534
- height: auto;
535
- ${paragraph3};
536
- .detail-info {
537
- display: none;
538
- }
539
- .css-${AttachedLinear.name} {
540
- /* position: initial; */
541
- /* width: 100%; */
542
- height: auto;
543
- bottom: 0;
544
- top: unset;
545
- background: none;
546
- }
547
- }
548
- }
549
- }
550
- &:not(.icon-view) {
551
- min-width: 684px;
552
- }
553
- `;
554
- const AttachmentRoot = css`
555
- border: 1px solid ${normal};
556
- display: block;
557
- position: relative;
558
- flex-wrap: wrap;
559
- min-height: 165px;
560
- flex-direction: column;
561
- padding-bottom: 20px;
562
- justify-content: start;
563
- background-color: ${white};
564
- border-radius: 4px;
565
- &:hover:not(.disabled) {
566
- .css-${AttachmentImageIcon.name} {
567
- cursor: pointer;
568
- }
569
- }
570
- .css-${Attached.name} {
571
- &:not(.disabled) {
572
- .css-${AttachedItem.name} {
573
- &:hover {
574
- background-color: ${fillHover};
575
- .css-${AttachedLinear.name} {
576
- background-color: ${fillHover};
577
- }
578
- }
579
- &:active {
580
- background-color: ${pressed};
581
- .css-${AttachedLinear.name} {
582
- background-color: ${pressed};
583
- }
584
- }
585
- &.chosen {
586
- background-color: ${focus};
587
- .css-${AttachedItemInfo.name}, .css-${AttachedItemOwner.name} {
588
- background-color: ${focus};
589
- }
590
- }
591
- }
592
- }
593
- }
594
- &.disabled {
595
- .css-${AttachedItem.name} {
596
- pointer-events: none;
597
- }
598
- }
599
- @media (max-width: 716px) {
600
- .css-${Attached.name}:not(.icon-view) {
601
- min-width: 575px;
602
- }
603
- .css-${AttachedItemInfo.name} {
604
- max-width: calc(40% - 10px);
605
- }
606
- }
607
- `; // End style
608
- // Start handler
162
+ const PushNotify = useRef(null); // Start handler
609
163
 
610
164
  const onShowSortPopover = () => {
611
165
  setPopover(true);
@@ -676,18 +230,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
676
230
  attachedList.forEach(el => {
677
231
  attachedRef.current.appendChild(el);
678
232
  });
679
- };
680
-
681
- const onChangeViewAttachType = (e, viewAttachType2) => {
682
- const type = viewAttachType2 || viewTypeState;
683
-
684
- if (type === 'detail') {
685
- setViewTypeState('icon');
686
- attachedRef.current.classList.add('icon-view');
687
- } else {
688
- setViewTypeState('detail');
689
- attachedRef.current.classList.remove('icon-view');
690
- }
233
+ setPopover(false);
691
234
  };
692
235
 
693
236
  const afterChangeFile = (length = 0) => {
@@ -708,59 +251,31 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
708
251
  }
709
252
  };
710
253
 
711
- const setError = (errorList, type) => {
712
- if (errorList[type]) {
713
- errorList[type]++;
714
- } else {
715
- errorList[type] = 1;
716
- }
717
- };
718
-
719
- const notifyError = errorList => {
720
- const errorInfoIcon = attachTextRef.current.parentNode.childNodes[1];
721
-
722
- if (JSON.stringify(errorList) !== '{}') {
723
- if (!errorInfoIcon.style.opacity) {
724
- errorInfoIcon.style.opacity = 1;
725
- errorInfoIcon.style.display = 'flex';
726
- } else if (errorInfoIcon.style.color === 'rgb(0, 149, 255)') {
727
- errorInfoIcon.style.color = danger;
728
- }
729
-
730
- if (onUploadError) {
731
- onUploadError(errorList);
732
- }
733
-
734
- Object.keys(errorList).forEach(key => {
735
- const quantity = `${errorList[key]} file${errorList[key] > 1 ? 's' : ''}`;
736
- const error = uploadErrorInfo[key] ? `${uploadErrorInfo[key]} (${quantity})` : quantity + errorDefault[key];
737
- const el = document.createElement('li');
738
- el.innerHTML = error;
739
- attachTextRef.current.parentNode.querySelector('ul').insertAdjacentElement('afterBegin', el);
740
- });
741
- } else if (errorInfoIcon.style.opacity === '1') {
742
- errorInfoIcon.style.color = info;
743
- }
744
- };
745
-
746
254
  const onChangeFiles = async e => {
747
255
  if (readOnly || disabled) return;
748
256
 
749
257
  if (e.target && e.target.files && e.target.files.length) {
750
258
  let files = e.target.files;
751
- const errorList = {};
752
259
  const lengthAttached = attached.length;
753
260
 
754
261
  for (let i = 0; i < files.length; i++) {
755
262
  if (i + 1 > maxFile - lengthAttached || files[i].size > maxSize || checkExistingFile(files[i]) || !checkAcceptFileType(files[i])) {
756
263
  if (i + 1 > maxFile - lengthAttached) {
757
- setError(errorList, 'maxFile');
264
+ var _files$i;
265
+
266
+ PushNotify.current(`${(_files$i = files[i]) === null || _files$i === void 0 ? void 0 : _files$i.name} - ${uploadErrorInfo['maxFile']}`);
758
267
  } else if (files[i].size > maxSize) {
759
- setError(errorList, 'maxSize');
268
+ var _files$i2;
269
+
270
+ PushNotify.current(`${(_files$i2 = files[i]) === null || _files$i2 === void 0 ? void 0 : _files$i2.name} - ${uploadErrorInfo['maxSize']}`);
760
271
  } else if (!checkAcceptFileType(files[i])) {
761
- setError(errorList, 'fileType');
272
+ var _files$i3;
273
+
274
+ PushNotify.current(`${(_files$i3 = files[i]) === null || _files$i3 === void 0 ? void 0 : _files$i3.name} - ${uploadErrorInfo['fileType']}`);
762
275
  } else {
763
- setError(errorList, 'existingFile');
276
+ var _files$i4;
277
+
278
+ PushNotify.current(`${(_files$i4 = files[i]) === null || _files$i4 === void 0 ? void 0 : _files$i4.name} - ${uploadErrorInfo['existingFile']}`);
764
279
  }
765
280
 
766
281
  files = removeFileOutInputFiles(i, true);
@@ -768,7 +283,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
768
283
  }
769
284
  }
770
285
 
771
- notifyError(errorList);
772
286
  const length = files.length;
773
287
 
774
288
  if (!lengthAttached && !length) {
@@ -822,16 +336,16 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
822
336
 
823
337
  reader.onloadstart = () => {
824
338
  // console.log(attachedRef.current.querySelector(`.css-${AttachedLinear.name}-attached`).parentNode.parentNode.querySelector('.filesize').offsetWidth);
825
- attachedRef.current.querySelector(`.css-${AttachedLinear.name}-attached`).childNodes[0].style.width = '0%';
339
+ attachedRef.current.querySelector(`.css-${AttachedLinearCSS.name}-attached`).childNodes[0].style.width = '0%';
826
340
  };
827
341
 
828
342
  reader.onprogress = e => {
829
- attachedRef.current.querySelector(`.css-${AttachedLinear.name}-attached`).childNodes[0].style.width = e.loaded / e.total * 100 + '%';
343
+ attachedRef.current.querySelector(`.css-${AttachedLinearCSS.name}-attached`).childNodes[0].style.width = e.loaded / e.total * 100 + '%';
830
344
  };
831
345
 
832
346
  reader.onloadend = () => {
833
347
  setTimeout(() => {
834
- attachedRef.current.querySelector(`.css-${AttachedLinear.name}-attached`).parentNode.remove();
348
+ attachedRef.current.querySelector(`.css-${AttachedLinearCSS.name}-attached`).parentNode.remove();
835
349
  resolve(url);
836
350
  }, 200);
837
351
  };
@@ -878,14 +392,14 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
878
392
  data.CreateDate = date.toISOString();
879
393
  const fileType = getType(data);
880
394
  return jsx("div", {
881
- css: AttachedItem,
395
+ css: AttachedItemCSS,
882
396
  key: i,
883
397
  onClick: e => onChooseItem(e),
884
398
  onDoubleClick: e => onView(e.currentTarget.parentNode)
885
399
  }, jsx("span", {
886
- css: AttachedItemInfo
400
+ css: AttachedItemInfoCSS
887
401
  }, jsx("span", {
888
- css: AttachedItemInfoIcon,
402
+ css: AttachedItemInfoIconCSS,
889
403
  className: 'new-file'
890
404
  }, icons[fileType], jsx("span", {
891
405
  className: 'filetype',
@@ -893,10 +407,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
893
407
  display: 'none'
894
408
  }
895
409
  }, fileType)), jsx("span", {
896
- css: AttachedItemInfoName,
410
+ css: AttachedItemInfoNameCSS,
897
411
  className: 'filename'
898
412
  }, data.name)), jsx("span", {
899
- css: AttachedItemOwner
413
+ css: AttachedItemOwnerCSS
900
414
  }, jsx("span", {
901
415
  className: 'detail-info'
902
416
  }, jsx("span", {
@@ -906,9 +420,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
906
420
  }, getDateTime(date)), jsx("span", {
907
421
  className: 'filesize'
908
422
  }, calculateSize(data.size))), jsx("span", {
909
- css: AttachedLinear
423
+ css: AttachedLinearCSS
910
424
  }, jsx(LinearProgress, {
911
- className: `css-${AttachedLinear.name}-attached`,
425
+ className: `css-${AttachedLinearCSS.name}-attached`,
912
426
  determinate: true,
913
427
  percent: 0
914
428
  }))));
@@ -918,14 +432,14 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
918
432
  const date = new Date(data.CreateDate);
919
433
  const type = getType(data);
920
434
  return jsx("div", {
921
- css: AttachedItem,
435
+ css: AttachedItemCSS,
922
436
  key: i,
923
437
  onClick: e => onChooseItem(e),
924
438
  onDoubleClick: e => onView(e.currentTarget.parentNode, data.AttachmentID)
925
439
  }, jsx("span", {
926
- css: AttachedItemInfo
440
+ css: AttachedItemInfoCSS
927
441
  }, jsx("span", {
928
- css: AttachedItemInfoIcon,
442
+ css: AttachedItemInfoIconCSS,
929
443
  className: data.lastModifiedDate ? 'new-file' : ''
930
444
  }, icons[type], jsx("span", {
931
445
  className: 'filetype',
@@ -933,10 +447,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
933
447
  display: 'none'
934
448
  }
935
449
  }, type)), jsx("span", {
936
- css: AttachedItemInfoName,
450
+ css: AttachedItemInfoNameCSS,
937
451
  className: 'filename'
938
452
  }, data.FileName)), jsx("span", {
939
- css: AttachedItemOwner
453
+ css: AttachedItemOwnerCSS
940
454
  }, jsx("span", {
941
455
  className: 'detail-info'
942
456
  }, jsx("span", {
@@ -1084,13 +598,13 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1084
598
  onClosePopup();
1085
599
  };
1086
600
 
1087
- const clearAllAttached = () => {
601
+ const clearAllAttached = (confirmPopup = false) => {
1088
602
  const allAttachEl = attachedRef.current.querySelectorAll('.attachment-row');
1089
603
 
1090
604
  if (allAttachEl && allAttachEl.length) {
1091
605
  allAttachEl.forEach(attachEl => attachEl.firstChild.classList.add('chosen'));
1092
606
  isDeleteAll.current = true;
1093
- onShowPopup();
607
+ confirmPopup ? onShowPopup() : onRemoveMultiple();
1094
608
  }
1095
609
  };
1096
610
 
@@ -1246,7 +760,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1246
760
  }
1247
761
 
1248
762
  chosenItems.length = 0;
1249
- attachedRef.current.querySelectorAll(`.css-${AttachedItem.name}`).forEach((itemEl, indexEl) => {
763
+ attachedRef.current.querySelectorAll(`.css-${AttachedItemCSS.name}`).forEach((itemEl, indexEl) => {
1250
764
  if (startIndex <= indexEl && indexEl <= endIndex) {
1251
765
  if (!itemEl.classList.contains('chosen')) {
1252
766
  itemEl.classList.add('chosen');
@@ -1494,8 +1008,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1494
1008
  };
1495
1009
 
1496
1010
  useEffect(() => {
1497
- if (refs) refs(ref);
1498
-
1499
1011
  if (attached.length) {
1500
1012
  attached.length = 0;
1501
1013
  }
@@ -1505,15 +1017,13 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1505
1017
  };
1506
1018
  }, []);
1507
1019
  useEffect(() => {
1508
- attachTextRef.current.innerHTML = label + (required ? `<b style="color: ${theme.colors.danger}"> *</b>` : '');
1509
1020
  let el = null;
1510
1021
 
1511
1022
  if (error) {
1512
1023
  attachTextRef.current.style.color = danger;
1513
- ref.current.style.borderColor = errorStyle && errorStyle.borderColor || danger;
1024
+ ref.current.style.borderColor = danger;
1514
1025
  el = document.createElement('p');
1515
1026
  el.classList.add('attachment-error');
1516
- Object.assign(el.style, errorStyle);
1517
1027
  el.innerHTML = error;
1518
1028
  attachTextRef.current.parentNode.insertAdjacentElement('afterEnd', el);
1519
1029
  }
@@ -1528,9 +1038,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1528
1038
  el.remove();
1529
1039
  }
1530
1040
  };
1531
- }, [required, error]);
1041
+ }, [error]);
1532
1042
  useEffect(() => {
1533
- onChangeViewAttachType(null, viewType === 'icon' ? 'detail' : 'icon');
1043
+ setViewTypeState(viewType);
1534
1044
  }, [viewType]);
1535
1045
  useEffect(() => {
1536
1046
  switch (true) {
@@ -1648,15 +1158,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1648
1158
  };
1649
1159
  }
1650
1160
  }, [inputProps]);
1651
- useEffect(() => {
1652
- if (disabled) {
1653
- ref.current.classList.add('disabled');
1654
- } else if (ref.current.classList.contains('disabled')) {
1655
- ref.current.classList.remove('disabled');
1656
- }
1657
-
1658
- attachmentInputRef.current.disabled = disabled || inputProps && inputProps.disabled;
1659
- }, [disabled]);
1660
1161
  useEffect(() => {
1661
1162
  if (maxSizeProp) {
1662
1163
  if (!isNaN(maxSizeProp)) {
@@ -1700,20 +1201,21 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1700
1201
 
1701
1202
 
1702
1203
  const AttachHeaderView = useMemo(() => jsx("div", {
1703
- css: AttachmentHeader
1204
+ css: AttachmentHeaderCSS,
1205
+ className: 'DGN-UI-Attachment-Header'
1704
1206
  }, jsx("div", {
1705
- css: AttachmentInfo
1207
+ css: AttachmentInfoCSS
1706
1208
  }, jsx("p", {
1707
- css: AttachmentText,
1209
+ css: AttachmentTextCSS,
1708
1210
  ref: attachTextRef
1709
- }), jsx("span", null, jsx(Info, {
1710
- width: '18',
1711
- height: '18',
1712
- bgColor: 'currentColor'
1713
- }), jsx("span", null, ' ', jsx("ul", null, " "), ' '))), jsx("div", {
1714
- css: AttachmentHeaderIcon
1211
+ }, label, required && jsx("span", {
1212
+ style: {
1213
+ color: danger
1214
+ }
1215
+ }, " *"))), jsx("div", {
1216
+ css: AttachmentHeaderIconCSS
1715
1217
  }, jsx("div", {
1716
- css: attachmentHandleIcon,
1218
+ css: AttachmentHandleIconCSS,
1717
1219
  ref: attachmentHandleIconRef
1718
1220
  }, jsx("span", {
1719
1221
  className: 'view',
@@ -1734,22 +1236,22 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1734
1236
  color: 'currentColor',
1735
1237
  viewBox: true
1736
1238
  }))), jsx("div", {
1737
- css: AttachmentImage,
1239
+ css: AttachmentImageCSS,
1738
1240
  ref: attachmentImageRef
1739
1241
  }, !(readOnly || disabled) && jsx("div", {
1740
- css: AttachmentImageCenter
1242
+ css: AttachmentImageCenterCSS
1741
1243
  }, jsx("div", {
1742
- css: AttachmentImageContent
1244
+ css: AttachmentImageContentCSS
1743
1245
  }, jsx("span", {
1744
- css: AttachmentImageIcon,
1246
+ css: AttachmentImageIconCSS,
1745
1247
  ref: attachmentImageIconRef,
1746
1248
  onClick: triggerClickInput
1747
1249
  }, jsx(AttachmentIcon, {
1748
1250
  viewBox: true,
1749
1251
  color: 'currentColor'
1750
1252
  })), jsx("span", {
1751
- css: AttachmentImageText
1752
- }, hintText || getGlobal('dropFileHere'))))), allowSort && jsx(ButtonIcon, {
1253
+ css: AttachmentImageTextCSS
1254
+ }, hintText)))), allowSort && jsx(ButtonIcon, {
1753
1255
  viewType: 'ghost',
1754
1256
  name: 'Sort',
1755
1257
  ref: sortIconRef,
@@ -1761,19 +1263,21 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1761
1263
  }), jsx(ButtonIcon, {
1762
1264
  viewType: 'ghost',
1763
1265
  name: viewTypeState === 'detail' ? 'IconView' : 'ListView',
1764
- onClick: onChangeViewAttachType
1765
- }))), [allowSort, readOnly, viewTypeState]);
1266
+ onClick: () => setViewTypeState(viewTypeState === 'icon' ? 'detail' : 'icon')
1267
+ }))), [allowSort, disabled, readOnly, label, required, hintText, viewTypeState]);
1766
1268
  const AttachmentInputView = useMemo(() => jsx("div", {
1767
- css: AttachmentInput
1768
- }, jsx("input", { ...inputProps,
1269
+ css: AttachmentInputCSS,
1270
+ className: 'DGN-UI-Attachment-Input'
1271
+ }, jsx("input", {
1769
1272
  type: "file",
1770
1273
  ref: attachmentInputRef,
1771
1274
  title: "",
1772
- style: inputStyle,
1773
1275
  onDrop: onDropInput,
1774
- onDragLeave: onDropInput
1775
- })), [inputStyle]);
1276
+ onDragLeave: onDropInput,
1277
+ ...inputProps
1278
+ })), [inputProps]);
1776
1279
  const AttachedView = useMemo(() => jsx(ScrollBar, {
1280
+ className: 'DGN-UI-Attachment-List',
1777
1281
  style: {
1778
1282
  marginRight: 5,
1779
1283
  paddingTop: 0,
@@ -1782,9 +1286,10 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1782
1286
  overflowY: 'overlay'
1783
1287
  }
1784
1288
  }, jsx("div", {
1785
- css: Attached,
1786
- ref: attachedRef
1787
- })), []);
1289
+ css: AttachedCSS,
1290
+ ref: attachedRef,
1291
+ className: viewTypeState === 'icon' ? 'icon-view' : ''
1292
+ })), [viewTypeState]);
1788
1293
  const PopoverView = useMemo(() => {
1789
1294
  return jsx(Popover, {
1790
1295
  open: popover,
@@ -1835,7 +1340,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1835
1340
  onClose: onClosePopup,
1836
1341
  onConfirm: onRemoveMultiple,
1837
1342
  onCancel: onClosePopup
1838
- }), [popup]);
1343
+ }), [deleteNotifyText, popup]);
1839
1344
  const ModalView = useMemo(() => {
1840
1345
  if (!chosenItems.length) return setOpen(false);
1841
1346
  const index = chosenItems[0];
@@ -1852,26 +1357,415 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1852
1357
 
1853
1358
  useImperativeHandle(reference, () => {
1854
1359
  stripDomain();
1855
- ref.current.oldAttached = oldAttached;
1856
- ref.current.allNewAttached = allNewAttached;
1857
- ref.current.attached = attached;
1858
- ref.current.clear = clearAllAttached;
1859
- ref.current.openFileDialog = triggerClickInput;
1860
- return ref.current;
1360
+ const currentRef = ref.current || {};
1361
+ const _instance = {
1362
+ oldAttached: oldAttached,
1363
+ allNewAttached: allNewAttached,
1364
+ attached: attached,
1365
+ clear: confirmPopup => clearAllAttached(confirmPopup),
1366
+ openFileDialog: triggerClickInput
1367
+ }; // methods
1368
+
1369
+ _instance.__proto__ = {}; // hidden methods
1370
+
1371
+ currentRef.instance = _instance;
1372
+ currentRef.oldAttached = oldAttached;
1373
+ currentRef.allNewAttached = allNewAttached;
1374
+ currentRef.attached = attached;
1375
+
1376
+ currentRef.clear = confirmPopup => clearAllAttached(confirmPopup);
1377
+
1378
+ currentRef.openFileDialog = triggerClickInput;
1379
+ return currentRef;
1861
1380
  });
1862
- return jsx("div", { ...props,
1863
- css: AttachmentRoot,
1864
- className: ('DGN-UI-Attachment ' + className).trim(),
1865
- style: style,
1381
+ return jsx("div", {
1866
1382
  ref: ref,
1383
+ css: AttachmentRootCSS,
1384
+ id: id,
1385
+ className: [`DGN-UI-Attachment ${disabled ? 'disabled' : ''}`, className].join(' ').trim().replace(/\s+/g, ' '),
1386
+ style: style,
1867
1387
  onDragEnter: onDragFileStart
1868
- }, AttachHeaderView, AttachmentInputView, AttachedView, PopoverView, PopupView, ModalView);
1388
+ }, AttachHeaderView, AttachmentInputView, AttachedView, PopoverView, PopupView, ModalView, jsx(Notify, {
1389
+ getAddNotify: func => PushNotify.current = func,
1390
+ progressing: true,
1391
+ autoDisappear: true,
1392
+ position: {
1393
+ vertical: 'bottom',
1394
+ horizontal: 'center'
1395
+ },
1396
+ color: 'danger'
1397
+ }));
1869
1398
  }));
1399
+ const ViewAttachTypeCSS = css`
1400
+ ${cursorPointer};
1401
+ ${parseHeight(24)};
1402
+ color: ${rest};
1403
+ &:hover {
1404
+ color: ${active};
1405
+ }
1406
+ `;
1407
+ const AttachmentHandleIconCSS = css`
1408
+ ${displayNone};
1409
+ ${parseHeight(24)};
1410
+ margin-right: 10px;
1411
+ border-right: 1px solid ${normal};
1412
+ span {
1413
+ ${cursorPointer};
1414
+ margin-right: 10px;
1415
+ color: ${rest};
1416
+ &:hover {
1417
+ color: ${active};
1418
+ }
1419
+ }
1420
+ `;
1421
+ const AttachmentHeaderCSS = css`
1422
+ ${flexRow};
1423
+ ${alignCenter};
1424
+ ${justifyBetween};
1425
+ ${borderBox};
1426
+ ${parseHeight(48)};
1427
+ padding: ${spacing([4, 4])};
1428
+ .css-${AttachmentHandleIconCSS.name}, .css-${ViewAttachTypeCSS.name} {
1429
+ z-index: 1;
1430
+ }
1431
+ `;
1432
+ const AttachmentInfoCSS = css`
1433
+ ${flexRow};
1434
+ ${positionRelative};
1435
+ ${alignCenter};
1436
+ margin: 0;
1437
+ & + p.attachment-error {
1438
+ color: ${danger};
1439
+ }
1440
+ `;
1441
+ const AttachmentTextCSS = css`
1442
+ ${userSelectNone};
1443
+ ${textUppercase};
1444
+ ${heading5};
1445
+ color: ${sub};
1446
+ `;
1447
+ const AttachmentHeaderIconCSS = css`
1448
+ ${flexRow};
1449
+ ${alignCenter};
1450
+ `;
1451
+ const AttachmentInputCSS = css`
1452
+ ${displayNone};
1453
+ ${positionAbsolute};
1454
+ width: 100%;
1455
+ height: 100%;
1456
+ top: 0;
1457
+ left: 0;
1458
+ z-index: 4;
1459
+ input {
1460
+ ${positionRelative};
1461
+ opacity: 0;
1462
+ top: -20px;
1463
+ font-size: 0px;
1464
+ width: 100%;
1465
+ height: calc(100% + 20px);
1466
+ }
1467
+ `;
1468
+ const AttachmentImageCenterCSS = css`
1469
+ ${flexRow};
1470
+ ${justifyCenter};
1471
+ ${alignCenter};
1472
+ width: 100%;
1473
+ height: 100%;
1474
+ `;
1475
+ const AttachmentImageContentCSS = css`
1476
+ ${textCenter};
1477
+ display: grid;
1478
+ `;
1479
+ const AttachmentImageIconCSS = css`
1480
+ ${parseWidthHeight(24, 24)};
1481
+ margin-bottom: 0;
1482
+ z-index: 3;
1483
+ svg {
1484
+ color: ${rest};
1485
+ }
1486
+ &:hover {
1487
+ border-color: ${lineHover};
1488
+ svg {
1489
+ color: ${active};
1490
+ }
1491
+ }
1492
+ `;
1493
+ const AttachmentImageTextCSS = css`
1494
+ ${displayNone};
1495
+ ${userSelectNone};
1496
+ ${paragraph3};
1497
+ color: ${rest};
1498
+ `;
1499
+ const AttachmentImageCSS = css`
1500
+ margin-right: 10px;
1501
+ &.hint-center {
1502
+ ${positionAbsolute};
1503
+ width: 100%;
1504
+ height: 100%;
1505
+ top: 0;
1506
+ left: 0;
1507
+ margin-right: 0;
1508
+ z-index: 1;
1509
+ .css-${AttachmentImageTextCSS.name} {
1510
+ ${displayBlock};
1511
+ }
1512
+ .css-${AttachmentImageIconCSS.name} {
1513
+ ${flexRow};
1514
+ ${justifyCenter};
1515
+ ${alignCenter};
1516
+ ${parseWidthHeight(64, 64)};
1517
+ margin: 0 auto 8px auto;
1518
+ border: 1px dashed ${normal};
1519
+ border-radius: 50%;
1520
+ svg {
1521
+ ${parseWidthHeight(40, 40)};
1522
+ }
1523
+ &:hover {
1524
+ border-color: ${lineHover};
1525
+ background-color: ${fillHover};
1526
+ }
1527
+ }
1528
+ }
1529
+ `;
1530
+ const AttachedItemInfoCSS = css`
1531
+ ${flexRow};
1532
+ ${alignCenter};
1533
+ ${borderRadius4px};
1534
+ ${userSelectNone};
1535
+ min-width: 104px;
1536
+ margin-right: 10px;
1537
+ min-width: calc(50% - 10px);
1538
+ `;
1539
+ const AttachedItemInfoIconCSS = css`
1540
+ ${flexRow};
1541
+ ${positionRelative};
1542
+ ${cursorPointer};
1543
+ max-height: 16px;
1544
+ max-width: 14px;
1545
+ padding: 4px 5px;
1546
+ box-sizing: content-box;
1547
+ &.new-file:after {
1548
+ content: '';
1549
+ ${positionAbsolute};
1550
+ top: 4.5px;
1551
+ left: -2px;
1552
+ width: 4px;
1553
+ height: 4px;
1554
+ border-radius: 50%;
1555
+ background: ${success};
1556
+ }
1557
+ `;
1558
+ const AttachedItemInfoNameCSS = css`
1559
+ ${paragraph1};
1560
+ ${cursorPointer};
1561
+ ${ellipsis};
1562
+ color: ${dark};
1563
+ margin-left: 12px;
1564
+ padding-top: 1px;
1565
+ box-sizing: content-box;
1566
+ `;
1567
+ const AttachedItemOwnerCSS = css`
1568
+ ${paragraph2};
1569
+ ${flexRow};
1570
+ ${positionRelative};
1571
+ ${alignCenter};
1572
+ ${cursorPointer};
1573
+ ${userSelectNone};
1574
+ height: 100%;
1575
+ color: ${sub};
1576
+ .detail-info {
1577
+ ${flexRow};
1578
+ min-width: 333px;
1579
+ .username {
1580
+ ${displayInlineBlock};
1581
+ ${ellipsis};
1582
+ min-width: 120px;
1583
+ max-width: 120px;
1584
+ }
1585
+ .datetime {
1586
+ ${displayInlineBlock};
1587
+ min-width: max-content;
1588
+ max-width: max-content;
1589
+ }
1590
+ .filesize {
1591
+ float: right;
1592
+ text-align: right;
1593
+ margin-left: auto;
1594
+ }
1595
+ }
1596
+ `;
1597
+ const AttachedLinearCSS = css`
1598
+ ${flexRow};
1599
+ ${positionAbsolute};
1600
+ ${alignCenter};
1601
+ width: 100%;
1602
+ top: 0;
1603
+ background: #fff;
1604
+ height: 100%;
1605
+ `;
1606
+ const AttachedItemCSS = css`
1607
+ ${flexRow};
1608
+ ${justifyBetween};
1609
+ ${alignCenter};
1610
+ ${positionRelative};
1611
+ ${borderRadius4px};
1612
+ ${parseHeight(24)};
1613
+ padding: ${spacing([0, 2])};
1614
+ transition: padding 0.5s ease;
1615
+ `;
1616
+ const AttachedCSS = css`
1617
+ ${positionRelative};
1618
+ height: 100%;
1619
+ max-height: 152px;
1620
+ margin-left: 8px;
1621
+ margin-right: 8px;
1622
+ z-index: 1;
1623
+ overflow-y: visible;
1624
+ .attachment-row {
1625
+ ${displayBlock};
1626
+ margin-bottom: 8px;
1627
+ &:last-child {
1628
+ margin-bottom: 0;
1629
+ }
1630
+ }
1631
+ &.icon-view {
1632
+ ${flexRow};
1633
+ ${flexWrap};
1634
+ ${justifyBetween};
1635
+ &::after {
1636
+ content: '';
1637
+ flex: auto;
1638
+ }
1639
+ max-height: 200px;
1640
+ margin-left: 0;
1641
+ width: max-content;
1642
+ max-width: calc(100% - 26px);
1643
+ .attachment-row {
1644
+ ${positionRelative};
1645
+ margin-left: 16px;
1646
+ overflow-y: visible;
1647
+ }
1648
+ .css-${AttachedItemCSS.name} {
1649
+ ${displayBlock};
1650
+ ${parseWidthHeight(80, 80)};
1651
+ padding: 0;
1652
+ position: initial;
1653
+ .css-${AttachedItemInfoCSS.name} {
1654
+ ${displayBlock};
1655
+ ${positionRelative};
1656
+ ${textCenter};
1657
+ ${ellipsis};
1658
+ width: max-content;
1659
+ max-width: 80px;
1660
+ margin-left: auto;
1661
+ margin-right: auto;
1662
+ min-width: 70px;
1663
+ .css-${AttachedItemInfoIconCSS.name} {
1664
+ ${displayBlock};
1665
+ ${parseWidthHeight(40, 40)};
1666
+ max-height: 40px;
1667
+ max-width: 40px;
1668
+ margin: 4px auto 2px;
1669
+ padding: 0;
1670
+ &.new-file:after {
1671
+ top: -1px;
1672
+ left: -7px;
1673
+ width: 8px;
1674
+ height: 8px;
1675
+ }
1676
+ }
1677
+ .css-${AttachedItemInfoNameCSS.name} {
1678
+ ${paragraph3};
1679
+ ${textCenter};
1680
+ margin: 0 8px;
1681
+ display: -webkit-box;
1682
+ word-break: break-word;
1683
+ max-width: 100%;
1684
+ white-space: pre-wrap;
1685
+ -webkit-line-clamp: 2;
1686
+ -webkit-box-orient: vertical;
1687
+ }
1688
+ }
1689
+ .css-${AttachedItemOwnerCSS.name} {
1690
+ ${paragraph3};
1691
+ position: inherit;
1692
+ height: auto;
1693
+ .detail-info {
1694
+ ${displayNone};
1695
+ }
1696
+ .css-${AttachedLinearCSS.name} {
1697
+ height: auto;
1698
+ bottom: 0;
1699
+ top: unset;
1700
+ background: none;
1701
+ }
1702
+ }
1703
+ }
1704
+ }
1705
+ &:not(.icon-view) {
1706
+ min-width: 684px;
1707
+ }
1708
+ `;
1709
+ const AttachmentRootCSS = css`
1710
+ ${flexCol};
1711
+ ${flexWrap};
1712
+ ${justifyStart};
1713
+ ${positionRelative};
1714
+ ${borderRadius4px};
1715
+ ${border(1, normal)};
1716
+ min-height: 165px;
1717
+ padding-bottom: 20px;
1718
+ background-color: ${white};
1719
+ &:hover:not(.disabled) {
1720
+ .css-${AttachmentImageIconCSS.name} {
1721
+ ${cursorPointer};
1722
+ }
1723
+ }
1724
+ .css-${AttachedCSS.name} {
1725
+ &:not(.disabled) {
1726
+ .css-${AttachedItemCSS.name} {
1727
+ &:hover {
1728
+ background-color: ${fillHover};
1729
+ .css-${AttachedLinearCSS.name} {
1730
+ background-color: ${fillHover};
1731
+ }
1732
+ }
1733
+ &:active {
1734
+ background-color: ${pressed};
1735
+ .css-${AttachedLinearCSS.name} {
1736
+ background-color: ${pressed};
1737
+ }
1738
+ }
1739
+ &.chosen {
1740
+ background-color: ${focus};
1741
+ .css-${AttachedItemInfoCSS.name}, .css-${AttachedItemOwnerCSS.name} {
1742
+ background-color: ${focus};
1743
+ }
1744
+ }
1745
+ }
1746
+ }
1747
+ }
1748
+ &.disabled {
1749
+ .css-${AttachedItemCSS.name} {
1750
+ ${pointerEventsNone};
1751
+ }
1752
+ }
1753
+ @media (max-width: 716px) {
1754
+ .css-${AttachedCSS.name}:not(.icon-view) {
1755
+ min-width: 575px;
1756
+ }
1757
+ .css-${AttachedItemInfoCSS.name} {
1758
+ max-width: calc(40% - 10px);
1759
+ }
1760
+ }
1761
+ `;
1870
1762
  Attachment.defaultProps = {
1871
1763
  deleteNotifyText: getGlobal('deleteNotifyText'),
1872
1764
  viewType: 'detail',
1873
1765
  label: getGlobal('attachText'),
1766
+ hintText: getGlobal('dropFileHere'),
1874
1767
  className: '',
1768
+ style: {},
1875
1769
  allowSort: true,
1876
1770
  multiple: true,
1877
1771
  disabled: false,
@@ -1881,6 +1775,15 @@ Attachment.defaultProps = {
1881
1775
  uploadErrorInfo: {}
1882
1776
  };
1883
1777
  Attachment.propTypes = {
1778
+ /** File types that can be accepted. */
1779
+ accept: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
1780
+
1781
+ /** If `true`, allow sort. */
1782
+ allowSort: PropTypes.bool,
1783
+
1784
+ /** Class for component. */
1785
+ className: PropTypes.string,
1786
+
1884
1787
  /** List attachment:<br />
1885
1788
  * [{<br />
1886
1789
  * &nbsp;&nbsp;&nbsp;&nbsp;"AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
@@ -1895,77 +1798,48 @@ Attachment.propTypes = {
1895
1798
  */
1896
1799
  data: PropTypes.array,
1897
1800
 
1898
- /** allow sort element on DOM if true */
1899
- allowSort: PropTypes.bool,
1801
+ /** The message to display when deleting files. */
1802
+ deleteNotifyText: PropTypes.string,
1900
1803
 
1901
- /** prevent all event if true */
1804
+ /** If `true`, the component is disabled. */
1902
1805
  disabled: PropTypes.bool,
1903
1806
 
1904
- /** prevent all event if true */
1905
- readOnly: PropTypes.bool,
1906
-
1907
- /** At least one attachment is required */
1908
- required: PropTypes.bool,
1909
-
1910
- /** allows to attach multiple files */
1911
- multiple: PropTypes.bool,
1912
-
1913
- /** the type of images displayed want to see */
1914
- viewType: PropTypes.oneOf(['detail', 'icon']),
1915
-
1916
- /** attach label to display in the upper left corner of attachment box */
1917
- label: PropTypes.string,
1918
-
1919
- /** domain of attachments*/
1807
+ /** Domain of attachments. */
1920
1808
  domain: PropTypes.string,
1921
1809
 
1922
- /** strip domain of attachments if it's true */
1923
- isStripDomain: PropTypes.bool,
1924
-
1925
- /** class of Attachment component */
1926
- className: PropTypes.string,
1927
-
1928
- /** the name of the person who attached the file when uploading the file */
1929
- ownerName: PropTypes.string,
1810
+ /** Error of attachment. */
1811
+ error: PropTypes.string,
1930
1812
 
1931
- /** Suggested passage attached */
1813
+ /** Suggested passage attached. */
1932
1814
  hintText: PropTypes.string,
1933
1815
 
1934
- /** text warning message when deleting files */
1935
- deleteNotifyText: PropTypes.string,
1936
-
1937
- /** error of attachment */
1938
- error: PropTypes.string,
1816
+ /** [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes) applied to the input element. */
1817
+ inputProps: PropTypes.object,
1939
1818
 
1940
- /** Allows what types of files to be attached */
1941
- accept: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
1819
+ /** If `true`, strip domain of attachments. */
1820
+ isStripDomain: PropTypes.bool,
1942
1821
 
1943
- /** Maximum capacity allowed to attach */
1944
- maxSize: PropTypes.string,
1822
+ /** Label of the component. */
1823
+ label: PropTypes.string,
1945
1824
 
1946
- /** Maximum quantity allowed to attach */
1825
+ /** Limit the number of uploaded files. */
1947
1826
  maxFile: PropTypes.number,
1948
1827
 
1949
- /** style inline of Attachment component */
1950
- style: PropTypes.object,
1951
-
1952
- /** style inline of error in Attachment component */
1953
- errorStyle: PropTypes.object,
1954
-
1955
- /** style inline of input in Attachment component */
1956
- inputStyle: PropTypes.object,
1828
+ /** Limit the size of uploaded files. */
1829
+ maxSize: PropTypes.string,
1957
1830
 
1958
- /** props of input in Attachment component */
1959
- inputProps: PropTypes.object,
1831
+ /** Allows to attach multiple files. */
1832
+ multiple: PropTypes.bool,
1960
1833
 
1961
- /** errors show up when the file upload is corrupted */
1962
- uploadErrorInfo: PropTypes.object,
1834
+ /** Callback fired when the files attached is changed. */
1835
+ onChange: PropTypes.func,
1963
1836
 
1964
- /** event when uploading file failed */
1965
- onUploadError: PropTypes.func,
1837
+ /** Download attached event, if not it will use default. */
1838
+ onDownload: PropTypes.func,
1966
1839
 
1967
1840
  /**
1968
- * event when removed file(s)<br/>
1841
+ * event when removed file(s)
1842
+ *
1969
1843
  * return data: {<br/>
1970
1844
  * &nbsp;&nbsp;&nbsp;&nbsp;attached: [Files] (insist old and all new files )<br/>
1971
1845
  * &nbsp;&nbsp;&nbsp;&nbsp;allNewAttached: [Files]<br/>
@@ -1976,16 +1850,25 @@ Attachment.propTypes = {
1976
1850
  */
1977
1851
  onRemove: PropTypes.func,
1978
1852
 
1979
- /** view attached event, if not it will use default */
1853
+ /** View attached event, if not it will use default. */
1980
1854
  onView: PropTypes.func,
1981
1855
 
1982
- /** download attached event, if not it will use default */
1983
- onDownload: PropTypes.func,
1856
+ /** Name of the person who attached the file when uploading the file. */
1857
+ ownerName: PropTypes.string,
1984
1858
 
1985
- /** event when there is a change attached */
1986
- onChange: PropTypes.func,
1859
+ /** If `true`, the component is readOnly. */
1860
+ readOnly: PropTypes.bool,
1861
+
1862
+ /** At least one attachment is required. */
1863
+ required: PropTypes.bool,
1864
+
1865
+ /** Style inline of component. */
1866
+ style: PropTypes.object,
1867
+
1868
+ /** Errors show up when the file upload is corrupted. */
1869
+ uploadErrorInfo: PropTypes.object,
1987
1870
 
1988
- /** any props else */
1989
- props: PropTypes.any
1871
+ /** The view type of files. */
1872
+ viewType: PropTypes.oneOf(['detail', 'icon'])
1990
1873
  };
1991
1874
  export default Attachment;