@antscorp/antsomi-ui 1.3.5-beta.380 → 1.3.5-beta.382

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,7 +20,7 @@ import { useLeftMenuContext } from '../../contexts';
20
20
  import { useLayoutStore } from '@antscorp/antsomi-ui/es/components/template';
21
21
  import { useCustomRouter } from '@antscorp/antsomi-ui/es/hooks';
22
22
  // Queries
23
- import { useUpdateTask } from '@antscorp/antsomi-ui/es/queries/LeftMenu';
23
+ import { useRemoveDashboard } from '@antscorp/antsomi-ui/es/queries/LeftMenu';
24
24
  export const useHomeMenu = () => {
25
25
  const { pathname, search } = window.location;
26
26
  const { navigate, replace } = useCustomRouter();
@@ -32,7 +32,7 @@ export const useHomeMenu = () => {
32
32
  const onClickCreateDashboard = useLayoutStore(store => store.state.leftMenu.onClickCreateDashboard);
33
33
  const [removedDashboardId, setRemovedDashboardId] = useState('');
34
34
  const urlParams = useMemo(() => new URLSearchParams(search), [search]);
35
- const { mutateAsync: removeDashboard, isLoading: isDashboardRemoving } = useUpdateTask();
35
+ const { mutateAsync: removeDashboard, isLoading: isDashboardRemoving } = useRemoveDashboard();
36
36
  const onOptionCallback = useCallback((args) => {
37
37
  const { optionKey, menuItemKey } = args;
38
38
  switch (optionKey) {
@@ -14,6 +14,7 @@ export const LabelWrapper = styled(Flex) `
14
14
  flex-shrink: 0;
15
15
  width: fit-content;
16
16
  display: none;
17
+ text-decoration-line: none !important;
17
18
 
18
19
  i {
19
20
  font-size: 15px !important;
@@ -26,6 +27,7 @@ export const LabelWrapper = styled(Flex) `
26
27
 
27
28
  &:hover {
28
29
  .icon-link {
30
+ color: inherit !important;
29
31
  display: flex;
30
32
  }
31
33
  }
@@ -19,7 +19,7 @@ export declare const flattenMenuArray: <T>(menuItems: T[], childKey: string) =>
19
19
  * Recursively filters menu items based on permissions.
20
20
  * check permission if menu item has menu_type of @alias MENU_ITEM_TYPE.MENU
21
21
  */
22
- export declare const recursivePermissionMenu: (menuItems: TFeatureMenu[], MenuPermissions: FeatureMenuPermission[]) => TFeatureMenu[];
22
+ export declare const recursivePermissionMenu: (menuItems: TFeatureMenu[], menuPermissions: FeatureMenuPermission[]) => TFeatureMenu[];
23
23
  /**
24
24
  * Generate a new path by replacing parameters in the given path.
25
25
  * @returns {string} The generated path with replaced parameters.
@@ -49,16 +49,16 @@ export const flattenMenuArray = (menuItems, childKey) => {
49
49
  * Recursively filters menu items based on permissions.
50
50
  * check permission if menu item has menu_type of @alias MENU_ITEM_TYPE.MENU
51
51
  */
52
- export const recursivePermissionMenu = (menuItems, MenuPermissions) => {
52
+ export const recursivePermissionMenu = (menuItems, menuPermissions) => {
53
53
  var _a, _b;
54
54
  const menu = (_b = (_a = menuItems === null || menuItems === void 0 ? void 0 : menuItems.filter(({ permission_code, menu_item_type }) => {
55
- if (menu_item_type !== MENU_ITEM_TYPE.MENU) {
55
+ if (Number(menu_item_type) !== MENU_ITEM_TYPE.MENU) {
56
56
  return true;
57
57
  }
58
- return MenuPermissions === null || MenuPermissions === void 0 ? void 0 : MenuPermissions.find(({ app_code = '', menu_code = '' }) => !!permission_code && [app_code, menu_code].includes(permission_code));
58
+ return menuPermissions === null || menuPermissions === void 0 ? void 0 : menuPermissions.find(({ app_code = '', menu_code = '' }) => !!permission_code && [app_code, menu_code].includes(permission_code));
59
59
  })) === null || _a === void 0 ? void 0 : _a.map(item => (Object.assign(Object.assign({}, item), (isArray(item.children)
60
60
  ? {
61
- children: recursivePermissionMenu(sortBy(item.children || [], ['level_position']), MenuPermissions),
61
+ children: recursivePermissionMenu(sortBy(item.children || [], ['level_position']), menuPermissions),
62
62
  }
63
63
  : {}))))) === null || _b === void 0 ? void 0 : _b.filter(item => !(isArray(item.children) && isEmpty(item.children)));
64
64
  return menu;
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { AppConfigProviderProps } from '@antscorp/antsomi-ui/es/providers';
3
3
  interface OldLeftMenuProps {
4
4
  activeKey: string;
5
- activeKeyPath: string[];
6
5
  appConfig?: AppConfigProviderProps;
7
6
  onMenuItemClick?: (key: string, keyPath: string[]) => void;
8
7
  }
@@ -11,16 +11,14 @@ import { OldLeftMenu } from './components';
11
11
  import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
12
12
  export const MenuMapping = () => {
13
13
  const [activeKey, setActiveKey] = useState('DASHBOARD');
14
- const [activeKeyPath, setActiveKeyPath] = useState(['DASHBOARD']);
15
- const onMenuItemClick = useCallback((key, keyPath) => {
14
+ const onMenuItemClick = useCallback((key, _keyPath) => {
16
15
  setActiveKey(key);
17
- setActiveKeyPath(keyPath);
18
16
  }, []);
19
17
  const appConfig = useContextSelector(AppConfigContext, state => state);
20
18
  return (React.createElement(MenuMappingWrapper, null,
21
19
  React.createElement(MenuMappingContainer, null,
22
20
  React.createElement("div", { className: "old-menu-wrapper" },
23
- React.createElement(OldLeftMenu, { activeKey: activeKey, activeKeyPath: activeKeyPath, appConfig: appConfig, onMenuItemClick: onMenuItemClick })),
21
+ React.createElement(OldLeftMenu, { activeKey: activeKey, appConfig: appConfig, onMenuItemClick: onMenuItemClick })),
24
22
  React.createElement(Icon, { type: "icon-ants-arrow-forward" }),
25
23
  React.createElement("div", { className: "new-menu-wrapper" },
26
24
  React.createElement(LeftMenu, { appConfig: appConfig, showLogo: false, style: { maxHeight: '100%' }, customization: { isRecommendation: true, activeKey, onMenuItemClick } })))));
@@ -1,12 +1,9 @@
1
1
  import React from 'react';
2
- import { Typography } from '../../../../../../atoms';
2
+ import { Flex, Typography } from '../../../../../../atoms';
3
3
  // Assets
4
- // import recommendationHumanImage from '../../../../../../../assets/images/components/Layout/recommendation-human.png';
5
4
  import recommendationHumanImage from '@antscorp/antsomi-ui/es/assets/images/components/Layout/recommendation-human.png';
6
- // import recommendationHumanImage from '@antscorp/antsomi-ui/es/assets/images/components/Layout/recommendation-human.png';
7
- // import recommendationHumanImage from '/images/recommendation-human.png';
8
- import { ImageWrapper, MessageWrapper, RecommendationImageWrapper } from './styled';
9
- export const RecommendationImage = () => (React.createElement(RecommendationImageWrapper, null,
5
+ import { ImageWrapper, MessageWrapper } from './styled';
6
+ export const RecommendationImage = () => (React.createElement(Flex, { gap: 40, vertical: true },
10
7
  React.createElement(MessageWrapper, null,
11
8
  React.createElement(Typography.Paragraph, null, `Having Trouble Navigating the New Menus? Let's Map Functions Together!`),
12
9
  React.createElement("div", { className: "arrow-triangle-down" })),
@@ -1,4 +1,2 @@
1
- /// <reference types="react" />
2
1
  export declare const MessageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
2
  export declare const ImageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const RecommendationImageWrapper: 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>;
@@ -1,5 +1,4 @@
1
1
  import styled from 'styled-components';
2
- import { Flex } from '../../../../../../atoms';
3
2
  export const MessageWrapper = styled.div `
4
3
  padding: 30px;
5
4
  width: 395px;
@@ -30,6 +29,7 @@ export const MessageWrapper = styled.div `
30
29
  export const ImageWrapper = styled.div `
31
30
  width: 215px;
32
31
  height: auto;
32
+ min-height: 505px;
33
33
 
34
34
  img {
35
35
  width: 100%;
@@ -37,10 +37,3 @@ export const ImageWrapper = styled.div `
37
37
  object-fit: contain;
38
38
  }
39
39
  `;
40
- export const RecommendationImageWrapper = styled(Flex) `
41
- padding: 56.5px 38px;
42
- `;
43
- RecommendationImageWrapper.defaultProps = {
44
- gap: 40,
45
- vertical: true,
46
- };
@@ -1,9 +1,17 @@
1
- import React from 'react';
1
+ // Libraries
2
+ import React, { useLayoutEffect } from 'react';
3
+ // Components
2
4
  import { MenuMapping, RecommendationImage } from './components';
3
5
  import { Flex } from '../../../../atoms';
6
+ import { useLayoutStore } from '../../stores';
4
7
  export const RecommendationWorkspace = () => {
5
- const a = 1;
6
- return (React.createElement(Flex, { style: { paddingTop: '10px' } },
8
+ const setHeaderState = useLayoutStore(store => store.setHeaderState);
9
+ useLayoutEffect(() => {
10
+ setHeaderState({
11
+ pageTitle: 'Recommendation',
12
+ });
13
+ }, [setHeaderState]);
14
+ return (React.createElement(Flex, { gap: 220, align: "center", justify: "center", style: { height: '100%' } },
7
15
  React.createElement(RecommendationImage, null),
8
16
  React.createElement(MenuMapping, null)));
9
17
  };
@@ -117,6 +117,7 @@ THEME.components = {
117
117
  borderRadiusXS: 0,
118
118
  optionActiveBg: '#F2F9FF',
119
119
  optionSelectedBg: (_m = THEME.token) === null || _m === void 0 ? void 0 : _m.blue1_1,
120
+ optionSelectedFontWeight: 400,
120
121
  colorBorder: (_o = THEME.token) === null || _o === void 0 ? void 0 : _o.blue1,
121
122
  controlItemBgActive: '#E0EBF7',
122
123
  colorBgContainerDisabled: (_p = THEME.token) === null || _p === void 0 ? void 0 : _p.bw2,
@@ -18,7 +18,7 @@ export type TGetDestinationChannel = {
18
18
  options?: UseQueryOptions<any, any, TDestinationChannelResponse, any[]>;
19
19
  };
20
20
  export declare const useGetDashboard: (params: TGetDashboard) => import("@tanstack/react-query").UseQueryResult<TDashboardResponse, any>;
21
- export declare const useUpdateTask: () => import("@tanstack/react-query").UseMutationResult<any, unknown, import("../../services/LeftMenu").TRemoveDashboardArgs, unknown>;
21
+ export declare const useRemoveDashboard: () => import("@tanstack/react-query").UseMutationResult<any, unknown, import("../../services/LeftMenu").TRemoveDashboardArgs, unknown>;
22
22
  export declare const useGetListMenu: (params: TGetListMenu) => import("@tanstack/react-query").UseQueryResult<TFeatureMenuResponse, any>;
23
23
  export declare const useGetListMenuPermission: (params: TGetListMenuPermission) => import("@tanstack/react-query").UseQueryResult<FeatureMenuPermission[], any>;
24
24
  export declare const useGetDestinationChannel: (params: TGetDestinationChannel) => import("@tanstack/react-query").UseQueryResult<TDestinationChannelResponse, any>;
@@ -10,7 +10,7 @@ export const useGetDashboard = (params) => {
10
10
  const { options, args } = params;
11
11
  return useQuery(Object.assign({ queryKey: [QUERY_KEYS.GET_DASHBOARD, args.params, args.auth], queryFn: () => getDashboard(params.args), onSuccess() { } }, options));
12
12
  };
13
- export const useUpdateTask = () => {
13
+ export const useRemoveDashboard = () => {
14
14
  const queryClient = useQueryClient();
15
15
  return useMutation(removeDashboard, {
16
16
  onSuccess: data => {
@@ -61,7 +61,7 @@ export const leftMenuServices = {
61
61
  headers,
62
62
  params: {
63
63
  _user_id: auth.userId,
64
- _owner_id: (auth === null || auth === void 0 ? void 0 : auth.accountId) || (auth === null || auth === void 0 ? void 0 : auth.userId),
64
+ _owner_id: !(auth === null || auth === void 0 ? void 0 : auth.accountId) || auth.accountId === 'all' ? auth === null || auth === void 0 ? void 0 : auth.userId : auth.accountId,
65
65
  portalId: auth.portalId,
66
66
  languageCode,
67
67
  isGrouped,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.380",
3
+ "version": "1.3.5-beta.382",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",