diginet-core-ui 1.3.65-beta.1 → 1.3.66-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.
- package/components/form-control/date-picker/index.js +11 -2
- package/components/form-control/dropdown/index.js +71 -10
- package/components/form-control/input-base/index.js +39 -30
- package/components/form-control/text-input/index.js +9 -45
- package/components/grid/Container.js +110 -0
- package/components/grid/Row.js +1 -1
- package/components/grid/index.js +35 -5
- package/components/index.js +6 -2
- package/components/tooltip/index.js +8 -2
- package/icons/basic.js +68 -0
- package/package.json +1 -1
- package/readme.md +15 -0
|
@@ -55,7 +55,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
55
55
|
returnFormat,
|
|
56
56
|
style,
|
|
57
57
|
textAlign,
|
|
58
|
-
value,
|
|
58
|
+
value: valueProp,
|
|
59
59
|
viewType,
|
|
60
60
|
...props
|
|
61
61
|
}, reference) => {
|
|
@@ -86,6 +86,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
86
86
|
const focusedValue = useRef(null);
|
|
87
87
|
const [, setDisplayValue] = useState(Date.now());
|
|
88
88
|
const [, setFocusedValue] = useState(Date.now());
|
|
89
|
+
const [value, setValue] = useState(valueProp || defaultValue);
|
|
89
90
|
|
|
90
91
|
const _IconAreaCSS = IconAreaCSS(unique);
|
|
91
92
|
|
|
@@ -126,7 +127,12 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
126
127
|
};
|
|
127
128
|
|
|
128
129
|
const onChangeValue = e => {
|
|
129
|
-
|
|
130
|
+
if (valueProp) {
|
|
131
|
+
closePicker();
|
|
132
|
+
} else {
|
|
133
|
+
setValue(e.value);
|
|
134
|
+
}
|
|
135
|
+
|
|
130
136
|
!!onChange && onChange({
|
|
131
137
|
value: formatValue(e.value, returnFormat)
|
|
132
138
|
});
|
|
@@ -436,6 +442,9 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
436
442
|
closePicker();
|
|
437
443
|
}
|
|
438
444
|
}, [value]);
|
|
445
|
+
useEffect(() => {
|
|
446
|
+
setValue(valueProp);
|
|
447
|
+
}, [valueProp]);
|
|
439
448
|
useEffect(() => {
|
|
440
449
|
if (!readOnly) {
|
|
441
450
|
ipRef.current.addEventListener('focus', onInputFocus);
|
|
@@ -101,9 +101,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
101
101
|
labelProps,
|
|
102
102
|
errorStyle,
|
|
103
103
|
children,
|
|
104
|
-
dropdownItemStyle
|
|
104
|
+
dropdownItemStyle,
|
|
105
|
+
searchExpr,
|
|
106
|
+
searchMode
|
|
105
107
|
}, reference) => {
|
|
106
108
|
if (multiple && selectBox === undefined) selectBox = true;
|
|
109
|
+
if (typeof searchExpr === 'string') searchExpr = [searchExpr];
|
|
107
110
|
const ref = useRef(null);
|
|
108
111
|
const dropdownRef = useRef(null);
|
|
109
112
|
const loadingProgressRef = useRef(null);
|
|
@@ -122,6 +125,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
122
125
|
}));
|
|
123
126
|
const [openState, setOpenState] = useState(false);
|
|
124
127
|
const [showClear, setShowClear] = useState(false);
|
|
128
|
+
const [textValue, setTextValue] = useState('');
|
|
125
129
|
|
|
126
130
|
const _isMobile = isMobile.any();
|
|
127
131
|
|
|
@@ -169,6 +173,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
169
173
|
};
|
|
170
174
|
|
|
171
175
|
const onClickInput = e => {
|
|
176
|
+
if (disabled || readOnly || loading) return;
|
|
177
|
+
|
|
172
178
|
if (!dropdownListRef.current) {
|
|
173
179
|
if (!multiple || !Array.from(inputRef.current.querySelectorAll('.DGN-UI-Chip')).some(item => item.contains(e === null || e === void 0 ? void 0 : e.target))) {
|
|
174
180
|
if ((typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none') && !multiple) {
|
|
@@ -231,7 +237,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
231
237
|
const dropdownHeight = Math.min(Math.max(1, (itemMode === 'normal' ? dropdown.props.children : mapParent(dataSource, treeViewID, treeViewParentID)).length || 1), 7) * 40 + (multiple ? 43 : 0);
|
|
232
238
|
let positionTop = top + height + 4;
|
|
233
239
|
|
|
234
|
-
if (top + height + 4 + dropdownHeight > innerHeight) {
|
|
240
|
+
if (top + height + 4 + dropdownHeight + (allowSearch ? 40 : 0) > innerHeight) {
|
|
235
241
|
if (top - dropdownHeight > 0) {
|
|
236
242
|
positionTop = top - dropdownHeight;
|
|
237
243
|
} else {
|
|
@@ -387,6 +393,29 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
387
393
|
}
|
|
388
394
|
};
|
|
389
395
|
|
|
396
|
+
const handleRenderBySearch = (data, searchValue) => {
|
|
397
|
+
let existExpr = [];
|
|
398
|
+
typeof data === 'object' ? existExpr = searchExpr.filter(value => Object.keys(data).includes(value)) : existExpr = [data];
|
|
399
|
+
return existExpr.every(key => {
|
|
400
|
+
// return searchByMode(data?.[key] || key.toString(), searchValue);
|
|
401
|
+
const _data = (data === null || data === void 0 ? void 0 : data[key]) || key.toString();
|
|
402
|
+
|
|
403
|
+
if (searchMode === 'contains') {
|
|
404
|
+
if (_data.indexOf(searchValue) !== -1) return false;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (searchMode === 'startswith') {
|
|
408
|
+
if (_data.lastIndexOf(searchValue) === 0) return false;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (searchMode === 'equals') {
|
|
412
|
+
if (_data == searchValue) return false;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return true;
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
|
|
390
419
|
const mapDropdown = (pattern, keyArr) => {
|
|
391
420
|
var _currentObjectDefault;
|
|
392
421
|
|
|
@@ -414,9 +443,16 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
414
443
|
const length = dataSourceUsable.length;
|
|
415
444
|
|
|
416
445
|
for (let index = 0; index < length; index++) {
|
|
446
|
+
var _searchExpr;
|
|
447
|
+
|
|
417
448
|
const data = dataSourceUsable[index];
|
|
449
|
+
const itemHidden = typeof data === 'object' ? data['hidden'] : false;
|
|
450
|
+
if (itemHidden) continue;
|
|
418
451
|
let displayText = typeof data === 'object' ? keyArr ? renderData(data, keyArr) : data[displayExpr] || data[valueExpr] : data;
|
|
419
|
-
|
|
452
|
+
|
|
453
|
+
if (((_searchExpr = searchExpr) === null || _searchExpr === void 0 ? void 0 : _searchExpr.length) > 0 && pattern) {
|
|
454
|
+
if (handleRenderBySearch(data, pattern)) continue;
|
|
455
|
+
} else if (pattern && !new RegExp(pattern).test(displayText.normalize())) continue;
|
|
420
456
|
|
|
421
457
|
if (renderItem && typeof renderItem === 'function') {
|
|
422
458
|
displayText = renderItem({
|
|
@@ -785,11 +821,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
785
821
|
|
|
786
822
|
if (timing[unique]) clearTimeout(timing[unique]);
|
|
787
823
|
timing[unique] = setTimeout(() => {
|
|
824
|
+
var _searchExpr2;
|
|
825
|
+
|
|
788
826
|
// if (timerRef.current) {
|
|
789
827
|
// clearTimeout(timerRef.current);
|
|
790
828
|
// timerRef.current = null;
|
|
791
829
|
// }
|
|
792
|
-
renderDropdown(new RegExp(value.normalize(), 'gim'));
|
|
830
|
+
renderDropdown(((_searchExpr2 = searchExpr) === null || _searchExpr2 === void 0 ? void 0 : _searchExpr2.length) > 0 ? value.normalize() : new RegExp(value.normalize(), 'gim'));
|
|
793
831
|
}, timeout.current || searchDelayTime);
|
|
794
832
|
};
|
|
795
833
|
|
|
@@ -931,6 +969,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
931
969
|
}
|
|
932
970
|
} else {
|
|
933
971
|
inputRef.current.value = '';
|
|
972
|
+
setTextValue('');
|
|
934
973
|
} // onChangeValue('', '');
|
|
935
974
|
|
|
936
975
|
|
|
@@ -962,6 +1001,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
962
1001
|
inputRef.current.innerHTML = '';
|
|
963
1002
|
} else if (!isSearch[unique]) {
|
|
964
1003
|
inputRef.current.value = '';
|
|
1004
|
+
setTextValue('');
|
|
965
1005
|
}
|
|
966
1006
|
|
|
967
1007
|
currentValue[unique] = '';
|
|
@@ -1093,6 +1133,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1093
1133
|
ReactDOM.render(valueWithIcon, inputRef.current.appendChild(el));
|
|
1094
1134
|
} else {
|
|
1095
1135
|
inputRef.current.value = text;
|
|
1136
|
+
setTextValue(text);
|
|
1096
1137
|
}
|
|
1097
1138
|
};
|
|
1098
1139
|
|
|
@@ -1325,14 +1366,26 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1325
1366
|
return false;
|
|
1326
1367
|
}
|
|
1327
1368
|
}
|
|
1328
|
-
}) : jsx("input", { ...inputProps,
|
|
1329
|
-
style: inputStyle,
|
|
1369
|
+
}) : jsx(Fragment, null, jsx("input", { ...inputProps,
|
|
1370
|
+
style: openState || !textValue ? inputStyle : { ...inputStyle,
|
|
1371
|
+
visibility: 'hidden'
|
|
1372
|
+
},
|
|
1330
1373
|
ref: inputRef,
|
|
1331
1374
|
css: _DropdownInputCSS,
|
|
1332
1375
|
type: "text",
|
|
1333
1376
|
placeholder: placeholder,
|
|
1334
|
-
disabled: disabled ||
|
|
1335
|
-
})
|
|
1377
|
+
disabled: disabled || allowSearch
|
|
1378
|
+
}), !openState && textValue && jsx(Typography, {
|
|
1379
|
+
hoverTooltip: true,
|
|
1380
|
+
lineClamp: 1,
|
|
1381
|
+
type: 'p1',
|
|
1382
|
+
css: _DropdownInputCSS,
|
|
1383
|
+
style: {
|
|
1384
|
+
position: 'absolute',
|
|
1385
|
+
lineHeight: '24px'
|
|
1386
|
+
},
|
|
1387
|
+
onClick: onClickInput
|
|
1388
|
+
}, textValue))), jsx("div", {
|
|
1336
1389
|
ref: iconRef,
|
|
1337
1390
|
css: _IconCSS,
|
|
1338
1391
|
className: 'DGN-UI-Dropdown-Icon'
|
|
@@ -1356,7 +1409,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1356
1409
|
},
|
|
1357
1410
|
disabled: disabled || readOnly
|
|
1358
1411
|
})));
|
|
1359
|
-
}, [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, renderSelectedItem, placeholder, itemMultipleSize, openState, showClear]);
|
|
1412
|
+
}, [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, renderSelectedItem, placeholder, itemMultipleSize, openState, showClear, textValue]);
|
|
1360
1413
|
const ErrorView = useMemo(() => error && jsx(HelperText, {
|
|
1361
1414
|
disabled: disabled,
|
|
1362
1415
|
style: {
|
|
@@ -1382,6 +1435,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1382
1435
|
|
|
1383
1436
|
const InputCSS = (multiple, renderSelectedItem) => css`
|
|
1384
1437
|
${flexRow};
|
|
1438
|
+
${positionRelative};
|
|
1385
1439
|
width: 100%;
|
|
1386
1440
|
${!multiple && renderSelectedItem ? `width: calc(100% - 34px)` : ''}
|
|
1387
1441
|
`;
|
|
@@ -1757,7 +1811,8 @@ Dropdown.defaultProps = {
|
|
|
1757
1811
|
inputProps: {},
|
|
1758
1812
|
formStyle: {},
|
|
1759
1813
|
dataSource: [],
|
|
1760
|
-
onInput: null
|
|
1814
|
+
onInput: null,
|
|
1815
|
+
searchMode: 'contains'
|
|
1761
1816
|
};
|
|
1762
1817
|
Dropdown.propTypes = {
|
|
1763
1818
|
/**The variant to use. */
|
|
@@ -1928,6 +1983,12 @@ Dropdown.propTypes = {
|
|
|
1928
1983
|
/** The contents in Dropdown box (Exp: TreeView). */
|
|
1929
1984
|
children: PropTypes.node,
|
|
1930
1985
|
|
|
1986
|
+
/** Specifies a data object's field name or an expression whose value is compared to the search string. */
|
|
1987
|
+
searchExpr: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
1988
|
+
|
|
1989
|
+
/** Specifies a comparison operation used to search items. */
|
|
1990
|
+
searchMode: PropTypes.oneOf(['contains', 'startswith', 'equals']),
|
|
1991
|
+
|
|
1931
1992
|
/**
|
|
1932
1993
|
* ref methods
|
|
1933
1994
|
*
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useEffect,
|
|
4
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
5
5
|
import useInput from '../../../utils/useInput';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { jsx, css } from '@emotion/core';
|
|
8
|
-
import { renderIcon } from '../../../utils';
|
|
9
8
|
import theme from '../../../theme/settings';
|
|
10
9
|
import { typography } from '../../../styles/typography';
|
|
11
10
|
const {
|
|
12
11
|
colors
|
|
13
12
|
} = theme;
|
|
14
13
|
import { getGlobal } from '../../../global';
|
|
14
|
+
import Icon from '../../../icons';
|
|
15
15
|
const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
16
16
|
type,
|
|
17
17
|
viewType,
|
|
@@ -588,26 +588,46 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
588
588
|
onFocus: onFocus,
|
|
589
589
|
...bind
|
|
590
590
|
}));
|
|
591
|
+
const StartIcon = useMemo(() => {
|
|
592
|
+
let node = startIcon;
|
|
593
|
+
|
|
594
|
+
if (typeof node === 'string') {
|
|
595
|
+
node = jsx(Icon, {
|
|
596
|
+
name: startIcon,
|
|
597
|
+
style: iconStyle
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
return jsx("div", {
|
|
602
|
+
css: inputBaseIconCSS,
|
|
603
|
+
...startIconProps,
|
|
604
|
+
className: ['start-icon', startIconProps.className ? startIconProps.className : ''].join(' ').trim()
|
|
605
|
+
}, node);
|
|
606
|
+
}, [startIcon]);
|
|
607
|
+
const EndIcon = useMemo(() => {
|
|
608
|
+
let node = endIcon;
|
|
609
|
+
|
|
610
|
+
if (typeof node === 'string') {
|
|
611
|
+
node = jsx(Icon, {
|
|
612
|
+
name: endIcon,
|
|
613
|
+
style: iconStyle
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return jsx("div", {
|
|
618
|
+
css: inputBaseIconCSS,
|
|
619
|
+
...endIconProps,
|
|
620
|
+
className: ['end-icon', endIconProps.className ? endIconProps.className : ''].join(' ').trim()
|
|
621
|
+
}, ' ', node, ' ');
|
|
622
|
+
}, [endIcon]);
|
|
591
623
|
const InputComp = jsx("div", {
|
|
592
624
|
css: inputBaseRoot,
|
|
593
625
|
ref: ref,
|
|
594
626
|
...props,
|
|
595
627
|
className: ['DGN-UI-InputBase', newClass, className, status].join(' ').trim()
|
|
596
|
-
}, jsx("div", {
|
|
628
|
+
}, startIcon && StartIcon, jsx("div", {
|
|
597
629
|
css: inputBaseCSS
|
|
598
|
-
},
|
|
599
|
-
css: inputBaseIconCSS,
|
|
600
|
-
...startIconProps,
|
|
601
|
-
className: 'start-icon ' + (startIconProps.className ? startIconProps.className : '')
|
|
602
|
-
}, renderIcon(startIcon, typeof startIcon === 'string' && startIcon.length < 20 ? 'effect' : null, {
|
|
603
|
-
onClick: startIconProps.onClick ? null : () => inputBaseRef.current.focus(),
|
|
604
|
-
style: {
|
|
605
|
-
padding: 0,
|
|
606
|
-
minHeight: '24px',
|
|
607
|
-
...iconStyle
|
|
608
|
-
},
|
|
609
|
-
viewBox: true
|
|
610
|
-
})), jsx("input", {
|
|
630
|
+
}, jsx("input", {
|
|
611
631
|
type: type,
|
|
612
632
|
autoComplete: autoComplete,
|
|
613
633
|
placeholder: isEnabled ? placeholder : '',
|
|
@@ -627,18 +647,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
627
647
|
onBlur: onBlur,
|
|
628
648
|
onFocus: onFocus,
|
|
629
649
|
...bind
|
|
630
|
-
})),
|
|
631
|
-
css: inputBaseIconCSS,
|
|
632
|
-
...endIconProps,
|
|
633
|
-
className: 'end-icon ' + (endIconProps.className ? endIconProps.className : '')
|
|
634
|
-
}, renderIcon(endIcon, null, {
|
|
635
|
-
style: {
|
|
636
|
-
padding: 0,
|
|
637
|
-
minHeight: '24px',
|
|
638
|
-
...iconStyle
|
|
639
|
-
},
|
|
640
|
-
viewBox: true
|
|
641
|
-
})));
|
|
650
|
+
})), endIcon && EndIcon);
|
|
642
651
|
const InputBaseComp = multiline ? MultipleInputComp : InputComp;
|
|
643
652
|
/* End component */
|
|
644
653
|
|
|
@@ -724,10 +733,10 @@ InputBase.propTypes = {
|
|
|
724
733
|
required: PropTypes.bool,
|
|
725
734
|
|
|
726
735
|
/** icon element display in the left of input */
|
|
727
|
-
startIcon: PropTypes.
|
|
736
|
+
startIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
728
737
|
|
|
729
738
|
/** icon element display in the right of input */
|
|
730
|
-
endIcon: PropTypes.
|
|
739
|
+
endIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
731
740
|
|
|
732
741
|
/** props of input in InputBase component */
|
|
733
742
|
inputProps: PropTypes.object,
|
|
@@ -7,24 +7,6 @@ import { jsx, css } from '@emotion/core';
|
|
|
7
7
|
import { ButtonIcon, CircularProgress as Circular, HelperText, InputBase, Label } from '../../';
|
|
8
8
|
import { renderIcon, onValidate } from '../../../utils';
|
|
9
9
|
import { cursorNotAllowed, displayBlock, flexRow, positionRelative } from '../../../styles/general';
|
|
10
|
-
const icons = {
|
|
11
|
-
default: `<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M15.5616 19.0007C15.4036 19.0007 15.2446 18.9637 15.0986 18.8877L9.99962 16.2237L4.90162 18.8877C4.56362 19.0627 4.15562 19.0327 3.84962 18.8087C3.54162 18.5847 3.38862 18.2057 3.45362 17.8307L4.42462 12.2027L0.304623 8.21765C0.030623 7.95265 -0.068377 7.55465 0.048623 7.19065C0.165623 6.82865 0.478623 6.56365 0.856623 6.50965L6.55662 5.68165L9.10462 0.555654C9.44262 -0.124346 10.5576 -0.124346 10.8956 0.555654L13.4436 5.68165L19.1436 6.50965C19.5216 6.56365 19.8346 6.82865 19.9516 7.19065C20.0686 7.55465 19.9696 7.95265 19.6956 8.21765L15.5756 12.2027L16.5466 17.8307C16.6116 18.2057 16.4576 18.5847 16.1506 18.8087C15.9766 18.9367 15.7696 19.0007 15.5616 19.0007Z" fill="#7F828E"/>
|
|
13
|
-
</svg>`,
|
|
14
|
-
success: `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
15
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M18.997 8.974H19C19.551 8.974 19.999 9.42 20 9.971C20.008 12.642 18.975 15.157 17.091 17.051C15.208 18.945 12.7 19.992 10.029 20H10C7.33905 20 4.83605 18.968 2.94905 17.091C1.05505 15.208 0.00804612 12.7 4.61203e-05 10.029C-0.00795388 7.357 1.02505 4.843 2.90905 2.949C4.79205 1.055 7.30005 0.008 9.97105 0C10.766 0.012 11.576 0.092 12.352 0.278C12.888 0.408 13.219 0.948 13.089 1.485C12.96 2.021 12.417 2.351 11.883 2.223C11.262 2.073 10.603 2.01 9.97705 2C7.84005 2.006 5.83305 2.844 4.32705 4.359C2.82005 5.874 1.99405 7.886 2.00005 10.023C2.00605 12.16 2.84405 14.166 4.35905 15.673C5.86905 17.174 7.87105 18 10 18H10.023C12.16 17.994 14.167 17.156 15.673 15.641C17.18 14.125 18.006 12.114 18 9.977C17.999 9.425 18.445 8.975 18.997 8.974ZM6.29305 9.2929C6.68405 8.9019 7.31605 8.9019 7.70705 9.2929L9.95105 11.5369L16.248 4.3409C16.612 3.9279 17.243 3.8839 17.659 4.2479C18.074 4.6109 18.116 5.2429 17.752 5.6589L10.752 13.6589C10.57 13.8669 10.31 13.9899 10.033 13.9999H10C9.73505 13.9999 9.48105 13.8949 9.29305 13.7069L6.29305 10.7069C5.90205 10.3159 5.90205 9.6839 6.29305 9.2929Z" fill="#00C875"/>
|
|
16
|
-
</svg>`,
|
|
17
|
-
warning: `<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M14.7736 2.56003C14.4236 3.00003 14.5036 3.63003 14.9336 3.97003C16.6136 5.29003 17.6836 7.18003 17.9336 9.31003C18.1936 11.43 17.6036 13.53 16.2836 15.21L16.2736 15.23C14.9536 16.9 13.0636 17.96 10.9536 18.21C8.83361 18.46 6.73361 17.88 5.05361 16.56C3.37361 15.24 2.30361 13.34 2.05361 11.22C1.79361 9.09003 2.38361 7.00003 3.70361 5.32003C4.10361 4.84003 4.55361 4.36003 5.06361 3.96003C5.49361 3.62003 5.57361 2.99003 5.23361 2.56003C4.89361 2.13003 4.26361 2.05003 3.83361 2.39003C3.19361 2.88003 2.63361 3.47003 2.13361 4.08003C0.48361 6.18003 -0.246391 8.80003 0.0736095 11.45C0.393609 14.1 1.72361 16.47 3.82361 18.12C5.92361 19.77 8.54361 20.5 11.1936 20.18C13.8336 19.86 16.1936 18.54 17.8436 16.45L17.8636 16.43C19.5136 14.33 20.2436 11.71 19.9236 9.06003C19.6036 6.41003 18.2736 4.04003 16.1736 2.39003C15.7436 2.05003 15.1136 2.13003 14.7736 2.56003Z" fill="#FFAA00"/>
|
|
19
|
-
<path d="M12.0835 15.01C12.0535 16.17 11.0935 17.08 9.9335 17.05C8.8235 17.02 7.9235 16.13 7.8935 15.01V14.96C7.9235 13.8 8.8835 12.89 10.0435 12.92C11.1535 12.95 12.0535 13.84 12.0835 14.96V15.01ZM12.1335 1.23L11.0935 10.27C11.0935 10.88 10.6035 11.37 9.9935 11.37C9.3835 11.37 8.8935 10.88 8.8935 10.27L7.8535 1.23C7.7235 0.69 8.0535 0.16 8.5935 0.03C8.6735 0.01 8.7435 0 8.8135 0H11.1635C11.7235 0.01 12.1635 0.47 12.1535 1.02C12.1635 1.09 12.1535 1.16 12.1335 1.23Z" fill="#FFAA00"/>
|
|
20
|
-
</svg>`,
|
|
21
|
-
none: `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M2 10C2 8.154 2.635 6.458 3.688 5.103L14.897 16.312C13.542 17.366 11.846 18 10 18C5.589 18 2 14.411 2 10ZM18 10C18 11.846 17.365 13.542 16.312 14.897L5.103 3.688C6.458 2.634 8.154 2 10 2C14.411 2 18 5.589 18 10ZM10 0C4.486 0 0 4.486 0 10C0 15.514 4.486 20 10 20C15.514 20 20 15.514 20 10C20 4.486 15.514 0 10 0Z" fill="#FF3D71"/>
|
|
23
|
-
</svg>`,
|
|
24
|
-
danger: `<svg width="16" height="22" style="max-height:20px" viewBox="0 0 16 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
25
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M7.11087 22.0002C6.99687 22.0002 6.88187 21.9802 6.76887 21.9392C6.33687 21.7822 6.06687 21.3502 6.11687 20.8932L6.88487 13.8002H0.999871C0.630871 13.8002 0.291871 13.5972 0.117871 13.2712C-0.056129 12.9452 -0.036129 12.5512 0.168871 12.2442L8.05687 0.444182C8.31287 0.0611818 8.79687 -0.0978183 9.22987 0.0611817C9.66287 0.218182 9.93187 0.650182 9.88187 1.10718L9.11387 8.20018H14.9999C15.3689 8.20018 15.7079 8.40318 15.8819 8.72918C16.0549 9.05518 16.0359 9.44918 15.8309 9.75618L7.94187 21.5562C7.75287 21.8402 7.43687 22.0002 7.11087 22.0002Z" fill="#FF3D71"/>
|
|
26
|
-
</svg>`
|
|
27
|
-
};
|
|
28
10
|
const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
29
11
|
type,
|
|
30
12
|
viewType,
|
|
@@ -48,7 +30,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
48
30
|
readOnly,
|
|
49
31
|
multiline,
|
|
50
32
|
onConfirm,
|
|
51
|
-
refs,
|
|
52
33
|
rows,
|
|
53
34
|
maxRows,
|
|
54
35
|
style,
|
|
@@ -184,7 +165,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
184
165
|
setValue(valueProp);
|
|
185
166
|
}, [valueProp]);
|
|
186
167
|
useEffect(() => {
|
|
187
|
-
!!refs && refs(ref);
|
|
188
168
|
currentValue = defaultValue || '';
|
|
189
169
|
}, []);
|
|
190
170
|
useEffect(() => {
|
|
@@ -206,22 +186,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
206
186
|
}
|
|
207
187
|
};
|
|
208
188
|
}, [type, multiline]);
|
|
209
|
-
useEffect(() => {
|
|
210
|
-
if (/inform/i.test(type) && !multiline) {
|
|
211
|
-
const regexp = /(success)|(warning)|(danger)/gi;
|
|
212
|
-
const existedClass = ref.current.classList.value.match(regexp);
|
|
213
|
-
|
|
214
|
-
if (existedClass) {
|
|
215
|
-
ref.current.classList.remove(existedClass[0]);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
ref.current.classList.add(status);
|
|
219
|
-
|
|
220
|
-
if (!icon) {
|
|
221
|
-
iconRef.current.innerHTML = icons[status];
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}, [status]);
|
|
225
189
|
useEffect(() => {
|
|
226
190
|
if (error && !value && value !== 0) {
|
|
227
191
|
ref.current.classList.add('danger');
|
|
@@ -289,7 +253,10 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
289
253
|
}, [loading]);
|
|
290
254
|
/* End handler */
|
|
291
255
|
|
|
292
|
-
useImperativeHandle(reference, () =>
|
|
256
|
+
useImperativeHandle(reference, () => ({
|
|
257
|
+
element: ref.current,
|
|
258
|
+
instance: {}
|
|
259
|
+
}));
|
|
293
260
|
const validateResult = validates && onValidate(value, validates, true);
|
|
294
261
|
const startIconCustom = icon && type !== 'inform' ? icon : startIcon;
|
|
295
262
|
const endIconCustom = /^inform$/i.test(type) ? jsx("div", {
|
|
@@ -352,7 +319,7 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
352
319
|
autoWidth: autoWidth,
|
|
353
320
|
rows: rows,
|
|
354
321
|
maxRows: maxRows,
|
|
355
|
-
status: isError || validateResult ? 'danger' :
|
|
322
|
+
status: isError || validateResult ? 'danger' : status,
|
|
356
323
|
inputProps: inputProps,
|
|
357
324
|
inputStyle: inputStyle,
|
|
358
325
|
startIcon: startIconCustom,
|
|
@@ -475,9 +442,6 @@ TextInput.propTypes = {
|
|
|
475
442
|
/** any props of label in TextInput component */
|
|
476
443
|
labelProps: PropTypes.object,
|
|
477
444
|
|
|
478
|
-
/** The function to get ref of Dropdown component */
|
|
479
|
-
refs: PropTypes.func,
|
|
480
|
-
|
|
481
445
|
/** on key down function */
|
|
482
446
|
onKeyDown: PropTypes.func,
|
|
483
447
|
|
|
@@ -496,10 +460,10 @@ TextInput.propTypes = {
|
|
|
496
460
|
/** on focus function */
|
|
497
461
|
onFocus: PropTypes.func,
|
|
498
462
|
|
|
499
|
-
/** validation value, argument can:<br/>
|
|
500
|
-
* * string: the validation rule. Example required.<br/>
|
|
501
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
502
|
-
* * array: the validation rule list, insist object/string
|
|
463
|
+
/** validation value, argument can:<br/>
|
|
464
|
+
* * string: the validation rule. Example required.<br/>
|
|
465
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
466
|
+
* * array: the validation rule list, insist object/string
|
|
503
467
|
*/
|
|
504
468
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
505
469
|
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** @jsxRuntime classic */
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import Grid from '.';
|
|
7
|
+
|
|
8
|
+
const checkChildren = children => {
|
|
9
|
+
if (!children) return false;
|
|
10
|
+
|
|
11
|
+
if (Array.isArray(children)) {
|
|
12
|
+
return !children.every(v => v === false);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Container = props => {
|
|
19
|
+
const {
|
|
20
|
+
className,
|
|
21
|
+
children
|
|
22
|
+
} = props;
|
|
23
|
+
return checkChildren(children) ? jsx(Grid, { ...props,
|
|
24
|
+
className: ['DGN-UI-Container', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
25
|
+
container: true
|
|
26
|
+
}) : null;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
Container.defaultProps = {
|
|
30
|
+
style: {},
|
|
31
|
+
className: '',
|
|
32
|
+
columns: 12,
|
|
33
|
+
lg: false,
|
|
34
|
+
md: false,
|
|
35
|
+
sm: false,
|
|
36
|
+
xl: false,
|
|
37
|
+
xs: false,
|
|
38
|
+
zeroMinWidth: false,
|
|
39
|
+
spacing: 0,
|
|
40
|
+
direction: 'row',
|
|
41
|
+
wrap: 'wrap',
|
|
42
|
+
columnSpacing: {
|
|
43
|
+
xs: 4,
|
|
44
|
+
sm: 4,
|
|
45
|
+
md: 4,
|
|
46
|
+
lg: 4,
|
|
47
|
+
xl: 6
|
|
48
|
+
},
|
|
49
|
+
rowSpacing: {
|
|
50
|
+
xs: 4,
|
|
51
|
+
sm: 4,
|
|
52
|
+
md: 4,
|
|
53
|
+
lg: 4,
|
|
54
|
+
xl: 4
|
|
55
|
+
},
|
|
56
|
+
topSpacing: {
|
|
57
|
+
xs: 2,
|
|
58
|
+
sm: 2,
|
|
59
|
+
md: 2,
|
|
60
|
+
lg: 2,
|
|
61
|
+
xl: 2
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
Container.propTypes = {
|
|
65
|
+
/** The content of the component. */
|
|
66
|
+
children: PropTypes.node,
|
|
67
|
+
|
|
68
|
+
/** Style inline of component. */
|
|
69
|
+
style: PropTypes.object,
|
|
70
|
+
|
|
71
|
+
/** Class for component. */
|
|
72
|
+
className: PropTypes.string,
|
|
73
|
+
|
|
74
|
+
/** The number of columns. */
|
|
75
|
+
columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
76
|
+
|
|
77
|
+
/** Defines the horizontal space between the type `Col` components. It overrides the value of the `spacing` prop. */
|
|
78
|
+
columnSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
79
|
+
|
|
80
|
+
/** Defines the `flex-direction` style property. It is applied for all screen sizes. */
|
|
81
|
+
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
82
|
+
|
|
83
|
+
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `lg` breakpoint and wider screens if not overridden. */
|
|
84
|
+
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
85
|
+
|
|
86
|
+
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `md` breakpoint and wider screens if not overridden. */
|
|
87
|
+
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
88
|
+
|
|
89
|
+
/** Defines the vertical space between the type `Col` components. It overrides the value of the `spacing` prop. */
|
|
90
|
+
rowSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
91
|
+
|
|
92
|
+
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `sm` breakpoint and wider screens if not overridden. */
|
|
93
|
+
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
94
|
+
|
|
95
|
+
/** Defines the space between the type `Col` components */
|
|
96
|
+
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
97
|
+
|
|
98
|
+
/** Defines the flex-wrap style property. It's applied for all screen sizes. */
|
|
99
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
100
|
+
|
|
101
|
+
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `xl` breakpoint and wider screens if not overridden. */
|
|
102
|
+
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
103
|
+
|
|
104
|
+
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for all the screen sizes with the lowest priority. */
|
|
105
|
+
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
106
|
+
|
|
107
|
+
/** If `true`, it sets `min-width: 0` on the item. Refer to the limitations section of the documentation to better understand the use case. */
|
|
108
|
+
zeroMinWidth: PropTypes.bool
|
|
109
|
+
};
|
|
110
|
+
export default Container;
|
package/components/grid/Row.js
CHANGED
package/components/grid/index.js
CHANGED
|
@@ -22,11 +22,13 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
22
22
|
container,
|
|
23
23
|
direction,
|
|
24
24
|
item,
|
|
25
|
+
leftSpacing: leftSpacingProp,
|
|
25
26
|
lg,
|
|
26
27
|
md,
|
|
27
28
|
rowSpacing: rowSpacingProp,
|
|
28
29
|
sm,
|
|
29
30
|
spacing,
|
|
31
|
+
topSpacing: topSpacingProp,
|
|
30
32
|
wrap,
|
|
31
33
|
xl,
|
|
32
34
|
xs,
|
|
@@ -36,11 +38,13 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
38
|
const rowSpacing = rowSpacingProp || spacing;
|
|
37
39
|
const columnSpacing = columnSpacingProp || spacing;
|
|
38
40
|
const columns = container ? columnsProp : columnsContext;
|
|
41
|
+
const topSpacing = topSpacingProp || rowSpacing;
|
|
42
|
+
const leftSpacing = leftSpacingProp || columnSpacing;
|
|
39
43
|
const ref = useRef(null);
|
|
40
44
|
|
|
41
45
|
const _GridCSS = GridCSS(direction, zeroMinWidth, container, item, wrap);
|
|
42
46
|
|
|
43
|
-
const _GridSpacingCSS = GridSpacingCSS(rowSpacing, columnSpacing);
|
|
47
|
+
const _GridSpacingCSS = GridSpacingCSS(rowSpacing, columnSpacing, topSpacing, leftSpacing);
|
|
44
48
|
|
|
45
49
|
const _HandleGridCSS = HandleGridCSS([xs, sm, md, lg, xl], columns);
|
|
46
50
|
|
|
@@ -63,7 +67,7 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
63
67
|
}, jsx(GridContext.Provider, {
|
|
64
68
|
value: columns
|
|
65
69
|
}, children));
|
|
66
|
-
}, [id, container, item, direction, wrap, rowSpacing, columnSpacing, xs, sm, md, lg, xl, spacing, zeroMinWidth, className, columns, children]);
|
|
70
|
+
}, [id, container, item, direction, leftSpacing, wrap, rowSpacing, columnSpacing, xs, sm, md, lg, xl, spacing, topSpacing, zeroMinWidth, className, columns, children]);
|
|
67
71
|
}));
|
|
68
72
|
|
|
69
73
|
const getOffset = val => {
|
|
@@ -151,19 +155,40 @@ const GridCSS = (direction, zeroMinWidth, container, item, wrap) => css`
|
|
|
151
155
|
})};
|
|
152
156
|
`;
|
|
153
157
|
|
|
154
|
-
const GridSpacingCSS = (rowSpacing, columnSpacing) => css`
|
|
155
|
-
${
|
|
158
|
+
const GridSpacingCSS = (rowSpacing, columnSpacing, topSpacing, leftSpacing) => css`
|
|
159
|
+
${topSpacing && handleBreakpoints(topSpacing, propValue => {
|
|
156
160
|
const spacing = typeof propValue === 'number' ? themeSpacing(propValue) : propValue;
|
|
157
161
|
|
|
158
162
|
if (spacing !== '0px') {
|
|
159
163
|
return `
|
|
160
164
|
margin-top: -${getOffset(spacing)};
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return '';
|
|
169
|
+
})};
|
|
170
|
+
${rowSpacing && handleBreakpoints(rowSpacing, propValue => {
|
|
171
|
+
const spacing = typeof propValue === 'number' ? themeSpacing(propValue) : propValue;
|
|
172
|
+
|
|
173
|
+
if (spacing !== '0px') {
|
|
174
|
+
return `
|
|
161
175
|
& > .DGN-UI-Grid-item {
|
|
162
176
|
padding-top: ${getOffset(spacing)};
|
|
163
177
|
}
|
|
164
178
|
`;
|
|
165
179
|
}
|
|
166
180
|
|
|
181
|
+
return '';
|
|
182
|
+
})};
|
|
183
|
+
${leftSpacing && handleBreakpoints(leftSpacing, propValue => {
|
|
184
|
+
const spacing = typeof propValue === 'number' ? themeSpacing(propValue) : propValue;
|
|
185
|
+
|
|
186
|
+
if (spacing !== '0px') {
|
|
187
|
+
return `
|
|
188
|
+
margin-left: -${getOffset(spacing)};
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
167
192
|
return '';
|
|
168
193
|
})};
|
|
169
194
|
${columnSpacing && handleBreakpoints(columnSpacing, propValue => {
|
|
@@ -172,7 +197,6 @@ const GridSpacingCSS = (rowSpacing, columnSpacing) => css`
|
|
|
172
197
|
if (spacing !== '0px') {
|
|
173
198
|
return `
|
|
174
199
|
width: calc(100% + ${getOffset(spacing)});
|
|
175
|
-
margin-left: -${getOffset(spacing)};
|
|
176
200
|
& > .DGN-UI-Grid-item {
|
|
177
201
|
padding-left: ${getOffset(spacing)};
|
|
178
202
|
}
|
|
@@ -230,6 +254,9 @@ Grid.propTypes = {
|
|
|
230
254
|
/** If `true`, the component will have the flex *item* behavior. You should be wrapping *items* with a *container*. */
|
|
231
255
|
item: PropTypes.bool,
|
|
232
256
|
|
|
257
|
+
/** Defines the horizontal space of `container` components. */
|
|
258
|
+
leftSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
259
|
+
|
|
233
260
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `lg` breakpoint and wider screens if not overridden. */
|
|
234
261
|
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
235
262
|
|
|
@@ -245,6 +272,9 @@ Grid.propTypes = {
|
|
|
245
272
|
/** Defines the space between the type `item` components. It can only be used on a type `container` component. */
|
|
246
273
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
247
274
|
|
|
275
|
+
/** Defines the vertical space of `container` components. */
|
|
276
|
+
topSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
277
|
+
|
|
248
278
|
/** Defines the flex-wrap style property. It's applied for all screen sizes. */
|
|
249
279
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
250
280
|
|
package/components/index.js
CHANGED
|
@@ -57,7 +57,8 @@ export { default as Toggle } from './form-control/toggle'; // Grid
|
|
|
57
57
|
|
|
58
58
|
export { default as Grid } from './grid';
|
|
59
59
|
export { default as Row } from './grid/Row';
|
|
60
|
-
export { default as Col } from './grid/Col';
|
|
60
|
+
export { default as Col } from './grid/Col';
|
|
61
|
+
export { default as Container } from './grid/Container'; //Icon
|
|
61
62
|
|
|
62
63
|
export { default as Icon } from '../icons/index'; // List
|
|
63
64
|
|
|
@@ -78,7 +79,10 @@ export { default as PagingSelector } from './paging/page-selector2'; // PAPER
|
|
|
78
79
|
|
|
79
80
|
export { default as Paper } from './paper'; // POPOVER
|
|
80
81
|
|
|
81
|
-
export { default as Popover } from './popover';
|
|
82
|
+
export { default as Popover } from './popover';
|
|
83
|
+
export { default as PopoverHeader } from './popover/header';
|
|
84
|
+
export { default as PopoverBody } from './popover/body';
|
|
85
|
+
export { default as PopoverFooter } from './popover/footer'; // POPUP
|
|
82
86
|
|
|
83
87
|
export { default as Popup } from './popup';
|
|
84
88
|
export { default as PopupV2 } from './popup/v2';
|
|
@@ -57,6 +57,7 @@ const Tooltip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
57
57
|
backgroundColor,
|
|
58
58
|
children,
|
|
59
59
|
color,
|
|
60
|
+
disableInteractive,
|
|
60
61
|
direction,
|
|
61
62
|
distance,
|
|
62
63
|
size,
|
|
@@ -462,7 +463,8 @@ const Tooltip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
462
463
|
const renderTooltip = useMemo(() => {
|
|
463
464
|
if (open && title) {
|
|
464
465
|
const node = jsx("div", {
|
|
465
|
-
className: 'DGN-UI-Portal DGN-Tooltip'
|
|
466
|
+
className: 'DGN-UI-Portal DGN-Tooltip',
|
|
467
|
+
onMouseEnter: () => disableInteractive ? onHideTooltip() : null
|
|
466
468
|
}, jsx("span", {
|
|
467
469
|
className: IDs.arrow,
|
|
468
470
|
css: ArrowCSS,
|
|
@@ -480,7 +482,7 @@ const Tooltip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
480
482
|
}
|
|
481
483
|
|
|
482
484
|
return null;
|
|
483
|
-
}, [open, title, backgroundColor, color, size, padding, textAlign]);
|
|
485
|
+
}, [open, title, backgroundColor, color, size, padding, textAlign, disableInteractive]);
|
|
484
486
|
return jsx(TagCreatedName, {
|
|
485
487
|
ref: ref,
|
|
486
488
|
css: ContainerCSS,
|
|
@@ -533,6 +535,7 @@ Tooltip.defaultProps = {
|
|
|
533
535
|
arrowSize: 6,
|
|
534
536
|
backgroundColor: fillTooltip,
|
|
535
537
|
color: white,
|
|
538
|
+
disableInteractive: false,
|
|
536
539
|
direction: 'down',
|
|
537
540
|
size: 'medium',
|
|
538
541
|
forceDirection: false,
|
|
@@ -570,6 +573,9 @@ Tooltip.propTypes = {
|
|
|
570
573
|
/** If `true`, the component is disabled. */
|
|
571
574
|
disabled: PropTypes.bool,
|
|
572
575
|
|
|
576
|
+
/** If `true`, makes a tooltip not interactive, i.e. it will close when the user hovers over the tooltip. */
|
|
577
|
+
disableInteractive: PropTypes.bool,
|
|
578
|
+
|
|
573
579
|
/** distance between the tooltip and the children */
|
|
574
580
|
distance: PropTypes.number,
|
|
575
581
|
|
package/icons/basic.js
CHANGED
|
@@ -2915,6 +2915,34 @@ export const List = /*#__PURE__*/memo(({
|
|
|
2915
2915
|
fill: colors[color] || color
|
|
2916
2916
|
}));
|
|
2917
2917
|
});
|
|
2918
|
+
export const ListAlt = /*#__PURE__*/memo(({
|
|
2919
|
+
width,
|
|
2920
|
+
height,
|
|
2921
|
+
color = '#7F828E',
|
|
2922
|
+
viewBox = false
|
|
2923
|
+
}) => {
|
|
2924
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
2925
|
+
width: width || 24,
|
|
2926
|
+
height: height || 24,
|
|
2927
|
+
viewBox: "0 0 24 24",
|
|
2928
|
+
fill: "none"
|
|
2929
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2930
|
+
fillRule: "evenodd",
|
|
2931
|
+
clipRule: "evenodd",
|
|
2932
|
+
d: "M20.1 3H3.9C3.4 3 3 3.4 3 3.9V20.1C3 20.5 3.4 21 3.9 21H20.1C20.5 21 21 20.5 21 20.1V3.9C21 3.4 20.5 3 20.1 3ZM9 7H7V9H9V7ZM17 7H11V9H17V7ZM17 11H11V13H17V11ZM11 15H17V17H11V15ZM7 11H9V13H7V11ZM9 15H7V17H9V15ZM5 19H19V5H5V19Z",
|
|
2933
|
+
fill: colors[color] || color
|
|
2934
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
2935
|
+
width: width || 18,
|
|
2936
|
+
height: height || 18,
|
|
2937
|
+
viewBox: "0 0 18 18",
|
|
2938
|
+
fill: "none"
|
|
2939
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
2940
|
+
fillRule: "evenodd",
|
|
2941
|
+
clipRule: "evenodd",
|
|
2942
|
+
d: "M17.1 0H0.9C0.4 0 0 0.4 0 0.9V17.1C0 17.5 0.4 18 0.9 18H17.1C17.5 18 18 17.5 18 17.1V0.9C18 0.4 17.5 0 17.1 0ZM6 4H4V6H6V4ZM14 4H8V6H14V4ZM14 8H8V10H14V8ZM8 12H14V14H8V12ZM4 8H6V10H4V8ZM6 12H4V14H6V12ZM2 16H16V2H2V16Z",
|
|
2943
|
+
fill: colors[color] || color
|
|
2944
|
+
}));
|
|
2945
|
+
});
|
|
2918
2946
|
export const ListApproval = /*#__PURE__*/memo(({
|
|
2919
2947
|
width,
|
|
2920
2948
|
height,
|
|
@@ -4276,6 +4304,46 @@ export const PersonRate = /*#__PURE__*/memo(({
|
|
|
4276
4304
|
fill: colors[color] || color
|
|
4277
4305
|
}));
|
|
4278
4306
|
});
|
|
4307
|
+
export const PersonSetting = /*#__PURE__*/memo(({
|
|
4308
|
+
width,
|
|
4309
|
+
height,
|
|
4310
|
+
color = '#7F828E',
|
|
4311
|
+
viewBox = false
|
|
4312
|
+
}) => {
|
|
4313
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
4314
|
+
width: width || 24,
|
|
4315
|
+
height: height || 24,
|
|
4316
|
+
viewBox: "0 0 24 24",
|
|
4317
|
+
fill: "none"
|
|
4318
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4319
|
+
d: "M11 11C13.21 11 15 9.21 15 7C15 4.79 13.21 3 11 3C8.79 3 7 4.79 7 7C7 9.21 8.79 11 11 11Z",
|
|
4320
|
+
fill: colors[color] || color
|
|
4321
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
4322
|
+
d: "M11 13C8.33 13 3 14.34 3 17V19H12.8027C12.2922 18.1175 12 17.0929 12 16C12 14.9646 12.2623 13.9904 12.724 13.1403C12.0912 13.0468 11.4991 13 11 13Z",
|
|
4323
|
+
fill: colors[color] || color
|
|
4324
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
4325
|
+
fillRule: "evenodd",
|
|
4326
|
+
clipRule: "evenodd",
|
|
4327
|
+
d: "M21.0851 16C21.0851 16.136 21.0727 16.264 21.0563 16.392L21.924 17.052C22.0021 17.112 22.0227 17.22 21.9733 17.308L21.1509 18.692C21.1015 18.78 20.9946 18.816 20.9 18.78L19.8761 18.38C19.6622 18.536 19.432 18.672 19.1811 18.772L19.0248 19.832C19.0125 19.928 18.9262 20 18.8234 20H17.1785C17.0757 20 16.9893 19.928 16.977 19.832L16.8207 18.772C16.5699 18.672 16.3396 18.54 16.1257 18.38L15.1018 18.78C15.0113 18.812 14.9003 18.78 14.851 18.692L14.0285 17.308C13.9792 17.22 13.9997 17.112 14.0779 17.052L14.9455 16.392C14.9291 16.264 14.9167 16.132 14.9167 16C14.9167 15.868 14.9291 15.736 14.9455 15.608L14.0779 14.948C13.9997 14.888 13.9751 14.78 14.0285 14.692L14.851 13.308C14.9003 13.22 15.0072 13.184 15.1018 13.22L16.1257 13.62C16.3396 13.464 16.5699 13.328 16.8207 13.228L16.977 12.168C16.9893 12.072 17.0757 12 17.1785 12H18.8234C18.9262 12 19.0125 12.072 19.0248 12.168L19.1811 13.228C19.432 13.328 19.6622 13.46 19.8761 13.62L20.9 13.22C20.9905 13.188 21.1015 13.22 21.1509 13.308L21.9733 14.692C22.0227 14.78 22.0021 14.888 21.924 14.948L21.0563 15.608C21.0727 15.736 21.0851 15.864 21.0851 16ZM16.5616 16C16.5616 16.772 17.2073 17.4 18.0009 17.4C18.7946 17.4 19.4402 16.772 19.4402 16C19.4402 15.228 18.7946 14.6 18.0009 14.6C17.2073 14.6 16.5616 15.228 16.5616 16Z",
|
|
4328
|
+
fill: colors[color] || color
|
|
4329
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
4330
|
+
width: width || 19,
|
|
4331
|
+
height: height || 17,
|
|
4332
|
+
viewBox: "0 0 19 17",
|
|
4333
|
+
fill: "none"
|
|
4334
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4335
|
+
d: "M8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8Z",
|
|
4336
|
+
fill: colors[color] || color
|
|
4337
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
4338
|
+
d: "M8 10C5.33 10 0 11.34 0 14V16H9.80269C9.29218 15.1175 9 14.0929 9 13C9 11.9646 9.26227 10.9904 9.724 10.1403C9.09118 10.0468 8.49911 10 8 10Z",
|
|
4339
|
+
fill: colors[color] || color
|
|
4340
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
4341
|
+
fillRule: "evenodd",
|
|
4342
|
+
clipRule: "evenodd",
|
|
4343
|
+
d: "M18.0851 13C18.0851 13.136 18.0727 13.264 18.0563 13.392L18.924 14.052C19.0021 14.112 19.0227 14.22 18.9733 14.308L18.1509 15.692C18.1015 15.78 17.9946 15.816 17.9 15.78L16.8761 15.38C16.6622 15.536 16.432 15.672 16.1811 15.772L16.0248 16.832C16.0125 16.928 15.9262 17 15.8234 17H14.1785C14.0757 17 13.9893 16.928 13.977 16.832L13.8207 15.772C13.5699 15.672 13.3396 15.54 13.1257 15.38L12.1018 15.78C12.0113 15.812 11.9003 15.78 11.851 15.692L11.0285 14.308C10.9792 14.22 10.9997 14.112 11.0779 14.052L11.9455 13.392C11.9291 13.264 11.9167 13.132 11.9167 13C11.9167 12.868 11.9291 12.736 11.9455 12.608L11.0779 11.948C10.9997 11.888 10.9751 11.78 11.0285 11.692L11.851 10.308C11.9003 10.22 12.0072 10.184 12.1018 10.22L13.1257 10.62C13.3396 10.464 13.5699 10.328 13.8207 10.228L13.977 9.168C13.9893 9.072 14.0757 9 14.1785 9H15.8234C15.9262 9 16.0125 9.072 16.0248 9.168L16.1811 10.228C16.432 10.328 16.6622 10.46 16.8761 10.62L17.9 10.22C17.9905 10.188 18.1015 10.22 18.1509 10.308L18.9733 11.692C19.0227 11.78 19.0021 11.888 18.924 11.948L18.0563 12.608C18.0727 12.736 18.0851 12.864 18.0851 13ZM13.5616 13C13.5616 13.772 14.2073 14.4 15.0009 14.4C15.7946 14.4 16.4402 13.772 16.4402 13C16.4402 12.228 15.7946 11.6 15.0009 11.6C14.2073 11.6 13.5616 12.228 13.5616 13Z",
|
|
4344
|
+
fill: colors[color] || color
|
|
4345
|
+
}));
|
|
4346
|
+
});
|
|
4279
4347
|
export const PersonSync = /*#__PURE__*/memo(({
|
|
4280
4348
|
width,
|
|
4281
4349
|
height,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,21 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.66
|
|
42
|
+
- \[Changed\]: THEME – Update makestyles
|
|
43
|
+
- \[Changed\]: THEME – Refactoring makeStyles
|
|
44
|
+
- \[Changed\]: Popover – Update Popover with new design
|
|
45
|
+
- \[Changed\]: Status – Update Status with new design
|
|
46
|
+
- \[Changed\]: Popover – Add prop clickOutsideToClose
|
|
47
|
+
- \[Changed\]: TextInput – Add cursor not-allow when disabled
|
|
48
|
+
- \[Changed\]: Tooltip – Add prop disabled
|
|
49
|
+
- \[Changed\]: InputBase – Allow startIcon, endIcon as node
|
|
50
|
+
- \[Fixed\]: TECH – Fix eslint, remove unused code
|
|
51
|
+
- \[Fixed\]: Popover – Fix css children height and overflow
|
|
52
|
+
- \[Fixed\]: Dropdown – Fix css disabled
|
|
53
|
+
- \[Fixed\]: Label – Fix not show required when label too long
|
|
54
|
+
- \[Fixed\]: Dropdown – Fix bug not reset search text when rerender
|
|
55
|
+
|
|
41
56
|
## 1.3.65
|
|
42
57
|
- \[Changed\]: Dropdown – Add viewType none
|
|
43
58
|
|