@nocobase/flow-engine 2.1.0-beta.42 → 2.1.0-beta.43
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/subModel/LazyDropdown.js +17 -9
- package/lib/flowContext.d.ts +6 -1
- package/lib/flowContext.js +35 -6
- package/lib/flowEngine.d.ts +1 -0
- package/lib/flowEngine.js +53 -30
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.js +4 -3
- package/lib/runjs-context/contexts/JSBlockRunJSContext.js +4 -15
- package/lib/runjs-context/contexts/JSColumnRunJSContext.js +5 -2
- package/lib/runjs-context/contexts/JSEditableFieldRunJSContext.js +5 -8
- package/lib/runjs-context/contexts/JSFieldRunJSContext.js +4 -3
- package/lib/runjs-context/contexts/JSItemRunJSContext.js +4 -3
- package/lib/runjs-context/contexts/base.js +464 -29
- package/lib/runjs-context/contexts/elementDoc.d.ts +11 -0
- package/lib/runjs-context/contexts/elementDoc.js +152 -0
- package/lib/utils/loadedPageCache.d.ts +24 -0
- package/lib/utils/loadedPageCache.js +139 -0
- package/package.json +4 -4
- package/src/__tests__/flowContext.test.ts +23 -0
- package/src/__tests__/runjsContext.test.ts +18 -0
- package/src/__tests__/runjsContextImplementations.test.ts +9 -2
- package/src/__tests__/runjsLocales.test.ts +6 -5
- package/src/__tests__/viewScopedFlowEngine.test.ts +133 -0
- package/src/components/subModel/LazyDropdown.tsx +16 -7
- package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +51 -0
- package/src/flowContext.ts +40 -6
- package/src/flowEngine.ts +51 -27
- package/src/runjs-context/contexts/FormJSFieldItemRunJSContext.ts +4 -3
- package/src/runjs-context/contexts/JSBlockRunJSContext.ts +4 -15
- package/src/runjs-context/contexts/JSColumnRunJSContext.ts +4 -2
- package/src/runjs-context/contexts/JSEditableFieldRunJSContext.ts +5 -9
- package/src/runjs-context/contexts/JSFieldRunJSContext.ts +4 -3
- package/src/runjs-context/contexts/JSItemRunJSContext.ts +4 -3
- package/src/runjs-context/contexts/base.ts +467 -31
- package/src/runjs-context/contexts/elementDoc.ts +130 -0
- package/src/utils/loadedPageCache.ts +147 -0
|
@@ -332,7 +332,7 @@ const getLabelSearchText = /* @__PURE__ */ __name((label) => {
|
|
|
332
332
|
}
|
|
333
333
|
return "";
|
|
334
334
|
}, "getLabelSearchText");
|
|
335
|
-
const createSearchItem = /* @__PURE__ */ __name((item, searchKey, currentSearchValue, menuVisible, t, searchHandlers, activateSearchSubmenu, deactivateSearchSubmenu) => ({
|
|
335
|
+
const createSearchItem = /* @__PURE__ */ __name((item, searchKey, currentSearchValue, menuVisible, t, searchHandlers, activateSearchSubmenu, deactivateSearchSubmenu, shouldActivateSearchSubmenu) => ({
|
|
336
336
|
key: `${searchKey}-search`,
|
|
337
337
|
type: "group",
|
|
338
338
|
label: /* @__PURE__ */ import_react.default.createElement("div", { onMouseDown: (e) => e.stopPropagation(), onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -350,28 +350,34 @@ const createSearchItem = /* @__PURE__ */ __name((item, searchKey, currentSearchV
|
|
|
350
350
|
var _a;
|
|
351
351
|
e.stopPropagation();
|
|
352
352
|
const value = e.target.value;
|
|
353
|
-
|
|
353
|
+
if (shouldActivateSearchSubmenu) {
|
|
354
|
+
activateSearchSubmenu(searchKey);
|
|
355
|
+
}
|
|
354
356
|
if (((_a = e.nativeEvent) == null ? void 0 : _a.isComposing) || searchHandlers.isComposing(searchKey)) {
|
|
355
357
|
searchHandlers.updateInputValue(searchKey, value);
|
|
356
358
|
return;
|
|
357
359
|
}
|
|
358
|
-
if (!value) {
|
|
360
|
+
if (!value && shouldActivateSearchSubmenu) {
|
|
359
361
|
deactivateSearchSubmenu(searchKey);
|
|
360
362
|
}
|
|
361
363
|
searchHandlers.updateSearchValue(searchKey, value);
|
|
362
364
|
},
|
|
363
365
|
onCompositionStart: (e) => {
|
|
364
366
|
e.stopPropagation();
|
|
365
|
-
|
|
367
|
+
if (shouldActivateSearchSubmenu) {
|
|
368
|
+
activateSearchSubmenu(searchKey);
|
|
369
|
+
}
|
|
366
370
|
searchHandlers.startComposition(searchKey);
|
|
367
371
|
},
|
|
368
372
|
onCompositionEnd: (e) => {
|
|
369
373
|
e.stopPropagation();
|
|
370
374
|
const value = e.currentTarget.value;
|
|
371
|
-
if (
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
+
if (shouldActivateSearchSubmenu) {
|
|
376
|
+
if (value) {
|
|
377
|
+
activateSearchSubmenu(searchKey);
|
|
378
|
+
} else {
|
|
379
|
+
deactivateSearchSubmenu(searchKey);
|
|
380
|
+
}
|
|
375
381
|
}
|
|
376
382
|
searchHandlers.endComposition(searchKey, value);
|
|
377
383
|
},
|
|
@@ -557,6 +563,7 @@ const LazyDropdown = /* @__PURE__ */ __name(({ menu, ...props }) => {
|
|
|
557
563
|
const searchKey = keyPath;
|
|
558
564
|
const currentSearchValue = searchValues[searchKey] || "";
|
|
559
565
|
const currentInputValue = inputValues[searchKey] ?? currentSearchValue;
|
|
566
|
+
const shouldActivateSearchSubmenu = !(item.type === "group" && path.length === 0);
|
|
560
567
|
const filteredChildren = currentSearchValue ? (/* @__PURE__ */ __name(function deepFilter(items2) {
|
|
561
568
|
const searchText = currentSearchValue.toLowerCase();
|
|
562
569
|
return items2.map((child) => {
|
|
@@ -581,7 +588,8 @@ const LazyDropdown = /* @__PURE__ */ __name(({ menu, ...props }) => {
|
|
|
581
588
|
t,
|
|
582
589
|
searchHandlers,
|
|
583
590
|
activateSearchSubmenu,
|
|
584
|
-
deactivateSearchSubmenu
|
|
591
|
+
deactivateSearchSubmenu,
|
|
592
|
+
shouldActivateSearchSubmenu
|
|
585
593
|
);
|
|
586
594
|
const dividerItem = { key: `${keyPath}-search-divider`, type: "divider" };
|
|
587
595
|
if (currentSearchValue && resolvedFiltered.length === 0) {
|
package/lib/flowContext.d.ts
CHANGED
|
@@ -222,6 +222,10 @@ export type FlowContextGetApiInfosOptions = {
|
|
|
222
222
|
* RunJS 文档版本(默认 v1)。
|
|
223
223
|
*/
|
|
224
224
|
version?: RunJSVersion;
|
|
225
|
+
/**
|
|
226
|
+
* Include editor completion metadata. Defaults to false so API-doc callers keep the compact public shape.
|
|
227
|
+
*/
|
|
228
|
+
includeCompletion?: boolean;
|
|
225
229
|
};
|
|
226
230
|
export type FlowContextGetVarInfosOptions = {
|
|
227
231
|
/**
|
|
@@ -293,7 +297,7 @@ export declare class FlowContext {
|
|
|
293
297
|
* - 输出仅来自 RunJS doc 与 defineProperty/defineMethod 的 info
|
|
294
298
|
* - 不读取/展开 PropertyMeta(变量结构)
|
|
295
299
|
* - 不自动展开深层 properties
|
|
296
|
-
* -
|
|
300
|
+
* - 默认不返回自动补全字段(例如 completion),传入 includeCompletion=true 时返回
|
|
297
301
|
*/
|
|
298
302
|
getApiInfos(options?: FlowContextGetApiInfosOptions): Promise<Record<string, FlowContextApiInfo>>;
|
|
299
303
|
/**
|
|
@@ -423,6 +427,7 @@ export declare class FlowRuntimeContext<TModel extends FlowModel = FlowModel, TM
|
|
|
423
427
|
export type FlowSettingsContext<TModel extends FlowModel = FlowModel> = FlowRuntimeContext<TModel, 'settings'>;
|
|
424
428
|
export type RunJSDocCompletionDoc = {
|
|
425
429
|
insertText?: string;
|
|
430
|
+
requires?: Array<'element'>;
|
|
426
431
|
};
|
|
427
432
|
export type RunJSDocHiddenDoc = boolean | ((ctx: any) => boolean | Promise<boolean>);
|
|
428
433
|
export type RunJSDocHiddenOrPathsDoc = boolean | string[] | ((ctx: any) => boolean | string[] | Promise<boolean | string[]>);
|
package/lib/flowContext.js
CHANGED
|
@@ -399,10 +399,11 @@ const _FlowContext = class _FlowContext {
|
|
|
399
399
|
* - 输出仅来自 RunJS doc 与 defineProperty/defineMethod 的 info
|
|
400
400
|
* - 不读取/展开 PropertyMeta(变量结构)
|
|
401
401
|
* - 不自动展开深层 properties
|
|
402
|
-
* -
|
|
402
|
+
* - 默认不返回自动补全字段(例如 completion),传入 includeCompletion=true 时返回
|
|
403
403
|
*/
|
|
404
404
|
async getApiInfos(options = {}) {
|
|
405
405
|
const version = options.version || "v1";
|
|
406
|
+
const includeCompletion = !!options.includeCompletion;
|
|
406
407
|
const evalCtx = this.createProxy();
|
|
407
408
|
const isPrivateKey = /* @__PURE__ */ __name((key) => typeof key === "string" && key.startsWith("_"), "isPrivateKey");
|
|
408
409
|
const isVarRootKey = /* @__PURE__ */ __name((key) => key === "record" || key === "formValues" || key === "popup", "isVarRootKey");
|
|
@@ -439,7 +440,14 @@ const _FlowContext = class _FlowContext {
|
|
|
439
440
|
const src = toDocObject(obj);
|
|
440
441
|
if (!src) return {};
|
|
441
442
|
const out2 = {};
|
|
442
|
-
for (const k of [
|
|
443
|
+
for (const k of [
|
|
444
|
+
"description",
|
|
445
|
+
"examples",
|
|
446
|
+
...includeCompletion ? ["completion"] : [],
|
|
447
|
+
"ref",
|
|
448
|
+
"params",
|
|
449
|
+
"returns"
|
|
450
|
+
]) {
|
|
443
451
|
const v = src[k];
|
|
444
452
|
if (typeof v !== "undefined") out2[k] = v;
|
|
445
453
|
}
|
|
@@ -452,7 +460,17 @@ const _FlowContext = class _FlowContext {
|
|
|
452
460
|
const src = toDocObject(obj);
|
|
453
461
|
if (!src) return {};
|
|
454
462
|
const out2 = {};
|
|
455
|
-
for (const k of [
|
|
463
|
+
for (const k of [
|
|
464
|
+
"title",
|
|
465
|
+
"type",
|
|
466
|
+
"interface",
|
|
467
|
+
"description",
|
|
468
|
+
"examples",
|
|
469
|
+
...includeCompletion ? ["completion"] : [],
|
|
470
|
+
"ref",
|
|
471
|
+
"params",
|
|
472
|
+
"returns"
|
|
473
|
+
]) {
|
|
456
474
|
const v = src[k];
|
|
457
475
|
if (typeof v !== "undefined") out2[k] = v;
|
|
458
476
|
}
|
|
@@ -539,7 +557,7 @@ const _FlowContext = class _FlowContext {
|
|
|
539
557
|
node = { ...node, ...pickPropertyInfo(docObj) };
|
|
540
558
|
node = { ...node, ...pickPropertyInfo(infoObj) };
|
|
541
559
|
delete node.properties;
|
|
542
|
-
delete node.completion;
|
|
560
|
+
if (!includeCompletion) delete node.completion;
|
|
543
561
|
if (!Object.keys(node).length) continue;
|
|
544
562
|
const outKey = mapDocKeyToApiKey(key, docNode);
|
|
545
563
|
out[outKey] = out[outKey] ? { ...out[outKey] || {}, ...node || {} } : node;
|
|
@@ -554,7 +572,7 @@ const _FlowContext = class _FlowContext {
|
|
|
554
572
|
node = { ...node, ...pickMethodInfo(docObj) };
|
|
555
573
|
node = { ...node, ...pickMethodInfo(info) };
|
|
556
574
|
delete node.properties;
|
|
557
|
-
delete node.completion;
|
|
575
|
+
if (!includeCompletion) delete node.completion;
|
|
558
576
|
if (!Object.keys(node).length) continue;
|
|
559
577
|
node.type = "function";
|
|
560
578
|
if (!out[key]) out[key] = node;
|
|
@@ -571,7 +589,7 @@ const _FlowContext = class _FlowContext {
|
|
|
571
589
|
let node = {};
|
|
572
590
|
node = { ...node, ...pickPropertyInfo(childObj) };
|
|
573
591
|
delete node.properties;
|
|
574
|
-
delete node.completion;
|
|
592
|
+
if (!includeCompletion) delete node.completion;
|
|
575
593
|
if (!node.description || !String(node.description).trim()) continue;
|
|
576
594
|
out[outKey] = node;
|
|
577
595
|
}
|
|
@@ -2255,6 +2273,17 @@ const _BaseFlowEngineContext = class _BaseFlowEngineContext extends FlowContext
|
|
|
2255
2273
|
});
|
|
2256
2274
|
const jsCode = await (0, import_utils.prepareRunJsCode)(String(code ?? ""), { preprocessTemplates: shouldPreprocessTemplates });
|
|
2257
2275
|
return runner.run(jsCode);
|
|
2276
|
+
},
|
|
2277
|
+
{
|
|
2278
|
+
description: "Execute a RunJS code string in the current Flow context.",
|
|
2279
|
+
detail: "(code: string, variables?: Record<string, any>, options?: JSRunnerOptions) => Promise<RunJSResult>",
|
|
2280
|
+
params: [
|
|
2281
|
+
{ name: "code", type: "string", description: "RunJS code to execute." },
|
|
2282
|
+
{ name: "variables", type: "Record<string, any>", optional: true, description: "Additional globals." },
|
|
2283
|
+
{ name: "options", type: "JSRunnerOptions", optional: true, description: "Runner options." }
|
|
2284
|
+
],
|
|
2285
|
+
returns: { type: "Promise<{ success: boolean; value?: any; error?: any; timeout?: boolean }>" },
|
|
2286
|
+
completion: { insertText: `await ctx.runjs('return 1')` }
|
|
2258
2287
|
}
|
|
2259
2288
|
);
|
|
2260
2289
|
}
|
package/lib/flowEngine.d.ts
CHANGED
package/lib/flowEngine.js
CHANGED
|
@@ -61,6 +61,7 @@ var import_ReactView = require("./ReactView");
|
|
|
61
61
|
var import_resources = require("./resources");
|
|
62
62
|
var import_emitter = require("./emitter");
|
|
63
63
|
var import_ModelOperationScheduler = __toESM(require("./scheduler/ModelOperationScheduler"));
|
|
64
|
+
var import_loadedPageCache = require("./utils/loadedPageCache");
|
|
64
65
|
var import_utils = require("./utils");
|
|
65
66
|
var _FlowEngine_instances, registerModel_fn;
|
|
66
67
|
const getFlowEngineLoggerLevel = /* @__PURE__ */ __name(() => process.env.NODE_ENV === "production" ? "warn" : "trace", "getFlowEngineLoggerLevel");
|
|
@@ -130,6 +131,7 @@ const _FlowEngine = class _FlowEngine {
|
|
|
130
131
|
* @private
|
|
131
132
|
*/
|
|
132
133
|
__publicField(this, "_savingModels", /* @__PURE__ */ new Map());
|
|
134
|
+
__publicField(this, "_loadedPageCache", (0, import_loadedPageCache.createLoadedPageCache)());
|
|
133
135
|
/**
|
|
134
136
|
* Flow engine context object.
|
|
135
137
|
* @private
|
|
@@ -1138,10 +1140,11 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1138
1140
|
async loadModel(options) {
|
|
1139
1141
|
if (!this.ensureModelRepository()) return;
|
|
1140
1142
|
const refresh = !!(options == null ? void 0 : options.refresh);
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1143
|
+
const bypassLoadedPageCache = this._loadedPageCache.shouldBypass(options, () => this.context.flowSettingsEnabled);
|
|
1144
|
+
if (!refresh && !bypassLoadedPageCache) {
|
|
1145
|
+
const model2 = this.findModelByParentId(options.parentId, options.subKey);
|
|
1146
|
+
if (model2) {
|
|
1147
|
+
return model2;
|
|
1145
1148
|
}
|
|
1146
1149
|
const hydrated = await this.hydrateModelFromPreviousEngines(options);
|
|
1147
1150
|
if (hydrated) {
|
|
@@ -1149,15 +1152,24 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1149
1152
|
}
|
|
1150
1153
|
}
|
|
1151
1154
|
const data = await this._modelRepository.findOne(options);
|
|
1152
|
-
if (!(data == null ? void 0 : data.uid))
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
+
if (!(data == null ? void 0 : data.uid)) {
|
|
1156
|
+
if (bypassLoadedPageCache) {
|
|
1157
|
+
this._loadedPageCache.clear(options);
|
|
1158
|
+
}
|
|
1159
|
+
return null;
|
|
1160
|
+
}
|
|
1161
|
+
if (refresh || bypassLoadedPageCache) {
|
|
1155
1162
|
const existing = this.getModel(data.uid);
|
|
1156
1163
|
if (existing) {
|
|
1157
1164
|
this.removeModelWithSubModels(existing.uid);
|
|
1158
1165
|
}
|
|
1159
1166
|
}
|
|
1160
|
-
|
|
1167
|
+
const model = await this.createModelAsync(data);
|
|
1168
|
+
if (bypassLoadedPageCache) {
|
|
1169
|
+
this._loadedPageCache.mountModelToParent(model, true);
|
|
1170
|
+
this._loadedPageCache.clear(options);
|
|
1171
|
+
}
|
|
1172
|
+
return model;
|
|
1161
1173
|
}
|
|
1162
1174
|
/**
|
|
1163
1175
|
* Find a sub-model by parent model ID and subKey.
|
|
@@ -1188,20 +1200,29 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1188
1200
|
async loadOrCreateModel(options, extra) {
|
|
1189
1201
|
if (!this.ensureModelRepository()) return;
|
|
1190
1202
|
const { uid, parentId, subKey } = options;
|
|
1191
|
-
|
|
1203
|
+
const bypassLoadedPageCache = this._loadedPageCache.shouldBypass(options, () => this.context.flowSettingsEnabled);
|
|
1204
|
+
if (uid && !bypassLoadedPageCache && this._modelInstances.has(uid)) {
|
|
1192
1205
|
return this._modelInstances.get(uid);
|
|
1193
1206
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1207
|
+
if (!bypassLoadedPageCache) {
|
|
1208
|
+
const m = this.findModelByParentId(parentId, subKey);
|
|
1209
|
+
if (m) {
|
|
1210
|
+
return m;
|
|
1211
|
+
}
|
|
1212
|
+
const hydrated = await this.hydrateModelFromPreviousEngines(options, extra);
|
|
1213
|
+
if (hydrated) {
|
|
1214
|
+
return hydrated;
|
|
1215
|
+
}
|
|
1201
1216
|
}
|
|
1202
1217
|
const data = await this._modelRepository.findOne(options);
|
|
1203
1218
|
let model = null;
|
|
1204
1219
|
if (data == null ? void 0 : data.uid) {
|
|
1220
|
+
if (bypassLoadedPageCache) {
|
|
1221
|
+
const existing = this.getModel(data.uid);
|
|
1222
|
+
if (existing) {
|
|
1223
|
+
this.removeModelWithSubModels(existing.uid);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1205
1226
|
model = await this.createModelAsync(data, extra);
|
|
1206
1227
|
} else {
|
|
1207
1228
|
model = await this.createModelAsync(options, extra);
|
|
@@ -1209,18 +1230,9 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1209
1230
|
await model.save();
|
|
1210
1231
|
}
|
|
1211
1232
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
});
|
|
1216
|
-
if (subModel) {
|
|
1217
|
-
return model;
|
|
1218
|
-
}
|
|
1219
|
-
if (model.subType === "array") {
|
|
1220
|
-
model.parent.addSubModel(model.subKey, model);
|
|
1221
|
-
} else {
|
|
1222
|
-
model.parent.setSubModel(model.subKey, model);
|
|
1223
|
-
}
|
|
1233
|
+
this._loadedPageCache.mountModelToParent(model, bypassLoadedPageCache);
|
|
1234
|
+
if (bypassLoadedPageCache) {
|
|
1235
|
+
this._loadedPageCache.clear(options);
|
|
1224
1236
|
}
|
|
1225
1237
|
return model;
|
|
1226
1238
|
}
|
|
@@ -1238,6 +1250,9 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1238
1250
|
async saveModel(model, options) {
|
|
1239
1251
|
if (!this.ensureModelRepository()) return;
|
|
1240
1252
|
const modelUid = model.uid;
|
|
1253
|
+
const dirtyLoadedPageKey = this._loadedPageCache.getDirtyKeyForModel(model, {
|
|
1254
|
+
force: !!(options == null ? void 0 : options.onlyStepParams)
|
|
1255
|
+
});
|
|
1241
1256
|
if (this._savingModels.has(modelUid)) {
|
|
1242
1257
|
this.logger.debug(`Model ${modelUid} is already being saved, waiting for existing save operation`);
|
|
1243
1258
|
return await this._savingModels.get(modelUid);
|
|
@@ -1246,6 +1261,7 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1246
1261
|
this._savingModels.set(modelUid, savePromise);
|
|
1247
1262
|
try {
|
|
1248
1263
|
const result = await savePromise;
|
|
1264
|
+
this._loadedPageCache.markDirty(dirtyLoadedPageKey);
|
|
1249
1265
|
return result;
|
|
1250
1266
|
} finally {
|
|
1251
1267
|
this._savingModels.delete(modelUid);
|
|
@@ -1276,10 +1292,15 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1276
1292
|
* @returns {Promise<boolean>} Whether destroyed successfully
|
|
1277
1293
|
*/
|
|
1278
1294
|
async destroyModel(uid) {
|
|
1279
|
-
|
|
1295
|
+
const modelInstance = this._modelInstances.get(uid);
|
|
1296
|
+
const dirtyLoadedPageKey = this._loadedPageCache.getDirtyKeyForModel(modelInstance);
|
|
1297
|
+
const hasModelRepository = this.ensureModelRepository();
|
|
1298
|
+
if (hasModelRepository) {
|
|
1280
1299
|
await this._modelRepository.destroy(uid);
|
|
1281
1300
|
}
|
|
1282
|
-
|
|
1301
|
+
if (hasModelRepository) {
|
|
1302
|
+
this._loadedPageCache.markDirty(dirtyLoadedPageKey);
|
|
1303
|
+
}
|
|
1283
1304
|
const parent = modelInstance == null ? void 0 : modelInstance.parent;
|
|
1284
1305
|
const result = this.removeModel(uid);
|
|
1285
1306
|
parent && parent.emitter.emit("onSubModelDestroyed", modelInstance);
|
|
@@ -1367,6 +1388,7 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1367
1388
|
console.warn(`FlowEngine: Cannot move model. Source or target model not found.`);
|
|
1368
1389
|
return;
|
|
1369
1390
|
}
|
|
1391
|
+
const dirtyLoadedPageKey = this._loadedPageCache.getDirtyKeyForModel(sourceModel);
|
|
1370
1392
|
const move = /* @__PURE__ */ __name((sourceModel2, targetModel2) => {
|
|
1371
1393
|
if (!sourceModel2.parent || !targetModel2.parent || sourceModel2.parent !== targetModel2.parent) {
|
|
1372
1394
|
console.error("FlowModel.moveTo: Both models must have the same parent to perform move operation.");
|
|
@@ -1401,6 +1423,7 @@ const _FlowEngine = class _FlowEngine {
|
|
|
1401
1423
|
if ((options == null ? void 0 : options.persist) !== false && this.ensureModelRepository()) {
|
|
1402
1424
|
const position = sourceModel.sortIndex - targetModel.sortIndex > 0 ? "after" : "before";
|
|
1403
1425
|
await this._modelRepository.move(sourceId, targetId, position);
|
|
1426
|
+
this._loadedPageCache.markDirty(dirtyLoadedPageKey);
|
|
1404
1427
|
}
|
|
1405
1428
|
sourceModel.parent.emitter.emit("onSubModelMoved", { source: sourceModel, target: targetModel });
|
|
1406
1429
|
(_b = this.emitter) == null ? void 0 : _b.emit("model:subModel:moved", {
|
|
@@ -31,6 +31,7 @@ __export(FormJSFieldItemRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(FormJSFieldItemRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _FormJSFieldItemRunJSContext = class _FormJSFieldItemRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_FormJSFieldItemRunJSContext, "FormJSFieldItemRunJSContext");
|
|
@@ -38,8 +39,8 @@ let FormJSFieldItemRunJSContext = _FormJSFieldItemRunJSContext;
|
|
|
38
39
|
FormJSFieldItemRunJSContext.define({
|
|
39
40
|
label: "FormJSFieldItem RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element: `ElementProxy instance providing a safe DOM container for form field rendering.
|
|
42
|
-
Supports innerHTML, append, and other DOM manipulation methods
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container for form field rendering.
|
|
43
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),
|
|
43
44
|
value: `Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).`,
|
|
44
45
|
record: `Current record data object (read-only).
|
|
45
46
|
Contains all field values of the parent record.`,
|
|
@@ -61,7 +62,7 @@ FormJSFieldItemRunJSContext.define(
|
|
|
61
62
|
{
|
|
62
63
|
label: "\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",
|
|
63
64
|
properties: {
|
|
64
|
-
element: "ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",
|
|
65
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668"),
|
|
65
66
|
value: "\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",
|
|
66
67
|
record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
|
|
67
68
|
formValues: {
|
|
@@ -31,6 +31,7 @@ __export(JSBlockRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSBlockRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSBlockRunJSContext = class _JSBlockRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSBlockRunJSContext, "JSBlockRunJSContext");
|
|
@@ -38,15 +39,9 @@ let JSBlockRunJSContext = _JSBlockRunJSContext;
|
|
|
38
39
|
JSBlockRunJSContext.define({
|
|
39
40
|
label: "RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element:
|
|
42
|
-
description: `ElementProxy instance providing a safe DOM container.
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container.
|
|
43
43
|
Supports innerHTML, append, and other DOM manipulation methods.
|
|
44
|
-
Use this to render content in the JS block
|
|
45
|
-
detail: "ElementProxy",
|
|
46
|
-
properties: {
|
|
47
|
-
innerHTML: "Set or read the HTML content of the container element."
|
|
48
|
-
}
|
|
49
|
-
},
|
|
44
|
+
Use this to render content in the JS block.`),
|
|
50
45
|
record: `Current record data object (read-only).
|
|
51
46
|
Available when the JS block is within a data block or detail view context.`,
|
|
52
47
|
value: "Current value of the field or component, if available in the current context.",
|
|
@@ -65,13 +60,7 @@ JSBlockRunJSContext.define(
|
|
|
65
60
|
{
|
|
66
61
|
label: "RunJS \u4E0A\u4E0B\u6587",
|
|
67
62
|
properties: {
|
|
68
|
-
element:
|
|
69
|
-
description: "ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",
|
|
70
|
-
detail: "ElementProxy",
|
|
71
|
-
properties: {
|
|
72
|
-
innerHTML: "\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
63
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),
|
|
75
64
|
record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",
|
|
76
65
|
value: "\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",
|
|
77
66
|
React: "React \u5E93",
|
|
@@ -31,6 +31,7 @@ __export(JSColumnRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSColumnRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSColumnRunJSContext = class _JSColumnRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSColumnRunJSContext, "JSColumnRunJSContext");
|
|
@@ -38,7 +39,9 @@ let JSColumnRunJSContext = _JSColumnRunJSContext;
|
|
|
38
39
|
JSColumnRunJSContext.define({
|
|
39
40
|
label: "JSColumn RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element:
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(
|
|
43
|
+
"ElementProxy instance providing a safe DOM container for the current table cell. Supports innerHTML/append and basic DOM APIs."
|
|
44
|
+
),
|
|
42
45
|
record: "Current row record object (read-only).",
|
|
43
46
|
recordIndex: "Index of the current row in the page (0-based).",
|
|
44
47
|
collection: "Collection definition metadata (read-only).",
|
|
@@ -56,7 +59,7 @@ JSColumnRunJSContext.define(
|
|
|
56
59
|
{
|
|
57
60
|
label: "JS \u5217 RunJS \u4E0A\u4E0B\u6587",
|
|
58
61
|
properties: {
|
|
59
|
-
element: "ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",
|
|
62
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),
|
|
60
63
|
record: "\u5F53\u524D\u884C\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF09",
|
|
61
64
|
recordIndex: "\u5F53\u524D\u884C\u7D22\u5F15\uFF08\u4ECE 0 \u5F00\u59CB\uFF09",
|
|
62
65
|
collection: "\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF09",
|
|
@@ -31,6 +31,7 @@ __export(JSEditableFieldRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSEditableFieldRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSEditableFieldRunJSContext = class _JSEditableFieldRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSEditableFieldRunJSContext, "JSEditableFieldRunJSContext");
|
|
@@ -38,10 +39,9 @@ let JSEditableFieldRunJSContext = _JSEditableFieldRunJSContext;
|
|
|
38
39
|
JSEditableFieldRunJSContext.define({
|
|
39
40
|
label: "JSEditableField RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(
|
|
43
|
+
"ElementProxy instance providing a safe DOM container for field rendering. In editable mode this container is typically a <span> element."
|
|
44
|
+
),
|
|
45
45
|
value: {
|
|
46
46
|
description: "Current field value (read-only snapshot). In editable scenarios, prefer ctx.getValue()/ctx.setValue(v) for two-way binding.",
|
|
47
47
|
detail: "any",
|
|
@@ -84,10 +84,7 @@ JSEditableFieldRunJSContext.define(
|
|
|
84
84
|
{
|
|
85
85
|
label: "JS \u53EF\u7F16\u8F91\u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",
|
|
86
86
|
properties: {
|
|
87
|
-
element:
|
|
88
|
-
description: "ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u7684\u5B89\u5168\u5BB9\u5668\uFF08\u901A\u5E38\u4E3A <span> \u5BB9\u5668\uFF09\u3002",
|
|
89
|
-
detail: "ElementProxy"
|
|
90
|
-
},
|
|
87
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u7684\u5B89\u5168\u5BB9\u5668\uFF08\u901A\u5E38\u4E3A <span> \u5BB9\u5668\uFF09\u3002"),
|
|
91
88
|
value: {
|
|
92
89
|
description: "\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\u5FEB\u7167\uFF09\u3002\u53EF\u7F16\u8F91\u573A\u666F\u5EFA\u8BAE\u4F7F\u7528 ctx.getValue()/ctx.setValue(v) \u505A\u53CC\u5411\u7ED1\u5B9A\u3002",
|
|
93
90
|
detail: "any",
|
|
@@ -31,6 +31,7 @@ __export(JSFieldRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSFieldRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSFieldRunJSContext = class _JSFieldRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSFieldRunJSContext, "JSFieldRunJSContext");
|
|
@@ -38,8 +39,8 @@ let JSFieldRunJSContext = _JSFieldRunJSContext;
|
|
|
38
39
|
JSFieldRunJSContext.define({
|
|
39
40
|
label: "JSField RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element: `ElementProxy instance providing a safe DOM container for field rendering.
|
|
42
|
-
Supports innerHTML, append, and other DOM manipulation methods
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container for field rendering.
|
|
43
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),
|
|
43
44
|
value: `Current value of the field (read-only).
|
|
44
45
|
Contains the data value stored in this field.`,
|
|
45
46
|
record: `Current record data object (read-only).
|
|
@@ -57,7 +58,7 @@ JSFieldRunJSContext.define(
|
|
|
57
58
|
{
|
|
58
59
|
label: "JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",
|
|
59
60
|
properties: {
|
|
60
|
-
element: "ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",
|
|
61
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C"),
|
|
61
62
|
value: "\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\uFF09",
|
|
62
63
|
record: "\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF0C\u5305\u542B\u7236\u8BB0\u5F55\u5168\u90E8\u5B57\u6BB5\u503C\uFF09",
|
|
63
64
|
collection: "\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF0C\u63CF\u8FF0\u5B57\u6BB5\u6240\u5C5E\u96C6\u5408\u7684 Schema\uFF09"
|
|
@@ -31,6 +31,7 @@ __export(JSItemRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSItemRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSItemRunJSContext = class _JSItemRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSItemRunJSContext, "JSItemRunJSContext");
|
|
@@ -38,8 +39,8 @@ let JSItemRunJSContext = _JSItemRunJSContext;
|
|
|
38
39
|
JSItemRunJSContext.define({
|
|
39
40
|
label: "JSItem RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element: `ElementProxy instance providing a safe DOM container for form item rendering.
|
|
42
|
-
Supports innerHTML, append, and other DOM manipulation methods
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
43
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),
|
|
43
44
|
resource: `Current resource instance (read-only).
|
|
44
45
|
Provides access to the data resource associated with the current form context.`,
|
|
45
46
|
record: `Current record data object (read-only).
|
|
@@ -59,7 +60,7 @@ JSItemRunJSContext.define(
|
|
|
59
60
|
{
|
|
60
61
|
label: "JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",
|
|
61
62
|
properties: {
|
|
62
|
-
element: "ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",
|
|
63
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C"),
|
|
63
64
|
resource: "\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",
|
|
64
65
|
record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
|
|
65
66
|
formValues: {
|