@giteeteam/apps-team-components 1.3.2 → 1.4.0

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 CHANGED
@@ -22,3 +22,6 @@ pnpm storybook
22
22
 
23
23
  # 1.3.x版本
24
24
  - team最低版本为4.23.0
25
+
26
+ # 1.4.x版本
27
+ - team最低版本为4.24.0
@@ -8,14 +8,10 @@ interface SelectTransitionProps {
8
8
  itemId: string;
9
9
  itemData: ItemResultProps;
10
10
  currentUser: Record<string, any>;
11
- workspace: string;
12
11
  setPopoverVisible: (flag: boolean) => void;
13
12
  name: string;
14
13
  objectId: string;
15
14
  workflowData: WorkflowDataProps;
16
- roleIds: string[];
17
- groupIds: string[];
18
- workspaceRoleIds: string[];
19
15
  approval: ApprovalData;
20
16
  checkIn: CheckInData;
21
17
  handleTransition: (updateTask: string, screenId: string, script: string) => void;
@@ -1,16 +1,116 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
- import { memo } from 'react';
2
+ import { useState, useCallback, useEffect, memo } from 'react';
3
3
  import { ClassNames } from '@emotion/react';
4
4
  import { Spin } from 'antd';
5
+ import useWorkflowConfig from '../../../lib/hooks/useWorkflowConfig.js';
5
6
  import { i18n } from '../../../lib/i18n.js';
7
+ import { checkFlowHandler } from '../../../lib/workflow.js';
6
8
  import { spinStyle, flowNextStyle, flowWrapperStyle, noPermissionStyle } from './style/index.js';
7
9
  import TransitionButton from './TransitionButton.js';
8
10
  import View from './View.js';
9
11
 
10
- const SelectTransition = ({ fetching, flowing, tasks, itemId, itemData, currentUser, workspace, setPopoverVisible, name, objectId, workflowData, roleIds, groupIds, workspaceRoleIds, approval, checkIn, handleTransition, readonly, flowHandlerActive, }) => {
11
- 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", { className: cx(css(flowWrapperStyle)), children: tasks.map(task => {
12
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
13
- 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));
12
+ const ApprovalStatus = {
13
+ approved: 'approved',
14
+ rejected: 'rejected',
15
+ };
16
+ const CheckInStatus = {
17
+ closed: 'closed',
18
+ pending: 'pending',
19
+ };
20
+ const SelectTransition = ({ fetching, flowing, tasks, itemId, itemData, currentUser, setPopoverVisible, name, objectId, workflowData, approval, checkIn, handleTransition, readonly, flowHandlerActive, }) => {
21
+ const [transitionList, setTransitionList] = useState([]);
22
+ const [checkResultList, setCheckResultList] = useState([]);
23
+ const [init, setInit] = useState(false);
24
+ const { postCheckTransitions, hideDisabledStatusTransition } = useWorkflowConfig();
25
+ const checkApproval = useCallback(({ text }) => {
26
+ var _a;
27
+ if (!approval.requireApproval)
28
+ return [true];
29
+ const approvedTransitions = approval.transition.approved.map(approved => approved.label);
30
+ const rejectedTransitions = approval.transition.rejected.map(rejected => rejected.label);
31
+ const unrestrictedTransitions = ((_a = approval.transition.unrestricted) === null || _a === void 0 ? void 0 : _a.map(unrestricted => unrestricted.label)) || [];
32
+ if ((ApprovalStatus.approved === approval.approvalStatus && approvedTransitions.includes(text)) ||
33
+ (ApprovalStatus.rejected === approval.approvalStatus && rejectedTransitions.includes(text))) {
34
+ return [true];
35
+ }
36
+ if (![ApprovalStatus.approved, ApprovalStatus.rejected].includes(approval.approvalStatus) &&
37
+ (unrestrictedTransitions === null || unrestrictedTransitions === void 0 ? void 0 : unrestrictedTransitions.includes(text))) {
38
+ if (!approval.startApproval) {
39
+ return [true];
40
+ }
41
+ else {
42
+ return [false, i18n.t('pages.fields.view.unrestrictedStatus')];
43
+ }
44
+ }
45
+ return [false, i18n.t('pages.fields.view.approvalStatus')];
46
+ }, [approval]);
47
+ const validateCheckIn = useCallback(() => {
48
+ if (!checkIn.requireCheckIn)
49
+ return true;
50
+ if (checkIn.checkInStatus !== CheckInStatus.pending) {
51
+ return true;
52
+ }
53
+ return false;
54
+ }, [checkIn]);
55
+ const checkOneTransition = useCallback(({ text, conditionCheck }) => {
56
+ const [checkApprovalResult, checkApprovalMessage] = checkApproval({ text });
57
+ if (!checkApprovalResult) {
58
+ return {
59
+ result: false,
60
+ message: checkApprovalMessage,
61
+ };
62
+ }
63
+ if (!validateCheckIn()) {
64
+ return {
65
+ result: false,
66
+ message: i18n.t('pages.fields.view.checkInStatus'),
67
+ };
68
+ }
69
+ const checkResult = checkFlowHandler(itemData, { userId: currentUser.id }, flowHandlerActive);
70
+ if (checkResult && !checkResult.result) {
71
+ return checkResult;
72
+ }
73
+ if (!(conditionCheck === null || conditionCheck === void 0 ? void 0 : conditionCheck.result) && conditionCheck) {
74
+ if (hideDisabledStatusTransition === 'enabled') {
75
+ return { result: false, isHide: true };
76
+ }
77
+ return conditionCheck;
78
+ }
79
+ return { result: true };
80
+ }, [checkApproval, currentUser, flowHandlerActive, hideDisabledStatusTransition, validateCheckIn, itemData]);
81
+ useEffect(() => {
82
+ if (!init && workflowData.objectId && tasks.length && postCheckTransitions && itemId) {
83
+ setInit(true);
84
+ postCheckTransitions(tasks.map(_transition => ({
85
+ transitionId: _transition.id,
86
+ itemId,
87
+ workflowId: workflowData.objectId,
88
+ }))).then(_checkResultList => {
89
+ setCheckResultList(_checkResultList);
90
+ });
91
+ }
92
+ }, [init, itemId, workflowData, postCheckTransitions, tasks, itemData]);
93
+ useEffect(() => {
94
+ const _transitionList = [];
95
+ if (checkResultList.length === 0)
96
+ return;
97
+ tasks.forEach(task => {
98
+ var _a;
99
+ const conditionCheck = (_a = checkResultList.find(checkResult => checkResult.transitionId === task.id)) === null || _a === void 0 ? void 0 : _a.result;
100
+ const allResult = checkOneTransition({ text: task.name, conditionCheck });
101
+ _transitionList.push({
102
+ data: task,
103
+ checkResult: allResult,
104
+ });
105
+ });
106
+ setTransitionList(_transitionList);
107
+ }, [checkResultList, checkOneTransition, itemData, tasks]);
108
+ return (jsx(ClassNames, { children: ({ cx, css }) => (jsxs(Fragment, { children: [fetching ? (jsx(Spin, { css: css(spinStyle) })) : transitionList.length ? (jsx("div", { className: cx(css(flowNextStyle), `flow-next-global`), children: jsx("div", { className: cx(css(flowWrapperStyle)), children: transitionList
109
+ .filter(_task => { var _a; return !((_a = _task === null || _task === void 0 ? void 0 : _task.checkResult) === null || _a === void 0 ? void 0 : _a.isHide); })
110
+ .map(_task => {
111
+ var _a, _b, _c;
112
+ const { data: task, checkResult } = _task;
113
+ return (jsx(TransitionButton, { loading: flowing, text: task.name, scriptValidator: (_a = task.parameters) === null || _a === void 0 ? void 0 : _a.scriptValidator, screenId: (_c = (_b = task.parameters) === null || _b === void 0 ? void 0 : _b.screen) === null || _c === void 0 ? void 0 : _c.key, target: task.target, handleTransition: handleTransition, readonly: readonly, conditionCheck: checkResult }, task.id));
14
114
  }) }) })) : (jsx("span", { onClick: () => {
15
115
  setPopoverVisible(false);
16
116
  }, css: css(noPermissionStyle), children: i18n.t('pages.fields.view.noWorkflowOrAuth') })), jsx(View, { workflowData: workflowData, hiddenPopover: () => setPopoverVisible(false), name: name, objectId: objectId })] })) }));
@@ -1,35 +1,20 @@
1
1
  import React from 'react';
2
- import { ItemResultProps } from '../../../lib/types/item';
3
- import { ApprovalData, CheckInData, ConditionType, ListItemType, NodeItemProps } from '../../../lib/types/workflow';
4
- interface FlowButtonProps {
5
- itemId: string;
2
+ import { NodeItemProps } from '../../../lib/types/workflow';
3
+ interface TransitionButtonProps {
6
4
  loading: boolean;
7
5
  text: string;
8
6
  screenId: string;
9
- item: ItemResultProps;
10
- workspace: string;
11
- authRoles: ListItemType[] | undefined;
12
- authUsers: ListItemType[] | undefined;
13
- authGroups: ListItemType[] | undefined;
14
- authUserFields: ListItemType[] | undefined;
15
- authWorkSpaceRoles: ListItemType[] | undefined;
16
- creatorAuth: boolean | undefined;
17
7
  scriptValidator: string;
18
- userId: string;
19
- roleIds: string[];
20
- groupIds: string[];
21
- workspaceRoleIds: string[];
22
- currentTaskId: string;
23
- conditions?: ConditionType[];
24
- approval: ApprovalData;
25
- checkIn: CheckInData;
26
8
  handleTransition: (updateTask: string, screenId: string, script: string) => void;
27
9
  target: NodeItemProps & {
28
10
  type?: string;
29
11
  };
30
- hiddenPopover?: () => void;
31
12
  readonly?: boolean;
32
13
  flowHandlerActive?: boolean;
14
+ conditionCheck?: {
15
+ result: boolean;
16
+ message: string;
17
+ };
33
18
  }
34
- declare const _default: React.NamedExoticComponent<FlowButtonProps>;
19
+ declare const _default: React.NamedExoticComponent<TransitionButtonProps>;
35
20
  export default _default;
@@ -1,113 +1,22 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
- import { useState, useCallback, useEffect, useMemo, memo } from 'react';
2
+ import { useMemo, memo } from 'react';
3
3
  import { css, ClassNames } from '@emotion/react';
4
4
  import { Tooltip } from 'antd';
5
5
  import { WorkFlowStatusColor } from '../../../lib/global.js';
6
6
  import { i18n } from '../../../lib/i18n.js';
7
- import { checkTransition } from '../../../lib/workflow.js';
8
7
  import BaseOverflowTooltip from '../../common/overflow-tooltip/BaseOverflowTooltip.js';
9
8
  import { tipLineStyle, tooltipStyle, iconStyle, stateBoxStyle, flowStateStyle, flowBtnStyle, notAllowedStyle, pointerStyle } from './style/index.js';
10
9
 
11
- const ApprovalStatus = {
12
- approved: 'approved',
13
- rejected: 'rejected',
14
- };
15
- const CheckInStatus = {
16
- closed: 'closed',
17
- pending: 'pending',
18
- };
19
- const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds, workspaceRoleIds, authRoles, authUsers, authGroups, creatorAuth, authUserFields, authWorkSpaceRoles, scriptValidator, approval, checkIn, conditions = [], handleTransition, target, readonly, flowHandlerActive, }) => {
20
- const [isCheck, setIsCheck] = useState(true);
21
- const [tip, setTip] = useState('');
22
- const checkApproval = useCallback(() => {
23
- var _a;
24
- if (!approval.requireApproval)
25
- return true;
26
- const approvedTransitions = approval.transition.approved.map(approved => approved.label);
27
- const rejectedTransitions = approval.transition.rejected.map(rejected => rejected.label);
28
- const unrestrictedTransitions = ((_a = approval.transition.unrestricted) === null || _a === void 0 ? void 0 : _a.map(unrestricted => unrestricted.label)) || [];
29
- if ((ApprovalStatus.approved === approval.approvalStatus && approvedTransitions.includes(text)) ||
30
- (ApprovalStatus.rejected === approval.approvalStatus && rejectedTransitions.includes(text))) {
31
- return true;
32
- }
33
- if (![ApprovalStatus.approved, ApprovalStatus.rejected].includes(approval.approvalStatus) &&
34
- (unrestrictedTransitions === null || unrestrictedTransitions === void 0 ? void 0 : unrestrictedTransitions.includes(text))) {
35
- if (!approval.startApproval) {
36
- return true;
37
- }
38
- else {
39
- setTip(i18n.t('pages.fields.view.unrestrictedStatus'));
40
- return false;
41
- }
42
- }
43
- setTip(i18n.t('pages.fields.view.approvalStatus'));
44
- return false;
45
- }, [approval, text]);
46
- const validateCheckIn = useCallback(() => {
47
- if (!checkIn.requireCheckIn)
48
- return true;
49
- if (checkIn.checkInStatus !== CheckInStatus.pending) {
50
- return true;
51
- }
52
- return false;
53
- }, [checkIn]);
54
- const checkAuth = useCallback(async () => {
55
- setIsCheck(true);
56
- if (!checkApproval()) {
57
- setIsCheck(false);
58
- return;
59
- }
60
- if (!validateCheckIn()) {
61
- setTip(i18n.t('pages.fields.view.checkInStatus'));
62
- setIsCheck(false);
63
- return;
64
- }
65
- const transition = {
66
- parameters: {
67
- fieldType: conditions,
68
- permissionType: {
69
- users: authUsers,
70
- roles: authRoles,
71
- groups: authGroups,
72
- workspaceRoles: authWorkSpaceRoles,
73
- customFields: authUserFields,
74
- creatorAuth,
75
- },
76
- },
77
- };
78
- const checkResult = checkTransition(item, transition, { userId, roleIds, groupIds, workspaceRoleIds }, flowHandlerActive);
79
- if (!checkResult.result) {
80
- setTip(checkResult.message);
81
- setIsCheck(false);
82
- }
83
- }, [
84
- checkApproval,
85
- validateCheckIn,
86
- conditions,
87
- authUsers,
88
- authRoles,
89
- authGroups,
90
- authWorkSpaceRoles,
91
- authUserFields,
92
- creatorAuth,
93
- item,
94
- userId,
95
- roleIds,
96
- groupIds,
97
- workspaceRoleIds,
98
- flowHandlerActive,
99
- ]);
100
- useEffect(() => {
101
- checkAuth();
102
- }, [checkAuth]);
10
+ const TransitionButton = ({ loading, screenId, text, scriptValidator, handleTransition, target, readonly, conditionCheck, }) => {
103
11
  const tipContent = useMemo(() => {
12
+ const _tip = conditionCheck.message;
104
13
  if (readonly)
105
14
  return i18n.t('pages.fields.view.readonlyStatus');
106
- if (!tip)
15
+ if (!_tip)
107
16
  return '';
108
- const contents = tip.split('--');
17
+ const contents = _tip.split('--');
109
18
  return (jsx("div", { children: contents.map((text, index) => (jsx("p", { css: css(tipLineStyle), children: text }, String(index)))) }));
110
- }, [tip, readonly]);
19
+ }, [readonly, conditionCheck]);
111
20
  const OverflowText = ({ text, target }) => {
112
21
  var _a, _b;
113
22
  return (jsxs(Fragment, { children: [jsx(BaseOverflowTooltip, { css: css(tooltipStyle), title: text, children: text }), jsx("span", { css: css(iconStyle), children: " \u2192 " }), jsx("div", { css: css(stateBoxStyle), children: jsx(BaseOverflowTooltip, { css: css(flowStateStyle), style: {
@@ -116,13 +25,13 @@ const FlowButton = ({ loading, screenId, text, item, userId, roleIds, groupIds,
116
25
  }, title: target.name, children: target.name }) })] }));
117
26
  };
118
27
  return (jsx(ClassNames, { children: ({ cx, css }) => {
119
- return isCheck && !readonly ? (jsx("div", { className: cx(css(flowBtnStyle), loading ? css(notAllowedStyle) : css(pointerStyle)), onClick: () => {
28
+ return conditionCheck ? ((conditionCheck === null || conditionCheck === void 0 ? void 0 : conditionCheck.result) && !readonly ? (jsx("div", { className: cx(css(flowBtnStyle), loading ? css(notAllowedStyle) : css(pointerStyle)), onClick: () => {
120
29
  if (!loading) {
121
30
  handleTransition(text, screenId, scriptValidator);
122
31
  }
123
- }, children: jsx(OverflowText, { text: text, target: target }) })) : (jsx(Tooltip, { title: tipContent, placement: "right", children: jsx("div", { className: cx(css(flowBtnStyle), css(notAllowedStyle)), children: jsx(OverflowText, { text: text, target: target }) }) }));
32
+ }, children: jsx(OverflowText, { text: text, target: target }) })) : (jsx(Tooltip, { title: tipContent, placement: "right", children: jsx("div", { className: cx(css(flowBtnStyle), css(notAllowedStyle)), children: jsx(OverflowText, { text: text, target: target }) }) }))) : null;
124
33
  } }));
125
34
  };
126
- var TransitionButton = memo(FlowButton);
35
+ var TransitionButton$1 = memo(TransitionButton);
127
36
 
128
- export { TransitionButton as default };
37
+ export { TransitionButton$1 as default };
@@ -48,7 +48,7 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
48
48
  }, [itemId, objectId]);
49
49
  const { checkTransitionScript, getWorkflowData, getItemStatus, runTransition } = useWorkflowConfig();
50
50
  const { currentUser } = useCurrentUser();
51
- const [groupIds, roleIds, workspaceRoleIds] = useWorkflowPermission((_a = itemData === null || itemData === void 0 ? void 0 : itemData.workspace) === null || _a === void 0 ? void 0 : _a.objectId);
51
+ const [groupIds, , workspaceRoleIds] = useWorkflowPermission((_a = itemData === null || itemData === void 0 ? void 0 : itemData.workspace) === null || _a === void 0 ? void 0 : _a.objectId);
52
52
  const [tasks, setTasks] = useState([]);
53
53
  const [workflowData, setWorkflowData] = useState({ nodes: [], transitions: [] });
54
54
  const updateWorkflowMessage = useCallback((workflowData, statusId) => {
@@ -256,7 +256,7 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
256
256
  refreshFlag.current++;
257
257
  refresh();
258
258
  });
259
- 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 })) }));
259
+ 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, setPopoverVisible: setPopoverVisible, name: name, objectId: objectId, workflowData: workflowData, approval: approval, checkIn: checkIn, handleTransition: handleTransition, readonly: readonly, flowHandlerActive: flowHandlerActive })) }));
260
260
  };
261
261
  function getWorkflowConfig(workflow, statusId) {
262
262
  var _a, _b, _c, _d, _e;
@@ -5,6 +5,8 @@ export interface IWorkflowConfig {
5
5
  getWorkflowData?: (itemId: string) => Promise<any>;
6
6
  runTransition?: (params: Record<string, any>) => Promise<any>;
7
7
  getItemStatus?: (itemId: string) => Promise<any>;
8
+ postCheckTransitions?: (params: Record<string, any>[]) => Promise<any>;
9
+ hideDisabledStatusTransition?: string;
8
10
  }
9
11
  export interface IWorkflowConfigContext {
10
12
  workflow?: IWorkflowConfig;
@@ -107,5 +107,6 @@ interface CheckUserPermissionParams {
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
109
  export declare function checkTransition(item: ItemResultProps, transition: TransitionProps, permissions: WorkflowPermissionType, flowHandlerActive?: boolean): ResultType;
110
+ export declare function checkFlowHandler(item: ItemResultProps, permissions: WorkflowPermissionType, flowHandlerActive?: boolean): ResultType;
110
111
  export declare const useWorkflowPermission: (workspaceId: ObjectId) => [ObjectId[], ObjectId[], ObjectId[]];
111
112
  export {};
@@ -375,6 +375,25 @@ function checkTransition(item, transition, permissions, flowHandlerActive) {
375
375
  return conditionCheck;
376
376
  return { result: true };
377
377
  }
378
+ function checkFlowHandler(item, permissions, flowHandlerActive) {
379
+ var _a, _b;
380
+ if (!item)
381
+ return { result: false };
382
+ 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)) {
383
+ const flowHandler = item.values.flowHandler;
384
+ const flowUser = flowHandler.find(user => user.value === permissions.userId);
385
+ if (flowUser) {
386
+ return { result: true };
387
+ }
388
+ else {
389
+ const tipUsers = flowHandler.map(user => user.label).join('、');
390
+ return {
391
+ result: false,
392
+ message: i18n.t('libs.default.tipText', { text: `${i18n.t('libs.workflow.flowHandler')}:${tipUsers}` }),
393
+ };
394
+ }
395
+ }
396
+ }
378
397
  const useWorkflowPermission = (workspaceId) => {
379
398
  const [roles, setRoles] = useState([]);
380
399
  const [groups, setGroups] = useState([]);
@@ -397,4 +416,4 @@ const useWorkflowPermission = (workspaceId) => {
397
416
  return [groups, roles, workspaceRoles];
398
417
  };
399
418
 
400
- export { DropdownConditions, ElementEnum, EmptyConditionList, NodeEnum, NumberConditions, StringConditions, checkItemCondition, checkTransition, checkUserPermission, getScriptUser, isEmptyCondition, useWorkflowPermission };
419
+ export { DropdownConditions, ElementEnum, EmptyConditionList, NodeEnum, NumberConditions, StringConditions, checkFlowHandler, checkItemCondition, checkTransition, checkUserPermission, getScriptUser, isEmptyCondition, useWorkflowPermission };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",