@antscorp/antsomi-ui 1.3.5-beta.364 → 1.3.5-beta.365
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/es/assets/css/main.scss +4 -0
- package/es/components/molecules/CalendarSelection/CalendarSelection.js +18 -9
- package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.js +40 -39
- package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +12 -81
- package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.js +1 -1
- package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +18 -5
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.js +7 -13
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +15 -56
- package/es/components/molecules/CalendarSelection/index.d.ts +26 -0
- package/es/components/molecules/CalendarSelection/index.js +4 -0
- package/es/components/molecules/index.d.ts +1 -1
- package/es/components/molecules/index.js +1 -1
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +7 -2
- package/es/components/organism/LeftMenu/utils/index.d.ts +2 -1
- package/es/components/organism/LeftMenu/utils/index.js +5 -1
- package/package.json +1 -1
package/es/assets/css/main.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
2
2
|
import React, { useLayoutEffect, useReducer, useRef } from 'react';
|
|
3
|
-
import { Divider } from 'antd';
|
|
3
|
+
import { Divider, ConfigProvider as AntdConfigProvider } from 'antd';
|
|
4
4
|
import { ActionContext, StateContext } from './context';
|
|
5
5
|
import { reducer, INITIAL_STATE } from './reducer';
|
|
6
6
|
import { StyledPopover, StyledPopoverBody, StyledPopoverContainer } from './styled';
|
|
@@ -34,12 +34,21 @@ export const CalendarSelection = props => {
|
|
|
34
34
|
React.createElement(Divider, { style: { margin: 0 } }),
|
|
35
35
|
React.createElement(Footer, null)));
|
|
36
36
|
// console.log(state.value.current.rangeValue);
|
|
37
|
-
return (React.createElement(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
37
|
+
return (React.createElement(AntdConfigProvider, { theme: {
|
|
38
|
+
components: {
|
|
39
|
+
Popover: {
|
|
40
|
+
borderRadiusLG: 0,
|
|
41
|
+
borderRadius: 0,
|
|
42
|
+
borderRadiusOuter: 0,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
} },
|
|
46
|
+
React.createElement(StateContext.Provider, { value: Object.assign(Object.assign({}, state), { rangeLimit,
|
|
47
|
+
timezone }) },
|
|
48
|
+
React.createElement(ActionContext.Provider, { value: { dispatch } },
|
|
49
|
+
React.createElement(StyledPopover, Object.assign({}, popoverProps, { open: state.open, arrow: false, trigger: ['click'], content: popoverContent, destroyTooltipOnHide: true, overlayInnerStyle: { padding: 0 }, onOpenChange: isOpen => {
|
|
50
|
+
if (!isOpen)
|
|
51
|
+
dispatch({ type: 'toggle_popover' });
|
|
52
|
+
} }),
|
|
53
|
+
React.createElement(TimeRangeDisplay, Object.assign({}, timeDisplayProps)))))));
|
|
45
54
|
};
|
|
@@ -65,44 +65,45 @@ export const CustomPicker = props => {
|
|
|
65
65
|
return React.createElement(StyledCellDate, { rangeColor: cellBgColor }, originNode);
|
|
66
66
|
}, [rangeValue]);
|
|
67
67
|
return (React.createElement(StyledCustomPickerRoot, null,
|
|
68
|
-
React.createElement("div", { className: "
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
React.createElement("div", { className: "range-input
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
68
|
+
React.createElement("div", { className: "section-input" },
|
|
69
|
+
React.createElement("div", { className: "range-inputs" }, rangeValue.map((range, rangeIdx) => (React.createElement(ConfigProvider, { key: rangeIdx, theme: {
|
|
70
|
+
components: {
|
|
71
|
+
DatePicker: Object.assign({ cellHeight: 20 }, (range.color && {
|
|
72
|
+
hoverBorderColor: range.color,
|
|
73
|
+
colorBorder: range.color,
|
|
74
|
+
colorPrimary: range.color,
|
|
75
|
+
colorPrimaryActive: range.color,
|
|
76
|
+
cellActiveWithRangeBg: new TinyColor(range.color).lighten(40).toHexString(),
|
|
77
|
+
})),
|
|
78
|
+
},
|
|
79
|
+
} },
|
|
80
|
+
React.createElement("div", { className: "range-input" },
|
|
81
|
+
React.createElement("div", { className: "range-input-label" }, generateRangeInputLabel(rangeIdx, range.label)),
|
|
82
|
+
React.createElement(RangePicker, Object.assign({}, rest, { open: true, value: [dayjs(range.start), dayjs(range.end)], onClick: () => setActiveRangeIdx(rangeIdx), getPopupContainer: () => popupContainer.current || document.body, panelRender: originalPanel => {
|
|
83
|
+
if (activeRangeIdx !== rangeIdx)
|
|
84
|
+
return null;
|
|
85
|
+
return originalPanel;
|
|
86
|
+
}, cellRender: (current, info) => {
|
|
87
|
+
if (typeof current === 'number' || info.type !== 'date') {
|
|
88
|
+
return info.originNode;
|
|
89
|
+
}
|
|
90
|
+
return renderCellDate(current, info.originNode);
|
|
91
|
+
}, onCalendarChange: value => {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
let start = '';
|
|
94
|
+
let end = '';
|
|
95
|
+
const valueFirst = dayjs((_a = value === null || value === void 0 ? void 0 : value.at(0)) === null || _a === void 0 ? void 0 : _a.toDate());
|
|
96
|
+
const valueSecond = dayjs((_b = value === null || value === void 0 ? void 0 : value.at(1)) === null || _b === void 0 ? void 0 : _b.toDate());
|
|
97
|
+
if (valueFirst.isBefore(valueSecond)) {
|
|
98
|
+
start = valueFirst.toISOString();
|
|
99
|
+
end = valueSecond.toISOString();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
start = valueSecond.toISOString();
|
|
103
|
+
end = valueFirst.toISOString();
|
|
104
|
+
}
|
|
105
|
+
handleCalendarChange(start, end);
|
|
106
|
+
} }))))))),
|
|
107
|
+
React.createElement(AutoUpdateTo, null)),
|
|
107
108
|
React.createElement(CalendarContainerStyled, { className: "calendar-container", ref: popupContainer })));
|
|
108
109
|
};
|
|
@@ -20,17 +20,23 @@ export const StyledCustomPickerRoot = styled.div `
|
|
|
20
20
|
display: flex;
|
|
21
21
|
flex-direction: column;
|
|
22
22
|
gap: 8px;
|
|
23
|
-
padding: 8px 12px;
|
|
24
23
|
|
|
25
|
-
.
|
|
24
|
+
.section-input {
|
|
25
|
+
padding: 8px 12px;
|
|
26
26
|
display: flex;
|
|
27
27
|
flex-direction: column;
|
|
28
|
-
gap:
|
|
28
|
+
gap: 4px;
|
|
29
29
|
|
|
30
|
-
.range-
|
|
30
|
+
.range-inputs {
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
|
-
gap:
|
|
33
|
+
gap: 8px;
|
|
34
|
+
|
|
35
|
+
.range-input {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 4px;
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
|
|
@@ -68,83 +74,8 @@ export const CalendarContainerStyled = styled.div `
|
|
|
68
74
|
|
|
69
75
|
/* Content */
|
|
70
76
|
.antsomi-picker-content {
|
|
71
|
-
/* Rectangle */
|
|
72
|
-
& td,
|
|
73
|
-
& th,
|
|
74
|
-
& .antsomi-picker-cell-inner,
|
|
75
|
-
& td::before {
|
|
76
|
-
/* width: var(--cellWidth);
|
|
77
|
-
height: var(--cellHeight); */
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/* Date node */
|
|
81
|
-
.antsomi-picker-cell-inner {
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/* Today node */
|
|
85
|
-
.antsomi-picker-cell-today {
|
|
86
|
-
.antsomi-picker-cell-inner {
|
|
87
|
-
&::before {
|
|
88
|
-
border-radius: 18px;
|
|
89
|
-
border: 0.0001rem solid var(--colorToDay);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* Selected node */
|
|
95
|
-
.antsomi-picker-cell-in-view {
|
|
96
|
-
&.antsomi-picker-cell-selected,
|
|
97
|
-
&.antsomi-picker-cell-range-start,
|
|
98
|
-
&.antsomi-picker-cell-range-end {
|
|
99
|
-
.antsomi-picker-cell-inner {
|
|
100
|
-
background: var(--colorSelected) !important;
|
|
101
|
-
border-radius: 18px !important;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* In Range */
|
|
107
|
-
.antsomi-picker-cell-in-range.antsomi-picker-cell-in-view {
|
|
108
|
-
&::before {
|
|
109
|
-
background: var(--colorInRange) !important;
|
|
110
|
-
}
|
|
111
|
-
.antsomi-picker-cell-inner {
|
|
112
|
-
/* background: var(--colorInRange) !important; */
|
|
113
|
-
&::after {
|
|
114
|
-
content: none !important;
|
|
115
|
-
background: var(--colorInRange) !important;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/* In Range Start End */
|
|
121
|
-
.antsomi-picker-cell-in-view.antsomi-picker-cell-range-start:not(
|
|
122
|
-
.antsomi-picker-cell-range-start-single
|
|
123
|
-
) {
|
|
124
|
-
&::before {
|
|
125
|
-
background: var(--colorInRange) !important;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
.antsomi-picker-cell-in-view.antsomi-picker-cell-range-end:not(
|
|
129
|
-
.antsomi-picker-cell-range-end-single
|
|
130
|
-
) {
|
|
131
|
-
&::before {
|
|
132
|
-
background: var(--colorInRange) !important;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/* Hover */
|
|
137
|
-
.antsomi-picker-cell-in-view {
|
|
138
|
-
&.antsomi-picker-cell-range-hover,
|
|
139
|
-
&.antsomi-picker-cell-range-hover-start,
|
|
140
|
-
&.antsomi-picker-cell-range-hover-end {
|
|
141
|
-
&:not(.antsomi-picker-cell-in-range)::after {
|
|
142
|
-
content: none !important;
|
|
143
|
-
border: none;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
77
|
}
|
|
78
|
+
|
|
148
79
|
.antsomi-picker-range-arrow {
|
|
149
80
|
display: none !important;
|
|
150
81
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyledRangePicker } from './styled';
|
|
3
3
|
const DATE_FORMAT = 'DD/MM/YYYY';
|
|
4
|
-
export const RangePicker = props => (React.createElement(StyledRangePicker, Object.assign({}, props, { allowEmpty: [true, true], allowClear: false, autoFocus: false, size: "
|
|
4
|
+
export const RangePicker = props => (React.createElement(StyledRangePicker, Object.assign({}, props, { allowEmpty: [true, true], allowClear: false, autoFocus: false, bordered: false, size: "middle", suffixIcon: false, format: DATE_FORMAT })));
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { DatePicker } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
2
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
const { RangePicker } = DatePicker;
|
|
4
5
|
export const StyledRangePicker = styled(RangePicker) `
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
&.antsomi-picker {
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
padding: 0;
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
.antsomi-picker-active-bar {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.antsomi-picker-input {
|
|
15
|
+
padding: 4px 10px;
|
|
16
|
+
|
|
17
|
+
&.antsomi-picker-input-active {
|
|
18
|
+
border-bottom: 2px solid ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.colorPrimary};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
input {
|
|
22
|
+
font-size: inherit;
|
|
23
|
+
}
|
|
11
24
|
}
|
|
12
25
|
}
|
|
13
26
|
`;
|
package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.js
CHANGED
|
@@ -10,22 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import cls from 'clsx';
|
|
13
|
-
import React, { forwardRef
|
|
13
|
+
import React, { forwardRef } from 'react';
|
|
14
14
|
import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
15
15
|
import { ACTION_TYPES } from '../../actions';
|
|
16
16
|
import { useCalendarSelectionContext } from '../../hooks';
|
|
17
17
|
import { getRangeTypeSelectedTitle, getRangeValueSelctedTitle } from '../../utils';
|
|
18
18
|
import { StyledBtnDisplayWrapper } from './styled';
|
|
19
|
-
import Icon from '@antscorp/icons';
|
|
20
19
|
const { Text } = Typography;
|
|
21
20
|
export const TimeRangeDisplay = forwardRef((props, ref) => {
|
|
22
21
|
const { showType = true, formatStart, formatEnd, operator } = props, rest = __rest(props, ["showType", "formatStart", "formatEnd", "operator"]);
|
|
23
22
|
const { state, action } = useCalendarSelectionContext();
|
|
24
|
-
// console.log({ state, action });
|
|
25
|
-
const [collapse, setCollapse] = useState(false);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setCollapse(false);
|
|
28
|
-
}, []);
|
|
29
23
|
const { rangeInfo, rangeValue } = state.value.original;
|
|
30
24
|
const handleOpenPopover = () => {
|
|
31
25
|
action.dispatch({ type: ACTION_TYPES.togglePopover });
|
|
@@ -36,14 +30,14 @@ export const TimeRangeDisplay = forwardRef((props, ref) => {
|
|
|
36
30
|
formatEnd,
|
|
37
31
|
operator,
|
|
38
32
|
});
|
|
39
|
-
|
|
33
|
+
const renderDateTitle = (title) => (React.createElement(Text, { className: "range-date-title", ellipsis: {
|
|
34
|
+
tooltip: title,
|
|
35
|
+
} }, title));
|
|
40
36
|
return (React.createElement(StyledBtnDisplayWrapper, Object.assign({ ref: ref }, rest, { onClick: handleOpenPopover, role: "button" }),
|
|
41
37
|
showType && (React.createElement(Text, { className: "range-type", ellipsis: { tooltip: rangeSelectedTitle } }, rangeSelectedTitle)),
|
|
42
|
-
React.createElement("div", { className: cls('range-date'
|
|
43
|
-
rangeValue.length > 0 && (
|
|
44
|
-
rangeValueTitles[0],
|
|
45
|
-
React.createElement(Icon, { className: "collapse-btn", type: "icon-ants-angle-down", style: { fontSize: 9 } }))),
|
|
38
|
+
React.createElement("div", { className: cls('range-date') },
|
|
39
|
+
rangeValue.length > 0 && renderDateTitle(rangeValueTitles[0]),
|
|
46
40
|
rangeValue.length > 1 && (React.createElement("div", { className: cls('collapse-wrapper') }, rangeValueTitles.slice(1).map(title => (React.createElement(React.Fragment, { key: title },
|
|
47
41
|
React.createElement("div", { className: "compare-title" }, "Compare"),
|
|
48
|
-
|
|
42
|
+
renderDateTitle(title)))))))));
|
|
49
43
|
});
|
|
@@ -1,70 +1,29 @@
|
|
|
1
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
export const StyledBtnDisplayWrapper = styled.div `
|
|
3
4
|
display: flex;
|
|
4
5
|
overflow: hidden;
|
|
5
6
|
text-overflow: ellipsis;
|
|
6
|
-
background-color: transparent;
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
width: fit-content;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 4px;
|
|
11
|
+
line-height: 1.4;
|
|
9
12
|
|
|
10
13
|
.range-type {
|
|
11
|
-
/* font-size: 0.75rem;
|
|
12
|
-
width: fit-content;
|
|
13
|
-
padding: 2px 8px; */
|
|
14
|
-
|
|
15
14
|
display: block;
|
|
16
|
-
font-size:
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
font-size: 11px;
|
|
16
|
+
padding: 3px 5px;
|
|
17
|
+
border-radius: 3px;
|
|
18
|
+
width: fit-content;
|
|
19
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw2};
|
|
20
|
+
line-height: inherit;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
.range-date {
|
|
22
|
-
|
|
23
|
-
border-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
background: transparent;
|
|
27
|
-
border-bottom: 1px solid rgb(184, 207, 230);
|
|
28
|
-
text-align: left;
|
|
29
|
-
display: flex;
|
|
30
|
-
-webkit-box-pack: justify;
|
|
31
|
-
justify-content: space-between;
|
|
32
|
-
-webkit-box-align: center;
|
|
33
|
-
align-items: center;
|
|
34
|
-
font-size: 0.75rem;
|
|
35
|
-
padding: 2px 8px;
|
|
36
|
-
max-width: unset;
|
|
37
|
-
|
|
38
|
-
.range-date-title {
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
gap: 8px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.collapse-wrapper {
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
gap: 2px;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
|
|
50
|
-
.compare-title {
|
|
51
|
-
font-size: 11px;
|
|
52
|
-
color: #878d93;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.collapse-btn {
|
|
57
|
-
padding: 4px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&.collapse {
|
|
61
|
-
.collapse-wrapper {
|
|
62
|
-
height: 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.collapse-btn {
|
|
66
|
-
transform: rotate(180deg);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
23
|
+
.range-date-title {
|
|
24
|
+
padding: 3px 5px;
|
|
25
|
+
border-radius: 3px;
|
|
26
|
+
background-color: ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue1_1};
|
|
27
|
+
line-height: inherit;
|
|
69
28
|
}
|
|
70
29
|
`;
|
|
@@ -28,3 +28,29 @@ export declare const CalendarSelectionConstants: {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export type { TriggerOutInfo, CalendarSelectionValue } from './types';
|
|
31
|
+
export declare const CalendarSelectionUtils: {
|
|
32
|
+
getDefaultDate: () => {
|
|
33
|
+
toDay: string;
|
|
34
|
+
yesterday: string;
|
|
35
|
+
startWeekSS: string;
|
|
36
|
+
startWeekMS: string;
|
|
37
|
+
last7Days: string;
|
|
38
|
+
startLastWeekSS: string;
|
|
39
|
+
startLastWeekMS: string;
|
|
40
|
+
endLastWeekSS: string;
|
|
41
|
+
endLastWeekMS: string;
|
|
42
|
+
last14Days: string;
|
|
43
|
+
startOfThisMonth: string;
|
|
44
|
+
endOfThisMonth: string;
|
|
45
|
+
last30Days: string;
|
|
46
|
+
lastMonthFirstDate: string;
|
|
47
|
+
lastMonthLastDate: string;
|
|
48
|
+
thisQuaterFirstDate: string;
|
|
49
|
+
thisQuaterLastDate: string;
|
|
50
|
+
lastQuaterFirstDate: string;
|
|
51
|
+
lastQuaterLastDate: string;
|
|
52
|
+
maxSub: number;
|
|
53
|
+
todayUptoCount: (val: number) => string;
|
|
54
|
+
yesterdayUptoCount: (val: number) => string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { TRIGGER_OUT_MODE, SELECTION_KEY, AUTO_UPDATE_TO_KEY } from './constants';
|
|
2
|
+
import { getDefaultDate } from './utils';
|
|
2
3
|
export { CalendarSelection } from './CalendarSelection';
|
|
3
4
|
export const CalendarSelectionConstants = {
|
|
4
5
|
TRIGGER_OUT_MODE,
|
|
5
6
|
SELECTION_KEY,
|
|
6
7
|
AUTO_UPDATE_TO_KEY,
|
|
7
8
|
};
|
|
9
|
+
export const CalendarSelectionUtils = {
|
|
10
|
+
getDefaultDate,
|
|
11
|
+
};
|
|
@@ -48,6 +48,7 @@ export { ModalSelect } from './ModalSelect';
|
|
|
48
48
|
export { EditableName } from './EditableName';
|
|
49
49
|
export { VirtualizedMenu } from './VirtualizedMenu';
|
|
50
50
|
export { SearchPopover, PopoverAddField } from './SearchPopover';
|
|
51
|
+
export { CalendarSelection, CalendarSelectionConstants, CalendarSelectionUtils, } from './CalendarSelection';
|
|
51
52
|
export * from './EmptyData';
|
|
52
53
|
export * from './PreviewModal';
|
|
53
54
|
export * from './Drawer';
|
|
@@ -55,7 +56,6 @@ export * from './DrawerDetail';
|
|
|
55
56
|
export * from './ThumbnailCard';
|
|
56
57
|
export * from './ProcessLoading';
|
|
57
58
|
export { EditorScript } from './EditorScript';
|
|
58
|
-
export { CalendarSelection, CalendarSelectionConstants } from './CalendarSelection';
|
|
59
59
|
export { EditorTab } from './EditorTab';
|
|
60
60
|
export { SelectAccount } from './SelectAccount';
|
|
61
61
|
export type { AdvancedPickerProps, TAdvancedPickerOption, TAdvancedRangePickerTimeRange, } from './DatePicker';
|
|
@@ -48,6 +48,7 @@ export { ModalSelect } from './ModalSelect';
|
|
|
48
48
|
export { EditableName } from './EditableName';
|
|
49
49
|
export { VirtualizedMenu } from './VirtualizedMenu';
|
|
50
50
|
export { SearchPopover, PopoverAddField } from './SearchPopover';
|
|
51
|
+
export { CalendarSelection, CalendarSelectionConstants, CalendarSelectionUtils, } from './CalendarSelection';
|
|
51
52
|
export * from './EmptyData';
|
|
52
53
|
export * from './PreviewModal';
|
|
53
54
|
export * from './Drawer';
|
|
@@ -55,6 +56,5 @@ export * from './DrawerDetail';
|
|
|
55
56
|
export * from './ThumbnailCard';
|
|
56
57
|
export * from './ProcessLoading';
|
|
57
58
|
export { EditorScript } from './EditorScript';
|
|
58
|
-
export { CalendarSelection, CalendarSelectionConstants } from './CalendarSelection';
|
|
59
59
|
export { EditorTab } from './EditorTab';
|
|
60
60
|
export { SelectAccount } from './SelectAccount';
|
|
@@ -30,7 +30,7 @@ const styles = {
|
|
|
30
30
|
};
|
|
31
31
|
export const ChildMenu = memo(props => {
|
|
32
32
|
const { items = [], onMenuClick } = props;
|
|
33
|
-
const auth = useLeftMenuStore(store =>
|
|
33
|
+
const { auth, env } = useLeftMenuStore(store => store.state.appConfig) || {};
|
|
34
34
|
const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
|
|
35
35
|
const menuItems = useLeftMenuStore(store => store.state.menuItems);
|
|
36
36
|
const customItems = useLeftMenuStore(store => store.state.customItems);
|
|
@@ -57,7 +57,12 @@ export const ChildMenu = memo(props => {
|
|
|
57
57
|
else {
|
|
58
58
|
const url = `${pathname}${hash}`;
|
|
59
59
|
// Active menu item by current url
|
|
60
|
-
const activeMenuItem = (_a = findLastMatchedItemByUrl({
|
|
60
|
+
const activeMenuItem = (_a = findLastMatchedItemByUrl({
|
|
61
|
+
url,
|
|
62
|
+
menuItems,
|
|
63
|
+
auth,
|
|
64
|
+
env,
|
|
65
|
+
})) === null || _a === void 0 ? void 0 : _a.menu_item_code;
|
|
61
66
|
if (activeMenuItem && activeMenuItem !== currentActiveItem) {
|
|
62
67
|
setCurrentActiveItem(activeMenuItem);
|
|
63
68
|
// Find parent key of active menu item to open it
|
|
@@ -32,7 +32,7 @@ export declare const getGeneratePath: (path: string, params?: Partial<PayloadInf
|
|
|
32
32
|
* This is used to delete the hash of the path returned from the api,
|
|
33
33
|
* the purpose of which is to compare with the url to activate the app
|
|
34
34
|
*/
|
|
35
|
-
export declare const getComparePath: (path: string) => string;
|
|
35
|
+
export declare const getComparePath: (path: string, env?: string) => string;
|
|
36
36
|
/**
|
|
37
37
|
* Creates an initial feature menu item object with default values.
|
|
38
38
|
* @param {Partial<TFeatureMenu>} featureMenuItem - The partial feature menu item object.
|
|
@@ -82,6 +82,7 @@ export declare const findLastMatchedItemByUrl: (args: {
|
|
|
82
82
|
url: string;
|
|
83
83
|
menuItems: TFeatureMenu[];
|
|
84
84
|
auth?: Partial<PayloadInfo>;
|
|
85
|
+
env?: string;
|
|
85
86
|
}) => TFeatureMenu | undefined;
|
|
86
87
|
export declare const findPathOfActiveItem: (args: {
|
|
87
88
|
activeMenuItem: TFeatureMenu;
|
|
@@ -16,6 +16,7 @@ import { APP_KEYS, MARKETING_CHANNEL_KEY, HOME_MENU_ITEMS, MARKETING_ROUTES, MEN
|
|
|
16
16
|
import { MARKETING_CHANNEL_CODE } from '../../../template/Layout/constants';
|
|
17
17
|
// Utils
|
|
18
18
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
19
|
+
import { ENV } from '@antscorp/antsomi-ui/es/config';
|
|
19
20
|
const PATH = 'src/components/organism/LeftMenu/utils/index.ts';
|
|
20
21
|
/**
|
|
21
22
|
* Converts a feature menu item to a menu item suitable for rendering in the UI.
|
|
@@ -101,8 +102,11 @@ export const getGeneratePath = (path, params) => {
|
|
|
101
102
|
* This is used to delete the hash of the path returned from the api,
|
|
102
103
|
* the purpose of which is to compare with the url to activate the app
|
|
103
104
|
*/
|
|
104
|
-
export const getComparePath = (path) => {
|
|
105
|
+
export const getComparePath = (path, env) => {
|
|
105
106
|
var _a;
|
|
107
|
+
if (env !== ENV.DEV) {
|
|
108
|
+
return path;
|
|
109
|
+
}
|
|
106
110
|
if (path === null || path === void 0 ? void 0 : path.includes('#')) {
|
|
107
111
|
const customPath = ((_a = path === null || path === void 0 ? void 0 : path.split('#')) === null || _a === void 0 ? void 0 : _a[1]) || '';
|
|
108
112
|
return customPath;
|