@giteeteam/apps-team-components 1.3.0 → 1.3.2-alpha.1
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/README.md +0 -3
- package/dist/components/common/overflow-tooltip/BaseOverflowTooltip.js +1 -1
- package/dist/components/common/overflow-tooltip/OverflowTooltip.js +1 -1
- package/dist/components/common/overflow-tooltip/SimpleOverflowToolTip.js +3 -3
- package/dist/components/common/user-field/UserAvatar.js +2 -2
- package/dist/components/default-empty-icon/config.js +3 -2
- package/dist/components/fields/ancestor/utils.js +12 -1
- package/dist/components/fields/cascade/utils.js +2 -1
- package/dist/components/fields/dropdown/BaseField.js +4 -4
- package/dist/components/fields/dropdown/ReadView.js +1 -1
- package/dist/components/fields/dropdown/hook.js +1 -1
- package/dist/components/fields/item-type/ItemTypeIcon.js +5 -1
- package/dist/components/fields/status/Cell.js +2 -2
- package/dist/components/fields/status/ReadView.js +2 -2
- package/dist/components/fields/status/SelectFlowHandler.js +6 -6
- package/dist/components/fields/status/Transition.js +1 -1
- package/dist/components/fields/status/TransitionButton.js +2 -2
- package/dist/components/fields/status/TransitionPanel.js +1 -1
- package/dist/components/fields/status/View.js +1 -1
- package/dist/components/fields/status/style/index.js +27 -1
- package/dist/components/fields/user-group/ReadView.js +6 -2
- package/dist/components/filters/filter-search/utils.js +5 -2
- package/dist/components/table-components/EditTableCell.js +1 -1
- package/dist/icons/empty-icon/data-empty.png.js +3 -0
- package/dist/icons/empty-icon/forbidden.png.js +3 -0
- package/dist/icons/empty-icon/index.js +8 -0
- package/dist/icons/empty-icon/load-error.png.js +3 -0
- package/dist/icons/empty-icon/not-found.png.js +3 -0
- package/dist/icons/empty-icon/workspace-empty.svg.js +239 -0
- package/dist/icons/index.js +17 -17
- package/dist/icons/svg/ArrowBack.svg.js +16 -2
- package/dist/icons/svg/Done.svg.js +16 -2
- package/dist/icons/svg/DottedCircle.svg.js +14 -2
- package/dist/icons/svg/HollowCircle.svg.js +14 -2
- package/dist/icons/svg/Search.svg.js +16 -2
- package/dist/icons/svg/Workflow.svg.js +14 -2
- package/dist/lib/array.js +44 -2
- package/dist/lib/config.js +3 -3
- package/dist/lib/dataType.js +5 -1
- package/dist/lib/date.js +48 -3
- package/dist/lib/error/index.js +2 -0
- package/dist/lib/error/utils.js +17 -2
- package/dist/lib/fetch.js +41 -6
- package/dist/lib/icons/utils.js +3 -1
- package/dist/lib/path.js +1 -1
- package/dist/lib/storage.js +38 -1
- package/dist/lib/workflow.js +2 -0
- package/dist/style/common.js +16 -1
- package/package.json +2 -1
package/dist/lib/fetch.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { useMemo, useCallback,
|
|
1
|
+
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
5
|
import { toNumber } from 'lodash-es';
|
|
6
|
-
import {
|
|
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';
|
|
9
9
|
import { TeamConfigContext } from './contexts/teamConfig.js';
|
|
10
10
|
import { IGNORE_URL } from './error/withServerError.js';
|
|
11
|
-
import
|
|
12
|
-
import { getErrorMessage } from './error/utils.js';
|
|
11
|
+
import './error/index.js';
|
|
13
12
|
import { i18n } from './i18n.js';
|
|
14
13
|
import isInOne from './isInOne.js';
|
|
15
14
|
import { useGetSourcePath } from './path.js';
|
|
16
15
|
import { getCurLocationInfo } from './router.js';
|
|
17
16
|
import { removeParseItems } from './storage.js';
|
|
18
17
|
import { useAppProps } from './useConfig.js';
|
|
18
|
+
import ErrorLog from './error/log.js';
|
|
19
|
+
import { getErrorMessage } from './error/utils.js';
|
|
19
20
|
|
|
20
21
|
const Blob = window.Blob;
|
|
21
|
-
process.env.NODE_ENV === 'development';
|
|
22
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
22
23
|
const DEFAULT_TIMEOUT = 15 * 1000;
|
|
23
24
|
const useGetConfigTimeout = () => {
|
|
24
25
|
const { publicRuntimeConfig = {} } = useContext(TeamConfigContext);
|
|
@@ -26,6 +27,16 @@ const useGetConfigTimeout = () => {
|
|
|
26
27
|
return toNumber(globalFetchTimeout) || DEFAULT_TIMEOUT;
|
|
27
28
|
};
|
|
28
29
|
const baseApi = '/parse/api';
|
|
30
|
+
const useGetLoginBasePath = () => {
|
|
31
|
+
const { publicRuntimeConfig = {} } = useContext(TeamConfigContext);
|
|
32
|
+
const basePath = useMemo(() => {
|
|
33
|
+
const { basePath = '' } = publicRuntimeConfig;
|
|
34
|
+
if (isDev)
|
|
35
|
+
return basePath;
|
|
36
|
+
return '';
|
|
37
|
+
}, [publicRuntimeConfig]);
|
|
38
|
+
return basePath;
|
|
39
|
+
};
|
|
29
40
|
const useGetServerGateway = () => {
|
|
30
41
|
const { publicRuntimeConfig } = useContext(TeamConfigContext);
|
|
31
42
|
return (publicRuntimeConfig === null || publicRuntimeConfig === void 0 ? void 0 : publicRuntimeConfig.gateway) || '';
|
|
@@ -42,6 +53,22 @@ const useGetGateway = (extraPath = '') => {
|
|
|
42
53
|
}, [extraPath, gateway]);
|
|
43
54
|
return result;
|
|
44
55
|
};
|
|
56
|
+
function useGetRequestConfig({ sessionToken, tenant, Cookie }) {
|
|
57
|
+
const gateway = useGetServerGateway();
|
|
58
|
+
const baseURL = useMemo(() => {
|
|
59
|
+
return `${gateway}${baseApi}`;
|
|
60
|
+
}, [gateway]);
|
|
61
|
+
return {
|
|
62
|
+
baseURL,
|
|
63
|
+
headers: {
|
|
64
|
+
'X-Parse-Session-Token': sessionToken,
|
|
65
|
+
'X-Parse-Application-Id': tenant,
|
|
66
|
+
...(Cookie && {
|
|
67
|
+
Cookie,
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
45
72
|
const useAxiosConfig = () => {
|
|
46
73
|
const gateway = useGetGateway();
|
|
47
74
|
const baseURL = useMemo(() => {
|
|
@@ -56,6 +83,14 @@ const useAxiosConfig = () => {
|
|
|
56
83
|
const errorLog = msg => {
|
|
57
84
|
return ErrorLog.show(msg);
|
|
58
85
|
};
|
|
86
|
+
const LOCALE_KEY = 'lang';
|
|
87
|
+
const useGetHeaderLang = () => {
|
|
88
|
+
const { locale } = useAppProps();
|
|
89
|
+
return locale;
|
|
90
|
+
};
|
|
91
|
+
const getGlobalEnv = () => {
|
|
92
|
+
return window.env || {};
|
|
93
|
+
};
|
|
59
94
|
const checkLog = debug('lib:fetch:checkSessionToken');
|
|
60
95
|
const NO_SESSION_KEY = 'sessionToken is required';
|
|
61
96
|
const CHECK_WHITE_LIST = [
|
|
@@ -267,4 +302,4 @@ const useFetch = () => {
|
|
|
267
302
|
return fetch;
|
|
268
303
|
};
|
|
269
304
|
|
|
270
|
-
export { baseApi, useFetch as default, useAxiosConfig, useGetConfigTimeout, useGetGateway, useGetServerGateway };
|
|
305
|
+
export { LOCALE_KEY, baseApi, useFetch as default, getGlobalEnv, useAxiosConfig, useGetConfigTimeout, useGetGateway, useGetHeaderLang, useGetLoginBasePath, useGetRequestConfig, useGetServerGateway };
|
package/dist/lib/icons/utils.js
CHANGED
|
@@ -53,8 +53,10 @@ const usePolyFillIcon = (url, defaultIconFontType) => {
|
|
|
53
53
|
}, [defaultIconFontType, isIconFont, url]);
|
|
54
54
|
return data;
|
|
55
55
|
};
|
|
56
|
+
const SUFFIX = 'B';
|
|
57
|
+
const joinIconColorSuffix = (icon, colored) => (colored ? `${icon}${SUFFIX}` : icon);
|
|
56
58
|
const isBase64Img = (str) => {
|
|
57
59
|
return /^data:image\/(png|jpeg|jpg|gif|svg\+xml);base64,/.test(str);
|
|
58
60
|
};
|
|
59
61
|
|
|
60
|
-
export { isBase64Img, isServerUrl, polyfillItemTypeIconMap, takeIconFromUrl, useIsIconFont, usePolyFillIcon };
|
|
62
|
+
export { isBase64Img, isServerUrl, joinIconColorSuffix, polyfillItemTypeIconMap, takeIconFromUrl, useIsIconFont, usePolyFillIcon };
|
package/dist/lib/path.js
CHANGED
package/dist/lib/storage.js
CHANGED
|
@@ -8,6 +8,16 @@ const getLocalStorageItem = (key, defaults = '') => {
|
|
|
8
8
|
return item !== null && item !== void 0 ? item : defaults;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
const setLocalStorageItem = (key, value) => {
|
|
12
|
+
try {
|
|
13
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
console.error(e);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
11
21
|
const getStorageKeys = () => {
|
|
12
22
|
return Object.keys(localStorage);
|
|
13
23
|
};
|
|
@@ -23,5 +33,32 @@ const removeParseItems = () => {
|
|
|
23
33
|
console.error('removeParseItems', error);
|
|
24
34
|
}
|
|
25
35
|
};
|
|
36
|
+
var storage = {
|
|
37
|
+
getItem: getLocalStorageItem,
|
|
38
|
+
setItem: setLocalStorageItem,
|
|
39
|
+
removeParseItems,
|
|
40
|
+
};
|
|
41
|
+
const setLocalStorageState = (key, data) => {
|
|
42
|
+
localStorage.setItem(key, JSON.stringify({ time: new Date().getDate(), data }));
|
|
43
|
+
};
|
|
44
|
+
const getLocalStorageState = async (key, fn) => {
|
|
45
|
+
try {
|
|
46
|
+
const target = localStorage.getItem(key);
|
|
47
|
+
if (target) {
|
|
48
|
+
const targetFormat = JSON.parse(target);
|
|
49
|
+
if ((targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.time) === new Date().getDate()) {
|
|
50
|
+
if (typeof targetFormat.data !== 'string') {
|
|
51
|
+
return targetFormat.data;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
console.error(e);
|
|
58
|
+
}
|
|
59
|
+
const data = await fn();
|
|
60
|
+
setLocalStorageState(key, data);
|
|
61
|
+
return data;
|
|
62
|
+
};
|
|
26
63
|
|
|
27
|
-
export { getLocalStorageItem, removeParseItems };
|
|
64
|
+
export { storage as default, getLocalStorageItem, getLocalStorageState, removeParseItems, setLocalStorageItem };
|
package/dist/lib/workflow.js
CHANGED
package/dist/style/common.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
const gray1 = '#FFFFFF';
|
|
2
|
+
const gray2 = '#FAFBFB';
|
|
3
|
+
const gray3 = '#F5F6F8';
|
|
1
4
|
const gray4 = '#F1F2F4';
|
|
5
|
+
const gray5 = '#DADDE3';
|
|
2
6
|
const gray6 = '#C1C5CF';
|
|
3
7
|
const gray7 = '#848C9F';
|
|
8
|
+
const gray8 = '#525E79';
|
|
4
9
|
const gray9 = '#213053';
|
|
10
|
+
const gray10 = '#091940';
|
|
11
|
+
const blue1 = '#e6f3ff';
|
|
12
|
+
const blue2 = '#b0d6ff';
|
|
13
|
+
const blue3 = '#87bdff';
|
|
14
|
+
const blue4 = '#5ea1ff';
|
|
15
|
+
const blue5 = '#3683ff';
|
|
5
16
|
const blue6 = '#0c62ff';
|
|
17
|
+
const blue7 = '#0045d9';
|
|
18
|
+
const blue8 = '#0033b3';
|
|
19
|
+
const blue9 = '#00238c';
|
|
20
|
+
const blue10 = '#001666';
|
|
6
21
|
const statusCellMinWidth = '62px';
|
|
7
22
|
const fieldLabelColor = '#909aaa';
|
|
8
23
|
const themeBgColorBase = gray4;
|
|
@@ -16,4 +31,4 @@ const randomClassName = (name) => {
|
|
|
16
31
|
return `${name}_${result}`;
|
|
17
32
|
};
|
|
18
33
|
|
|
19
|
-
export { blue6, fieldLabelColor, gray4, gray6, gray7, gray9, randomClassName, statusCellMinWidth, themeBgColorBase };
|
|
34
|
+
export { blue1, blue10, blue2, blue3, blue4, blue5, blue6, blue7, blue8, blue9, fieldLabelColor, gray1, gray10, gray2, gray3, gray4, gray5, gray6, gray7, gray8, gray9, randomClassName, statusCellMinWidth, themeBgColorBase };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giteeteam/apps-team-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2-alpha.1",
|
|
4
4
|
"description": "Gitee team components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@storybook/react": "^8.2.8",
|
|
48
48
|
"@storybook/react-webpack5": "^8.2.8",
|
|
49
49
|
"@storybook/test": "^8.2.8",
|
|
50
|
+
"@svgr/rollup": "8.1.0",
|
|
50
51
|
"@svgr/webpack": "^8.1.0",
|
|
51
52
|
"@types/js-cookie": "^3.0.6",
|
|
52
53
|
"@types/node": "18",
|