@giteeteam/apps-team-components 1.0.2-alpha.1 → 1.0.2-alpha.2
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,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Options as CacheOptions } from '@emotion/cache';
|
|
2
3
|
import { IAntdConfigContext } from './antdConfig';
|
|
3
4
|
import { ICurrentUserContext } from './currentUser';
|
|
4
5
|
import { ICurrentWorkspaceContext } from './currentWorkspace';
|
|
@@ -9,5 +10,6 @@ import { ITenantContext } from './tenant';
|
|
|
9
10
|
import { IWorkflowConfigContext } from './workflowConfig';
|
|
10
11
|
export interface LibraryProviderProps extends React.PropsWithChildren, IAntdConfigContext, ITeamConfigContext, ITenantContext, IDatetimeFormatContext, ICurrentWorkspaceContext, IWorkflowConfigContext, IItemConfigContext, ICurrentUserContext {
|
|
11
12
|
locale?: string;
|
|
13
|
+
emotionCacheOptions?: CacheOptions;
|
|
12
14
|
}
|
|
13
15
|
export declare const LibraryProvider: React.FC<LibraryProviderProps>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useEffect } from 'react';
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
|
+
import createCache from '@emotion/cache';
|
|
4
|
+
import { CacheProvider } from '@emotion/react';
|
|
3
5
|
import { i18n } from '../i18n';
|
|
4
6
|
import { AntdConfigProvider } from './antdConfig';
|
|
5
7
|
import { CurrentUserProvider } from './currentUser';
|
|
@@ -9,9 +11,15 @@ import { ItemConfigProvider } from './itemConfig';
|
|
|
9
11
|
import { TeamConfigProvider } from './teamConfig';
|
|
10
12
|
import { TenantProvider } from './tenant';
|
|
11
13
|
import { WorkflowConfigProvider } from './workflowConfig';
|
|
12
|
-
export const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, workspaceKey, workflow, item, currentUser, children, }) => {
|
|
14
|
+
export const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, workspaceKey, workflow, item, currentUser, emotionCacheOptions, children, }) => {
|
|
15
|
+
const emotionCache = useMemo(() => {
|
|
16
|
+
return createCache({
|
|
17
|
+
key: '',
|
|
18
|
+
...emotionCacheOptions,
|
|
19
|
+
});
|
|
20
|
+
}, [emotionCacheOptions]);
|
|
13
21
|
useEffect(() => {
|
|
14
22
|
i18n.setLocale(locale);
|
|
15
23
|
}, [locale]);
|
|
16
|
-
return (_jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: _jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, children: _jsx(TenantProvider, { tenant: tenant, children: _jsx(CurrentWorkspaceProvider, { workspaceKey: workspaceKey, children: _jsx(DatetimeFormatProvider, { datetimeFormat: datetimeFormat, children: _jsx(CurrentUserProvider, { currentUser: currentUser, children: _jsx(WorkflowConfigProvider, { workflow: workflow, children: _jsx(ItemConfigProvider, { item: item, children: children }) }) }) }) }) }) }) }));
|
|
24
|
+
return (_jsx(CacheProvider, { value: emotionCache, children: _jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: _jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, children: _jsx(TenantProvider, { tenant: tenant, children: _jsx(CurrentWorkspaceProvider, { workspaceKey: workspaceKey, children: _jsx(DatetimeFormatProvider, { datetimeFormat: datetimeFormat, children: _jsx(CurrentUserProvider, { currentUser: currentUser, children: _jsx(WorkflowConfigProvider, { workflow: workflow, children: _jsx(ItemConfigProvider, { item: item, children: children }) }) }) }) }) }) }) }) }));
|
|
17
25
|
};
|