@antscorp/antsomi-ui 1.3.5-beta.342 → 1.3.5-beta.344
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/organism/LeftMenu/components/HomeMenu/useHomeMenu.js +1 -0
- package/es/components/organism/LeftMenu/index.js +1 -0
- package/es/components/organism/LeftMenu/utils/index.js +12 -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
|
@@ -65,6 +65,7 @@ export const useHomeMenu = () => {
|
|
|
65
65
|
}, [auth, navigate, onClickCreateDashboard, replace, urlParams]);
|
|
66
66
|
const onMenuClick = useCallback((key, _) => {
|
|
67
67
|
const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: key }));
|
|
68
|
+
console.log('newPathName', newPathName);
|
|
68
69
|
if (newPathName !== pathname) {
|
|
69
70
|
navigate(newPathName);
|
|
70
71
|
}
|
|
@@ -32,6 +32,7 @@ export const LeftMenu = memo(props => {
|
|
|
32
32
|
}, [activeAppCode, isCustomized, state.hoverItem, onMenuItemClick]);
|
|
33
33
|
const renderFeatureMenuItems = useCallback((item) => {
|
|
34
34
|
const { menu_item_name, menu_item, icon_name, menu_item_code, menu_item_path, menu_item_domain, } = item;
|
|
35
|
+
console.log('🚀 ~ item:', item);
|
|
35
36
|
const isActive = activeAppCode === menu_item_code;
|
|
36
37
|
const isHover = state.hoverItem === menu_item_code;
|
|
37
38
|
const renderLabel = () => (React.createElement("li", { role: "menuitem", className: classNames({ isActive, isHover }) },
|
|
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
13
|
import { cloneDeep, isArray, isEmpty, sortBy } from 'lodash';
|
|
14
|
-
import { generatePath } from 'react-router-dom';
|
|
15
14
|
// Constants
|
|
16
15
|
import { APP_KEYS, MARKETING_CHANNEL_KEY, HOME_MENU_ITEMS, MARKETING_ROUTES, MENU_ITEM_TYPE, RENDER_OPTION, HOME_REPORT_ROUTES, SETTING_APP, } from '../constants';
|
|
17
16
|
import { MARKETING_CHANNEL_CODE } from '../../../template/Layout/constants';
|
|
@@ -70,13 +69,24 @@ export const recursivePermissionMenu = (menuItems, MenuPermissions) => {
|
|
|
70
69
|
export const getGeneratePath = (path, params) => {
|
|
71
70
|
try {
|
|
72
71
|
const { portalId, userId, dashboardId, channelId } = params || {};
|
|
73
|
-
return generatePath(path, {
|
|
72
|
+
// return generatePath(path, {
|
|
73
|
+
// user_id: userId ?? '-1',
|
|
74
|
+
// networkId: portalId ?? -1,
|
|
75
|
+
// portalId: portalId ?? -1,
|
|
76
|
+
// dashboardId: dashboardId ?? '-1',
|
|
77
|
+
// channelId: channelId ?? -1,
|
|
78
|
+
// });
|
|
79
|
+
const paramsObjects = {
|
|
74
80
|
user_id: userId !== null && userId !== void 0 ? userId : '-1',
|
|
75
81
|
networkId: portalId !== null && portalId !== void 0 ? portalId : -1,
|
|
76
82
|
portalId: portalId !== null && portalId !== void 0 ? portalId : -1,
|
|
77
83
|
dashboardId: dashboardId !== null && dashboardId !== void 0 ? dashboardId : '-1',
|
|
78
84
|
channelId: channelId !== null && channelId !== void 0 ? channelId : -1,
|
|
85
|
+
};
|
|
86
|
+
Object.keys(paramsObjects).forEach(key => {
|
|
87
|
+
path = path.replace(`:${key}`, paramsObjects[key]);
|
|
79
88
|
});
|
|
89
|
+
return path;
|
|
80
90
|
}
|
|
81
91
|
catch (error) {
|
|
82
92
|
handleError(error, {
|
|
@@ -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];
|