@giteeteam/apps-team-components 1.10.9 → 1.10.11
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/dist/components/fields/created-by/ReadView.d.ts +1 -1
- package/dist/components/fields/dropdown/BaseField.d.ts +1 -1
- package/dist/components/fields/reporter/ReadView.d.ts +1 -1
- package/dist/components/fields/updated-by/ReadView.d.ts +1 -1
- package/dist/lib/contexts/index.js +2 -2
- package/dist/lib/contexts/teamConfig.d.ts +1 -0
- package/dist/lib/contexts/teamConfig.js +2 -1
- package/dist/lib/fetch.js +11 -4
- package/dist/lib/useConfig.d.ts +1 -0
- package/dist/lib/useConfig.js +2 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { User as UserTyped } from '../../../lib/types/models';
|
|
2
2
|
declare const CreatedByReadView: import("react").MemoExoticComponent<({ value }: {
|
|
3
3
|
value: UserTyped;
|
|
4
|
-
}) => import("@emotion/react/
|
|
4
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
5
5
|
export default CreatedByReadView;
|
|
@@ -24,6 +24,6 @@ type GetFormattedLabelParams = {
|
|
|
24
24
|
background?: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
export declare const getFormattedLabel: ({ label, style }?: GetFormattedLabelParams) => import("@emotion/react/
|
|
27
|
+
export declare const getFormattedLabel: ({ label, style }?: GetFormattedLabelParams) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
28
28
|
declare const Dropdown: React.FC<BaseDropdownProps>;
|
|
29
29
|
export default Dropdown;
|
|
@@ -2,5 +2,5 @@ import { User as UserTyped } from '../../../lib/types/models';
|
|
|
2
2
|
declare const ReporterReadView: import("react").MemoExoticComponent<({ value, readonly }: {
|
|
3
3
|
value: UserTyped;
|
|
4
4
|
readonly?: boolean;
|
|
5
|
-
}) => import("@emotion/react/
|
|
5
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
6
6
|
export default ReporterReadView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { User as UserTyped } from '../../../lib/types/models';
|
|
2
2
|
declare const UpdatedByReadView: import("react").MemoExoticComponent<({ value }: {
|
|
3
3
|
value: UserTyped;
|
|
4
|
-
}) => import("@emotion/react/
|
|
4
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
5
5
|
export default UpdatedByReadView;
|
|
@@ -12,7 +12,7 @@ import { TeamConfigProvider } from './teamConfig.js';
|
|
|
12
12
|
import { TenantProvider } from './tenant.js';
|
|
13
13
|
import { WorkflowConfigProvider } from './workflowConfig.js';
|
|
14
14
|
|
|
15
|
-
const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, isMicroApp, publicRuntimeConfig, userConfig, workspaceKey, workflow, item, currentUser, emotionCacheOptions, children, }) => {
|
|
15
|
+
const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, isMicroApp, publicRuntimeConfig, userConfig, workspaceKey, workflow, item, currentUser, emotionCacheOptions, children, extraHeaders, }) => {
|
|
16
16
|
const emotionCache = useMemo(() => {
|
|
17
17
|
return createCache({
|
|
18
18
|
key: 'apps',
|
|
@@ -22,7 +22,7 @@ const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, te
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
i18n.setLocale(locale);
|
|
24
24
|
}, [locale]);
|
|
25
|
-
return (jsx(CacheProvider, { value: emotionCache, children: jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, isMicroApp: isMicroApp, publicRuntimeConfig: publicRuntimeConfig, userConfig: userConfig, 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 }) }) }) }) }) }) }) }) }));
|
|
25
|
+
return (jsx(CacheProvider, { value: emotionCache, children: jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, isMicroApp: isMicroApp, publicRuntimeConfig: publicRuntimeConfig, userConfig: userConfig, extraHeaders: extraHeaders, 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 }) }) }) }) }) }) }) }) }));
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export { LibraryProvider };
|
|
@@ -6,6 +6,7 @@ export interface ITeamConfigContext {
|
|
|
6
6
|
isMicroApp?: boolean;
|
|
7
7
|
publicRuntimeConfig?: Partial<IPublicRuntimeProps>;
|
|
8
8
|
userConfig?: Partial<IUserConfig>;
|
|
9
|
+
extraHeaders?: Record<string, string>;
|
|
9
10
|
}
|
|
10
11
|
export declare const TeamConfigContext: React.Context<ITeamConfigContext>;
|
|
11
12
|
export interface TeamConfigProviderProps extends React.PropsWithChildren, ITeamConfigContext {
|
|
@@ -4,7 +4,7 @@ import { getQiankunConfig, getPublicRuntimeConfig, getUserConfig } from '../conf
|
|
|
4
4
|
|
|
5
5
|
const defaultContext = {};
|
|
6
6
|
const TeamConfigContext = createContext(defaultContext);
|
|
7
|
-
const TeamConfigProvider = ({ teamGateway, teamBasePath, isMicroApp, children, publicRuntimeConfig, userConfig, }) => {
|
|
7
|
+
const TeamConfigProvider = ({ teamGateway, teamBasePath, isMicroApp, children, publicRuntimeConfig, userConfig, extraHeaders, }) => {
|
|
8
8
|
const runtimeConfig = useMemo(() => {
|
|
9
9
|
const config = { ...getQiankunConfig(), ...getPublicRuntimeConfig(), ...(publicRuntimeConfig || {}) };
|
|
10
10
|
if (teamGateway) {
|
|
@@ -23,6 +23,7 @@ const TeamConfigProvider = ({ teamGateway, teamBasePath, isMicroApp, children, p
|
|
|
23
23
|
isMicroApp,
|
|
24
24
|
publicRuntimeConfig: runtimeConfig,
|
|
25
25
|
userConfig: _userConfig,
|
|
26
|
+
extraHeaders,
|
|
26
27
|
}, children: children }));
|
|
27
28
|
};
|
|
28
29
|
|
package/dist/lib/fetch.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useContext, useMemo, useCallback, useEffect } from 'react';
|
|
|
2
2
|
import axios, { HttpStatusCode } from 'axios';
|
|
3
3
|
import cjson from 'compressed-json';
|
|
4
4
|
import debug from 'debug';
|
|
5
|
-
import { toNumber } from 'lodash-es';
|
|
5
|
+
import { toNumber, isEmpty } from 'lodash-es';
|
|
6
6
|
import { REDIRECT_URL_KEY, CANCEL_FETCH_STRING } from './global.js';
|
|
7
7
|
import throttleWithCache, { THROTTLE_TYPE } from './swr/throttleWithCache.js';
|
|
8
8
|
import { ParseErrorCode } from './constants/code.js';
|
|
@@ -42,6 +42,8 @@ const useGetServerGateway = () => {
|
|
|
42
42
|
return (publicRuntimeConfig === null || publicRuntimeConfig === void 0 ? void 0 : publicRuntimeConfig.gateway) || '';
|
|
43
43
|
};
|
|
44
44
|
const useGetGateway = (extraPath = '') => {
|
|
45
|
+
const { publicRuntimeConfig } = useContext(TeamConfigContext);
|
|
46
|
+
const { routePath } = publicRuntimeConfig;
|
|
45
47
|
const gateway = useGetServerGateway();
|
|
46
48
|
const result = useMemo(() => {
|
|
47
49
|
const inOne = isInOne(gateway);
|
|
@@ -49,8 +51,10 @@ const useGetGateway = (extraPath = '') => {
|
|
|
49
51
|
return inOne ? '' : extraPath;
|
|
50
52
|
if (inOne)
|
|
51
53
|
return gateway;
|
|
54
|
+
if (routePath)
|
|
55
|
+
return gateway;
|
|
52
56
|
return extraPath;
|
|
53
|
-
}, [extraPath, gateway]);
|
|
57
|
+
}, [extraPath, gateway, routePath]);
|
|
54
58
|
return result;
|
|
55
59
|
};
|
|
56
60
|
function useGetRequestConfig({ sessionToken, tenant, Cookie }) {
|
|
@@ -140,7 +144,7 @@ const useRedirectToLogin = () => {
|
|
|
140
144
|
return redirectToLogin;
|
|
141
145
|
};
|
|
142
146
|
const useRequestInterceptors = () => {
|
|
143
|
-
const { sessionToken, locale, appId } = useAppProps();
|
|
147
|
+
const { sessionToken, locale, appId, extraHeaders = {} } = useAppProps();
|
|
144
148
|
const requestInterceptors = useCallback(config => {
|
|
145
149
|
if (!config.ignoreParseHeaders) {
|
|
146
150
|
if (!config.headers)
|
|
@@ -168,9 +172,12 @@ const useRequestInterceptors = () => {
|
|
|
168
172
|
if (config.useJsonDecompress) {
|
|
169
173
|
config.headers['x-has-json-compression'] = 'true';
|
|
170
174
|
}
|
|
175
|
+
if (!isEmpty(extraHeaders)) {
|
|
176
|
+
config.headers = { ...config.headers, ...extraHeaders };
|
|
177
|
+
}
|
|
171
178
|
checkSessionToken(config);
|
|
172
179
|
return config;
|
|
173
|
-
}, [appId, locale, sessionToken]);
|
|
180
|
+
}, [appId, locale, sessionToken, extraHeaders]);
|
|
174
181
|
return requestInterceptors;
|
|
175
182
|
};
|
|
176
183
|
const useAddResponseInterceptors = (fetch) => {
|
package/dist/lib/useConfig.d.ts
CHANGED
package/dist/lib/useConfig.js
CHANGED
|
@@ -7,7 +7,7 @@ const LOCALE_KEY = 'lang';
|
|
|
7
7
|
const PROXIMA_TENANT_KEY = 'team_tenant';
|
|
8
8
|
const SESSION_KEY = 'sessionToken';
|
|
9
9
|
const useAppProps = () => {
|
|
10
|
-
const { userConfig = {}, publicRuntimeConfig = {} } = useContext(TeamConfigContext);
|
|
10
|
+
const { userConfig = {}, publicRuntimeConfig = {}, extraHeaders = {} } = useContext(TeamConfigContext);
|
|
11
11
|
const locale = useMemo(() => {
|
|
12
12
|
const userLocale = userConfig.locale;
|
|
13
13
|
const [defaultLang] = navigator.languages;
|
|
@@ -25,6 +25,7 @@ const useAppProps = () => {
|
|
|
25
25
|
locale,
|
|
26
26
|
sessionToken,
|
|
27
27
|
appId,
|
|
28
|
+
extraHeaders,
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giteeteam/apps-team-components",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.11",
|
|
4
4
|
"description": "Gitee team components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"public"
|
|
108
108
|
]
|
|
109
109
|
},
|
|
110
|
-
"packageManager": "pnpm@
|
|
110
|
+
"packageManager": "pnpm@10.15.1"
|
|
111
111
|
}
|