diginet-core-ui 1.3.70-beta.3 → 1.3.70-beta.5
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/avatar/index.js +13 -6
- package/components/chip/index.js +7 -7
- package/components/form-control/checkbox/index.js +2 -2
- package/components/form-control/dropdown/index.js +171 -205
- package/components/form-control/radio/index.js +2 -2
- package/components/form-control/toggle/index.js +2 -2
- package/global/index.js +5 -5
- package/package.json +2 -1
- package/utils/sb-teamplate.js +3 -3
|
@@ -7,7 +7,7 @@ import { jsx, css, keyframes } from '@emotion/core';
|
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
import { useIntersection } from '../../utils/intersectionObserver';
|
|
9
9
|
import { ButtonIcon, ModalSample, Popover, Popup, Typography } from '../';
|
|
10
|
-
import { randomString } from '../../utils';
|
|
10
|
+
import { classNames, randomString } from '../../utils';
|
|
11
11
|
import { getGlobal } from '../../global';
|
|
12
12
|
import AvatarDefault from '../../assets/avatar/default.svg';
|
|
13
13
|
import { alignCenter, borderNone, displayBlock, displayNone, flexCol, inlineFlex, overflowHidden, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
|
|
@@ -75,7 +75,8 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
75
75
|
lazyLoading,
|
|
76
76
|
id,
|
|
77
77
|
allowEdit,
|
|
78
|
-
onClick
|
|
78
|
+
onClick,
|
|
79
|
+
style
|
|
79
80
|
}, reference) => {
|
|
80
81
|
if (!defaultSrc) defaultSrc = AvatarDefault;
|
|
81
82
|
const ref = useRef(null);
|
|
@@ -258,17 +259,19 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
258
259
|
css: _AvatarContainerCSS,
|
|
259
260
|
ref: ref,
|
|
260
261
|
id: unique,
|
|
261
|
-
className: disabled
|
|
262
|
+
className: classNames(disabled && 'disabled')
|
|
262
263
|
}, jsx("div", {
|
|
263
264
|
css: _AvatarRootCSS,
|
|
264
|
-
className:
|
|
265
|
+
className: classNames('DGN-UI-Avatar', className),
|
|
266
|
+
style: style,
|
|
265
267
|
id: id
|
|
266
268
|
}, jsx("input", {
|
|
267
269
|
ref: inputRef,
|
|
268
270
|
type: "file",
|
|
269
271
|
title: '',
|
|
270
272
|
accept: 'image/*',
|
|
271
|
-
onChange: onChangeAvatar
|
|
273
|
+
onChange: onChangeAvatar,
|
|
274
|
+
disabled: disabled
|
|
272
275
|
}), jsx("div", {
|
|
273
276
|
css: _AvatarPreviewCSS,
|
|
274
277
|
onClick: _onClick,
|
|
@@ -415,7 +418,8 @@ Avatar.defaultProps = {
|
|
|
415
418
|
wrongTypeError: `File ${getGlobal(['errorDefault', 'fileType'])}`,
|
|
416
419
|
matchType: /^image\/(gif|jpe?g|tiff?|png|webp|bmp|svg(\+xml)?)$/i,
|
|
417
420
|
data: {},
|
|
418
|
-
lazyLoading: false
|
|
421
|
+
lazyLoading: false,
|
|
422
|
+
style: {}
|
|
419
423
|
};
|
|
420
424
|
Avatar.propTypes = {
|
|
421
425
|
/** If `true`, allow to edit avatar. */
|
|
@@ -493,6 +497,9 @@ Avatar.propTypes = {
|
|
|
493
497
|
/** lazy loading */
|
|
494
498
|
lazyLoading: PropTypes.bool,
|
|
495
499
|
|
|
500
|
+
/** Style inline of component. */
|
|
501
|
+
style: PropTypes.object,
|
|
502
|
+
|
|
496
503
|
/**
|
|
497
504
|
* ref methods
|
|
498
505
|
*
|
package/components/chip/index.js
CHANGED
|
@@ -6,7 +6,7 @@ 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 } from '../../styles/general';
|
|
9
|
+
import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, whiteSpaceNoWrap, cursorNotAllowed, positionAbsolute, overflowHidden } from '../../styles/general';
|
|
10
10
|
import { hexToRGBA } from '../../styles/color-helper';
|
|
11
11
|
import { useTheme } from '../../theme';
|
|
12
12
|
const {
|
|
@@ -78,9 +78,6 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
78
78
|
|
|
79
79
|
const onRemoveHandler = () => {
|
|
80
80
|
if (onRemove || disabled) onRemove(ref.current);
|
|
81
|
-
setTimeout(() => {
|
|
82
|
-
ref.current && ref.current.remove();
|
|
83
|
-
}, 0);
|
|
84
81
|
};
|
|
85
82
|
|
|
86
83
|
const _onClick = event => {
|
|
@@ -105,7 +102,7 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
105
102
|
color: 'currentColor'
|
|
106
103
|
});
|
|
107
104
|
} else return jsx("div", {
|
|
108
|
-
css: ChipIconCSS(
|
|
105
|
+
css: ChipIconCSS(infoChip)
|
|
109
106
|
}, startIcon);
|
|
110
107
|
}, [startIcon, size]); // Label
|
|
111
108
|
|
|
@@ -144,11 +141,11 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
144
141
|
viewBox: true,
|
|
145
142
|
onClick: onRemoveHandler
|
|
146
143
|
}) : node && jsx("div", {
|
|
147
|
-
css: ChipIconCSS(
|
|
144
|
+
css: ChipIconCSS(infoChip),
|
|
148
145
|
className: 'end-icon ' + size,
|
|
149
146
|
ref: IconRef
|
|
150
147
|
}, node);
|
|
151
|
-
}, [clearAble, viewType, color, endIcon, size, disabled]);
|
|
148
|
+
}, [clearAble, viewType, color, endIcon, size, disabled, onRemove]);
|
|
152
149
|
return jsx("div", {
|
|
153
150
|
css: ChipRootCSS(onClick, onDbClick, colorProps, infoChip),
|
|
154
151
|
ref: ref,
|
|
@@ -235,10 +232,13 @@ const ChipIconCSS = info => css`
|
|
|
235
232
|
${alignCenter};
|
|
236
233
|
${positionRelative};
|
|
237
234
|
${borderBox};
|
|
235
|
+
${overflowHidden};
|
|
238
236
|
width: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
239
237
|
min-width: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
238
|
+
max-width: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
240
239
|
height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
241
240
|
min-height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
241
|
+
max-height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
242
242
|
`;
|
|
243
243
|
|
|
244
244
|
Chip.defaultProps = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { css, jsx } from '@emotion/core';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
6
|
+
import { forwardRef, memo, useEffect, useRef, useState, useImperativeHandle, Fragment } from 'react';
|
|
7
7
|
import { Typography } from '../..';
|
|
8
8
|
import { alignCenter, alignStart, borderBox, cursorPointer, displayBlock, flexRow, positionAbsolute, positionRelative, cursorNoDrop, parseWidthHeight } from '../../../styles/general';
|
|
9
9
|
import { randomString } from '../../../utils';
|
|
@@ -154,7 +154,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
154
154
|
},
|
|
155
155
|
color: disabled ? clDisabled : '',
|
|
156
156
|
...labelProps
|
|
157
|
-
}, jsx(
|
|
157
|
+
}, jsx(Fragment, null, children || label, required && jsx("span", {
|
|
158
158
|
style: {
|
|
159
159
|
color: disabled ? clDisabled : clDanger
|
|
160
160
|
}
|
|
@@ -6,14 +6,13 @@ import ReactDOM from 'react-dom';
|
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { jsx, css } from '@emotion/core';
|
|
9
|
-
import { Account } from '../../../icons';
|
|
10
|
-
import AvatarDefault from '../../../assets/avatar/default.svg';
|
|
11
9
|
import { InputBase, Chip, CircularProgress, Checkbox, TreeView, HelperText, Label, ButtonIcon, Typography } from '../../';
|
|
12
10
|
import { mapParent, randomString, updatePosition } from '../../../utils';
|
|
13
11
|
import { getGlobal } from '../../../global';
|
|
14
|
-
import { alignCenter, backgroundTransparent, border, borderBox, borderNone, borderRadius4px, breakWord, cursorPointer, displayBlock, flexColReverse, flexRow, flexWrap,
|
|
12
|
+
import { alignCenter, backgroundTransparent, border, borderBox, borderNone, borderRadius4px, breakWord, cursorPointer, displayBlock, flexColReverse, flexRow, flexWrap, justifyCenter, justifyStart, outlineNone, overflowAuto, overflowHidden, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, userSelectNone } from '../../../styles/general';
|
|
15
13
|
import isMobile from '../../../utils/isMobile';
|
|
16
14
|
import theme from '../../../theme/settings';
|
|
15
|
+
import Avatar from '../../avatar';
|
|
17
16
|
const {
|
|
18
17
|
colors: {
|
|
19
18
|
system: {
|
|
@@ -50,6 +49,8 @@ const timing = {},
|
|
|
50
49
|
isSearch = {},
|
|
51
50
|
allValue = {};
|
|
52
51
|
const separatorPattern = /\{\w+\}/g;
|
|
52
|
+
const regexBetween = /(?<=\{)(.*?)(?=\})/g;
|
|
53
|
+
const regexInclude = /{|}/g;
|
|
53
54
|
|
|
54
55
|
const checkHasValue = value => {
|
|
55
56
|
return Array.isArray(value) ? value.length > 0 : value === 0 || !!value;
|
|
@@ -58,7 +59,6 @@ const checkHasValue = value => {
|
|
|
58
59
|
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
59
60
|
viewType,
|
|
60
61
|
itemMode,
|
|
61
|
-
itemMultipleSize,
|
|
62
62
|
required,
|
|
63
63
|
className,
|
|
64
64
|
label,
|
|
@@ -103,7 +103,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
103
103
|
children,
|
|
104
104
|
dropdownItemStyle,
|
|
105
105
|
searchExpr,
|
|
106
|
-
searchMode
|
|
106
|
+
searchMode,
|
|
107
|
+
maximumSelectionLength
|
|
107
108
|
}, reference) => {
|
|
108
109
|
if (multiple && selectBox === undefined) selectBox = true;
|
|
109
110
|
if (typeof searchExpr === 'string') searchExpr = [searchExpr];
|
|
@@ -126,12 +127,19 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
126
127
|
const [openState, setOpenState] = useState(false);
|
|
127
128
|
const [showClear, setShowClear] = useState(false);
|
|
128
129
|
const [textValue, setTextValue] = useState('');
|
|
130
|
+
let valueTemp = valueProp || defaultValue || [];
|
|
131
|
+
|
|
132
|
+
if (multiple && valueTemp && !Array.isArray(valueTemp)) {
|
|
133
|
+
valueTemp = [valueTemp];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const [valueMulti, setValueMulti] = useState(valueTemp);
|
|
129
137
|
|
|
130
138
|
const _isMobile = isMobile.any();
|
|
131
139
|
|
|
132
140
|
const _InputCSS = InputCSS(multiple, typeof renderSelectedItem === 'function');
|
|
133
141
|
|
|
134
|
-
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder,
|
|
142
|
+
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, typeof renderSelectedItem === 'function', disabled);
|
|
135
143
|
|
|
136
144
|
const _IconCSS = IconCSS(viewType, loading, showClear);
|
|
137
145
|
|
|
@@ -265,7 +273,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
265
273
|
},
|
|
266
274
|
onKeyDown: pressESCHandler,
|
|
267
275
|
autoFocus: true
|
|
268
|
-
})), jsx(
|
|
276
|
+
})), multiple && maximumSelectionLength && jsx(Typography, {
|
|
277
|
+
style: {
|
|
278
|
+
padding: spacing([2, 4])
|
|
279
|
+
}
|
|
280
|
+
}, getGlobal('selected'), " ", (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) || 0, "/", maximumSelectionLength), jsx("div", {
|
|
269
281
|
className: 'DGN-Dropdown-Box'
|
|
270
282
|
}, dropdown), loading && jsx("div", {
|
|
271
283
|
css: LoadingProgressCSS,
|
|
@@ -471,11 +483,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
471
483
|
}
|
|
472
484
|
|
|
473
485
|
const value = typeof data === 'object' ? data[valueExpr] : data;
|
|
474
|
-
|
|
486
|
+
let itemDisabled = typeof data === 'object' ? data['disabled'] : false;
|
|
475
487
|
const icon = getIconFromData(data);
|
|
476
488
|
|
|
477
489
|
if (multiple && selectBox) {
|
|
478
|
-
const checked = Array.isArray(
|
|
490
|
+
const checked = Array.isArray(valueMulti) ? valueMulti.includes(value) : valueMulti.includes(value);
|
|
491
|
+
const isMaximumSelection = maximumSelectionLength === (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length);
|
|
492
|
+
itemDisabled = itemDisabled || isMaximumSelection && !checked;
|
|
479
493
|
items.push(jsx("div", {
|
|
480
494
|
key: index,
|
|
481
495
|
css: !itemDisabled ? _DropdownItemCSS : [DisabledCSS, _DropdownItemCSS],
|
|
@@ -501,9 +515,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
501
515
|
value: value,
|
|
502
516
|
disabled: itemDisabled,
|
|
503
517
|
onChange: () => onChangeValue(displayText, value, icon, data, index)
|
|
504
|
-
}, icon && jsx("div", {
|
|
505
|
-
css: DropdownIconCSS
|
|
506
|
-
}, icon), jsx("div", {
|
|
518
|
+
}, icon && icon, jsx("div", {
|
|
507
519
|
css: DropdownTextCSS
|
|
508
520
|
}, displayText))));
|
|
509
521
|
} else {
|
|
@@ -521,9 +533,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
521
533
|
},
|
|
522
534
|
tabIndex: -1,
|
|
523
535
|
style: dropdownItemStyle
|
|
524
|
-
}, icon && jsx("div", {
|
|
525
|
-
css: DropdownIconCSS
|
|
526
|
-
}, icon), jsx("div", {
|
|
536
|
+
}, icon && icon, jsx("div", {
|
|
527
537
|
css: DropdownTextCSS
|
|
528
538
|
}, displayText)));
|
|
529
539
|
} // if (items?.length === limit) {
|
|
@@ -644,15 +654,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
644
654
|
height: '100%',
|
|
645
655
|
padding: '0 16px'
|
|
646
656
|
}
|
|
647
|
-
}, icon && jsx("div", {
|
|
648
|
-
css: DropdownIconCSS
|
|
649
|
-
}, icon), jsx("div", {
|
|
657
|
+
}, icon && icon, jsx("div", {
|
|
650
658
|
css: DropdownTextCSS
|
|
651
659
|
}, displayText));
|
|
652
660
|
} else {
|
|
653
|
-
item = jsx(Fragment, null, icon && jsx("div", {
|
|
654
|
-
css: DropdownIconCSS
|
|
655
|
-
}, icon), jsx("div", {
|
|
661
|
+
item = jsx(Fragment, null, icon && icon, jsx("div", {
|
|
656
662
|
css: DropdownTextCSS
|
|
657
663
|
}, displayText));
|
|
658
664
|
}
|
|
@@ -685,50 +691,31 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
685
691
|
return str + separatorArr[i];
|
|
686
692
|
};
|
|
687
693
|
|
|
688
|
-
const getIconFromData = data => {
|
|
694
|
+
const getIconFromData = (data, insideChip = false) => {
|
|
689
695
|
if (!iconExpr || iconExpr === 'none') return null;
|
|
696
|
+
let _src = iconDefault;
|
|
697
|
+
if (typeof iconExpr === 'string') _src = data[iconExpr];else {
|
|
698
|
+
let prefix = iconExpr.prefix || '';
|
|
699
|
+
const suffix = iconExpr.suffix || '';
|
|
700
|
+
const url = data[iconExpr.key];
|
|
701
|
+
|
|
702
|
+
if (prefix && /^http/i.test(prefix) && /^http/i.test(url)) {
|
|
703
|
+
prefix = '';
|
|
704
|
+
}
|
|
690
705
|
|
|
691
|
-
|
|
692
|
-
return data[iconExpr] ? jsx("img", {
|
|
693
|
-
src: data[iconExpr],
|
|
694
|
-
alt: data[valueExpr]
|
|
695
|
-
}) : iconDefault ? jsx("img", {
|
|
696
|
-
src: iconDefault,
|
|
697
|
-
alt: data[valueExpr],
|
|
698
|
-
style: iconExpr.style
|
|
699
|
-
}) : jsx(Account, {
|
|
700
|
-
width: 32,
|
|
701
|
-
height: 32
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
let prefix = iconExpr.prefix || '';
|
|
706
|
-
const suffix = iconExpr.suffix || '';
|
|
707
|
-
const url = data[iconExpr.key];
|
|
708
|
-
|
|
709
|
-
if (prefix && /^http/i.test(prefix) && /^http/i.test(url)) {
|
|
710
|
-
prefix = '';
|
|
706
|
+
_src = prefix + url + suffix;
|
|
711
707
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
src:
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
alt: data[valueExpr],
|
|
721
|
-
style: iconExpr.style
|
|
722
|
-
}) : jsx(Account, {
|
|
723
|
-
width: 32,
|
|
724
|
-
height: 32
|
|
708
|
+
return jsx(Avatar, {
|
|
709
|
+
disabled: true,
|
|
710
|
+
src: _src,
|
|
711
|
+
width: insideChip ? 20 : 24,
|
|
712
|
+
height: insideChip ? 20 : 24,
|
|
713
|
+
style: { ...iconExpr.style,
|
|
714
|
+
marginRight: spacing([insideChip ? 0 : 2])
|
|
715
|
+
}
|
|
725
716
|
});
|
|
726
717
|
};
|
|
727
718
|
|
|
728
|
-
const onErrorRenderIcon = e => {
|
|
729
|
-
e.target.src = iconDefault ? iconDefault : AvatarDefault;
|
|
730
|
-
};
|
|
731
|
-
|
|
732
719
|
const customizeWidthDropdown = () => {
|
|
733
720
|
if (dropdownListRef.current && _isMobile) dropdownListRef.current.style.maxHeight = `${Math.min(280, window.innerHeight) - (allowSearch ? 40 : 0)}px`;
|
|
734
721
|
|
|
@@ -831,9 +818,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
831
818
|
}, timeout.current || searchDelayTime);
|
|
832
819
|
};
|
|
833
820
|
|
|
834
|
-
const onChangeValue = (displayText, value, icon, data
|
|
821
|
+
const onChangeValue = (displayText, value, icon, data) => {
|
|
835
822
|
if (itemMode === 'treeview') {
|
|
836
823
|
if (valueProp === undefined) {
|
|
824
|
+
setValueMulti(value);
|
|
837
825
|
setValueIntoInput(value);
|
|
838
826
|
setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loading);
|
|
839
827
|
}
|
|
@@ -849,36 +837,28 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
849
837
|
const newValueArr = [...currentValue[unique]];
|
|
850
838
|
|
|
851
839
|
if (!currentValue[unique].some(v => JSON.stringify(v) === JSON.stringify(value))) {
|
|
852
|
-
newValueArr.push(value);
|
|
853
|
-
|
|
854
|
-
if (
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
const el = document.createElement('div');
|
|
878
|
-
el.className = 'dropdown-item';
|
|
879
|
-
el.style.display = 'flex';
|
|
880
|
-
ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
881
|
-
}
|
|
840
|
+
newValueArr.push(value); // if (valueProp === undefined) {
|
|
841
|
+
// let item = null;
|
|
842
|
+
// if (typeof renderSelectedItem === 'function') {
|
|
843
|
+
// item = renderSelextedItem({ data, index });
|
|
844
|
+
// } else {
|
|
845
|
+
// item = (
|
|
846
|
+
// <Chip
|
|
847
|
+
// startIcon={icon}
|
|
848
|
+
// label={displayText}
|
|
849
|
+
// size={itemMultipleSize}
|
|
850
|
+
// disabled={disabled}
|
|
851
|
+
// clearAble
|
|
852
|
+
// onRemove={e => onRemove(e, value)}
|
|
853
|
+
// style={{ margin: '3px 0', width: '100%' }}
|
|
854
|
+
// />
|
|
855
|
+
// );
|
|
856
|
+
// }
|
|
857
|
+
// const el = document.createElement('div');
|
|
858
|
+
// el.className = 'dropdown-item';
|
|
859
|
+
// el.style.display = 'flex';
|
|
860
|
+
// ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
861
|
+
// }
|
|
882
862
|
|
|
883
863
|
!!onChange && onChange({
|
|
884
864
|
value: newValueArr,
|
|
@@ -886,14 +866,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
886
866
|
});
|
|
887
867
|
} else {
|
|
888
868
|
const index = newValueArr.indexOf(value);
|
|
889
|
-
newValueArr.splice(index, 1);
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
const nodes = inputRef.current.querySelectorAll('.dropdown-item');
|
|
895
|
-
(_nodes$index = nodes[index]) === null || _nodes$index === void 0 ? void 0 : _nodes$index.remove();
|
|
896
|
-
}
|
|
869
|
+
newValueArr.splice(index, 1); // if (valueProp === undefined) {
|
|
870
|
+
// const nodes = inputRef.current.querySelectorAll('.dropdown-item');
|
|
871
|
+
// nodes[index]?.remove();
|
|
872
|
+
// }
|
|
897
873
|
|
|
898
874
|
!!onChange && onChange({
|
|
899
875
|
value: newValueArr,
|
|
@@ -901,6 +877,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
901
877
|
});
|
|
902
878
|
}
|
|
903
879
|
|
|
880
|
+
setValueMulti(newValueArr);
|
|
904
881
|
setTimeout(() => {
|
|
905
882
|
updatePositionDropdown();
|
|
906
883
|
}, 0);
|
|
@@ -936,20 +913,17 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
936
913
|
const index = currentValue[unique].findIndex(v => JSON.stringify(v) === JSON.stringify(value));
|
|
937
914
|
|
|
938
915
|
if (index !== -1) {
|
|
939
|
-
currentValue[unique].splice(index, 1);
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
e === null || e === void 0 ? void 0 : (_e$parentNode = e.parentNode) === null || _e$parentNode === void 0 ? void 0 : _e$parentNode.remove();
|
|
952
|
-
}, 0);
|
|
916
|
+
currentValue[unique].splice(index, 1); // setTimeout(() => {
|
|
917
|
+
// if (dropdownListRef.current && multiple && selectBox && !children) {
|
|
918
|
+
// const input = dropdownListRef.current.querySelector(`input[value="${value}"]`);
|
|
919
|
+
// if (input) {
|
|
920
|
+
// input.checked = false;
|
|
921
|
+
// }
|
|
922
|
+
// }
|
|
923
|
+
// e?.parentNode?.remove();
|
|
924
|
+
// }, 0);
|
|
925
|
+
|
|
926
|
+
setValueMulti([...currentValue[unique]]);
|
|
953
927
|
!!onChange && onChange({
|
|
954
928
|
value: currentValue[unique],
|
|
955
929
|
removed: value
|
|
@@ -961,18 +935,17 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
961
935
|
if (disabled || readOnly || loading || !clearAble) return;
|
|
962
936
|
currentValue[unique] = multiple ? [] : '';
|
|
963
937
|
|
|
964
|
-
if (inputRef.current.tagName.toLowerCase() === 'div') {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
dropdownListRef.current.querySelectorAll('input').forEach(input => input.checked = false);
|
|
969
|
-
}
|
|
938
|
+
if (inputRef.current.tagName.toLowerCase() === 'div') {// inputRef.current.innerHTML = '';
|
|
939
|
+
// if (dropdownListRef.current) {
|
|
940
|
+
// dropdownListRef.current.querySelectorAll('input').forEach(input => (input.checked = false));
|
|
941
|
+
// }
|
|
970
942
|
} else {
|
|
971
943
|
inputRef.current.value = '';
|
|
972
944
|
setTextValue('');
|
|
973
945
|
} // onChangeValue('', '');
|
|
974
946
|
|
|
975
947
|
|
|
948
|
+
setValueMulti([]);
|
|
976
949
|
setShowClear(false);
|
|
977
950
|
e && e.target && e.target.blur();
|
|
978
951
|
updatePositionDropdown();
|
|
@@ -994,7 +967,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
994
967
|
const setValueIntoInput = source => {
|
|
995
968
|
if (!source && source !== 0) {
|
|
996
969
|
if (multiple) {
|
|
997
|
-
inputRef.current.innerHTML = '';
|
|
970
|
+
// inputRef.current.innerHTML = '';
|
|
998
971
|
currentValue[unique] = [];
|
|
999
972
|
} else {
|
|
1000
973
|
if (typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' && !isSearch[unique]) {
|
|
@@ -1027,8 +1000,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1027
1000
|
}
|
|
1028
1001
|
|
|
1029
1002
|
valueArr = [...new Set(valueArr)];
|
|
1030
|
-
currentValue[unique] = [];
|
|
1031
|
-
|
|
1003
|
+
currentValue[unique] = []; // inputRef.current.innerHTML = '';
|
|
1004
|
+
|
|
1032
1005
|
valueArr.forEach(v => {
|
|
1033
1006
|
var _currentObjectDefault4;
|
|
1034
1007
|
|
|
@@ -1074,35 +1047,29 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1074
1047
|
}
|
|
1075
1048
|
};
|
|
1076
1049
|
|
|
1077
|
-
const setMultipleValueHandler = (data, value
|
|
1078
|
-
let item = null;
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
const el = document.createElement('div');
|
|
1103
|
-
el.className = 'dropdown-item';
|
|
1104
|
-
el.style.display = 'flex';
|
|
1105
|
-
ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
1050
|
+
const setMultipleValueHandler = (data, value) => {
|
|
1051
|
+
// let item = null;
|
|
1052
|
+
// if (typeof renderSelectedItem === 'function') {
|
|
1053
|
+
// item = renderSelectedItem({ data, index });
|
|
1054
|
+
// } else {
|
|
1055
|
+
// const icon = getIconFromData(data);
|
|
1056
|
+
// const text = keyArr ? renderData(data, keyArr) : data[renderSelectedItem || displayExpr];
|
|
1057
|
+
// item = (
|
|
1058
|
+
// <Chip
|
|
1059
|
+
// startIcon={icon}
|
|
1060
|
+
// label={text}
|
|
1061
|
+
// size={itemMultipleSize}
|
|
1062
|
+
// disabled={disabled}
|
|
1063
|
+
// clearAble
|
|
1064
|
+
// onRemove={e => onRemove(e, value)}
|
|
1065
|
+
// style={{ margin: '3px 0', width: '100%' }}
|
|
1066
|
+
// />
|
|
1067
|
+
// );
|
|
1068
|
+
// }
|
|
1069
|
+
// const el = document.createElement('div');
|
|
1070
|
+
// el.className = 'dropdown-item';
|
|
1071
|
+
// el.style.display = 'flex';
|
|
1072
|
+
// ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
1106
1073
|
currentValue[unique].push(value);
|
|
1107
1074
|
};
|
|
1108
1075
|
|
|
@@ -1121,9 +1088,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1121
1088
|
} else if (iconExpr && iconExpr !== 'none') {
|
|
1122
1089
|
inputRef.current.innerHTML = '';
|
|
1123
1090
|
const icon = getIconFromData(data);
|
|
1124
|
-
const valueWithIcon = jsx(Fragment, null, icon && jsx(
|
|
1125
|
-
css: DropdownIconCSS
|
|
1126
|
-
}, icon), jsx(Typography, {
|
|
1091
|
+
const valueWithIcon = jsx(Fragment, null, icon && icon, jsx(Typography, {
|
|
1127
1092
|
type: 'p1',
|
|
1128
1093
|
lineClamp: 1,
|
|
1129
1094
|
hoverTooltip: !_isMobile
|
|
@@ -1230,6 +1195,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1230
1195
|
if (allValue[unique][allValue[unique].length - 1] !== valueProp) {
|
|
1231
1196
|
allValue[unique].push(valueProp);
|
|
1232
1197
|
}
|
|
1198
|
+
|
|
1199
|
+
if (multiple && valueProp) {
|
|
1200
|
+
setValueMulti(!Array.isArray(valueProp) ? [valueProp] : valueProp);
|
|
1201
|
+
}
|
|
1233
1202
|
}, [valueProp]);
|
|
1234
1203
|
useEffect(() => {
|
|
1235
1204
|
if (valueProp !== undefined && (!dropdownListRef.current || children || JSON.stringify(valueProp) !== JSON.stringify(currentValue[unique]))) {
|
|
@@ -1342,9 +1311,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1342
1311
|
}, jsx("div", {
|
|
1343
1312
|
css: _InputCSS,
|
|
1344
1313
|
className: 'DGN-UI-Dropdown-Form-Input'
|
|
1345
|
-
}, multiple ? jsx("div", { ...inputProps,
|
|
1314
|
+
}, multiple && valueMulti !== null && valueMulti !== void 0 && valueMulti.length ? jsx("div", { ...inputProps,
|
|
1346
1315
|
style: {
|
|
1347
1316
|
cursor: 'text',
|
|
1317
|
+
gap: spacing(0.5),
|
|
1348
1318
|
...inputStyle
|
|
1349
1319
|
},
|
|
1350
1320
|
ref: inputRef,
|
|
@@ -1354,7 +1324,46 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1354
1324
|
e.preventDefault();
|
|
1355
1325
|
return false;
|
|
1356
1326
|
}
|
|
1357
|
-
}
|
|
1327
|
+
}, valueMulti.map((vl, index) => {
|
|
1328
|
+
let dataFilter = [...dataSource];
|
|
1329
|
+
|
|
1330
|
+
if (Array.isArray(valueObjectDefault)) {
|
|
1331
|
+
dataFilter = [...dataFilter, ...valueObjectDefault];
|
|
1332
|
+
} else if (typeof valueObjectDefault === 'object') {
|
|
1333
|
+
dataFilter = [...dataFilter, valueObjectDefault];
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
const data = dataFilter.find(v => v[valueExpr] === vl);
|
|
1337
|
+
let text = '';
|
|
1338
|
+
|
|
1339
|
+
if (data) {
|
|
1340
|
+
var _displayExpr4;
|
|
1341
|
+
|
|
1342
|
+
const mask = (_displayExpr4 = displayExpr) === null || _displayExpr4 === void 0 ? void 0 : _displayExpr4.replace(regexBetween, _ => data[_]);
|
|
1343
|
+
text = mask === null || mask === void 0 ? void 0 : mask.replace(regexInclude, '');
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
let item = null;
|
|
1347
|
+
|
|
1348
|
+
if (typeof renderSelectedItem === 'function') {
|
|
1349
|
+
item = renderSelectedItem({
|
|
1350
|
+
data,
|
|
1351
|
+
index
|
|
1352
|
+
});
|
|
1353
|
+
} else {
|
|
1354
|
+
item = jsx(Chip, {
|
|
1355
|
+
key: index,
|
|
1356
|
+
startIcon: getIconFromData(data, true),
|
|
1357
|
+
label: text,
|
|
1358
|
+
size: 'medium',
|
|
1359
|
+
disabled: disabled,
|
|
1360
|
+
clearAble: true,
|
|
1361
|
+
onRemove: e => onRemove(e, vl)
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
return item;
|
|
1366
|
+
})) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", { ...inputProps,
|
|
1358
1367
|
contentEditable: !disabled && !allowSearch,
|
|
1359
1368
|
style: inputStyle,
|
|
1360
1369
|
ref: inputRef,
|
|
@@ -1409,7 +1418,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1409
1418
|
},
|
|
1410
1419
|
disabled: disabled || readOnly
|
|
1411
1420
|
})));
|
|
1412
|
-
}, [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, renderSelectedItem, placeholder,
|
|
1421
|
+
}, [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, renderSelectedItem, placeholder, dataSource, valueObjectDefault, valueExpr, displayExpr, openState, showClear, textValue, valueMulti]);
|
|
1413
1422
|
const ErrorView = useMemo(() => error && jsx(HelperText, {
|
|
1414
1423
|
disabled: disabled,
|
|
1415
1424
|
style: {
|
|
@@ -1421,7 +1430,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1421
1430
|
}, error), [error, disabled, errorStyle]);
|
|
1422
1431
|
const DropdownView = useMemo(() => {
|
|
1423
1432
|
return openState ? /*#__PURE__*/createPortal(showDropdown(), document.body) : null;
|
|
1424
|
-
}, [openState, dataSource, loading, multiple, selectBox]);
|
|
1433
|
+
}, [openState, valueMulti, dataSource, loading, multiple, selectBox, maximumSelectionLength]);
|
|
1425
1434
|
/* End component */
|
|
1426
1435
|
|
|
1427
1436
|
return jsx(Fragment, null, jsx("div", {
|
|
@@ -1440,25 +1449,7 @@ const InputCSS = (multiple, renderSelectedItem) => css`
|
|
|
1440
1449
|
${!multiple && renderSelectedItem ? `width: calc(100% - 34px)` : ''}
|
|
1441
1450
|
`;
|
|
1442
1451
|
|
|
1443
|
-
const
|
|
1444
|
-
${inlineFlex};
|
|
1445
|
-
${alignCenter};
|
|
1446
|
-
${positionRelative};
|
|
1447
|
-
${overflowHidden};
|
|
1448
|
-
${parseWidthHeight(32)};
|
|
1449
|
-
margin-right: ${spacing([2])};
|
|
1450
|
-
min-height: 32px;
|
|
1451
|
-
min-width: 32px;
|
|
1452
|
-
border-radius: 16px;
|
|
1453
|
-
img {
|
|
1454
|
-
${parseWidthHeight(32)};
|
|
1455
|
-
min-height: 32px;
|
|
1456
|
-
min-width: 32px;
|
|
1457
|
-
object-fit: cover;
|
|
1458
|
-
}
|
|
1459
|
-
`;
|
|
1460
|
-
|
|
1461
|
-
const DropdownInputCSS = (viewType, multiple, placeholder, itemMultipleSize, renderSelectedItem, disabled) => css`
|
|
1452
|
+
const DropdownInputCSS = (viewType, multiple, placeholder, renderSelectedItem, disabled) => css`
|
|
1462
1453
|
${flexRow};
|
|
1463
1454
|
${alignCenter};
|
|
1464
1455
|
${outlineNone};
|
|
@@ -1497,7 +1488,7 @@ const DropdownInputCSS = (viewType, multiple, placeholder, itemMultipleSize, ren
|
|
|
1497
1488
|
}
|
|
1498
1489
|
svg {
|
|
1499
1490
|
${borderBox};
|
|
1500
|
-
padding:
|
|
1491
|
+
padding: 2px;
|
|
1501
1492
|
}
|
|
1502
1493
|
}
|
|
1503
1494
|
.DGN-UI-Typography {
|
|
@@ -1505,30 +1496,6 @@ const DropdownInputCSS = (viewType, multiple, placeholder, itemMultipleSize, ren
|
|
|
1505
1496
|
color: ${systemDisabled}
|
|
1506
1497
|
`}
|
|
1507
1498
|
}
|
|
1508
|
-
.css-${DropdownIconCSS.name} {
|
|
1509
|
-
${disabled && `
|
|
1510
|
-
svg {
|
|
1511
|
-
path {
|
|
1512
|
-
fill: ${systemDisabled};
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
`}
|
|
1516
|
-
${renderSelectedItem ? `
|
|
1517
|
-
min-height: 24px;
|
|
1518
|
-
min-width: 24px;
|
|
1519
|
-
` : `
|
|
1520
|
-
height: 24px;
|
|
1521
|
-
min-height: 24px;
|
|
1522
|
-
width: 24px;
|
|
1523
|
-
min-width: 24px;
|
|
1524
|
-
img {
|
|
1525
|
-
height: 24px;
|
|
1526
|
-
min-height: 24px;
|
|
1527
|
-
width: 24px;
|
|
1528
|
-
min-width: 24px;
|
|
1529
|
-
}
|
|
1530
|
-
`}
|
|
1531
|
-
}
|
|
1532
1499
|
`;
|
|
1533
1500
|
|
|
1534
1501
|
const IconCSS = (viewType, loading, showClear) => css`
|
|
@@ -1789,7 +1756,6 @@ const DisabledCSS = css`
|
|
|
1789
1756
|
Dropdown.defaultProps = {
|
|
1790
1757
|
viewType: 'underlined',
|
|
1791
1758
|
itemMode: 'normal',
|
|
1792
|
-
itemMultipleSize: 'medium',
|
|
1793
1759
|
className: '',
|
|
1794
1760
|
label: '',
|
|
1795
1761
|
placeholder: getGlobal('dropdownPlaceholder'),
|
|
@@ -1821,9 +1787,6 @@ Dropdown.propTypes = {
|
|
|
1821
1787
|
/** The mode of item when rendering. */
|
|
1822
1788
|
itemMode: PropTypes.oneOf(['normal', 'table', 'treeview']),
|
|
1823
1789
|
|
|
1824
|
-
/** Use for [Chip](https://core.diginet.com.vn/ui/?path=/story/chip) component, default selected item when `multiple`. */
|
|
1825
|
-
itemMultipleSize: PropTypes.oneOf(['small', 'medium']),
|
|
1826
|
-
|
|
1827
1790
|
/** Class for component. */
|
|
1828
1791
|
className: PropTypes.string,
|
|
1829
1792
|
|
|
@@ -1989,6 +1952,9 @@ Dropdown.propTypes = {
|
|
|
1989
1952
|
/** Specifies a comparison operation used to search items. */
|
|
1990
1953
|
searchMode: PropTypes.oneOf(['contains', 'startswith', 'equals']),
|
|
1991
1954
|
|
|
1955
|
+
/** Set restrictions regarding the maximum number of options that can be selected. (Use with prop `multiple`) */
|
|
1956
|
+
maximumSelectionLength: PropTypes.number,
|
|
1957
|
+
|
|
1992
1958
|
/**
|
|
1993
1959
|
* ref methods
|
|
1994
1960
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { css, jsx } from '@emotion/core';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
6
|
+
import { forwardRef, memo, useState, useRef, useEffect, useMemo, Fragment } from 'react';
|
|
7
7
|
import theme from '../../../theme/settings';
|
|
8
8
|
import { randomString } from '../../../utils';
|
|
9
9
|
import Typography from './../../typography';
|
|
@@ -98,7 +98,7 @@ const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
98
98
|
color: disabled ? clDisabled : '',
|
|
99
99
|
type: 'p1',
|
|
100
100
|
...labelProps
|
|
101
|
-
}, jsx(
|
|
101
|
+
}, jsx(Fragment, null, label !== null && label !== void 0 ? label : value, required && jsx("span", {
|
|
102
102
|
style: {
|
|
103
103
|
color: disabled ? clDisabled : clDanger
|
|
104
104
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { css, jsx } from '@emotion/core';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
6
|
+
import { forwardRef, memo, useEffect, useMemo, useRef, useState, Fragment } from 'react';
|
|
7
7
|
import theme from '../../../theme/settings';
|
|
8
8
|
import generateRandom from '../../../utils/randomString';
|
|
9
9
|
import Typography from '../../typography';
|
|
@@ -184,7 +184,7 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
184
184
|
hoverTooltip: hoverTooltip,
|
|
185
185
|
lineClamp: lineClamp || null,
|
|
186
186
|
mapping: 'label'
|
|
187
|
-
}, jsx(
|
|
187
|
+
}, jsx(Fragment, null, label, required && jsx("span", {
|
|
188
188
|
style: {
|
|
189
189
|
color: disabled ? clDisabled : clDanger
|
|
190
190
|
}
|
package/global/index.js
CHANGED
|
@@ -31,7 +31,7 @@ const globalObject = {
|
|
|
31
31
|
// Transfer
|
|
32
32
|
choices: 'lựa chọn',
|
|
33
33
|
chosen: 'được chọn',
|
|
34
|
-
selected: '
|
|
34
|
+
selected: 'Đã chọn',
|
|
35
35
|
// Date Picker
|
|
36
36
|
helperInvalid: 'Sai định dạng',
|
|
37
37
|
helperValid: 'Phù hợp',
|
|
@@ -64,8 +64,8 @@ const globalObject = {
|
|
|
64
64
|
min: 'Chưa đạt giá trị tối thiểu cho phép',
|
|
65
65
|
required: 'Trường này bắt buộc nhập'
|
|
66
66
|
},
|
|
67
|
-
inputPlaceholder:
|
|
68
|
-
dropdownPlaceholder:
|
|
67
|
+
inputPlaceholder: 'Nhập',
|
|
68
|
+
dropdownPlaceholder: 'Chọn'
|
|
69
69
|
},
|
|
70
70
|
en: {
|
|
71
71
|
agree: 'Agree',
|
|
@@ -130,8 +130,8 @@ const globalObject = {
|
|
|
130
130
|
min: 'The minimum allowed value has not been reached',
|
|
131
131
|
required: 'This field is required'
|
|
132
132
|
},
|
|
133
|
-
inputPlaceholder:
|
|
134
|
-
dropdownPlaceholder:
|
|
133
|
+
inputPlaceholder: 'Type something',
|
|
134
|
+
dropdownPlaceholder: 'Select'
|
|
135
135
|
},
|
|
136
136
|
delayOnInput: 500
|
|
137
137
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diginet-core-ui",
|
|
3
|
-
"version": "1.3.70-beta.
|
|
3
|
+
"version": "1.3.70-beta.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"jest": "^27.5.1",
|
|
60
60
|
"lint-staged": "^12.1.2",
|
|
61
61
|
"mkdirp": "^1.0.4",
|
|
62
|
+
"npm-run-all": "^4.1.5",
|
|
62
63
|
"onchange": "^7.1.0",
|
|
63
64
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
64
65
|
"react": "^17.0.1",
|
package/utils/sb-teamplate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@emotion/core';
|
|
3
3
|
import { Col, Row, Tooltip, Typography } from '../components/index';
|
|
4
4
|
import { useTheme } from '../theme';
|
|
5
5
|
import { flexWrap, flexRow, alignCenter } from '../styles/general';
|
|
@@ -15,7 +15,7 @@ export const Template = ({
|
|
|
15
15
|
disabledTooltip,
|
|
16
16
|
component: Component,
|
|
17
17
|
horizontal
|
|
18
|
-
}
|
|
18
|
+
}) => {
|
|
19
19
|
return /*#__PURE__*/React.createElement(Row, {
|
|
20
20
|
style: {
|
|
21
21
|
padding: spacing(2)
|
|
@@ -57,7 +57,7 @@ const StoryBookTemplate = ({
|
|
|
57
57
|
propsCustom,
|
|
58
58
|
listItem,
|
|
59
59
|
componentName
|
|
60
|
-
}
|
|
60
|
+
}) => {
|
|
61
61
|
return /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
|
|
62
62
|
xs: 12
|
|
63
63
|
}, /*#__PURE__*/React.createElement(ImportComp, {
|