@giteeteam/apps-team-components 1.2.2-alpha.4 → 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 +8 -15
- 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/style/mixin.d.ts +2 -0
- package/dist/components/common/style/mixin.js +17 -0
- 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/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 +16 -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/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/priority/ReadView.js +1 -1
- package/dist/components/fields/status/SelectTransition.js +2 -2
- package/dist/components/fields/status/TransitionButton.d.ts +0 -3
- package/dist/components/fields/status/TransitionButton.js +1 -7
- 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/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/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/lib/workflow.js +19 -85
- 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 +41 -6
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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';
|
|
@@ -8,8 +8,8 @@ import TransitionButton from './TransitionButton';
|
|
|
8
8
|
import View from './View';
|
|
9
9
|
const SelectTransition = ({ fetching, flowing, tasks, itemId, itemData, currentUser, workspace, setPopoverVisible, name, objectId, workflowData, roleIds, groupIds, workspaceRoleIds, approval, checkIn, handleTransition, readonly, flowHandlerActive, }) => {
|
|
10
10
|
return (_jsx(ClassNames, { children: ({ cx, css }) => (_jsxs(_Fragment, { children: [fetching ? (_jsx(Spin, { css: css(spinStyle) })) : tasks.length ? (_jsx("div", { className: cx(css(flowNextStyle), `flow-next-global`), children: _jsx("div", { className: cx(css(flowWrapperStyle)), children: tasks.map(task => {
|
|
11
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
12
|
-
return (_jsx(TransitionButton, { itemId: itemId, loading: flowing, text: task.name, item: itemData, workspace: workspace, userId: currentUser.id, groupIds: groupIds, roleIds: roleIds, workspaceRoleIds: workspaceRoleIds, currentTaskId: task.id, authUsers: (_b = (_a = task.parameters) === null || _a === void 0 ? void 0 : _a.permissionType) === null || _b === void 0 ? void 0 : _b.users, authRoles: (_d = (_c = task.parameters) === null || _c === void 0 ? void 0 : _c.permissionType) === null || _d === void 0 ? void 0 : _d.roles, authGroups: (_f = (_e = task.parameters) === null || _e === void 0 ? void 0 : _e.permissionType) === null || _f === void 0 ? void 0 : _f.groups, authUserFields: (_h = (_g = task.parameters) === null || _g === void 0 ? void 0 : _g.permissionType) === null || _h === void 0 ? void 0 : _h.customFields, authWorkSpaceRoles: (_k = (_j = task.parameters) === null || _j === void 0 ? void 0 : _j.permissionType) === null || _k === void 0 ? void 0 : _k.workspaceRoles, creatorAuth: (_m = (_l = task.parameters) === null || _l === void 0 ? void 0 : _l.permissionType) === null || _m === void 0 ? void 0 : _m.creatorAuth, scriptValidator: (_o = task.parameters) === null || _o === void 0 ? void 0 : _o.scriptValidator, conditions: (_p = task.parameters) === null || _p === void 0 ? void 0 : _p.fieldType, screenId: (_r = (_q = task.parameters) === null || _q === void 0 ? void 0 : _q.screen) === null || _r === void 0 ? void 0 : _r.key, target: task.target, approval: approval, checkIn: checkIn, handleTransition: handleTransition, hiddenPopover: () => setPopoverVisible(false), readonly: readonly, flowHandlerActive: flowHandlerActive
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
12
|
+
return (_jsx(TransitionButton, { itemId: itemId, loading: flowing, text: task.name, item: itemData, workspace: workspace, userId: currentUser.id, groupIds: groupIds, roleIds: roleIds, workspaceRoleIds: workspaceRoleIds, currentTaskId: task.id, authUsers: (_b = (_a = task.parameters) === null || _a === void 0 ? void 0 : _a.permissionType) === null || _b === void 0 ? void 0 : _b.users, authRoles: (_d = (_c = task.parameters) === null || _c === void 0 ? void 0 : _c.permissionType) === null || _d === void 0 ? void 0 : _d.roles, authGroups: (_f = (_e = task.parameters) === null || _e === void 0 ? void 0 : _e.permissionType) === null || _f === void 0 ? void 0 : _f.groups, authUserFields: (_h = (_g = task.parameters) === null || _g === void 0 ? void 0 : _g.permissionType) === null || _h === void 0 ? void 0 : _h.customFields, authWorkSpaceRoles: (_k = (_j = task.parameters) === null || _j === void 0 ? void 0 : _j.permissionType) === null || _k === void 0 ? void 0 : _k.workspaceRoles, creatorAuth: (_m = (_l = task.parameters) === null || _l === void 0 ? void 0 : _l.permissionType) === null || _m === void 0 ? void 0 : _m.creatorAuth, scriptValidator: (_o = task.parameters) === null || _o === void 0 ? void 0 : _o.scriptValidator, conditions: (_p = task.parameters) === null || _p === void 0 ? void 0 : _p.fieldType, screenId: (_r = (_q = task.parameters) === null || _q === void 0 ? void 0 : _q.screen) === null || _r === void 0 ? void 0 : _r.key, target: task.target, approval: approval, checkIn: checkIn, handleTransition: handleTransition, hiddenPopover: () => setPopoverVisible(false), readonly: readonly, flowHandlerActive: flowHandlerActive }, task.id));
|
|
13
13
|
}) }) })) : (_jsx("span", { onClick: () => {
|
|
14
14
|
setPopoverVisible(false);
|
|
15
15
|
}, css: css(noPermissionStyle), children: i18n.t('pages.fields.view.noWorkflowOrAuth') })), _jsx(View, { workflowData: workflowData, hiddenPopover: () => setPopoverVisible(false), name: name, objectId: objectId })] })) }));
|
|
@@ -29,9 +29,6 @@ interface FlowButtonProps {
|
|
|
29
29
|
};
|
|
30
30
|
hiddenPopover?: () => void;
|
|
31
31
|
readonly?: boolean;
|
|
32
|
-
conditionKey: string;
|
|
33
|
-
fieldTypeConditionKey: string;
|
|
34
|
-
userConditionKey: string;
|
|
35
32
|
flowHandlerActive?: boolean;
|
|
36
33
|
}
|
|
37
34
|
declare const _default: React.NamedExoticComponent<FlowButtonProps>;
|
|
@@ -15,7 +15,7 @@ const CheckInStatus = {
|
|
|
15
15
|
closed: 'closed',
|
|
16
16
|
pending: 'pending',
|
|
17
17
|
};
|
|
18
|
-
const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds, workspaceRoleIds, authRoles, authUsers, authGroups, creatorAuth, authUserFields, authWorkSpaceRoles, scriptValidator, approval, checkIn, conditions = [], handleTransition, target, readonly,
|
|
18
|
+
const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds, workspaceRoleIds, authRoles, authUsers, authGroups, creatorAuth, authUserFields, authWorkSpaceRoles, scriptValidator, approval, checkIn, conditions = [], handleTransition, target, readonly, flowHandlerActive, }) => {
|
|
19
19
|
const [isCheck, setIsCheck] = useState(true);
|
|
20
20
|
const [tip, setTip] = useState('');
|
|
21
21
|
const checkApproval = useCallback(() => {
|
|
@@ -62,7 +62,6 @@ const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds,
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
const transition = {
|
|
65
|
-
conditionKey,
|
|
66
65
|
parameters: {
|
|
67
66
|
fieldType: conditions,
|
|
68
67
|
permissionType: {
|
|
@@ -72,9 +71,7 @@ const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds,
|
|
|
72
71
|
workspaceRoles: authWorkSpaceRoles,
|
|
73
72
|
customFields: authUserFields,
|
|
74
73
|
creatorAuth,
|
|
75
|
-
conditionKey: userConditionKey,
|
|
76
74
|
},
|
|
77
|
-
fieldTypeConditionKey,
|
|
78
75
|
},
|
|
79
76
|
};
|
|
80
77
|
const checkResult = checkTransition(item, transition, { userId, roleIds, groupIds, workspaceRoleIds }, flowHandlerActive);
|
|
@@ -97,9 +94,6 @@ const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds,
|
|
|
97
94
|
roleIds,
|
|
98
95
|
groupIds,
|
|
99
96
|
workspaceRoleIds,
|
|
100
|
-
conditionKey,
|
|
101
|
-
fieldTypeConditionKey,
|
|
102
|
-
userConditionKey,
|
|
103
97
|
flowHandlerActive,
|
|
104
98
|
]);
|
|
105
99
|
useEffect(() => {
|
|
@@ -13,7 +13,7 @@ const UserGroupReadView = props => {
|
|
|
13
13
|
const [value, setValue] = useState([]);
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
var _a;
|
|
16
|
-
setValue(Array.isArray(propsValue) ? propsValue : (_a = [propsValue]) !== null && _a !== void 0 ? _a : []);
|
|
16
|
+
setValue(Array.isArray(propsValue) ? propsValue : ((_a = [propsValue]) !== null && _a !== void 0 ? _a : []));
|
|
17
17
|
}, [propsValue, setValue]);
|
|
18
18
|
const showValue = useMemo(() => {
|
|
19
19
|
var _a, _b;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getValue: (item: any) => any;
|
|
2
|
+
export declare const getLabel: (item: any) => any;
|
|
3
|
+
export declare const getFieldCollectionRealValue: (v: any) => boolean;
|
|
4
|
+
export declare const getRealValueByIqlTo: (value: any[], options: any[], key: string) => any[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { pick } from 'lodash-es';
|
|
2
|
+
import { getArrayValue } from 'lib/array';
|
|
3
|
+
import { isDate } from 'lib/date';
|
|
4
|
+
const pickKey = {
|
|
5
|
+
label: [],
|
|
6
|
+
value: ['objectId', 'icon', 'key', 'icon', 'name', 'enable', 'deleted'],
|
|
7
|
+
username: ['username', 'nickname', 'deleted', 'enabled'],
|
|
8
|
+
key: ['icon', 'key', 'name', 'objectId'],
|
|
9
|
+
};
|
|
10
|
+
export const getValue = item => item.value || item.key || item.id || item.objectId;
|
|
11
|
+
export const getLabel = item => item.label || item.name || item.value;
|
|
12
|
+
export const getFieldCollectionRealValue = v => (isDate(v === null || v === void 0 ? void 0 : v.type) ? !!(v === null || v === void 0 ? void 0 : v.value) : !!(v === null || v === void 0 ? void 0 : v.expression) && !!(v === null || v === void 0 ? void 0 : v.value));
|
|
13
|
+
export const getRealValueByIqlTo = (value, options, key) => {
|
|
14
|
+
if (!value || !options)
|
|
15
|
+
return value;
|
|
16
|
+
return getArrayValue(value)
|
|
17
|
+
.map(item => {
|
|
18
|
+
const curItem = options.find(o => item[key] === o[key]);
|
|
19
|
+
if (!curItem)
|
|
20
|
+
return item;
|
|
21
|
+
return {
|
|
22
|
+
...pick(curItem, pickKey[key]),
|
|
23
|
+
label: curItem.label || curItem.username,
|
|
24
|
+
value: curItem.value || curItem.objectId,
|
|
25
|
+
};
|
|
26
|
+
})
|
|
27
|
+
.filter(Boolean);
|
|
28
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { omit } from 'lodash-es';
|
|
4
|
-
const EditTableCell = ({ overlayClsName, itemTypeId, workspaceId, readonly, id, objectId, property, text, Component, handleChange, }) => {
|
|
4
|
+
const EditTableCell = ({ overlayClsName, itemTypeId, workspaceId, readonly, id, objectId, property, text, Component, dataSource, handleChange, }) => {
|
|
5
5
|
const commonProps = {
|
|
6
6
|
overlayClsName,
|
|
7
7
|
itemTypeId,
|
|
@@ -10,6 +10,7 @@ const EditTableCell = ({ overlayClsName, itemTypeId, workspaceId, readonly, id,
|
|
|
10
10
|
itemId: id,
|
|
11
11
|
objectId,
|
|
12
12
|
value: text,
|
|
13
|
+
dataSource,
|
|
13
14
|
...omit(property, 'defaultValue'),
|
|
14
15
|
};
|
|
15
16
|
return _jsx(Component, { ...commonProps, onChange: handleChange });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useCallback, useRef, useState } from 'react';
|
|
3
3
|
import { isEmpty } from 'lodash-es';
|
|
4
4
|
import EmptyField from '../common/EmptyField';
|
|
@@ -52,14 +52,14 @@ const BaseTableCell = ({ className, cellData, column, rowData, readComponents =
|
|
|
52
52
|
}, [editComponents]);
|
|
53
53
|
if (cellEntered && EditComponent) {
|
|
54
54
|
const { property, data, objectId } = column;
|
|
55
|
-
return (_jsx("div", { className: cls, children: _jsx(EditTableCell, { Component: EditComponent, workspaceId: (_a = rowData.workspace) === null || _a === void 0 ? void 0 : _a.objectId, itemTypeId: (_b = rowData.itemType) === null || _b === void 0 ? void 0 : _b.objectId, property: property, data: data, id: rowData.objectId, readonly: readonly, objectId: objectId, text: cellData, handleChange: handleChange }) }));
|
|
55
|
+
return (_jsx("div", { className: cls, children: _jsx(EditTableCell, { Component: EditComponent, workspaceId: (_a = rowData.workspace) === null || _a === void 0 ? void 0 : _a.objectId, itemTypeId: (_b = rowData.itemType) === null || _b === void 0 ? void 0 : _b.objectId, property: property, data: data, id: rowData.objectId, readonly: readonly, objectId: objectId, text: cellData, handleChange: handleChange, dataSource: column.dataSource }) }));
|
|
56
56
|
}
|
|
57
57
|
if (ReadComponent) {
|
|
58
|
-
return (_jsx("div", { className: cls, onMouseOver: handleMouseOver, children: _jsx(ReadComponent, { readonly: readonly, value: cellData, ...column.property, userData: column.data, options: ((_c = column.data) === null || _c === void 0 ? void 0 : _c.customData) || EMPTY_ARRAY, itemValues: rowData }) }));
|
|
58
|
+
return (_jsx("div", { className: cls, onMouseOver: handleMouseOver, children: _jsx(ReadComponent, { readonly: readonly, value: cellData, ...column.property, userData: column.data, options: ((_c = column.data) === null || _c === void 0 ? void 0 : _c.customData) || EMPTY_ARRAY, itemValues: rowData, objectId: column.objectId, dataSource: column.dataSource }) }));
|
|
59
59
|
}
|
|
60
60
|
const text = transferItem(cellData !== null && cellData !== void 0 ? cellData : rowData[column.dataIndex], readonly);
|
|
61
61
|
return _jsx("div", { className: cls, children: text });
|
|
62
62
|
};
|
|
63
63
|
export const TableCell = props => {
|
|
64
|
-
return
|
|
64
|
+
return _jsx(BaseTableCell, { ...props });
|
|
65
65
|
};
|
|
@@ -9,6 +9,7 @@ import CreatedAtReadView from '../fields/created-at/ReadView';
|
|
|
9
9
|
import CreatedByReadView from '../fields/created-by/ReadView';
|
|
10
10
|
import DataQuoteReadView from '../fields/data-quote/ReadView';
|
|
11
11
|
import DateReadView from '../fields/date/ReadView';
|
|
12
|
+
import DropdownCell from '../fields/dropdown/Cell';
|
|
12
13
|
import DropdownReadView from '../fields/dropdown/ReadView';
|
|
13
14
|
import FileReadView from '../fields/file/ReadView';
|
|
14
15
|
import FormulaReadView from '../fields/formula/ReadView';
|
|
@@ -90,5 +91,6 @@ export const getAllReadComponents = () => {
|
|
|
90
91
|
export const getStandardEditComponents = () => {
|
|
91
92
|
return {
|
|
92
93
|
[FIELD_TYPE_KEY_MAPPINGS.Status]: StatusCell,
|
|
94
|
+
[FIELD_TYPE_KEY_MAPPINGS.Dropdown]: DropdownCell,
|
|
93
95
|
};
|
|
94
96
|
};
|