@giteeteam/apps-team-components 1.10.2 → 1.10.4

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.
@@ -4,8 +4,6 @@ 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 useTeamConfig from '../../../lib/hooks/useTeamConfig.js';
8
- import { isInCMCC } from '../../../lib/isInCMCC.js';
9
7
  import EmptyField from '../../common/EmptyField.js';
10
8
  import { tooltipOverflowStyle, getTooltipMaxlineStyle } from '../../common/overflow-tooltip/style/index.js';
11
9
  import { useToWorkspacePage } from './hooks.js';
@@ -15,15 +13,13 @@ import ValueDisplay from './ValueDisplay.js';
15
13
  const BindWorkspaceReadView = memo(props => {
16
14
  const { value: _value, mode } = props;
17
15
  const { t } = useI18n();
18
- const { publicRuntimeConfig } = useTeamConfig();
19
- const inCMCC = isInCMCC(publicRuntimeConfig);
20
- const { toWorkspacePage } = useToWorkspacePage();
16
+ const { toWorkspacePage, disableLink } = useToWorkspacePage();
21
17
  const value = useCreation(() => getArrayValue(_value), [_value]);
22
- const title = useCreation(() => (inCMCC ? '' : t('pages.fields.default.toWorkspacePage')), [t, inCMCC]);
18
+ const title = useCreation(() => (disableLink ? '' : t('pages.fields.default.toWorkspacePage')), [t, disableLink]);
23
19
  return (jsx(ClassNames, { children: ({ cx, css }) => {
24
20
  if (!(value === null || value === void 0 ? void 0 : value.length))
25
21
  return jsx(EmptyField, { readonly: true });
26
- 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 }));
27
23
  } }));
28
24
  });
29
25
  BindWorkspaceReadView.displayName = 'BindWorkspaceReadView';
@@ -4,6 +4,7 @@ interface ValueDisplayBaseProps {
4
4
  onClick?: (workspaceKey: string) => void;
5
5
  wrapperClassName?: string;
6
6
  itemClassName?: string;
7
+ disabled?: boolean;
7
8
  }
8
9
  interface ValueDisplayProps extends ValueDisplayBaseProps {
9
10
  mode: string;
@@ -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: value.map((workspace, index) => {
23
- return (jsxs(Fragment, { children: [jsx(WorkspaceLabel, { title: title, onClick: onClick, className: itemClassName, workspace: workspace }), index !== value.length - 1 && ''] }, workspace.key));
24
- }), enterable: true, alwaysShowTooltip: true, children: showValue }));
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';
@@ -1,3 +1,4 @@
1
1
  export declare const useToWorkspacePage: () => {
2
2
  toWorkspacePage: (workspaceKey: string) => void;
3
+ disableLink: boolean;
3
4
  };
@@ -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
 
@@ -15,6 +15,7 @@ interface TransitionComponentProps {
15
15
  flowUsers: Array<Record<string, any>>;
16
16
  loadingFlowUsers: boolean;
17
17
  fetchFlowUsers: (itemId: string, status: string, keyword?: string) => Promise<void>;
18
+ getPopupContainer?: (node: HTMLElement) => HTMLElement;
18
19
  }
19
20
  declare const _default: React.NamedExoticComponent<TransitionComponentProps>;
20
21
  export default _default;
@@ -12,7 +12,7 @@ import { workflowContentStyle, statePopoverStyle, flowStateStyle, flowStateInWor
12
12
  import TransitionPanel from './TransitionPanel.js';
13
13
 
14
14
  const Transition = props => {
15
- const { itemId, itemType, workspace, objectId, onTransitionSuccess, name, type, readonly, apply, flowUsers, loadingFlowUsers, fetchFlowUsers, } = props;
15
+ const { itemId, itemType, workspace, objectId, onTransitionSuccess, name, type, readonly, apply, flowUsers, loadingFlowUsers, fetchFlowUsers, getPopupContainer, } = props;
16
16
  const [popoverVisible, setPopoverVisible] = useState(false);
17
17
  const [flowing, setFlowing] = useState(false);
18
18
  const isProcessing = useRef(false);
@@ -36,7 +36,7 @@ const Transition = props => {
36
36
  return;
37
37
  }
38
38
  setPopoverVisible(visible);
39
- }, getPopupContainer: () => document.body, trigger: "click", placement: "bottomLeft", content: jsx(TransitionPanel, { itemId: itemId, itemType: itemType, workspace: workspace, objectId: showData.objectId, onTransitionSuccess: transitionSuccess, name: name, readonly: readonly, setPopoverVisible: setPopoverVisible, isProcessing: isProcessing, flowing: flowing, setFlowing: setFlowing, flowHandlerActive: props.flowHandlerActive, flowUsers: flowUsers, loadingFlowUsers: loadingFlowUsers, fetchFlowUsers: fetchFlowUsers }), children: jsxs(Button, { type: "link", className: cx('status-btn', css(flowStateStyle), css(flowStateInWorkflowStyle), css(flowStateButtonStyle), css(stateBtnStyle), {
39
+ }, getPopupContainer: getPopupContainer || (() => document.body), trigger: "click", placement: "bottomLeft", content: jsx(TransitionPanel, { itemId: itemId, itemType: itemType, workspace: workspace, objectId: showData.objectId, onTransitionSuccess: transitionSuccess, name: name, readonly: readonly, setPopoverVisible: setPopoverVisible, isProcessing: isProcessing, flowing: flowing, setFlowing: setFlowing, flowHandlerActive: props.flowHandlerActive, flowUsers: flowUsers, loadingFlowUsers: loadingFlowUsers, fetchFlowUsers: fetchFlowUsers }), children: jsxs(Button, { type: "link", className: cx('status-btn', css(flowStateStyle), css(flowStateInWorkflowStyle), css(flowStateButtonStyle), css(stateBtnStyle), {
40
40
  [css(noStateStyle)]: !showData.name,
41
41
  }), style: {
42
42
  backgroundColor: (_a = WorkFlowStatusColor[showData.type]) === null || _a === void 0 ? void 0 : _a.bgColor,
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.10.2",
3
+ "version": "1.10.4",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",