@nocobase/flow-engine 2.1.0-beta.23 → 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.
@@ -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 type LayoutSlot = ColumnSlot | ColumnEdgeSlot | RowGapSlot | EmptyRowSlot | EmptyColumnSlot;
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;