@antscorp/antsomi-ui 1.3.5-beta.213 → 1.3.5-beta.215

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.
@@ -1,8 +1,3 @@
1
- export declare const HOME_REPORT_ROUTES: {
2
- DETAIL: string;
3
- CONFIGURE: string;
4
- CREATE: string;
5
- };
6
1
  export declare const CONFIG_OPTIONS: {
7
2
  CONFIGURE: {
8
3
  key: string;
@@ -1,8 +1,3 @@
1
- export const HOME_REPORT_ROUTES = {
2
- DETAIL: 'detail/:dashboardId',
3
- CONFIGURE: 'detail/:dashboardId/configure',
4
- CREATE: 'create',
5
- };
6
1
  export const CONFIG_OPTIONS = {
7
2
  CONFIGURE: {
8
3
  key: 'configure',
@@ -3,7 +3,8 @@ import { useCallback, useMemo } from 'react';
3
3
  import { useContextSelector } from 'use-context-selector';
4
4
  import { useHistory, useLocation } from 'react-router-dom';
5
5
  // Constants
6
- import { CONFIG_OPTIONS, HOME_REPORT_ROUTES } from './constants';
6
+ import { CONFIG_OPTIONS } from './constants';
7
+ import { HOME_REPORT_ROUTES } from '../../constants';
7
8
  // Utils
8
9
  import { getGeneratePath, getMenuItem } from '../../utils';
9
10
  // Contexts
@@ -14,26 +15,15 @@ export const useHomeMenu = () => {
14
15
  // Hooks
15
16
  const { pathname } = useLocation();
16
17
  const history = useHistory();
17
- const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
18
18
  const appMenuChildren = useLeftMenuStore(store => store.state.appMenuChildren);
19
- const menuItems = useLeftMenuStore(store => store.state.menuItems);
20
19
  // Contexts
21
20
  const auth = useContextSelector(AppConfigContext, state => state === null || state === void 0 ? void 0 : state.auth);
22
21
  // Memos
23
- const homeItem = useMemo(() => menuItems === null || menuItems === void 0 ? void 0 : menuItems.find(item => item.menu_item_code === activeAppCode), [activeAppCode, menuItems]);
24
- // const listDashboardName = useMemo(
25
- // () =>
26
- // get(dashboardData, 'entries.ownedDashboard', [])?.map(overview =>
27
- // get(overview, 'dashboardName', ''),
28
- // ) || [],
29
- // [dashboardData],
30
- // );
31
- const getHomePath = useCallback((path) => `${(homeItem === null || homeItem === void 0 ? void 0 : homeItem.menu_item_path) || ''}/${path}`, [homeItem === null || homeItem === void 0 ? void 0 : homeItem.menu_item_path]);
32
22
  const onOptionCallback = useCallback((args) => {
33
23
  const { optionKey, menuItemKey } = args;
34
24
  switch (optionKey) {
35
25
  case CONFIG_OPTIONS.CONFIGURE.key: {
36
- const newPathName = getGeneratePath(getHomePath(HOME_REPORT_ROUTES.CONFIGURE), Object.assign(Object.assign({}, auth), { dashboardId: menuItemKey }));
26
+ const newPathName = getGeneratePath(HOME_REPORT_ROUTES.CONFIGURE, Object.assign(Object.assign({}, auth), { dashboardId: menuItemKey }));
37
27
  if (newPathName !== pathname) {
38
28
  history.push(newPathName);
39
29
  }
@@ -44,36 +34,21 @@ export const useHomeMenu = () => {
44
34
  default:
45
35
  break;
46
36
  }
47
- }, [getHomePath, auth, pathname, history]);
37
+ }, [auth, pathname, history]);
48
38
  const customChildren = useMemo(() => appMenuChildren === null || appMenuChildren === void 0 ? void 0 : appMenuChildren.map(appMenuItem => {
49
39
  var _a;
50
40
  return getMenuItem(Object.assign(Object.assign({}, appMenuItem), { children: (_a = appMenuItem === null || appMenuItem === void 0 ? void 0 : appMenuItem.children) === null || _a === void 0 ? void 0 : _a.map(item => (Object.assign(Object.assign({}, item), { options: Object.values(CONFIG_OPTIONS), optionCallback: onOptionCallback }))) }));
51
41
  }), [appMenuChildren, onOptionCallback]);
52
42
  // Callbacks
53
43
  const onCreateNewReport = useCallback(() => {
54
- history.push(getGeneratePath(getHomePath(HOME_REPORT_ROUTES.CREATE), auth));
55
- }, [auth, history, getHomePath]);
44
+ history.push(getGeneratePath(HOME_REPORT_ROUTES.CREATE, auth));
45
+ }, [auth, history]);
56
46
  const onMenuClick = useCallback((key, _) => {
57
- const newPathName = getGeneratePath(getHomePath(HOME_REPORT_ROUTES.DETAIL), Object.assign(Object.assign({}, auth), { dashboardId: key }));
47
+ const newPathName = getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: key }));
58
48
  if (newPathName !== pathname) {
59
49
  history.push(newPathName);
60
50
  }
61
- }, [getHomePath, auth, pathname, history]);
62
- // const onCreateNewReport = useCallback(() => {
63
- // const configTab = {
64
- // id: generateKey(),
65
- // dashboardName: getDefaultDashboardName(listDashboardName),
66
- // layout: 'settings',
67
- // filters: [],
68
- // enableParamFilter: 1,
69
- // portalId: getPortalId({}),
70
- // status: 1,
71
- // };
72
- // // onUpdateLoading({ isLoading: false });
73
- // // props.onAddNewOverview({
74
- // // configTab,
75
- // // });
76
- // }, [listDashboardName]);
51
+ }, [auth, pathname, history]);
77
52
  return {
78
53
  children: customChildren,
79
54
  /* Callbacks */
@@ -6,6 +6,7 @@ import { isNil } from 'lodash';
6
6
  import { MenuItemImageWrapper, MaskImage } from './styled';
7
7
  export const MenuItemImage = memo(({ fallbackIcon, imageUrl, className }) => {
8
8
  const [isExistImage, setIsExistImage] = useState(true);
9
- return (React.createElement(MenuItemImageWrapper, { align: "center", justify: "center", className: className }, isExistImage ? (React.createElement(MaskImage, { url: imageUrl })) : // <img src={imageUrl} alt="" onError={() => setIsExistImage(false)} />
10
- isNil(fallbackIcon) ? null : (React.createElement(Icon, { type: fallbackIcon }))));
9
+ return (React.createElement(MenuItemImageWrapper, { align: "center", justify: "center", className: className }, isExistImage ? (React.createElement(React.Fragment, null,
10
+ React.createElement(MaskImage, { url: imageUrl }),
11
+ React.createElement("img", { src: imageUrl, alt: "", onError: () => setIsExistImage(false), style: { display: 'none' } }))) : isNil(fallbackIcon) ? null : (React.createElement(Icon, { type: fallbackIcon }))));
11
12
  });
@@ -87,7 +87,7 @@ export const ChildMenu = memo(props => {
87
87
  e.domEvent.preventDefault();
88
88
  optionCallback === null || optionCallback === void 0 ? void 0 : optionCallback({ menuItemKey: key, optionKey: e.key });
89
89
  },
90
- }, trigger: ['click'], getPopupContainer: trigger => trigger.parentElement },
90
+ }, trigger: ['click'] },
91
91
  React.createElement(Icon, { className: "child-menu-item-icon", type: "icon-ants-three-dot-vertical", style: { marginTop: '2px', zIndex: 1000 } })))) : (React.createElement(LabelCustom, { ellipsis: { tooltip: label } }, label));
92
92
  return {
93
93
  key,
@@ -16,6 +16,11 @@ export declare const MENU_ITEM_TYPE: {
16
16
  };
17
17
  export declare const ICON_SIZE = 20;
18
18
  export declare const HOME_MENU_ITEMS: Record<string, TMenuFeatureItem>;
19
+ export declare const HOME_REPORT_ROUTES: {
20
+ DETAIL: string;
21
+ CONFIGURE: string;
22
+ CREATE: string;
23
+ };
19
24
  export declare const MARKETING_ROUTES: {
20
25
  CHANNEL: string;
21
26
  };
@@ -32,6 +32,12 @@ export const HOME_MENU_ITEMS = {
32
32
  icon_name: null,
33
33
  },
34
34
  };
35
+ const HOME_ROUTE = '/gen2/:networkId/dashboard';
36
+ export const HOME_REPORT_ROUTES = {
37
+ DETAIL: `${HOME_ROUTE}/detail/:dashboardId`,
38
+ CONFIGURE: `${HOME_ROUTE}/detail/:dashboardId/configure`,
39
+ CREATE: `${HOME_ROUTE}/create`,
40
+ };
35
41
  /* MARKETING APP */
36
42
  export const MARKETING_ROUTES = {
37
43
  CHANNEL: '/gen2/:networkId/:user_id/marketing-hub/journeys/:channelId/list',
@@ -11,7 +11,7 @@ export const PopoverWrapper = styled.div `
11
11
  visibility: hidden;
12
12
  position: absolute;
13
13
  background-color: white;
14
- left: 69px;
14
+ left: 65px;
15
15
  border-radius: ${(_a = THEME === null || THEME === void 0 ? void 0 : THEME.token) === null || _a === void 0 ? void 0 : _a.borderRadiusXL}px;
16
16
  bottom: 15px;
17
17
  width: 230px;
@@ -160,9 +160,9 @@ export const FeatureMenuItem = styled.div `
160
160
  }
161
161
 
162
162
  .popup-triangle {
163
- visibility: hidden;
164
163
  opacity: 0;
165
- right: -10px;
164
+ visibility: hidden;
165
+ right: -4px;
166
166
  position: absolute;
167
167
  width: 0;
168
168
  height: 0;
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  import { isArray, isEmpty, sortBy } from 'lodash';
14
14
  import { generatePath } from 'react-router-dom';
15
15
  // Constants
16
- import { APP_KEYS, MARKETING_CHANNEL_KEY, HOME_MENU_ITEMS, MARKETING_ROUTES, MENU_ITEM_TYPE, MARKETING_CHANNEL_CODE, RENDER_OPTION, } from '../constants';
16
+ import { APP_KEYS, MARKETING_CHANNEL_KEY, HOME_MENU_ITEMS, MARKETING_ROUTES, MENU_ITEM_TYPE, MARKETING_CHANNEL_CODE, RENDER_OPTION, HOME_REPORT_ROUTES, } from '../constants';
17
17
  // Utils
18
18
  import { handleError } from '@antscorp/antsomi-ui/es/utils';
19
19
  const PATH = 'src/components/organism/LeftMenu/utils/index.ts';
@@ -114,6 +114,7 @@ export const getMappingAppChildren = (args) => {
114
114
  menu_item: String(item.dashboardId),
115
115
  menu_item_code: String(item.dashboardId),
116
116
  menu_item_name: item.dashboardName,
117
+ menu_item_path: getGeneratePath(HOME_REPORT_ROUTES.DETAIL, Object.assign(Object.assign({}, auth), { dashboardId: String(item.dashboardId) })),
117
118
  })))) }));
118
119
  });
119
120
  break;
@@ -17,7 +17,12 @@ export const InformationWrapper = styled(Flex) `
17
17
  max-width: 100%;
18
18
  color: inherit;
19
19
  padding-right: 25px;
20
- word-break: break-all;
20
+ word-break: break-word;
21
+
22
+ overflow: hidden;
23
+ display: -webkit-box;
24
+ -webkit-box-orient: vertical;
25
+ -webkit-line-clamp: 3;
21
26
  }
22
27
 
23
28
  .antsomi-radio-group {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.213",
3
+ "version": "1.3.5-beta.215",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",