@giteeteam/apps-team-components 1.2.2 → 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/README.md +21 -28
- package/dist/components/common/EmptyField.d.ts +0 -1
- package/dist/components/common/EmptyField.js +7 -5
- package/dist/components/common/PriceTag.js +26 -23
- package/dist/components/common/expand-component/index.d.ts +22 -0
- package/dist/components/common/expand-component/index.js +67 -0
- package/dist/components/common/expand-component/style.d.ts +2 -0
- package/dist/components/common/expand-component/style.js +10 -0
- package/dist/components/common/item-icon/ItemIcon.d.ts +7 -0
- package/dist/components/common/item-icon/ItemIcon.js +8 -0
- 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.d.ts +19 -0
- package/dist/components/common/overflow-tooltip/OverflowTooltip.js +57 -0
- package/dist/components/common/overflow-tooltip/SimpleOverflowToolTip.js +8 -5
- package/dist/components/common/overflow-tooltip/style/index.js +16 -14
- package/dist/components/common/style/global.js +4 -2
- package/dist/components/common/style/mixin.d.ts +2 -0
- package/dist/components/common/style/mixin.js +20 -0
- package/dist/components/common/user-field/UserAvatar.js +8 -6
- package/dist/components/common/user-field/style/index.js +23 -21
- package/dist/components/common/utils.d.ts +6 -0
- package/dist/components/common/utils.js +63 -5
- package/dist/components/default-empty-icon/config.d.ts +2 -0
- package/dist/components/default-empty-icon/config.js +24 -0
- package/dist/components/default-empty-icon/index.d.ts +5 -0
- package/dist/components/default-empty-icon/index.js +24 -0
- package/dist/components/default-empty-icon/style.d.ts +11 -0
- package/dist/components/default-empty-icon/style.js +67 -0
- package/dist/components/default-empty-icon/types.d.ts +29 -0
- package/dist/components/default-empty-icon/types.js +8 -0
- 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/types.d.ts +1 -0
- package/dist/components/fields/base-component/utils.d.ts +2 -0
- package/dist/components/fields/base-component/utils.js +11 -0
- 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 +10 -7
- package/dist/components/fields/bind-workspace/style/index.js +5 -3
- 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.d.ts +24 -2
- package/dist/components/fields/dropdown/BaseField.js +565 -2
- package/dist/components/fields/dropdown/Cell.d.ts +3 -0
- package/dist/components/fields/dropdown/Cell.js +8 -0
- 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 +9 -0
- package/dist/components/fields/dropdown/data.js +29 -0
- package/dist/components/fields/dropdown/hook.d.ts +102 -0
- package/dist/components/fields/dropdown/hook.js +155 -0
- package/dist/components/fields/dropdown/style.d.ts +16 -0
- package/dist/components/fields/dropdown/style.js +93 -0
- 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.d.ts +11 -0
- package/dist/components/fields/hooks/useViewClass.js +20 -0
- 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 +18 -15
- 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.d.ts +9 -0
- package/dist/components/fields/item-type/ItemTypeIcon.js +31 -0
- 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.d.ts +1 -0
- package/dist/components/fields/item-type/style/index.js +8 -0
- 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 +7 -5
- 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 +54 -51
- 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 +302 -325
- 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 +7 -5
- package/dist/components/fields/team/ReadView.js +10 -8
- package/dist/components/fields/team/style/index.js +5 -3
- 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 +12 -9
- package/dist/components/fields/user-group/BaseField.d.ts +0 -1
- package/dist/components/fields/user-group/ReadView.js +12 -14
- 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.d.ts +4 -0
- package/dist/components/filters/filter-search/utils.js +28 -0
- package/dist/components/item/hooks.js +5 -2
- package/dist/components/table-components/EditTableCell.d.ts +1 -0
- package/dist/components/table-components/EditTableCell.js +8 -4
- package/dist/components/table-components/index.js +14 -11
- package/dist/components/table-components/style/index.js +7 -5
- package/dist/components/table-components/utils.js +50 -45
- package/dist/icons/SyncIconFont.d.ts +6 -0
- package/dist/icons/SyncIconFont.js +17 -0
- package/dist/icons/createFromIconFontClass.d.ts +4 -0
- package/dist/icons/createFromIconFontClass.js +35 -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 +8 -0
- package/dist/icons/empty-icon/large-item@2x.png +0 -0
- package/dist/icons/empty-icon/large-item@2x.png.js +3 -0
- package/dist/icons/empty-icon/large-workspace@2x.png +0 -0
- package/dist/icons/empty-icon/large-workspace@2x.png.js +3 -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/small-default@2x.png.js +3 -0
- package/dist/icons/empty-icon/workspace-empty.svg +127 -0
- package/dist/icons/index.d.ts +58 -1
- package/dist/icons/index.js +315 -19
- package/dist/icons/style/index.d.ts +2 -0
- package/dist/icons/style/index.js +25 -0
- 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.d.ts +1 -0
- package/dist/index.js +47 -46
- package/dist/lib/app/utils.d.ts +2 -0
- package/dist/lib/app/utils.js +18 -0
- package/dist/lib/array.js +5 -44
- package/dist/lib/config.d.ts +14 -0
- package/dist/lib/config.js +47 -0
- package/dist/lib/constants/code.d.ts +4 -0
- package/dist/lib/constants/code.js +6 -0
- package/dist/lib/constants/field.d.ts +1 -0
- package/dist/lib/constants/field.js +5 -0
- 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.d.ts +3 -0
- package/dist/lib/contexts/teamConfig.js +25 -7
- 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/index.d.ts +2 -0
- package/dist/lib/error/log.d.ts +10 -0
- package/dist/lib/error/log.js +28 -0
- package/dist/lib/error/utils.d.ts +14 -0
- package/dist/lib/error/utils.js +38 -0
- package/dist/lib/error/withServerError.d.ts +1 -0
- package/dist/lib/error/withServerError.js +3 -0
- package/dist/lib/fetch.d.ts +45 -0
- package/dist/lib/fetch.js +270 -0
- package/dist/lib/global.d.ts +18 -0
- package/dist/lib/global.js +28 -8
- 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.d.ts +1 -0
- package/dist/lib/i18n.js +6 -2
- package/dist/lib/icons/utils.d.ts +23 -0
- package/dist/lib/icons/utils.js +60 -0
- package/dist/lib/isInOne.js +2 -1
- package/dist/lib/number.js +3 -1
- package/dist/lib/path.d.ts +5 -0
- package/dist/lib/path.js +50 -0
- package/dist/lib/regExp.js +3 -1
- package/dist/lib/router.d.ts +23 -0
- package/dist/lib/router.js +23 -0
- package/dist/lib/storage.d.ts +10 -0
- package/dist/lib/storage.js +27 -0
- 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.d.ts +17 -0
- package/dist/lib/swr/throttleWithCache.js +110 -0
- package/dist/lib/throttleFetch.d.ts +2 -0
- package/dist/lib/throttleFetch.js +68 -0
- package/dist/lib/useConfig.d.ts +8 -0
- package/dist/lib/useConfig.js +31 -0
- 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.d.ts +45 -0
- package/dist/locales/index.js +50 -3
- 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 +19 -23
- package/dist/style/global.d.ts +1 -0
- package/dist/style/global.js +10 -0
- package/package.json +111 -69
- 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/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
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
|
-
import EmptyField from '../../common/EmptyField';
|
|
4
|
-
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
|
|
5
|
-
import { handleValue } from './BaseField';
|
|
3
|
+
import EmptyField from '../../common/EmptyField.js';
|
|
4
|
+
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip.js';
|
|
5
|
+
import { handleValue } from './BaseField.js';
|
|
6
|
+
|
|
6
7
|
var MUTIPLE_MODE;
|
|
7
8
|
(function (MUTIPLE_MODE) {
|
|
8
9
|
MUTIPLE_MODE["multiple"] = "multiple";
|
|
9
10
|
MUTIPLE_MODE["tags"] = "tags";
|
|
10
11
|
})(MUTIPLE_MODE || (MUTIPLE_MODE = {}));
|
|
11
12
|
const getFormattedLabel = ({ label, style = {}, }) => {
|
|
12
|
-
return
|
|
13
|
+
return jsx("span", { style: { borderRadius: 2, color: style === null || style === void 0 ? void 0 : style.color, background: style === null || style === void 0 ? void 0 : style.background }, children: label });
|
|
13
14
|
};
|
|
14
15
|
const DropdownReadView = memo(props => {
|
|
15
16
|
const { value, options, readonly: propsReadonly, userData, mode } = props;
|
|
@@ -45,7 +46,7 @@ const DropdownReadView = memo(props => {
|
|
|
45
46
|
return '';
|
|
46
47
|
return valueArr.map((item, index) => {
|
|
47
48
|
const content = optionsMap[item] ? getFormattedLabel(optionsMap[item]) : item;
|
|
48
|
-
return index === value.length - 1 ? content :
|
|
49
|
+
return index === value.length - 1 ? content : jsxs(Fragment, { children: [content, ","] });
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
else {
|
|
@@ -73,7 +74,8 @@ const DropdownReadView = memo(props => {
|
|
|
73
74
|
.join(',');
|
|
74
75
|
return result;
|
|
75
76
|
}, [options, value]);
|
|
76
|
-
return
|
|
77
|
+
return showValue ? (jsx(SimpleOverflowToolTip, { title: showValueTitle, children: showValue })) : (jsx(EmptyField, { readonly: readonly }));
|
|
77
78
|
});
|
|
78
79
|
DropdownReadView.displayName = 'DropdownReadView';
|
|
79
|
-
|
|
80
|
+
|
|
81
|
+
export { DropdownReadView as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import useFetch from '../../../lib/fetch.js';
|
|
3
|
+
import { throttleFetch } from '../../../lib/throttleFetch.js';
|
|
4
|
+
|
|
5
|
+
const useFetchDropdown = () => {
|
|
6
|
+
const fetch = useFetch();
|
|
7
|
+
const fetchDropdownData = useCallback(({ keyword, workspaceId, page, fieldId, propsValue }) => {
|
|
8
|
+
return throttleFetch({ keyword, workspaceId, page, fieldId }, async () => {
|
|
9
|
+
try {
|
|
10
|
+
const { data } = await fetch.get(`/dropdown/data/${fieldId}`, {
|
|
11
|
+
params: {
|
|
12
|
+
keyword,
|
|
13
|
+
workspaceId,
|
|
14
|
+
page,
|
|
15
|
+
propsValue,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return data === null || data === void 0 ? void 0 : data.data;
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.error('fetchDropdownData_error', e);
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}, [fetch]);
|
|
26
|
+
return fetchDropdownData;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { useFetchDropdown };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
import { Item, ItemType, PointerObject } from 'lib/types/models';
|
|
3
|
+
import { FieldProps, IScreenLabelProps } from '../base-component/types';
|
|
4
|
+
import { IParams } from '../hooks/useParamsAdapter';
|
|
5
|
+
interface optionType {
|
|
6
|
+
key: string;
|
|
7
|
+
value: string;
|
|
8
|
+
disabled: undefined | boolean;
|
|
9
|
+
children: {
|
|
10
|
+
props: selectValue;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface selectValue {
|
|
14
|
+
label: React.ReactNode;
|
|
15
|
+
value: string | number;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
enable?: boolean;
|
|
18
|
+
icon?: string;
|
|
19
|
+
itemType?: PointerObject | ItemType;
|
|
20
|
+
archived?: boolean;
|
|
21
|
+
values?: {
|
|
22
|
+
[propName: string]: any;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export type BaseDropdownProps = SelectProps<any> & FieldProps & {
|
|
26
|
+
value?: string[] | number[] | Array<IParams>;
|
|
27
|
+
options?: selectValue[];
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
onChange?: (e: any, option?: optionType | optionType[] | string) => void;
|
|
30
|
+
onSelect?: (e: any, option: any) => void;
|
|
31
|
+
onOptionsChange?: (options: any[]) => void;
|
|
32
|
+
onBlur?: (e: any) => void;
|
|
33
|
+
onClear?: () => void;
|
|
34
|
+
fetchOptions?: (keywords: string) => Promise<selectValue[]>;
|
|
35
|
+
fetchValues?: (values: string[], key: string) => Promise<selectValue[]>;
|
|
36
|
+
debounceTimeout?: number;
|
|
37
|
+
useChange?: boolean;
|
|
38
|
+
expression?: string;
|
|
39
|
+
iql?: string;
|
|
40
|
+
display?: string;
|
|
41
|
+
objectId?: string;
|
|
42
|
+
dataQuoteInit?: (dates: Item[] | selectValue[], value: string[], display?: string) => selectValue[];
|
|
43
|
+
workspace?: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
valueDisplayWrap?: boolean;
|
|
46
|
+
optionDisplayWrap?: boolean;
|
|
47
|
+
disabledSwr?: boolean;
|
|
48
|
+
onlyValue?: boolean;
|
|
49
|
+
isGroup?: boolean;
|
|
50
|
+
fetchChange?: (value?: boolean) => void;
|
|
51
|
+
displayValueHidden?: boolean;
|
|
52
|
+
disabledLineThrough?: boolean;
|
|
53
|
+
displayWorkspace?: boolean;
|
|
54
|
+
onlyWorkspace?: boolean;
|
|
55
|
+
setOnlyWorkspace?: (e: boolean) => void;
|
|
56
|
+
isShowOnlyWorkspace?: boolean;
|
|
57
|
+
fieldTypeKey?: string;
|
|
58
|
+
iqlKey?: string;
|
|
59
|
+
detailKey?: string;
|
|
60
|
+
fetchOnFocus?: boolean;
|
|
61
|
+
isCascaded?: boolean;
|
|
62
|
+
cascadeCustomData?: selectValue[];
|
|
63
|
+
onlyWorkspaceTip?: string;
|
|
64
|
+
hasCurrentWorkspace?: boolean;
|
|
65
|
+
clickFetch?: boolean;
|
|
66
|
+
iqlToNeedMore?: boolean;
|
|
67
|
+
itemId?: string;
|
|
68
|
+
workspaceId?: string;
|
|
69
|
+
dataSource?: string;
|
|
70
|
+
userData?: Record<string, any>;
|
|
71
|
+
page?: string;
|
|
72
|
+
labelWidth?: number;
|
|
73
|
+
labelAlign?: IScreenLabelProps;
|
|
74
|
+
editMode?: boolean;
|
|
75
|
+
apply?: string;
|
|
76
|
+
hiddenLabel?: boolean;
|
|
77
|
+
screenMode?: string;
|
|
78
|
+
searchComponent?: boolean;
|
|
79
|
+
};
|
|
80
|
+
export declare const EMPTY_OPTIONS: any[];
|
|
81
|
+
export declare const useCommonProps: (props: BaseDropdownProps) => {
|
|
82
|
+
propsValue: any;
|
|
83
|
+
fetchChange: (value?: boolean) => void;
|
|
84
|
+
onSearchChange: any;
|
|
85
|
+
options: any[];
|
|
86
|
+
onlyWorkspace: boolean;
|
|
87
|
+
setOnlyWorkspace: (e: any) => void;
|
|
88
|
+
detailKey: string;
|
|
89
|
+
loading: boolean;
|
|
90
|
+
_setValue: import("react").Dispatch<import("react").SetStateAction<any[]>>;
|
|
91
|
+
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
92
|
+
setOptions: import("react").Dispatch<import("react").SetStateAction<any[]>>;
|
|
93
|
+
propsOptions: any[];
|
|
94
|
+
cachedOptionsRef: import("react").MutableRefObject<selectValue[]>;
|
|
95
|
+
needFetchDataSource: boolean;
|
|
96
|
+
fetchOptions: (keyword?: string) => Promise<any>;
|
|
97
|
+
fetchValues: (value: string[], key: string) => Promise<any>;
|
|
98
|
+
canAsyncFetchOption: boolean;
|
|
99
|
+
cacheSelectOptions: (opts: selectValue[]) => selectValue[];
|
|
100
|
+
value: any[];
|
|
101
|
+
};
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { useState, useMemo, useRef, useCallback } from 'react';
|
|
2
|
+
import { uniqWith, debounce } from 'lodash-es';
|
|
3
|
+
import { getArrayValue } from '../../../lib/array.js';
|
|
4
|
+
import { REMOTE_DATA_QUOTE_FIELD_TYPE } from '../../../lib/constants/field.js';
|
|
5
|
+
import { FIELD_TYPE_KEY_MAPPINGS } from '../../../lib/global.js';
|
|
6
|
+
import { useFetchDropdown } from './data.js';
|
|
7
|
+
|
|
8
|
+
const useGenerateFetchFunction = ({ workspaceId, page, fieldId, propsValue, needFetchDataSource, defaultFetchValues, defaultFetchOptions, }) => {
|
|
9
|
+
const fetchDropdownData = useFetchDropdown();
|
|
10
|
+
const fetchOptions = useMemo(() => {
|
|
11
|
+
if (!needFetchDataSource) {
|
|
12
|
+
return defaultFetchOptions;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return async (keyword) => await fetchDropdownData({
|
|
16
|
+
fieldId,
|
|
17
|
+
keyword: keyword ? keyword : undefined,
|
|
18
|
+
workspaceId,
|
|
19
|
+
page,
|
|
20
|
+
propsValue,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}, [defaultFetchOptions, fetchDropdownData, fieldId, needFetchDataSource, page, propsValue, workspaceId]);
|
|
24
|
+
const fetchValues = useMemo(() => {
|
|
25
|
+
if (!needFetchDataSource) {
|
|
26
|
+
return defaultFetchValues;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return async (value) => await fetchDropdownData({
|
|
30
|
+
fieldId,
|
|
31
|
+
workspaceId,
|
|
32
|
+
page,
|
|
33
|
+
propsValue: JSON.stringify(value),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}, [defaultFetchValues, fetchDropdownData, fieldId, needFetchDataSource, page, workspaceId]);
|
|
37
|
+
return {
|
|
38
|
+
fetchOptions,
|
|
39
|
+
fetchValues,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const EMPTY_OPTIONS = [];
|
|
43
|
+
const useCommonProps = (props) => {
|
|
44
|
+
var _a;
|
|
45
|
+
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;
|
|
46
|
+
const [loading, setLoading] = useState(true);
|
|
47
|
+
const [value, _setValue] = useState([]);
|
|
48
|
+
const propsOptions = useMemo(() => {
|
|
49
|
+
return isCascaded ? cascadeCustomData : _propsOptions;
|
|
50
|
+
}, [_propsOptions, isCascaded, cascadeCustomData]);
|
|
51
|
+
const [options, setOptions] = useState(propsOptions || []);
|
|
52
|
+
const cachedOptionsRef = useRef([]);
|
|
53
|
+
const needFetchDataSource = !!(userData === null || userData === void 0 ? void 0 : userData.source) || !!dataSource;
|
|
54
|
+
const { fetchOptions, fetchValues } = useGenerateFetchFunction({
|
|
55
|
+
workspaceId: workspaceId || workspace,
|
|
56
|
+
page,
|
|
57
|
+
fieldId: objectId,
|
|
58
|
+
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,
|
|
59
|
+
needFetchDataSource,
|
|
60
|
+
defaultFetchOptions: _fetchOptions,
|
|
61
|
+
defaultFetchValues: _fetchValues,
|
|
62
|
+
});
|
|
63
|
+
const canAsyncFetchOption = useMemo(() => typeof fetchValues === 'function' && typeof fetchOptions === 'function', [fetchOptions, fetchValues]);
|
|
64
|
+
const cacheSelectOptions = useCallback((opts) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const optsInit = opts === null || opts === void 0 ? void 0 : opts.map(ele => {
|
|
67
|
+
var _a;
|
|
68
|
+
if (ele === null || ele === void 0 ? void 0 : ele.itemType) {
|
|
69
|
+
return {
|
|
70
|
+
...ele,
|
|
71
|
+
icon: (_a = ele.itemType) === null || _a === void 0 ? void 0 : _a.icon,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return ele;
|
|
75
|
+
});
|
|
76
|
+
if (Array.isArray(cachedOptionsRef.current) && Array.isArray(optsInit)) {
|
|
77
|
+
let cachedOptionsRefCopy = cachedOptionsRef.current;
|
|
78
|
+
if (REMOTE_DATA_QUOTE_FIELD_TYPE.includes(fieldTypeKey)) {
|
|
79
|
+
cachedOptionsRefCopy = (_a = cachedOptionsRef.current) === null || _a === void 0 ? void 0 : _a.map(opt => {
|
|
80
|
+
const currentOpt = optsInit.find(ele => ele.value === opt.value);
|
|
81
|
+
return {
|
|
82
|
+
...opt,
|
|
83
|
+
values: currentOpt === null || currentOpt === void 0 ? void 0 : currentOpt.values,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const cachedOptions = cachedOptionsRefCopy.concat(optsInit);
|
|
88
|
+
let cachedOptionsFilter = cachedOptions;
|
|
89
|
+
if ([FIELD_TYPE_KEY_MAPPINGS.Version, FIELD_TYPE_KEY_MAPPINGS.Team, FIELD_TYPE_KEY_MAPPINGS.Sprint].includes(fieldTypeKey)) {
|
|
90
|
+
cachedOptionsFilter = cachedOptions.map(ele => {
|
|
91
|
+
const versionWithArchived = optsInit === null || optsInit === void 0 ? void 0 : optsInit.find(opt => {
|
|
92
|
+
return opt.value === ele.value;
|
|
93
|
+
});
|
|
94
|
+
return versionWithArchived ? Object.assign(ele, versionWithArchived) : ele;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
cachedOptionsRef.current = uniqWith(cachedOptionsFilter, (a, b) => a.value === b.value);
|
|
98
|
+
}
|
|
99
|
+
return cachedOptionsRef.current;
|
|
100
|
+
}, [fieldTypeKey]);
|
|
101
|
+
const handleSearch = useMemo(() => {
|
|
102
|
+
if (!canAsyncFetchOption) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const searchFunc = _keyword => {
|
|
106
|
+
const keyword = _keyword === null || _keyword === void 0 ? void 0 : _keyword.trim();
|
|
107
|
+
if (!keyword) {
|
|
108
|
+
setOptions(cachedOptionsRef.current);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
setLoading(true);
|
|
112
|
+
fetchOptions(keyword).then(opts => {
|
|
113
|
+
setLoading(false);
|
|
114
|
+
cacheSelectOptions(opts);
|
|
115
|
+
const _value = getArrayValue(value);
|
|
116
|
+
const noExistValues = _value.filter(v => opts.every(item => item.value !== v));
|
|
117
|
+
if (noExistValues.length) {
|
|
118
|
+
opts = noExistValues
|
|
119
|
+
.map(v => { var _a; return (_a = cachedOptionsRef.current) === null || _a === void 0 ? void 0 : _a.find(item => item.value === v); })
|
|
120
|
+
.filter(Boolean)
|
|
121
|
+
.concat(opts);
|
|
122
|
+
}
|
|
123
|
+
setOptions(opts);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
return debounce(searchFunc, debounceTimeout);
|
|
128
|
+
}, [fetchOptions, canAsyncFetchOption, debounceTimeout, cacheSelectOptions, value]);
|
|
129
|
+
const onChangeCurrent = useCallback(e => {
|
|
130
|
+
setOnlyWorkspace(e.target.checked);
|
|
131
|
+
}, [setOnlyWorkspace]);
|
|
132
|
+
return {
|
|
133
|
+
propsValue,
|
|
134
|
+
fetchChange: fetchChange,
|
|
135
|
+
onSearchChange: handleSearch,
|
|
136
|
+
options,
|
|
137
|
+
onlyWorkspace,
|
|
138
|
+
setOnlyWorkspace: onChangeCurrent,
|
|
139
|
+
detailKey,
|
|
140
|
+
loading,
|
|
141
|
+
_setValue,
|
|
142
|
+
setLoading,
|
|
143
|
+
setOptions,
|
|
144
|
+
propsOptions,
|
|
145
|
+
cachedOptionsRef,
|
|
146
|
+
needFetchDataSource,
|
|
147
|
+
fetchOptions,
|
|
148
|
+
fetchValues,
|
|
149
|
+
canAsyncFetchOption,
|
|
150
|
+
cacheSelectOptions,
|
|
151
|
+
value,
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export { EMPTY_OPTIONS, useCommonProps };
|
|
@@ -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,93 @@
|
|
|
1
|
+
import { randomClassName } from '../../../style/common.js';
|
|
2
|
+
import { hoverStyle, hoverIconStyle } from '../../common/style/mixin.js';
|
|
3
|
+
|
|
4
|
+
const dropdownSelectDisabled = `
|
|
5
|
+
text-decoration: line-through;
|
|
6
|
+
`;
|
|
7
|
+
const onlyWorkspaceStyle = `
|
|
8
|
+
padding: 5px 12px;
|
|
9
|
+
`;
|
|
10
|
+
const onlyWorkspaceDividerStyle = `
|
|
11
|
+
&:not(.add-weights) {
|
|
12
|
+
margin: 4px 0;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
const hiddenHoverClass = randomClassName('hidden-hover');
|
|
16
|
+
const displayWrapClass = randomClassName('display-wrap');
|
|
17
|
+
const valueOptionClass = randomClassName('value-option');
|
|
18
|
+
const valueOptionContentClass = randomClassName('value-option-content');
|
|
19
|
+
const valueOptionIconClass = randomClassName('value-option-icon');
|
|
20
|
+
const valueOptionLabelClass = randomClassName('value-option-label');
|
|
21
|
+
const workspaceClass = randomClassName('workspace');
|
|
22
|
+
const hoverIconClass = randomClassName('hover-icon');
|
|
23
|
+
const optionDisplayWrapClass = randomClassName('option-display-wrap');
|
|
24
|
+
const dropdownStyle = (antPrefix) => `
|
|
25
|
+
width: 100%;
|
|
26
|
+
|
|
27
|
+
&:not(.${hiddenHoverClass}) &:not(.${displayWrapClass}) :hover {
|
|
28
|
+
${hoverStyle}
|
|
29
|
+
|
|
30
|
+
.${hoverIconClass} {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.${hoverIconClass} {
|
|
36
|
+
${hoverIconStyle}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${antPrefix}-select {
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.${antPrefix}-select-selection-item) {
|
|
44
|
+
.${workspaceClass} {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.${valueOptionClass} {
|
|
50
|
+
margin-bottom: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.${valueOptionContentClass} {
|
|
54
|
+
width: 100%;
|
|
55
|
+
padding-top: 6px;
|
|
56
|
+
|
|
57
|
+
.${valueOptionIconClass} {
|
|
58
|
+
position: absolute;
|
|
59
|
+
margin-top: 3px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.${valueOptionLabelClass} {
|
|
63
|
+
display: inline-block;
|
|
64
|
+
width: ~'calc(100% - 22px)';
|
|
65
|
+
margin-left: 22px;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.${optionDisplayWrapClass} {
|
|
73
|
+
.${antPrefix}-select-selection-overflow {
|
|
74
|
+
display: block;
|
|
75
|
+
.${antPrefix}-select-selection-overflow-item {
|
|
76
|
+
width: fit-content;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
const dropdownSelectOptionClass = randomClassName('dropdown-select-option');
|
|
82
|
+
const disabledClass = randomClassName('disabled');
|
|
83
|
+
const dropdownSelectStyle = (antPrefix) => `
|
|
84
|
+
.${dropdownSelectOptionClass}.${disabledClass} {
|
|
85
|
+
text-decoration: line-through;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.${antPrefix}-select-selection-item-content {
|
|
89
|
+
text-decoration: line-through;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
export { disabledClass, displayWrapClass, dropdownSelectDisabled, dropdownSelectOptionClass, dropdownSelectStyle, dropdownStyle, hiddenHoverClass, hoverIconClass, onlyWorkspaceDividerStyle, onlyWorkspaceStyle, optionDisplayWrapClass, valueOptionClass, valueOptionContentClass, valueOptionIconClass, valueOptionLabelClass, workspaceClass };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import EmptyField from '../../common/EmptyField';
|
|
4
|
-
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
|
|
3
|
+
import EmptyField from '../../common/EmptyField.js';
|
|
4
|
+
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip.js';
|
|
5
|
+
|
|
5
6
|
const FileReadView = memo(({ value }) => {
|
|
6
7
|
const showValue = (value === null || value === void 0 ? void 0 : value.length)
|
|
7
8
|
? value
|
|
@@ -9,6 +10,7 @@ const FileReadView = memo(({ value }) => {
|
|
|
9
10
|
.filter(Boolean)
|
|
10
11
|
.join(',')
|
|
11
12
|
: '';
|
|
12
|
-
return (
|
|
13
|
+
return (jsx(Fragment, { children: showValue ? (jsx(SimpleOverflowToolTip, { title: showValue, children: showValue })) : (jsx(EmptyField, { readonly: true })) }));
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
export { FileReadView as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
|
-
import EmptyField from '../../common/EmptyField';
|
|
4
|
-
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
|
|
3
|
+
import EmptyField from '../../common/EmptyField.js';
|
|
4
|
+
import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip.js';
|
|
5
|
+
|
|
5
6
|
const FormulaReadView = memo(({ value, addonBefore = '', addonAfter = '' }) => {
|
|
6
7
|
const showValue = useMemo(() => {
|
|
7
8
|
return (value === null || value === void 0 ? void 0 : value.toString()) || '';
|
|
@@ -9,6 +10,7 @@ const FormulaReadView = memo(({ value, addonBefore = '', addonAfter = '' }) => {
|
|
|
9
10
|
const valueWithPrefix = useMemo(() => {
|
|
10
11
|
return `${addonBefore}${showValue || ''}${addonAfter}`;
|
|
11
12
|
}, [addonBefore, showValue, addonAfter]);
|
|
12
|
-
return (
|
|
13
|
+
return (jsx(Fragment, { children: valueWithPrefix ? (jsx(SimpleOverflowToolTip, { title: valueWithPrefix, children: valueWithPrefix })) : (jsx(EmptyField, { readonly: true })) }));
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
export { FormulaReadView as default };
|
|
@@ -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,20 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { SCREEN_TYPE } from '../../../lib/global.js';
|
|
3
|
+
|
|
4
|
+
const useViewClass = ({ screenMode, editing, readonly }) => {
|
|
5
|
+
const isView = useMemo(() => {
|
|
6
|
+
return screenMode === SCREEN_TYPE.View;
|
|
7
|
+
}, [screenMode]);
|
|
8
|
+
const viewClassNames = useMemo(() => {
|
|
9
|
+
return {
|
|
10
|
+
'field-value-view': isView && !editing,
|
|
11
|
+
'field-value-readonly': readonly,
|
|
12
|
+
};
|
|
13
|
+
}, [isView, editing, readonly]);
|
|
14
|
+
return {
|
|
15
|
+
viewClassNames,
|
|
16
|
+
isView,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { useViewClass as default };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { memo, useMemo } from 'react';
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { Popover } from 'antd';
|
|
5
|
-
import EmptyField from '../../common/EmptyField';
|
|
6
|
-
import {
|
|
5
|
+
import EmptyField from '../../common/EmptyField.js';
|
|
6
|
+
import { hyperLinkTipItem, hyperLinkListStyle, hyperLinkItemStyle } from './style/index.js';
|
|
7
|
+
|
|
7
8
|
const HyperLinkCell = memo(props => {
|
|
8
9
|
const { value } = props;
|
|
9
10
|
const list = useMemo(() => {
|
|
10
11
|
return value === null || value === void 0 ? void 0 : value.filter(item => item === null || item === void 0 ? void 0 : item.value);
|
|
11
12
|
}, [value]);
|
|
12
13
|
const content = useMemo(() => {
|
|
13
|
-
return list === null || list === void 0 ? void 0 : list.map(item => (
|
|
14
|
+
return list === null || list === void 0 ? void 0 : list.map(item => (jsx("a", { href: item.value, target: "_blank", rel: "noreferrer", css: css(hyperLinkTipItem), children: item.label }, item.id)));
|
|
14
15
|
}, [list]);
|
|
15
|
-
return (list === null || list === void 0 ? void 0 : list.length) > 0 ? (
|
|
16
|
+
return (list === null || list === void 0 ? void 0 : list.length) > 0 ? (jsx(Popover, { content: content, destroyTooltipOnHide: true, children: jsx("div", { css: css(hyperLinkListStyle), children: list.map((item, index) => (jsxs("a", { href: item.value, target: "_blank", rel: "noreferrer", css: css(hyperLinkItemStyle), children: [item.label, index + 1 !== list.length && jsx("span", { children: ",\u00A0" })] }, item.id))) }) })) : (jsx(EmptyField, { readonly: true }));
|
|
16
17
|
});
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
export { HyperLinkCell as default };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { blue6 } from '../../../../style/common';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { blue6 } from '../../../../style/common.js';
|
|
2
|
+
|
|
3
|
+
const hyperLinkListStyle = `
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
5
6
|
`;
|
|
6
|
-
|
|
7
|
-
${hyperLinkListStyle} & {
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
color: @blue-6;
|
|
10
|
-
text-overflow: ellipsis;
|
|
11
|
-
white-space: nowrap;
|
|
12
|
-
-webkit-line-clamp: 1;
|
|
13
|
-
}
|
|
7
|
+
const hyperLinkItemStyle = `
|
|
8
|
+
${hyperLinkListStyle} & {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
color: @blue-6;
|
|
11
|
+
text-overflow: ellipsis;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
-webkit-line-clamp: 1;
|
|
14
|
+
}
|
|
14
15
|
`;
|
|
15
|
-
|
|
16
|
-
display: block;
|
|
17
|
-
color: ${blue6};
|
|
16
|
+
const hyperLinkTipItem = `
|
|
17
|
+
display: block;
|
|
18
|
+
color: ${blue6};
|
|
18
19
|
`;
|
|
20
|
+
|
|
21
|
+
export { hyperLinkItemStyle, hyperLinkListStyle, hyperLinkTipItem };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import EmptyField from '../../common/EmptyField';
|
|
1
|
+
import { jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import EmptyField from '../../common/EmptyField.js';
|
|
3
|
+
|
|
3
4
|
const ItemGroupReadView = ({ value }) => {
|
|
4
|
-
return
|
|
5
|
+
return jsx(Fragment, { children: (value === null || value === void 0 ? void 0 : value.name) || jsx(EmptyField, { readonly: true }) });
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
export { ItemGroupReadView as default };
|
|
@@ -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;
|