diginet-core-ui 1.4.52 → 1.4.53-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.
@@ -0,0 +1,13 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2302_32)">
3
+ <path d="M0 32.6C0 32.8 0.1 33 0.3 33.1C4.1 35 8 36.9 11.8 38.8C11.9 38.9 12 38.9 12.1 39C12.1 39 12.1 39 12.2 39C12.2 37 12.2 35 12.2 32.9H21.4C21.9 32.9 22.3 32.5 22.3 32V21L20.3 23V30.9C17.6 30.9 14.9 30.9 12.2 30.9C12.2 30.8 12.2 30.6 12.2 30.5C12.2 24.8 12.2 12.6 12.2 7C12.2 6.5 11.9 6 11.4 5.7C9.1 4.5 6.8 3.4 4.4 2.2C4.4 2.2 4.3 2.1 4.1 2C9.5 2 14.9 2 20.2 2V11L22.2 13V0.9C22.2 0.4 21.8 0 21.3 0H0C0 0.1 0 0.2 0 0.3C0 8.9 0 24 0 32.6ZM8.4 22.5C8.4 22 8.8 21.6 9.3 21.6C9.8 21.6 10.2 22 10.2 22.5C10.2 23 9.8 23.4 9.3 23.4C8.9 23.4 8.4 23 8.4 22.5Z" fill="#FFAA00"/>
4
+ <path d="M32.8002 12.7V22.2C32.8002 22.8 33.6002 23.2 34.0002 22.7L38.8002 17.9C39.1002 17.6 39.1002 17.2 38.8002 16.9L34.0002 12.2C33.6002 11.8 32.8002 12.1 32.8002 12.7Z" fill="#FF4444"/>
5
+ <path d="M24.8002 12.7V22.2C24.8002 22.8 25.6002 23.2 26.0002 22.7L30.8002 17.9C31.1002 17.6 31.1002 17.2 30.8002 16.9L26.0002 12.1C25.6002 11.8 24.8002 12.1 24.8002 12.7Z" fill="#FF4444"/>
6
+ <path d="M16.7002 12.7V22.2C16.7002 22.8 17.5002 23.2 17.9002 22.7L22.7002 17.9C23.0002 17.6 23.0002 17.2 22.7002 16.9L17.9002 12.1C17.5002 11.8 16.7002 12.1 16.7002 12.7Z" fill="#FF4444"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_2302_32">
10
+ <rect width="39" height="39" fill="white"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2302_42)">
3
+ <path d="M21.4 0H0V0.3C0 8.9 0 24 0 32.6C0 32.8 0.1 33 0.3 33.1C4.1 35 8 36.9 11.8 38.8C11.9 38.9 12 38.9 12.1 39H12.2V32.9H18.8C18.5 32.3 18.4 31.6 18.2 30.9H12.2V6.9C12.2 6.4 11.9 5.9 11.4 5.6C9.1 4.5 6.8 3.4 4.5 2.2C4.4 2.2 4.3 2.1 4.1 2H20.2V7L22.2 9V0.9C22.3 0.4 21.9 0 21.4 0ZM9.4 21.5C9.9 21.5 10.4 21.9 10.4 22.5C10.4 23.1 10 23.4 9.4 23.4C8.8 23.4 8.4 23 8.4 22.5C8.4 22 8.9 21.5 9.4 21.5Z" fill="#FFAA00"/>
4
+ <path d="M32.4999 7.29994V17.1999C32.4999 17.8999 33.2999 18.1999 33.7999 17.6999L38.7999 12.6999C39.0999 12.3999 39.0999 11.8999 38.7999 11.5999L33.7999 6.59994C33.3999 6.29994 32.4999 6.69994 32.4999 7.29994Z" fill="#FF4444"/>
5
+ <path d="M24.2999 7.29994V17.1999C24.2999 17.8999 25.0999 18.1999 25.5999 17.6999L30.5999 12.6999C30.8999 12.3999 30.8999 11.8999 30.5999 11.5999L25.5999 6.59994C25.0999 6.29994 24.2999 6.69994 24.2999 7.29994Z" fill="#FF4444"/>
6
+ <path d="M15.8999 7.29994V17.1999C15.8999 17.8999 16.6999 18.1999 17.1999 17.6999L22.1999 12.6999C22.4999 12.3999 22.4999 11.8999 22.1999 11.5999L17.1999 6.59994C16.6999 6.29994 15.8999 6.69994 15.8999 7.29994Z" fill="#FF4444"/>
7
+ <path d="M34.4 20.6C32.8 19.6 31 19 29 19C28.5 19 28.1 19 27.7 19.1C26.9 19.2 26 19.4 25.3 19.7C24.9 19.9 24.4 20.1 24 20.3C22 21.4 20.5 23.2 19.7 25.3C19.2 26.5 19 27.7 19 29C19 34.5 23.5 39 29 39C34.5 39 39 34.5 39 29C39 25.5 37.1 22.3 34.4 20.6ZM35.2 25.8L29.3 33.8C29 34.3 28.4 34.6 27.8 34.6H27.7C27.2 34.6 26.6 34.4 26.3 34L22.8 30.2C22.3 29.6 22.3 28.7 22.9 28.1C23.2 27.8 23.5 27.7 23.9 27.7C24.3 27.7 24.7 27.9 25 28.2L27.5 30.9L27.6 31C27.7 31 27.7 31 27.7 30.9L32.7 24.1C33 23.7 33.4 23.5 33.9 23.5C34.2 23.5 34.5 23.6 34.8 23.8C35.6 24.2 35.7 25.1 35.2 25.8Z" fill="#1CA261"/>
8
+ </g>
9
+ <defs>
10
+ <clipPath id="clip0_2302_42">
11
+ <rect width="39" height="39" fill="white"/>
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
@@ -0,0 +1,15 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2319_30)">
3
+ <path d="M19.5 19.2015C19.9 19.5995 20.3 19.898 20.8 20.2959C21.8 20.8929 23 21.4898 24.1 21.6888C24.8 21.8878 26.6 21.7883 26.9 21.7883C27.8 21.6888 28.7 21.4898 29.5 21.1913C30.5 20.7934 31.4 20.2959 32.1 19.5995C31.9 18.6046 31.7 17.6097 31.5 16.7143C31.3 15.9184 30.8 15.4209 30 15.4209H21.6C20.7 15.4209 20.2 15.9184 20 16.8138C19.9 17.5102 19.7 18.3061 19.5 19.2015Z" fill="#2680EB"/>
4
+ <path d="M25.8 13.8291C28.5 13.8291 30.6 11.6403 30.6 8.9541C30.6 6.26788 28.4 4.0791 25.8 4.0791C23.2 4.0791 21 6.26788 21 8.9541C21 11.7398 23.2 13.9286 25.8 13.8291Z" fill="#2680EB"/>
5
+ <path d="M35.2001 3.78061C32.8001 1.39286 29.5001 0 26.0001 0C25.7001 0 25.4001 0 25.1001 0C25.0001 0 25.0001 0 24.9001 0H9.1001C8.5001 0 8.0001 0.497449 8.0001 1.09439C8.0001 1.69133 8.5001 2.18878 9.1001 2.18878H18.6001C18.0001 2.58673 17.4001 3.08418 16.8001 3.68112C16.4001 4.07908 16.1001 4.47704 15.7001 4.875H7.0001C6.4001 4.97449 5.9001 5.47194 5.9001 6.06888C5.9001 6.66582 6.4001 7.26275 7.0001 7.26275H14.3001C13.9001 8.15816 13.6001 9.05357 13.3001 9.94898H9.0001C8.4001 9.94898 7.9001 10.4464 7.9001 11.0434C7.9001 11.6403 8.4001 12.1378 9.0001 12.1378H13.0001C13.0001 12.3367 13.0001 12.5357 13.0001 12.7347C13.0001 13.4311 13.1001 14.1276 13.2001 14.9235H5.0001C4.4001 14.9235 3.9001 15.4209 3.9001 16.0179C3.9001 16.6148 4.4001 17.1122 5.0001 17.1122H13.9001C14.3001 18.2066 14.9001 19.301 15.6001 20.2959L1.6001 31.3393C-0.3999 33.2296 -0.5999 36.2143 1.1001 37.8061C2.8001 39.4974 5.7001 39.2985 7.7001 37.4082L19.0001 23.5791C21.1001 24.8724 23.5001 25.5689 26.0001 25.5689C29.5001 25.5689 32.8001 24.176 35.2001 21.7883C37.6001 19.4005 39.0001 16.1173 39.0001 12.7347C39.0001 9.35204 37.6001 6.16837 35.2001 3.78061ZM33.4001 20.0969C32.4001 21.0918 31.3001 21.7883 30.0001 22.2857C28.7001 22.7832 27.3001 23.0816 26.0001 23.0816C23.9001 23.0816 21.9001 22.4847 20.2001 21.2908C18.5001 20.0969 17.1001 18.5051 16.3001 16.6148C15.5001 14.7245 15.3001 12.6352 15.7001 10.6454C16.1001 8.65561 17.1001 6.76531 18.6001 5.37245C20.1001 3.97959 22.0001 2.98469 24.0001 2.58673C26.0001 2.18878 28.2001 2.38776 30.1001 3.18367C32.0001 3.97959 33.6001 5.27296 34.8001 7.06378C35.9001 8.7551 36.6001 10.7449 36.5001 12.8342C36.5001 14.227 36.2001 15.5204 35.7001 16.8138C35.2001 18.0077 34.4001 19.102 33.4001 20.0969Z" fill="#FF8C00"/>
6
+ <path d="M1.1001 12.2372H5.8001C6.4001 12.2372 6.9001 11.7398 6.9001 11.1429C6.9001 10.5459 6.5001 9.94898 5.9001 9.94898H1.1001C0.5001 9.94898 0.000100322 10.4464 0.000100322 11.0434C0.000100322 11.6403 0.5001 12.2372 1.1001 12.2372Z" fill="#FF8C00"/>
7
+ <path d="M3.0001 7.26275H4.0001C4.6001 7.26275 5.1001 6.76531 5.1001 6.16837C5.1001 5.57143 4.6001 4.97449 4.0001 4.97449H3.0001C2.4001 4.97449 1.9001 5.47194 1.9001 6.06888C1.9001 6.66582 2.4001 7.26275 3.0001 7.26275Z" fill="#FF8C00"/>
8
+ <path d="M11.0001 22.1862C11.6001 22.1862 12.1001 21.6888 12.1001 21.0918C12.1001 20.4949 11.6001 19.898 11.0001 19.898H8.1001C7.5001 19.898 7.0001 20.3954 7.0001 20.9923C7.0001 21.5893 7.5001 22.0867 8.1001 22.0867H11.0001V22.1862Z" fill="#FF8C00"/>
9
+ </g>
10
+ <defs>
11
+ <clipPath id="clip0_2319_30">
12
+ <rect width="39" height="39" fill="white"/>
13
+ </clipPath>
14
+ </defs>
15
+ </svg>
@@ -454,6 +454,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
454
454
  allNewAttached: tempNewDataState
455
455
  });
456
456
  !!onRemoveProp && onRemoveProp(recentRemovedAttached);
457
+ removeActiveChosenItem();
457
458
  onClosePopup();
458
459
  };
459
460
  const clearAllAttached = (confirmPopup = false) => {
@@ -689,13 +690,12 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
689
690
  }
690
691
  };
691
692
  const clickOutOfItem = e => {
692
- var _popupRef$current, _popupRef$current$sty;
693
693
  if (!attachedRef || !attachedRef.current) {
694
694
  document.removeEventListener('keydown', onKeyDown);
695
695
  document.removeEventListener('click', clickOutOfItem);
696
696
  return;
697
697
  }
698
- if (!(attachedRef.current.contains(e.target) && attachedRef.current !== e.target) && !attachmentHandleIconRef.current.contains(e.target) && !isDeleteAll.current && (((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : (_popupRef$current$sty = _popupRef$current.style) === null || _popupRef$current$sty === void 0 ? void 0 : _popupRef$current$sty.display) !== 'flex' || popupRef.current.querySelector('button.filled.info').contains(e.target))) {
698
+ if (!(attachedRef.current.contains(e.target) && attachedRef.current !== e.target) && !attachmentHandleIconRef.current.contains(e.target) && !isDeleteAll.current && !(popupRef.current instanceof Element)) {
699
699
  removeAllChosenItems();
700
700
  removeActiveChosenItem();
701
701
  }
@@ -1442,17 +1442,17 @@ Attachment.propTypes = {
1442
1442
  allowSort: PropTypes.bool,
1443
1443
  /** Class for component. */
1444
1444
  className: PropTypes.string,
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
- * }, ...]
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
+ * }, ...]
1456
1456
  */
1457
1457
  data: PropTypes.array,
1458
1458
  /** The message to display when deleting files. */
@@ -1483,16 +1483,16 @@ Attachment.propTypes = {
1483
1483
  onChange: PropTypes.func,
1484
1484
  /** Download attached event, if not it will use default. */
1485
1485
  onDownload: PropTypes.func,
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
- * }
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
+ * }
1496
1496
  */
1497
1497
  onRemove: PropTypes.func,
1498
1498
  /** View attached event, if not it will use default. */
@@ -652,7 +652,7 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
652
652
  color: 'primary',
653
653
  type: 'h3',
654
654
  ref: refs.content,
655
- format: ['lowercase']
655
+ format: ['sentence']
656
656
  }))), jsx("div", {
657
657
  className: className.navigator.around
658
658
  }, jsx(ButtonIcon, {
@@ -226,7 +226,7 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
226
226
  * START EFFECT
227
227
  */
228
228
  useEffect(() => {
229
- if (defaultValue && defaultValue !== '' && isValidDate(defaultValue)) {
229
+ if (defaultValue && defaultValue !== '' && isValidDate(defaultValue) && !value) {
230
230
  if (isBeforeLimit(min, defaultValue)) {
231
231
  onUpdate(min);
232
232
  } else if (isAfterLimit(max, defaultValue)) {
@@ -262,8 +262,8 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
262
262
  tableData = [],
263
263
  weekDateFirst = getDateOfWeek(firstDay),
264
264
  weekDateLast = getDateOfWeek(lastDay);
265
- /**
266
- * days of previous month
265
+ /**
266
+ * days of previous month
267
267
  */
268
268
  for (let i = weekDateFirst; i > 0; i--) {
269
269
  const day = Date.parse(new Date(time.getFullYear(), time.getMonth(), 1));
@@ -275,8 +275,8 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
275
275
  className: unique.day.day
276
276
  })));
277
277
  }
278
- /**
279
- * days of current month
278
+ /**
279
+ * days of current month
280
280
  */
281
281
  for (let i = 0; i < lastDate; i++) {
282
282
  const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
@@ -302,8 +302,8 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
302
302
  type: 'h6'
303
303
  }, i + 1)));
304
304
  }
305
- /**
306
- * days of next month
305
+ /**
306
+ * days of next month
307
307
  */
308
308
  for (let i = 0; i < 13 - weekDateLast; i++) {
309
309
  const day = Date.parse(new Date(time.getFullYear(), time.getMonth() + 1, 0));
@@ -288,10 +288,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
288
288
  });
289
289
  };
290
290
 
291
- /**
292
- * So sánh text đầu vào cáo map với txtSearch
293
- * @param text
294
- * @return {boolean}
291
+ /**
292
+ * So sánh text đầu vào cáo map với txtSearch
293
+ * @param text
294
+ * @return {boolean}
295
295
  */
296
296
  const handleRenderBySearch = (text = '') => {
297
297
  if (typeof text !== 'string') text = text.toString();
@@ -303,10 +303,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
303
303
  } else return text.toLowerCase().includes(txtSearch.toLowerCase());
304
304
  };
305
305
 
306
- /**
307
- * Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
308
- * @param data {object} rowData of dataSource
309
- * @return {string}
306
+ /**
307
+ * Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
308
+ * @param data {object} rowData of dataSource
309
+ * @return {string}
310
310
  */
311
311
  const displayValue = data => {
312
312
  let text = '';
@@ -459,8 +459,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
459
459
  parentID: treeViewParentID,
460
460
  value: typeof currentValue[unique] === 'string' ? [currentValue[unique]] : currentValue[unique],
461
461
  onChange: (e, value) => onChangeValue(e, '', multiple ? value : e.value),
462
- renderItem: renderItem,
463
- isInDropdown: true
462
+ renderItem: renderItem
464
463
  }) : EmptyDataText);
465
464
  };
466
465
 
@@ -1722,9 +1721,9 @@ Dropdown.propTypes = {
1722
1721
  defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1723
1722
  /** If `true`, the component is disabled. */
1724
1723
  disabled: PropTypes.bool,
1725
- /** The field name used for displaying text in the dropdown list.<br/>
1726
- * Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
1727
- * Note: Do not use 'id - name', as it will return undefined.
1724
+ /** The field name used for displaying text in the dropdown list.<br/>
1725
+ * Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
1726
+ * Note: Do not use 'id - name', as it will return undefined.
1728
1727
  */
1729
1728
  displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1730
1729
  /** Inline style for dropdown items. */
@@ -1733,14 +1732,14 @@ Dropdown.propTypes = {
1733
1732
  error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
1734
1733
  /** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
1735
1734
  helperTextProps: PropTypes.object,
1736
- /** The field name used for displaying icons.<br/>
1737
- * Example:<br/>
1738
- * &nbsp;&nbsp;string: 'icon'<br/>
1739
- * &nbsp;&nbsp;object: {<br/>
1740
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1741
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1742
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1743
- * &nbsp;&nbsp;}
1735
+ /** The field name used for displaying icons.<br/>
1736
+ * Example:<br/>
1737
+ * &nbsp;&nbsp;string: 'icon'<br/>
1738
+ * &nbsp;&nbsp;object: {<br/>
1739
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1740
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1741
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1742
+ * &nbsp;&nbsp;}
1744
1743
  */
1745
1744
  iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
1746
1745
  key: PropTypes.string,
@@ -1774,8 +1773,8 @@ Dropdown.propTypes = {
1774
1773
  onChange: PropTypes.func,
1775
1774
  /** Callback function fired when the dropdown is closed. */
1776
1775
  onClosed: PropTypes.func,
1777
- /** Callback function fired when the input value changes.<br/>
1778
- * If undefined, the filter function will run (default behavior).
1776
+ /** Callback function fired when the input value changes.<br/>
1777
+ * If undefined, the filter function will run (default behavior).
1779
1778
  */
1780
1779
  onInput: PropTypes.func,
1781
1780
  /** Callback function fired when a key is pressed down in the input. */
@@ -1788,21 +1787,21 @@ Dropdown.propTypes = {
1788
1787
  placeholder: PropTypes.string,
1789
1788
  /** If `true`, the component is read-only. */
1790
1789
  readOnly: PropTypes.bool,
1791
- /** Function used for custom rendering of items.<br/>
1792
- * Example: `(data, index) => data.name + ' - ' + data.role`<br/>
1793
- * This can be used as an alternative to `displayExpr`
1790
+ /** Function used for custom rendering of items.<br/>
1791
+ * Example: `(data, index) => data.name + ' - ' + data.role`<br/>
1792
+ * This can be used as an alternative to `displayExpr`
1794
1793
  */
1795
1794
  renderItem: PropTypes.func,
1796
- /** Function or field name used to display selected items.<br/>
1797
- * Example: `(data, index) => index + ' - ' + data.name`<br/>
1795
+ /** Function or field name used to display selected items.<br/>
1796
+ * Example: `(data, index) => index + ' - ' + data.name`<br/>
1798
1797
  */
1799
1798
  renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
1800
1799
  /** If `true`, the label will indicate that the input is required. */
1801
1800
  required: PropTypes.bool,
1802
- /**
1803
- * Duration to wait after entering search content before triggering a search.<br/>
1804
- * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1805
- * If `true`, the default delayOnInput will be used.
1801
+ /**
1802
+ * Duration to wait after entering search content before triggering a search.<br/>
1803
+ * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1804
+ * If `true`, the default delayOnInput will be used.
1806
1805
  */
1807
1806
  searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
1808
1807
  /** Specifies the field name or expression used to compare values with the search string. */
@@ -1829,19 +1828,19 @@ Dropdown.propTypes = {
1829
1828
  valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
1830
1829
  /** The variant to use. */
1831
1830
  viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
1832
- /**
1833
- * ref methods
1834
- *
1835
- * how to get component element? ref.current
1836
- *
1837
- * how to call method? ref.current.instance.{method}
1838
- *
1839
- * * showDropdown(): Show dropdown
1840
- * * closeDropdown(): Close dropdown
1841
- * * onClear(): Clear selected value
1842
- * * setPreviousValue(): Set value to previous value
1843
- * * setValue(value): Set value of dropdown
1844
- * * @param {value} - string || number || array
1831
+ /**
1832
+ * ref methods
1833
+ *
1834
+ * how to get component element? ref.current
1835
+ *
1836
+ * how to call method? ref.current.instance.{method}
1837
+ *
1838
+ * * showDropdown(): Show dropdown
1839
+ * * closeDropdown(): Close dropdown
1840
+ * * onClear(): Clear selected value
1841
+ * * setPreviousValue(): Set value to previous value
1842
+ * * setValue(value): Set value of dropdown
1843
+ * * @param {value} - string || number || array
1845
1844
  */
1846
1845
  };
1847
1846
  export default Dropdown;
@@ -1,13 +1,15 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import { ButtonIcon, InputBase, Label, Popover, PopoverBody } from "../..";
4
+ import { ButtonIcon, InputBase, Label, Popover, PopoverBody, HelperText } from "../..";
5
5
  import PropTypes from 'prop-types';
6
- import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
6
+ import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useMemo } from 'react';
7
7
  import { animation, borderColor, displayBlock, overflowHidden, parseHeight, parseMinWidth, positionRelative, scaleX } from "../../../styles/general";
8
8
  import { useTheme } from "../../../theme";
9
9
  import useThemeProps from "../../../theme/utils/useThemeProps";
10
10
  import { classNames, getProp } from "../../../utils";
11
+ const regexBetween = /[^{}]+(?=})/g;
12
+ const regexInclude = /{|}/g;
11
13
  const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
12
14
  if (!reference) reference = useRef(null);
13
15
  const theme = useTheme();
@@ -22,10 +24,14 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
22
24
  });
23
25
  const {
24
26
  action = {},
27
+ allowInput,
25
28
  bgColor: bgColorProp,
26
29
  children,
27
30
  className,
28
31
  delayOnInput,
32
+ disabled,
33
+ displayExpr: displayExprProp,
34
+ error,
29
35
  endIcon,
30
36
  inputProps,
31
37
  inputRef,
@@ -39,10 +45,19 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
39
45
  placeholder,
40
46
  startIcon,
41
47
  style,
42
- value,
43
- viewType
48
+ value: valueProps,
49
+ valueExpr,
50
+ viewType,
51
+ helperTextProps
44
52
  } = props;
53
+ let displayExpr = displayExprProp;
45
54
  const bgColor = typeof bgColorProp === 'string' ? getProp(colors, bgColorProp, bgColorProp) : bgColorProp;
55
+ const ErrorView = useMemo(() => {
56
+ return error ? jsx(HelperText, {
57
+ ...helperTextProps,
58
+ disabled: disabled
59
+ }, error) : null;
60
+ }, [disabled, error, helperTextProps]);
46
61
  const ref = useRef(null);
47
62
  const dropdownBoxRef = useRef(null);
48
63
  const timer = useRef(null);
@@ -85,6 +100,28 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
85
100
  onClosed === null || onClosed === void 0 ? void 0 : onClosed();
86
101
  }
87
102
  };
103
+
104
+ /**
105
+ * Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
106
+ * @param data {object} rowData of dataSource
107
+ * @return {string}
108
+ */
109
+ const displayValue = data => {
110
+ let text = '';
111
+ if (data || data === 0) {
112
+ displayExpr = displayExpr || valueExpr;
113
+ let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
114
+ // convert {id} - {name} to {<data[id]>} - {<data[name]>}
115
+ if (!mask && regexBetween.test(displayExpr)) {
116
+ var _displayExpr;
117
+ mask = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.replace(regexBetween, _ => (data === null || data === void 0 ? void 0 : data[_]) || '');
118
+ } else if (!mask) {
119
+ mask = typeof data !== 'object' ? data : '';
120
+ }
121
+ text = mask.toString().replace(regexInclude, '');
122
+ }
123
+ return text;
124
+ };
88
125
  useLayoutEffect(() => {
89
126
  if (ref.current) {
90
127
  const {
@@ -130,15 +167,17 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
130
167
  onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
131
168
  }) : null;
132
169
  };
170
+ const value = displayValue(valueProps);
133
171
  return jsx(Fragment, null, jsx("div", {
134
172
  ref: ref,
135
173
  css: _DropdownBoxRootCSS,
136
- className: classNames('DGN-UI-Dropdown-Box', className),
174
+ className: classNames('DGN-UI-Dropdown-Box', className, error && 'error'),
137
175
  style: style
138
176
  }, label ? jsx(Label, {
139
177
  ...labelProps
140
178
  }, label) : null, jsx(InputBase, {
141
179
  ...inputProps,
180
+ readOnly: !allowInput,
142
181
  style: inputStyle,
143
182
  viewType: viewType,
144
183
  inputRef: inputRef,
@@ -157,7 +196,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
157
196
  anchor: ref.current,
158
197
  width: popoverWidth,
159
198
  onClose: closeDropdownBox
160
- }, jsx(PopoverBody, null, children)));
199
+ }, jsx(PopoverBody, null, children)), ErrorView);
161
200
  }));
162
201
  const DropdownBoxRootCSS = (bgColorProp, {
163
202
  colors
@@ -166,6 +205,17 @@ const DropdownBoxRootCSS = (bgColorProp, {
166
205
  ${positionRelative};
167
206
  ${parseMinWidth(150)};
168
207
  ${parseHeight('max-content')};
208
+ &.error {
209
+ .DGN-UI-InputBase {
210
+ ${borderColor(getProp(colors, 'semantic/danger'))};
211
+ &::before {
212
+ ${borderColor(getProp(colors, 'semantic/danger'))};
213
+ }
214
+ &::after {
215
+ ${borderColor(getProp(colors, 'semantic/danger'))};
216
+ }
217
+ }
218
+ }
169
219
  .DGN-UI-InputBase {
170
220
  background: ${bgColorProp ? bgColorProp === true ? getProp(colors, 'fill/disabled') : bgColorProp : 'inherit'} !important;
171
221
  ${openState && css`
@@ -183,20 +233,6 @@ const DropdownBoxCSS = ({
183
233
  margin-top: ${spacing([1])};
184
234
  ${overflowHidden};
185
235
  `;
186
-
187
- // DropdownBox.defaultProps = {
188
- // className: '',
189
- // label: '',
190
- // placeholder: '',
191
- // startIcon: 'Search',
192
- // endIcon: 'ArrowDown',
193
- // openOnClickAt: 'icon',
194
- // viewType: 'underlined',
195
- // inputProps: {},
196
- // delayOnInput: 700,
197
- // zIndex: zIndexCORE(1),
198
- // };
199
-
200
236
  DropdownBox.propTypes = {
201
237
  /** class for dropdown */
202
238
  className: PropTypes.string,
@@ -233,6 +269,12 @@ DropdownBox.propTypes = {
233
269
  /** the function will run after open */
234
270
  onOpened: PropTypes.func,
235
271
  /** the function will run after close */
236
- onClosed: PropTypes.func
272
+ onClosed: PropTypes.func,
273
+ /** Error message displayed below the input. */
274
+ error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
275
+ /** If `true`, the component is disabled. */
276
+ disabled: PropTypes.bool,
277
+ /** If `true`, the input is enable. */
278
+ allowInput: PropTypes.bool
237
279
  };
238
280
  export default DropdownBox;
@@ -116,6 +116,7 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
116
116
  viewType,
117
117
  defaultValue,
118
118
  value,
119
+ fixedDecimalDigit,
119
120
  ...other
120
121
  } = props;
121
122
  const ref = useRef(null);
@@ -145,7 +146,7 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
145
146
  if (decimal && decimal.length > decimalDigit) {
146
147
  if (decimalDigit) {
147
148
  decimal = decimal.slice(0, decimalDigit);
148
- return number + decimalSymbol + decimal;
149
+ return parseValueWithFix(number + decimalSymbol + decimal);
149
150
  } else {
150
151
  return number;
151
152
  }
@@ -332,11 +333,24 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
332
333
  if (value === null) {
333
334
  inputRef.current.value = '';
334
335
  } else {
335
- const v = getValueWithDecimal(value.toString().replace('.', decimalSymbol));
336
+ let number = value;
337
+ if (fixedDecimalDigit && !!decimalDigit) {
338
+ var _strVal$split;
339
+ const strVal = String(value);
340
+ const isDecimalNum = strVal.indexOf('.') > -1 && (((_strVal$split = strVal.split('.')) === null || _strVal$split === void 0 ? void 0 : _strVal$split[1]) || '').length >= decimalDigit;
341
+ if (isDecimalNum) {
342
+ const coreToFixed = (num, precision) => {
343
+ return (+(Math.round(+(num + 'e' + precision)) + 'e' + -precision)).toFixed(precision);
344
+ };
345
+ const val = coreToFixed(Number(String(value).replace(thousandSeparator, '')), decimalDigit);
346
+ number = String(val);
347
+ }
348
+ }
349
+ const v = getValueWithDecimal(number.toString().replace('.', decimalSymbol));
336
350
  if (convertToWords && !decimalDigit && (disabled || readOnly)) {
337
351
  let valueConverted = getGlobal('helperInvalid');
338
- if (Number.isInteger(value)) {
339
- valueConverted = locale.get() === 'vi' ? num2WordsVi.convert(value) : num2WordsEn(value);
352
+ if (Number.isInteger(number)) {
353
+ valueConverted = locale.get() === 'vi' ? num2WordsVi.convert(number) : num2WordsEn(number);
340
354
  }
341
355
  inputRef.current.value = parseValueWithFix(valueConverted);
342
356
  } else {
@@ -345,11 +359,12 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
345
359
  }
346
360
  }
347
361
  }, [disabled, readOnly, value, prefix, suffix]);
348
- useEffect(() => {
349
- const valueInput = inputRef.current.value;
350
- inputRef.current.value = getValueWithDecimal(valueInput);
351
- }, [decimalDigit]);
352
- /* End handler */
362
+
363
+ // useEffect(() => {
364
+ // const valueInput = inputRef.current.value;
365
+ // inputRef.current.value = getValueWithDecimal(valueInput);
366
+ // }, [decimalDigit]);
367
+ // /* End handler */
353
368
 
354
369
  useImperativeHandle(reference, () => {
355
370
  const currentRef = ref.current || {};
@@ -478,10 +493,10 @@ MoneyInput.propTypes = {
478
493
  inputProps: PropTypes.object,
479
494
  /** style inline of input in MoneyInput component */
480
495
  inputStyle: PropTypes.object,
481
- /** validation value, argument can:<br/>
482
- * * string: the validation rule. Example required.<br/>
483
- * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
484
- * * array: the validation rule list, insist object/string
496
+ /** validation value, argument can:<br/>
497
+ * * string: the validation rule. Example required.<br/>
498
+ * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
499
+ * * array: the validation rule list, insist object/string
485
500
  */
486
501
  validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
487
502
  /** on key down function */
@@ -490,13 +505,13 @@ MoneyInput.propTypes = {
490
505
  onKeyUp: PropTypes.func,
491
506
  /** on input function */
492
507
  onInput: PropTypes.func,
493
- /**
494
- * on change function, return an object:<br/>
495
- * {<br/>
496
- * &nbsp;&nbsp;&nbsp;&nbsp;value: is a number or null value<br/>
497
- * &nbsp;&nbsp;&nbsp;&nbsp;target.value: value of input<br/>
498
- * &nbsp;&nbsp;&nbsp;&nbsp;...element<br/>
499
- * }
508
+ /**
509
+ * on change function, return an object:<br/>
510
+ * {<br/>
511
+ * &nbsp;&nbsp;&nbsp;&nbsp;value: is a number or null value<br/>
512
+ * &nbsp;&nbsp;&nbsp;&nbsp;target.value: value of input<br/>
513
+ * &nbsp;&nbsp;&nbsp;&nbsp;...element<br/>
514
+ * }
500
515
  */
501
516
  onChange: PropTypes.func,
502
517
  /** on blur function */
@@ -508,6 +523,8 @@ MoneyInput.propTypes = {
508
523
  /** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label) of label. */
509
524
  labelProps: PropTypes.object,
510
525
  /** [Props](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) of helper text. */
511
- helperTextProps: PropTypes.object
526
+ helperTextProps: PropTypes.object,
527
+ /** If `true`, decimal digit is fixed. */
528
+ fixedDecimalDigit: PropTypes.bool
512
529
  };
513
530
  export default MoneyInput;
@@ -49,7 +49,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
49
49
  labelProps,
50
50
  max: maxProp,
51
51
  maxDigit,
52
- min,
52
+ min: minProp,
53
53
  nonStyle,
54
54
  onBlur,
55
55
  onChange,
@@ -69,9 +69,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
69
69
  viewType
70
70
  } = props;
71
71
  let max = maxProp;
72
+ let min = minProp;
72
73
  let thousandSymbol = thousandSeparator;
73
74
  let decimalSymbol = decimalSymbolProp;
74
75
  let valueProps = valueProp;
76
+ if (!min && min !== 0) min = -Infinity;
77
+ if (!max && max !== 0) max = Infinity;
75
78
  const pos = useRef(null);
76
79
  const ref = useRef(null);
77
80
  const globalRef = useRef({});
@@ -111,6 +114,18 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
111
114
  }
112
115
  } = inputRef;
113
116
  let number = convertMoneyToNumber(vl, isNumber);
117
+ if (fixedDecimalDigit && !!decimalDigit) {
118
+ var _strVal$split;
119
+ const strVal = String(vl);
120
+ const isDecimalNum = strVal.indexOf('.') > -1 && (((_strVal$split = strVal.split('.')) === null || _strVal$split === void 0 ? void 0 : _strVal$split[1]) || '').length >= decimalDigit;
121
+ if (isDecimalNum) {
122
+ const coreToFixed = (num, precision) => {
123
+ return (+(Math.round(+(num + 'e' + precision)) + 'e' + -precision)).toFixed(precision);
124
+ };
125
+ const val = coreToFixed(Number(String(vl).replaceAll(thousandSymbol, '')), decimalDigit);
126
+ number = String(val);
127
+ }
128
+ }
114
129
 
115
130
  // if (disabledNegative && Number(number || 0) < 0) number = clamp(number, min, max);
116
131
  // if (typeof max !== 'undefined' && Number(number) > max) number = Math.min(number, max);
@@ -134,15 +149,6 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
134
149
  if (((_number3 = number) === null || _number3 === void 0 ? void 0 : _number3.indexOf(thousandSymbol)) > -1 && selectionStart !== number.length + 1) {
135
150
  pos.current = selectionStart + (number.toString().length - 1 === vl.toString().length ? 1 : 0);
136
151
  }
137
- if (fixedDecimalDigit && !!decimalDigit) {
138
- var _strVal$split;
139
- const strVal = String(vl);
140
- const isDecimalNum = strVal.indexOf('.') > -1 && (((_strVal$split = strVal.split('.')) === null || _strVal$split === void 0 ? void 0 : _strVal$split[1]) || '').length >= decimalDigit;
141
- if (isDecimalNum) {
142
- const val = Number(vl).toFixed(decimalDigit);
143
- number = String(val);
144
- }
145
- }
146
152
  return number;
147
153
  }, [decimalSymbol, max, value, decimalDigit, fixedDecimalDigit]);
148
154
 
@@ -178,7 +184,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
178
184
  if (flag) _onChange(e);
179
185
  }, [min, max, decimalDigit]);
180
186
  const _onBlur = useCallback(e => {
181
- var _e$value;
187
+ var _e$value, _e$value2;
182
188
  let value = (_e$value = e.value) !== null && _e$value !== void 0 ? _e$value : e.target.value;
183
189
  if (fixedDecimalDigit) value = Number(value).toFixed(decimalDigit);
184
190
  value = convertMoneyToNumber(value);
@@ -190,6 +196,15 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
190
196
  target
191
197
  }, true);
192
198
  }
199
+ if (((_e$value2 = e.value) !== null && _e$value2 !== void 0 ? _e$value2 : e.target.value).slice(-1) === decimalSymbol) {
200
+ var _e$value3;
201
+ const target = e.target;
202
+ target.value = Number(String((_e$value3 = e.value) !== null && _e$value3 !== void 0 ? _e$value3 : e.target.value).replaceAll(thousandSymbol, ''));
203
+ _onInput({
204
+ ...e,
205
+ target
206
+ }, true);
207
+ }
193
208
  onBlur && onBlur(e);
194
209
  }, [min, max]);
195
210
  const _onKeyDown = e => {
@@ -280,6 +295,10 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
280
295
  const target = e.target;
281
296
  target.value = globalRef.current.valueString;
282
297
  target.valueString = globalRef.current.returnValue;
298
+ // eslint-disable-next-line no-extra-boolean-cast
299
+ if (String(e.target.valueString).slice(-1) === decimalSymbol) {
300
+ return;
301
+ }
283
302
  onChange({
284
303
  ...e,
285
304
  value: globalRef.current.value,
@@ -315,8 +334,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
315
334
  // nếu không cho nhập số âm mà value đầu vào là âm thì reset value về 0
316
335
  valueProps = clamp(0, min, max);
317
336
  }
318
-
319
- // setValue(parseNumberToMoney(valueProps?.toString().replace(regexValidNumber, ''), true));
337
+ // setValue(valueProps);
320
338
  setValue(parseNumberToMoney((_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.toString().replace(regexValidNumber, ''), true));
321
339
  }
322
340
  }, [valueProps, decimalDigit]);
@@ -384,29 +402,28 @@ const NumberInputRootCSS = ({
384
402
  ${cursorNotAllowed};
385
403
  }
386
404
  `;
387
-
388
- // NumberInput.defaultProps = {
389
- // autoFocus: false,
390
- // className: '',
391
- // decimalDigit: Infinity,
392
- // decimalSymbol: locale.get() === 'vi' ? ',' : '.',
393
- // disabled: false,
394
- // disabledNegative: false,
395
- // endIcon: '',
396
- // error: '',
397
- // fixedDecimalDigit: false,
398
- // label: '',
399
- // max: Infinity,
400
- // min: -Infinity,
401
- // readOnly: false,
402
- // required: false,
403
- // startIcon: '',
404
- // step: 1,
405
- // style: {},
406
- // thousandSeparator: false,
407
- // viewType: 'underlined',
408
- // };
409
-
405
+ NumberInput.defaultProps = {
406
+ // delayOnChange: 500,
407
+ // autoFocus: false,
408
+ // className: '',
409
+ // decimalDigit: Infinity,
410
+ // decimalSymbol: locale.get() === 'vi' ? ',' : '.',
411
+ // disabled: false,
412
+ // disabledNegative: false,
413
+ // endIcon: '',
414
+ // error: '',
415
+ // fixedDecimalDigit: false,
416
+ // label: '',
417
+ // max: Infinity,
418
+ // min: -Infinity,
419
+ // readOnly: false,
420
+ // required: false,
421
+ // startIcon: '',
422
+ // step: 1,
423
+ // style: {},
424
+ // thousandSeparator: false,
425
+ // viewType: 'underlined',
426
+ };
410
427
  NumberInput.propTypes = {
411
428
  /** If `true`, the input element is focused during the first mount. */
412
429
  autoFocus: PropTypes.bool,
@@ -533,22 +533,22 @@ PagingInfo.propTypes = {
533
533
  onChangePage: PropTypes.func,
534
534
  /** Callback fired when quantity on per page changed. */
535
535
  onChangePerPage: PropTypes.func,
536
- /**
537
- * Callback fired when page number is changing.
538
- *
539
- * * prevPage: Page before changed
540
- * * newPage: Page after changed
541
- * * cancel(value): Function cancel change page
542
- * * @param {value} - bool
536
+ /**
537
+ * Callback fired when page number is changing.
538
+ *
539
+ * * prevPage: Page before changed
540
+ * * newPage: Page after changed
541
+ * * cancel(value): Function cancel change page
542
+ * * @param {value} - bool
543
543
  */
544
544
  onChangingPage: PropTypes.func,
545
- /**
546
- * Callback fired when quantity on item per page is changing.
547
- *
548
- * * prevPerPage: Items per page before changed
549
- * * newPerPage: Items per page after changed
550
- * * cancel(value): Function cancel change items per page
551
- * * @param {value} - bool
545
+ /**
546
+ * Callback fired when quantity on item per page is changing.
547
+ *
548
+ * * prevPerPage: Items per page before changed
549
+ * * newPerPage: Items per page after changed
550
+ * * cancel(value): Function cancel change items per page
551
+ * * @param {value} - bool
552
552
  */
553
553
  onChangingPerPage: PropTypes.func,
554
554
  /** Style inline of component. */
@@ -557,26 +557,26 @@ PagingInfo.propTypes = {
557
557
  totalItems: PropTypes.number,
558
558
  /** Compact type for mobile. */
559
559
  typeShort: PropTypes.bool
560
- /**
561
- * ref methods (ref.current.instance.*method*)
562
- *
563
- * * onChangePage(page): Change page number
564
- * * @param {page} - number
565
- * * onChangePerPage(per): Change quantity on per page
566
- * * @param {per} - number
567
- * * setTotalItems(items): Set total items
568
- * * @param {items} - number
569
- *
570
- * * option(): Gets all UI component properties
571
- * * Returns value - object
572
- * * option(optionName): Gets the value of a single property
573
- * * @param {optionName} - string
574
- * * Returns value - any
575
- * * option(optionName, optionValue): Updates the value of a single property
576
- * * @param {optionName} - string
577
- * * @param {optionValue} - any
578
- * * option(options): Updates the values of several properties
579
- * * @param {options} - object
560
+ /**
561
+ * ref methods (ref.current.instance.*method*)
562
+ *
563
+ * * onChangePage(page): Change page number
564
+ * * @param {page} - number
565
+ * * onChangePerPage(per): Change quantity on per page
566
+ * * @param {per} - number
567
+ * * setTotalItems(items): Set total items
568
+ * * @param {items} - number
569
+ *
570
+ * * option(): Gets all UI component properties
571
+ * * Returns value - object
572
+ * * option(optionName): Gets the value of a single property
573
+ * * @param {optionName} - string
574
+ * * Returns value - any
575
+ * * option(optionName, optionValue): Updates the value of a single property
576
+ * * @param {optionName} - string
577
+ * * @param {optionValue} - any
578
+ * * option(options): Updates the values of several properties
579
+ * * @param {options} - object
580
580
  */
581
581
  };
582
582
  export { PagingInfo };
@@ -37,7 +37,6 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
37
37
  expand,
38
38
  expandIcon,
39
39
  id,
40
- isInDropdown,
41
40
  multiple,
42
41
  multipleValueMode,
43
42
  onChange,
@@ -70,7 +69,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
70
69
  allowNumber: false,
71
70
  allowSymbol: false
72
71
  }));
73
- const _TreeViewRootCSS = TreeViewRootCSS(theme, isInDropdown);
72
+ const _TreeViewRootCSS = TreeViewRootCSS(theme);
74
73
  const determinateCheckbox = (input, determinate) => {
75
74
  if (multipleValueMode === 'multiple' || disabledRelevantValue) {
76
75
  input.classList[determinate ? 'add' : 'remove']('determinate');
@@ -620,7 +619,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
620
619
  return jsx("div", {
621
620
  className: classNames('TreeView-Item', 'non-child', focusClass),
622
621
  style: {
623
- paddingLeft: 34 + 16 * level
622
+ paddingLeft: multipleValueMode === 'single' ? 16 : 34 + 16 * level
624
623
  },
625
624
  onClick: multiple || selectBox || onChange ? e => onClickHandler(e, data) : undefined,
626
625
  key: index,
@@ -794,7 +793,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
794
793
  const TreeViewRootCSS = ({
795
794
  colors,
796
795
  spacing
797
- }, isInDropdown) => css`
796
+ }) => css`
798
797
  ${displayBlock};
799
798
  ${positionRelative};
800
799
  .DGN-UI-Accordion {
@@ -834,7 +833,7 @@ const TreeViewRootCSS = ({
834
833
  .TreeView-Content {
835
834
  ${displayBlock};
836
835
  ${positionRelative};
837
- ${isInDropdown && parseMaxHeight(240)};
836
+ ${parseMaxHeight(240)};
838
837
  ${overflowYScroll};
839
838
  &::-webkit-scrollbar {
840
839
  ${borderRadius(4)};
package/package.json CHANGED
@@ -1,44 +1,78 @@
1
- {
2
- "name": "diginet-core-ui",
3
- "version": "1.4.52",
4
- "description": "The DigiNet core ui",
5
- "homepage": "https://diginet.com.vn",
6
- "main": "index.js",
7
- "scripts": {
8
- "start-js": "react-scripts start --max_old_space_size=4096",
9
- "start": "npx npm-run-all -p start-js",
10
- "build": "GENERATE_SOURCEMAP=false && react-scripts build --env=production --max_old_space_size=8192",
11
- "eject": "react-scripts eject",
12
- "test": "echo \"Error: no test specified\" && exit 1"
13
- },
14
- "dependencies": {
15
- "@emotion/core": "^10.0.35",
16
- "prop-types": "^15.7.2",
17
- "@emotion/css": "^11.11.0",
18
- "@emotion/react": "^11.10.6"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://diginetvn@bitbucket.org/diginetvn/diginet-core-ui.git"
23
- },
24
- "keywords": [
25
- "core ui",
26
- "diginet"
27
- ],
28
- "author": "rocachien",
29
- "contributors": [
30
- {
31
- "name": "Chien Do",
32
- "email": "rocachien@gmail.com"
33
- },
34
- {
35
- "name": "Nhat Tran",
36
- "email": "tranminhnhat1005@gmail.com"
37
- },
38
- {
39
- "name": "Thuan Nguyen",
40
- "email": "nt.thuan.hutech@gmail.com"
41
- }
42
- ],
43
- "license": "MIT"
44
- }
1
+ {
2
+ "name": "diginet-core-ui",
3
+ "version": "1.4.53-beta.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "license": "UNLICENSED",
7
+ "scripts": {
8
+ "start": "npm-run-all --parallel start-sb eslint-test",
9
+ "start-sb": "start-storybook -p 9050",
10
+ "build-storybook": "build-storybook -c .storybook -s src",
11
+ "build": "run-script-os",
12
+ "build:windows": "rimraf dist && mkdirp dist/components && npm run compile && sass --style=compressed src/scss:dist/css && xcopy src\\\\assets dist\\\\assets\\ /e /y",
13
+ "build:darwin:linux:default": "rm -rf dist && npm run compile && sass --style=compressed src/scss:dist/css && cp -rf src/assets dist/assets",
14
+ "compile": "babel src --out-dir dist --ignore **/*.stories.js",
15
+ "pack": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm pack",
16
+ "production-keep-version": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish",
17
+ "beta": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish --tag beta",
18
+ "production": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm publish",
19
+ "version:add": "run-script-os",
20
+ "version:add:windows": "cat package.json.tmp | sed \"s/0.0.0/%npm_package_version%/g\" > dist/package.json",
21
+ "version:add:darwin:linux:default": "VERSION=$(npm run version:extract --silent) && cat package.json.tmp | sed \"s/0.0.0/${VERSION}/g\" > dist/package.json",
22
+ "version:bump": "npm version patch --no-git-tag-version --silent",
23
+ "version:extract": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'",
24
+ "test": "echo \"Error: no test specified\" && exit 1",
25
+ "lint": "eslint --fix --config .eslintrc.js \"**/*.js\"",
26
+ "eslint-test": "onchange \"src/**/*.{js,jsx,json}\" -- eslint . --fix",
27
+ "freshtall": "npm cache clean --force && rm -rf node_modules && rm -f package-lock.json && npm install",
28
+ "test-storybook": "test-storybook --url http://localhost:9050",
29
+ "preinstall": "echo {} > package-lock.json"
30
+ },
31
+ "dependencies": {
32
+ "@emotion/core": "^10.0.35",
33
+ "@emotion/css": "^11.11.0",
34
+ "@emotion/react": "^11.10.6",
35
+ "babel-plugin-module-resolver": "^4.1.0",
36
+ "date-fns": "^2.30.0",
37
+ "prop-types": "^15.7.2"
38
+ },
39
+ "lint-staged": {
40
+ "*/**/*.{js,jsx,json}": [
41
+ "prettier --write",
42
+ "git add"
43
+ ]
44
+ },
45
+ "devDependencies": {
46
+ "@babel/cli": "^7.14.3",
47
+ "@babel/plugin-proposal-class-properties": "^7.13.0",
48
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.16.0",
49
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
50
+ "@babel/plugin-proposal-optional-chaining": "^7.14.2",
51
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
52
+ "@babel/plugin-proposal-private-property-in-object": "^7.18.6",
53
+ "@babel/preset-react": "^7.13.13",
54
+ "@storybook/addon-actions": "6.2.9",
55
+ "@storybook/addon-essentials": "6.2.9",
56
+ "@storybook/addon-links": "6.2.9",
57
+ "@storybook/addon-postcss": "^2.0.0",
58
+ "@storybook/react": "6.2.9",
59
+ "@storybook/test-runner": "^0.7.1",
60
+ "autoprefixer": "^10.3.1",
61
+ "babel-loader": "^8.2.2",
62
+ "eslint": "^8.4.1",
63
+ "eslint-plugin-react": "^7.27.1",
64
+ "eslint-plugin-regex": "^1.10.0",
65
+ "husky": "^7.0.4",
66
+ "jest": "^27.5.1",
67
+ "lint-staged": "^12.1.2",
68
+ "mkdirp": "^1.0.4",
69
+ "npm-run-all": "^4.1.5",
70
+ "onchange": "^7.1.0",
71
+ "postcss-flexbugs-fixes": "^5.0.2",
72
+ "react": "^17.0.1",
73
+ "react-dom": "^17.0.1",
74
+ "rimraf": "^3.0.2",
75
+ "run-script-os": "^1.1.6",
76
+ "sass": "1.58.3"
77
+ }
78
+ }
package/readme.md CHANGED
@@ -42,6 +42,13 @@ npm test
42
42
 
43
43
  ## Changelog
44
44
 
45
+ ## 1.4.53
46
+ - \[Added\]: Icon – Add IconMenu MHRP09N0036, MHRP09N0037
47
+ - \[Added\]: Icon – Add IconMenu MHRP25N0009
48
+ - \[Fixed\]: Treeview - Fix bug Treeview keeps the search bar visible while scrolling
49
+ - \[Fixed\]: NumberInput – NumberInput Core when changing 'decimalDigit'
50
+ - \[Fixed\]: Attachment – Fix the issue where the attachment cannot be deleted when clicking outside the Attachment popup
51
+
45
52
  ## 1.4.52
46
53
  - \[Fixed\]: DropDown - Fix bug search data in Dropdown
47
54
  - \[Fixed\]: NumberInput – NumberInput Core when changing 'decimalDigit'