diginet-core-ui 1.3.73-beta.4 → 1.3.73-beta.6

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.
@@ -232,7 +232,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
232
232
  img.alt = '';
233
233
 
234
234
  img.onerror = () => {
235
- setSrcState(null);
235
+ setSrcState(defaultSrc);
236
236
  existed[unique] = false;
237
237
  };
238
238
 
@@ -6,9 +6,9 @@ import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import { ButtonIcon, Typography } from '../';
8
8
  import Icon from '../../icons';
9
- import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, whiteSpaceNoWrap, cursorNotAllowed, positionAbsolute, overflowHidden } from '../../styles/general';
9
+ import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, cursorNotAllowed, positionAbsolute, overflowHidden } from '../../styles/general';
10
10
  import { hexToRGBA } from '../../styles/color-helper';
11
- import { useTheme } from '../../theme';
11
+ import { useTheme, useColor as colors } from '../../theme';
12
12
  const {
13
13
  colors: {
14
14
  danger,
@@ -52,9 +52,10 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
52
52
  const ref = useRef(null);
53
53
  const IconRef = useRef(null);
54
54
  if (!onDbClick && onDoubleClick) onDbClick = onDoubleClick;
55
- const color = colorMap.get(colorProps) || colorProps;
55
+ let color = colorMap.get(colorProps) || colorProps;
56
+ if (colors[color]) color = colors[color];
56
57
  const infoChip = {
57
- color: colorMap.get(colorProps) || colorProps,
58
+ color: color,
58
59
  contentColor: viewType !== 'filled' ? color : white,
59
60
  backgroundColor: viewType !== 'filled' ? white : color,
60
61
  iconSize: iconSizeMap.get(size),
@@ -160,7 +161,6 @@ const ChipLabelCSS = css`
160
161
  ${alignCenter};
161
162
  ${positionRelative};
162
163
  ${userSelectNone};
163
- ${whiteSpaceNoWrap};
164
164
  `;
165
165
 
166
166
  const ChipRootCSS = (onClick, onDbClick, colorProps, info) => css`
@@ -268,7 +268,7 @@ Chip.propTypes = {
268
268
  viewType: PropTypes.oneOf(['ghost', 'outlined', 'filled']),
269
269
 
270
270
  /** color for text or background of Chip */
271
- color: PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']),
271
+ color: PropTypes.oneOfType([PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']), PropTypes.string]),
272
272
 
273
273
  /** size of Chip */
274
274
  size: PropTypes.oneOf(['small', 'medium', 'large']),
@@ -431,11 +431,11 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
431
431
  }
432
432
  }
433
433
 
434
- const trueWidth = width > 320 ? width < 633 ? 633 : width : 320;
434
+ const pickerWidth = window.innerWidth <= 633 ? 300 : 633;
435
435
 
436
- if (left + trueWidth > innerWidth) {
437
- if (innerWidth > trueWidth) {
438
- style.left = (innerWidth - trueWidth) / 2;
436
+ if (left + pickerWidth > innerWidth) {
437
+ if (innerWidth > pickerWidth) {
438
+ style.left = (innerWidth - pickerWidth) / 2;
439
439
  }
440
440
  }
441
441
 
@@ -1047,8 +1047,10 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1047
1047
  disabled: disabled,
1048
1048
  required: required
1049
1049
  }, label), jsx(InputBase, {
1050
- placeholder: placeholder,
1051
- ...inputProps,
1050
+ inputProps: {
1051
+ placeholder: !readOnly && !disabled ? placeholder : '',
1052
+ ...inputProps
1053
+ },
1052
1054
  readOnly: true,
1053
1055
  ref: ipConRef,
1054
1056
  inputRef: ipRef,
@@ -894,6 +894,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
894
894
  value,
895
895
  data
896
896
  });
897
+ } else {
898
+ // Fix lost icon when select same value
899
+ triggerBlur(false);
897
900
  }
898
901
  }
899
902
 
@@ -1086,7 +1089,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1086
1089
  };
1087
1090
 
1088
1091
  const setSingleValueHandler = (data, keyArr) => {
1089
- 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;
1090
1093
 
1091
1094
  if (typeof renderSelectedItem === 'function') {
1092
1095
  inputRef.current.innerHTML = '';
@@ -1157,8 +1160,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1157
1160
  return currentRef;
1158
1161
  });
1159
1162
  useEffect(() => {
1160
- setShowClear(clearAble && checkHasValue(valueProp) && !disabled && !readOnly && !loading);
1161
- }, [clearAble, valueProp, disabled, readOnly, loading]);
1163
+ setShowClear(clearAble && checkHasValue(valueProp || defaultValue) && !disabled && !readOnly && !loading);
1164
+ }, [clearAble, valueProp, defaultValue, disabled, readOnly, loading]);
1162
1165
  useEffect(() => {
1163
1166
  if (valueObjectDefault) {
1164
1167
  if (Array.isArray(valueObjectDefault)) {
@@ -1369,7 +1372,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
1369
1372
  if (data) {
1370
1373
  var _displayExpr4;
1371
1374
 
1372
- 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[_]));
1373
1376
  text = mask === null || mask === void 0 ? void 0 : mask.replace(regexInclude, '');
1374
1377
  }
1375
1378
 
@@ -1570,6 +1573,9 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
1570
1573
  span:empty:before {
1571
1574
  content: '${placeholder}';
1572
1575
  color: ${sub};
1576
+ height: 100%;
1577
+ ${flexRow};
1578
+ ${alignCenter};
1573
1579
  }
1574
1580
  &::placeholder {
1575
1581
  color: ${sub};
@@ -1619,6 +1625,13 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
1619
1625
  transform: rotateX(180deg);
1620
1626
  }
1621
1627
  }
1628
+ span:empty:before {
1629
+ content: '${placeholder}';
1630
+ color: ${sub};
1631
+ height: 100%;
1632
+ ${flexRow};
1633
+ ${alignCenter};
1634
+ }
1622
1635
  &::placeholder {
1623
1636
  color: ${sub};
1624
1637
  }