balibabu commited on
Commit
b9ad0fd
·
1 Parent(s): d9499f9

feat: click on a blank area of ​​the canvas to hide the form drawer #918 (#1384)

Browse files

### What problem does this PR solve?
feat: click on a blank area of ​​the canvas to hide the form drawer #918

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

web/src/pages/flow/canvas/index.tsx CHANGED
@@ -62,6 +62,10 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
62
  [showDrawer],
63
  );
64
 
 
 
 
 
65
  const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop();
66
 
67
  const { handleKeyUp } = useHandleKeyUp();
@@ -101,6 +105,7 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
101
  onDrop={onDrop}
102
  onDragOver={onDragOver}
103
  onNodeClick={onNodeClick}
 
104
  onInit={setReactFlowInstance}
105
  onKeyUp={handleKeyUp}
106
  onSelectionChange={onSelectionChange}
 
62
  [showDrawer],
63
  );
64
 
65
+ const onPaneClick = useCallback(() => {
66
+ hideDrawer();
67
+ }, [hideDrawer]);
68
+
69
  const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop();
70
 
71
  const { handleKeyUp } = useHandleKeyUp();
 
105
  onDrop={onDrop}
106
  onDragOver={onDragOver}
107
  onNodeClick={onNodeClick}
108
+ onPaneClick={onPaneClick}
109
  onInit={setReactFlowInstance}
110
  onKeyUp={handleKeyUp}
111
  onSelectionChange={onSelectionChange}
web/src/pages/flow/constant.tsx CHANGED
@@ -203,9 +203,9 @@ export const CategorizeAnchorPointPositions = [
203
  export const RestrictedUpstreamMap = {
204
  [Operator.Begin]: [],
205
  [Operator.Categorize]: [Operator.Begin, Operator.Categorize, Operator.Answer],
206
- [Operator.Answer]: [],
207
- [Operator.Retrieval]: [],
208
- [Operator.Generate]: [],
209
  [Operator.Message]: [
210
  Operator.Begin,
211
  Operator.Message,
@@ -214,8 +214,14 @@ export const RestrictedUpstreamMap = {
214
  Operator.RewriteQuestion,
215
  Operator.Categorize,
216
  ],
217
- [Operator.Relevant]: [],
218
- [Operator.RewriteQuestion]: [],
 
 
 
 
 
 
219
  };
220
 
221
  export const NodeMap = {
 
203
  export const RestrictedUpstreamMap = {
204
  [Operator.Begin]: [],
205
  [Operator.Categorize]: [Operator.Begin, Operator.Categorize, Operator.Answer],
206
+ [Operator.Answer]: [Operator.Begin, Operator.Answer, Operator.Message],
207
+ [Operator.Retrieval]: [Operator.Begin, Operator.Relevant],
208
+ [Operator.Generate]: [Operator.Begin],
209
  [Operator.Message]: [
210
  Operator.Begin,
211
  Operator.Message,
 
214
  Operator.RewriteQuestion,
215
  Operator.Categorize,
216
  ],
217
+ [Operator.Relevant]: [Operator.Begin, Operator.Answer],
218
+ [Operator.RewriteQuestion]: [
219
+ Operator.Begin,
220
+ Operator.Message,
221
+ Operator.Generate,
222
+ Operator.RewriteQuestion,
223
+ Operator.Categorize,
224
+ ],
225
  };
226
 
227
  export const NodeMap = {
web/src/pages/flow/list/index.less CHANGED
@@ -56,6 +56,6 @@
56
  }
57
 
58
  .templatesBox {
59
- // max-height: 500px;
60
  overflow: auto;
61
  }
 
56
  }
57
 
58
  .templatesBox {
59
+ max-height: 70vh;
60
  overflow: auto;
61
  }