@nocobase/flow-engine 2.1.0-beta.33 → 2.1.0-beta.34
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.
|
@@ -39,4 +39,15 @@ export declare const Droppable: FC<{
|
|
|
39
39
|
model: FlowModel<any>;
|
|
40
40
|
children: React.ReactNode;
|
|
41
41
|
}>;
|
|
42
|
-
export
|
|
42
|
+
export interface DndProviderProps extends DndContextProps, PersistOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Whether to render the built-in `DragOverlay` (the "Dragging" pill that
|
|
45
|
+
* follows the cursor). Defaults to `true` for backwards compatibility with
|
|
46
|
+
* existing flow-engine drag interactions. Set to `false` when the
|
|
47
|
+
* surrounding UI already gives clear visual feedback (e.g. a drag-sort
|
|
48
|
+
* table that highlights the drop position) and the floating pill would be
|
|
49
|
+
* redundant.
|
|
50
|
+
*/
|
|
51
|
+
showDragOverlay?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare const DndProvider: FC<DndProviderProps>;
|
|
@@ -274,6 +274,7 @@ const Droppable = /* @__PURE__ */ __name(({ model, children }) => {
|
|
|
274
274
|
}, "Droppable");
|
|
275
275
|
const DndProvider = /* @__PURE__ */ __name(({
|
|
276
276
|
persist = true,
|
|
277
|
+
showDragOverlay = true,
|
|
277
278
|
children,
|
|
278
279
|
onDragStart,
|
|
279
280
|
onDragEnd,
|
|
@@ -337,7 +338,7 @@ const DndProvider = /* @__PURE__ */ __name(({
|
|
|
337
338
|
...restProps
|
|
338
339
|
},
|
|
339
340
|
children,
|
|
340
|
-
typeof document !== "undefined" ? (0, import_react_dom.createPortal)(
|
|
341
|
+
showDragOverlay && typeof document !== "undefined" ? (0, import_react_dom.createPortal)(
|
|
341
342
|
/* @__PURE__ */ import_react.default.createElement(
|
|
342
343
|
import_core.DragOverlay,
|
|
343
344
|
{
|
|
@@ -153,7 +153,7 @@ const _FlowExecutor = class _FlowExecutor {
|
|
|
153
153
|
const stepDefaultParams = await (0, import_utils.resolveDefaultParams)(step.defaultParams, runtimeCtx);
|
|
154
154
|
combinedParams = { ...stepDefaultParams };
|
|
155
155
|
} else {
|
|
156
|
-
flowContext.logger.
|
|
156
|
+
flowContext.logger.warn(
|
|
157
157
|
`BaseModel.applyFlow: Step '${stepKey}' in flow '${flowKey}' has neither 'use' nor 'handler'. Skipping.`
|
|
158
158
|
);
|
|
159
159
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/flow-engine",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.34",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A standalone flow engine for NocoBase, managing workflows, models, and actions.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@formily/antd-v5": "1.x",
|
|
10
10
|
"@formily/reactive": "2.x",
|
|
11
|
-
"@nocobase/sdk": "2.1.0-beta.
|
|
12
|
-
"@nocobase/shared": "2.1.0-beta.
|
|
11
|
+
"@nocobase/sdk": "2.1.0-beta.34",
|
|
12
|
+
"@nocobase/shared": "2.1.0-beta.34",
|
|
13
13
|
"ahooks": "^3.7.2",
|
|
14
14
|
"axios": "^1.7.0",
|
|
15
15
|
"dayjs": "^1.11.9",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
],
|
|
38
38
|
"author": "NocoBase Team",
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ca804833299c547f8d49f8d58f73273a4bfcd03c"
|
|
41
41
|
}
|
|
@@ -283,9 +283,22 @@ export const Droppable: FC<{ model: FlowModel<any>; children: React.ReactNode }>
|
|
|
283
283
|
);
|
|
284
284
|
};
|
|
285
285
|
|
|
286
|
+
export interface DndProviderProps extends DndContextProps, PersistOptions {
|
|
287
|
+
/**
|
|
288
|
+
* Whether to render the built-in `DragOverlay` (the "Dragging" pill that
|
|
289
|
+
* follows the cursor). Defaults to `true` for backwards compatibility with
|
|
290
|
+
* existing flow-engine drag interactions. Set to `false` when the
|
|
291
|
+
* surrounding UI already gives clear visual feedback (e.g. a drag-sort
|
|
292
|
+
* table that highlights the drop position) and the floating pill would be
|
|
293
|
+
* redundant.
|
|
294
|
+
*/
|
|
295
|
+
showDragOverlay?: boolean;
|
|
296
|
+
}
|
|
297
|
+
|
|
286
298
|
// 提供一个封装了 DragOverlay 的 DndProvider 组件,继承 DndContext 的所有 props
|
|
287
|
-
export const DndProvider: FC<
|
|
299
|
+
export const DndProvider: FC<DndProviderProps> = ({
|
|
288
300
|
persist = true,
|
|
301
|
+
showDragOverlay = true,
|
|
289
302
|
children,
|
|
290
303
|
onDragStart,
|
|
291
304
|
onDragEnd,
|
|
@@ -355,7 +368,7 @@ export const DndProvider: FC<DndContextProps & PersistOptions> = ({
|
|
|
355
368
|
{...restProps}
|
|
356
369
|
>
|
|
357
370
|
{children}
|
|
358
|
-
{typeof document !== 'undefined'
|
|
371
|
+
{showDragOverlay && typeof document !== 'undefined'
|
|
359
372
|
? createPortal(
|
|
360
373
|
<DragOverlay
|
|
361
374
|
dropAnimation={null}
|
|
@@ -158,7 +158,7 @@ export class FlowExecutor {
|
|
|
158
158
|
const stepDefaultParams = await resolveDefaultParams(step.defaultParams, runtimeCtx);
|
|
159
159
|
combinedParams = { ...stepDefaultParams };
|
|
160
160
|
} else {
|
|
161
|
-
flowContext.logger.
|
|
161
|
+
flowContext.logger.warn(
|
|
162
162
|
`BaseModel.applyFlow: Step '${stepKey}' in flow '${flowKey}' has neither 'use' nor 'handler'. Skipping.`,
|
|
163
163
|
);
|
|
164
164
|
continue;
|
|
@@ -546,6 +546,34 @@ describe('FlowModel', () => {
|
|
|
546
546
|
|
|
547
547
|
loggerSpy.mockRestore();
|
|
548
548
|
});
|
|
549
|
+
|
|
550
|
+
test('should warn and skip step when use and handler are both missing', async () => {
|
|
551
|
+
const warnSpy = vi.spyOn(model.context.logger, 'warn').mockImplementation(() => {});
|
|
552
|
+
const errorSpy = vi.spyOn(model.context.logger, 'error').mockImplementation(() => {});
|
|
553
|
+
|
|
554
|
+
TestFlowModel.registerFlow({
|
|
555
|
+
key: 'settingsOnlyFlow',
|
|
556
|
+
steps: {
|
|
557
|
+
edit: {
|
|
558
|
+
title: 'Edit',
|
|
559
|
+
uiSchema: {},
|
|
560
|
+
},
|
|
561
|
+
},
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
const result = await model.applyFlow('settingsOnlyFlow');
|
|
565
|
+
|
|
566
|
+
expect(result).toEqual({});
|
|
567
|
+
expect(warnSpy).toHaveBeenCalledWith(
|
|
568
|
+
expect.stringContaining("Step 'edit' in flow 'settingsOnlyFlow' has neither 'use' nor 'handler'"),
|
|
569
|
+
);
|
|
570
|
+
expect(errorSpy).not.toHaveBeenCalledWith(
|
|
571
|
+
expect.stringContaining("Step 'edit' in flow 'settingsOnlyFlow' has neither 'use' nor 'handler'"),
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
warnSpy.mockRestore();
|
|
575
|
+
errorSpy.mockRestore();
|
|
576
|
+
});
|
|
549
577
|
});
|
|
550
578
|
|
|
551
579
|
describe('beforeRender flows', () => {
|