diginet-core-ui 1.4.46-beta.2 → 1.4.47-beta.1

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.
@@ -281,11 +281,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
281
281
  attachedRef.current.appendChild(el);
282
282
  });
283
283
  };
284
-
285
- // const afterChangeFile = (length = 0) => {
286
- // setIsEmpty(!length);
287
- // };
288
-
289
284
  const onChangeFiles = async e => {
290
285
  var _e$target, _e$target$files, _Array$from$;
291
286
  if (!isEnable) return;
@@ -434,6 +429,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
434
429
  const index = Array.from(attachedRef.current.children).indexOf(itemEl.parentNode);
435
430
  const deletedFile = attachedItems[index];
436
431
  if (deletedFile.hasOwnProperty('AttachmentID')) {
432
+ // if attachment has ID (CDN uploaded) push it to removedAttachmentRef
437
433
  removedAttachedRef.current.push(deletedFile);
438
434
  }
439
435
  recentRemovedAttached.push(deletedFile);
@@ -448,9 +444,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
448
444
  }
449
445
  });
450
446
  const tempAttachedItems = [...tempDataState, ...tempNewDataState];
451
- // if (tempAttachedItems.length < 2) {
452
- // afterChangeFile(tempAttachedItems?.length || 0);
453
- // }
454
447
  stripDomain();
455
448
  if (onChange) onChange({
456
449
  element: nodeList,
@@ -516,7 +509,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
516
509
  setNewDataState(files[0] ? [files[0]] : []);
517
510
  });
518
511
  }
519
- // attachmentInputRef.current.files = allNewAttached.getAll('files');
520
512
  };
521
513
  const checkExistingFile = newFile => {
522
514
  const files = [...dataState, ...newDataState];
@@ -536,7 +528,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
536
528
  const ctrlKey = e.ctrlKey;
537
529
  const shiftKey = e.shiftKey;
538
530
  const itemEl = e.currentTarget.firstChild;
539
- // timer.current = setTimeout(() => {
540
531
  if (!prevent.current) {
541
532
  if (shiftKey && !ctrlKey) {
542
533
  let startIndex = chosenItems[chosenItems.length - 1] || 0;
@@ -588,7 +579,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
588
579
  checkChosenMultiple();
589
580
  }
590
581
  prevent.current = false;
591
- // }, 100);
592
582
  };
593
583
  const removeActiveChosenItem = () => {
594
584
  attachedRef.current.querySelectorAll('.chosen').forEach(itemEl => {
@@ -779,7 +769,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
779
769
  }, [accept]);
780
770
  useEffect(() => {
781
771
  oldAttached.length = 0;
782
- // afterChangeFile((data?.length || 0) + (newDataState?.length || 0));
783
772
  if (data !== null && data !== void 0 && data.length && !(dataState !== null && dataState !== void 0 && dataState.length) && !(newDataState !== null && newDataState !== void 0 && newDataState.length)) {
784
773
  // Load files data was uploaded
785
774
  const length = data.length;
@@ -1444,20 +1433,6 @@ const ItemPictureInfoCSS = ({
1444
1433
  ${bgColor(getProp(colors, 'fill/tooltip'))};
1445
1434
  ${parseWidth('100%')};
1446
1435
  `;
1447
-
1448
- // Attachment.defaultProps = {
1449
- // allowDelete: true,
1450
- // allowSort: true,
1451
- // className: '',
1452
- // data: [],
1453
- // disabled: false,
1454
- // height: 280,
1455
- // maxFile: Infinity,
1456
- // multiple: true,
1457
- // style: {},
1458
- // viewType: 'detail',
1459
- // };
1460
-
1461
1436
  Attachment.propTypes = {
1462
1437
  /** File types that can be accepted. */
1463
1438
  accept: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
@@ -1467,17 +1442,17 @@ Attachment.propTypes = {
1467
1442
  allowSort: PropTypes.bool,
1468
1443
  /** Class for component. */
1469
1444
  className: PropTypes.string,
1470
- /** List attachment:<br />
1471
- * [{<br />
1472
- * &nbsp;&nbsp;&nbsp;&nbsp;"AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
1473
- * &nbsp;&nbsp;&nbsp;&nbsp;"URL": "https://apricot.diginet.com.vn/cdn-dev/file/demo.jpg",<br />
1474
- * &nbsp;&nbsp;&nbsp;&nbsp;"FileName": "8a07bee1eeff17a14eee.jpg",<br />
1475
- * &nbsp;&nbsp;&nbsp;&nbsp;"FileSize": 248837,<br />
1476
- * &nbsp;&nbsp;&nbsp;&nbsp;"KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
1477
- * &nbsp;&nbsp;&nbsp;&nbsp;"CreateUserID": "LEMONADMIN",<br />
1478
- * &nbsp;&nbsp;&nbsp;&nbsp;"CreateDate": "2020-08-24T11:54:04.307Z",<br />
1479
- * &nbsp;&nbsp;&nbsp;&nbsp;"UserName": "Quản trị hệ thống"<br />
1480
- * }, ...]
1445
+ /** List attachment:<br />
1446
+ * [{<br />
1447
+ * &nbsp;&nbsp;&nbsp;&nbsp;"AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
1448
+ * &nbsp;&nbsp;&nbsp;&nbsp;"URL": "https://apricot.diginet.com.vn/cdn-dev/file/demo.jpg",<br />
1449
+ * &nbsp;&nbsp;&nbsp;&nbsp;"FileName": "8a07bee1eeff17a14eee.jpg",<br />
1450
+ * &nbsp;&nbsp;&nbsp;&nbsp;"FileSize": 248837,<br />
1451
+ * &nbsp;&nbsp;&nbsp;&nbsp;"KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
1452
+ * &nbsp;&nbsp;&nbsp;&nbsp;"CreateUserID": "LEMONADMIN",<br />
1453
+ * &nbsp;&nbsp;&nbsp;&nbsp;"CreateDate": "2020-08-24T11:54:04.307Z",<br />
1454
+ * &nbsp;&nbsp;&nbsp;&nbsp;"UserName": "Quản trị hệ thống"<br />
1455
+ * }, ...]
1481
1456
  */
1482
1457
  data: PropTypes.array,
1483
1458
  /** The message to display when deleting files. */
@@ -1508,16 +1483,16 @@ Attachment.propTypes = {
1508
1483
  onChange: PropTypes.func,
1509
1484
  /** Download attached event, if not it will use default. */
1510
1485
  onDownload: PropTypes.func,
1511
- /**
1512
- * event when removed file(s)
1513
- *
1514
- * return data: {<br/>
1515
- * &nbsp;&nbsp;&nbsp;&nbsp;attached: [Files] (insist old and all new files )<br/>
1516
- * &nbsp;&nbsp;&nbsp;&nbsp;allNewAttached: [Files]<br/>
1517
- * &nbsp;&nbsp;&nbsp;&nbsp;oldAttached: [Files]<br/>
1518
- * &nbsp;&nbsp;&nbsp;&nbsp;removedAttached: [Files]<br/>
1519
- * &nbsp;&nbsp;&nbsp;&nbsp;element: [NodeList (just removed)]<br/>
1520
- * }
1486
+ /**
1487
+ * event when removed file(s)
1488
+ *
1489
+ * return data: {<br/>
1490
+ * &nbsp;&nbsp;&nbsp;&nbsp;attached: [Files] (insist old and all new files )<br/>
1491
+ * &nbsp;&nbsp;&nbsp;&nbsp;allNewAttached: [Files]<br/>
1492
+ * &nbsp;&nbsp;&nbsp;&nbsp;oldAttached: [Files]<br/>
1493
+ * &nbsp;&nbsp;&nbsp;&nbsp;removedAttached: [Files]<br/>
1494
+ * &nbsp;&nbsp;&nbsp;&nbsp;element: [NodeList (just removed)]<br/>
1495
+ * }
1521
1496
  */
1522
1497
  onRemove: PropTypes.func,
1523
1498
  /** View attached event, if not it will use default. */
@@ -26,7 +26,13 @@ const viDisplayFormat = new Map([['year', 'YYYY'], ['quarter', 'Q-YYYY'], ['mont
26
26
  const pickerReturnFormat = new Map([['year', 'YYYY'], ['quarter', 'YYYY-Q'], ['month', 'YYYY-MM']]);
27
27
  const parseValueToDate = valueProp => {
28
28
  if (valueProp === '') return null;
29
- return isValidDate(valueProp) ? new Date(valueProp) : valueProp;
29
+ if (isValidDate(valueProp)) {
30
+ const date = new Date(valueProp);
31
+ const userTimezoneOffset = date.getTimezoneOffset() * 60000;
32
+ return new Date(date.getTime() + userTimezoneOffset);
33
+ } else {
34
+ return valueProp;
35
+ }
30
36
  };
31
37
  const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
32
38
  var _ref, _pickerReturnFormat$g, _ipRef$current, _ipRef$current2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.4.46-beta.2",
3
+ "version": "1.4.47-beta.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/readme.md CHANGED
@@ -41,6 +41,11 @@ npm test
41
41
  ```
42
42
 
43
43
  ## Changelog
44
+ ## 1.4.47
45
+ - \[Added\]: Icon – Add IconMenu MHRP09N2000
46
+ - \[Fixed\]: Attachment - Attachment error on older mobile devices
47
+ - \[Changed\]: NumberInput – Fix NumberInput when the error still allows entering symbols
48
+
44
49
  ## 1.4.46
45
50
  - \[Added\]: Icon – Add Icon Sql
46
51
  - \[Added\]: Icon – Add IconMenu MHRM29N0006