@nocobase/flow-engine 2.0.0-alpha.49 → 2.0.0-alpha.50
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/acl/Acl.d.ts +2 -1
- package/lib/acl/Acl.js +19 -23
- package/lib/flowEngine.js +20 -8
- package/lib/locale/de-DE.json +63 -0
- package/lib/locale/en-US.json +48 -48
- package/lib/locale/es-ES.json +63 -0
- package/lib/locale/fr-FR.json +63 -0
- package/lib/locale/hu-HU.json +63 -0
- package/lib/locale/id-ID.json +63 -0
- package/lib/locale/index.d.ts +94 -94
- package/lib/locale/it-IT.json +63 -0
- package/lib/locale/ja-JP.json +63 -0
- package/lib/locale/ko-KR.json +63 -0
- package/lib/locale/nl-NL.json +63 -0
- package/lib/locale/pt-BR.json +63 -0
- package/lib/locale/ru-RU.json +63 -0
- package/lib/locale/tr-TR.json +63 -0
- package/lib/locale/uk-UA.json +63 -0
- package/lib/locale/vi-VN.json +63 -0
- package/lib/locale/zh-CN.json +48 -48
- package/lib/locale/zh-TW.json +63 -0
- package/lib/models/flowModel.d.ts +2 -2
- package/lib/resources/multiRecordResource.js +1 -17
- package/lib/resources/singleRecordResource.js +1 -17
- package/lib/types.d.ts +8 -0
- package/lib/utils/serverContextParams.d.ts +3 -0
- package/lib/utils/serverContextParams.js +2 -0
- package/lib/utils/variablesParams.js +2 -1
- package/lib/views/createViewMeta.d.ts +1 -0
- package/lib/views/createViewMeta.js +39 -18
- package/package.json +4 -4
- package/src/__tests__/createViewMeta.popup.test.ts +8 -1
- package/src/acl/Acl.tsx +19 -24
- package/src/flowEngine.ts +24 -7
- package/src/locale/de-DE.json +63 -0
- package/src/locale/en-US.json +48 -48
- package/src/locale/es-ES.json +63 -0
- package/src/locale/fr-FR.json +63 -0
- package/src/locale/hu-HU.json +63 -0
- package/src/locale/id-ID.json +63 -0
- package/src/locale/it-IT.json +63 -0
- package/src/locale/ja-JP.json +63 -0
- package/src/locale/ko-KR.json +63 -0
- package/src/locale/nl-NL.json +63 -0
- package/src/locale/pt-BR.json +63 -0
- package/src/locale/ru-RU.json +63 -0
- package/src/locale/tr-TR.json +63 -0
- package/src/locale/uk-UA.json +63 -0
- package/src/locale/vi-VN.json +63 -0
- package/src/locale/zh-CN.json +48 -48
- package/src/locale/zh-TW.json +63 -0
- package/src/models/__tests__/flowEngine.resolveUse.test.ts +58 -0
- package/src/models/flowModel.tsx +2 -4
- package/src/resources/multiRecordResource.ts +1 -20
- package/src/resources/singleRecordResource.ts +1 -17
- package/src/types.ts +12 -0
- package/src/utils/__tests__/variablesParams.test.ts +33 -0
- package/src/utils/serverContextParams.ts +5 -0
- package/src/utils/variablesParams.ts +2 -1
- package/src/views/createViewMeta.ts +27 -5
|
@@ -150,6 +150,8 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
150
150
|
collection: res.collectionName,
|
|
151
151
|
dataSourceKey: res.dataSourceKey || 'main',
|
|
152
152
|
filterByTk: res.filterByTk,
|
|
153
|
+
associationName: res.associationName,
|
|
154
|
+
sourceId: res.sourceId,
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
}
|
|
@@ -175,7 +177,7 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
175
177
|
const parent = stack[idx];
|
|
176
178
|
if (!parent?.viewUid) return undefined;
|
|
177
179
|
|
|
178
|
-
let model = useCtx.engine?.getModel
|
|
180
|
+
let model = useCtx.engine?.getModel(parent.viewUid, true) as PopupModelLike;
|
|
179
181
|
if (!model) {
|
|
180
182
|
try {
|
|
181
183
|
model = (await useCtx.engine.loadModel({ uid: parent.viewUid })) as PopupModelLike;
|
|
@@ -188,7 +190,14 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
188
190
|
const dataSourceKey = params?.dataSourceKey || 'main';
|
|
189
191
|
const filterByTk = parent?.filterByTk ?? parent?.sourceId;
|
|
190
192
|
if (!collection || typeof filterByTk === 'undefined' || filterByTk === null) return undefined;
|
|
191
|
-
|
|
193
|
+
const ref: RecordRef = {
|
|
194
|
+
collection,
|
|
195
|
+
dataSourceKey,
|
|
196
|
+
filterByTk,
|
|
197
|
+
sourceId: parent?.sourceId,
|
|
198
|
+
associationName: params?.associationName,
|
|
199
|
+
};
|
|
200
|
+
return ref;
|
|
192
201
|
} catch (e) {
|
|
193
202
|
(flowCtx?.logger || ctx.logger)?.warn?.({ err: e }, '[FlowEngine] popup.getParentRecordRef failed');
|
|
194
203
|
return undefined;
|
|
@@ -245,6 +254,7 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
245
254
|
properties: async () => ({
|
|
246
255
|
dataSourceKey: { type: 'string', title: t('Data source key') },
|
|
247
256
|
collectionName: { type: 'string', title: t('Collection name') },
|
|
257
|
+
associationName: { type: 'string', title: t('Association name') },
|
|
248
258
|
filterByTk: { type: 'string', title: t('filterByTk') },
|
|
249
259
|
sourceId: { type: 'string', title: t('sourceId') },
|
|
250
260
|
}),
|
|
@@ -276,7 +286,16 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
276
286
|
parent?: PopupVariableParams;
|
|
277
287
|
};
|
|
278
288
|
const params: PopupVariableParams = {};
|
|
279
|
-
if (ref)
|
|
289
|
+
if (ref) {
|
|
290
|
+
const merged: RecordRef = { ...ref };
|
|
291
|
+
if (!merged.associationName && inputArgs?.associationName) {
|
|
292
|
+
merged.associationName = inputArgs.associationName;
|
|
293
|
+
}
|
|
294
|
+
if (typeof merged.sourceId === 'undefined' && typeof inputArgs?.sourceId !== 'undefined') {
|
|
295
|
+
merged.sourceId = inputArgs?.sourceId;
|
|
296
|
+
}
|
|
297
|
+
params.record = merged;
|
|
298
|
+
}
|
|
280
299
|
|
|
281
300
|
// 构建 parent 链(用于服务端解析 ctx.popup.parent[.parent...].record.*)
|
|
282
301
|
try {
|
|
@@ -348,7 +367,7 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
348
367
|
const stack = Array.isArray(nav?.viewStack) ? nav.viewStack : [];
|
|
349
368
|
const last = stack?.[stack.length - 1];
|
|
350
369
|
if (last?.viewUid) {
|
|
351
|
-
let model = ctx?.engine?.getModel
|
|
370
|
+
let model = ctx?.engine?.getModel(last.viewUid, true) as PopupModelLike;
|
|
352
371
|
if (!model) {
|
|
353
372
|
model = (await ctx.engine.loadModel({ uid: last.viewUid })) as PopupModelLike;
|
|
354
373
|
}
|
|
@@ -388,6 +407,7 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
388
407
|
properties: async () => ({
|
|
389
408
|
dataSourceKey: { type: 'string', title: t('Data source key') },
|
|
390
409
|
collectionName: { type: 'string', title: t('Collection name') },
|
|
410
|
+
associationName: { type: 'string', title: t('Association name') },
|
|
391
411
|
filterByTk: { type: 'string', title: t('filterByTk') },
|
|
392
412
|
sourceId: { type: 'string', title: t('sourceId') },
|
|
393
413
|
}),
|
|
@@ -415,6 +435,7 @@ export function createPopupMeta(ctx: FlowContext, anchorView?: FlowView): Proper
|
|
|
415
435
|
interface PopupNodeResource {
|
|
416
436
|
dataSourceKey: string;
|
|
417
437
|
collectionName?: string;
|
|
438
|
+
associationName?: string;
|
|
418
439
|
filterByTk?: any;
|
|
419
440
|
sourceId?: any;
|
|
420
441
|
}
|
|
@@ -431,7 +452,7 @@ export async function buildPopupRuntime(ctx: FlowContext, view: FlowView): Promi
|
|
|
431
452
|
const buildNode = async (idx: number): Promise<PopupNode | undefined> => {
|
|
432
453
|
if (idx < 0 || !stack[idx]?.viewUid) return undefined;
|
|
433
454
|
const viewUid = stack[idx].viewUid;
|
|
434
|
-
let model = ctx.engine?.getModel
|
|
455
|
+
let model = ctx.engine?.getModel(viewUid, true) as PopupModelLike;
|
|
435
456
|
if (!model) {
|
|
436
457
|
model = (await ctx.engine?.loadModel({ uid: viewUid })) as PopupModelLike;
|
|
437
458
|
}
|
|
@@ -443,6 +464,7 @@ export async function buildPopupRuntime(ctx: FlowContext, view: FlowView): Promi
|
|
|
443
464
|
resource: {
|
|
444
465
|
dataSourceKey,
|
|
445
466
|
collectionName,
|
|
467
|
+
associationName: p?.associationName,
|
|
446
468
|
filterByTk: stack[idx]?.filterByTk,
|
|
447
469
|
sourceId: stack[idx]?.sourceId,
|
|
448
470
|
},
|