@antscorp/antsomi-ui 1.3.5-beta.364 → 1.3.5-beta.366

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.
@@ -20,3 +20,7 @@
20
20
  -moz-box-sizing: border-box;
21
21
  box-sizing: border-box;
22
22
  }
23
+
24
+ .rc-virtual-list-scrollbar {
25
+ width: 4px !important;
26
+ }
@@ -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(StateContext.Provider, { value: Object.assign(Object.assign({}, state), { rangeLimit,
38
- timezone }) },
39
- React.createElement(ActionContext.Provider, { value: { dispatch } },
40
- React.createElement(StyledPopover, Object.assign({}, popoverProps, { open: state.open, arrow: false, trigger: ['click'], content: popoverContent, destroyTooltipOnHide: true, overlayInnerStyle: { padding: 0 }, onOpenChange: isOpen => {
41
- if (!isOpen)
42
- dispatch({ type: 'toggle_popover' });
43
- } }),
44
- React.createElement(TimeRangeDisplay, Object.assign({}, timeDisplayProps))))));
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: "range-inputs" }, rangeValue.map((range, rangeIdx) => (React.createElement(ConfigProvider, { key: rangeIdx, theme: {
69
- components: {
70
- DatePicker: Object.assign({ cellHeight: 20 }, (range.color && {
71
- hoverBorderColor: range.color,
72
- colorBorder: range.color,
73
- colorPrimary: range.color,
74
- colorPrimaryActive: range.color,
75
- cellActiveWithRangeBg: new TinyColor(range.color).lighten(40).toHexString(),
76
- })),
77
- },
78
- } },
79
- React.createElement("div", { className: "range-input" },
80
- React.createElement("div", { className: "range-input-label" }, generateRangeInputLabel(rangeIdx, range.label)),
81
- 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 => {
82
- if (activeRangeIdx !== rangeIdx)
83
- return null;
84
- return originalPanel;
85
- }, cellRender: (current, info) => {
86
- if (typeof current === 'number' || info.type !== 'date') {
87
- return info.originNode;
88
- }
89
- return renderCellDate(current, info.originNode);
90
- }, onCalendarChange: value => {
91
- var _a, _b;
92
- let start = '';
93
- let end = '';
94
- const valueFirst = dayjs((_a = value === null || value === void 0 ? void 0 : value.at(0)) === null || _a === void 0 ? void 0 : _a.toDate());
95
- const valueSecond = dayjs((_b = value === null || value === void 0 ? void 0 : value.at(1)) === null || _b === void 0 ? void 0 : _b.toDate());
96
- if (valueFirst.isBefore(valueSecond)) {
97
- start = valueFirst.toISOString();
98
- end = valueSecond.toISOString();
99
- }
100
- else {
101
- start = valueSecond.toISOString();
102
- end = valueFirst.toISOString();
103
- }
104
- handleCalendarChange(start, end);
105
- } }))))))),
106
- React.createElement(AutoUpdateTo, null),
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
- .range-inputs {
24
+ .section-input {
25
+ padding: 8px 12px;
26
26
  display: flex;
27
27
  flex-direction: column;
28
- gap: 8px;
28
+ gap: 4px;
29
29
 
30
- .range-input {
30
+ .range-inputs {
31
31
  display: flex;
32
32
  flex-direction: column;
33
- gap: 4px;
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: "large", suffixIcon: false, format: DATE_FORMAT })));
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
- font-size: 12px;
6
- padding-right: 8px;
6
+ &.antsomi-picker {
7
+ font-size: 12px;
8
+ padding: 0;
7
9
 
8
- .ant-picker-input {
9
- input {
10
- width: 80px;
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
  `;
@@ -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, useEffect, useState } from 'react';
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
- // console.log({ rangeSelectedTitle, rangeValueTitles });
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', { collapse: state.open }) },
43
- rangeValue.length > 0 && (React.createElement(Text, { className: "range-date-title", ellipsis: { tooltip: rangeValueTitles[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
- React.createElement(Text, { className: "range-date-title", ellipsis: { tooltip: title } }, title)))))))));
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: 0.813rem;
17
- margin-right: 0.5rem;
18
- color: rgb(127, 127, 127);
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
- border-top: none;
23
- border-right: none;
24
- border-left: none;
25
- border-image: initial;
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 => { var _a; return (_a = store.state.appConfig) === null || _a === void 0 ? void 0 : _a.auth; });
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({ url, menuItems, auth })) === null || _a === void 0 ? void 0 : _a.menu_item_code;
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
@@ -110,7 +115,7 @@ export const ChildMenu = memo(props => {
110
115
  React.createElement(Icon, { className: "child-menu-item-icon", type: "icon-ants-three-dot-vertical", style: styles.dotIcon }))))) : (React.createElement(LabelCustom, { ellipsis: { tooltip: label } }, label));
111
116
  const renderIcon = () => {
112
117
  var _a;
113
- return !isNil(icon) || !isNil(logo_url) ? (React.createElement(Flex, { style: { flexShrink: 0 }, align: "center" }, !isNil(icon) ? (React.createElement(IconWrapper, null,
118
+ return !!icon || !!logo_url ? (React.createElement(Flex, { style: { flexShrink: 0 }, align: "center" }, !isNil(icon) ? (React.createElement(IconWrapper, null,
114
119
  React.createElement(Icon, { type: icon }))) : !isNil(logo_url) ? (React.createElement(MenuItemImage, { imageUrl: logo_url, fallbackIcon: (_a = args === null || args === void 0 ? void 0 : args.parent) === null || _a === void 0 ? void 0 : _a.icon, className: classNames({ isActive: currentActiveItem === key }) })) : null)) : null;
115
120
  };
116
121
  const renderTitle = () => !menu_item_path ? (renderLabel()) : isPushDifferentDomain(menu_item_domain, menu_item_path) ? (React.createElement("div", { onClick: () => navigatePath(menu_item_domain, menu_item_path), className: "menu-link" }, renderLabel())) : (React.createElement(Link, { to: getPath(menu_item_path), className: "menu-link" }, renderLabel()));
@@ -4,6 +4,7 @@ import { FeatureMenuPermission } from '@antscorp/antsomi-ui/es/models/LeftMenu';
4
4
  import { AppConfigProviderProps } from '../../..';
5
5
  import { TMenuItem } from './types';
6
6
  export interface LeftMenuProps {
7
+ show?: boolean;
7
8
  appConfig?: AppConfigProviderProps;
8
9
  objectType?: string;
9
10
  objectId?: number;
@@ -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;
@@ -33,12 +33,11 @@ import { useDeepCompareMemo, useMutationObserver } from '@antscorp/antsomi-ui/es
33
33
  const { DATAFLOWS, APP_ANTALYSER } = APP_CODES;
34
34
  export const Layout = memo(props => {
35
35
  const { leftMenuProps, headerProps = {}, workspaceProps, contentWrapperProps, processingNotificationProps, children, onActiveMenuChange, } = props;
36
- const _a = leftMenuProps || {}, { className = '' } = _a, restOfLeftMenuProps = __rest(_a, ["className"]);
37
- const _b = workspaceProps || {}, { workspaceContentProps } = _b, restOfWorkspaceProps = __rest(_b, ["workspaceContentProps"]);
36
+ const _a = workspaceProps || {}, { workspaceContentProps } = _a, restOfWorkspaceProps = __rest(_a, ["workspaceContentProps"]);
38
37
  const appConfig = useContextSelector(AppConfigContext, state => state);
39
38
  const { auth, languageCode, appCode, permissionDomain: configPermissionDomain, env } = appConfig;
40
39
  const { token, userId, portalId } = auth || {};
41
- const showLeftMenu = useLayoutStore(store => store.state.leftMenu.show);
40
+ const leftMenu = useLayoutStore(store => store.state.leftMenu);
42
41
  const header = useLayoutStore(store => store.state.header);
43
42
  const contentWrapper = useLayoutStore(store => store.state.contentWrapper);
44
43
  const workspace = useLayoutStore(store => store.state.workspace);
@@ -111,8 +110,9 @@ export const Layout = memo(props => {
111
110
  } }) }), accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: 'APP_CUSTOMER_360' }), accountSelection: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection), { show: !!((_b = headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection) === null || _b === void 0 ? void 0 : _b.show) && showAccountSelection }) }));
112
111
  }, [headerProps, iamDomain, permissionDomain, showAccountSelection]);
113
112
  const mergeHeaderProps = useDeepCompareMemo(() => merge(cloneDeep(initialHeaderProps), header), [initialHeaderProps, header]);
114
- const _c = useDeepCompareMemo(() => merge(cloneDeep(contentWrapperProps), cloneDeep(contentWrapper)), [contentWrapperProps, contentWrapper]), { noPadding } = _c, mergeContentWrapperProps = __rest(_c, ["noPadding"]);
113
+ const _b = useDeepCompareMemo(() => merge(cloneDeep(contentWrapperProps), cloneDeep(contentWrapper)), [contentWrapperProps, contentWrapper]), { noPadding } = _b, mergeContentWrapperProps = __rest(_b, ["noPadding"]);
115
114
  const mergeWorkSpaceProps = useDeepCompareMemo(() => merge(cloneDeep(restOfWorkspaceProps), omit(workspace, 'workspaceContentProps')), [restOfWorkspaceProps, workspace]);
115
+ const _c = useDeepCompareMemo(() => merge(cloneDeep(leftMenuProps), cloneDeep(leftMenu)), [leftMenuProps, leftMenu]), { className: leftMenuClassName, show: showLeftMenu = true } = _c, mergeLeftMenuProps = __rest(_c, ["className", "show"]);
116
116
  const antsProcessingNotificationConfig = useMemo(() => (Object.assign({ permissionDomain, socketDomain: SOCKET_API, token, accountId: userId, userId, lang: languageCode, networkId: portalId }, processingNotificationProps)), [permissionDomain, token, userId, languageCode, portalId, processingNotificationProps]);
117
117
  const onActiveMenuCodeChange = useCallback((activeItemPath, flattenPermissionList) => {
118
118
  var _a;
@@ -120,10 +120,10 @@ export const Layout = memo(props => {
120
120
  const hasRole = hasSelectAccountPermission(activeItemPath, flattenPermissionList);
121
121
  setShowAccountSelection(hasRole);
122
122
  }, [onActiveMenuChange]);
123
- return (React.createElement(LayoutWrapper, { showLeftMenu: showLeftMenu },
123
+ return (React.createElement(LayoutWrapper, { showLeftMenu: !!showLeftMenu },
124
124
  React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { showLogo: !showLeftMenu })),
125
125
  React.createElement(Flex, { className: "layout-body" },
126
- showLeftMenu && (React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${className}`, appConfig: appConfig }, restOfLeftMenuProps, { onActiveMenuCodeChange: onActiveMenuCodeChange }))),
126
+ showLeftMenu && (React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${leftMenuClassName}`, appConfig: appConfig }, mergeLeftMenuProps, { onActiveMenuCodeChange: onActiveMenuCodeChange }))),
127
127
  React.createElement(ContentWrapper, Object.assign({ "$noPadding": noPadding, "$noSpaceTopContent": noSpaceTopContent }, mergeContentWrapperProps),
128
128
  React.createElement("div", Object.assign({ className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }, mergeWorkSpaceProps),
129
129
  React.createElement(NotificationWrapper, { ref: notificationWrapperRef },
@@ -2,10 +2,10 @@
2
2
  import { HeaderV2Props } from '../../../molecules';
3
3
  import { DeepPartial } from '@antscorp/antsomi-ui/es/types';
4
4
  import { ContentWrapperProps, WorkspaceProps } from '../types';
5
+ import { LeftMenuProps } from '../../../organism';
5
6
  export interface HeaderStore extends Partial<HeaderV2Props> {
6
7
  }
7
- export interface LeftMenuStore {
8
- show: boolean;
8
+ export interface LeftMenuStore extends LeftMenuProps {
9
9
  onClickCreateDashboard?: React.MouseEventHandler<HTMLElement>;
10
10
  }
11
11
  export interface LayoutStoreState {
@@ -3,7 +3,7 @@ import { create } from 'zustand';
3
3
  import { cloneDeep, merge } from 'lodash';
4
4
  const initialState = {
5
5
  header: {},
6
- leftMenu: { show: true },
6
+ leftMenu: {},
7
7
  workspace: {},
8
8
  contentWrapper: {},
9
9
  };
@@ -26,7 +26,7 @@ export const useLayoutStore = create(set => ({
26
26
  state: Object.assign(Object.assign({}, store.state), { header: {} }),
27
27
  })),
28
28
  resetLeftMenuState: () => set(store => ({
29
- state: Object.assign(Object.assign({}, store.state), { leftMenu: { show: true } }),
29
+ state: Object.assign(Object.assign({}, store.state), { leftMenu: {} }),
30
30
  })),
31
31
  resetWorkspaceState: () => set(store => ({
32
32
  state: Object.assign(Object.assign({}, store.state), { workspace: {} }),
@@ -38,7 +38,7 @@ export const useLayoutStore = create(set => ({
38
38
  state: {
39
39
  contentWrapper: {},
40
40
  header: {},
41
- leftMenu: { show: true },
41
+ leftMenu: {},
42
42
  workspace: {},
43
43
  },
44
44
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.364",
3
+ "version": "1.3.5-beta.366",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",