@giteeteam/apps-team-components 1.4.1 → 1.4.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.
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { NodeItemProps } from '../../../lib/types/workflow';
2
3
  interface SelectFlowHandlerProps {
3
4
  itemId: string;
4
5
  onBack: () => void;
@@ -7,7 +8,7 @@ interface SelectFlowHandlerProps {
7
8
  loading: boolean;
8
9
  loadingUser: boolean;
9
10
  fetchUsers: (itemId: string, status: string, keyword?: string) => Promise<void>;
10
- handleTransition: (updateTask: string, screenId: string, script: string, flowHandler?: Array<{
11
+ handleTransition: (updateTask: string, screenId: string, script: string, target: NodeItemProps, flowHandler?: Array<{
11
12
  label: string;
12
13
  value: string;
13
14
  }>) => void;
@@ -55,7 +55,7 @@ const SelectFlowHandler = ({ itemId, task, onBack, users, loading, loadingUser,
55
55
  label: user.nickname ? `${user.nickname}(${user.username})` : user.username,
56
56
  value: user.objectId,
57
57
  }));
58
- 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
+ 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, task.target, submitUsers);
59
59
  }, [
60
60
  handleTransition,
61
61
  selectedUserIds.length,
@@ -63,6 +63,7 @@ const SelectFlowHandler = ({ itemId, task, onBack, users, loading, loadingUser,
63
63
  task.name,
64
64
  (_b = (_a = task.parameters) === null || _a === void 0 ? void 0 : _a.screen) === null || _b === void 0 ? void 0 : _b.key,
65
65
  (_c = task.parameters) === null || _c === void 0 ? void 0 : _c.scriptValidator,
66
+ task.target,
66
67
  ]);
67
68
  const OverflowText = () => {
68
69
  var _a, _b;
@@ -14,7 +14,7 @@ interface SelectTransitionProps {
14
14
  workflowData: WorkflowDataProps;
15
15
  approval: ApprovalData;
16
16
  checkIn: CheckInData;
17
- handleTransition: (updateTask: string, screenId: string, script: string) => void;
17
+ handleTransition: (updateTask: string, screenId: string, script: string, target?: any) => void;
18
18
  readonly: boolean;
19
19
  flowHandlerActive?: boolean;
20
20
  }
@@ -5,7 +5,7 @@ interface TransitionButtonProps {
5
5
  text: string;
6
6
  screenId: string;
7
7
  scriptValidator: string;
8
- handleTransition: (updateTask: string, screenId: string, script: string) => void;
8
+ handleTransition: (updateTask: string, screenId: string, script: string, target: NodeItemProps) => void;
9
9
  target: NodeItemProps & {
10
10
  type?: string;
11
11
  };
@@ -27,7 +27,7 @@ const TransitionButton = ({ loading, screenId, text, scriptValidator, handleTran
27
27
  return (jsx(ClassNames, { children: ({ cx, css }) => {
28
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: () => {
29
29
  if (!loading) {
30
- handleTransition(text, screenId, scriptValidator);
30
+ handleTransition(text, screenId, scriptValidator, target);
31
31
  }
32
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;
33
33
  } }));
@@ -269,13 +269,16 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
269
269
  const submitTransition = useCallback(async (itemDetail) => {
270
270
  await submitHandle(updateTransitionText, itemDetail);
271
271
  }, [submitHandle, updateTransitionText]);
272
- const handleTransition = useCallback(async (transitionText, screenId, scriptValidator, flowHandler) => {
272
+ const handleTransition = useCallback(async (transitionText, screenId, scriptValidator, target, flowHandler) => {
273
273
  if (flowHandlerActive) {
274
274
  if (transitionStep === TransitionStepType.SelectTransition) {
275
- setCurrentFlowHandler(undefined);
276
- setFlowTask(tasks.find(task => task.name === transitionText));
277
- setTransitionStep(TransitionStepType.SelectFlowHandler);
278
- return;
275
+ const nextStateTransition = workflowData.transitions.find(t => t.source.id === target.key);
276
+ if (nextStateTransition) {
277
+ setCurrentFlowHandler(undefined);
278
+ setFlowTask(tasks.find(task => task.name === transitionText));
279
+ setTransitionStep(TransitionStepType.SelectFlowHandler);
280
+ return;
281
+ }
279
282
  }
280
283
  else {
281
284
  console.info('flowHandler', flowHandler);
@@ -318,8 +321,9 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
318
321
  }
319
322
  }, [
320
323
  flowHandlerActive,
321
- transitionStep,
322
324
  setFlowing,
325
+ transitionStep,
326
+ workflowData.transitions,
323
327
  tasks,
324
328
  itemId,
325
329
  itemType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",