@giteeteam/apps-team-components 1.3.0-alpha.1 → 1.3.0-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.
- package/dist/components/common/EmptyField.d.ts +0 -1
- package/dist/components/common/EmptyField.js +7 -5
- package/dist/components/common/PriceTag.js +11 -8
- package/dist/components/common/expand-component/index.d.ts +0 -1
- package/dist/components/common/expand-component/index.js +12 -10
- package/dist/components/common/expand-component/style.js +4 -2
- package/dist/components/common/item-icon/ItemIcon.d.ts +0 -1
- package/dist/components/common/item-icon/ItemIcon.js +6 -4
- package/dist/components/common/overflow-tooltip/BaseOverflowTooltip.d.ts +0 -1
- package/dist/components/common/overflow-tooltip/BaseOverflowTooltip.js +9 -6
- package/dist/components/common/overflow-tooltip/OverflowTooltip.js +9 -6
- package/dist/components/common/overflow-tooltip/SimpleOverflowToolTip.js +8 -5
- package/dist/components/common/overflow-tooltip/style/index.js +5 -3
- package/dist/components/common/style/global.js +3 -1
- package/dist/components/common/style/mixin.js +6 -3
- package/dist/components/common/user-field/UserAvatar.js +8 -6
- package/dist/components/common/user-field/style/index.js +5 -3
- package/dist/components/common/utils.js +13 -9
- package/dist/components/default-empty-icon/config.js +11 -6
- package/dist/components/default-empty-icon/index.js +10 -9
- package/dist/components/default-empty-icon/style.js +15 -12
- package/dist/components/default-empty-icon/types.js +3 -1
- package/dist/components/field-behavior/fields/type.js +5 -2
- package/dist/components/fields/actors/BaseField.js +5 -2
- package/dist/components/fields/actors/ReadView.d.ts +0 -1
- package/dist/components/fields/actors/ReadView.js +8 -6
- package/dist/components/fields/ancestor/ReadView.js +8 -6
- package/dist/components/fields/ancestor/utils.js +4 -12
- package/dist/components/fields/assignee/ReadView.d.ts +0 -1
- package/dist/components/fields/assignee/ReadView.js +13 -11
- package/dist/components/fields/base-component/utils.js +3 -1
- package/dist/components/fields/bind-workspace/ReadView.d.ts +0 -1
- package/dist/components/fields/bind-workspace/ReadView.js +11 -9
- package/dist/components/fields/bind-workspace/hooks.js +7 -4
- package/dist/components/fields/bind-workspace/style/index.js +3 -1
- package/dist/components/fields/cascade/ReadView.js +8 -6
- package/dist/components/fields/cascade/utils.js +4 -3
- package/dist/components/fields/checkbox/ReadView.d.ts +0 -1
- package/dist/components/fields/checkbox/ReadView.js +7 -5
- package/dist/components/fields/created-at/ReadView.js +10 -8
- package/dist/components/fields/created-by/ReadView.d.ts +0 -1
- package/dist/components/fields/created-by/ReadView.js +11 -9
- package/dist/components/fields/data-quote/ReadView.js +12 -10
- package/dist/components/fields/data-quote/utils.js +5 -3
- package/dist/components/fields/date/ReadView.d.ts +0 -1
- package/dist/components/fields/date/ReadView.js +8 -6
- package/dist/components/fields/dropdown/BaseField.js +42 -40
- package/dist/components/fields/dropdown/Cell.d.ts +0 -1
- package/dist/components/fields/dropdown/Cell.js +6 -4
- package/dist/components/fields/dropdown/ReadView.d.ts +0 -1
- package/dist/components/fields/dropdown/ReadView.js +10 -8
- package/dist/components/fields/dropdown/data.d.ts +1 -1
- package/dist/components/fields/dropdown/data.js +6 -3
- package/dist/components/fields/dropdown/hook.d.ts +0 -1
- package/dist/components/fields/dropdown/hook.js +11 -8
- package/dist/components/fields/dropdown/style.js +21 -18
- package/dist/components/fields/file/ReadView.d.ts +0 -1
- package/dist/components/fields/file/ReadView.js +7 -5
- package/dist/components/fields/formula/ReadView.d.ts +0 -1
- package/dist/components/fields/formula/ReadView.js +7 -5
- package/dist/components/fields/hooks/useViewClass.js +4 -2
- package/dist/components/fields/hyper-link/ReadView.d.ts +0 -1
- package/dist/components/fields/hyper-link/ReadView.js +8 -6
- package/dist/components/fields/hyper-link/style/index.js +7 -4
- package/dist/components/fields/item-group/ReadView.d.ts +0 -1
- package/dist/components/fields/item-group/ReadView.js +6 -4
- package/dist/components/fields/item-type/ItemTypeIcon.js +15 -17
- package/dist/components/fields/item-type/ReadView.d.ts +0 -1
- package/dist/components/fields/item-type/ReadView.js +7 -5
- package/dist/components/fields/item-type/style/index.js +3 -1
- package/dist/components/fields/key/ReadView.d.ts +0 -1
- package/dist/components/fields/key/ReadView.js +7 -5
- package/dist/components/fields/long-text/ReadView.d.ts +0 -1
- package/dist/components/fields/long-text/ReadView.js +8 -6
- package/dist/components/fields/long-text/style/index.js +3 -1
- package/dist/components/fields/number/BaseField.js +5 -2
- package/dist/components/fields/number/ReadView.d.ts +0 -1
- package/dist/components/fields/number/ReadView.js +8 -6
- package/dist/components/fields/priority/ReadView.js +12 -10
- package/dist/components/fields/priority/style/index.js +11 -8
- package/dist/components/fields/radio/ReadView.d.ts +0 -1
- package/dist/components/fields/radio/ReadView.js +8 -6
- package/dist/components/fields/repo-files/ReadView.js +8 -6
- package/dist/components/fields/repo-files/utils.js +5 -3
- package/dist/components/fields/reporter/ReadView.d.ts +0 -1
- package/dist/components/fields/reporter/ReadView.js +11 -9
- package/dist/components/fields/script/BaseField.js +4 -1
- package/dist/components/fields/script/ReadView.d.ts +0 -1
- package/dist/components/fields/script/ReadView.js +10 -8
- package/dist/components/fields/sprint/ReadView.js +7 -5
- package/dist/components/fields/status/Cell.js +8 -6
- package/dist/components/fields/status/Field.d.ts +0 -1
- package/dist/components/fields/status/ReadView.js +10 -8
- package/dist/components/fields/status/SelectFlowHandler.js +15 -12
- package/dist/components/fields/status/SelectTransition.js +13 -10
- package/dist/components/fields/status/Transition.js +18 -15
- package/dist/components/fields/status/TransitionButton.js +17 -14
- package/dist/components/fields/status/TransitionPanel.js +14 -11
- package/dist/components/fields/status/View.js +11 -8
- package/dist/components/fields/status/style/index.js +36 -59
- package/dist/components/fields/story-point/ReadView.d.ts +0 -1
- package/dist/components/fields/story-point/ReadView.js +6 -4
- package/dist/components/fields/tag/ReadView.js +10 -8
- package/dist/components/fields/tag/style/index.js +3 -1
- package/dist/components/fields/team/ReadView.js +10 -8
- package/dist/components/fields/team/style/index.js +4 -2
- package/dist/components/fields/text/BaseField.d.ts +0 -1
- package/dist/components/fields/text/ReadView.js +8 -6
- package/dist/components/fields/tree/ReadView.js +10 -8
- package/dist/components/fields/tree/utils.js +5 -3
- package/dist/components/fields/updated-at/ReadView.js +10 -8
- package/dist/components/fields/updated-by/ReadView.d.ts +0 -1
- package/dist/components/fields/updated-by/ReadView.js +11 -9
- package/dist/components/fields/user/ReadView.d.ts +0 -1
- package/dist/components/fields/user/ReadView.js +11 -9
- package/dist/components/fields/user/style/index.js +7 -4
- package/dist/components/fields/user-group/BaseField.d.ts +0 -1
- package/dist/components/fields/user-group/ReadView.js +11 -13
- package/dist/components/fields/version/ReadView.js +8 -6
- package/dist/components/fields/workspace/ReadView.d.ts +0 -1
- package/dist/components/fields/workspace/ReadView.js +10 -8
- package/dist/components/filters/filter-search/utils.js +6 -6
- package/dist/components/item/hooks.js +5 -2
- package/dist/components/table-components/EditTableCell.js +6 -3
- package/dist/components/table-components/index.js +14 -11
- package/dist/components/table-components/style/index.js +3 -1
- package/dist/components/table-components/utils.js +49 -46
- package/dist/icons/SyncIconFont.js +7 -5
- package/dist/icons/createFromIconFontClass.js +3 -1
- package/dist/icons/empty-icon/index.d.ts +8 -1
- package/dist/icons/empty-icon/large-item@2x.png.js +3 -0
- package/dist/icons/empty-icon/large-workspace@2x.png.js +3 -0
- package/dist/icons/empty-icon/small-default@2x.png.js +3 -0
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +37 -35
- package/dist/icons/style/index.js +4 -2
- package/dist/icons/svg/ArrowBack.svg.js +3 -0
- package/dist/icons/svg/Done.svg.js +3 -0
- package/dist/icons/svg/DottedCircle.svg.js +3 -0
- package/dist/icons/svg/HollowCircle.svg.js +3 -0
- package/dist/icons/svg/Search.svg.js +3 -0
- package/dist/icons/svg/Workflow.svg.js +3 -0
- package/dist/index.js +47 -47
- package/dist/lib/app/utils.d.ts +0 -1
- package/dist/lib/app/utils.js +4 -2
- package/dist/lib/array.js +5 -44
- package/dist/lib/config.js +8 -6
- package/dist/lib/constants/code.js +3 -1
- package/dist/lib/constants/field.js +5 -2
- package/dist/lib/contexts/antdConfig.js +10 -7
- package/dist/lib/contexts/currentUser.js +7 -4
- package/dist/lib/contexts/currentWorkspace.js +7 -4
- package/dist/lib/contexts/datetimeFormat.js +7 -4
- package/dist/lib/contexts/index.js +16 -13
- package/dist/lib/contexts/itemConfig.js +7 -4
- package/dist/lib/contexts/teamConfig.js +8 -5
- package/dist/lib/contexts/tenant.js +7 -4
- package/dist/lib/contexts/workflowConfig.js +7 -4
- package/dist/lib/dataType.js +4 -5
- package/dist/lib/date.js +11 -52
- package/dist/lib/dayjs.js +2 -1
- package/dist/lib/error/log.js +7 -4
- package/dist/lib/error/utils.d.ts +1 -1
- package/dist/lib/error/utils.js +8 -20
- package/dist/lib/error/withServerError.js +3 -1
- package/dist/lib/fetch.js +23 -54
- package/dist/lib/global.js +16 -14
- package/dist/lib/hooks/useAntdConfig.js +4 -2
- package/dist/lib/hooks/useCurrentUser.js +4 -2
- package/dist/lib/hooks/useCurrentWorkspace.js +4 -2
- package/dist/lib/hooks/useDataQuoteStore.js +8 -5
- package/dist/lib/hooks/useDateTimeFormatType.js +4 -2
- package/dist/lib/hooks/useI18n.d.ts +1 -1
- package/dist/lib/hooks/useI18n.js +4 -2
- package/dist/lib/hooks/useItemConfig.js +4 -2
- package/dist/lib/hooks/useTeamConfig.js +4 -2
- package/dist/lib/hooks/useTenant.js +4 -2
- package/dist/lib/hooks/useWorkflowConfig.js +4 -2
- package/dist/lib/i18n.js +6 -3
- package/dist/lib/icons/utils.js +10 -9
- package/dist/lib/isInOne.js +2 -1
- package/dist/lib/number.js +3 -1
- package/dist/lib/path.d.ts +2 -2
- package/dist/lib/path.js +9 -6
- package/dist/lib/regExp.js +3 -1
- package/dist/lib/router.js +4 -1
- package/dist/lib/storage.js +4 -39
- package/dist/lib/store/dataQuoteStore.js +5 -2
- package/dist/lib/swr/constants.js +4 -2
- package/dist/lib/swr/hooks.js +6 -3
- package/dist/lib/swr/throttleWithCache.js +7 -5
- package/dist/lib/throttleFetch.js +4 -2
- package/dist/lib/useConfig.js +9 -6
- package/dist/lib/useUser.js +9 -6
- package/dist/lib/users.js +5 -2
- package/dist/lib/workflow.js +21 -20
- package/dist/locales/index.js +5 -3
- package/dist/style/common.js +11 -24
- package/dist/style/global.js +3 -1
- package/package.json +8 -2
- package/dist/components/fields/base-component/types.js +0 -1
- package/dist/components/fields/hooks/useParamsAdapter.js +0 -1
- package/dist/components/fields/radio/BaseField.js +0 -1
- package/dist/components/fields/status/Field.js +0 -1
- package/dist/components/fields/tag/BaseField.js +0 -1
- package/dist/components/fields/text/BaseField.js +0 -1
- package/dist/components/fields/tree/BaseField.js +0 -1
- package/dist/components/fields/tree/types.js +0 -1
- package/dist/components/fields/types.js +0 -1
- package/dist/components/fields/user-group/ActionCell.js +0 -1
- package/dist/components/fields/user-group/BaseField.js +0 -1
- package/dist/icons/empty-icon/index.js +0 -8
- package/dist/icons/svg/ArrowBack.svg +0 -1
- package/dist/icons/svg/Done.svg +0 -1
- package/dist/icons/svg/DottedCircle.svg +0 -7
- package/dist/icons/svg/HollowCircle.svg +0 -6
- package/dist/icons/svg/Search.svg +0 -1
- package/dist/icons/svg/Workflow.svg +0 -12
- package/dist/lib/error/index.js +0 -2
package/dist/lib/dataType.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { isNil } from 'lodash-es';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return isNaN(number) ? defaultNum : number;
|
|
5
|
-
};
|
|
6
|
-
export const toBoolean = (flag, defaultFlag = true) => {
|
|
2
|
+
|
|
3
|
+
const toBoolean = (flag, defaultFlag = true) => {
|
|
7
4
|
if (isNil(flag))
|
|
8
5
|
return defaultFlag;
|
|
9
6
|
if (flag === 'true')
|
|
@@ -14,3 +11,5 @@ export const toBoolean = (flag, defaultFlag = true) => {
|
|
|
14
11
|
return flag;
|
|
15
12
|
return defaultFlag;
|
|
16
13
|
};
|
|
14
|
+
|
|
15
|
+
export { toBoolean };
|
package/dist/lib/date.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { DATE_FORMAT, DATE_TYPE
|
|
4
|
-
import { i18n } from './i18n';
|
|
5
|
-
|
|
1
|
+
import 'lodash-es';
|
|
2
|
+
import './dayjs.js';
|
|
3
|
+
import { DATE_FORMAT, DATE_TYPE } from './global.js';
|
|
4
|
+
import { i18n } from './i18n.js';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
|
|
7
|
+
const getDateType = (pickerType) => {
|
|
6
8
|
switch (pickerType) {
|
|
7
9
|
case DATE_TYPE.DATETIME:
|
|
8
10
|
return DATE_FORMAT.DATETIME;
|
|
@@ -17,35 +19,10 @@ export const getDateType = (pickerType) => {
|
|
|
17
19
|
return DATE_FORMAT.DATE;
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
|
-
|
|
21
|
-
export const getStartOfDayUnix = (date) => {
|
|
22
|
-
return dayjs(date).startOf('day').valueOf();
|
|
23
|
-
};
|
|
24
|
-
export const getStartOfDayToDate = (date) => {
|
|
25
|
-
return dayjs(date).startOf('day').toDate();
|
|
26
|
-
};
|
|
27
|
-
export const getEndOfDayUnix = (date) => {
|
|
28
|
-
return dayjs(date).endOf('day').valueOf();
|
|
29
|
-
};
|
|
30
|
-
export const getEndOfDayToDate = (date) => {
|
|
31
|
-
return dayjs(date).endOf('day').toDate();
|
|
32
|
-
};
|
|
33
|
-
export const getStartOfWeekUnix = (date) => {
|
|
34
|
-
return dayjs(date).startOf('week').valueOf();
|
|
35
|
-
};
|
|
36
|
-
export const getEndOfWeekUnix = (date) => {
|
|
37
|
-
return dayjs(date).endOf('week').valueOf();
|
|
38
|
-
};
|
|
39
|
-
export const getStartOfMonthUnix = (date) => {
|
|
40
|
-
return dayjs(date).startOf('month').valueOf();
|
|
41
|
-
};
|
|
42
|
-
export const getEndOfMonthUnix = (date) => {
|
|
43
|
-
return dayjs(date).endOf('month').valueOf();
|
|
44
|
-
};
|
|
45
|
-
export const getFormat = (date, format) => {
|
|
22
|
+
const getFormat = (date, format) => {
|
|
46
23
|
return dayjs(date).format(format);
|
|
47
24
|
};
|
|
48
|
-
|
|
25
|
+
var DateTypeEnum;
|
|
49
26
|
(function (DateTypeEnum) {
|
|
50
27
|
DateTypeEnum["dateTime"] = "second";
|
|
51
28
|
DateTypeEnum["date"] = "date";
|
|
@@ -53,23 +30,5 @@ export var DateTypeEnum;
|
|
|
53
30
|
DateTypeEnum["month"] = "month";
|
|
54
31
|
DateTypeEnum["year"] = "year";
|
|
55
32
|
})(DateTypeEnum || (DateTypeEnum = {}));
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
export const dateToMillisecond = (date, days) => {
|
|
60
|
-
return getStartOfDayUnix(date.subtract(days, 'day'));
|
|
61
|
-
};
|
|
62
|
-
export const countDuration = (stoppedAt, startedAt) => {
|
|
63
|
-
const duration = dayjs(stoppedAt).diff(startedAt, 'ms');
|
|
64
|
-
return isNumber(duration) ? duration / 1000 : 0;
|
|
65
|
-
};
|
|
66
|
-
export const getMonthEndDate = (time, format = '-') => {
|
|
67
|
-
var _a;
|
|
68
|
-
const [year, month, date] = time.split(format);
|
|
69
|
-
const endMonthDate = (_a = new Date(+year, +month, 0)) === null || _a === void 0 ? void 0 : _a.getDate();
|
|
70
|
-
if (isNaN(endMonthDate)) {
|
|
71
|
-
throw new TypeError(i18n.t('date.invalidate'));
|
|
72
|
-
}
|
|
73
|
-
const isEqualMonth = +date <= endMonthDate;
|
|
74
|
-
return [endMonthDate, isEqualMonth];
|
|
75
|
-
};
|
|
33
|
+
|
|
34
|
+
export { DateTypeEnum, getDateType, getFormat };
|
package/dist/lib/dayjs.js
CHANGED
package/dist/lib/error/log.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { message } from 'antd';
|
|
2
2
|
import debug from 'debug';
|
|
3
3
|
import { throttle } from 'lodash-es';
|
|
4
|
-
import { isChinese } from 'components/common/utils';
|
|
5
|
-
import {
|
|
4
|
+
import { isChinese } from '../../components/common/utils.js';
|
|
5
|
+
import { nsSeparator, i18n } from '../i18n.js';
|
|
6
|
+
|
|
6
7
|
const logger = debug('lib:error');
|
|
7
|
-
|
|
8
|
+
class ErrorLog {
|
|
8
9
|
constructor(options) {
|
|
9
10
|
this.show = (msg) => {
|
|
10
11
|
logger('errorMessage', msg);
|
|
@@ -22,4 +23,6 @@ export class ErrorLog {
|
|
|
22
23
|
}, timeout, { trailing: false });
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
var ErrorLog$1 = new ErrorLog();
|
|
27
|
+
|
|
28
|
+
export { ErrorLog, ErrorLog$1 as default };
|
|
@@ -5,7 +5,7 @@ export type ErrorResponse = any;
|
|
|
5
5
|
type GetErrorMessageHandler = (errorData: ErrorData, defaultMessage?: string) => string;
|
|
6
6
|
export declare const getRedirectURI: (errorPageURL: string | URL, baseAPI?: string) => string;
|
|
7
7
|
export declare const getRedirectURL: (redirectConfig: {
|
|
8
|
-
enabled:
|
|
8
|
+
enabled: "true" | "false" | undefined;
|
|
9
9
|
}, errorPageURL: string | URL) => string;
|
|
10
10
|
export declare const getKeycloakErrorMsg: GetErrorMessageHandler;
|
|
11
11
|
export declare const getParseErrorMsg: GetErrorMessageHandler;
|
package/dist/lib/error/utils.js
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const getRedirectURI = (errorPageURL, baseAPI = LOGIN_PAGE_URL) => {
|
|
5
|
-
const redirectApi = new URL(baseAPI, errorPageURL);
|
|
6
|
-
redirectApi.searchParams.append('redirect_uri', errorPageURL);
|
|
7
|
-
return encodeURIComponent(redirectApi.toString());
|
|
8
|
-
};
|
|
9
|
-
export const getRedirectURL = (redirectConfig, errorPageURL) => {
|
|
10
|
-
if (isEmpty(redirectConfig))
|
|
11
|
-
return LOGIN_PAGE_URL;
|
|
12
|
-
if ((redirectConfig === null || redirectConfig === void 0 ? void 0 : redirectConfig.enabled) !== 'true')
|
|
13
|
-
return LOGIN_PAGE_URL;
|
|
14
|
-
const redirectUri = getRedirectURI(errorPageURL);
|
|
15
|
-
return redirectUri;
|
|
16
|
-
};
|
|
17
|
-
export const getKeycloakErrorMsg = errorData => {
|
|
1
|
+
import 'lodash-es';
|
|
2
|
+
|
|
3
|
+
const getKeycloakErrorMsg = errorData => {
|
|
18
4
|
if (!(errorData === null || errorData === void 0 ? void 0 : errorData.error_description) || !(errorData === null || errorData === void 0 ? void 0 : errorData.error))
|
|
19
5
|
return null;
|
|
20
6
|
return `${errorData.error}: ${errorData.error_description}`;
|
|
21
7
|
};
|
|
22
|
-
|
|
8
|
+
const getParseErrorMsg = errorData => {
|
|
23
9
|
if (!(errorData === null || errorData === void 0 ? void 0 : errorData.code) || !(errorData === null || errorData === void 0 ? void 0 : errorData.error))
|
|
24
10
|
return null;
|
|
25
11
|
if ('string' === typeof errorData.error) {
|
|
@@ -38,8 +24,8 @@ export const getParseErrorMsg = errorData => {
|
|
|
38
24
|
return null;
|
|
39
25
|
}
|
|
40
26
|
};
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
const getNormalErrorMsg = errorData => 'string' === typeof errorData ? errorData : null;
|
|
28
|
+
const getErrorMessage = (errorData, defaultMsg = '请求失败.') => {
|
|
43
29
|
const errorMessage = getNormalErrorMsg(errorData) ||
|
|
44
30
|
(errorData === null || errorData === void 0 ? void 0 : errorData.message) ||
|
|
45
31
|
(errorData === null || errorData === void 0 ? void 0 : errorData.error) ||
|
|
@@ -48,3 +34,5 @@ export const getErrorMessage = (errorData, defaultMsg = '请求失败.') => {
|
|
|
48
34
|
defaultMsg;
|
|
49
35
|
return errorMessage;
|
|
50
36
|
};
|
|
37
|
+
|
|
38
|
+
export { getErrorMessage, getKeycloakErrorMsg, getNormalErrorMsg, getParseErrorMsg };
|
package/dist/lib/fetch.js
CHANGED
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
import { useCallback, useContext, useEffect
|
|
1
|
+
import { useMemo, useCallback, useContext, 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 { CANCEL_FETCH_STRING, REDIRECT_URL_KEY } from '
|
|
7
|
-
import throttleWithCache, { THROTTLE_TYPE } from '
|
|
8
|
-
import { ParseErrorCode } from './constants/code';
|
|
9
|
-
import { TeamConfigContext } from './contexts/teamConfig';
|
|
10
|
-
import { IGNORE_URL } from './error/withServerError';
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
6
|
+
import { CANCEL_FETCH_STRING, REDIRECT_URL_KEY } from './global.js';
|
|
7
|
+
import throttleWithCache, { THROTTLE_TYPE } from './swr/throttleWithCache.js';
|
|
8
|
+
import { ParseErrorCode } from './constants/code.js';
|
|
9
|
+
import { TeamConfigContext } from './contexts/teamConfig.js';
|
|
10
|
+
import { IGNORE_URL } from './error/withServerError.js';
|
|
11
|
+
import ErrorLog from './error/log.js';
|
|
12
|
+
import { getErrorMessage } from './error/utils.js';
|
|
13
|
+
import { i18n } from './i18n.js';
|
|
14
|
+
import isInOne from './isInOne.js';
|
|
15
|
+
import { useGetSourcePath } from './path.js';
|
|
16
|
+
import { getCurLocationInfo } from './router.js';
|
|
17
|
+
import { removeParseItems } from './storage.js';
|
|
18
|
+
import { useAppProps } from './useConfig.js';
|
|
19
|
+
|
|
18
20
|
const Blob = window.Blob;
|
|
19
|
-
|
|
21
|
+
process.env.NODE_ENV === 'development';
|
|
20
22
|
const DEFAULT_TIMEOUT = 15 * 1000;
|
|
21
|
-
|
|
23
|
+
const useGetConfigTimeout = () => {
|
|
22
24
|
const { publicRuntimeConfig = {} } = useContext(TeamConfigContext);
|
|
23
25
|
const { globalFetchTimeout } = publicRuntimeConfig;
|
|
24
26
|
return toNumber(globalFetchTimeout) || DEFAULT_TIMEOUT;
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const { publicRuntimeConfig = {} } = useContext(TeamConfigContext);
|
|
29
|
-
const basePath = useMemo(() => {
|
|
30
|
-
const { basePath = '' } = publicRuntimeConfig;
|
|
31
|
-
if (isDev)
|
|
32
|
-
return basePath;
|
|
33
|
-
return '';
|
|
34
|
-
}, [publicRuntimeConfig]);
|
|
35
|
-
return basePath;
|
|
36
|
-
};
|
|
37
|
-
export const useGetServerGateway = () => {
|
|
28
|
+
const baseApi = '/parse/api';
|
|
29
|
+
const useGetServerGateway = () => {
|
|
38
30
|
const { publicRuntimeConfig } = useContext(TeamConfigContext);
|
|
39
31
|
return (publicRuntimeConfig === null || publicRuntimeConfig === void 0 ? void 0 : publicRuntimeConfig.gateway) || '';
|
|
40
32
|
};
|
|
41
|
-
|
|
33
|
+
const useGetGateway = (extraPath = '') => {
|
|
42
34
|
const gateway = useGetServerGateway();
|
|
43
35
|
const result = useMemo(() => {
|
|
44
36
|
const inOne = isInOne(gateway);
|
|
@@ -50,23 +42,7 @@ export const useGetGateway = (extraPath = '') => {
|
|
|
50
42
|
}, [extraPath, gateway]);
|
|
51
43
|
return result;
|
|
52
44
|
};
|
|
53
|
-
|
|
54
|
-
const gateway = useGetServerGateway();
|
|
55
|
-
const baseURL = useMemo(() => {
|
|
56
|
-
return `${gateway}${baseApi}`;
|
|
57
|
-
}, [gateway]);
|
|
58
|
-
return {
|
|
59
|
-
baseURL,
|
|
60
|
-
headers: {
|
|
61
|
-
'X-Parse-Session-Token': sessionToken,
|
|
62
|
-
'X-Parse-Application-Id': tenant,
|
|
63
|
-
...(Cookie && {
|
|
64
|
-
Cookie,
|
|
65
|
-
}),
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
export const useAxiosConfig = () => {
|
|
45
|
+
const useAxiosConfig = () => {
|
|
70
46
|
const gateway = useGetGateway();
|
|
71
47
|
const baseURL = useMemo(() => {
|
|
72
48
|
return `${gateway}${baseApi}`;
|
|
@@ -80,14 +56,6 @@ export const useAxiosConfig = () => {
|
|
|
80
56
|
const errorLog = msg => {
|
|
81
57
|
return ErrorLog.show(msg);
|
|
82
58
|
};
|
|
83
|
-
export const LOCALE_KEY = 'lang';
|
|
84
|
-
export const useGetHeaderLang = () => {
|
|
85
|
-
const { locale } = useAppProps();
|
|
86
|
-
return locale;
|
|
87
|
-
};
|
|
88
|
-
export const getGlobalEnv = () => {
|
|
89
|
-
return window.env || {};
|
|
90
|
-
};
|
|
91
59
|
const checkLog = debug('lib:fetch:checkSessionToken');
|
|
92
60
|
const NO_SESSION_KEY = 'sessionToken is required';
|
|
93
61
|
const CHECK_WHITE_LIST = [
|
|
@@ -298,4 +266,5 @@ const useFetch = () => {
|
|
|
298
266
|
useAddResponseInterceptors(fetch);
|
|
299
267
|
return fetch;
|
|
300
268
|
};
|
|
301
|
-
|
|
269
|
+
|
|
270
|
+
export { baseApi, useFetch as default, useAxiosConfig, useGetConfigTimeout, useGetGateway, useGetServerGateway };
|
package/dist/lib/global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const FIELD_TYPE_KEY_MAPPINGS = {
|
|
2
2
|
Text: 'Text',
|
|
3
3
|
User: 'User',
|
|
4
4
|
LongText: 'LongText',
|
|
@@ -58,34 +58,34 @@ export const FIELD_TYPE_KEY_MAPPINGS = {
|
|
|
58
58
|
Cascade: 'Cascade',
|
|
59
59
|
RepoFiles: 'RepoFiles',
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
const DATE_TYPE = {
|
|
62
62
|
DATETIME: 'dateTime',
|
|
63
63
|
DATE: 'date',
|
|
64
64
|
WEEK: 'week',
|
|
65
65
|
MONTH: 'month',
|
|
66
66
|
YEAR: 'year',
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
const DATE_FORMAT = {
|
|
69
69
|
DATETIME: 'YYYY-MM-DD HH:mm:ss',
|
|
70
70
|
DATE: 'YYYY-MM-DD',
|
|
71
71
|
WEEK: 'YYYY 第W周',
|
|
72
72
|
MONTH: 'YYYY-MM',
|
|
73
73
|
YEAR: 'YYYY',
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
76
|
+
const DATE_TIME_FORMAT_SEC = 'YYYY-MM-DD HH:mm:ss';
|
|
77
|
+
var WorkflowStatusType;
|
|
78
78
|
(function (WorkflowStatusType) {
|
|
79
79
|
WorkflowStatusType["Start"] = "Start";
|
|
80
80
|
WorkflowStatusType["InProgress"] = "InProgress";
|
|
81
81
|
WorkflowStatusType["Finished"] = "Finished";
|
|
82
82
|
})(WorkflowStatusType || (WorkflowStatusType = {}));
|
|
83
|
-
|
|
83
|
+
const WorkFlowStatusColor = {
|
|
84
84
|
[WorkflowStatusType.Start]: { color: '#0C62FF', bgColor: '#E6F3FF' },
|
|
85
85
|
[WorkflowStatusType.InProgress]: { color: '#FFAA0C', bgColor: '#FEF5D0' },
|
|
86
86
|
[WorkflowStatusType.Finished]: { color: '#09B866', bgColor: '#DFF7E8' },
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
const CustomFieldComponentTypes = {
|
|
89
89
|
Date: 'Date',
|
|
90
90
|
Dropdown: 'Dropdown',
|
|
91
91
|
User: 'User',
|
|
@@ -98,9 +98,9 @@ export const CustomFieldComponentTypes = {
|
|
|
98
98
|
Radio: 'Radio',
|
|
99
99
|
Checkbox: 'Checkbox',
|
|
100
100
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
const BASE_FIELD_WIDTH = 104;
|
|
102
|
+
const CURRENT_WORKSPACE = 'currentWorkspace()';
|
|
103
|
+
const FIELD_CONTAINERS_PAGE = {
|
|
104
104
|
DETAIL: 'detail',
|
|
105
105
|
MODAL: 'modal',
|
|
106
106
|
DRAWER: 'drawer',
|
|
@@ -109,10 +109,12 @@ export const FIELD_CONTAINERS_PAGE = {
|
|
|
109
109
|
AUTOMATION_FIELD: 'automation_field',
|
|
110
110
|
VIEW_MODAL: 'view_modal',
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
const SCREEN_TYPE = {
|
|
113
113
|
View: 'view',
|
|
114
114
|
Create: 'create',
|
|
115
115
|
Edit: 'edit',
|
|
116
116
|
};
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
const CANCEL_FETCH_STRING = 'cancel_fetch_string';
|
|
118
|
+
const REDIRECT_URL_KEY = 'team_redirect_url';
|
|
119
|
+
|
|
120
|
+
export { BASE_FIELD_WIDTH, CANCEL_FETCH_STRING, CURRENT_WORKSPACE, CustomFieldComponentTypes, DATE_FORMAT, DATE_TIME_FORMAT, DATE_TIME_FORMAT_SEC, DATE_TYPE, FIELD_CONTAINERS_PAGE, FIELD_TYPE_KEY_MAPPINGS, REDIRECT_URL_KEY, SCREEN_TYPE, WorkFlowStatusColor, WorkflowStatusType };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { AntdConfigContext } from '
|
|
2
|
+
import { AntdConfigContext } from '../contexts/antdConfig.js';
|
|
3
|
+
|
|
3
4
|
const useAntdConfig = () => {
|
|
4
5
|
const antdConfig = useContext(AntdConfigContext);
|
|
5
6
|
return antdConfig;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useAntdConfig as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { CurrentUserContext } from '
|
|
2
|
+
import { CurrentUserContext } from '../contexts/currentUser.js';
|
|
3
|
+
|
|
3
4
|
const useCurrentUser = () => {
|
|
4
5
|
const { currentUser } = useContext(CurrentUserContext);
|
|
5
6
|
return currentUser;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useCurrentUser as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { CurrentWorkspaceContext } from '
|
|
2
|
+
import { CurrentWorkspaceContext } from '../contexts/currentWorkspace.js';
|
|
3
|
+
|
|
3
4
|
const useCurrentWorkspace = () => {
|
|
4
5
|
const currentWorkspace = useContext(CurrentWorkspaceContext);
|
|
5
6
|
return currentWorkspace;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useCurrentWorkspace as default };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useMemo, useEffect } from 'react';
|
|
2
|
+
import { isEmpty, clone } from 'lodash-es';
|
|
3
3
|
import { useRecoilState } from 'recoil';
|
|
4
|
-
import { REG_EN_NUMBER } from '../regExp';
|
|
5
|
-
import {
|
|
4
|
+
import { REG_EN_NUMBER } from '../regExp.js';
|
|
5
|
+
import { dataQuoteState, currentDeleteState } from '../store/dataQuoteStore.js';
|
|
6
|
+
|
|
6
7
|
const OBJECT_ID_LENGTH = 10;
|
|
7
|
-
|
|
8
|
+
const useDataQuoteStore = (dataSources, getOptionsByValues) => {
|
|
8
9
|
const [dataQuoteList, setDataQuoteList] = useRecoilState(dataQuoteState);
|
|
9
10
|
const [currentDeleteItem, setCurrentDeleteItem] = useRecoilState(currentDeleteState);
|
|
10
11
|
const dataSourcesDep = useMemo(() => {
|
|
@@ -64,3 +65,5 @@ export const useDataQuoteStore = (dataSources, getOptionsByValues) => {
|
|
|
64
65
|
setCurrentDeleteItem('');
|
|
65
66
|
}, [currentDeleteItem, setDataQuoteList, dataQuoteList, dataSourcesDep, setCurrentDeleteItem]);
|
|
66
67
|
};
|
|
68
|
+
|
|
69
|
+
export { useDataQuoteStore };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'react';
|
|
2
|
-
import { DatetimeFormatContext } from '
|
|
2
|
+
import { DatetimeFormatContext } from '../contexts/datetimeFormat.js';
|
|
3
|
+
|
|
3
4
|
const useDateTimeFormatType = () => {
|
|
4
5
|
const { datetimeFormat } = useContext(DatetimeFormatContext);
|
|
5
6
|
return useMemo(() => datetimeFormat, [datetimeFormat]);
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useDateTimeFormatType as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { ItemConfigContext } from '
|
|
2
|
+
import { ItemConfigContext } from '../contexts/itemConfig.js';
|
|
3
|
+
|
|
3
4
|
const useItemConfig = () => {
|
|
4
5
|
const { item } = useContext(ItemConfigContext);
|
|
5
6
|
return item;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useItemConfig as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { TeamConfigContext } from '
|
|
2
|
+
import { TeamConfigContext } from '../contexts/teamConfig.js';
|
|
3
|
+
|
|
3
4
|
const useTeamConfig = () => {
|
|
4
5
|
const teamConfig = useContext(TeamConfigContext);
|
|
5
6
|
return teamConfig;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useTeamConfig as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { TenantContext } from '
|
|
2
|
+
import { TenantContext } from '../contexts/tenant.js';
|
|
3
|
+
|
|
3
4
|
const useTenant = () => {
|
|
4
5
|
const { tenant } = useContext(TenantContext);
|
|
5
6
|
return tenant;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useTenant as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { WorkflowConfigContext } from '
|
|
2
|
+
import { WorkflowConfigContext } from '../contexts/workflowConfig.js';
|
|
3
|
+
|
|
3
4
|
const useWorkflowConfig = () => {
|
|
4
5
|
const { workflow } = useContext(WorkflowConfigContext);
|
|
5
6
|
return workflow;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
export { useWorkflowConfig as default };
|
package/dist/lib/i18n.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { zh, ru, en } from '../locales/index.js';
|
|
2
|
+
|
|
2
3
|
let locale = 'zh';
|
|
3
4
|
const getTranslate = () => {
|
|
4
5
|
switch (locale) {
|
|
@@ -15,7 +16,7 @@ const getTranslate = () => {
|
|
|
15
16
|
return zh;
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
+
const i18n = {
|
|
19
20
|
t: (key, opts) => {
|
|
20
21
|
var _a;
|
|
21
22
|
const translate = getTranslate();
|
|
@@ -32,4 +33,6 @@ export const i18n = {
|
|
|
32
33
|
locale = _locale;
|
|
33
34
|
},
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
const nsSeparator = '@';
|
|
37
|
+
|
|
38
|
+
export { i18n, nsSeparator };
|
package/dist/lib/icons/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useGetBasePath } from '
|
|
3
|
-
|
|
2
|
+
import { useGetBasePath } from '../path.js';
|
|
3
|
+
|
|
4
|
+
const polyfillItemTypeIconMap = {
|
|
4
5
|
BookMark: 'Issue_Story',
|
|
5
6
|
Book: 'Issue_Demand',
|
|
6
7
|
Flask: 'Issue_Test',
|
|
@@ -17,20 +18,20 @@ export const polyfillItemTypeIconMap = {
|
|
|
17
18
|
Risk: 'Issue_Risk',
|
|
18
19
|
ManHour: 'Issue_Time',
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
+
const takeIconFromUrl = (url) => {
|
|
21
22
|
const arr = url.split('/');
|
|
22
23
|
const last = arr[arr.length - 1];
|
|
23
24
|
const [icon] = last.split('.');
|
|
24
25
|
return icon;
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
+
const useIsIconFont = (url) => {
|
|
27
28
|
const basePath = useGetBasePath();
|
|
28
29
|
return !(url.startsWith('/icons') || url.endsWith('.svg') || url.startsWith(basePath) || url.startsWith('/project'));
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
const isServerUrl = (url) => {
|
|
31
32
|
return url.startsWith('http') || url.startsWith('/parse/files');
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
+
const usePolyFillIcon = (url, defaultIconFontType) => {
|
|
34
35
|
const isIconFont = useIsIconFont(url);
|
|
35
36
|
const data = useMemo(() => {
|
|
36
37
|
if (!url) {
|
|
@@ -52,8 +53,8 @@ export const usePolyFillIcon = (url, defaultIconFontType) => {
|
|
|
52
53
|
}, [defaultIconFontType, isIconFont, url]);
|
|
53
54
|
return data;
|
|
54
55
|
};
|
|
55
|
-
const
|
|
56
|
-
export const joinIconColorSuffix = (icon, colored) => (colored ? `${icon}${SUFFIX}` : icon);
|
|
57
|
-
export const isBase64Img = (str) => {
|
|
56
|
+
const isBase64Img = (str) => {
|
|
58
57
|
return /^data:image\/(png|jpeg|jpg|gif|svg\+xml);base64,/.test(str);
|
|
59
58
|
};
|
|
59
|
+
|
|
60
|
+
export { isBase64Img, isServerUrl, polyfillItemTypeIconMap, takeIconFromUrl, useIsIconFont, usePolyFillIcon };
|
package/dist/lib/isInOne.js
CHANGED
package/dist/lib/number.js
CHANGED
package/dist/lib/path.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const iconBasePath = "/icons";
|
|
2
2
|
export declare const startsWithIconPath: any;
|
|
3
3
|
export declare const useGetBasePath: () => string;
|
|
4
|
-
export declare const useGetSourcePath: () => (path: string) => string;
|
|
5
|
-
export declare const usePatchIconUrl: () => (path: string) => string;
|
|
4
|
+
export declare const useGetSourcePath: () => ((path: string) => string);
|
|
5
|
+
export declare const usePatchIconUrl: () => ((path: string) => string);
|