@giteeteam/apps-team-components 1.1.5 → 1.2.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/dist/components/fields/status/Cell.js +1 -1
- package/dist/components/fields/status/Field.d.ts +1 -0
- package/dist/components/fields/status/SelectFlowHandler.d.ts +16 -0
- package/dist/components/fields/status/SelectFlowHandler.js +75 -0
- package/dist/components/fields/status/SelectTransition.d.ts +26 -0
- package/dist/components/fields/status/SelectTransition.js +17 -0
- package/dist/components/fields/status/Transition.d.ts +4 -0
- package/dist/components/fields/status/Transition.js +2 -2
- package/dist/components/fields/status/TransitionButton.d.ts +1 -0
- package/dist/components/fields/status/TransitionButton.js +3 -2
- package/dist/components/fields/status/TransitionPanel.d.ts +4 -0
- package/dist/components/fields/status/TransitionPanel.js +36 -17
- package/dist/components/fields/status/style/index.d.ts +12 -2
- package/dist/components/fields/status/style/index.js +158 -2
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.js +12 -0
- package/dist/icons/svg/ArrowBack.svg +1 -0
- package/dist/icons/svg/Done.svg +1 -0
- package/dist/icons/svg/Search.svg +1 -0
- package/dist/lib/workflow.d.ts +1 -1
- package/dist/lib/workflow.js +16 -1
- package/dist/locales/index.d.ts +24 -0
- package/dist/locales/index.js +24 -0
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const StatusCell = React.memo(props => {
|
|
|
12
12
|
setShowData({ objectId, name, type });
|
|
13
13
|
onChange === null || onChange === void 0 ? void 0 : onChange({ objectId, name, type });
|
|
14
14
|
}, [onChange]);
|
|
15
|
-
return (_jsx("div", { className: `${overlayClsName} field-cell-layout field-layout ${!readonly ? 'pointer' : ''}`, children: readonly ? (_jsx(ReadView, { value: showData, readonly: true })) : (_jsx(Transition, { itemId: itemId, ...showData, apply: "cell", workspace: workspaceId, itemType: itemTypeId, onTransitionSuccess: handleChange })) }));
|
|
15
|
+
return (_jsx("div", { className: `${overlayClsName} field-cell-layout field-layout ${!readonly ? 'pointer' : ''}`, children: readonly ? (_jsx(ReadView, { value: showData, readonly: true })) : (_jsx(Transition, { itemId: itemId, ...showData, ...(props.flowHandler || {}), apply: "cell", workspace: workspaceId, itemType: itemTypeId, onTransitionSuccess: handleChange })) }));
|
|
16
16
|
});
|
|
17
17
|
StatusCell.displayName = 'StatusCell';
|
|
18
18
|
export default StatusCell;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SelectFlowHandlerProps {
|
|
3
|
+
itemId: string;
|
|
4
|
+
onBack: () => void;
|
|
5
|
+
task: Record<string, any>;
|
|
6
|
+
users: Array<Record<string, any>>;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
loadingUser: boolean;
|
|
9
|
+
fetchUsers: (itemId: string, keyword?: string) => Promise<void>;
|
|
10
|
+
handleTransition: (updateTask: string, screenId: string, script: string, flowHandler?: Array<{
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}>) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: React.NamedExoticComponent<SelectFlowHandlerProps>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import React, { memo, useCallback, useEffect } from 'react';
|
|
3
|
+
import { ClassNames, css } from '@emotion/react';
|
|
4
|
+
import { Button, Input, message, Spin } from 'antd';
|
|
5
|
+
import { cloneDeep, debounce } from 'lodash-es';
|
|
6
|
+
import { ArrowBackIcon, DoneIcon, SearchIcon } from '../../../icons';
|
|
7
|
+
import { WorkFlowStatusColor } from '../../../lib/global';
|
|
8
|
+
import { i18n } from '../../../lib/i18n';
|
|
9
|
+
import BaseOverflowTooltip from '../../common/overflow-tooltip/BaseOverflowTooltip';
|
|
10
|
+
import { FlowHandlerHeader, FlowHandlerSearchWrapper, FlowHandlerSelectContent, FlowHandlerSelectItem, FlowHandlerSelectMessage, FlowHandlerSubmitWrapper, FlowHandlerWrapper, flowStateStyle, iconStyle, overflowStyle, overflowStyleText, stateBoxStyle, tooltipStyle, } from './style';
|
|
11
|
+
const SelectFlowHandler = ({ itemId, task, onBack, users, loading, loadingUser, fetchUsers, handleTransition, }) => {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const [selectedUsers, setSelectedUsers] = React.useState([]);
|
|
14
|
+
const [selectedUserIds, setSelectedUserIds] = React.useState([]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
fetchUsers(itemId);
|
|
17
|
+
}, [itemId]);
|
|
18
|
+
const onSearch = debounce(useCallback((value) => {
|
|
19
|
+
fetchUsers(itemId, value);
|
|
20
|
+
}, [fetchUsers, itemId]), 300);
|
|
21
|
+
const selectUser = useCallback(userData => {
|
|
22
|
+
const userId = selectedUserIds.find(id => id === userData.objectId);
|
|
23
|
+
let newIds = [], newUsers = [];
|
|
24
|
+
if (!userId) {
|
|
25
|
+
newIds = selectedUserIds.concat(userData.objectId);
|
|
26
|
+
newUsers = selectedUsers.concat(userData);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
newIds = selectedUserIds.filter(id => id !== userData.objectId);
|
|
30
|
+
newUsers = selectedUsers.filter(user => user.objectId !== userData.objectId);
|
|
31
|
+
}
|
|
32
|
+
setSelectedUsers(newUsers);
|
|
33
|
+
setSelectedUserIds(newIds);
|
|
34
|
+
}, [selectedUserIds, selectedUsers]);
|
|
35
|
+
const selectAll = useCallback(() => {
|
|
36
|
+
setSelectedUsers(cloneDeep(users));
|
|
37
|
+
setSelectedUserIds(cloneDeep(users.map(user => user.objectId)));
|
|
38
|
+
}, [users]);
|
|
39
|
+
const clearSelect = useCallback(() => {
|
|
40
|
+
setSelectedUsers([]);
|
|
41
|
+
setSelectedUserIds([]);
|
|
42
|
+
}, []);
|
|
43
|
+
const onSubmit = useCallback(() => {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
if (!selectedUserIds.length) {
|
|
46
|
+
message.error(i18n.t('pages.workflow.flowHandler.message'));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const submitUsers = selectedUsers.map(user => ({
|
|
50
|
+
deleted: user.deleted,
|
|
51
|
+
enabled: user.enabled,
|
|
52
|
+
nickname: user.nickname,
|
|
53
|
+
username: user.username,
|
|
54
|
+
label: user.nickname ? `${user.nickname}(${user.username})` : user.username,
|
|
55
|
+
value: user.objectId,
|
|
56
|
+
}));
|
|
57
|
+
handleTransition(task.name, (_b = (_a = task.parameters) === null || _a === void 0 ? void 0 : _a.screen) === null || _b === void 0 ? void 0 : _b.key, (_c = task.parameters) === null || _c === void 0 ? void 0 : _c.scriptValidator, submitUsers);
|
|
58
|
+
}, [
|
|
59
|
+
handleTransition,
|
|
60
|
+
selectedUserIds.length,
|
|
61
|
+
selectedUsers,
|
|
62
|
+
task.name,
|
|
63
|
+
(_b = (_a = task.parameters) === null || _a === void 0 ? void 0 : _a.screen) === null || _b === void 0 ? void 0 : _b.key,
|
|
64
|
+
(_c = task.parameters) === null || _c === void 0 ? void 0 : _c.scriptValidator,
|
|
65
|
+
]);
|
|
66
|
+
const OverflowText = () => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
return (_jsxs("div", { css: css(overflowStyle), children: [_jsx(BaseOverflowTooltip, { css: css(tooltipStyle, overflowStyleText), title: task.name, children: task.name }), _jsx("span", { css: css(iconStyle), children: " \u2192 " }), _jsx("div", { css: css(stateBoxStyle), children: _jsx(BaseOverflowTooltip, { css: css(flowStateStyle, overflowStyleText), style: {
|
|
69
|
+
backgroundColor: (_a = WorkFlowStatusColor[task.target.type]) === null || _a === void 0 ? void 0 : _a.bgColor,
|
|
70
|
+
color: (_b = WorkFlowStatusColor[task.target.type]) === null || _b === void 0 ? void 0 : _b.color,
|
|
71
|
+
}, title: task.target.name, children: task.target.name }) })] }));
|
|
72
|
+
};
|
|
73
|
+
return (_jsx(ClassNames, { children: ({ cx, css }) => (_jsxs("div", { className: cx(css(FlowHandlerWrapper)), children: [_jsxs("header", { className: cx(css(FlowHandlerHeader)), children: [_jsx("span", { className: "back-wrapper", onClick: () => onBack === null || onBack === void 0 ? void 0 : onBack(), children: _jsx(ArrowBackIcon, { className: "icon-back" }) }), _jsx("span", { children: i18n.t('pages.workflow.flowHandler.title') })] }), task && _jsx(OverflowText, {}), _jsxs("div", { className: cx(css(FlowHandlerSearchWrapper)), children: [_jsx(SearchIcon, { className: "icon-search" }), _jsx(Input, { className: "search-input", placeholder: i18n.t('pages.workflow.flowHandler.search'), onChange: e => onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value), allowClear: true })] }), _jsxs("div", { className: cx(css(FlowHandlerSelectMessage)), children: [_jsx("span", { onClick: selectAll, children: i18n.t('pages.workflow.flowHandler.selectAll') }), _jsx("span", { children: i18n.t('pages.workflow.flowHandler.count', { count: selectedUserIds.length }) }), _jsx("span", { onClick: clearSelect, children: i18n.t('pages.workflow.flowHandler.clear') })] }), _jsx("div", { className: cx(css(FlowHandlerSelectContent)), children: _jsx(Spin, { spinning: loadingUser, className: "loading", children: users.map(user => (_jsxs("div", { className: cx(css(FlowHandlerSelectItem), { active: selectedUserIds.includes(user.objectId) }), onClick: () => selectUser(user), children: [user.username, " ", user.nickname ? `(${user.nickname})` : '', _jsx("span", { children: selectedUserIds.includes(user.objectId) && _jsx(DoneIcon, { className: "icon-done" }) })] }, user.objectId))) }) }), _jsx("div", { className: cx(css(FlowHandlerSubmitWrapper)), children: _jsx(Button, { type: "primary", onClick: onSubmit, loading: loading, children: i18n.t('pages.workflow.flowHandler.submit') }) })] })) }));
|
|
74
|
+
};
|
|
75
|
+
export default memo(SelectFlowHandler);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ItemResultProps } from '../../../lib/types/item';
|
|
3
|
+
import { ApprovalData, CheckInData, WorkflowDataProps } from '../../../lib/types/workflow';
|
|
4
|
+
interface SelectTransitionProps {
|
|
5
|
+
fetching: boolean;
|
|
6
|
+
flowing: boolean;
|
|
7
|
+
tasks: Record<string, any>[];
|
|
8
|
+
itemId: string;
|
|
9
|
+
itemData: ItemResultProps;
|
|
10
|
+
currentUser: Record<string, any>;
|
|
11
|
+
workspace: string;
|
|
12
|
+
setPopoverVisible: (flag: boolean) => void;
|
|
13
|
+
name: string;
|
|
14
|
+
objectId: string;
|
|
15
|
+
workflowData: WorkflowDataProps;
|
|
16
|
+
roleIds: string[];
|
|
17
|
+
groupIds: string[];
|
|
18
|
+
workspaceRoleIds: string[];
|
|
19
|
+
approval: ApprovalData;
|
|
20
|
+
checkIn: CheckInData;
|
|
21
|
+
handleTransition: (updateTask: string, screenId: string, script: string) => void;
|
|
22
|
+
readonly: boolean;
|
|
23
|
+
flowHandlerActive?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare const _default: React.NamedExoticComponent<SelectTransitionProps>;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { ClassNames } from '@emotion/react';
|
|
4
|
+
import { Spin } from 'antd';
|
|
5
|
+
import { i18n } from '../../../lib/i18n';
|
|
6
|
+
import { flowNextStyle, noPermissionStyle, spinStyle } from './style';
|
|
7
|
+
import TransitionButton from './TransitionButton';
|
|
8
|
+
import View from './View';
|
|
9
|
+
const SelectTransition = ({ fetching, flowing, tasks, itemId, itemData, currentUser, workspace, setPopoverVisible, name, objectId, workflowData, roleIds, groupIds, workspaceRoleIds, approval, checkIn, handleTransition, readonly, flowHandlerActive, }) => {
|
|
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", { 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 }, task.id));
|
|
13
|
+
}) }) })) : (_jsx("span", { onClick: () => {
|
|
14
|
+
setPopoverVisible(false);
|
|
15
|
+
}, css: css(noPermissionStyle), children: i18n.t('pages.fields.view.noWorkflowOrAuth') })), _jsx(View, { workflowData: workflowData, hiddenPopover: () => setPopoverVisible(false), name: name, objectId: objectId })] })) }));
|
|
16
|
+
};
|
|
17
|
+
export default memo(SelectTransition);
|
|
@@ -11,6 +11,10 @@ interface TransitionComponentProps {
|
|
|
11
11
|
apply?: string;
|
|
12
12
|
readonly?: boolean;
|
|
13
13
|
onTransitionSuccess?: (status: Status) => void;
|
|
14
|
+
flowHandlerActive?: boolean;
|
|
15
|
+
flowUsers: Array<Record<string, any>>;
|
|
16
|
+
loadingFlowUsers: boolean;
|
|
17
|
+
fetchFlowUsers: (itemId: string, keyword?: string) => Promise<void>;
|
|
14
18
|
}
|
|
15
19
|
declare const _default: React.NamedExoticComponent<TransitionComponentProps>;
|
|
16
20
|
export default _default;
|
|
@@ -11,7 +11,7 @@ import BaseOverflowTooltip from '../../common/overflow-tooltip/BaseOverflowToolt
|
|
|
11
11
|
import { caretDownStyle, flowStateButtonStyle, flowStateInWorkflowStyle, flowStateStyle, noStateStyle, stateBtnStyle, statePopoverStyle, workflowContentStyle, } from './style';
|
|
12
12
|
import TransitionPanel from './TransitionPanel';
|
|
13
13
|
const Transition = props => {
|
|
14
|
-
const { itemId, itemType, workspace, objectId, onTransitionSuccess, name, type, readonly, apply } = props;
|
|
14
|
+
const { itemId, itemType, workspace, objectId, onTransitionSuccess, name, type, readonly, apply, flowUsers, loadingFlowUsers, fetchFlowUsers, } = props;
|
|
15
15
|
const [popoverVisible, setPopoverVisible] = useState(false);
|
|
16
16
|
const [flowing, setFlowing] = useState(false);
|
|
17
17
|
const isProcessing = useRef(false);
|
|
@@ -35,7 +35,7 @@ const Transition = props => {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
setPopoverVisible(visible);
|
|
38
|
-
}, 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 }), children: _jsxs(Button, { type: "link", className: cx('status-btn', css(flowStateStyle), css(flowStateInWorkflowStyle), css(flowStateButtonStyle), css(stateBtnStyle), {
|
|
38
|
+
}, 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
39
|
[css(noStateStyle)]: !showData.name,
|
|
40
40
|
}), style: {
|
|
41
41
|
backgroundColor: (_a = WorkFlowStatusColor[showData.type]) === null || _a === void 0 ? void 0 : _a.bgColor,
|
|
@@ -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(() => {
|
|
@@ -74,7 +74,7 @@ const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds,
|
|
|
74
74
|
},
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
|
-
const checkResult = checkTransition(item, transition, { userId, roleIds, groupIds, workspaceRoleIds });
|
|
77
|
+
const checkResult = checkTransition(item, transition, { userId, roleIds, groupIds, workspaceRoleIds }, flowHandlerActive);
|
|
78
78
|
if (!checkResult.result) {
|
|
79
79
|
setTip(checkResult.message);
|
|
80
80
|
setIsCheck(false);
|
|
@@ -94,6 +94,7 @@ const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds,
|
|
|
94
94
|
roleIds,
|
|
95
95
|
groupIds,
|
|
96
96
|
workspaceRoleIds,
|
|
97
|
+
flowHandlerActive,
|
|
97
98
|
]);
|
|
98
99
|
useEffect(() => {
|
|
99
100
|
checkAuth();
|
|
@@ -13,6 +13,10 @@ interface TransitionPanelProps {
|
|
|
13
13
|
isProcessing: React.MutableRefObject<boolean>;
|
|
14
14
|
flowing: boolean;
|
|
15
15
|
setFlowing: (flowing: boolean) => void;
|
|
16
|
+
flowHandlerActive?: boolean;
|
|
17
|
+
flowUsers: Array<Record<string, any>>;
|
|
18
|
+
loadingFlowUsers: boolean;
|
|
19
|
+
fetchFlowUsers: (itemId: string, keyword?: string) => Promise<void>;
|
|
16
20
|
}
|
|
17
21
|
declare const _default: React.NamedExoticComponent<TransitionPanelProps>;
|
|
18
22
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { ClassNames } from '@emotion/react';
|
|
4
4
|
import { proximaSdk, useListener } from '@giteeteam/proxima-sdk-js';
|
|
5
|
-
import { message
|
|
5
|
+
import { message } from 'antd';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
import { cloneDeep } from 'lodash-es';
|
|
8
8
|
import useCurrentUser from '../../../lib/hooks/useCurrentUser';
|
|
@@ -10,10 +10,14 @@ import useWorkflowConfig from '../../../lib/hooks/useWorkflowConfig';
|
|
|
10
10
|
import { i18n } from '../../../lib/i18n';
|
|
11
11
|
import { getScriptUser, useWorkflowPermission } from '../../../lib/workflow';
|
|
12
12
|
import { useItem } from '../../item/hooks';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import View from './View';
|
|
13
|
+
import SelectFlowHandler from './SelectFlowHandler';
|
|
14
|
+
import SelectTransition from './SelectTransition';
|
|
16
15
|
const logger = debug('TransitionPanel');
|
|
16
|
+
var TransitionStepType;
|
|
17
|
+
(function (TransitionStepType) {
|
|
18
|
+
TransitionStepType["SelectTransition"] = "SelectTransition";
|
|
19
|
+
TransitionStepType["SelectFlowHandler"] = "SelectFlowHandler";
|
|
20
|
+
})(TransitionStepType || (TransitionStepType = {}));
|
|
17
21
|
const PROPERTY_ACTION_SORT_KEY = 'opsbar-sequence';
|
|
18
22
|
const DEFAULT_APPROVAL_DATA = {
|
|
19
23
|
requireApproval: false,
|
|
@@ -22,7 +26,7 @@ const DEFAULT_APPROVAL_DATA = {
|
|
|
22
26
|
startApproval: false,
|
|
23
27
|
};
|
|
24
28
|
const DEFAULT_CHECK_IN_DATA = { requireCheckIn: false, checkInStatus: '', transition: null };
|
|
25
|
-
const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSuccess, name, readonly, setPopoverVisible, isProcessing, flowing, setFlowing, }) => {
|
|
29
|
+
const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSuccess, name, readonly, setPopoverVisible, isProcessing, flowing, setFlowing, flowHandlerActive, flowUsers, loadingFlowUsers, fetchFlowUsers, }) => {
|
|
26
30
|
var _a;
|
|
27
31
|
const [updateTransitionText, setUpdateTransitionText] = useState('');
|
|
28
32
|
const { itemData, mutate: itemMutate } = useItem(itemId, true);
|
|
@@ -31,6 +35,9 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
31
35
|
const [fetching, setFetching] = useState(true);
|
|
32
36
|
const [approval, setApproval] = useState(cloneDeep(DEFAULT_APPROVAL_DATA));
|
|
33
37
|
const [checkIn, setCheckIn] = useState(cloneDeep(DEFAULT_CHECK_IN_DATA));
|
|
38
|
+
const [transitionStep, setTransitionStep] = useState(TransitionStepType.SelectTransition);
|
|
39
|
+
const [flowTask, setFlowTask] = useState({});
|
|
40
|
+
const [currentFlowHandler, setCurrentFlowHandler] = useState(undefined);
|
|
34
41
|
const newItem = useRef(itemId);
|
|
35
42
|
useEffect(() => {
|
|
36
43
|
setStatusId(objectId);
|
|
@@ -111,6 +118,7 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
111
118
|
proximaSdk.execute('updateCheckInInfo', status.objectId);
|
|
112
119
|
}, [itemId, itemMutate, onTransitionSuccess]);
|
|
113
120
|
const submitHandle = useCallback(async (transitionText, itemDetail = null) => {
|
|
121
|
+
console.info('currentFlowHandler', currentFlowHandler);
|
|
114
122
|
const params = {
|
|
115
123
|
workflowId: workflowData.objectId,
|
|
116
124
|
currentState: statusId,
|
|
@@ -120,6 +128,7 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
120
128
|
reporter: itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.reporter,
|
|
121
129
|
securityLevel: itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.securityLevel,
|
|
122
130
|
values: itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.values,
|
|
131
|
+
flowHandler: (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.flowHandler) || currentFlowHandler,
|
|
123
132
|
};
|
|
124
133
|
try {
|
|
125
134
|
setFlowing(true);
|
|
@@ -158,11 +167,23 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
158
167
|
setFlowing(false);
|
|
159
168
|
setPopoverVisible(false);
|
|
160
169
|
}
|
|
161
|
-
}, [itemId, workflowData.objectId, statusId, onTransitionSuccess, runTransition, getItemStatus]);
|
|
170
|
+
}, [itemId, workflowData.objectId, statusId, onTransitionSuccess, runTransition, getItemStatus, currentFlowHandler]);
|
|
162
171
|
const submitTransition = useCallback(async (itemDetail) => {
|
|
163
172
|
await submitHandle(updateTransitionText, itemDetail);
|
|
164
173
|
}, [submitHandle, updateTransitionText]);
|
|
165
|
-
const handleTransition = useCallback(async (transitionText, screenId, scriptValidator) => {
|
|
174
|
+
const handleTransition = useCallback(async (transitionText, screenId, scriptValidator, flowHandler) => {
|
|
175
|
+
if (flowHandlerActive) {
|
|
176
|
+
if (transitionStep === TransitionStepType.SelectTransition) {
|
|
177
|
+
setCurrentFlowHandler(undefined);
|
|
178
|
+
setFlowTask(tasks.find(task => task.name === transitionText));
|
|
179
|
+
setTransitionStep(TransitionStepType.SelectFlowHandler);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
console.info('flowHandler', flowHandler);
|
|
184
|
+
setCurrentFlowHandler(flowHandler);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
166
187
|
setFlowing(true);
|
|
167
188
|
try {
|
|
168
189
|
const params = {
|
|
@@ -185,7 +206,7 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
185
206
|
setFlowing(false);
|
|
186
207
|
}
|
|
187
208
|
if (!screenId) {
|
|
188
|
-
submitHandle(transitionText);
|
|
209
|
+
submitHandle(transitionText, { flowHandler });
|
|
189
210
|
}
|
|
190
211
|
else {
|
|
191
212
|
isProcessing.current = true;
|
|
@@ -198,7 +219,10 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
198
219
|
setUpdateTransitionText(transitionText);
|
|
199
220
|
}
|
|
200
221
|
}, [
|
|
222
|
+
flowHandlerActive,
|
|
223
|
+
transitionStep,
|
|
201
224
|
setFlowing,
|
|
225
|
+
tasks,
|
|
202
226
|
itemId,
|
|
203
227
|
itemType,
|
|
204
228
|
workspace,
|
|
@@ -207,9 +231,9 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
207
231
|
itemData,
|
|
208
232
|
workspaceRoleIds,
|
|
209
233
|
groupIds,
|
|
210
|
-
isProcessing,
|
|
211
|
-
submitHandle,
|
|
212
234
|
checkTransitionScript,
|
|
235
|
+
submitHandle,
|
|
236
|
+
isProcessing,
|
|
213
237
|
]);
|
|
214
238
|
useListener('itemTransitionSuccess', async ({ itemId: editItemId, transition: editTransition, itemData }) => {
|
|
215
239
|
if (editItemId === itemId && editTransition === updateTransitionText && isProcessing.current) {
|
|
@@ -231,12 +255,7 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
|
|
|
231
255
|
refreshFlag.current++;
|
|
232
256
|
refresh();
|
|
233
257
|
});
|
|
234
|
-
return (_jsx(ClassNames, { children: (
|
|
235
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
236
|
-
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 }, task.id));
|
|
237
|
-
}) }) })) : (_jsx("span", { onClick: () => {
|
|
238
|
-
setPopoverVisible(false);
|
|
239
|
-
}, css: css(noPermissionStyle), children: i18n.t('pages.fields.view.noWorkflowOrAuth') })), _jsx(View, { workflowData: workflowData, hiddenPopover: () => setPopoverVisible(false), name: name, objectId: objectId })] })) }));
|
|
258
|
+
return (_jsx(ClassNames, { children: () => transitionStep === TransitionStepType.SelectFlowHandler ? (_jsx(SelectFlowHandler, { itemId: itemId, task: flowTask, onBack: () => setTransitionStep(TransitionStepType.SelectTransition), users: flowUsers, loading: flowing, loadingUser: loadingFlowUsers, fetchUsers: fetchFlowUsers, handleTransition: handleTransition })) : (_jsx(SelectTransition, { fetching: fetching, flowing: flowing, tasks: tasks, itemId: itemId, itemData: itemData, currentUser: currentUser, workspace: workspace, setPopoverVisible: setPopoverVisible, name: name, objectId: objectId, workflowData: workflowData, roleIds: roleIds, groupIds: groupIds, workspaceRoleIds: workspaceRoleIds, approval: approval, checkIn: checkIn, handleTransition: handleTransition, readonly: readonly, flowHandlerActive: flowHandlerActive })) }));
|
|
240
259
|
};
|
|
241
260
|
function getWorkflowConfig(workflow, statusId) {
|
|
242
261
|
var _a, _b, _c, _d, _e;
|
|
@@ -10,11 +10,21 @@ export declare const noStateStyle = "\n color: #909aaa;\n background: #F1F2F4;
|
|
|
10
10
|
export declare const caretDownStyle = "\n padding-left: 2px;\n margin-left: 0;\n line-height: 10px;\n";
|
|
11
11
|
export declare const statusViewGlobalStyle = "\n.field-layout.status-view {\n position: relative;\n padding: 10px;\n margin: -12px;\n margin-top: 10px;\n font-size: 12px;\n cursor: pointer;\n border-top: 1px solid #ddd;\n}\n\n.field-layout.status-view .status-view-watch {\n width: 12px;\n height: 12px;\n margin-right: 5px;\n font-size: 12px;\n vertical-align: middle;\n}\n";
|
|
12
12
|
export declare const tipLineStyle = "\n margin-bottom: 0;\n";
|
|
13
|
-
export declare const tooltipStyle = "\n width:
|
|
13
|
+
export declare const tooltipStyle = "\n width: 98px;\n";
|
|
14
14
|
export declare const iconStyle = "\n padding: 0 6px;\n color: #848C9F;\n";
|
|
15
|
-
export declare const stateBoxStyle = "\n display: flex;\n width:
|
|
15
|
+
export declare const stateBoxStyle = "\n display: flex;\n width: 98px;\n\n span {\n padding-right: 8px;\n }\n";
|
|
16
16
|
export declare const flowBtnStyle = "\n display: flex;\n padding: 5px 10px;\n margin: 0;\n\n &:hover {\n background-color: var(--select-item-selected-bg, #e6f3ff);\n }\n";
|
|
17
17
|
export declare const notAllowedStyle = "\n cursor: not-allowed;\n opacity: 0.3;\n";
|
|
18
18
|
export declare const pointerStyle = "\n cursor: pointer;\n";
|
|
19
19
|
export declare const spinStyle = "\n width: 150px;\n height: 50px;\n";
|
|
20
20
|
export declare const noPermissionStyle = "\n display: block;\n width: 120px;\n padding: 20px 10px 10px;\n font-size: 12px;\n color: #2e405e;\n";
|
|
21
|
+
export declare const overflowStyle = "\n display: flex;\n margin-top: 4px;\n";
|
|
22
|
+
export declare const overflowStyleText = "\n flex: 1;\n";
|
|
23
|
+
export declare const FlowHandlerWrapper = "\n width: 216px;\n";
|
|
24
|
+
export declare const FlowHandlerHeader = "\n position: relative;\n font-size: 14px;\n text-align: center;\n line-height: 22px;\n .back-wrapper {\n position: absolute;\n left: 0;\n top: 0;\n cursor: pointer;\n }\n .icon-back {\n font-size: 16px !important;\n width: 16px !important;\n }\n";
|
|
25
|
+
export declare const FlowHandlerSearchWrapper = "\n margin: 0 -12px;\n margin-top: 6px;\n padding: 5px 10px;\n border-top: 1px solid #f1f2f4;\n border-bottom: 1px solid #f1f2f4;\n\n .icon-search {\n position: relative;\n top: 2px;\n color: #b5bac5;\n font-size: 16px !important;\n width: 16px !important;\n }\n .search-input {\n padding-left: 6px;\n border: none;\n width: 196px;\n outline: none;\n fill: none;\n box-shadow: none !important;\n }\n";
|
|
26
|
+
export declare const FlowHandlerSelectWrapper = "\n margin: 0 -12px;\n padding: 9px 10px;\n .icon-arrow-down {\n position: relative;\n top: 2px; \n color: #b5bac5;\n font-size: 16px !important;\n width: 16px !important;\n }\n .select-input {\n border: none;\n display: inline-block;\n width: 196px;\n outline: none;\n fill: none;\n box-shadow: none;\n &:focus {\n box-shadow: none;\n }\n }\n .select-input::placeholder {\n color: #b5bac5;\n }\n }\n";
|
|
27
|
+
export declare const FlowHandlerSelectMessage = "\n margin: 0 -12px;\n padding: 6px 12px;\n display: flex;\n font-size: 12px;\n color: #091940;\n border-bottom: 1px solid #f1f2f4;\n\n span:nth-child(1) {\n position: relative;\n color: #0C62FF;\n cursor: pointer;\n &:hover {\n color: #091940;\n }\n\n &:after {\n content: '';\n position: absolute;\n height: 14px;\n top: 2px;\n right: -10px;\n border-right: 1px solid #f1f2f4;\n }\n }\n span:nth-child(2) {\n padding-left: 18px;\n flex: 1;\n \n }\n span:nth-child(3) {\n color: #0c62ff;\n cursor: pointer;\n &:hover {\n color: #091940;\n }\n }\n";
|
|
28
|
+
export declare const FlowHandlerSelectContent = "\n min-height: 200px;\n max-height: 200px;\n overflow-y: auto;\n margin: 0 -12px;\n .loading {\n height: 200px !important;\n }\n";
|
|
29
|
+
export declare const FlowHandlerSelectItem = "\n position: relative;\n margin: 0 4px;\n padding: 5px 12px;\n font-size: 14px;\n color: #091940;\n cursor: pointer;\n border-radius: 4px;\n\n .icon-done {\n position: absolute;\n top: 10px;\n right: 14px;\n width: 12px;\n height: 12px;\n color: #0C62FF;\n scale: 1.2;\n }\n\n &:hover {\n background-color: #f1f2f4;\n }\n\n &.active {\n background-color: #E6F3FF;\n font-weight: 600;\n }\n";
|
|
30
|
+
export declare const FlowHandlerSubmitWrapper = "\n border-top: 1px solid #f1f2f4;\n padding: 6px 0;\n margin-bottom: -12px;\n text-align: right;\n";
|
|
@@ -111,7 +111,7 @@ export const tipLineStyle = `
|
|
|
111
111
|
margin-bottom: 0;
|
|
112
112
|
`;
|
|
113
113
|
export const tooltipStyle = `
|
|
114
|
-
width:
|
|
114
|
+
width: 98px;
|
|
115
115
|
`;
|
|
116
116
|
export const iconStyle = `
|
|
117
117
|
padding: 0 6px;
|
|
@@ -119,7 +119,7 @@ export const iconStyle = `
|
|
|
119
119
|
`;
|
|
120
120
|
export const stateBoxStyle = `
|
|
121
121
|
display: flex;
|
|
122
|
-
width:
|
|
122
|
+
width: 98px;
|
|
123
123
|
|
|
124
124
|
span {
|
|
125
125
|
padding-right: 8px;
|
|
@@ -152,3 +152,159 @@ export const noPermissionStyle = `
|
|
|
152
152
|
font-size: 12px;
|
|
153
153
|
color: #2e405e;
|
|
154
154
|
`;
|
|
155
|
+
export const overflowStyle = `
|
|
156
|
+
display: flex;
|
|
157
|
+
margin-top: 4px;
|
|
158
|
+
`;
|
|
159
|
+
export const overflowStyleText = `
|
|
160
|
+
flex: 1;
|
|
161
|
+
`;
|
|
162
|
+
export const FlowHandlerWrapper = `
|
|
163
|
+
width: 216px;
|
|
164
|
+
`;
|
|
165
|
+
export const FlowHandlerHeader = `
|
|
166
|
+
position: relative;
|
|
167
|
+
font-size: 14px;
|
|
168
|
+
text-align: center;
|
|
169
|
+
line-height: 22px;
|
|
170
|
+
.back-wrapper {
|
|
171
|
+
position: absolute;
|
|
172
|
+
left: 0;
|
|
173
|
+
top: 0;
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
}
|
|
176
|
+
.icon-back {
|
|
177
|
+
font-size: 16px !important;
|
|
178
|
+
width: 16px !important;
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
export const FlowHandlerSearchWrapper = `
|
|
182
|
+
margin: 0 -12px;
|
|
183
|
+
margin-top: 6px;
|
|
184
|
+
padding: 5px 10px;
|
|
185
|
+
border-top: 1px solid #f1f2f4;
|
|
186
|
+
border-bottom: 1px solid #f1f2f4;
|
|
187
|
+
|
|
188
|
+
.icon-search {
|
|
189
|
+
position: relative;
|
|
190
|
+
top: 2px;
|
|
191
|
+
color: #b5bac5;
|
|
192
|
+
font-size: 16px !important;
|
|
193
|
+
width: 16px !important;
|
|
194
|
+
}
|
|
195
|
+
.search-input {
|
|
196
|
+
padding-left: 6px;
|
|
197
|
+
border: none;
|
|
198
|
+
width: 196px;
|
|
199
|
+
outline: none;
|
|
200
|
+
fill: none;
|
|
201
|
+
box-shadow: none !important;
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
204
|
+
export const FlowHandlerSelectWrapper = `
|
|
205
|
+
margin: 0 -12px;
|
|
206
|
+
padding: 9px 10px;
|
|
207
|
+
.icon-arrow-down {
|
|
208
|
+
position: relative;
|
|
209
|
+
top: 2px;
|
|
210
|
+
color: #b5bac5;
|
|
211
|
+
font-size: 16px !important;
|
|
212
|
+
width: 16px !important;
|
|
213
|
+
}
|
|
214
|
+
.select-input {
|
|
215
|
+
border: none;
|
|
216
|
+
display: inline-block;
|
|
217
|
+
width: 196px;
|
|
218
|
+
outline: none;
|
|
219
|
+
fill: none;
|
|
220
|
+
box-shadow: none;
|
|
221
|
+
&:focus {
|
|
222
|
+
box-shadow: none;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
.select-input::placeholder {
|
|
226
|
+
color: #b5bac5;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
`;
|
|
230
|
+
export const FlowHandlerSelectMessage = `
|
|
231
|
+
margin: 0 -12px;
|
|
232
|
+
padding: 6px 12px;
|
|
233
|
+
display: flex;
|
|
234
|
+
font-size: 12px;
|
|
235
|
+
color: #091940;
|
|
236
|
+
border-bottom: 1px solid #f1f2f4;
|
|
237
|
+
|
|
238
|
+
span:nth-child(1) {
|
|
239
|
+
position: relative;
|
|
240
|
+
color: #0C62FF;
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
&:hover {
|
|
243
|
+
color: #091940;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
&:after {
|
|
247
|
+
content: '';
|
|
248
|
+
position: absolute;
|
|
249
|
+
height: 14px;
|
|
250
|
+
top: 2px;
|
|
251
|
+
right: -10px;
|
|
252
|
+
border-right: 1px solid #f1f2f4;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
span:nth-child(2) {
|
|
256
|
+
padding-left: 18px;
|
|
257
|
+
flex: 1;
|
|
258
|
+
|
|
259
|
+
}
|
|
260
|
+
span:nth-child(3) {
|
|
261
|
+
color: #0c62ff;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
&:hover {
|
|
264
|
+
color: #091940;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
`;
|
|
268
|
+
export const FlowHandlerSelectContent = `
|
|
269
|
+
min-height: 200px;
|
|
270
|
+
max-height: 200px;
|
|
271
|
+
overflow-y: auto;
|
|
272
|
+
margin: 0 -12px;
|
|
273
|
+
.loading {
|
|
274
|
+
height: 200px !important;
|
|
275
|
+
}
|
|
276
|
+
`;
|
|
277
|
+
export const FlowHandlerSelectItem = `
|
|
278
|
+
position: relative;
|
|
279
|
+
margin: 0 4px;
|
|
280
|
+
padding: 5px 12px;
|
|
281
|
+
font-size: 14px;
|
|
282
|
+
color: #091940;
|
|
283
|
+
cursor: pointer;
|
|
284
|
+
border-radius: 4px;
|
|
285
|
+
|
|
286
|
+
.icon-done {
|
|
287
|
+
position: absolute;
|
|
288
|
+
top: 10px;
|
|
289
|
+
right: 14px;
|
|
290
|
+
width: 12px;
|
|
291
|
+
height: 12px;
|
|
292
|
+
color: #0C62FF;
|
|
293
|
+
scale: 1.2;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
&:hover {
|
|
297
|
+
background-color: #f1f2f4;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
&.active {
|
|
301
|
+
background-color: #E6F3FF;
|
|
302
|
+
font-weight: 600;
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
export const FlowHandlerSubmitWrapper = `
|
|
306
|
+
border-top: 1px solid #f1f2f4;
|
|
307
|
+
padding: 6px 0;
|
|
308
|
+
margin-bottom: -12px;
|
|
309
|
+
text-align: right;
|
|
310
|
+
`;
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -6,3 +6,6 @@ export interface IconProps {
|
|
|
6
6
|
export declare const HollowCircleIcon: React.FC<IconProps>;
|
|
7
7
|
export declare const WorkflowIcon: React.FC<IconProps>;
|
|
8
8
|
export declare const DottedCircleIcon: React.FC<IconProps>;
|
|
9
|
+
export declare const ArrowBackIcon: React.FC<IconProps>;
|
|
10
|
+
export declare const SearchIcon: React.FC<IconProps>;
|
|
11
|
+
export declare const DoneIcon: React.FC<IconProps>;
|
package/dist/icons/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import AntdIcon from '@ant-design/icons';
|
|
3
|
+
import ArrowBack from './svg/ArrowBack.svg';
|
|
4
|
+
import Done from './svg/Done.svg';
|
|
3
5
|
import DottedCircle from './svg/DottedCircle.svg';
|
|
4
6
|
import HollowCircle from './svg/HollowCircle.svg';
|
|
7
|
+
import Search from './svg/Search.svg';
|
|
5
8
|
import Workflow from './svg/Workflow.svg';
|
|
6
9
|
export const HollowCircleIcon = props => {
|
|
7
10
|
return _jsx(AntdIcon, { ...props, component: HollowCircle });
|
|
@@ -12,3 +15,12 @@ export const WorkflowIcon = props => {
|
|
|
12
15
|
export const DottedCircleIcon = props => {
|
|
13
16
|
return _jsx(AntdIcon, { ...props, style: { fontSize: 10, width: 10, marginLeft: 2 }, component: DottedCircle });
|
|
14
17
|
};
|
|
18
|
+
export const ArrowBackIcon = props => {
|
|
19
|
+
return _jsx(AntdIcon, { ...props, style: { fontSize: 10, width: 10, marginLeft: 2 }, component: ArrowBack });
|
|
20
|
+
};
|
|
21
|
+
export const SearchIcon = props => {
|
|
22
|
+
return _jsx(AntdIcon, { ...props, style: { fontSize: 10, width: 10, marginLeft: 2 }, component: Search });
|
|
23
|
+
};
|
|
24
|
+
export const DoneIcon = props => {
|
|
25
|
+
return _jsx(AntdIcon, { ...props, style: { fontSize: 10, width: 10, marginLeft: 2 }, component: Done });
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1720087015972" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13078" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M521.856 137.984l2.24 2.24a38.4 38.4 0 0 1 0 54.272l-275.2 275.2h624.64a41.6 41.6 0 1 1 0 83.2H247.488l276.608 276.672a38.4 38.4 0 0 1 4.48 48.96l-4.48 5.312-2.24 2.304-5.312 4.416a38.4 38.4 0 0 1-43.712 0l-5.312-4.48-343.872-343.936a38.272 38.272 0 0 1-11.136-23.872v-12.48a38.272 38.272 0 0 1 11.136-23.872l343.872-343.936a38.4 38.4 0 0 1 54.336 0z" p-id="13079"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1720427435830" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13078" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M380.352 842.176l-305.664-305.28a38.4 38.4 0 0 1-0.064-54.272l2.048-2.048a38.464 38.464 0 0 1 54.272 0l275.328 274.88 482.816-575.36a38.4 38.4 0 0 1 54.144-4.736l2.432 2.112a38.4 38.4 0 0 1 4.736 54.08l-510.08 607.936a38.336 38.336 0 0 1-29.376 13.696h-6.72a38.336 38.336 0 0 1-23.872-11.008z" p-id="13079"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1720090255506" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13220" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M457.6 112a345.6 345.6 0 0 1 270.08 561.28l173.056 173.184a38.4 38.4 0 0 1-48.96 58.752l-5.312-4.48-173.184-173.056a345.6 345.6 0 1 1-215.68-615.68z m0 76.8a268.8 268.8 0 1 0 186.944 461.952 18.112 18.112 0 0 1 2.816-3.392l3.392-2.816A268.8 268.8 0 0 0 457.6 188.8z" p-id="13221"></path></svg>
|
package/dist/lib/workflow.d.ts
CHANGED
|
@@ -106,6 +106,6 @@ interface CheckUserPermissionParams {
|
|
|
106
106
|
}
|
|
107
107
|
export declare function checkUserPermission({ transition, userId, roleIds, groupIds, item, workspaceRoleIds, }: CheckUserPermissionParams): ResultType;
|
|
108
108
|
export declare function checkItemCondition(transition: TransitionProps, item: ItemResultProps): ResultType;
|
|
109
|
-
export declare function checkTransition(item: ItemResultProps, transition: TransitionProps, permissions: WorkflowPermissionType): ResultType;
|
|
109
|
+
export declare function checkTransition(item: ItemResultProps, transition: TransitionProps, permissions: WorkflowPermissionType, flowHandlerActive?: boolean): ResultType;
|
|
110
110
|
export declare const useWorkflowPermission: (workspaceId: ObjectId) => [ObjectId[], ObjectId[], ObjectId[]];
|
|
111
111
|
export {};
|
package/dist/lib/workflow.js
CHANGED
|
@@ -344,9 +344,24 @@ export function checkItemCondition(transition, item) {
|
|
|
344
344
|
}
|
|
345
345
|
return { result: true };
|
|
346
346
|
}
|
|
347
|
-
export function checkTransition(item, transition, permissions) {
|
|
347
|
+
export function checkTransition(item, transition, permissions, flowHandlerActive) {
|
|
348
|
+
var _a, _b;
|
|
348
349
|
if (!item || !transition)
|
|
349
350
|
return { result: false };
|
|
351
|
+
if (flowHandlerActive && ((_b = (_a = item === null || item === void 0 ? void 0 : item.values) === null || _a === void 0 ? void 0 : _a.flowHandler) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
352
|
+
const flowHandler = item.values.flowHandler;
|
|
353
|
+
const flowUser = flowHandler.find(user => user.value === permissions.userId);
|
|
354
|
+
if (flowUser) {
|
|
355
|
+
return { result: true };
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
const tipUsers = flowHandler.map(user => user.label).join('、');
|
|
359
|
+
return {
|
|
360
|
+
result: false,
|
|
361
|
+
message: i18n.t('libs.default.tipText', { text: `${i18n.t('libs.workflow.flowHandler')}:${tipUsers}` }),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}
|
|
350
365
|
const roleCheck = checkUserPermission({
|
|
351
366
|
transition,
|
|
352
367
|
item,
|
package/dist/locales/index.d.ts
CHANGED
|
@@ -29,6 +29,13 @@ export declare const en: {
|
|
|
29
29
|
'pages.workflow.condition.notEqualTo': string;
|
|
30
30
|
'pages.workflow.condition.containedIn': string;
|
|
31
31
|
'pages.workflow.condition.notContainedIn': string;
|
|
32
|
+
'pages.workflow.flowHandler.title': string;
|
|
33
|
+
'pages.workflow.flowHandler.search': string;
|
|
34
|
+
'pages.workflow.flowHandler.selectAll': string;
|
|
35
|
+
'pages.workflow.flowHandler.clear': string;
|
|
36
|
+
'pages.workflow.flowHandler.count': string;
|
|
37
|
+
'pages.workflow.flowHandler.submit': string;
|
|
38
|
+
'pages.workflow.flowHandler.message': string;
|
|
32
39
|
'global.stateless': string;
|
|
33
40
|
'global.haveDelete': string;
|
|
34
41
|
'global.columns.forbiddenActive': string;
|
|
@@ -39,6 +46,7 @@ export declare const en: {
|
|
|
39
46
|
'libs.workflow.group': string;
|
|
40
47
|
'libs.workflow.userFields': string;
|
|
41
48
|
'libs.workflow.workspaceRoles': string;
|
|
49
|
+
'libs.workflow.flowHandler': string;
|
|
42
50
|
'libs.default.tipText': string;
|
|
43
51
|
'libs.default.flowTextTip.0': string;
|
|
44
52
|
'libs.default.flowTextTip.1': string;
|
|
@@ -76,6 +84,13 @@ export declare const zh: {
|
|
|
76
84
|
'pages.workflow.condition.notEqualTo': string;
|
|
77
85
|
'pages.workflow.condition.containedIn': string;
|
|
78
86
|
'pages.workflow.condition.notContainedIn': string;
|
|
87
|
+
'pages.workflow.flowHandler.title': string;
|
|
88
|
+
'pages.workflow.flowHandler.search': string;
|
|
89
|
+
'pages.workflow.flowHandler.selectAll': string;
|
|
90
|
+
'pages.workflow.flowHandler.clear': string;
|
|
91
|
+
'pages.workflow.flowHandler.count': string;
|
|
92
|
+
'pages.workflow.flowHandler.submit': string;
|
|
93
|
+
'pages.workflow.flowHandler.message': string;
|
|
79
94
|
'global.stateless': string;
|
|
80
95
|
'global.haveDelete': string;
|
|
81
96
|
'global.columns.forbiddenActive': string;
|
|
@@ -86,6 +101,7 @@ export declare const zh: {
|
|
|
86
101
|
'libs.workflow.group': string;
|
|
87
102
|
'libs.workflow.userFields': string;
|
|
88
103
|
'libs.workflow.workspaceRoles': string;
|
|
104
|
+
'libs.workflow.flowHandler': string;
|
|
89
105
|
'libs.default.tipText': string;
|
|
90
106
|
'libs.default.flowTextTip.0': string;
|
|
91
107
|
'libs.default.flowTextTip.1': string;
|
|
@@ -123,6 +139,13 @@ export declare const ru: {
|
|
|
123
139
|
'pages.workflow.condition.notEqualTo': string;
|
|
124
140
|
'pages.workflow.condition.containedIn': string;
|
|
125
141
|
'pages.workflow.condition.notContainedIn': string;
|
|
142
|
+
'pages.workflow.flowHandler.title': string;
|
|
143
|
+
'pages.workflow.flowHandler.search': string;
|
|
144
|
+
'pages.workflow.flowHandler.selectAll': string;
|
|
145
|
+
'pages.workflow.flowHandler.clear': string;
|
|
146
|
+
'pages.workflow.flowHandler.count': string;
|
|
147
|
+
'pages.workflow.flowHandler.submit': string;
|
|
148
|
+
'pages.workflow.flowHandler.message': string;
|
|
126
149
|
'global.stateless': string;
|
|
127
150
|
'global.haveDelete': string;
|
|
128
151
|
'global.columns.forbiddenActive': string;
|
|
@@ -133,6 +156,7 @@ export declare const ru: {
|
|
|
133
156
|
'libs.workflow.group': string;
|
|
134
157
|
'libs.workflow.userFields': string;
|
|
135
158
|
'libs.workflow.workspaceRoles': string;
|
|
159
|
+
'libs.workflow.flowHandler': string;
|
|
136
160
|
'libs.default.tipText': string;
|
|
137
161
|
'libs.default.flowTextTip.0': string;
|
|
138
162
|
'libs.default.flowTextTip.1': string;
|
package/dist/locales/index.js
CHANGED
|
@@ -29,6 +29,13 @@ export const en = {
|
|
|
29
29
|
'pages.workflow.condition.notEqualTo': 'not equal to',
|
|
30
30
|
'pages.workflow.condition.containedIn': 'is contained',
|
|
31
31
|
'pages.workflow.condition.notContainedIn': "isn't contained",
|
|
32
|
+
'pages.workflow.flowHandler.title': 'Next Flow Handler',
|
|
33
|
+
'pages.workflow.flowHandler.search': 'Please enter keywords for search',
|
|
34
|
+
'pages.workflow.flowHandler.selectAll': 'Select All',
|
|
35
|
+
'pages.workflow.flowHandler.clear': 'Clear Selected',
|
|
36
|
+
'pages.workflow.flowHandler.count': 'Selected {{count}} users',
|
|
37
|
+
'pages.workflow.flowHandler.submit': 'Confirm And Transition',
|
|
38
|
+
'pages.workflow.flowHandler.message': 'Please select at least one handler',
|
|
32
39
|
'global.stateless': 'Stateless',
|
|
33
40
|
'global.haveDelete': 'deleted',
|
|
34
41
|
'global.columns.forbiddenActive': 'disabled',
|
|
@@ -39,6 +46,7 @@ export const en = {
|
|
|
39
46
|
'libs.workflow.group': 'User group',
|
|
40
47
|
'libs.workflow.userFields': 'User fields',
|
|
41
48
|
'libs.workflow.workspaceRoles': 'Workspace roles',
|
|
49
|
+
'libs.workflow.flowHandler': 'Flow handler',
|
|
42
50
|
'libs.default.tipText': 'This process allows only {{text}}, please contact support',
|
|
43
51
|
'libs.default.flowTextTip.0': 'The issue field [{{field}}] should be [{{condition}}] specified field [{{target}}]',
|
|
44
52
|
'libs.default.flowTextTip.1': 'The issue field [{{field}}] should be [{{condition}}]',
|
|
@@ -76,6 +84,13 @@ export const zh = {
|
|
|
76
84
|
'pages.workflow.condition.notEqualTo': '不等于',
|
|
77
85
|
'pages.workflow.condition.containedIn': '包含',
|
|
78
86
|
'pages.workflow.condition.notContainedIn': '不包含',
|
|
87
|
+
'pages.workflow.flowHandler.title': '下一流程处理人',
|
|
88
|
+
'pages.workflow.flowHandler.search': '请输入关键字搜索',
|
|
89
|
+
'pages.workflow.flowHandler.selectAll': '全选',
|
|
90
|
+
'pages.workflow.flowHandler.clear': '清空已选',
|
|
91
|
+
'pages.workflow.flowHandler.count': '已选{{count}}项',
|
|
92
|
+
'pages.workflow.flowHandler.submit': '确认并流转',
|
|
93
|
+
'pages.workflow.flowHandler.message': '请至少选择一个处理人',
|
|
79
94
|
'global.stateless': '无状态',
|
|
80
95
|
'global.haveDelete': '已删除',
|
|
81
96
|
'global.columns.forbiddenActive': '已禁用',
|
|
@@ -86,6 +101,7 @@ export const zh = {
|
|
|
86
101
|
'libs.workflow.group': '用户组',
|
|
87
102
|
'libs.workflow.userFields': '用户字段',
|
|
88
103
|
'libs.workflow.workspaceRoles': '空间角色',
|
|
104
|
+
'libs.workflow.flowHandler': '流程处理人',
|
|
89
105
|
'libs.default.tipText': '此流程只有{{text}}可以进行操作,请联系相关人员处理',
|
|
90
106
|
'libs.default.flowTextTip.0': '当前事项字段[{{field}}]应该[{{condition}}]指定条件值[{{target}}]',
|
|
91
107
|
'libs.default.flowTextTip.1': '当前事项字段[{{field}}]应该[{{condition}}]',
|
|
@@ -123,6 +139,13 @@ export const ru = {
|
|
|
123
139
|
'pages.workflow.condition.notEqualTo': 'не равняется',
|
|
124
140
|
'pages.workflow.condition.containedIn': 'содержится',
|
|
125
141
|
'pages.workflow.condition.notContainedIn': 'не содержится',
|
|
142
|
+
'pages.workflow.flowHandler.title': 'Следующий процессор',
|
|
143
|
+
'pages.workflow.flowHandler.search': 'Введите ключевое слово для поиска',
|
|
144
|
+
'pages.workflow.flowHandler.selectAll': 'Полная выборка',
|
|
145
|
+
'pages.workflow.flowHandler.clear': 'Очистить выбрано',
|
|
146
|
+
'pages.workflow.flowHandler.count': 'Выбранный элемент {{{count}}',
|
|
147
|
+
'pages.workflow.flowHandler.submit': 'Подтверждение и обращение',
|
|
148
|
+
'pages.workflow.flowHandler.message': 'Пожалуйста, выберите хотя бы одного человека.',
|
|
126
149
|
'global.stateless': 'Stateless',
|
|
127
150
|
'global.haveDelete': 'deleted',
|
|
128
151
|
'global.columns.forbiddenActive': 'disabled',
|
|
@@ -133,6 +156,7 @@ export const ru = {
|
|
|
133
156
|
'libs.workflow.group': 'Группа пользователей',
|
|
134
157
|
'libs.workflow.userFields': 'Поле пользователя',
|
|
135
158
|
'libs.workflow.workspaceRoles': 'Роль рабочего пространства',
|
|
159
|
+
'libs.workflow.flowHandler': 'Оператор процессов',
|
|
136
160
|
'libs.default.tipText': 'В этом процессе можно использовать только "{{text}}". Пожалуйста, свяжитесь с администратором.',
|
|
137
161
|
'libs.default.flowTextTip.0': `Поле задачи "{{field}}" должно при условии "{{condition}}" указывать значение условия "{{target}}"`,
|
|
138
162
|
'libs.default.flowTextTip.1': `Поле задачи "{{field}}" должно при условии "{{condition}}"`,
|