@giteeteam/apps-team-components 1.2.2 → 1.3.0-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 +21 -28
- package/dist/components/common/PriceTag.js +18 -18
- package/dist/components/common/expand-component/index.d.ts +23 -0
- package/dist/components/common/expand-component/index.js +65 -0
- package/dist/components/common/expand-component/style.d.ts +2 -0
- package/dist/components/common/expand-component/style.js +8 -0
- package/dist/components/common/item-icon/ItemIcon.d.ts +8 -0
- package/dist/components/common/item-icon/ItemIcon.js +6 -0
- package/dist/components/common/overflow-tooltip/OverflowTooltip.d.ts +19 -0
- package/dist/components/common/overflow-tooltip/OverflowTooltip.js +54 -0
- package/dist/components/common/overflow-tooltip/style/index.js +13 -13
- package/dist/components/common/style/global.js +2 -2
- package/dist/components/common/style/mixin.d.ts +2 -0
- package/dist/components/common/style/mixin.js +17 -0
- package/dist/components/common/user-field/style/index.js +21 -21
- package/dist/components/common/utils.d.ts +6 -0
- package/dist/components/common/utils.js +54 -0
- package/dist/components/default-empty-icon/config.d.ts +2 -0
- package/dist/components/default-empty-icon/config.js +19 -0
- package/dist/components/default-empty-icon/index.d.ts +5 -0
- package/dist/components/default-empty-icon/index.js +23 -0
- package/dist/components/default-empty-icon/style.d.ts +11 -0
- package/dist/components/default-empty-icon/style.js +64 -0
- package/dist/components/default-empty-icon/types.d.ts +29 -0
- package/dist/components/default-empty-icon/types.js +6 -0
- package/dist/components/field-behavior/fields/type.js +1 -1
- package/dist/components/fields/base-component/types.d.ts +1 -0
- package/dist/components/fields/base-component/utils.d.ts +2 -0
- package/dist/components/fields/base-component/utils.js +9 -0
- package/dist/components/fields/bind-workspace/hooks.js +3 -3
- package/dist/components/fields/bind-workspace/style/index.js +3 -3
- package/dist/components/fields/dropdown/BaseField.d.ts +24 -2
- package/dist/components/fields/dropdown/BaseField.js +562 -1
- package/dist/components/fields/dropdown/Cell.d.ts +4 -0
- package/dist/components/fields/dropdown/Cell.js +6 -0
- package/dist/components/fields/dropdown/ReadView.js +1 -1
- package/dist/components/fields/dropdown/data.d.ts +9 -0
- package/dist/components/fields/dropdown/data.js +26 -0
- package/dist/components/fields/dropdown/hook.d.ts +103 -0
- package/dist/components/fields/dropdown/hook.js +152 -0
- package/dist/components/fields/dropdown/style.d.ts +16 -0
- package/dist/components/fields/dropdown/style.js +90 -0
- package/dist/components/fields/hooks/useViewClass.d.ts +11 -0
- package/dist/components/fields/hooks/useViewClass.js +18 -0
- package/dist/components/fields/hyper-link/style/index.js +14 -14
- package/dist/components/fields/item-type/ItemTypeIcon.d.ts +9 -0
- package/dist/components/fields/item-type/ItemTypeIcon.js +33 -0
- package/dist/components/fields/item-type/style/index.d.ts +1 -0
- package/dist/components/fields/item-type/style/index.js +6 -0
- package/dist/components/fields/key/ReadView.js +2 -2
- package/dist/components/fields/long-text/style/index.js +5 -5
- package/dist/components/fields/priority/ReadView.js +1 -1
- package/dist/components/fields/priority/style/index.js +50 -50
- package/dist/components/fields/status/style/index.js +323 -323
- package/dist/components/fields/tag/style/index.js +5 -5
- package/dist/components/fields/team/style/index.js +2 -2
- package/dist/components/fields/user/style/index.js +8 -8
- package/dist/components/fields/user-group/ReadView.js +1 -1
- package/dist/components/filters/filter-search/utils.d.ts +4 -0
- package/dist/components/filters/filter-search/utils.js +28 -0
- package/dist/components/table-components/EditTableCell.d.ts +1 -0
- package/dist/components/table-components/EditTableCell.js +2 -1
- package/dist/components/table-components/index.js +4 -4
- package/dist/components/table-components/style/index.js +5 -5
- package/dist/components/table-components/utils.js +2 -0
- package/dist/icons/SyncIconFont.d.ts +6 -0
- package/dist/icons/SyncIconFont.js +15 -0
- package/dist/icons/createFromIconFontClass.d.ts +4 -0
- package/dist/icons/createFromIconFontClass.js +33 -0
- package/dist/icons/empty-icon/data-empty.png +0 -0
- package/dist/icons/empty-icon/forbidden.png +0 -0
- package/dist/icons/empty-icon/index.d.ts +1 -0
- package/dist/icons/empty-icon/index.js +8 -0
- package/dist/icons/empty-icon/large-item@2x.png +0 -0
- package/dist/icons/empty-icon/large-workspace@2x.png +0 -0
- package/dist/icons/empty-icon/load-error.png +0 -0
- package/dist/icons/empty-icon/not-found.png +0 -0
- package/dist/icons/empty-icon/small-default@2x.png +0 -0
- package/dist/icons/empty-icon/workspace-empty.svg +127 -0
- package/dist/icons/index.d.ts +58 -1
- package/dist/icons/index.js +294 -0
- package/dist/icons/style/index.d.ts +2 -0
- package/dist/icons/style/index.js +23 -0
- package/dist/icons/svg/DottedCircle.svg +7 -7
- package/dist/icons/svg/HollowCircle.svg +6 -6
- package/dist/icons/svg/Workflow.svg +12 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/app/utils.d.ts +3 -0
- package/dist/lib/app/utils.js +16 -0
- package/dist/lib/config.d.ts +14 -0
- package/dist/lib/config.js +45 -0
- package/dist/lib/constants/code.d.ts +4 -0
- package/dist/lib/constants/code.js +4 -0
- package/dist/lib/constants/field.d.ts +1 -0
- package/dist/lib/constants/field.js +2 -0
- package/dist/lib/contexts/index.js +2 -2
- package/dist/lib/contexts/teamConfig.d.ts +3 -0
- package/dist/lib/contexts/teamConfig.js +19 -4
- package/dist/lib/error/index.d.ts +2 -0
- package/dist/lib/error/index.js +2 -0
- package/dist/lib/error/log.d.ts +10 -0
- package/dist/lib/error/log.js +25 -0
- package/dist/lib/error/utils.d.ts +14 -0
- package/dist/lib/error/utils.js +50 -0
- package/dist/lib/error/withServerError.d.ts +1 -0
- package/dist/lib/error/withServerError.js +1 -0
- package/dist/lib/fetch.d.ts +45 -0
- package/dist/lib/fetch.js +301 -0
- package/dist/lib/global.d.ts +18 -0
- package/dist/lib/global.js +18 -0
- package/dist/lib/i18n.d.ts +1 -0
- package/dist/lib/i18n.js +1 -0
- package/dist/lib/icons/utils.d.ts +23 -0
- package/dist/lib/icons/utils.js +59 -0
- package/dist/lib/path.d.ts +5 -0
- package/dist/lib/path.js +47 -0
- package/dist/lib/router.d.ts +23 -0
- package/dist/lib/router.js +20 -0
- package/dist/lib/storage.d.ts +10 -0
- package/dist/lib/storage.js +62 -0
- package/dist/lib/swr/throttleWithCache.d.ts +17 -0
- package/dist/lib/swr/throttleWithCache.js +108 -0
- package/dist/lib/throttleFetch.d.ts +2 -0
- package/dist/lib/throttleFetch.js +66 -0
- package/dist/lib/useConfig.d.ts +8 -0
- package/dist/lib/useConfig.js +28 -0
- package/dist/locales/index.d.ts +45 -0
- package/dist/locales/index.js +45 -0
- package/dist/public/icons/BulbIcon.svg +1 -0
- package/dist/public/icons/Cloud.svg +1 -0
- package/dist/public/icons/ConsultIcon.svg +1 -0
- package/dist/public/icons/Demo.svg +1 -0
- package/dist/public/icons/ErrorTemplate.svg +1 -0
- package/dist/public/icons/Fail.svg +1 -0
- package/dist/public/icons/Flag.svg +1 -0
- package/dist/public/icons/GiteeIcon.svg +1 -0
- package/dist/public/icons/IntelligenceGradient.svg +1 -0
- package/dist/public/icons/Issue_Approval.svg +1 -0
- package/dist/public/icons/Issue_Bug.svg +1 -0
- package/dist/public/icons/Issue_Demand.svg +1 -0
- package/dist/public/icons/Issue_Doc.svg +1 -0
- package/dist/public/icons/Issue_Idea.svg +1 -0
- package/dist/public/icons/Issue_List.svg +1 -0
- package/dist/public/icons/Issue_Plan.svg +1 -0
- package/dist/public/icons/Issue_Product.svg +1 -0
- package/dist/public/icons/Issue_Risk.svg +1 -0
- package/dist/public/icons/Issue_Story.svg +1 -0
- package/dist/public/icons/Issue_Subtask.svg +1 -0
- package/dist/public/icons/Issue_Task.svg +1 -0
- package/dist/public/icons/Issue_Test.svg +1 -0
- package/dist/public/icons/Issue_TestExcution.svg +1 -0
- package/dist/public/icons/Issue_TestPlan.svg +1 -0
- package/dist/public/icons/Issue_Time.svg +1 -0
- package/dist/public/icons/Issue_develop.svg +1 -0
- package/dist/public/icons/KanbanCover.svg +7 -0
- package/dist/public/icons/ListCover.svg +118 -0
- package/dist/public/icons/ManHour.svg +1 -0
- package/dist/public/icons/MobileIcon.svg +1 -0
- package/dist/public/icons/NoItemType.svg +10 -0
- package/dist/public/icons/ProductIcon.svg +1 -0
- package/dist/public/icons/RedFlagIcon.svg +1 -0
- package/dist/public/icons/Safe.svg +1 -0
- package/dist/public/icons/StarIcon.svg +61 -0
- package/dist/public/icons/StructureCover.svg +1 -0
- package/dist/public/icons/Success.svg +1 -0
- package/dist/public/icons/TeamIcon.svg +1 -0
- package/dist/public/icons/WebIcon.svg +1 -0
- package/dist/public/icons/iconfont.svg +467 -0
- package/dist/public/icons/iconfont.ttf +0 -0
- package/dist/public/icons/iconfont.woff +0 -0
- package/dist/public/icons/iconfont.woff2 +0 -0
- package/dist/public/icons/iconfont_multiple_color.js +1 -0
- package/dist/public/icons/iconfont_single_color.css +912 -0
- package/dist/public/icons/iconfont_single_color.js +1 -0
- package/dist/public/icons/loginBg.svg +1 -0
- package/dist/public/mockServiceWorker.js +284 -0
- package/dist/style/common.d.ts +1 -0
- package/dist/style/common.js +9 -0
- package/dist/style/global.d.ts +1 -0
- package/dist/style/global.js +8 -0
- package/package.json +105 -69
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import useFetch from 'lib/fetch';
|
|
3
|
+
import { throttleFetch } from 'lib/throttleFetch';
|
|
4
|
+
export const useFetchDropdown = () => {
|
|
5
|
+
const fetch = useFetch();
|
|
6
|
+
const fetchDropdownData = useCallback(({ keyword, workspaceId, page, fieldId, propsValue }) => {
|
|
7
|
+
return throttleFetch({ keyword, workspaceId, page, fieldId }, async () => {
|
|
8
|
+
try {
|
|
9
|
+
const { data } = await fetch.get(`/dropdown/data/${fieldId}`, {
|
|
10
|
+
params: {
|
|
11
|
+
keyword,
|
|
12
|
+
workspaceId,
|
|
13
|
+
page,
|
|
14
|
+
propsValue,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return data === null || data === void 0 ? void 0 : data.data;
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.error('fetchDropdownData_error', e);
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}, [fetch]);
|
|
25
|
+
return fetchDropdownData;
|
|
26
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectProps } from 'antd';
|
|
3
|
+
import { Item, ItemType, PointerObject } from 'lib/types/models';
|
|
4
|
+
import { FieldProps, IScreenLabelProps } from '../base-component/types';
|
|
5
|
+
import { IParams } from '../hooks/useParamsAdapter';
|
|
6
|
+
interface optionType {
|
|
7
|
+
key: string;
|
|
8
|
+
value: string;
|
|
9
|
+
disabled: undefined | boolean;
|
|
10
|
+
children: {
|
|
11
|
+
props: selectValue;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface selectValue {
|
|
15
|
+
label: React.ReactNode;
|
|
16
|
+
value: string | number;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
enable?: boolean;
|
|
19
|
+
icon?: string;
|
|
20
|
+
itemType?: PointerObject | ItemType;
|
|
21
|
+
archived?: boolean;
|
|
22
|
+
values?: {
|
|
23
|
+
[propName: string]: any;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type BaseDropdownProps = SelectProps<any> & FieldProps & {
|
|
27
|
+
value?: string[] | number[] | Array<IParams>;
|
|
28
|
+
options?: selectValue[];
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
onChange?: (e: any, option?: optionType | optionType[] | string) => void;
|
|
31
|
+
onSelect?: (e: any, option: any) => void;
|
|
32
|
+
onOptionsChange?: (options: any[]) => void;
|
|
33
|
+
onBlur?: (e: any) => void;
|
|
34
|
+
onClear?: () => void;
|
|
35
|
+
fetchOptions?: (keywords: string) => Promise<selectValue[]>;
|
|
36
|
+
fetchValues?: (values: string[], key: string) => Promise<selectValue[]>;
|
|
37
|
+
debounceTimeout?: number;
|
|
38
|
+
useChange?: boolean;
|
|
39
|
+
expression?: string;
|
|
40
|
+
iql?: string;
|
|
41
|
+
display?: string;
|
|
42
|
+
objectId?: string;
|
|
43
|
+
dataQuoteInit?: (dates: Item[] | selectValue[], value: string[], display?: string) => selectValue[];
|
|
44
|
+
workspace?: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
valueDisplayWrap?: boolean;
|
|
47
|
+
optionDisplayWrap?: boolean;
|
|
48
|
+
disabledSwr?: boolean;
|
|
49
|
+
onlyValue?: boolean;
|
|
50
|
+
isGroup?: boolean;
|
|
51
|
+
fetchChange?: (value?: boolean) => void;
|
|
52
|
+
displayValueHidden?: boolean;
|
|
53
|
+
disabledLineThrough?: boolean;
|
|
54
|
+
displayWorkspace?: boolean;
|
|
55
|
+
onlyWorkspace?: boolean;
|
|
56
|
+
setOnlyWorkspace?: (e: boolean) => void;
|
|
57
|
+
isShowOnlyWorkspace?: boolean;
|
|
58
|
+
fieldTypeKey?: string;
|
|
59
|
+
iqlKey?: string;
|
|
60
|
+
detailKey?: string;
|
|
61
|
+
fetchOnFocus?: boolean;
|
|
62
|
+
isCascaded?: boolean;
|
|
63
|
+
cascadeCustomData?: selectValue[];
|
|
64
|
+
onlyWorkspaceTip?: string;
|
|
65
|
+
hasCurrentWorkspace?: boolean;
|
|
66
|
+
clickFetch?: boolean;
|
|
67
|
+
iqlToNeedMore?: boolean;
|
|
68
|
+
itemId?: string;
|
|
69
|
+
workspaceId?: string;
|
|
70
|
+
dataSource?: string;
|
|
71
|
+
userData?: Record<string, any>;
|
|
72
|
+
page?: string;
|
|
73
|
+
labelWidth?: number;
|
|
74
|
+
labelAlign?: IScreenLabelProps;
|
|
75
|
+
editMode?: boolean;
|
|
76
|
+
apply?: string;
|
|
77
|
+
hiddenLabel?: boolean;
|
|
78
|
+
screenMode?: string;
|
|
79
|
+
searchComponent?: boolean;
|
|
80
|
+
};
|
|
81
|
+
export declare const EMPTY_OPTIONS: any[];
|
|
82
|
+
export declare const useCommonProps: (props: BaseDropdownProps) => {
|
|
83
|
+
propsValue: any;
|
|
84
|
+
fetchChange: (value?: boolean) => void;
|
|
85
|
+
onSearchChange: any;
|
|
86
|
+
options: any[];
|
|
87
|
+
onlyWorkspace: boolean;
|
|
88
|
+
setOnlyWorkspace: (e: any) => void;
|
|
89
|
+
detailKey: string;
|
|
90
|
+
loading: boolean;
|
|
91
|
+
_setValue: import("react").Dispatch<import("react").SetStateAction<any[]>>;
|
|
92
|
+
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
93
|
+
setOptions: import("react").Dispatch<import("react").SetStateAction<any[]>>;
|
|
94
|
+
propsOptions: any[];
|
|
95
|
+
cachedOptionsRef: import("react").MutableRefObject<selectValue[]>;
|
|
96
|
+
needFetchDataSource: boolean;
|
|
97
|
+
fetchOptions: (keyword?: string) => Promise<any>;
|
|
98
|
+
fetchValues: (value: string[], key: string) => Promise<any>;
|
|
99
|
+
canAsyncFetchOption: boolean;
|
|
100
|
+
cacheSelectOptions: (opts: selectValue[]) => selectValue[];
|
|
101
|
+
value: any[];
|
|
102
|
+
};
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { debounce, uniqWith } from 'lodash-es';
|
|
3
|
+
import { getArrayValue } from 'lib/array';
|
|
4
|
+
import { REMOTE_DATA_QUOTE_FIELD_TYPE } from 'lib/constants/field';
|
|
5
|
+
import { FIELD_TYPE_KEY_MAPPINGS } from 'lib/global';
|
|
6
|
+
import { useFetchDropdown } from './data';
|
|
7
|
+
const useGenerateFetchFunction = ({ workspaceId, page, fieldId, propsValue, needFetchDataSource, defaultFetchValues, defaultFetchOptions, }) => {
|
|
8
|
+
const fetchDropdownData = useFetchDropdown();
|
|
9
|
+
const fetchOptions = useMemo(() => {
|
|
10
|
+
if (!needFetchDataSource) {
|
|
11
|
+
return defaultFetchOptions;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return async (keyword) => await fetchDropdownData({
|
|
15
|
+
fieldId,
|
|
16
|
+
keyword: keyword ? keyword : undefined,
|
|
17
|
+
workspaceId,
|
|
18
|
+
page,
|
|
19
|
+
propsValue,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}, [defaultFetchOptions, fetchDropdownData, fieldId, needFetchDataSource, page, propsValue, workspaceId]);
|
|
23
|
+
const fetchValues = useMemo(() => {
|
|
24
|
+
if (!needFetchDataSource) {
|
|
25
|
+
return defaultFetchValues;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return async (value) => await fetchDropdownData({
|
|
29
|
+
fieldId,
|
|
30
|
+
workspaceId,
|
|
31
|
+
page,
|
|
32
|
+
propsValue: JSON.stringify(value),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}, [defaultFetchValues, fetchDropdownData, fieldId, needFetchDataSource, page, workspaceId]);
|
|
36
|
+
return {
|
|
37
|
+
fetchOptions,
|
|
38
|
+
fetchValues,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export const EMPTY_OPTIONS = [];
|
|
42
|
+
export const useCommonProps = (props) => {
|
|
43
|
+
var _a;
|
|
44
|
+
const { value: propsValue, options: _propsOptions = EMPTY_OPTIONS, fetchValues: _fetchValues, fetchOptions: _fetchOptions, debounceTimeout = 600, objectId, userData, workspace, page, fetchChange, onlyWorkspace, setOnlyWorkspace, fieldTypeKey, detailKey, isCascaded, cascadeCustomData, workspaceId, dataSource, } = props;
|
|
45
|
+
const [loading, setLoading] = useState(true);
|
|
46
|
+
const [value, _setValue] = useState([]);
|
|
47
|
+
const propsOptions = useMemo(() => {
|
|
48
|
+
return isCascaded ? cascadeCustomData : _propsOptions;
|
|
49
|
+
}, [_propsOptions, isCascaded, cascadeCustomData]);
|
|
50
|
+
const [options, setOptions] = useState(propsOptions || []);
|
|
51
|
+
const cachedOptionsRef = useRef([]);
|
|
52
|
+
const needFetchDataSource = !!(userData === null || userData === void 0 ? void 0 : userData.source) || !!dataSource;
|
|
53
|
+
const { fetchOptions, fetchValues } = useGenerateFetchFunction({
|
|
54
|
+
workspaceId: workspaceId || workspace,
|
|
55
|
+
page,
|
|
56
|
+
fieldId: objectId,
|
|
57
|
+
propsValue: Array.isArray(propsValue) ? ((_a = propsValue === null || propsValue === void 0 ? void 0 : propsValue[0]) === null || _a === void 0 ? void 0 : _a.value) || (propsValue === null || propsValue === void 0 ? void 0 : propsValue[0]) : propsValue,
|
|
58
|
+
needFetchDataSource,
|
|
59
|
+
defaultFetchOptions: _fetchOptions,
|
|
60
|
+
defaultFetchValues: _fetchValues,
|
|
61
|
+
});
|
|
62
|
+
const canAsyncFetchOption = useMemo(() => typeof fetchValues === 'function' && typeof fetchOptions === 'function', [fetchOptions, fetchValues]);
|
|
63
|
+
const cacheSelectOptions = useCallback((opts) => {
|
|
64
|
+
var _a;
|
|
65
|
+
const optsInit = opts === null || opts === void 0 ? void 0 : opts.map(ele => {
|
|
66
|
+
var _a;
|
|
67
|
+
if (ele === null || ele === void 0 ? void 0 : ele.itemType) {
|
|
68
|
+
return {
|
|
69
|
+
...ele,
|
|
70
|
+
icon: (_a = ele.itemType) === null || _a === void 0 ? void 0 : _a.icon,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return ele;
|
|
74
|
+
});
|
|
75
|
+
if (Array.isArray(cachedOptionsRef.current) && Array.isArray(optsInit)) {
|
|
76
|
+
let cachedOptionsRefCopy = cachedOptionsRef.current;
|
|
77
|
+
if (REMOTE_DATA_QUOTE_FIELD_TYPE.includes(fieldTypeKey)) {
|
|
78
|
+
cachedOptionsRefCopy = (_a = cachedOptionsRef.current) === null || _a === void 0 ? void 0 : _a.map(opt => {
|
|
79
|
+
const currentOpt = optsInit.find(ele => ele.value === opt.value);
|
|
80
|
+
return {
|
|
81
|
+
...opt,
|
|
82
|
+
values: currentOpt === null || currentOpt === void 0 ? void 0 : currentOpt.values,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const cachedOptions = cachedOptionsRefCopy.concat(optsInit);
|
|
87
|
+
let cachedOptionsFilter = cachedOptions;
|
|
88
|
+
if ([FIELD_TYPE_KEY_MAPPINGS.Version, FIELD_TYPE_KEY_MAPPINGS.Team, FIELD_TYPE_KEY_MAPPINGS.Sprint].includes(fieldTypeKey)) {
|
|
89
|
+
cachedOptionsFilter = cachedOptions.map(ele => {
|
|
90
|
+
const versionWithArchived = optsInit === null || optsInit === void 0 ? void 0 : optsInit.find(opt => {
|
|
91
|
+
return opt.value === ele.value;
|
|
92
|
+
});
|
|
93
|
+
return versionWithArchived ? Object.assign(ele, versionWithArchived) : ele;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
cachedOptionsRef.current = uniqWith(cachedOptionsFilter, (a, b) => a.value === b.value);
|
|
97
|
+
}
|
|
98
|
+
return cachedOptionsRef.current;
|
|
99
|
+
}, [fieldTypeKey]);
|
|
100
|
+
const handleSearch = useMemo(() => {
|
|
101
|
+
if (!canAsyncFetchOption) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const searchFunc = _keyword => {
|
|
105
|
+
const keyword = _keyword === null || _keyword === void 0 ? void 0 : _keyword.trim();
|
|
106
|
+
if (!keyword) {
|
|
107
|
+
setOptions(cachedOptionsRef.current);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
setLoading(true);
|
|
111
|
+
fetchOptions(keyword).then(opts => {
|
|
112
|
+
setLoading(false);
|
|
113
|
+
cacheSelectOptions(opts);
|
|
114
|
+
const _value = getArrayValue(value);
|
|
115
|
+
const noExistValues = _value.filter(v => opts.every(item => item.value !== v));
|
|
116
|
+
if (noExistValues.length) {
|
|
117
|
+
opts = noExistValues
|
|
118
|
+
.map(v => { var _a; return (_a = cachedOptionsRef.current) === null || _a === void 0 ? void 0 : _a.find(item => item.value === v); })
|
|
119
|
+
.filter(Boolean)
|
|
120
|
+
.concat(opts);
|
|
121
|
+
}
|
|
122
|
+
setOptions(opts);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
return debounce(searchFunc, debounceTimeout);
|
|
127
|
+
}, [fetchOptions, canAsyncFetchOption, debounceTimeout, cacheSelectOptions, value]);
|
|
128
|
+
const onChangeCurrent = useCallback(e => {
|
|
129
|
+
setOnlyWorkspace(e.target.checked);
|
|
130
|
+
}, [setOnlyWorkspace]);
|
|
131
|
+
return {
|
|
132
|
+
propsValue,
|
|
133
|
+
fetchChange: fetchChange,
|
|
134
|
+
onSearchChange: handleSearch,
|
|
135
|
+
options,
|
|
136
|
+
onlyWorkspace,
|
|
137
|
+
setOnlyWorkspace: onChangeCurrent,
|
|
138
|
+
detailKey,
|
|
139
|
+
loading,
|
|
140
|
+
_setValue,
|
|
141
|
+
setLoading,
|
|
142
|
+
setOptions,
|
|
143
|
+
propsOptions,
|
|
144
|
+
cachedOptionsRef,
|
|
145
|
+
needFetchDataSource,
|
|
146
|
+
fetchOptions,
|
|
147
|
+
fetchValues,
|
|
148
|
+
canAsyncFetchOption,
|
|
149
|
+
cacheSelectOptions,
|
|
150
|
+
value,
|
|
151
|
+
};
|
|
152
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const dropdownSelectDisabled = "\n text-decoration: line-through;\n";
|
|
2
|
+
export declare const onlyWorkspaceStyle = "\n padding: 5px 12px;\n";
|
|
3
|
+
export declare const onlyWorkspaceDividerStyle = "\n &:not(.add-weights) {\n margin: 4px 0;\n }\n";
|
|
4
|
+
export declare const hiddenHoverClass: string;
|
|
5
|
+
export declare const displayWrapClass: string;
|
|
6
|
+
export declare const valueOptionClass: string;
|
|
7
|
+
export declare const valueOptionContentClass: string;
|
|
8
|
+
export declare const valueOptionIconClass: string;
|
|
9
|
+
export declare const valueOptionLabelClass: string;
|
|
10
|
+
export declare const workspaceClass: string;
|
|
11
|
+
export declare const hoverIconClass: string;
|
|
12
|
+
export declare const optionDisplayWrapClass: string;
|
|
13
|
+
export declare const dropdownStyle: (antPrefix: string) => string;
|
|
14
|
+
export declare const dropdownSelectOptionClass: string;
|
|
15
|
+
export declare const disabledClass: string;
|
|
16
|
+
export declare const dropdownSelectStyle: (antPrefix: string) => string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { randomClassName } from 'style/common';
|
|
2
|
+
import { hoverIconStyle, hoverStyle } from 'components/common/style/mixin';
|
|
3
|
+
export const dropdownSelectDisabled = `
|
|
4
|
+
text-decoration: line-through;
|
|
5
|
+
`;
|
|
6
|
+
export const onlyWorkspaceStyle = `
|
|
7
|
+
padding: 5px 12px;
|
|
8
|
+
`;
|
|
9
|
+
export const onlyWorkspaceDividerStyle = `
|
|
10
|
+
&:not(.add-weights) {
|
|
11
|
+
margin: 4px 0;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
export const hiddenHoverClass = randomClassName('hidden-hover');
|
|
15
|
+
export const displayWrapClass = randomClassName('display-wrap');
|
|
16
|
+
export const valueOptionClass = randomClassName('value-option');
|
|
17
|
+
export const valueOptionContentClass = randomClassName('value-option-content');
|
|
18
|
+
export const valueOptionIconClass = randomClassName('value-option-icon');
|
|
19
|
+
export const valueOptionLabelClass = randomClassName('value-option-label');
|
|
20
|
+
export const workspaceClass = randomClassName('workspace');
|
|
21
|
+
export const hoverIconClass = randomClassName('hover-icon');
|
|
22
|
+
export const optionDisplayWrapClass = randomClassName('option-display-wrap');
|
|
23
|
+
export const dropdownStyle = (antPrefix) => `
|
|
24
|
+
width: 100%;
|
|
25
|
+
|
|
26
|
+
&:not(.${hiddenHoverClass}) &:not(.${displayWrapClass}) :hover {
|
|
27
|
+
${hoverStyle}
|
|
28
|
+
|
|
29
|
+
.${hoverIconClass} {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.${hoverIconClass} {
|
|
35
|
+
${hoverIconStyle}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.${antPrefix}-select {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.${antPrefix}-select-selection-item) {
|
|
43
|
+
.${workspaceClass} {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.${valueOptionClass} {
|
|
49
|
+
margin-bottom: 8px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.${valueOptionContentClass} {
|
|
53
|
+
width: 100%;
|
|
54
|
+
padding-top: 6px;
|
|
55
|
+
|
|
56
|
+
.${valueOptionIconClass} {
|
|
57
|
+
position: absolute;
|
|
58
|
+
margin-top: 3px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.${valueOptionLabelClass} {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
width: ~'calc(100% - 22px)';
|
|
64
|
+
margin-left: 22px;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.${optionDisplayWrapClass} {
|
|
72
|
+
.${antPrefix}-select-selection-overflow {
|
|
73
|
+
display: block;
|
|
74
|
+
.${antPrefix}-select-selection-overflow-item {
|
|
75
|
+
width: fit-content;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
export const dropdownSelectOptionClass = randomClassName('dropdown-select-option');
|
|
81
|
+
export const disabledClass = randomClassName('disabled');
|
|
82
|
+
export const dropdownSelectStyle = (antPrefix) => `
|
|
83
|
+
.${dropdownSelectOptionClass}.${disabledClass} {
|
|
84
|
+
text-decoration: line-through;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.${antPrefix}-select-selection-item-content {
|
|
88
|
+
text-decoration: line-through;
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface IViewClass {
|
|
2
|
+
screenMode: string;
|
|
3
|
+
editing: boolean;
|
|
4
|
+
readonly: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface IViewClassResult {
|
|
7
|
+
viewClassNames: Record<string, boolean>;
|
|
8
|
+
isView: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const useViewClass: ({ screenMode, editing, readonly }: IViewClass) => IViewClassResult;
|
|
11
|
+
export default useViewClass;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { SCREEN_TYPE } from 'lib/global';
|
|
3
|
+
const useViewClass = ({ screenMode, editing, readonly }) => {
|
|
4
|
+
const isView = useMemo(() => {
|
|
5
|
+
return screenMode === SCREEN_TYPE.View;
|
|
6
|
+
}, [screenMode]);
|
|
7
|
+
const viewClassNames = useMemo(() => {
|
|
8
|
+
return {
|
|
9
|
+
'field-value-view': isView && !editing,
|
|
10
|
+
'field-value-readonly': readonly,
|
|
11
|
+
};
|
|
12
|
+
}, [isView, editing, readonly]);
|
|
13
|
+
return {
|
|
14
|
+
viewClassNames,
|
|
15
|
+
isView,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default useViewClass;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { blue6 } from '../../../../style/common';
|
|
2
|
-
export const hyperLinkListStyle = `
|
|
3
|
-
display: flex;
|
|
4
|
-
width: 100%;
|
|
2
|
+
export const hyperLinkListStyle = `
|
|
3
|
+
display: flex;
|
|
4
|
+
width: 100%;
|
|
5
5
|
`;
|
|
6
|
-
export const hyperLinkItemStyle = `
|
|
7
|
-
${hyperLinkListStyle} & {
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
color: @blue-6;
|
|
10
|
-
text-overflow: ellipsis;
|
|
11
|
-
white-space: nowrap;
|
|
12
|
-
-webkit-line-clamp: 1;
|
|
13
|
-
}
|
|
6
|
+
export const hyperLinkItemStyle = `
|
|
7
|
+
${hyperLinkListStyle} & {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
color: @blue-6;
|
|
10
|
+
text-overflow: ellipsis;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
-webkit-line-clamp: 1;
|
|
13
|
+
}
|
|
14
14
|
`;
|
|
15
|
-
export const hyperLinkTipItem = `
|
|
16
|
-
display: block;
|
|
17
|
-
color: ${blue6};
|
|
15
|
+
export const hyperLinkTipItem = `
|
|
16
|
+
display: block;
|
|
17
|
+
color: ${blue6};
|
|
18
18
|
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const NoItemTypeIconUrl = "/icons/NoItemType.svg";
|
|
3
|
+
export declare const useNoItemTypeIcon: () => string;
|
|
4
|
+
export declare const ItemTypeIcon: ({ icon, name, className, }: {
|
|
5
|
+
icon?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}) => React.ReactElement;
|
|
9
|
+
export default ItemTypeIcon;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { ClassNames } from '@emotion/react';
|
|
4
|
+
import { Tooltip } from 'antd';
|
|
5
|
+
import { CustomIconFont } from 'icons/index';
|
|
6
|
+
import useI18n from 'lib/hooks/useI18n';
|
|
7
|
+
import { isBase64Img, usePolyFillIcon } from 'lib/icons/utils';
|
|
8
|
+
import { usePatchIconUrl } from 'lib/path';
|
|
9
|
+
import { nameItemTypeImg } from './style';
|
|
10
|
+
export const NoItemTypeIconUrl = '/icons/NoItemType.svg';
|
|
11
|
+
export const useNoItemTypeIcon = () => {
|
|
12
|
+
const patchIconUrl = usePatchIconUrl();
|
|
13
|
+
return patchIconUrl(NoItemTypeIconUrl);
|
|
14
|
+
};
|
|
15
|
+
export const ItemTypeIcon = ({ icon, name, className, }) => {
|
|
16
|
+
const { t } = useI18n();
|
|
17
|
+
const [title, setTitle] = useState(name);
|
|
18
|
+
const [isURL, _icon] = usePolyFillIcon(icon);
|
|
19
|
+
const patchIconUrl = usePatchIconUrl();
|
|
20
|
+
const NoItemTypeIcon = useMemo(() => patchIconUrl(NoItemTypeIconUrl), [patchIconUrl]);
|
|
21
|
+
return (_jsx(Tooltip, { title: title, children: _jsx(ClassNames, { children: ({ cx, css }) => {
|
|
22
|
+
var _a;
|
|
23
|
+
return isURL ? (_jsx("img", { src: (_a = patchIconUrl(icon)) !== null && _a !== void 0 ? _a : NoItemTypeIcon, onError: e => {
|
|
24
|
+
const target = e.target;
|
|
25
|
+
icon
|
|
26
|
+
? setTitle(t('pages.fields.default.getImageError'))
|
|
27
|
+
: setTitle(t('pages.fields.default.noItemType'));
|
|
28
|
+
target.onerror = null;
|
|
29
|
+
target.src = NoItemTypeIcon;
|
|
30
|
+
}, className: cx(css(nameItemTypeImg), className) })) : isBase64Img(icon) ? (_jsx("img", { src: icon, className: cx(css(nameItemTypeImg), className) })) : (_jsx(CustomIconFont, { type: _icon, className: cx(css(nameItemTypeImg), className) }));
|
|
31
|
+
} }) }));
|
|
32
|
+
};
|
|
33
|
+
export default ItemTypeIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const nameItemTypeImg = "\n width: 16px;\n height: 16px;\n margin-right: 8px;\n font-size: 16px;\n";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import EmptyField from '../../common/EmptyField';
|
|
4
4
|
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
|
|
5
5
|
const KeyReadView = memo(({ value }) => {
|
|
6
|
-
return
|
|
6
|
+
return value ? _jsx(SimpleOverflowToolTip, { title: value, children: value }) : _jsx(EmptyField, { readonly: true });
|
|
7
7
|
});
|
|
8
8
|
KeyReadView.displayName = 'KeyReadView';
|
|
9
9
|
export default KeyReadView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const whiteSpacePreStyle = `
|
|
2
|
-
padding-top: 5px;
|
|
3
|
-
padding-bottom: 5px;
|
|
4
|
-
word-break: break-all;
|
|
5
|
-
white-space: pre-wrap;
|
|
1
|
+
export const whiteSpacePreStyle = `
|
|
2
|
+
padding-top: 5px;
|
|
3
|
+
padding-bottom: 5px;
|
|
4
|
+
word-break: break-all;
|
|
5
|
+
white-space: pre-wrap;
|
|
6
6
|
`;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
2
2
|
import { memo, useCallback, useMemo } from 'react';
|
|
3
3
|
import { CaretDownOutlined } from '@ant-design/icons';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import { DottedCircleIcon, HollowCircleIcon } from '
|
|
5
|
+
import { DottedCircleIcon, HollowCircleIcon } from 'icons/index';
|
|
6
6
|
import useAntdConfig from '../../../lib/hooks/useAntdConfig';
|
|
7
7
|
import useI18n from '../../../lib/hooks/useI18n';
|
|
8
8
|
import EmptyField from '../../common/EmptyField';
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { fieldLabelColor } from '../../../../style/common';
|
|
2
|
-
export const cellBoxStyle = (antPrefix) => `
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
line-height: unset;
|
|
6
|
-
|
|
7
|
-
.${antPrefix}-dropdown-menu-title-content {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
max-width: 150px;
|
|
11
|
-
|
|
12
|
-
.anticon {
|
|
13
|
-
flex-shrink: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
& > span {
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
2
|
+
export const cellBoxStyle = (antPrefix) => `
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
line-height: unset;
|
|
6
|
+
|
|
7
|
+
.${antPrefix}-dropdown-menu-title-content {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
max-width: 150px;
|
|
11
|
+
|
|
12
|
+
.anticon {
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
& > span {
|
|
17
|
+
white-space: pre-line;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
20
|
`;
|
|
21
|
-
export const headerCellStyle = `
|
|
22
|
-
max-width: 120px;
|
|
23
|
-
height: 24px;
|
|
24
|
-
padding: 0 8px;
|
|
25
|
-
font-size: 12px;
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
line-height: 24px;
|
|
28
|
-
color: #213053;
|
|
29
|
-
text-align: center;
|
|
30
|
-
background-color: #f5f6f8;
|
|
31
|
-
border-radius: 4px;
|
|
21
|
+
export const headerCellStyle = `
|
|
22
|
+
max-width: 120px;
|
|
23
|
+
height: 24px;
|
|
24
|
+
padding: 0 8px;
|
|
25
|
+
font-size: 12px;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
line-height: 24px;
|
|
28
|
+
color: #213053;
|
|
29
|
+
text-align: center;
|
|
30
|
+
background-color: #f5f6f8;
|
|
31
|
+
border-radius: 4px;
|
|
32
32
|
`;
|
|
33
|
-
export const emptyTextStyle = `
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
33
|
+
export const emptyTextStyle = `
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
38
|
`;
|
|
39
|
-
export const colorIconStyle = `
|
|
40
|
-
margin-right: 5px;
|
|
41
|
-
font-size: 12px;
|
|
39
|
+
export const colorIconStyle = `
|
|
40
|
+
margin-right: 5px;
|
|
41
|
+
font-size: 12px;
|
|
42
42
|
`;
|
|
43
|
-
export const emptyStyle = `
|
|
44
|
-
color: ${fieldLabelColor};
|
|
43
|
+
export const emptyStyle = `
|
|
44
|
+
color: ${fieldLabelColor};
|
|
45
45
|
`;
|
|
46
|
-
export const emptyIconStyle = `
|
|
47
|
-
margin-right: 5px;
|
|
48
|
-
font-size: 12px!important;
|
|
49
|
-
width: 12px!important;
|
|
50
|
-
margin-left: 0!important;
|
|
46
|
+
export const emptyIconStyle = `
|
|
47
|
+
margin-right: 5px;
|
|
48
|
+
font-size: 12px!important;
|
|
49
|
+
width: 12px!important;
|
|
50
|
+
margin-left: 0!important;
|
|
51
51
|
`;
|
|
52
|
-
export const downIconStyle = `
|
|
53
|
-
margin-left: 2px;
|
|
54
|
-
|
|
55
|
-
svg {
|
|
56
|
-
vertical-align: inherit;
|
|
57
|
-
}
|
|
52
|
+
export const downIconStyle = `
|
|
53
|
+
margin-left: 2px;
|
|
54
|
+
|
|
55
|
+
svg {
|
|
56
|
+
vertical-align: inherit;
|
|
57
|
+
}
|
|
58
58
|
`;
|