@antscorp/antsomi-ui 1.3.5-beta.196 → 1.3.5-beta.199
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.js +2 -3
- package/es/components/organism/LeftMenu/components/common/ChildMenu/index.js +12 -9
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.d.ts +2 -6
- package/es/components/organism/LeftMenu/hooks/useLeftMenu.js +16 -33
- package/es/components/organism/LeftMenu/index.js +2 -2
- package/es/components/organism/LeftMenu/stores/index.d.ts +3 -3
- package/es/components/organism/LeftMenu/stores/index.js +1 -5
- package/es/components/template/Layout/Layout.d.ts +20 -0
- package/es/components/template/Layout/Layout.js +61 -0
- package/es/components/template/Layout/index.d.ts +2 -18
- package/es/components/template/Layout/index.js +2 -62
- package/es/components/template/Layout/stores/index.d.ts +18 -0
- package/es/components/template/Layout/stores/index.js +17 -0
- package/es/components/template/Layout/styled.js +3 -1
- package/es/constants/theme.js +12 -7
- package/es/providers/AppConfigProvider/contexts/index.d.ts +0 -3
- package/es/providers/AppConfigProvider/contexts/index.js +2 -5
- package/es/providers/AppConfigProvider/index.d.ts +0 -1
- package/es/providers/AppConfigProvider/index.js +0 -1
- package/es/providers/ConfigProvider/GlobalStyle.js +12 -2
- package/es/types/index.d.ts +4 -0
- package/es/types/index.js +1 -0
- package/es/types/processingNotification.d.ts +4 -0
- package/es/types/processingNotification.js +1 -0
- package/package.json +2 -2
- package/es/providers/AppConfigProvider/reducer.d.ts +0 -12
- package/es/providers/AppConfigProvider/reducer.js +0 -12
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { memo, useEffect, useState } from 'react';
|
|
13
|
-
import { cloneDeep, merge } from 'lodash';
|
|
14
13
|
// Styled
|
|
15
14
|
import { HeaderV2Styled } from './styled';
|
|
16
15
|
// Components
|
|
@@ -22,9 +21,9 @@ import { useContextSelector } from 'use-context-selector';
|
|
|
22
21
|
import { AppConfigContext } from '../../..';
|
|
23
22
|
export const HeaderV2 = memo(props => {
|
|
24
23
|
var _a, _b, _c;
|
|
25
|
-
const { auth, env: envContext, languageCode = 'en',
|
|
24
|
+
const { auth, env: envContext, languageCode = 'en', } = useContextSelector(AppConfigContext, state => state);
|
|
26
25
|
/** Prefer to use Header in AppConfigContext */
|
|
27
|
-
const { className, style, pageTitle = 'Page Title', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } =
|
|
26
|
+
const { className, style, pageTitle = 'Page Title', accountSelection = {}, helpConfig, notificationConfig = {}, accountSharingConfig, useURLParam, config, } = props;
|
|
28
27
|
/** General config for children component */
|
|
29
28
|
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, } = config || {};
|
|
30
29
|
const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
|
|
@@ -15,22 +15,25 @@ import { ICON_SIZE } from '../../../constants';
|
|
|
15
15
|
import { ENV } from '@antscorp/antsomi-ui/es/config';
|
|
16
16
|
// Contexts
|
|
17
17
|
import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
|
|
18
|
-
// Stores
|
|
19
|
-
import { useLeftMenuStore } from '../../../stores';
|
|
20
18
|
// Utils
|
|
21
19
|
import { findActiveAppCodeByUrl, getGeneratePath } from '../../../utils';
|
|
22
20
|
import { findActiveMenuItemByUrl, recursiveFindParentOfActiveItem } from './utils';
|
|
21
|
+
import { random } from '@antscorp/antsomi-ui/es/utils';
|
|
22
|
+
import { useLeftMenuStore } from '../../../stores';
|
|
23
23
|
export const ChildMenu = memo(props => {
|
|
24
24
|
const { items = [], parentKey, onMenuClick } = props;
|
|
25
|
-
//
|
|
25
|
+
// Contexts
|
|
26
26
|
const auth = useContextSelector(AppConfigContext, state => state === null || state === void 0 ? void 0 : state.auth);
|
|
27
27
|
const env = useContextSelector(AppConfigContext, state => state === null || state === void 0 ? void 0 : state.env);
|
|
28
|
-
|
|
28
|
+
// Stores
|
|
29
29
|
const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
|
|
30
30
|
const menuItems = useLeftMenuStore(store => store.state.menuItems);
|
|
31
|
+
const setLeftMenuState = useLeftMenuStore(store => store.setState);
|
|
31
32
|
// States
|
|
32
33
|
const [currentActiveItem, setCurrentActiveItem] = useState('');
|
|
33
34
|
const [openKeys, setOpenKeys] = useState([]);
|
|
35
|
+
// Variables
|
|
36
|
+
const randomMenuWrapperId = random(10);
|
|
34
37
|
// Hooks
|
|
35
38
|
const { pathname, hash, search } = useLocation();
|
|
36
39
|
// Side Effects
|
|
@@ -48,7 +51,7 @@ export const ChildMenu = memo(props => {
|
|
|
48
51
|
/** Active App Item having code matching url */
|
|
49
52
|
const matchAppCode = findActiveAppCodeByUrl({ menuItems, url, auth });
|
|
50
53
|
if (matchAppCode && matchAppCode !== activeAppCode) {
|
|
51
|
-
|
|
54
|
+
setLeftMenuState({ activeAppCode: matchAppCode });
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
}, [
|
|
@@ -60,8 +63,8 @@ export const ChildMenu = memo(props => {
|
|
|
60
63
|
search,
|
|
61
64
|
parentKey,
|
|
62
65
|
activeAppCode,
|
|
63
|
-
setLeftMenuStoreState,
|
|
64
66
|
menuItems,
|
|
67
|
+
setLeftMenuState,
|
|
65
68
|
]);
|
|
66
69
|
// Handlers
|
|
67
70
|
const onClick = e => {
|
|
@@ -83,8 +86,8 @@ export const ChildMenu = memo(props => {
|
|
|
83
86
|
e.domEvent.preventDefault();
|
|
84
87
|
optionCallback === null || optionCallback === void 0 ? void 0 : optionCallback({ menuItemKey: key, optionKey: e.key });
|
|
85
88
|
},
|
|
86
|
-
}, trigger: ['click'] },
|
|
87
|
-
React.createElement(Icon, { type: "icon-ants-three-dot-vertical", style: { marginTop: '2px', zIndex: 1000 } })))) : (React.createElement(LabelCustom, { ellipsis: { tooltip: label } }, label));
|
|
89
|
+
}, trigger: ['click'], getPopupContainer: trigger => trigger.parentElement },
|
|
90
|
+
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));
|
|
88
91
|
return {
|
|
89
92
|
key,
|
|
90
93
|
label: isString(menu_item_path) ? (React.createElement(Link, { to: getGeneratePath(`${domain}${menu_item_path}`, auth), className: "menu-link" }, labelComponent())) : (labelComponent()),
|
|
@@ -93,7 +96,7 @@ export const ChildMenu = memo(props => {
|
|
|
93
96
|
};
|
|
94
97
|
});
|
|
95
98
|
};
|
|
96
|
-
return (React.createElement(MenuWrapper, { className: "child-menu" },
|
|
99
|
+
return (React.createElement(MenuWrapper, { className: "child-menu", id: randomMenuWrapperId },
|
|
97
100
|
React.createElement(Menu, { selectedKeys: [currentActiveItem], defaultOpenKeys: [currentActiveItem], openKeys: uniq(openKeys), mode: "inline", items: customMenuItems({ items }), inlineIndent: 10, onOpenChange: openKeys => {
|
|
98
101
|
setOpenKeys(openKeys);
|
|
99
102
|
}, expandIcon: ({ isOpen }) => (React.createElement(Icon, { type: "icon-ants-expand-more", style: {
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TFeatureMenu } from '@antscorp/antsomi-ui/es/models/LeftMenu/FeatureMenu';
|
|
3
1
|
import { LeftMenuProps } from '..';
|
|
4
2
|
interface TState {
|
|
5
3
|
hoverItem: string;
|
|
6
4
|
isExpandMenu: boolean;
|
|
7
|
-
featureChildren: TFeatureMenu[];
|
|
8
5
|
}
|
|
9
6
|
export declare const useLeftMenu: (props: LeftMenuProps) => {
|
|
10
7
|
state: TState;
|
|
11
8
|
activeAppCode: string;
|
|
12
|
-
permissionMenu: TFeatureMenu[];
|
|
9
|
+
permissionMenu: import("@antscorp/antsomi-ui/es/models/LeftMenu").TFeatureMenu[];
|
|
13
10
|
appConfig: import("@antscorp/antsomi-ui/es/providers").AppConfigProviderProps;
|
|
14
|
-
setState: import("react").Dispatch<import("react").SetStateAction<TState>>;
|
|
15
11
|
onToggleChildMenu: () => void;
|
|
16
|
-
onMouseEnter: (key: string
|
|
12
|
+
onMouseEnter: (key: string) => void;
|
|
17
13
|
onMouseLeave: () => void;
|
|
18
14
|
};
|
|
19
15
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { useContextSelector } from 'use-context-selector';
|
|
4
|
-
import {
|
|
4
|
+
import { isArray, sortBy } from 'lodash';
|
|
5
5
|
import { useLocation } from 'react-router-dom';
|
|
6
6
|
// Contexts
|
|
7
7
|
import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
|
|
@@ -9,13 +9,11 @@ import { AppConfigContext } from '@antscorp/antsomi-ui/es/providers';
|
|
|
9
9
|
import { useGetDashboard, useGetDestinationChannel, useGetListMenu, useGetListMenuPermission, } from '@antscorp/antsomi-ui/es/queries/LeftMenu';
|
|
10
10
|
// Utils
|
|
11
11
|
import { findActiveAppCodeByUrl, flattenMenuArray, getMappingAppChildren, recursivePermissionMenu, } from '../utils';
|
|
12
|
-
import isEqual from 'react-fast-compare';
|
|
13
12
|
// Store
|
|
14
13
|
import { useLeftMenuStore } from '../stores';
|
|
15
14
|
const initialState = {
|
|
16
15
|
hoverItem: '',
|
|
17
16
|
isExpandMenu: true,
|
|
18
|
-
featureChildren: [],
|
|
19
17
|
};
|
|
20
18
|
export const useLeftMenu = (props) => {
|
|
21
19
|
// Props
|
|
@@ -24,13 +22,13 @@ export const useLeftMenu = (props) => {
|
|
|
24
22
|
const { pathname, hash, search } = useLocation();
|
|
25
23
|
// Contexts
|
|
26
24
|
const appConfig = useContextSelector(AppConfigContext, state => state);
|
|
25
|
+
// Stores
|
|
26
|
+
const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
|
|
27
|
+
const setLeftMenuState = useLeftMenuStore(store => store.setState);
|
|
27
28
|
// Destructuring variables
|
|
28
29
|
const { auth, languageCode } = appConfig;
|
|
29
30
|
// State
|
|
30
31
|
const [state, setState] = useState(initialState);
|
|
31
|
-
// NOTES: Trial Zustand
|
|
32
|
-
const activeAppCode = useLeftMenuStore(store => store.state.activeAppCode);
|
|
33
|
-
const setLeftMenuStoreState = useLeftMenuStore(state => state.setState);
|
|
34
32
|
// Queries
|
|
35
33
|
const { data: menuList } = useGetListMenu({
|
|
36
34
|
args: {
|
|
@@ -108,11 +106,13 @@ export const useLeftMenu = (props) => {
|
|
|
108
106
|
useEffect(() => {
|
|
109
107
|
var _a;
|
|
110
108
|
const appCode = state.hoverItem ? state.hoverItem : activeAppCode;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
if (isArray(mappingChildrenMenu)) {
|
|
110
|
+
setLeftMenuState({
|
|
111
|
+
menuItems: mappingChildrenMenu,
|
|
112
|
+
appMenuChildren: ((_a = mappingChildrenMenu === null || mappingChildrenMenu === void 0 ? void 0 : mappingChildrenMenu.find(item => item.menu_item_code === appCode)) === null || _a === void 0 ? void 0 : _a.children) || [],
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, [activeAppCode, mappingChildrenMenu, state.hoverItem, setLeftMenuState]);
|
|
116
116
|
/**
|
|
117
117
|
* Active App Item having code matching url
|
|
118
118
|
*/
|
|
@@ -120,7 +120,7 @@ export const useLeftMenu = (props) => {
|
|
|
120
120
|
const url = `${pathname}${hash}${search}`;
|
|
121
121
|
const matchAppCode = findActiveAppCodeByUrl({ url, menuItems: mappingChildrenMenu, auth });
|
|
122
122
|
if (matchAppCode && matchAppCode !== activeAppCode) {
|
|
123
|
-
|
|
123
|
+
setLeftMenuState({ activeAppCode: matchAppCode });
|
|
124
124
|
}
|
|
125
125
|
}, [
|
|
126
126
|
activeAppCode,
|
|
@@ -131,33 +131,17 @@ export const useLeftMenu = (props) => {
|
|
|
131
131
|
pathname,
|
|
132
132
|
permissionMenu,
|
|
133
133
|
search,
|
|
134
|
-
|
|
134
|
+
setLeftMenuState,
|
|
135
135
|
]);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
var _a;
|
|
138
|
-
if (activeAppCode) {
|
|
139
|
-
const featureChildren = ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code === activeAppCode)) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
140
|
-
if (!isEqual(featureChildren, state.featureChildren) && !state.hoverItem) {
|
|
141
|
-
setState(prev => {
|
|
142
|
-
var _a;
|
|
143
|
-
return (Object.assign(Object.assign({}, prev), { featureChildren: ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code === activeAppCode)) === null || _a === void 0 ? void 0 : _a.children) || [] }));
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, [permissionMenu, activeAppCode, state.featureChildren, state.hoverItem]);
|
|
148
136
|
/* Callbacks */
|
|
149
137
|
const onToggleChildMenu = useCallback(() => {
|
|
150
138
|
setState(prev => (Object.assign(Object.assign({}, prev), { isExpandMenu: !prev.isExpandMenu })));
|
|
151
139
|
}, []);
|
|
152
|
-
const onMouseEnter = useCallback((key
|
|
153
|
-
var _a;
|
|
140
|
+
const onMouseEnter = useCallback((key) => {
|
|
154
141
|
if (!state.isExpandMenu) {
|
|
155
|
-
|
|
156
|
-
? children
|
|
157
|
-
: ((_a = permissionMenu === null || permissionMenu === void 0 ? void 0 : permissionMenu.find(item => item.menu_item_code === activeAppCode)) === null || _a === void 0 ? void 0 : _a.children) || [];
|
|
158
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: key, featureChildren })));
|
|
142
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: key })));
|
|
159
143
|
}
|
|
160
|
-
}, [
|
|
144
|
+
}, [state.isExpandMenu]);
|
|
161
145
|
const onMouseLeave = useCallback(() => {
|
|
162
146
|
if (!state.isExpandMenu) {
|
|
163
147
|
setState(prev => (Object.assign(Object.assign({}, prev), { hoverItem: '' })));
|
|
@@ -172,7 +156,6 @@ export const useLeftMenu = (props) => {
|
|
|
172
156
|
permissionMenu,
|
|
173
157
|
appConfig,
|
|
174
158
|
/* Callbacks */
|
|
175
|
-
setState,
|
|
176
159
|
onToggleChildMenu,
|
|
177
160
|
onMouseEnter,
|
|
178
161
|
onMouseLeave,
|
|
@@ -65,7 +65,7 @@ export const LeftMenu = memo(props => {
|
|
|
65
65
|
}, [activeAppCode, state.hoverItem]);
|
|
66
66
|
// Render components
|
|
67
67
|
const renderFeatureMenuItems = (item) => {
|
|
68
|
-
const { menu_item_name, menu_item, icon_name, menu_item_code, menu_item_path, menu_item_domain,
|
|
68
|
+
const { menu_item_name, menu_item, icon_name, menu_item_code, menu_item_path, menu_item_domain, } = item;
|
|
69
69
|
const domain = !isNil(menu_item_domain) && (appConfig === null || appConfig === void 0 ? void 0 : appConfig.env) === ENV.DEV ? menu_item_domain : '';
|
|
70
70
|
const isActive = activeAppCode === menu_item_code;
|
|
71
71
|
const isHover = state.hoverItem === menu_item_code;
|
|
@@ -73,7 +73,7 @@ export const LeftMenu = memo(props => {
|
|
|
73
73
|
React.createElement("div", { className: "icon-wrapper" }, isNil(icon_name) ? null : React.createElement(Icon, { type: icon_name, style: { fontSize: ICON_SIZE } })),
|
|
74
74
|
React.createElement(Typography.Text, null, menu_item_name),
|
|
75
75
|
React.createElement("div", { className: "popup-triangle" })));
|
|
76
|
-
return (React.createElement(FeatureMenuItem, { key: menu_item, onMouseEnter: () => onMouseEnter(menu_item_code
|
|
76
|
+
return (React.createElement(FeatureMenuItem, { key: menu_item, onMouseEnter: () => onMouseEnter(menu_item_code) }, isString(menu_item_path) ? (React.createElement(Link, { to: getGeneratePath(`${domain}${menu_item_path}`, appConfig === null || appConfig === void 0 ? void 0 : appConfig.auth), className: "menu-link" }, labelComponent())) : (labelComponent())));
|
|
77
77
|
};
|
|
78
78
|
return (React.createElement(LeftMenuNavWrapper, { style: style, className: className },
|
|
79
79
|
React.createElement(LeftMenuNav, null,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TFeatureMenu } from '@antscorp/antsomi-ui/es/models/LeftMenu';
|
|
2
|
-
export interface
|
|
2
|
+
export interface LeftMenuState {
|
|
3
3
|
activeAppCode: string;
|
|
4
4
|
menuItems: TFeatureMenu[];
|
|
5
5
|
appMenuChildren: TFeatureMenu[];
|
|
6
6
|
}
|
|
7
7
|
interface LeftMenuStore {
|
|
8
|
-
state:
|
|
9
|
-
setState: (state: Partial<
|
|
8
|
+
state: LeftMenuState;
|
|
9
|
+
setState: (state: Partial<LeftMenuState>) => void;
|
|
10
10
|
}
|
|
11
11
|
export declare const useLeftMenuStore: import("zustand").UseBoundStore<import("zustand").StoreApi<LeftMenuStore>>;
|
|
12
12
|
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
import { create } from 'zustand';
|
|
3
|
-
const initialState = {
|
|
4
|
-
activeAppCode: '',
|
|
5
|
-
menuItems: [],
|
|
6
|
-
appMenuChildren: [],
|
|
7
|
-
};
|
|
3
|
+
const initialState = { activeAppCode: '', menuItems: [], appMenuChildren: [] };
|
|
8
4
|
export const useLeftMenuStore = create(set => ({
|
|
9
5
|
state: initialState,
|
|
10
6
|
setState: newState => set(store => ({ state: Object.assign(Object.assign({}, store.state), newState) })),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { LeftMenuProps } from '../../organism';
|
|
3
|
+
import { HeaderV2Props } from '../../molecules';
|
|
4
|
+
import '@antscorp/processing-notification/dist/index.css';
|
|
5
|
+
import { ProcessingNotificationProps } from '@antscorp/antsomi-ui/es/types';
|
|
6
|
+
interface LayoutProps {
|
|
7
|
+
headerProps?: Partial<HeaderV2Props>;
|
|
8
|
+
leftMenuProps?: LeftMenuProps;
|
|
9
|
+
processingNotificationProps?: Partial<ProcessingNotificationProps>;
|
|
10
|
+
workspaceProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare const Layout: React.FC<PropsWithChildren<LayoutProps>>;
|
|
13
|
+
declare global {
|
|
14
|
+
namespace JSX {
|
|
15
|
+
interface IntrinsicElements {
|
|
16
|
+
'ants-processing-notification': any;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
// Libraries
|
|
13
|
+
import React, { memo, useMemo } from 'react';
|
|
14
|
+
import { useContextSelector } from 'use-context-selector';
|
|
15
|
+
import AntsProcessingNotification from '@antscorp/processing-notification';
|
|
16
|
+
import { merge } from 'lodash';
|
|
17
|
+
// Styled
|
|
18
|
+
import { ChildrenWrapper, ContentWrapper, LayoutWrapper, NotificationWrapper } from './styled';
|
|
19
|
+
// Components
|
|
20
|
+
import { LeftMenu } from '../../organism';
|
|
21
|
+
import { Flex } from '../../atoms';
|
|
22
|
+
import { HeaderV2 } from '../../molecules';
|
|
23
|
+
// Contexts
|
|
24
|
+
import { AppConfigContext } from '../../..';
|
|
25
|
+
// Constants
|
|
26
|
+
import { PERMISSION_API, SOCKET_API } from '../../../constants';
|
|
27
|
+
// Css
|
|
28
|
+
import '@antscorp/processing-notification/dist/index.css';
|
|
29
|
+
import { useLayoutStore } from './stores';
|
|
30
|
+
export const Layout = memo(props => {
|
|
31
|
+
const { leftMenuProps, headerProps = {}, workspaceProps, processingNotificationProps, children, } = props;
|
|
32
|
+
const _a = leftMenuProps || {}, { className = '' } = _a, restOfLeftMenuProps = __rest(_a, ["className"]);
|
|
33
|
+
// Selectors
|
|
34
|
+
const { auth, languageCode } = useContextSelector(AppConfigContext, state => state);
|
|
35
|
+
const { token, userId, portalId } = auth || {};
|
|
36
|
+
const headerStore = useLayoutStore(store => store.state.header);
|
|
37
|
+
// Memo
|
|
38
|
+
const initialHeaderProps = useMemo(() => {
|
|
39
|
+
var _a;
|
|
40
|
+
return (Object.assign(Object.assign({ className: 'layout-header' }, headerProps), { helpConfig: {
|
|
41
|
+
configs: Object.assign(Object.assign({}, (_a = headerProps === null || headerProps === void 0 ? void 0 : headerProps.helpConfig) === null || _a === void 0 ? void 0 : _a.configs), { appCode: 'SANDBOX_MARKETING', avatar: '//c0-platform.ants.tech/avatar/2021/09/17/0xgbkurioo.png', config: {
|
|
42
|
+
p_timezone: 'Asia/Singapore',
|
|
43
|
+
api_pid: 33167,
|
|
44
|
+
p_f_longdatetime: "dd MMMM 'at' HH:mm:ss",
|
|
45
|
+
embeddedData: {},
|
|
46
|
+
INSIGHT_U_OGS: 'uogs',
|
|
47
|
+
} }),
|
|
48
|
+
}, accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: 'APP_CUSTOMER_360' }) }));
|
|
49
|
+
}, [headerProps]);
|
|
50
|
+
const mergeHeaderProps = useMemo(() => merge(initialHeaderProps, headerStore), [initialHeaderProps, headerStore]);
|
|
51
|
+
const antsProcessingNotificationConfig = useMemo(() => (Object.assign({ permissionDomain: PERMISSION_API, socketDomain: SOCKET_API, token, accountId: userId, userId, lang: languageCode, networkId: portalId }, processingNotificationProps)), [languageCode, portalId, token, userId, processingNotificationProps]);
|
|
52
|
+
return (React.createElement(LayoutWrapper, null,
|
|
53
|
+
React.createElement(HeaderV2, Object.assign({}, mergeHeaderProps)),
|
|
54
|
+
React.createElement(Flex, { className: "layout-body" },
|
|
55
|
+
React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${className}` }, restOfLeftMenuProps)),
|
|
56
|
+
React.createElement(ContentWrapper, null,
|
|
57
|
+
React.createElement("div", Object.assign({}, workspaceProps, { className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }),
|
|
58
|
+
React.createElement(NotificationWrapper, null,
|
|
59
|
+
React.createElement(AntsProcessingNotification, Object.assign({}, antsProcessingNotificationConfig))),
|
|
60
|
+
React.createElement(ChildrenWrapper, null, children))))));
|
|
61
|
+
});
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { HeaderV2Props } from '../../molecules';
|
|
4
|
-
import '@antscorp/processing-notification/dist/index.css';
|
|
5
|
-
interface LayoutProps {
|
|
6
|
-
headerProps?: Partial<HeaderV2Props>;
|
|
7
|
-
leftMenuProps?: LeftMenuProps;
|
|
8
|
-
workspaceProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
-
}
|
|
10
|
-
export declare const Layout: React.FC<PropsWithChildren<LayoutProps>>;
|
|
11
|
-
declare global {
|
|
12
|
-
namespace JSX {
|
|
13
|
-
interface IntrinsicElements {
|
|
14
|
-
'ants-processing-notification': any;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
1
|
+
export * from './Layout';
|
|
2
|
+
export * from './stores';
|
|
@@ -1,62 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
// Libraries
|
|
13
|
-
import React, { memo, useMemo } from 'react';
|
|
14
|
-
import { useContextSelector } from 'use-context-selector';
|
|
15
|
-
import AntsProcessingNotification from '@antscorp/processing-notification';
|
|
16
|
-
// Styled
|
|
17
|
-
import { ChildrenWrapper, ContentWrapper, LayoutWrapper, NotificationWrapper } from './styled';
|
|
18
|
-
// Components
|
|
19
|
-
import { LeftMenu } from '../../organism';
|
|
20
|
-
import { Flex } from '../../atoms';
|
|
21
|
-
import { HeaderV2 } from '../../molecules';
|
|
22
|
-
// Contexts
|
|
23
|
-
import { AppConfigContext } from '../../..';
|
|
24
|
-
// Constants
|
|
25
|
-
import { PERMISSION_API, SOCKET_API } from '../../../constants';
|
|
26
|
-
// Css
|
|
27
|
-
import '@antscorp/processing-notification/dist/index.css';
|
|
28
|
-
export const Layout = memo(props => {
|
|
29
|
-
var _a;
|
|
30
|
-
const { leftMenuProps, headerProps, workspaceProps, children } = props;
|
|
31
|
-
const _b = leftMenuProps || {}, { className = '' } = _b, restOfLeftMenuProps = __rest(_b, ["className"]);
|
|
32
|
-
// Selectors
|
|
33
|
-
const { auth, languageCode } = useContextSelector(AppConfigContext, state => state);
|
|
34
|
-
const { token, userId, portalId } = auth || {};
|
|
35
|
-
// Memo
|
|
36
|
-
const antsProcessingNotificationConfig = useMemo(() => ({
|
|
37
|
-
permissionDomain: PERMISSION_API,
|
|
38
|
-
socketDomain: SOCKET_API,
|
|
39
|
-
token,
|
|
40
|
-
accountId: userId,
|
|
41
|
-
userId,
|
|
42
|
-
lang: languageCode,
|
|
43
|
-
networkId: portalId,
|
|
44
|
-
}), [languageCode, portalId, token, userId]);
|
|
45
|
-
return (React.createElement(LayoutWrapper, null,
|
|
46
|
-
React.createElement(HeaderV2, Object.assign({ className: "layout-header" }, headerProps, { helpConfig: {
|
|
47
|
-
configs: Object.assign(Object.assign({}, (_a = headerProps === null || headerProps === void 0 ? void 0 : headerProps.helpConfig) === null || _a === void 0 ? void 0 : _a.configs), { appCode: 'SANDBOX_MARKETING', avatar: '//c0-platform.ants.tech/avatar/2021/09/17/0xgbkurioo.png', config: {
|
|
48
|
-
p_timezone: 'Asia/Singapore',
|
|
49
|
-
api_pid: 33167,
|
|
50
|
-
p_f_longdatetime: "dd MMMM 'at' HH:mm:ss",
|
|
51
|
-
embeddedData: {},
|
|
52
|
-
INSIGHT_U_OGS: 'uogs',
|
|
53
|
-
} }),
|
|
54
|
-
}, accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: 'APP_CUSTOMER_360' }) })),
|
|
55
|
-
React.createElement(Flex, { className: "layout-body" },
|
|
56
|
-
React.createElement(LeftMenu, Object.assign({ className: `layout-body__menu ${className}` }, restOfLeftMenuProps)),
|
|
57
|
-
React.createElement(ContentWrapper, null,
|
|
58
|
-
React.createElement("div", Object.assign({}, workspaceProps, { className: `layout-body__content ${(workspaceProps === null || workspaceProps === void 0 ? void 0 : workspaceProps.className) || ''}` }),
|
|
59
|
-
React.createElement(NotificationWrapper, null,
|
|
60
|
-
React.createElement(AntsProcessingNotification, Object.assign({}, antsProcessingNotificationConfig))),
|
|
61
|
-
React.createElement(ChildrenWrapper, null, children))))));
|
|
62
|
-
});
|
|
1
|
+
export * from './Layout';
|
|
2
|
+
export * from './stores';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HeaderV2Props } from '../../../molecules';
|
|
2
|
+
import { DeepPartial } from '@antscorp/antsomi-ui/es/types';
|
|
3
|
+
export interface HeaderStore extends Partial<HeaderV2Props> {
|
|
4
|
+
}
|
|
5
|
+
export interface WorkspaceStore {
|
|
6
|
+
}
|
|
7
|
+
export interface LayoutStoreState {
|
|
8
|
+
header: HeaderStore;
|
|
9
|
+
workspace: WorkspaceStore;
|
|
10
|
+
}
|
|
11
|
+
interface LayoutStore {
|
|
12
|
+
state: LayoutStoreState;
|
|
13
|
+
setHeaderState: (state: DeepPartial<HeaderStore>) => void;
|
|
14
|
+
setWorkspaceState: (state: Partial<WorkspaceStore>) => void;
|
|
15
|
+
setLayoutState: (state: DeepPartial<LayoutStoreState>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const useLayoutStore: import("zustand").UseBoundStore<import("zustand").StoreApi<LayoutStore>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import { create } from 'zustand';
|
|
3
|
+
import { merge } from 'lodash';
|
|
4
|
+
const initialState = {
|
|
5
|
+
header: {},
|
|
6
|
+
workspace: {},
|
|
7
|
+
};
|
|
8
|
+
export const useLayoutStore = create(set => ({
|
|
9
|
+
state: initialState,
|
|
10
|
+
setLayoutState: newState => set(store => ({ state: merge(store.state, newState) })),
|
|
11
|
+
setHeaderState: newState => set(store => ({
|
|
12
|
+
state: Object.assign(Object.assign({}, store.state), { header: Object.assign(Object.assign({}, store.state.header), newState) }),
|
|
13
|
+
})),
|
|
14
|
+
setWorkspaceState: newState => set(store => ({
|
|
15
|
+
state: Object.assign(Object.assign({}, store.state), { workspace: Object.assign(Object.assign({}, store.state.workspace), newState) }),
|
|
16
|
+
})),
|
|
17
|
+
}));
|
|
@@ -19,7 +19,9 @@ export const LayoutWrapper = styled(Flex) `
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.layout-body {
|
|
22
|
+
position: relative;
|
|
22
23
|
width: 100%;
|
|
24
|
+
z-index: 10;
|
|
23
25
|
|
|
24
26
|
&__menu {
|
|
25
27
|
flex-shrink: 0;
|
|
@@ -56,7 +58,7 @@ export const NotificationWrapper = styled.div `
|
|
|
56
58
|
/* margin-bottom: 6px; */
|
|
57
59
|
padding-top: 15px;
|
|
58
60
|
background-color: white;
|
|
59
|
-
z-index:
|
|
61
|
+
z-index: 999;
|
|
60
62
|
|
|
61
63
|
> div {
|
|
62
64
|
margin-bottom: 6px;
|
package/es/constants/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
1
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
2
2
|
// Types
|
|
3
3
|
import { theme } from 'antd';
|
|
4
4
|
// Variables
|
|
@@ -167,6 +167,11 @@ THEME.components = {
|
|
|
167
167
|
titleFontSizeLG: 14,
|
|
168
168
|
titleFontSizeSM: 14,
|
|
169
169
|
horizontalMargin: '0px',
|
|
170
|
+
colorBorderSecondary: '#E5E5E5',
|
|
171
|
+
lineHeight: 1.17,
|
|
172
|
+
lineHeightLG: 1.17,
|
|
173
|
+
lineHeightSM: 1.17,
|
|
174
|
+
itemHoverColor: (_w = THEME.token) === null || _w === void 0 ? void 0 : _w.colorPrimary,
|
|
170
175
|
},
|
|
171
176
|
Collapse: {
|
|
172
177
|
headerBg: '#FFF',
|
|
@@ -174,22 +179,22 @@ THEME.components = {
|
|
|
174
179
|
headerPadding: '15px 10px',
|
|
175
180
|
},
|
|
176
181
|
Switch: {
|
|
177
|
-
colorTextQuaternary: (
|
|
178
|
-
colorTextTertiary: (
|
|
182
|
+
colorTextQuaternary: (_x = THEME.token) === null || _x === void 0 ? void 0 : _x.bw0,
|
|
183
|
+
colorTextTertiary: (_y = THEME.token) === null || _y === void 0 ? void 0 : _y.bw0,
|
|
179
184
|
handleSize: 12,
|
|
180
185
|
handleSizeSM: 7,
|
|
181
186
|
trackMinWidth: 30,
|
|
182
|
-
handleBg: (
|
|
187
|
+
handleBg: (_z = THEME.token) === null || _z === void 0 ? void 0 : _z.colorPrimary,
|
|
183
188
|
},
|
|
184
189
|
Popover: {
|
|
185
|
-
borderRadius: (
|
|
190
|
+
borderRadius: (_0 = THEME.token) === null || _0 === void 0 ? void 0 : _0.borderRadiusLG,
|
|
186
191
|
},
|
|
187
192
|
Dropdown: {
|
|
188
|
-
borderRadius: (
|
|
193
|
+
borderRadius: (_1 = THEME.token) === null || _1 === void 0 ? void 0 : _1.borderRadiusLG,
|
|
189
194
|
controlItemBgHover: '#F2F9FF',
|
|
190
195
|
},
|
|
191
196
|
Tooltip: {
|
|
192
|
-
colorBgSpotlight: (
|
|
197
|
+
colorBgSpotlight: (_2 = THEME.token) === null || _2 === void 0 ? void 0 : _2.bw8,
|
|
193
198
|
},
|
|
194
199
|
Menu: {
|
|
195
200
|
itemHoverBg: '#F2F9FF',
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PayloadInfo } from '../../..';
|
|
3
3
|
import { envType } from '@antscorp/antsomi-ui/es/types/config';
|
|
4
|
-
import { TAppConfigAction, TAppConfigState } from '../reducer';
|
|
5
4
|
export interface AppConfigProviderProps {
|
|
6
5
|
env?: envType;
|
|
7
6
|
auth?: Omit<PayloadInfo, 'url'>;
|
|
8
7
|
languageCode?: string;
|
|
9
|
-
state?: TAppConfigState;
|
|
10
|
-
dispatch?: React.Dispatch<TAppConfigAction>;
|
|
11
8
|
}
|
|
12
9
|
declare const AppConfigContext: import("use-context-selector").Context<AppConfigProviderProps>;
|
|
13
10
|
declare const AppConfigProvider: React.FC<React.PropsWithChildren<{
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
// Libraries
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { createContext } from 'use-context-selector';
|
|
4
|
-
import { reducer } from '../reducer';
|
|
5
4
|
const initialContext = {};
|
|
6
5
|
const AppConfigContext = createContext(initialContext);
|
|
7
6
|
const AppConfigProvider = props => {
|
|
8
7
|
const { value = initialContext, children } = props;
|
|
9
|
-
|
|
10
|
-
const appConfigValue = useMemo(() => (Object.assign(Object.assign({}, value), { state, dispatch })), [state, value]);
|
|
11
|
-
return React.createElement(AppConfigContext.Provider, { value: appConfigValue }, children);
|
|
8
|
+
return React.createElement(AppConfigContext.Provider, { value: value }, children);
|
|
12
9
|
};
|
|
13
10
|
export { AppConfigContext, AppConfigProvider };
|
|
@@ -11,7 +11,7 @@ import { fab } from '@fortawesome/free-brands-svg-icons';
|
|
|
11
11
|
library.add(fas, far, fab);
|
|
12
12
|
const { accent6, accent7, gray5, scrollBarSize } = THEME.token || {};
|
|
13
13
|
export const GlobalStyle = () => {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38;
|
|
15
15
|
return (React.createElement(Global, { styles: css `
|
|
16
16
|
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap');
|
|
17
17
|
|
|
@@ -849,6 +849,16 @@ export const GlobalStyle = () => {
|
|
|
849
849
|
.antsomi-tabs {
|
|
850
850
|
.antsomi-tabs-tab {
|
|
851
851
|
font-weight: bold;
|
|
852
|
+
|
|
853
|
+
&:not(.antsomi-tabs-tab-active):hover {
|
|
854
|
+
background-color: ${(_37 = THEME.token) === null || _37 === void 0 ? void 0 : _37.blue};
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
.antsomi-tabs-tab-active {
|
|
858
|
+
z-index: 2;
|
|
859
|
+
}
|
|
860
|
+
.antsomi-tabs-nav::before {
|
|
861
|
+
z-index: 1;
|
|
852
862
|
}
|
|
853
863
|
}
|
|
854
864
|
|
|
@@ -883,7 +893,7 @@ export const GlobalStyle = () => {
|
|
|
883
893
|
.antsomi-menu {
|
|
884
894
|
.antsomi-menu-submenu.antsomi-menu-submenu-selected {
|
|
885
895
|
.antsomi-menu-item.antsomi-menu-item-selected {
|
|
886
|
-
background-color: ${(
|
|
896
|
+
background-color: ${(_38 = THEME.token) === null || _38 === void 0 ? void 0 : _38.blue};
|
|
887
897
|
}
|
|
888
898
|
}
|
|
889
899
|
}
|
package/es/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './variables';
|
|
|
19
19
|
export * from './service';
|
|
20
20
|
export * from './templateListing';
|
|
21
21
|
export * from './share-access';
|
|
22
|
+
export * from './processingNotification';
|
|
22
23
|
export type PayloadInfo = {
|
|
23
24
|
url?: string;
|
|
24
25
|
userId?: string;
|
|
@@ -27,3 +28,6 @@ export type PayloadInfo = {
|
|
|
27
28
|
portalId?: number;
|
|
28
29
|
};
|
|
29
30
|
export type TServiceAuth = PayloadInfo;
|
|
31
|
+
export type DeepPartial<T> = {
|
|
32
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
33
|
+
};
|
package/es/types/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.199",
|
|
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
|
"dependencies": {
|
|
63
63
|
"@antscorp/icons": "^0.27.14",
|
|
64
64
|
"@antscorp/image-editor": "1.0.2",
|
|
65
|
-
"@antscorp/processing-notification": "^1.0.
|
|
65
|
+
"@antscorp/processing-notification": "^1.0.2",
|
|
66
66
|
"@emotion/react": "^11.11.1",
|
|
67
67
|
"@fortawesome/fontawesome-svg-core": "6.1.1",
|
|
68
68
|
"@fortawesome/free-brands-svg-icons": "6.1.1",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { HeaderV2Props } from '../../components';
|
|
2
|
-
export declare const APP_CONFIG_ACTION_TYPE: {
|
|
3
|
-
UPDATE_HEADER: string;
|
|
4
|
-
};
|
|
5
|
-
export type TAppConfigState = {
|
|
6
|
-
header?: Partial<HeaderV2Props>;
|
|
7
|
-
};
|
|
8
|
-
export type TAppConfigAction = {
|
|
9
|
-
type: string;
|
|
10
|
-
value: Partial<TAppConfigState>;
|
|
11
|
-
};
|
|
12
|
-
export declare const reducer: (state: TAppConfigState, action: TAppConfigAction) => TAppConfigState;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const APP_CONFIG_ACTION_TYPE = {
|
|
2
|
-
UPDATE_HEADER: 'update-header',
|
|
3
|
-
};
|
|
4
|
-
export const reducer = (state, action) => {
|
|
5
|
-
var _a;
|
|
6
|
-
switch (action.type) {
|
|
7
|
-
case APP_CONFIG_ACTION_TYPE.UPDATE_HEADER:
|
|
8
|
-
return Object.assign(Object.assign({}, state), { header: Object.assign(Object.assign({}, (state.header || {})), (((_a = action.value) === null || _a === void 0 ? void 0 : _a.header) || {})) });
|
|
9
|
-
default:
|
|
10
|
-
throw new Error(`unknown action type: ${action.type}`);
|
|
11
|
-
}
|
|
12
|
-
};
|