@antscorp/antsomi-ui 1.3.5-beta.575 → 1.3.5-beta.576

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.
@@ -9,6 +9,7 @@ interface Breadcrumb {
9
9
  useExternalLink?: boolean;
10
10
  }
11
11
  export interface HeaderV2Props {
12
+ show?: boolean;
12
13
  className?: string;
13
14
  style?: React.CSSProperties;
14
15
  pageTitle?: string | React.ReactNode;
@@ -32,7 +32,7 @@ export const HeaderV2 = memo(props => {
32
32
  const { search } = useLocation();
33
33
  const { replace } = useCustomRouter();
34
34
  // * Prefer to use Header in AppConfigContext
35
- const { className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
35
+ const { show = true, className, style, breadcrumbs, showLogo = false, rightContent, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
36
36
  /** General config for children component */
37
37
  const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
38
38
  const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
@@ -108,7 +108,7 @@ export const HeaderV2 = memo(props => {
108
108
  onSelectAccount === null || onSelectAccount === void 0 ? void 0 : onSelectAccount(userId);
109
109
  };
110
110
  const QUOTE_ENTITY = React.createElement(React.Fragment, null, "\u00BB");
111
- return (React.createElement(HeaderV2Styled, { className: className || '', style: style },
111
+ return (React.createElement(HeaderV2Styled, { "$show": show, className: className || '', style: style },
112
112
  React.createElement("div", { className: "left-side" },
113
113
  showLogo && (React.createElement(LogoWrapper, { className: "logo-wrapper" },
114
114
  React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" }))),
@@ -1,2 +1,4 @@
1
1
  export declare const LogoWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const HeaderV2Styled: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const HeaderV2Styled: import("styled-components").StyledComponent<"div", any, {
3
+ $show: boolean;
4
+ }, never>;
@@ -21,6 +21,8 @@ export const HeaderV2Styled = styled.div `
21
21
  padding: 10px 20px;
22
22
  box-sizing: border-box;
23
23
 
24
+ ${props => !props.$show && 'display: none;'}
25
+
24
26
  .left-side,
25
27
  .right-side {
26
28
  display: flex;
@@ -16,7 +16,7 @@ import { useLeftMenu } from './hooks';
16
16
  import { useLeftMenuContext } from './contexts';
17
17
  const SubLogoAntsomi = 'https://st-media-template.antsomi.com/icons/antsomi/antsomi.png';
18
18
  export const LeftMenuComponent = memo(props => {
19
- const { style, className, customization, showLogo = true } = props;
19
+ const { show = true, style, className, customization, showLogo = true } = props;
20
20
  const { isExpandable = true, isCustomized, isRecommendation, items = [], onMenuItemClick, } = customization || {};
21
21
  const appHoverMenuChildren = useLeftMenuContext(store => store.appHoverMenuChildren);
22
22
  const { state, activeAppCode, permissionMenu, customActiveAppKey, onToggleChildMenu, onMouseEnter, onMouseLeave, onHoverMenuBar, onShowPopover, onClickFeatureMenuItem, } = useLeftMenu(props);
@@ -95,7 +95,7 @@ export const LeftMenuComponent = memo(props => {
95
95
  }
96
96
  return null;
97
97
  };
98
- return (React.createElement(LeftMenuNavWrapper, { style: style, "$isExpandMenu": state.isExpandMenu && isExpandable, className: className },
98
+ return (React.createElement(LeftMenuNavWrapper, { "$show": show, style: style, "$isExpandMenu": state.isExpandMenu && isExpandable, className: className },
99
99
  React.createElement(LeftMenuNav, { className: "left-menu-nav" },
100
100
  React.createElement(FeatureMenuWrapper, { vertical: true, onMouseEnter: () => onShowPopover(), onMouseLeave: onMouseLeave },
101
101
  showLogo && (React.createElement(NavLogoWrapper, { align: "center", justify: "center", onMouseEnter: onHoverMenuBar },
@@ -8,6 +8,7 @@ export declare const FeatureMenuWrapper: import("styled-components").StyledCompo
8
8
  export declare const ExpandWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
9
9
  export declare const LeftMenuNavWrapper: import("styled-components").StyledComponent<"div", any, {
10
10
  $isExpandMenu?: boolean | undefined;
11
+ $show?: boolean | undefined;
11
12
  }, never>;
12
13
  export declare const NavLogoWrapper: 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>;
13
14
  export declare const LeftMenuNav: import("styled-components").StyledComponent<"nav", any, {}, never>;
@@ -44,7 +44,9 @@ export const PopoverWrapper = styled.div `
44
44
  bottom: 15px;
45
45
  box-shadow: 0px 3px 20px 0px #002e5933;
46
46
  height: ${({ hasMarginTop }) => hasMarginTop ? `calc(100% - ${HEADER_HEIGHT + 15}px)` : `calc(100% - 15px)`};
47
- transition: visibility 0s, opacity 0.2s ease-out;
47
+ transition:
48
+ visibility 0s,
49
+ opacity 0.2s ease-out;
48
50
  z-index: 10;
49
51
  padding: 10px;
50
52
  box-sizing: border-box;
@@ -67,6 +69,8 @@ export const LeftMenuNavWrapper = styled.div `
67
69
  display: flex;
68
70
  transition: all 0.2s ease-out;
69
71
 
72
+ ${p => !p.$show && 'display: none;'}
73
+
70
74
  ${p => (p.$isExpandMenu ? `gap: 10px;` : `gap: 15px;`)}
71
75
  `;
72
76
  export const NavLogoWrapper = styled(Flex) `
@@ -206,7 +210,9 @@ export const ChildMenuWrapper = styled.div `
206
210
  margin-top: ${({ isMarginTop }) => (isMarginTop ? `${HEADER_HEIGHT}px` : '0px')};
207
211
  width: ${({ isExpand }) => (isExpand ? '210px' : '0px')};
208
212
  padding: ${({ isExpand }) => (isExpand ? '10px' : '10px 0')};
209
- transition: width 0.2s, padding 0.2s ease;
213
+ transition:
214
+ width 0.2s,
215
+ padding 0.2s ease;
210
216
  padding-left: 0px;
211
217
  box-sizing: border-box;
212
218
  z-index: 1;
@@ -5,6 +5,7 @@ import '@antscorp/processing-notification/dist/index.css';
5
5
  import { ProcessingNotificationProps } from '@antscorp/antsomi-ui/es/types';
6
6
  import { ContentWrapperProps, WorkspaceProps } from './types';
7
7
  export interface LayoutProps {
8
+ onlyContent?: boolean;
8
9
  headerProps?: Partial<Omit<HeaderV2Props, 'helpConfig'> & {
9
10
  helpConfig: Partial<HeaderV2Props['helpConfig']>;
10
11
  }>;
@@ -63,6 +63,7 @@ export const Layout = memo(props => {
63
63
  const header = useLayoutStore(store => store.state.header);
64
64
  const contentWrapper = useLayoutStore(store => store.state.contentWrapper);
65
65
  const workspace = useLayoutStore(store => store.state.workspace);
66
+ const onlyContent = useLayoutStore(store => store.state.onlyContent);
66
67
  const [, , removeCookie] = useCookies();
67
68
  const params = useParams();
68
69
  const location = useLocation();
@@ -88,6 +89,8 @@ export const Layout = memo(props => {
88
89
  attributeOldValue: true,
89
90
  characterDataOldValue: true,
90
91
  });
92
+ // Memo
93
+ const showOnlyContent = useDeepCompareMemo(() => { var _a; return (_a = props.onlyContent) !== null && _a !== void 0 ? _a : onlyContent; }, [onlyContent, props.onlyContent]);
91
94
  const permissionDomain = useDeepCompareMemo(() => {
92
95
  var _a;
93
96
  /**
@@ -193,6 +196,12 @@ export const Layout = memo(props => {
193
196
  setLoadingLayout(false);
194
197
  }
195
198
  }, [mergeLeftMenuProps.customization]);
199
+ /** Timeout for set layout loading off in case left menu no callback onActiveMenuCodeChange */
200
+ useDeepCompareEffect(() => {
201
+ setTimeout(() => {
202
+ setLoadingLayout(false);
203
+ }, 5000);
204
+ }, []);
196
205
  // Handle access denied
197
206
  const onClickSwitchAccount = useCallback(() => {
198
207
  // Remove cookie when switch account
@@ -276,12 +285,12 @@ export const Layout = memo(props => {
276
285
  ? header === null || header === void 0 ? void 0 : header.pageTitle
277
286
  : ''
278
287
  : activePageTitle))),
279
- React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { showLogo: !showLeftMenu })),
288
+ React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { show: !showOnlyContent, showLogo: !showLeftMenu })),
280
289
  React.createElement(Flex, { className: "layout-body" },
281
- showLeftMenu && (React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${leftMenuClassName}` }, mergeLeftMenuProps, { customization: Object.assign(Object.assign({}, mergeLeftMenuProps.customization), {
290
+ React.createElement(LeftMenu, Object.assign({ show: showLeftMenu && !showOnlyContent, className: `layout-body__menu ${leftMenuClassName}` }, mergeLeftMenuProps, { customization: Object.assign(Object.assign({}, mergeLeftMenuProps.customization), {
282
291
  // If user has access denied, disable expandable
283
- isExpandable: !isAccessDenied && ((_a = mergeLeftMenuProps.customization) === null || _a === void 0 ? void 0 : _a.isExpandable) }), appConfig: leftMenuAppConfig, onActiveMenuCodeChange: onActiveMenuCodeChange }))),
284
- React.createElement(ContentWrapper, Object.assign({ "$noPadding": noPadding, "$noSpaceTopContent": noSpaceTopContent }, mergeContentWrapperProps), (activeMenu === null || activeMenu === void 0 ? void 0 : activeMenu.menu_item_code) === HOME_MENU_ITEMS.RECOMMENDATION ? (React.createElement("div", { className: "layout-body__content" },
292
+ isExpandable: !isAccessDenied && ((_a = mergeLeftMenuProps.customization) === null || _a === void 0 ? void 0 : _a.isExpandable) }), appConfig: leftMenuAppConfig, onActiveMenuCodeChange: onActiveMenuCodeChange })),
293
+ React.createElement(ContentWrapper, Object.assign({ "$noPadding": noPadding, "$noSpaceTopContent": noSpaceTopContent, "$showOnlyContent": showOnlyContent }, mergeContentWrapperProps), (activeMenu === null || activeMenu === void 0 ? void 0 : activeMenu.menu_item_code) === HOME_MENU_ITEMS.RECOMMENDATION ? (React.createElement("div", { className: "layout-body__content" },
285
294
  React.createElement(RecommendationWorkspace, null))) : (React.createElement("div", Object.assign({ className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }, mergeWorkSpaceProps), isLoadingLayout ? (React.createElement(LayoutLoading, { spinning: true })) : (React.createElement(React.Fragment, null,
286
295
  React.createElement(NotificationWrapper, { className: "process-notification", ref: notificationWrapperRef }, showNotification && (React.createElement(AntsProcessingNotification, Object.assign({}, antsProcessingNotificationConfig, { callback: handleCallbackNotify })))),
287
296
  React.createElement(ChildrenWrapper, Object.assign({}, workspaceContentProps), isAccessDenied ? (React.createElement(AccessDenied, { onClickRequestAccess: onClickRequestAccess, onClickSwitchAccount: onClickSwitchAccount })) : (React.createElement("div", null, children)))))))))));
@@ -15,6 +15,8 @@ export interface LayoutStoreState {
15
15
  leftMenu: LeftMenuStore;
16
16
  workspace: WorkspaceProps;
17
17
  contentWrapper: ContentWrapperProps;
18
+ /** Just show only content */
19
+ onlyContent?: boolean;
18
20
  }
19
21
  interface LayoutStore {
20
22
  state: LayoutStoreState;
@@ -6,6 +6,7 @@ const initialState = {
6
6
  leftMenu: {},
7
7
  workspace: {},
8
8
  contentWrapper: {},
9
+ onlyContent: false,
9
10
  };
10
11
  export const useLayoutStore = create(set => ({
11
12
  state: initialState,
@@ -5,6 +5,7 @@ export declare const LayoutWrapper: import("styled-components").StyledComponent<
5
5
  export declare const ContentWrapper: import("styled-components").StyledComponent<"div", any, {
6
6
  $noPadding?: boolean | undefined;
7
7
  $noSpaceTopContent?: boolean | undefined;
8
+ $showOnlyContent?: boolean | undefined;
8
9
  }, never>;
9
10
  export declare const NotificationWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
10
11
  export declare const ChildrenWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,6 +1,6 @@
1
1
  var _a, _b;
2
2
  // Libraries
3
- import styled from 'styled-components';
3
+ import styled, { css } from 'styled-components';
4
4
  // Components
5
5
  import { Flex, Spin } from '../../atoms';
6
6
  // Constants
@@ -57,6 +57,16 @@ export const ContentWrapper = styled.div `
57
57
  .layout-body__content {
58
58
  ${({ $noSpaceTopContent }) => $noSpaceTopContent && 'padding-top: 0;'}
59
59
  }
60
+
61
+ ${({ $showOnlyContent }) => $showOnlyContent &&
62
+ css `
63
+ padding: 0px;
64
+
65
+ .layout-body__content {
66
+ padding: 0px;
67
+ border-radius: 0px;
68
+ }
69
+ `}
60
70
  `;
61
71
  export const NotificationWrapper = styled.div `
62
72
  flex-shrink: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.575",
3
+ "version": "1.3.5-beta.576",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -62,7 +62,7 @@
62
62
  "not op_mini all"
63
63
  ],
64
64
  "dependencies": {
65
- "@antscorp/icons": "0.27.51",
65
+ "@antscorp/icons": "0.27.52",
66
66
  "@antscorp/image-editor": "1.0.2",
67
67
  "@antscorp/processing-notification": "^1.0.3",
68
68
  "@dnd-kit/core": "^6.1.0",