@antscorp/antsomi-ui 1.3.5-beta.341 → 1.3.5-beta.343
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.
- package/es/components/molecules/HeaderV2/HeaderV2.d.ts +2 -0
- package/es/components/molecules/HeaderV2/HeaderV2.js +6 -3
- package/es/components/molecules/HeaderV2/styled.d.ts +1 -0
- package/es/components/molecules/HeaderV2/styled.js +10 -2
- package/es/components/template/Layout/Layout.js +4 -3
- package/es/components/template/Layout/stores/index.d.ts +1 -0
- package/es/components/template/Layout/stores/index.js +9 -5
- package/es/components/template/Layout/styled.d.ts +3 -1
- package/es/components/template/Layout/styled.js +6 -2
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +4 -2
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +1 -1
- package/es/components/template/TemplateListing/constants/defaultProps.js +1 -1
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +2 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ export interface HeaderV2Props {
|
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
pageTitle?: string | React.ReactNode;
|
|
15
15
|
breadcrumbs?: Breadcrumb[];
|
|
16
|
+
showLogo?: boolean;
|
|
16
17
|
accountSelection?: Omit<AccountSelectionProps, 'onChange' | 'apiConfig'> & {
|
|
17
18
|
onSelectAccount?: (userId: string) => void;
|
|
18
19
|
};
|
|
@@ -28,6 +29,7 @@ export interface HeaderV2Props {
|
|
|
28
29
|
show?: boolean;
|
|
29
30
|
};
|
|
30
31
|
useURLParam?: boolean;
|
|
32
|
+
rightContent?: React.ReactNode;
|
|
31
33
|
config?: {
|
|
32
34
|
env?: envType;
|
|
33
35
|
language?: string;
|
|
@@ -13,7 +13,7 @@ import React, { memo, useLayoutEffect, useMemo, useState } from 'react';
|
|
|
13
13
|
import { Link, useLocation } from 'react-router-dom';
|
|
14
14
|
// Hooks
|
|
15
15
|
// Styled
|
|
16
|
-
import { HeaderV2Styled } from './styled';
|
|
16
|
+
import { HeaderV2Styled, LogoWrapper } from './styled';
|
|
17
17
|
// Components
|
|
18
18
|
import { AccountSelection } from '../AccountSelection';
|
|
19
19
|
import { AccountSharing, Help, Notification, } from '../../organism';
|
|
@@ -23,16 +23,16 @@ import { useContextSelector } from 'use-context-selector';
|
|
|
23
23
|
import { AppConfigContext } from '../../..';
|
|
24
24
|
import { isNil } from 'lodash';
|
|
25
25
|
import { useCustomRouter } from '@antscorp/antsomi-ui/es/hooks';
|
|
26
|
+
const SubLogoAntsomi = 'https://st-media-template.antsomi.com/icons/antsomi/antsomi.png';
|
|
26
27
|
const { DATAFLOWS, APP_ANTALYSER } = APP_CODES;
|
|
27
28
|
// const DOUBLE_RIGHT_POINTING = '»'
|
|
28
29
|
export const HeaderV2 = memo(props => {
|
|
29
30
|
var _a;
|
|
30
31
|
const { auth, env: envContext, languageCode = 'en', appCode: contextAppCode, urlLogout: urlLogoutProvider = '', menuCode: contextMenuCode, } = useContextSelector(AppConfigContext, state => state);
|
|
31
32
|
const { search } = useLocation();
|
|
32
|
-
// const history = useHistory();
|
|
33
33
|
const { replace } = useCustomRouter();
|
|
34
34
|
// * Prefer to use Header in AppConfigContext
|
|
35
|
-
const { className, style, breadcrumbs, pageTitle = '', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
|
|
35
|
+
const { 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"]);
|
|
@@ -107,6 +107,8 @@ export const HeaderV2 = memo(props => {
|
|
|
107
107
|
const QUOTE_ENTITY = React.createElement(React.Fragment, null, "\u00BB");
|
|
108
108
|
return (React.createElement(HeaderV2Styled, { className: className || '', style: style },
|
|
109
109
|
React.createElement("div", { className: "left-side" },
|
|
110
|
+
showLogo && (React.createElement(LogoWrapper, null,
|
|
111
|
+
React.createElement("img", { src: SubLogoAntsomi, alt: "Antsomi sub logo" }))),
|
|
110
112
|
React.createElement(AccountSelection, Object.assign({}, accountSelectionProps, { currentAccount: selectedAccount, apiConfig: accountSelectionApiConfig, onChange: handleChangeAccount, inputStyle: inputStyle })),
|
|
111
113
|
React.createElement("div", { className: "title-container" },
|
|
112
114
|
breadcrumbs ? (React.createElement("div", { className: "header-breadcrumbs" }, breadcrumbs.map((item, index) => (React.createElement(React.Fragment, { key: `${item.title}_${item.link}` },
|
|
@@ -117,6 +119,7 @@ export const HeaderV2 = memo(props => {
|
|
|
117
119
|
"\u2002")))))) : null,
|
|
118
120
|
typeof pageTitle === 'string' ? (React.createElement("div", { className: "page-title" }, pageTitle)) : (pageTitle))),
|
|
119
121
|
React.createElement("div", { className: "right-side" },
|
|
122
|
+
rightContent,
|
|
120
123
|
showHelp ? React.createElement(Help, Object.assign({ configs: helpConfigProps }, helpProps)) : null,
|
|
121
124
|
showNotification ? React.createElement(Notification, Object.assign({}, notificationConfigProps)) : null,
|
|
122
125
|
showAccountSharing ? (React.createElement(AccountSharing, Object.assign({ isShowSharing: isShowSharing, isShareAccountAccess: isShareAccountAccess }, accountSharingPropsFormatted, accountSharingProps))) : null)));
|
|
@@ -14,11 +14,10 @@ export const HeaderV2Styled = styled.div `
|
|
|
14
14
|
.right-side {
|
|
15
15
|
display: flex;
|
|
16
16
|
align-items: center;
|
|
17
|
-
gap:
|
|
17
|
+
gap: 15px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.left-side {
|
|
21
|
-
gap: 15px;
|
|
22
21
|
flex: 1;
|
|
23
22
|
overflow: hidden;
|
|
24
23
|
}
|
|
@@ -45,3 +44,12 @@ export const HeaderV2Styled = styled.div `
|
|
|
45
44
|
font-weight: bold;
|
|
46
45
|
}
|
|
47
46
|
`;
|
|
47
|
+
export const LogoWrapper = styled.div `
|
|
48
|
+
height: 30px;
|
|
49
|
+
width: 30px;
|
|
50
|
+
|
|
51
|
+
img {
|
|
52
|
+
height: 100%;
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
@@ -38,6 +38,7 @@ export const Layout = memo(props => {
|
|
|
38
38
|
const { auth, languageCode, appCode, env } = appConfig;
|
|
39
39
|
const { token, userId, portalId } = auth || {};
|
|
40
40
|
const headerStore = useLayoutStore(store => store.state.header);
|
|
41
|
+
const showLeftMenu = useLayoutStore(store => store.state.leftMenu.show);
|
|
41
42
|
const [showAccountSelection, setShowAccountSelection] = useState(false);
|
|
42
43
|
// Memo
|
|
43
44
|
const permissionDomain = useMemo(() => {
|
|
@@ -91,10 +92,10 @@ export const Layout = memo(props => {
|
|
|
91
92
|
const hasRole = hasSelectAccountPermission(activeItemPath, flattenPermissionList);
|
|
92
93
|
setShowAccountSelection(hasRole);
|
|
93
94
|
}, [onActiveMenuChange]);
|
|
94
|
-
return (React.createElement(LayoutWrapper,
|
|
95
|
-
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps)),
|
|
95
|
+
return (React.createElement(LayoutWrapper, { showLeftMenu: showLeftMenu },
|
|
96
|
+
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps, { showLogo: !showLeftMenu })),
|
|
96
97
|
React.createElement(Flex, { className: "layout-body" },
|
|
97
|
-
React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${className}`, appConfig: appConfig }, restOfLeftMenuProps, { onActiveMenuCodeChange: onActiveMenuCodeChange })),
|
|
98
|
+
showLeftMenu && (React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${className}`, appConfig: appConfig }, restOfLeftMenuProps, { onActiveMenuCodeChange: onActiveMenuCodeChange }))),
|
|
98
99
|
React.createElement(ContentWrapper, null,
|
|
99
100
|
React.createElement("div", Object.assign({}, restOfWorkspaceProps, { className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }),
|
|
100
101
|
React.createElement(NotificationWrapper, null,
|
|
@@ -4,6 +4,7 @@ import { DeepPartial } from '@antscorp/antsomi-ui/es/types';
|
|
|
4
4
|
export interface HeaderStore extends Partial<HeaderV2Props> {
|
|
5
5
|
}
|
|
6
6
|
export interface LeftMenuStore {
|
|
7
|
+
show: boolean;
|
|
7
8
|
onClickCreateDashboard?: React.MouseEventHandler<HTMLElement>;
|
|
8
9
|
}
|
|
9
10
|
export interface WorkspaceStore {
|
|
@@ -3,7 +3,7 @@ import { create } from 'zustand';
|
|
|
3
3
|
import { merge } from 'lodash';
|
|
4
4
|
const initialState = {
|
|
5
5
|
header: {},
|
|
6
|
-
leftMenu: {},
|
|
6
|
+
leftMenu: { show: true },
|
|
7
7
|
workspace: {},
|
|
8
8
|
};
|
|
9
9
|
export const useLayoutStore = create(set => ({
|
|
@@ -19,15 +19,19 @@ export const useLayoutStore = create(set => ({
|
|
|
19
19
|
state: Object.assign(Object.assign({}, store.state), { workspace: Object.assign(Object.assign({}, store.state.workspace), newState) }),
|
|
20
20
|
})),
|
|
21
21
|
resetHeaderState: () => set(store => ({
|
|
22
|
-
state: Object.assign(Object.assign({}, store.state), { header:
|
|
22
|
+
state: Object.assign(Object.assign({}, store.state), { header: {} }),
|
|
23
23
|
})),
|
|
24
24
|
resetLeftMenuState: () => set(store => ({
|
|
25
|
-
state: Object.assign(Object.assign({}, store.state), { leftMenu:
|
|
25
|
+
state: Object.assign(Object.assign({}, store.state), { leftMenu: { show: true } }),
|
|
26
26
|
})),
|
|
27
27
|
resetWorkspaceState: () => set(store => ({
|
|
28
|
-
state: Object.assign(Object.assign({}, store.state), { workspace:
|
|
28
|
+
state: Object.assign(Object.assign({}, store.state), { workspace: {} }),
|
|
29
29
|
})),
|
|
30
30
|
resetLayoutState: () => set(store => ({
|
|
31
|
-
state: Object.assign(Object.assign({}, store.state),
|
|
31
|
+
state: Object.assign(Object.assign({}, store.state), {
|
|
32
|
+
header: {},
|
|
33
|
+
leftMenu: { show: true },
|
|
34
|
+
workspace: {},
|
|
35
|
+
}),
|
|
32
36
|
})),
|
|
33
37
|
}));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const LayoutWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/flex/interface").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {
|
|
2
|
+
export declare const LayoutWrapper: 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
|
+
showLeftMenu: boolean;
|
|
4
|
+
}, never>;
|
|
3
5
|
export declare const ContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
6
|
export declare const NotificationWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
7
|
export declare const ChildrenWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -12,10 +12,14 @@ export const LayoutWrapper = styled(Flex) `
|
|
|
12
12
|
position: relative;
|
|
13
13
|
|
|
14
14
|
.layout-header {
|
|
15
|
-
width: calc(100% - 71px);
|
|
16
15
|
position: absolute;
|
|
17
|
-
left: 71px;
|
|
18
16
|
z-index: 20;
|
|
17
|
+
${({ showLeftMenu }) => showLeftMenu
|
|
18
|
+
? `
|
|
19
|
+
width: calc(100% - 71px);
|
|
20
|
+
left: 71px;
|
|
21
|
+
`
|
|
22
|
+
: 'width: 100%'};
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
.layout-body {
|
|
@@ -27,7 +27,9 @@ import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
|
27
27
|
import { CATEGORY_DEBOUNCE, CATEGORY_LISTING_WITH } from '../../constants';
|
|
28
28
|
const PATH = 'src/components/template/TemplateListing/components/CategoryListing/index.tsx';
|
|
29
29
|
export const CategoryListing = memo(props => {
|
|
30
|
-
const { width = CATEGORY_LISTING_WITH, items = [], loading = false, show = true, checkedCategories = {}, emptyProps, debounceChangeMenu = CATEGORY_DEBOUNCE, header, footer,
|
|
30
|
+
const { width = CATEGORY_LISTING_WITH, items = [], loading = false, show = true, checkedCategories = {}, emptyProps, debounceChangeMenu = CATEGORY_DEBOUNCE, header, footer,
|
|
31
|
+
/* Wrapper */
|
|
32
|
+
wrapperClassName, wrapperStyle, onMenuChange } = props, restOfProps = __rest(props, ["width", "items", "loading", "show", "checkedCategories", "emptyProps", "debounceChangeMenu", "header", "footer", "wrapperClassName", "wrapperStyle", "onMenuChange"]);
|
|
31
33
|
const [checkedState, setCheckedState] = useState({});
|
|
32
34
|
useEffect(() => {
|
|
33
35
|
setCheckedState(prev => (isEqual(prev, checkedCategories) ? prev : checkedCategories));
|
|
@@ -112,7 +114,7 @@ export const CategoryListing = memo(props => {
|
|
|
112
114
|
});
|
|
113
115
|
return menuItems;
|
|
114
116
|
}, [getItem, items]);
|
|
115
|
-
return (show && !isEmpty(menuItems)) || header || loading ? (React.createElement(MenuWrapper, { "$width": width },
|
|
117
|
+
return (show && !isEmpty(menuItems)) || header || loading ? (React.createElement(MenuWrapper, { "$width": width, className: wrapperClassName, style: wrapperStyle },
|
|
116
118
|
header,
|
|
117
119
|
React.createElement(Scrollbars, { className: "category__listing" },
|
|
118
120
|
React.createElement(Spin, { spinning: loading, wrapperClassName: "template-listing__loading" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ThumbnailCardProps } from '../../../molecules';
|
|
2
2
|
import { BlankTemplateProps, CategoryListingProps, TemplateListingProps, TemplatesProps } from '../types';
|
|
3
3
|
import { EmptyProps } from '../types/Empty';
|
|
4
|
-
export declare const CATEGORY_LISTING_WITH =
|
|
4
|
+
export declare const CATEGORY_LISTING_WITH = 230;
|
|
5
5
|
export declare const THUMBNAIL_URL = "https://st-media-template.antsomi.com/base64-img/37563.png";
|
|
6
6
|
export declare const LISTING_GAP_DEFAULT = 30;
|
|
7
7
|
export declare const CATEGORY_DEBOUNCE = 400;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Variables */
|
|
2
|
-
export const CATEGORY_LISTING_WITH =
|
|
2
|
+
export const CATEGORY_LISTING_WITH = 230;
|
|
3
3
|
export const THUMBNAIL_URL = 'https://st-media-template.antsomi.com/base64-img/37563.png';
|
|
4
4
|
export const LISTING_GAP_DEFAULT = 30;
|
|
5
5
|
export const CATEGORY_DEBOUNCE = 400;
|
|
@@ -13,6 +13,8 @@ export interface CategoryListingProps extends MenuProps {
|
|
|
13
13
|
emptyProps?: EmptyProps;
|
|
14
14
|
header?: ReactNode;
|
|
15
15
|
footer?: ReactNode;
|
|
16
|
+
wrapperClassName?: string;
|
|
17
|
+
wrapperStyle?: React.CSSProperties;
|
|
16
18
|
onMenuChange?: (value: TCheckedCategories) => void;
|
|
17
19
|
}
|
|
18
20
|
export type TMenuItem = Required<MenuProps>['items'][number];
|