@giteeteam/apps-team-components 1.8.0 → 1.9.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 +1 -0
- package/dist/components/common/overflow-tooltip/OverflowTooltip.js +2 -6
- package/dist/components/common/overflow-tooltip/TooltipContent.d.ts +11 -0
- package/dist/components/common/overflow-tooltip/TooltipContent.js +13 -0
- package/dist/components/fields/bind-workspace/ReadView.d.ts +4 -1
- package/dist/components/fields/bind-workspace/ReadView.js +5 -4
- package/dist/components/fields/bind-workspace/ValueDisplay.d.ts +11 -0
- package/dist/components/fields/bind-workspace/ValueDisplay.js +36 -0
- package/dist/components/fields/bind-workspace/hooks.js +8 -6
- package/dist/components/fields/bind-workspace/style/index.d.ts +1 -1
- package/dist/components/fields/bind-workspace/style/index.js +5 -1
- package/dist/components/fields/status/TransitionPanel.js +3 -1
- package/dist/lib/array.d.ts +2 -0
- package/dist/lib/array.js +14 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { useState, useRef, useCallback, useEffect, memo } from 'react';
|
|
3
|
-
import { ClassNames } from '@emotion/react';
|
|
4
3
|
import { Tooltip } from 'antd';
|
|
5
|
-
import {
|
|
4
|
+
import { TooltipContent } from './TooltipContent.js';
|
|
6
5
|
|
|
7
6
|
const isTextOverflow = element => {
|
|
8
7
|
return new Promise(resolve => {
|
|
@@ -47,10 +46,7 @@ const OverflowTooltip = props => {
|
|
|
47
46
|
if (!children) {
|
|
48
47
|
return null;
|
|
49
48
|
}
|
|
50
|
-
|
|
51
|
-
!enterable && setVisible(false);
|
|
52
|
-
}, children: children })) }));
|
|
53
|
-
return (jsx(Tooltip, { trigger: trigger, placement: placement, overlayStyle: overlayStyle, overlayClassName: overlayClassName, title: title, open: visible, onOpenChange: handleVisibleChange, getPopupContainer: getContainer, destroyTooltipOnHide: true, children: content }));
|
|
49
|
+
return (jsx(Tooltip, { trigger: trigger, placement: placement, overlayStyle: overlayStyle, overlayClassName: overlayClassName, title: title, open: visible, onOpenChange: handleVisibleChange, getPopupContainer: getContainer, destroyTooltipOnHide: true, children: jsx(TooltipContent, { ref: elRef, maxline: maxline, style: style, enterable: enterable, className: className, setVisible: setVisible, content: children }) }));
|
|
54
50
|
};
|
|
55
51
|
var OverflowTooltip$1 = memo(OverflowTooltip);
|
|
56
52
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
interface TooltipContentProps {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
maxline?: number;
|
|
5
|
+
enterable?: boolean;
|
|
6
|
+
setVisible: (visible: boolean) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const TooltipContent: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLElement>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { ClassNames } from '@emotion/react';
|
|
4
|
+
import { tooltipOverflowStyle, getTooltipMaxlineStyle } from './style/index.js';
|
|
5
|
+
|
|
6
|
+
const TooltipContent = forwardRef((props, elRef) => {
|
|
7
|
+
const { maxline = 1, enterable, setVisible, content, className, ...rest } = props;
|
|
8
|
+
return (jsx(ClassNames, { children: ({ cx, css }) => (jsx("span", { ...rest, ref: elRef, className: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(maxline)), className), onMouseLeave: () => {
|
|
9
|
+
!enterable && setVisible(false);
|
|
10
|
+
}, children: content })) }));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { TooltipContent };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { ReadViewBaseProps } from '../types';
|
|
2
|
-
|
|
2
|
+
type BindWorkspaceReadViewProps = ReadViewBaseProps & {
|
|
3
|
+
mode?: 'multiple';
|
|
4
|
+
};
|
|
5
|
+
declare const BindWorkspaceReadView: import("react").NamedExoticComponent<BindWorkspaceReadViewProps>;
|
|
3
6
|
export default BindWorkspaceReadView;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { ClassNames } from '@emotion/react';
|
|
4
|
-
import useI18n from '../../../lib/hooks/useI18n.js';
|
|
5
4
|
import EmptyField from '../../common/EmptyField.js';
|
|
6
5
|
import { tooltipOverflowStyle, getTooltipMaxlineStyle } from '../../common/overflow-tooltip/style/index.js';
|
|
7
6
|
import { useToWorkspacePage } from './hooks.js';
|
|
8
7
|
import { pointerStyle } from './style/index.js';
|
|
8
|
+
import ValueDisplay from './ValueDisplay.js';
|
|
9
9
|
|
|
10
10
|
const BindWorkspaceReadView = memo(props => {
|
|
11
|
-
const { value } = props;
|
|
12
|
-
const { t } = useI18n();
|
|
11
|
+
const { value, mode } = props;
|
|
13
12
|
const { toWorkspacePage } = useToWorkspacePage();
|
|
14
13
|
return (jsx(ClassNames, { children: ({ cx, css }) => {
|
|
15
|
-
|
|
14
|
+
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
15
|
+
return jsx(EmptyField, { readonly: true });
|
|
16
|
+
return (jsx(ValueDisplay, { mode: mode, value: value, wrapperClassName: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(1))), itemClassName: cx(css(pointerStyle)), onClick: toWorkspacePage }));
|
|
16
17
|
} }));
|
|
17
18
|
});
|
|
18
19
|
BindWorkspaceReadView.displayName = 'BindWorkspaceReadView';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ValueDisplayBaseProps {
|
|
2
|
+
value: any[];
|
|
3
|
+
onClick?: (workspaceKey: string) => void;
|
|
4
|
+
wrapperClassName?: string;
|
|
5
|
+
itemClassName?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ValueDisplayProps extends ValueDisplayBaseProps {
|
|
8
|
+
mode: string;
|
|
9
|
+
}
|
|
10
|
+
declare const ValueDisplay: import("react").NamedExoticComponent<ValueDisplayProps>;
|
|
11
|
+
export default ValueDisplay;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { memo, Fragment } from 'react';
|
|
3
|
+
import OverflowTooltip from '../../common/overflow-tooltip/OverflowTooltip.js';
|
|
4
|
+
import useI18n from '../../../lib/hooks/useI18n.js';
|
|
5
|
+
|
|
6
|
+
const WorkspaceLabel = memo(props => {
|
|
7
|
+
const { title, onClick, className, workspace } = props;
|
|
8
|
+
const { key, name } = workspace;
|
|
9
|
+
return (jsx("span", { title: title, onClick: () => onClick(key), className: className, children: name }));
|
|
10
|
+
});
|
|
11
|
+
const SingleValueDisplay = memo(({ value, onClick, wrapperClassName, itemClassName }) => {
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
const [workspace] = value;
|
|
14
|
+
return (jsx(WorkspaceLabel, { title: t('pages.fields.default.toWorkspacePage'), onClick: onClick, className: `${wrapperClassName} ${itemClassName}`, workspace: workspace }));
|
|
15
|
+
});
|
|
16
|
+
const MultipleValueDisplay = memo(({ value, onClick, itemClassName }) => {
|
|
17
|
+
const { t } = useI18n();
|
|
18
|
+
const showValue = value
|
|
19
|
+
.map(workspace => workspace === null || workspace === void 0 ? void 0 : workspace.name)
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join(',');
|
|
22
|
+
if (!showValue)
|
|
23
|
+
return null;
|
|
24
|
+
return (jsx(OverflowTooltip, { title: value.map((workspace, index) => {
|
|
25
|
+
return (jsxs(Fragment, { children: [jsx(WorkspaceLabel, { title: t('pages.fields.default.toWorkspacePage'), onClick: onClick, className: itemClassName, workspace: workspace }), index !== value.length - 1 && ','] }, workspace.key));
|
|
26
|
+
}), enterable: true, alwaysShowTooltip: true, children: showValue }));
|
|
27
|
+
});
|
|
28
|
+
MultipleValueDisplay.displayName = 'MultipleValueDisplay';
|
|
29
|
+
SingleValueDisplay.displayName = 'SingleValueDisplay';
|
|
30
|
+
const ValueDisplay = memo(props => {
|
|
31
|
+
const { mode, ...rest } = props;
|
|
32
|
+
return mode === 'multiple' ? jsx(MultipleValueDisplay, { ...rest }) : jsx(SingleValueDisplay, { ...rest });
|
|
33
|
+
});
|
|
34
|
+
ValueDisplay.displayName = 'ValueDisplay';
|
|
35
|
+
|
|
36
|
+
export { ValueDisplay as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemoizedFn } from 'ahooks';
|
|
1
2
|
import useTeamConfig from '../../../lib/hooks/useTeamConfig.js';
|
|
2
3
|
import useTenant from '../../../lib/hooks/useTenant.js';
|
|
3
4
|
import isInOne from '../../../lib/isInOne.js';
|
|
@@ -6,13 +7,14 @@ const useToWorkspacePage = () => {
|
|
|
6
7
|
const { publicRuntimeConfig, isMicroApp } = useTeamConfig();
|
|
7
8
|
const inOne = isInOne(publicRuntimeConfig.gateway, isMicroApp);
|
|
8
9
|
const tenant = useTenant();
|
|
10
|
+
const toWorkspacePage = useMemoizedFn((workspaceKey) => {
|
|
11
|
+
const url = inOne
|
|
12
|
+
? `/${tenant}/${workspaceKey}`
|
|
13
|
+
: `${publicRuntimeConfig.basePath}/${tenant}/workspaces/${workspaceKey}`;
|
|
14
|
+
window.open(`${url}?from=item`, '_blank');
|
|
15
|
+
});
|
|
9
16
|
return {
|
|
10
|
-
toWorkspacePage
|
|
11
|
-
const url = inOne
|
|
12
|
-
? `/${tenant}/${workspaceKey}`
|
|
13
|
-
: `${publicRuntimeConfig.basePath}/${tenant}/workspaces/${workspaceKey}?from=item`;
|
|
14
|
-
window.open(`${url}?from=item`, '_blank');
|
|
15
|
-
},
|
|
17
|
+
toWorkspacePage,
|
|
16
18
|
};
|
|
17
19
|
};
|
|
18
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pointerStyle = "\n
|
|
1
|
+
export declare const pointerStyle = "\n cursor: pointer;\n &:hover {\n color: #5ea1ff;\n }\n";
|
|
@@ -5,6 +5,7 @@ import { proximaSdk, useListener } from '@giteeteam/proxima-sdk-js';
|
|
|
5
5
|
import { message } from 'antd';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
import { cloneDeep } from 'lodash-es';
|
|
8
|
+
import { WorkflowStatusType } from '../../../lib/global.js';
|
|
8
9
|
import useCurrentUser from '../../../lib/hooks/useCurrentUser.js';
|
|
9
10
|
import useWorkflowConfig from '../../../lib/hooks/useWorkflowConfig.js';
|
|
10
11
|
import { i18n } from '../../../lib/i18n.js';
|
|
@@ -276,7 +277,8 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
276
277
|
if (flowHandlerActive) {
|
|
277
278
|
if (transitionStep === TransitionStepType.SelectTransition) {
|
|
278
279
|
const nextStateTransition = workflowData.transitions.find(t => t.source.id === target.key);
|
|
279
|
-
|
|
280
|
+
const nextState = workflowData.nodes.find(node => node.id === target.key);
|
|
281
|
+
if (nextStateTransition && (nextState === null || nextState === void 0 ? void 0 : nextState.key) !== WorkflowStatusType.Finished) {
|
|
280
282
|
setCurrentFlowHandler(undefined);
|
|
281
283
|
setFlowTask(tasks.find(task => task.name === transitionText));
|
|
282
284
|
setTransitionStep(TransitionStepType.SelectFlowHandler);
|
package/dist/lib/array.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export declare const serializationArrayByKey: (list: any[], keyPath: string) =>
|
|
|
7
7
|
export declare const createHash: () => number;
|
|
8
8
|
export declare function parseArray(str: string): string[];
|
|
9
9
|
export declare const getArrayValue: <T = any>(value: T) => T;
|
|
10
|
+
export declare const getStringArrayValue: (value: string, defaultValue?: any, isEmptyUseDefault?: boolean) => string[];
|
|
11
|
+
export declare const formatArrayToStringArray: (value: string[], defaultValue?: any) => string;
|
|
10
12
|
export {};
|
package/dist/lib/array.js
CHANGED
|
@@ -43,5 +43,18 @@ function parseArray(str) {
|
|
|
43
43
|
return [];
|
|
44
44
|
}
|
|
45
45
|
const getArrayValue = (value) => { var _a; return (_a = (isArray(value) ? value : [value])) === null || _a === void 0 ? void 0 : _a.filter(Boolean); };
|
|
46
|
+
const getStringArrayValue = (value, defaultValue = undefined, isEmptyUseDefault = false) => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (!value)
|
|
49
|
+
return defaultValue;
|
|
50
|
+
const result = (_a = value.split) === null || _a === void 0 ? void 0 : _a.call(value, ',');
|
|
51
|
+
if (isEmptyUseDefault && !(result === null || result === void 0 ? void 0 : result.length)) {
|
|
52
|
+
return defaultValue;
|
|
53
|
+
}
|
|
54
|
+
return result !== null && result !== void 0 ? result : defaultValue;
|
|
55
|
+
};
|
|
56
|
+
const formatArrayToStringArray = (value, defaultValue = undefined) => {
|
|
57
|
+
return getArrayValue(value).join(',') || defaultValue;
|
|
58
|
+
};
|
|
46
59
|
|
|
47
|
-
export { arrayDiff, createHash, getArrayValue, parseArray, serializationArrayByKey };
|
|
60
|
+
export { arrayDiff, createHash, formatArrayToStringArray, getArrayValue, getStringArrayValue, parseArray, serializationArrayByKey };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giteeteam/apps-team-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-alpha.1",
|
|
4
4
|
"description": "Gitee team components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -106,5 +106,6 @@
|
|
|
106
106
|
"workerDirectory": [
|
|
107
107
|
"public"
|
|
108
108
|
]
|
|
109
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"packageManager": "pnpm@7.32.5+sha512.4395951a16c3553123c8693f9e350e9ce18824f602b5af158fb17c2d6ee10a53251544522e31e3003d3b1b9bf5422d25ca14f86e8d10053c552674ee9e33fd15"
|
|
110
111
|
}
|