diginet-core-ui 1.3.73 → 1.3.75

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.
Files changed (58) hide show
  1. package/assets/images/menu/dhr/MHRP29N0026.svg +13 -0
  2. package/assets/images/menu/dhr/MHRP29N0027.svg +14 -0
  3. package/assets/images/menu/dhr/MHRP29N0028.svg +15 -0
  4. package/components/accordion/details.js +19 -10
  5. package/components/accordion/group.js +15 -6
  6. package/components/accordion/index.js +20 -11
  7. package/components/accordion/summary.js +18 -9
  8. package/components/avatar/index.js +20 -20
  9. package/components/badge/index.js +17 -9
  10. package/components/button/icon.js +33 -25
  11. package/components/button/index.js +25 -17
  12. package/components/card/body.js +12 -4
  13. package/components/card/extra.js +12 -4
  14. package/components/card/footer.js +12 -4
  15. package/components/card/header.js +12 -4
  16. package/components/card/index.js +12 -4
  17. package/components/chip/index.js +6 -6
  18. package/components/form-control/attachment/index.js +197 -192
  19. package/components/form-control/date-picker/index.js +4 -2
  20. package/components/form-control/date-range-picker/index.js +21 -14
  21. package/components/form-control/dropdown/index.js +69 -48
  22. package/components/form-control/input-base/index.js +505 -483
  23. package/components/form-control/label/index.js +27 -21
  24. package/components/form-control/text-input/index.js +8 -5
  25. package/components/grid/Col.js +8 -7
  26. package/components/grid/Container.js +16 -15
  27. package/components/grid/Row.js +16 -15
  28. package/components/grid/index.js +17 -36
  29. package/components/image/index.js +164 -0
  30. package/components/index.js +3 -1
  31. package/components/modal/body.js +12 -9
  32. package/components/modal/footer.js +22 -11
  33. package/components/modal/header.js +25 -13
  34. package/components/modal/index.js +32 -30
  35. package/components/modal/modal.js +29 -25
  36. package/components/others/option-wrapper/index.js +5 -18
  37. package/components/paging/page-info.js +45 -33
  38. package/components/paging/page-selector2.js +45 -33
  39. package/components/popover/body.js +14 -6
  40. package/components/popover/footer.js +15 -6
  41. package/components/popover/header.js +17 -7
  42. package/components/popover/index.js +262 -129
  43. package/components/status/index.js +12 -4
  44. package/components/tab/tab-container.js +29 -27
  45. package/components/tab/tab-header.js +35 -30
  46. package/components/tab/tab-panel.js +31 -27
  47. package/components/tab/tab.js +47 -37
  48. package/components/tree-view/index.js +146 -111
  49. package/components/typography/index.js +47 -36
  50. package/icons/basic.js +248 -0
  51. package/icons/effect.js +44 -36
  52. package/package.json +1 -1
  53. package/readme.md +43 -0
  54. package/styles/general.js +34 -11
  55. package/theme/index.js +1 -1
  56. package/theme/set-theme.js +5 -4
  57. package/utils/index.js +13 -10
  58. package/utils/useMediaQuery.js +4 -2
@@ -38,6 +38,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
38
38
  readOnly,
39
39
  required,
40
40
  returnFormat,
41
+ showUnitCount,
41
42
  startFromZero,
42
43
  style,
43
44
  textAlign,
@@ -462,8 +463,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
462
463
  tableData = [],
463
464
  weekDateFirst = getDateOfWeek(firstDay),
464
465
  weekDateLast = getDateOfWeek(lastDay);
465
- /**
466
- * days of previous month
466
+ /**
467
+ * days of previous month
467
468
  */
468
469
 
469
470
  for (let i = weekDateFirst; i > 0; i--) {
@@ -476,8 +477,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
476
477
  className: unique.day.day
477
478
  })));
478
479
  }
479
- /**
480
- * days of current month
480
+ /**
481
+ * days of current month
481
482
  */
482
483
 
483
484
 
@@ -491,8 +492,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
491
492
  }, jsx(Typography, { ...typographyProps(unique.day.day)
492
493
  }, i + 1)));
493
494
  }
494
- /**
495
- * days of next month
495
+ /**
496
+ * days of next month
496
497
  */
497
498
 
498
499
 
@@ -595,11 +596,11 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
595
596
  }
596
597
  }
597
598
 
598
- const trueWidth = width > 320 ? width < 633 ? 633 : width : 320;
599
+ const pickerWidth = window.innerWidth <= 633 ? 300 : 633;
599
600
 
600
- if (left + trueWidth > innerWidth) {
601
- if (innerWidth > trueWidth) {
602
- style.left = (innerWidth - trueWidth) / 2;
601
+ if (left + pickerWidth > innerWidth) {
602
+ if (innerWidth > pickerWidth) {
603
+ style.left = (innerWidth - pickerWidth) / 2;
603
604
  }
604
605
  }
605
606
 
@@ -1003,9 +1004,9 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1003
1004
 
1004
1005
  if (!reset) {
1005
1006
  if (unshift) {
1006
- tempValue = formatValue(time, displayFormat) + ' - ' + el.value + ` (${selected.current} ${enUnitText})`;
1007
+ tempValue = formatValue(time, displayFormat) + ' - ' + el.value + (showUnitCount ? ` (${selected.current} ${enUnitText})` : '');
1007
1008
  } else {
1008
- tempValue = el.value + ' - ' + formatValue(time, displayFormat) + ` (${selected.current} ${enUnitText})`;
1009
+ tempValue = el.value + ' - ' + formatValue(time, displayFormat) + (showUnitCount ? ` (${selected.current} ${enUnitText})` : '');
1009
1010
  }
1010
1011
  } else {
1011
1012
  tempValue = formatValue(time, displayFormat);
@@ -1189,8 +1190,10 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1189
1190
  disabled: disabled,
1190
1191
  required: required
1191
1192
  }, label), jsx(InputBase, {
1192
- placeholder: placeholder,
1193
- ...inputProps,
1193
+ inputProps: {
1194
+ placeholder: !readOnly && !disabled ? placeholder : '',
1195
+ ...inputProps
1196
+ },
1194
1197
  readOnly: true,
1195
1198
  ref: ipConRef,
1196
1199
  inputRef: ipRef,
@@ -1224,6 +1227,7 @@ DateRangePickerV2.defaultProps = {
1224
1227
  startFromZero: false,
1225
1228
  textAlign: 'start',
1226
1229
  returnFormat: 'YYYY-MM-DD',
1230
+ showUnitCount: true,
1227
1231
  viewType: 'underlined'
1228
1232
  };
1229
1233
  DateRangePickerV2.propTypes = {
@@ -1287,6 +1291,9 @@ DateRangePickerV2.propTypes = {
1287
1291
  /** format of the returned value */
1288
1292
  returnFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
1289
1293
 
1294
+ /** If `true`, show unit count. */
1295
+ showUnitCount: PropTypes.bool,
1296
+
1290
1297
  /** counter with start with 0 or 1 */
1291
1298
  startFromZero: PropTypes.bool,
1292
1299
 
@@ -49,7 +49,8 @@ const timing = {},
49
49
  isSearch = {},
50
50
  allValue = {};
51
51
  const separatorPattern = /\{\w+\}/g;
52
- const regexBetween = /[^{\}]+(?=})/g;
52
+ const regexBetween = /[^{\}]+(?=})/g; // eslint-disable-line
53
+
53
54
  const regexInclude = /{|}/g;
54
55
 
55
56
  const checkHasValue = value => {
@@ -233,7 +234,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
233
234
  css: _DropdownListCSS,
234
235
  ref: dropdownListRef,
235
236
  className: 'DGN-Dropdown-List'
236
- }, children) : itemMode === 'normal' ? mapDropdown(null, keyArr) : mapTreeView();
237
+ }, dataSource !== null && dataSource !== void 0 && dataSource.length ? children : EmptyDataText) : itemMode === 'normal' ? mapDropdown(null, keyArr) : mapTreeView();
237
238
  const {
238
239
  innerHeight
239
240
  } = window;
@@ -551,10 +552,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
551
552
  css: _DropdownListCSS,
552
553
  ref: dropdownListRef,
553
554
  className: 'DGN-Dropdown-List'
554
- }, items !== null && items !== void 0 && items.length ? items : jsx("div", {
555
- css: _DropdownItemCSS,
556
- className: 'no-data'
557
- }, ' ', noDataText, ' '));
555
+ }, items !== null && items !== void 0 && items.length ? items : EmptyDataText);
558
556
  };
559
557
 
560
558
  const mapTreeView = () => {
@@ -563,7 +561,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
563
561
  css: _DropdownListCSS,
564
562
  ref: dropdownListRef,
565
563
  className: 'DGN-Dropdown-List'
566
- }, jsx(TreeView, {
564
+ }, dataSource !== null && dataSource !== void 0 && dataSource.length ? jsx(TreeView, {
567
565
  dataSource: dataSource,
568
566
  displayExpr: displayExpr,
569
567
  valueExpr: valueExpr,
@@ -580,7 +578,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
580
578
  value: typeof currentValue[unique] === 'string' ? [currentValue[unique]] : currentValue[unique],
581
579
  onChange: (e, value) => onChangeValue('', multiple ? value : e.value),
582
580
  renderItem: renderItem
583
- })); // }
581
+ }) : EmptyDataText); // }
584
582
  // return treeView[unique];
585
583
  };
586
584
 
@@ -896,6 +894,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
896
894
  value,
897
895
  data
898
896
  });
897
+ } else {
898
+ // Fix lost icon when select same value
899
+ triggerBlur(false);
899
900
  }
900
901
  }
901
902
 
@@ -917,6 +918,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
917
918
  const onRemove = (e, value) => {
918
919
  var _ref;
919
920
 
921
+ if (readOnly || disabled) return;
920
922
  const index = currentValue[unique].findIndex(v => JSON.stringify(v) === JSON.stringify(value));
921
923
 
922
924
  if (index !== -1) {
@@ -1087,7 +1089,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1087
1089
  };
1088
1090
 
1089
1091
  const setSingleValueHandler = (data, keyArr) => {
1090
- const text = keyArr ? renderData(data, keyArr) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr || valueExpr] || data;
1092
+ const text = keyArr ? renderData(data, keyArr) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr] || data[valueExpr] || data;
1091
1093
 
1092
1094
  if (typeof renderSelectedItem === 'function') {
1093
1095
  inputRef.current.innerHTML = '';
@@ -1158,8 +1160,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1158
1160
  return currentRef;
1159
1161
  });
1160
1162
  useEffect(() => {
1161
- setShowClear(clearAble && checkHasValue(valueProp) && !disabled && !readOnly && !loading);
1162
- }, [clearAble, valueProp, disabled, readOnly, loading]);
1163
+ setShowClear(clearAble && checkHasValue(valueProp !== null && valueProp !== void 0 ? valueProp : defaultValue) && !disabled && !readOnly && !loading);
1164
+ }, [clearAble, valueProp, defaultValue, disabled, readOnly, loading]);
1163
1165
  useEffect(() => {
1164
1166
  if (valueObjectDefault) {
1165
1167
  if (Array.isArray(valueObjectDefault)) {
@@ -1211,6 +1213,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1211
1213
 
1212
1214
  if (multiple && valueProp) {
1213
1215
  setValueMulti(!Array.isArray(valueProp) ? [valueProp] : valueProp);
1216
+ } // Close dropdown treeview by children when select item
1217
+
1218
+
1219
+ if (children && (closeAfterSelect === true || closeAfterSelect === undefined && !multiple)) {
1220
+ closeDropdown();
1214
1221
  }
1215
1222
  }, [valueProp]);
1216
1223
  useEffect(() => {
@@ -1312,6 +1319,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1312
1319
 
1313
1320
  /* Start component */
1314
1321
 
1322
+ const EmptyDataText = jsx("div", {
1323
+ css: _DropdownItemCSS,
1324
+ className: 'no-data'
1325
+ }, ' ', noDataText, ' ');
1315
1326
  const LabelView = useMemo(() => label ? jsx(Label, {
1316
1327
  required: required,
1317
1328
  disabled: disabled,
@@ -1361,7 +1372,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1361
1372
  if (data) {
1362
1373
  var _displayExpr4;
1363
1374
 
1364
- const mask = (_displayExpr4 = displayExpr) === null || _displayExpr4 === void 0 ? void 0 : _displayExpr4.replace(regexBetween, _ => data[_]);
1375
+ const mask = (data === null || data === void 0 ? void 0 : data[displayExpr]) || ((_displayExpr4 = displayExpr) === null || _displayExpr4 === void 0 ? void 0 : _displayExpr4.replace(regexBetween, _ => data[_]));
1365
1376
  text = mask === null || mask === void 0 ? void 0 : mask.replace(regexInclude, '');
1366
1377
  }
1367
1378
 
@@ -1379,7 +1390,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1379
1390
  label: text,
1380
1391
  size: 'medium',
1381
1392
  disabled: disabled,
1382
- clearAble: true,
1393
+ clearAble: !readOnly && !disabled,
1383
1394
  onRemove: e => onRemove(e, vl)
1384
1395
  });
1385
1396
  }
@@ -1562,6 +1573,9 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
1562
1573
  span:empty:before {
1563
1574
  content: '${placeholder}';
1564
1575
  color: ${sub};
1576
+ height: 100%;
1577
+ ${flexRow};
1578
+ ${alignCenter};
1565
1579
  }
1566
1580
  &::placeholder {
1567
1581
  color: ${sub};
@@ -1611,6 +1625,13 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
1611
1625
  transform: rotateX(180deg);
1612
1626
  }
1613
1627
  }
1628
+ span:empty:before {
1629
+ content: '${placeholder}';
1630
+ color: ${sub};
1631
+ height: 100%;
1632
+ ${flexRow};
1633
+ ${alignCenter};
1634
+ }
1614
1635
  &::placeholder {
1615
1636
  color: ${sub};
1616
1637
  }
@@ -1829,14 +1850,14 @@ Dropdown.propTypes = {
1829
1850
  /** The icon to display if not found the icon follow `iconExpr`. */
1830
1851
  iconDefault: PropTypes.string,
1831
1852
 
1832
- /** Field name used for icon display.<br/>
1833
- * Example:<br/>
1834
- * &nbsp;&nbsp;string: 'icon'<br/>
1835
- * &nbsp;&nbsp;object: {<br/>
1836
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1837
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1838
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1839
- * &nbsp;&nbsp;}
1853
+ /** Field name used for icon display.<br/>
1854
+ * Example:<br/>
1855
+ * &nbsp;&nbsp;string: 'icon'<br/>
1856
+ * &nbsp;&nbsp;object: {<br/>
1857
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1858
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1859
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1860
+ * &nbsp;&nbsp;}
1840
1861
  */
1841
1862
  iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
1842
1863
  key: PropTypes.string,
@@ -1851,9 +1872,9 @@ Dropdown.propTypes = {
1851
1872
  /** The displayed value of component. */
1852
1873
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1853
1874
 
1854
- /** Field name used for text display in dropdown list.<br/>
1855
- * Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
1856
- * Note: don't use 'id - name', return undefined
1875
+ /** Field name used for text display in dropdown list.<br/>
1876
+ * Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
1877
+ * Note: don't use 'id - name', return undefined
1857
1878
  */
1858
1879
  displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1859
1880
 
@@ -1863,10 +1884,10 @@ Dropdown.propTypes = {
1863
1884
  /** The field name used for the returned result. */
1864
1885
  valueExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
1865
1886
 
1866
- /**
1867
- * Duration wait enter search content on search.<br/>
1868
- * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1869
- * If `true`, used default delayOnInput.
1887
+ /**
1888
+ * Duration wait enter search content on search.<br/>
1889
+ * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1890
+ * If `true`, used default delayOnInput.
1870
1891
  */
1871
1892
  searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
1872
1893
 
@@ -1933,19 +1954,19 @@ Dropdown.propTypes = {
1933
1954
  /** The array of elements that appear in the dropdown list. */
1934
1955
  dataSource: PropTypes.array,
1935
1956
 
1936
- /** Function displays items by custom.<br/>
1937
- * renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
1938
- * --> such as: displayExpr={'name - role'}
1957
+ /** Function displays items by custom.<br/>
1958
+ * renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
1959
+ * --> such as: displayExpr={'name - role'}
1939
1960
  */
1940
1961
  renderItem: PropTypes.func,
1941
1962
 
1942
- /** Function or field name used for display selected items, example:<br/>
1943
- * renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
1963
+ /** Function or field name used for display selected items, example:<br/>
1964
+ * renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
1944
1965
  */
1945
1966
  renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
1946
1967
 
1947
- /** Callback fired when the input value changes.<br/>
1948
- * if undefined: the filter function will run (default)
1968
+ /** Callback fired when the input value changes.<br/>
1969
+ * if undefined: the filter function will run (default)
1949
1970
  */
1950
1971
  onInput: PropTypes.func,
1951
1972
 
@@ -1976,19 +1997,19 @@ Dropdown.propTypes = {
1976
1997
  /** If `true`, show multi-line selected item(s). */
1977
1998
  multilineSelectedItem: PropTypes.bool,
1978
1999
 
1979
- /**
1980
- * ref methods
1981
- *
1982
- * how to get component element? ref.current
1983
- *
1984
- * how to call method? ref.current.instance.{method}
1985
- *
1986
- * * showDropdown(): Show dropdown
1987
- * * closeDropdown(): Close dropdown
1988
- * * onClear(): Clear selected value
1989
- * * setPreviousValue(): Set value to previous value
1990
- * * setValue(value): Set value of dropdown
1991
- * * @param {value} - string || number || array
2000
+ /**
2001
+ * ref methods
2002
+ *
2003
+ * how to get component element? ref.current
2004
+ *
2005
+ * how to call method? ref.current.instance.{method}
2006
+ *
2007
+ * * showDropdown(): Show dropdown
2008
+ * * closeDropdown(): Close dropdown
2009
+ * * onClear(): Clear selected value
2010
+ * * setPreviousValue(): Set value to previous value
2011
+ * * setValue(value): Set value of dropdown
2012
+ * * @param {value} - string || number || array
1992
2013
  */
1993
2014
  reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
1994
2015
  current: PropTypes.instanceOf(Element)