diginet-core-ui 1.3.73 → 1.3.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +1 -1
  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 +15 -8
  21. package/components/form-control/dropdown/index.js +34 -13
  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 +4 -1
  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 +242 -109
  43. package/components/status/index.js +12 -4
  44. package/components/tab/tab-container.js +29 -27
  45. package/components/tab/tab-header.js +33 -28
  46. package/components/tab/tab-panel.js +31 -27
  47. package/components/tab/tab.js +45 -35
  48. package/components/tree-view/index.js +108 -73
  49. package/components/typography/index.js +36 -25
  50. package/icons/basic.js +248 -0
  51. package/icons/effect.js +44 -36
  52. package/package.json +1 -1
  53. package/readme.md +40 -0
  54. package/styles/general.js +23 -0
  55. package/theme/index.js +1 -1
  56. package/theme/set-theme.js +2 -1
  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,
@@ -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
  }