@antscorp/antsomi-ui 1.3.5-beta.378 → 1.3.5-beta.379

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,16 +20,20 @@ export const LeftMenuComponent = memo(props => {
20
20
  const { state, activeAppCode, permissionMenu, customActiveAppKey, onToggleChildMenu, onMouseEnter, onMouseLeave, onHoverMenuBar, } = useLeftMenu(props);
21
21
  const { isPushDifferentDomain, getPath, navigatePath } = useNavigatePath();
22
22
  const childMenu = useMemo(() => {
23
- const selectedFeatureKey = state.hoverItem ? state.hoverItem : activeAppCode;
23
+ const appActiveKey = state.hoverItem
24
+ ? state.hoverItem
25
+ : isCustomized || isRecommendation
26
+ ? customActiveAppKey
27
+ : activeAppCode;
24
28
  if (isCustomized)
25
29
  return React.createElement(CustomMenu, null);
26
- switch (selectedFeatureKey) {
27
- case APP_KEYS.HOME:
30
+ switch (appActiveKey) {
31
+ case isRecommendation ? 'DASHBOARD' : APP_KEYS.HOME:
28
32
  return React.createElement(HomeMenu, null);
29
33
  default:
30
34
  return React.createElement(CommonMenu, null);
31
35
  }
32
- }, [activeAppCode, isCustomized, state.hoverItem]);
36
+ }, [activeAppCode, customActiveAppKey, isCustomized, isRecommendation, state.hoverItem]);
33
37
  const renderFeatureMenuItem = useCallback((item) => {
34
38
  const { menu_item_name, menu_item, icon_name, menu_item_code, menu_item_path, menu_item_domain, } = item;
35
39
  const isActive = activeAppCode === menu_item_code;
@@ -8,6 +8,7 @@ import { useLeftMenuContext } from '../../contexts';
8
8
  import { getMenuItem } from '../../utils';
9
9
  export const CommonMenu = memo(() => {
10
10
  const appMenuChildren = useLeftMenuContext(store => store.appMenuChildren);
11
+ const onMenuClick = useLeftMenuContext(store => store.onMenuClick);
11
12
  const customChildren = useMemo(() => appMenuChildren === null || appMenuChildren === void 0 ? void 0 : appMenuChildren.map(item => getMenuItem(item)), [appMenuChildren]);
12
- return React.createElement(ChildMenu, { items: customChildren });
13
+ return React.createElement(ChildMenu, { items: customChildren, onMenuClick: onMenuClick });
13
14
  });
@@ -10,12 +10,12 @@ export const HomeMenuWrapper = styled(Flex) `
10
10
  height: 100%;
11
11
  width: 100%;
12
12
 
13
- .menu-list {
13
+ & > .menu-list {
14
14
  width: 100%;
15
15
  flex: 1 1 0%;
16
16
  overflow: hidden;
17
17
 
18
- .antsomi-menu {
18
+ & .antsomi-menu {
19
19
  & > li > ul {
20
20
  font-weight: 400 !important;
21
21
  font-size: 11px !important;
@@ -65,11 +65,13 @@ export const useHomeMenu = () => {
65
65
  }
66
66
  }, [auth, navigate, onClickCreateDashboard, replace, urlParams]);
67
67
  const onMenuClick = useCallback((key, _keyPath) => {
68
- const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: key }));
69
- if (newPathName !== pathname) {
70
- navigate(newPathName);
68
+ if (!isRecommendation) {
69
+ const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: key }));
70
+ if (newPathName !== pathname) {
71
+ navigate(newPathName);
72
+ }
71
73
  }
72
- }, [auth, pathname, navigate]);
74
+ }, [isRecommendation, auth, pathname, navigate]);
73
75
  const onRemoveDashboard = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
74
76
  if (removedDashboardId && auth && env) {
75
77
  const params = {
@@ -147,7 +147,7 @@ export const ChildMenu = memo(props => {
147
147
  var _a;
148
148
  return (_a = args === null || args === void 0 ? void 0 : args.items) === null || _a === void 0 ? void 0 : _a.map(item => {
149
149
  const { key, label, children, icon, logo_url, menu_item_path = null, menu_item_domain = null, options, optionCallback, } = item;
150
- const renderLabel = () => (React.createElement(LabelWrapper, { hasOption: !!(options === null || options === void 0 ? void 0 : options.length) },
150
+ const renderLabel = () => (React.createElement(LabelWrapper, null,
151
151
  React.createElement(LabelCustom, { ellipsis: { tooltip: label } }, label),
152
152
  (options === null || options === void 0 ? void 0 : options.length) && !isRecommendation && (React.createElement(OptionDropdownWrapper, null,
153
153
  React.createElement(Dropdown, { menu: {
@@ -1,7 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const LabelWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
3
- hasOption?: boolean | undefined;
4
- }, never>;
2
+ export declare const LabelWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
5
3
  export declare const LabelCustom: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/typography/Text").TextProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
6
4
  export declare const OptionDropdownWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
7
5
  export declare const MenuWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -9,12 +9,6 @@ import { ICON_SIZE } from '../../../constants';
9
9
  export const LabelWrapper = styled(Flex) `
10
10
  width: 100%;
11
11
  overflow: hidden;
12
- ${({ hasOption }) => hasOption
13
- ? `
14
- font-weight: 400 !important;
15
- font-size: 11px !important;
16
- `
17
- : ''}
18
12
 
19
13
  .icon-link {
20
14
  flex-shrink: 0;
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
2
  import React, { useState, memo, useLayoutEffect, useMemo } from 'react';
3
- import { Menu } from 'antd';
3
+ import { Menu, Typography } from 'antd';
4
4
  import { omit, orderBy, uniq } from 'lodash';
5
5
  import Icon from '@antscorp/icons';
6
6
  // Styled
@@ -44,7 +44,9 @@ export const OldLeftMenu = memo(props => {
44
44
  const { app_code, menu_code, app_name = '', menu_name = '', icon, childs, } = featureMenuPermission;
45
45
  return {
46
46
  key: app_code || menu_code || '',
47
- label: app_code ? (React.createElement(AppLabel, null, app_name.toUpperCase())) : (React.createElement(MenuLabel, null, menu_name)),
47
+ label: app_code ? (React.createElement(AppLabel, null,
48
+ React.createElement(Typography.Text, { ellipsis: { tooltip: app_name.toUpperCase() } }, app_name.toUpperCase()))) : (React.createElement(MenuLabel, null,
49
+ React.createElement(Typography.Text, { ellipsis: { tooltip: menu_name } }, menu_name))),
48
50
  icon: icon ? React.createElement(IconWrapper, { url: icon }) : undefined,
49
51
  children: childs === null || childs === void 0 ? void 0 : childs.map(item => recursiveGetMenuItem(omit(item, ['childs']))),
50
52
  };
@@ -36,6 +36,10 @@ export const MenuWrapper = styled.div `
36
36
  padding-right: 10px !important;
37
37
  border-left: 4px solid transparent;
38
38
 
39
+ & > .antsomi-menu-title-content {
40
+ margin: 0;
41
+ }
42
+
39
43
  &.antsomi-menu-item-selected {
40
44
  border-left: 4px solid #005eb8;
41
45
  border-radius: 0px !important;
@@ -49,15 +53,25 @@ export const MenuWrapper = styled.div `
49
53
  }
50
54
  `;
51
55
  export const AppLabel = styled.span `
52
- font-size: 14px;
53
- font-weight: 700;
54
- line-height: 16px;
55
56
  display: flex;
56
- padding: 0 10px !important;
57
+
58
+ & > .antsomi-typography {
59
+ font-size: 14px;
60
+ font-weight: 700;
61
+ line-height: 16px;
62
+ padding: 0 10px;
63
+ max-width: 100%;
64
+ color: inherit !important;
65
+ }
57
66
  `;
58
67
  export const MenuLabel = styled.span `
59
- font-size: 12px;
60
- font-weight: 500;
61
- line-height: 14px;
62
- padding: 0 10px !important;
68
+ display: flex;
69
+ & > .antsomi-typography {
70
+ font-size: 12px;
71
+ font-weight: 500;
72
+ line-height: 14px;
73
+ padding-right: 10px !important;
74
+ padding-left: 6px !important;
75
+ color: inherit !important;
76
+ }
63
77
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.378",
3
+ "version": "1.3.5-beta.379",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",