@giteeteam/apps-team-components 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fields/bind-workspace/ReadView.js +3 -5
- package/dist/components/fields/bind-workspace/ValueDisplay.d.ts +1 -0
- package/dist/components/fields/bind-workspace/ValueDisplay.js +6 -4
- package/dist/components/fields/bind-workspace/hooks.d.ts +1 -0
- package/dist/components/fields/bind-workspace/hooks.js +2 -0
- package/dist/components/fields/workspace/ReadView.js +2 -2
- package/package.json +1 -1
|
@@ -4,24 +4,22 @@ import { ClassNames } from '@emotion/react';
|
|
|
4
4
|
import { useCreation } from 'ahooks';
|
|
5
5
|
import { getArrayValue } from '../../../lib/array.js';
|
|
6
6
|
import useI18n from '../../../lib/hooks/useI18n.js';
|
|
7
|
-
import { isInCMCC } from '../../../lib/isInCMCC.js';
|
|
8
7
|
import EmptyField from '../../common/EmptyField.js';
|
|
9
8
|
import { tooltipOverflowStyle, getTooltipMaxlineStyle } from '../../common/overflow-tooltip/style/index.js';
|
|
10
9
|
import { useToWorkspacePage } from './hooks.js';
|
|
11
10
|
import { pointerStyle } from './style/index.js';
|
|
12
11
|
import ValueDisplay from './ValueDisplay.js';
|
|
13
12
|
|
|
14
|
-
const inCMCC = isInCMCC();
|
|
15
13
|
const BindWorkspaceReadView = memo(props => {
|
|
16
14
|
const { value: _value, mode } = props;
|
|
17
15
|
const { t } = useI18n();
|
|
18
|
-
const { toWorkspacePage } = useToWorkspacePage();
|
|
16
|
+
const { toWorkspacePage, disableLink } = useToWorkspacePage();
|
|
19
17
|
const value = useCreation(() => getArrayValue(_value), [_value]);
|
|
20
|
-
const title = useCreation(() => (
|
|
18
|
+
const title = useCreation(() => (disableLink ? '' : t('pages.fields.default.toWorkspacePage')), [t, disableLink]);
|
|
21
19
|
return (jsx(ClassNames, { children: ({ cx, css }) => {
|
|
22
20
|
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
23
21
|
return jsx(EmptyField, { readonly: true });
|
|
24
|
-
return (jsx(ValueDisplay, { title: title, mode: mode, value: value, wrapperClassName: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(1))), itemClassName: cx(css(pointerStyle)), onClick: toWorkspacePage }));
|
|
22
|
+
return (jsx(ValueDisplay, { title: title, mode: mode, value: value, wrapperClassName: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(1))), itemClassName: disableLink ? '' : cx(css(pointerStyle)), onClick: toWorkspacePage, disabled: disableLink }));
|
|
25
23
|
} }));
|
|
26
24
|
});
|
|
27
25
|
BindWorkspaceReadView.displayName = 'BindWorkspaceReadView';
|
|
@@ -12,16 +12,18 @@ const SingleValueDisplay = memo(({ value, onClick, wrapperClassName, itemClassNa
|
|
|
12
12
|
const [workspace] = getArrayValue(value);
|
|
13
13
|
return (jsx(WorkspaceLabel, { title: title, onClick: onClick, className: `${wrapperClassName} ${itemClassName} single`, workspace: workspace }));
|
|
14
14
|
});
|
|
15
|
-
const MultipleValueDisplay = memo(({ value, onClick, itemClassName, title }) => {
|
|
15
|
+
const MultipleValueDisplay = memo(({ value, onClick, itemClassName, title, disabled }) => {
|
|
16
16
|
const showValue = value
|
|
17
17
|
.map(workspace => workspace === null || workspace === void 0 ? void 0 : workspace.name)
|
|
18
18
|
.filter(Boolean)
|
|
19
19
|
.join(',');
|
|
20
20
|
if (!showValue)
|
|
21
21
|
return null;
|
|
22
|
-
return (jsx(OverflowTooltip, { title:
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return (jsx(OverflowTooltip, { title: disabled
|
|
23
|
+
? ''
|
|
24
|
+
: value.map((workspace, index) => {
|
|
25
|
+
return (jsxs(Fragment, { children: [jsx(WorkspaceLabel, { title: title, onClick: onClick, className: itemClassName, workspace: workspace }), index !== value.length - 1 && ','] }, workspace.key));
|
|
26
|
+
}), enterable: true, alwaysShowTooltip: true, children: showValue }));
|
|
25
27
|
});
|
|
26
28
|
MultipleValueDisplay.displayName = 'MultipleValueDisplay';
|
|
27
29
|
SingleValueDisplay.displayName = 'SingleValueDisplay';
|
|
@@ -8,6 +8,7 @@ const useToWorkspacePage = () => {
|
|
|
8
8
|
const { publicRuntimeConfig, isMicroApp } = useTeamConfig();
|
|
9
9
|
const inOne = isInOne(publicRuntimeConfig.gateway, isMicroApp);
|
|
10
10
|
const inCmcc = isInCMCC(publicRuntimeConfig);
|
|
11
|
+
const disableLink = inCmcc;
|
|
11
12
|
const tenant = useTenant();
|
|
12
13
|
const toWorkspacePage = useMemoizedFn((workspaceKey) => {
|
|
13
14
|
if (inCmcc)
|
|
@@ -19,6 +20,7 @@ const useToWorkspacePage = () => {
|
|
|
19
20
|
});
|
|
20
21
|
return {
|
|
21
22
|
toWorkspacePage,
|
|
23
|
+
disableLink,
|
|
22
24
|
};
|
|
23
25
|
};
|
|
24
26
|
|
|
@@ -8,9 +8,9 @@ import { pointerStyle } from '../bind-workspace/style/index.js';
|
|
|
8
8
|
|
|
9
9
|
const WorkspaceReadView = memo(({ value }) => {
|
|
10
10
|
const { name, key } = value || {};
|
|
11
|
-
const { toWorkspacePage } = useToWorkspacePage();
|
|
11
|
+
const { toWorkspacePage, disableLink } = useToWorkspacePage();
|
|
12
12
|
return (jsx(ClassNames, { children: ({ cx, css }) => {
|
|
13
|
-
return name ? (jsx("span", { className: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(1)), css(pointerStyle)), title: name, onClick: () => toWorkspacePage(key), children: name })) : (jsx(EmptyField, { readonly: true }));
|
|
13
|
+
return name ? (jsx("span", { className: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(1)), !disableLink && css(pointerStyle)), title: name, onClick: () => toWorkspacePage(key), children: name })) : (jsx(EmptyField, { readonly: true }));
|
|
14
14
|
} }));
|
|
15
15
|
});
|
|
16
16
|
WorkspaceReadView.displayName = 'WorkspaceReadView';
|