@nocobase/flow-engine 2.1.0-beta.22 → 2.1.0-beta.24
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/lib/components/FieldModelRenderer.js +2 -2
- package/lib/components/FlowModelRenderer.d.ts +2 -0
- package/lib/components/FlowModelRenderer.js +2 -0
- package/lib/components/dnd/gridDragPlanner.d.ts +59 -2
- package/lib/components/dnd/gridDragPlanner.js +595 -19
- package/lib/components/dnd/index.d.ts +19 -1
- package/lib/components/dnd/index.js +243 -23
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +20 -1
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +4 -0
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +21 -8
- package/lib/components/settings/wrappers/contextual/useFloatToolbarPortal.js +2 -0
- package/lib/components/settings/wrappers/contextual/useFloatToolbarVisibility.js +100 -32
- package/lib/components/subModel/index.d.ts +1 -0
- package/lib/components/subModel/index.js +19 -0
- package/lib/components/subModel/utils.d.ts +1 -1
- package/lib/data-source/index.d.ts +73 -0
- package/lib/data-source/index.js +205 -1
- package/lib/flowContext.d.ts +2 -0
- package/lib/flowI18n.js +2 -1
- package/lib/models/DisplayItemModel.d.ts +1 -1
- package/lib/models/EditableItemModel.d.ts +1 -1
- package/lib/models/FilterableItemModel.d.ts +1 -1
- package/lib/models/flowModel.d.ts +11 -9
- package/lib/models/flowModel.js +48 -9
- package/lib/provider.js +38 -23
- package/package.json +4 -4
- package/src/__tests__/provider.test.tsx +24 -2
- package/src/components/FieldModelRenderer.tsx +2 -1
- package/src/components/FlowModelRenderer.tsx +6 -0
- package/src/components/__tests__/dnd.test.ts +44 -0
- package/src/components/__tests__/gridDragPlanner.test.ts +426 -5
- package/src/components/dnd/__tests__/DndProvider.test.tsx +98 -0
- package/src/components/dnd/gridDragPlanner.ts +735 -17
- package/src/components/dnd/index.tsx +291 -27
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +25 -1
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +24 -5
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +94 -3
- package/src/components/settings/wrappers/contextual/__tests__/FlowsFloatContextMenu.test.tsx +171 -2
- package/src/components/settings/wrappers/contextual/useFloatToolbarPortal.ts +2 -0
- package/src/components/settings/wrappers/contextual/useFloatToolbarVisibility.ts +112 -32
- package/src/components/subModel/index.ts +1 -0
- package/src/data-source/__tests__/index.test.ts +34 -1
- package/src/data-source/index.ts +252 -2
- package/src/flowContext.ts +2 -0
- package/src/flowI18n.ts +2 -1
- package/src/models/DisplayItemModel.tsx +1 -1
- package/src/models/EditableItemModel.tsx +1 -1
- package/src/models/FilterableItemModel.tsx +1 -1
- package/src/models/flowModel.tsx +85 -23
- package/src/provider.tsx +41 -25
|
@@ -40,7 +40,7 @@ __export(FieldModelRenderer_exports, {
|
|
|
40
40
|
FieldModelRenderer: () => FieldModelRenderer
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(FieldModelRenderer_exports);
|
|
43
|
-
var
|
|
43
|
+
var import_FlowModelRenderer = require("./FlowModelRenderer");
|
|
44
44
|
var import_lodash = __toESM(require("lodash"));
|
|
45
45
|
var import_react = __toESM(require("react"));
|
|
46
46
|
const flowModelRendererPropKeys = [
|
|
@@ -93,7 +93,7 @@ function FieldModelRenderer(props) {
|
|
|
93
93
|
(0, import_react.useEffect)(() => {
|
|
94
94
|
model && model.setProps(modelProps);
|
|
95
95
|
}, [modelProps]);
|
|
96
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
96
|
+
return /* @__PURE__ */ import_react.default.createElement(import_FlowModelRenderer.FlowModelRenderer, { model, ...rest });
|
|
97
97
|
}
|
|
98
98
|
__name(FieldModelRenderer, "FieldModelRenderer");
|
|
99
99
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -19,6 +19,8 @@ export interface FlowModelRendererProps {
|
|
|
19
19
|
showBackground?: boolean;
|
|
20
20
|
showBorder?: boolean;
|
|
21
21
|
showDragHandle?: boolean;
|
|
22
|
+
/** 是否显示事件流入口,默认 true */
|
|
23
|
+
showDynamicFlowsEditor?: boolean;
|
|
22
24
|
/** 自定义工具栏样式,`top/left/right/bottom` 会作为 portal overlay 的 inset 使用 */
|
|
23
25
|
style?: React.CSSProperties;
|
|
24
26
|
/**
|
|
@@ -135,6 +135,7 @@ const FlowModelRendererCore = (0, import_reactive.observer)(
|
|
|
135
135
|
showBackground: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showBackground : void 0,
|
|
136
136
|
showBorder: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showBorder : void 0,
|
|
137
137
|
showDragHandle: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showDragHandle : void 0,
|
|
138
|
+
showDynamicFlowsEditor: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showDynamicFlowsEditor : void 0,
|
|
138
139
|
settingsMenuLevel,
|
|
139
140
|
extraToolbarItems,
|
|
140
141
|
toolbarStyle: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.style : void 0,
|
|
@@ -167,6 +168,7 @@ const FlowModelRendererCore = (0, import_reactive.observer)(
|
|
|
167
168
|
showBackground: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showBackground : void 0,
|
|
168
169
|
showBorder: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showBorder : void 0,
|
|
169
170
|
showDragHandle: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showDragHandle : void 0,
|
|
171
|
+
showDynamicFlowsEditor: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.showDynamicFlowsEditor : void 0,
|
|
170
172
|
settingsMenuLevel,
|
|
171
173
|
extraToolbarItems,
|
|
172
174
|
toolbarStyle: import_lodash.default.isObject(showFlowSettings) ? showFlowSettings.style : void 0,
|
|
@@ -32,6 +32,33 @@ export interface GridLayoutData {
|
|
|
32
32
|
rows: Record<string, string[][]>;
|
|
33
33
|
sizes: Record<string, number[]>;
|
|
34
34
|
rowOrder?: string[];
|
|
35
|
+
layout?: GridLayoutV2;
|
|
36
|
+
}
|
|
37
|
+
export interface GridLayoutV2 {
|
|
38
|
+
version: 2;
|
|
39
|
+
rows: GridRowV2[];
|
|
40
|
+
}
|
|
41
|
+
export interface GridRowV2 {
|
|
42
|
+
id: string;
|
|
43
|
+
cells: GridCellV2[];
|
|
44
|
+
sizes: number[];
|
|
45
|
+
}
|
|
46
|
+
export interface GridCellV2 {
|
|
47
|
+
id: string;
|
|
48
|
+
items?: string[];
|
|
49
|
+
rows?: GridRowV2[];
|
|
50
|
+
}
|
|
51
|
+
export interface GridLayoutPathEntry {
|
|
52
|
+
rowId: string;
|
|
53
|
+
cellId?: string;
|
|
54
|
+
}
|
|
55
|
+
export type GridLayoutPath = GridLayoutPathEntry[];
|
|
56
|
+
export interface GridLayoutPosition {
|
|
57
|
+
path: GridLayoutPath;
|
|
58
|
+
rowIndex: number;
|
|
59
|
+
cellIndex: number;
|
|
60
|
+
itemIndex: number;
|
|
61
|
+
itemUid: string;
|
|
35
62
|
}
|
|
36
63
|
export interface ColumnSlot {
|
|
37
64
|
type: 'column';
|
|
@@ -40,6 +67,7 @@ export interface ColumnSlot {
|
|
|
40
67
|
insertIndex: number;
|
|
41
68
|
position: 'before' | 'after';
|
|
42
69
|
rect: Rect;
|
|
70
|
+
path?: GridLayoutPath;
|
|
43
71
|
}
|
|
44
72
|
export interface ColumnEdgeSlot {
|
|
45
73
|
type: 'column-edge';
|
|
@@ -47,12 +75,14 @@ export interface ColumnEdgeSlot {
|
|
|
47
75
|
columnIndex: number;
|
|
48
76
|
direction: 'left' | 'right';
|
|
49
77
|
rect: Rect;
|
|
78
|
+
path?: GridLayoutPath;
|
|
50
79
|
}
|
|
51
80
|
export interface RowGapSlot {
|
|
52
81
|
type: 'row-gap';
|
|
53
82
|
targetRowId: string;
|
|
54
83
|
position: 'above' | 'below';
|
|
55
84
|
rect: Rect;
|
|
85
|
+
path?: GridLayoutPath;
|
|
56
86
|
}
|
|
57
87
|
export interface EmptyRowSlot {
|
|
58
88
|
type: 'empty-row';
|
|
@@ -63,8 +93,19 @@ export interface EmptyColumnSlot {
|
|
|
63
93
|
rowId: string;
|
|
64
94
|
columnIndex: number;
|
|
65
95
|
rect: Rect;
|
|
96
|
+
path?: GridLayoutPath;
|
|
66
97
|
}
|
|
67
|
-
export
|
|
98
|
+
export interface ItemEdgeSlot {
|
|
99
|
+
type: 'item-edge';
|
|
100
|
+
rowId: string;
|
|
101
|
+
columnIndex: number;
|
|
102
|
+
itemIndex: number;
|
|
103
|
+
itemUid: string;
|
|
104
|
+
direction: 'left' | 'right';
|
|
105
|
+
rect: Rect;
|
|
106
|
+
path?: GridLayoutPath;
|
|
107
|
+
}
|
|
108
|
+
export type LayoutSlot = ColumnSlot | ColumnEdgeSlot | RowGapSlot | EmptyRowSlot | EmptyColumnSlot | ItemEdgeSlot;
|
|
68
109
|
/**
|
|
69
110
|
* 列内插入的配置
|
|
70
111
|
*/
|
|
@@ -122,10 +163,26 @@ export interface BuildLayoutSnapshotOptions {
|
|
|
122
163
|
export declare const buildLayoutSnapshot: ({ container }: BuildLayoutSnapshotOptions) => LayoutSnapshot;
|
|
123
164
|
export declare const getSlotKey: (slot: LayoutSlot) => string;
|
|
124
165
|
export declare const resolveDropIntent: (point: Point, slots: LayoutSlot[]) => LayoutSlot | null;
|
|
166
|
+
export declare const projectLayoutToLegacyRows: (layout: GridLayoutV2) => GridLayoutData;
|
|
167
|
+
export declare const normalizeGridLayout: ({ layout, rows, sizes, rowOrder, itemUids, generateId, logger, gridUid, }: {
|
|
168
|
+
layout?: GridLayoutV2 | null;
|
|
169
|
+
rows?: Record<string, string[][]>;
|
|
170
|
+
sizes?: Record<string, number[]>;
|
|
171
|
+
rowOrder?: string[];
|
|
172
|
+
itemUids?: string[];
|
|
173
|
+
generateId?: () => string;
|
|
174
|
+
logger?: Pick<Console, 'warn'>;
|
|
175
|
+
gridUid?: string;
|
|
176
|
+
}) => GridLayoutV2;
|
|
177
|
+
export declare const replaceUidInGridLayout: (layout: GridLayoutV2, fromUid: string, toUid: string) => GridLayoutV2;
|
|
178
|
+
export declare const findModelUidLayoutPosition: (layout: GridLayoutV2, uidValue: string) => GridLayoutPosition | null;
|
|
179
|
+
export declare const isSameGridLayout: (a: GridLayoutV2, b: GridLayoutV2) => boolean;
|
|
125
180
|
export interface SimulateLayoutOptions {
|
|
126
181
|
slot: LayoutSlot;
|
|
127
182
|
sourceUid: string;
|
|
128
183
|
layout: GridLayoutData;
|
|
129
184
|
generateRowId?: () => string;
|
|
185
|
+
generatedIds?: Map<string, string>;
|
|
186
|
+
generateId?: (key: string) => string;
|
|
130
187
|
}
|
|
131
|
-
export declare const simulateLayoutForSlot: ({ slot, sourceUid, layout, generateRowId, }: SimulateLayoutOptions) => GridLayoutData;
|
|
188
|
+
export declare const simulateLayoutForSlot: ({ slot, sourceUid, layout, generateRowId, generatedIds, generateId, }: SimulateLayoutOptions) => GridLayoutData;
|