@antscorp/antsomi-ui 1.3.5-beta.365 → 1.3.5-beta.367

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.
@@ -115,7 +115,7 @@ export const ChildMenu = memo(props => {
115
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));
116
116
  const renderIcon = () => {
117
117
  var _a;
118
- 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,
119
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;
120
120
  };
121
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;
@@ -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.365",
3
+ "version": "1.3.5-beta.367",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -59,7 +59,7 @@
59
59
  "not op_mini all"
60
60
  ],
61
61
  "dependencies": {
62
- "@antscorp/icons": "0.27.30",
62
+ "@antscorp/icons": "0.27.35",
63
63
  "@antscorp/image-editor": "1.0.2",
64
64
  "@antscorp/processing-notification": "^1.0.3",
65
65
  "@dnd-kit/core": "^6.1.0",