diginet-core-ui 1.4.50 → 1.4.51
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/calendar/function.js +1 -1
- package/components/form-control/calendar/index.js +1 -1
- package/components/form-control/date-range-picker/index.js +106 -3
- package/components/form-control/dropdown/index.js +15 -4
- package/components/form-control/number-input/index2.js +6 -3
- package/components/paging/page-info.js +1 -0
- package/components/popover/index.js +13 -13
- package/components/tree-view/index.js +4 -3
- package/global/index.js +10 -0
- package/package.json +1 -1
- package/readme.md +7 -0
|
@@ -652,7 +652,7 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
|
|
|
652
652
|
color: 'primary',
|
|
653
653
|
type: 'h3',
|
|
654
654
|
ref: refs.content,
|
|
655
|
-
format: ['
|
|
655
|
+
format: ['sentence']
|
|
656
656
|
}))), jsx("div", {
|
|
657
657
|
className: className.navigator.around
|
|
658
658
|
}, jsx(ButtonIcon, {
|
|
@@ -226,7 +226,7 @@ const Calendar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
226
226
|
* START EFFECT
|
|
227
227
|
*/
|
|
228
228
|
useEffect(() => {
|
|
229
|
-
if (defaultValue && defaultValue !== '' && isValidDate(defaultValue)) {
|
|
229
|
+
if (defaultValue && defaultValue !== '' && isValidDate(defaultValue) && !value) {
|
|
230
230
|
if (isBeforeLimit(min, defaultValue)) {
|
|
231
231
|
onUpdate(min);
|
|
232
232
|
} else if (isAfterLimit(max, defaultValue)) {
|
|
@@ -7,7 +7,7 @@ import locale from "../../../locale";
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
9
|
import { render } from 'react-dom';
|
|
10
|
-
import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexCol, flexRow, invisible, justifyEnd, left, parseHeight, parseMaxWidth, parseMinWidth, pointerEventsNone, positionFixed, shadowLarge, textCenter, top, userSelectNone, whiteSpaceNoWrap, z } from "../../../styles/general";
|
|
10
|
+
import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexCol, flexRow, invisible, justifyBetween, justifyEnd, left, parseHeight, parseMaxWidth, parseMinWidth, pointerEventsNone, positionFixed, shadowLarge, textCenter, top, userSelectNone, whiteSpaceNoWrap, z } from "../../../styles/general";
|
|
11
11
|
import { useTheme } from "../../../theme";
|
|
12
12
|
import { capitalizeSentenceCase, classNames, isEqual, date as moment, randomString, updatePosition } from "../../../utils";
|
|
13
13
|
import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from "../calendar/function";
|
|
@@ -128,6 +128,7 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
128
128
|
const [, setValueFr] = useState(Date.now());
|
|
129
129
|
const [, setValueTo] = useState(Date.now());
|
|
130
130
|
const [, setSelected] = useState(Date.now());
|
|
131
|
+
const [focusBtn, setFocusBtn] = useState('today');
|
|
131
132
|
const [valueState, setValueState] = useState();
|
|
132
133
|
const navigatorFromRefs = {
|
|
133
134
|
doubleLeft: useRef(null),
|
|
@@ -148,7 +149,13 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
148
149
|
const cancelText = getGlobal(['cancel']);
|
|
149
150
|
const confirmText = getGlobal(['confirm']);
|
|
150
151
|
const unitText = getGlobal([unitCount]);
|
|
152
|
+
const todayText = getGlobal(['today']);
|
|
153
|
+
const yesterdayText = getGlobal(['yesterday']);
|
|
154
|
+
const thisWeekText = getGlobal(['thisWeek']);
|
|
155
|
+
const thisMonthText = getGlobal(['thisMonth']);
|
|
151
156
|
const _ControlContainerCSS = ControlContainerCSS(theme);
|
|
157
|
+
const _FooterContainerCSS = FooterContainerCSS(theme);
|
|
158
|
+
const _DateOptionsCSS = DateOptionsCSS(theme);
|
|
152
159
|
const updateValues = useCallback(v => {
|
|
153
160
|
values.current = v;
|
|
154
161
|
setValues();
|
|
@@ -761,6 +768,46 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
761
768
|
!!onChange && onChange(e);
|
|
762
769
|
onSwap(true);
|
|
763
770
|
};
|
|
771
|
+
const onClickPresetDate = type => {
|
|
772
|
+
if (!type) return;
|
|
773
|
+
setFocusBtn(type);
|
|
774
|
+
let value = [];
|
|
775
|
+
const currentDay = new Date();
|
|
776
|
+
switch (type) {
|
|
777
|
+
case 'today':
|
|
778
|
+
value = [new Date(Date.now() - 25200000).valueOf()];
|
|
779
|
+
break;
|
|
780
|
+
case 'yesterday':
|
|
781
|
+
{
|
|
782
|
+
const yesterday = new Date(Date.now() - 86400000 - 25200000);
|
|
783
|
+
value = [new Date(Date.now() - 86400000 - 25200000).valueOf()];
|
|
784
|
+
valueFr.current = yesterday;
|
|
785
|
+
break;
|
|
786
|
+
}
|
|
787
|
+
case 'thisWeek':
|
|
788
|
+
{
|
|
789
|
+
const first = currentDay.getDate() - currentDay.getDay() + 1; // First day is the day of the month - the day of the week
|
|
790
|
+
const last = first + 6; // last day is the first day + 6
|
|
791
|
+
const firstday = new Date(currentDay.setDate(first)).setHours(0, 0, 0).valueOf();
|
|
792
|
+
const lastday = new Date(currentDay.setDate(last)).setHours(0, 0, 0).valueOf();
|
|
793
|
+
value = [firstday, lastday];
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
case 'thisMonth':
|
|
797
|
+
{
|
|
798
|
+
let firstday = new Date(currentDay.getFullYear(), currentDay.getMonth(), 1).valueOf();
|
|
799
|
+
let lastday = new Date(currentDay.getFullYear(), currentDay.getMonth() + 1, 0).valueOf();
|
|
800
|
+
value = [firstday, lastday];
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
default:
|
|
804
|
+
break;
|
|
805
|
+
}
|
|
806
|
+
updateValues(value);
|
|
807
|
+
updateSelected(countDay(values.current));
|
|
808
|
+
renderPicker();
|
|
809
|
+
controls ? setButtonState() : onChangeValue(values.current);
|
|
810
|
+
};
|
|
764
811
|
useEffect(() => {
|
|
765
812
|
update(defaultValue);
|
|
766
813
|
return () => {
|
|
@@ -768,9 +815,11 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
768
815
|
};
|
|
769
816
|
}, []);
|
|
770
817
|
useEffect(() => {
|
|
771
|
-
if (value) {
|
|
818
|
+
if (value && value[0] && value[1]) {
|
|
772
819
|
update(value);
|
|
773
820
|
closePicker();
|
|
821
|
+
} else {
|
|
822
|
+
ipRef.current.value = '';
|
|
774
823
|
}
|
|
775
824
|
}, [value]);
|
|
776
825
|
useEffect(() => {
|
|
@@ -856,6 +905,50 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
856
905
|
const endIcon = actionIconAt === 'end' && iconComp;
|
|
857
906
|
const startIcon = actionIconAt === 'start' && iconComp;
|
|
858
907
|
const footerMemo = jsx("div", {
|
|
908
|
+
css: _FooterContainerCSS
|
|
909
|
+
}, jsx("div", {
|
|
910
|
+
css: _DateOptionsCSS
|
|
911
|
+
}, jsx(Button, {
|
|
912
|
+
size: "medium",
|
|
913
|
+
labelProps: {
|
|
914
|
+
type: 'h4',
|
|
915
|
+
style: {
|
|
916
|
+
textTransform: 'initial'
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
onClick: () => onClickPresetDate('today'),
|
|
920
|
+
color: focusBtn === 'today' && 'primary'
|
|
921
|
+
}, todayText), jsx(Button, {
|
|
922
|
+
size: "medium",
|
|
923
|
+
labelProps: {
|
|
924
|
+
type: 'h4',
|
|
925
|
+
style: {
|
|
926
|
+
textTransform: 'initial'
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
onClick: () => onClickPresetDate('yesterday'),
|
|
930
|
+
color: focusBtn === 'yesterday' && 'primary'
|
|
931
|
+
}, yesterdayText), jsx(Button, {
|
|
932
|
+
size: "medium",
|
|
933
|
+
labelProps: {
|
|
934
|
+
type: 'h4',
|
|
935
|
+
style: {
|
|
936
|
+
textTransform: 'initial'
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
onClick: () => onClickPresetDate('thisWeek'),
|
|
940
|
+
color: focusBtn === 'thisWeek' && 'primary'
|
|
941
|
+
}, thisWeekText), jsx(Button, {
|
|
942
|
+
size: "medium",
|
|
943
|
+
labelProps: {
|
|
944
|
+
type: 'h4',
|
|
945
|
+
style: {
|
|
946
|
+
textTransform: 'initial'
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
onClick: () => onClickPresetDate('thisMonth'),
|
|
950
|
+
color: focusBtn === 'thisMonth' && 'primary'
|
|
951
|
+
}, thisMonthText)), jsx("div", {
|
|
859
952
|
css: _ControlContainerCSS,
|
|
860
953
|
className: unique.footer,
|
|
861
954
|
ref: footerRef
|
|
@@ -874,7 +967,7 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
874
967
|
color: 'info',
|
|
875
968
|
className: unique.confirm,
|
|
876
969
|
onClick: onConfirm
|
|
877
|
-
}, confirmText));
|
|
970
|
+
}, confirmText)));
|
|
878
971
|
const leftCalendarComp = jsx("div", {
|
|
879
972
|
css: generateCalendarCSS(unique, false, false, theme)
|
|
880
973
|
}, renderNavigator(unique, navigatorFromRefs, e => setPrevTime(e, 'year', valueFr.current, 'from'), e => setPrevTime(e, 'month', valueFr.current, 'from'), e => setNextTime(e, 'month', valueFr.current, 'from'), e => setNextTime(e, 'year', valueFr.current, 'from')), jsx("div", {
|
|
@@ -1029,6 +1122,16 @@ const ControlContainerCSS = ({
|
|
|
1029
1122
|
${justifyEnd};
|
|
1030
1123
|
margin: ${spacing([0, 4, 4])};
|
|
1031
1124
|
`;
|
|
1125
|
+
const FooterContainerCSS = () => css`
|
|
1126
|
+
${displayFlex};
|
|
1127
|
+
${justifyBetween};
|
|
1128
|
+
`;
|
|
1129
|
+
const DateOptionsCSS = ({
|
|
1130
|
+
spacing
|
|
1131
|
+
}) => css`
|
|
1132
|
+
${displayFlex};
|
|
1133
|
+
padding-left: ${spacing(4)}px;
|
|
1134
|
+
`;
|
|
1032
1135
|
const pickerCSS = {
|
|
1033
1136
|
backGr: ({
|
|
1034
1137
|
zIndex
|
|
@@ -77,6 +77,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
77
77
|
inputStyle,
|
|
78
78
|
itemMode,
|
|
79
79
|
isInGrid,
|
|
80
|
+
isPaging,
|
|
80
81
|
label,
|
|
81
82
|
labelProps,
|
|
82
83
|
limit,
|
|
@@ -135,6 +136,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
135
136
|
skip: skip || 0,
|
|
136
137
|
limit: limit || 50
|
|
137
138
|
});
|
|
139
|
+
const txtSearchRef = useRef(false);
|
|
138
140
|
const [unique] = useState(randomString(6, {
|
|
139
141
|
allowNumber: false,
|
|
140
142
|
allowSymbol: false
|
|
@@ -170,7 +172,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
170
172
|
const _IconCSS = IconCSS(viewType, theme);
|
|
171
173
|
const _DropdownFormCSS = viewType === 'outlined' ? DropdownFormOutlinedCSS(disabled, readOnly, placeholder, theme) : DropdownFormCSS(viewType, multiple, disabled, readOnly, placeholder, _DropdownInputCSS.name, theme);
|
|
172
174
|
const _DropdownListCSS = DropdownListCSS(theme);
|
|
173
|
-
const _DropdownBoxCSS = DropdownBoxCSS(loadingState, theme, itemMode);
|
|
175
|
+
const _DropdownBoxCSS = DropdownBoxCSS(loadingState, theme, itemMode, isPaging);
|
|
174
176
|
const _DropdownItemCSS = DropdownItemCSS(multiple, selectBox, theme);
|
|
175
177
|
const _DropdownRootCSS = DropdownRootCSS(_DropdownFormCSS.name, _DropdownInputCSS.name, theme);
|
|
176
178
|
const _CheckBoxCSS = CheckBoxCSS(theme);
|
|
@@ -455,7 +457,8 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
455
457
|
parentID: treeViewParentID,
|
|
456
458
|
value: typeof currentValue[unique] === 'string' ? [currentValue[unique]] : currentValue[unique],
|
|
457
459
|
onChange: (e, value) => onChangeValue(e, '', multiple ? value : e.value),
|
|
458
|
-
renderItem: renderItem
|
|
460
|
+
renderItem: renderItem,
|
|
461
|
+
isInDropdown: true
|
|
459
462
|
}) : EmptyDataText);
|
|
460
463
|
};
|
|
461
464
|
|
|
@@ -674,6 +677,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
674
677
|
var _e$target$value;
|
|
675
678
|
if (!dropdownRef.current) return; // Kiểm tra nếu dropdown đóng trước searchDelayTime thì không chạy
|
|
676
679
|
setTxtSearch((_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : '');
|
|
680
|
+
txtSearchRef.current = !!e.target.value;
|
|
677
681
|
if (onInput) {
|
|
678
682
|
onInput(e);
|
|
679
683
|
}
|
|
@@ -938,6 +942,13 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
938
942
|
return () => {
|
|
939
943
|
allValue[unique] = null;
|
|
940
944
|
closeDropdown(null, 'cleanup');
|
|
945
|
+
if (onInput && txtSearchRef.current) {
|
|
946
|
+
onInput({
|
|
947
|
+
target: {
|
|
948
|
+
value: ''
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
}
|
|
941
952
|
};
|
|
942
953
|
}, []);
|
|
943
954
|
useEffect(() => {
|
|
@@ -1554,8 +1565,8 @@ const DropdownListCSS = ({
|
|
|
1554
1565
|
`;
|
|
1555
1566
|
const DropdownBoxCSS = (loading, {
|
|
1556
1567
|
colors
|
|
1557
|
-
}, itemMode) => css`
|
|
1558
|
-
${loading || itemMode === 'treeview' ? overflowHidden : overflowYScroll};
|
|
1568
|
+
}, itemMode, isPaging) => css`
|
|
1569
|
+
${loading || itemMode === 'treeview' || isPaging ? overflowHidden : overflowYScroll};
|
|
1559
1570
|
${parseMaxHeight(280)};
|
|
1560
1571
|
&::-webkit-scrollbar {
|
|
1561
1572
|
${borderRadius(4)};
|
|
@@ -49,7 +49,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
49
49
|
labelProps,
|
|
50
50
|
max: maxProp,
|
|
51
51
|
maxDigit,
|
|
52
|
-
min,
|
|
52
|
+
min: minProp,
|
|
53
53
|
nonStyle,
|
|
54
54
|
onBlur,
|
|
55
55
|
onChange,
|
|
@@ -69,9 +69,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
69
69
|
viewType
|
|
70
70
|
} = props;
|
|
71
71
|
let max = maxProp;
|
|
72
|
+
let min = minProp;
|
|
72
73
|
let thousandSymbol = thousandSeparator;
|
|
73
74
|
let decimalSymbol = decimalSymbolProp;
|
|
74
75
|
let valueProps = valueProp;
|
|
76
|
+
if (!min && min !== 0) min = -Infinity;
|
|
77
|
+
if (!max && max !== 0) max = Infinity;
|
|
75
78
|
const pos = useRef(null);
|
|
76
79
|
const ref = useRef(null);
|
|
77
80
|
const globalRef = useRef({});
|
|
@@ -135,7 +138,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
135
138
|
pos.current = selectionStart + (number.toString().length - 1 === vl.toString().length ? 1 : 0);
|
|
136
139
|
}
|
|
137
140
|
return number;
|
|
138
|
-
}, [decimalSymbol, max, value]);
|
|
141
|
+
}, [decimalSymbol, max, value, decimalDigit]);
|
|
139
142
|
|
|
140
143
|
/**
|
|
141
144
|
* Convert money to format number
|
|
@@ -310,7 +313,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
310
313
|
// setValue(parseNumberToMoney(valueProps?.toString().replace(regexValidNumber, ''), true));
|
|
311
314
|
setValue(parseNumberToMoney((_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.toString().replace(regexValidNumber, ''), true));
|
|
312
315
|
}
|
|
313
|
-
}, [valueProps]);
|
|
316
|
+
}, [valueProps, decimalDigit]);
|
|
314
317
|
useEffect(() => {
|
|
315
318
|
setError(errorProp);
|
|
316
319
|
}, [errorProp]);
|
|
@@ -398,6 +398,7 @@ const PagingInfo = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
|
398
398
|
height: 24,
|
|
399
399
|
color: 'line/category'
|
|
400
400
|
}) : getGlobal('lineNumber'), jsx(Dropdown, {
|
|
401
|
+
isPaging: true,
|
|
401
402
|
allowSearch: false,
|
|
402
403
|
viewType: 'underlined',
|
|
403
404
|
dataSource: listPerPageData,
|
|
@@ -202,7 +202,7 @@ const Popover = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) =
|
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
const updatePositionPopover = (el = null, cb) => {
|
|
205
|
-
var _window, _window2, _anchor6, _anchorRect, _anchorRect2, _anchor7, _anchorRect3, _anchorRect4, _anchorRect5, _anchorRect6, _anchorRect7, _anchorRect8, _anchorRect9,
|
|
205
|
+
var _window, _window2, _anchor6, _anchorRect, _anchorRect2, _anchor7, _anchorRect3, _anchorRect4, _anchorRect5, _anchorRect6, _anchorRect7, _anchorRect8, _anchorRect9, _anchorRect0, _anchorRect1, _anchorRect10, _newDirectionObject, _newDirectionObject$t, _transformOrigin, _newDirectionObject2, _newDirectionObject2$, _transformOrigin2;
|
|
206
206
|
if (el instanceof Element) setElement(el);
|
|
207
207
|
if (!ref.current) {
|
|
208
208
|
window.removeEventListener('resize', updatePositionPopover);
|
|
@@ -336,36 +336,36 @@ const Popover = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) =
|
|
|
336
336
|
|
|
337
337
|
// Valid mean popover not at top-left, top-right, bottom-left, bottom-right
|
|
338
338
|
const validVerticalArrow = left >= ((_anchorRect5 = anchorRect) === null || _anchorRect5 === void 0 ? void 0 : _anchorRect5.left) + ((_anchorRect6 = anchorRect) === null || _anchorRect6 === void 0 ? void 0 : _anchorRect6.width) / 2 - popoverWidth && left <= ((_anchorRect7 = anchorRect) === null || _anchorRect7 === void 0 ? void 0 : _anchorRect7.right) - ((_anchorRect8 = anchorRect) === null || _anchorRect8 === void 0 ? void 0 : _anchorRect8.width) / 2 + popoverWidth;
|
|
339
|
-
const validHorizontalArrow = top >= ((_anchorRect9 = anchorRect) === null || _anchorRect9 === void 0 ? void 0 : _anchorRect9.top) + ((
|
|
339
|
+
const validHorizontalArrow = top >= ((_anchorRect9 = anchorRect) === null || _anchorRect9 === void 0 ? void 0 : _anchorRect9.top) + ((_anchorRect0 = anchorRect) === null || _anchorRect0 === void 0 ? void 0 : _anchorRect0.height) / 2 - popoverHeight && top <= ((_anchorRect1 = anchorRect) === null || _anchorRect1 === void 0 ? void 0 : _anchorRect1.bottom) - ((_anchorRect10 = anchorRect) === null || _anchorRect10 === void 0 ? void 0 : _anchorRect10.height) / 2;
|
|
340
340
|
|
|
341
341
|
// Get arrow's position
|
|
342
342
|
if (arrow && translate) {
|
|
343
343
|
switch (aPosition) {
|
|
344
344
|
case 'top':
|
|
345
345
|
if (validVerticalArrow) {
|
|
346
|
-
var
|
|
347
|
-
arrowPosition.left = ((
|
|
346
|
+
var _anchorRect11, _anchorRect12;
|
|
347
|
+
arrowPosition.left = ((_anchorRect11 = anchorRect) === null || _anchorRect11 === void 0 ? void 0 : _anchorRect11.width) / 2 + ((_anchorRect12 = anchorRect) === null || _anchorRect12 === void 0 ? void 0 : _anchorRect12.left) - arrowSize + 'px';
|
|
348
348
|
arrowPosition.top = Math.round(top) - arrowSize + 'px';
|
|
349
349
|
}
|
|
350
350
|
break;
|
|
351
351
|
case 'bottom':
|
|
352
352
|
if (validVerticalArrow) {
|
|
353
|
-
var
|
|
354
|
-
arrowPosition.left = ((
|
|
353
|
+
var _anchorRect13, _anchorRect14;
|
|
354
|
+
arrowPosition.left = ((_anchorRect13 = anchorRect) === null || _anchorRect13 === void 0 ? void 0 : _anchorRect13.width) / 2 + ((_anchorRect14 = anchorRect) === null || _anchorRect14 === void 0 ? void 0 : _anchorRect14.left) - arrowSize + 'px';
|
|
355
355
|
arrowPosition.top = Math.round(top) + popoverHeight + 'px';
|
|
356
356
|
}
|
|
357
357
|
break;
|
|
358
358
|
case 'left':
|
|
359
359
|
if (validHorizontalArrow) {
|
|
360
|
-
var
|
|
361
|
-
arrowPosition.top = ((
|
|
360
|
+
var _anchorRect15, _anchorRect16;
|
|
361
|
+
arrowPosition.top = ((_anchorRect15 = anchorRect) === null || _anchorRect15 === void 0 ? void 0 : _anchorRect15.height) / 2 + ((_anchorRect16 = anchorRect) === null || _anchorRect16 === void 0 ? void 0 : _anchorRect16.top) - arrowSize / 2 + 'px';
|
|
362
362
|
arrowPosition.left = Math.round(left) - 1.5 * arrowSize + 'px';
|
|
363
363
|
}
|
|
364
364
|
break;
|
|
365
365
|
case 'right':
|
|
366
366
|
if (validHorizontalArrow) {
|
|
367
|
-
var
|
|
368
|
-
arrowPosition.top = ((
|
|
367
|
+
var _anchorRect17, _anchorRect18;
|
|
368
|
+
arrowPosition.top = ((_anchorRect17 = anchorRect) === null || _anchorRect17 === void 0 ? void 0 : _anchorRect17.height) / 2 + ((_anchorRect18 = anchorRect) === null || _anchorRect18 === void 0 ? void 0 : _anchorRect18.top) - arrowSize / 2 + 'px';
|
|
369
369
|
arrowPosition.left = Math.round(left) + popoverWidth - arrowSize / 2 + 'px';
|
|
370
370
|
}
|
|
371
371
|
break;
|
|
@@ -495,15 +495,15 @@ const Popover = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) =
|
|
|
495
495
|
return currentRef;
|
|
496
496
|
});
|
|
497
497
|
const renderAnchor = () => {
|
|
498
|
-
var
|
|
499
|
-
if (!((
|
|
498
|
+
var _anchor0, _anchor1, _anchor1$props;
|
|
499
|
+
if (!((_anchor0 = anchor) !== null && _anchor0 !== void 0 && _anchor0.type)) return null;
|
|
500
500
|
const AnchorTag = /*#__PURE__*/React.cloneElement(anchor, {
|
|
501
501
|
ref: ref => {
|
|
502
502
|
anchor = ref;
|
|
503
503
|
},
|
|
504
504
|
style: {
|
|
505
505
|
cursor: 'pointer',
|
|
506
|
-
...(((
|
|
506
|
+
...(((_anchor1 = anchor) === null || _anchor1 === void 0 ? void 0 : (_anchor1$props = _anchor1.props) === null || _anchor1$props === void 0 ? void 0 : _anchor1$props.style) || {})
|
|
507
507
|
}
|
|
508
508
|
});
|
|
509
509
|
return AnchorTag;
|
|
@@ -37,6 +37,7 @@ const TreeView = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
37
37
|
expand,
|
|
38
38
|
expandIcon,
|
|
39
39
|
id,
|
|
40
|
+
isInDropdown,
|
|
40
41
|
multiple,
|
|
41
42
|
multipleValueMode,
|
|
42
43
|
onChange,
|
|
@@ -69,7 +70,7 @@ const TreeView = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
69
70
|
allowNumber: false,
|
|
70
71
|
allowSymbol: false
|
|
71
72
|
}));
|
|
72
|
-
const _TreeViewRootCSS = TreeViewRootCSS(theme);
|
|
73
|
+
const _TreeViewRootCSS = TreeViewRootCSS(theme, isInDropdown);
|
|
73
74
|
const determinateCheckbox = (input, determinate) => {
|
|
74
75
|
if (multipleValueMode === 'multiple' || disabledRelevantValue) {
|
|
75
76
|
input.classList[determinate ? 'add' : 'remove']('determinate');
|
|
@@ -793,7 +794,7 @@ const TreeView = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
793
794
|
const TreeViewRootCSS = ({
|
|
794
795
|
colors,
|
|
795
796
|
spacing
|
|
796
|
-
}) => css`
|
|
797
|
+
}, isInDropdown) => css`
|
|
797
798
|
${displayBlock};
|
|
798
799
|
${positionRelative};
|
|
799
800
|
.DGN-UI-Accordion {
|
|
@@ -833,7 +834,7 @@ const TreeViewRootCSS = ({
|
|
|
833
834
|
.TreeView-Content {
|
|
834
835
|
${displayBlock};
|
|
835
836
|
${positionRelative};
|
|
836
|
-
${parseMaxHeight(240)};
|
|
837
|
+
${isInDropdown && parseMaxHeight(240)};
|
|
837
838
|
${overflowYScroll};
|
|
838
839
|
&::-webkit-scrollbar {
|
|
839
840
|
${borderRadius(4)};
|
package/global/index.js
CHANGED
|
@@ -45,6 +45,11 @@ const globalObject = {
|
|
|
45
45
|
label: 'Thời gian',
|
|
46
46
|
weekdaysLong: ['Hai', 'Ba', 'Tư', 'Năm', 'Sáu', 'Bảy', 'CN'],
|
|
47
47
|
weekdaysShort: ['H', 'B', 'T', 'N', 'S', 'B', 'C'],
|
|
48
|
+
// Daterange Picker
|
|
49
|
+
today: 'Hôm nay',
|
|
50
|
+
yesterday: 'Hôm qua',
|
|
51
|
+
thisWeek: 'Tuần này',
|
|
52
|
+
thisMonth: 'Tháng này',
|
|
48
53
|
// Time Picker
|
|
49
54
|
months: {
|
|
50
55
|
full: ['tháng 01', 'tháng 02', 'tháng 03', 'tháng 04', 'tháng 05', 'tháng 06', 'tháng 07', 'tháng 08', 'tháng 09', 'tháng 10', 'tháng 11', 'tháng 12'],
|
|
@@ -120,6 +125,11 @@ const globalObject = {
|
|
|
120
125
|
label: 'Time',
|
|
121
126
|
weekdaysLong: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
122
127
|
weekdaysShort: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
|
|
128
|
+
// Daterange Picker
|
|
129
|
+
today: 'Today',
|
|
130
|
+
yesterday: 'Yesterday',
|
|
131
|
+
thisWeek: 'This week',
|
|
132
|
+
thisMonth: 'This month',
|
|
123
133
|
// Time Picker
|
|
124
134
|
months: {
|
|
125
135
|
full: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -42,6 +42,13 @@ npm test
|
|
|
42
42
|
|
|
43
43
|
## Changelog
|
|
44
44
|
|
|
45
|
+
## 1.4.51
|
|
46
|
+
- \[Changed\]: Treeview - Treeview keeps the search bar visible while scrolling
|
|
47
|
+
- \[Changed\]: DateRangePicker - Quick-selection in DateRangePicker
|
|
48
|
+
- \[Fixed\]: Dropdown – Dropdown data lost in the Filter bar on the Web
|
|
49
|
+
- \[Fixed\]: DateRangePicker – When clearing the value in DateRangePicker CORE, the UI still displays the old value.
|
|
50
|
+
- \[Fixed\]: NumberInput – NumberInput Core when changing 'decimalDigit'
|
|
51
|
+
|
|
45
52
|
## 1.4.50
|
|
46
53
|
- \[Added\]: Icon – Add IconMenu MHRP39N0025, MHRP39N0027, MHRP39N0028
|
|
47
54
|
- \[Added\]: Attachment – Add HEIF support to getFileType in Attachment
|