@tmagic/editor 1.5.0-beta.13 → 1.5.0-beta.15

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.
Files changed (42) hide show
  1. package/dist/style.css +61 -6
  2. package/dist/tmagic-editor.js +521 -242
  3. package/dist/tmagic-editor.umd.cjs +522 -243
  4. package/package.json +12 -10
  5. package/src/components/CodeBlockEditor.vue +11 -5
  6. package/src/components/CodeParams.vue +3 -3
  7. package/src/fields/Code.vue +1 -2
  8. package/src/fields/CodeSelect.vue +13 -11
  9. package/src/fields/CodeSelectCol.vue +32 -5
  10. package/src/fields/CondOpSelect.vue +5 -2
  11. package/src/fields/DataSourceFields.vue +31 -12
  12. package/src/fields/DataSourceMethods.vue +72 -14
  13. package/src/fields/DisplayConds.vue +8 -3
  14. package/src/fields/EventSelect.vue +25 -8
  15. package/src/fields/KeyValue.vue +15 -10
  16. package/src/hooks/index.ts +0 -1
  17. package/src/hooks/use-code-block-edit.ts +1 -1
  18. package/src/hooks/use-data-source-edit.ts +3 -2
  19. package/src/initService.ts +103 -24
  20. package/src/layouts/Framework.vue +0 -3
  21. package/src/layouts/PropsPanel.vue +3 -3
  22. package/src/layouts/page-bar/PageBar.vue +46 -3
  23. package/src/layouts/page-bar/PageBarScrollContainer.vue +49 -24
  24. package/src/layouts/page-bar/PageList.vue +4 -2
  25. package/src/layouts/sidebar/Sidebar.vue +3 -0
  26. package/src/layouts/sidebar/code-block/CodeBlockList.vue +6 -1
  27. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +7 -5
  28. package/src/layouts/sidebar/data-source/DataSourceList.vue +6 -1
  29. package/src/layouts/workspace/Workspace.vue +5 -2
  30. package/src/layouts/workspace/viewer/Stage.vue +12 -5
  31. package/src/services/dataSource.ts +12 -5
  32. package/src/services/dep.ts +49 -11
  33. package/src/services/editor.ts +26 -11
  34. package/src/theme/page-bar.scss +24 -9
  35. package/src/theme/search-input.scss +1 -0
  36. package/src/utils/data-source/formConfigs/http.ts +2 -0
  37. package/src/utils/data-source/index.ts +2 -2
  38. package/src/utils/editor.ts +94 -2
  39. package/src/utils/idle-task.ts +34 -3
  40. package/src/utils/props.ts +3 -3
  41. package/types/index.d.ts +803 -1169
  42. package/src/hooks/use-data-source-method.ts +0 -100
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tmagic/design'), require('@tmagic/form'), require('@tmagic/table'), require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/core'), require('@tmagic/utils'), require('moveable'), require('@tmagic/stage'), require('events'), require('gesto'), require('sortablejs'), require('keycon')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tmagic/design', '@tmagic/form', '@tmagic/table', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', 'emmet-monaco-es', 'monaco-editor', '@tmagic/core', '@tmagic/utils', 'moveable', '@tmagic/stage', 'events', 'gesto', 'sortablejs', 'keycon'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.designPlugin, global.formPlugin, global.tablePlugin, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.emmetMonacoEs, global.monaco, global.core, global.utils, global.VanillaMoveable, global.StageCore, global.events, global.Gesto, global.Sortable, global.KeyController));
5
- })(this, (function (exports, designPlugin, formPlugin, tablePlugin, vue, iconsVue, lodashEs, serialize, emmetMonacoEs, monaco, core, utils, VanillaMoveable, StageCore, events, Gesto, Sortable, KeyController) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tmagic/design'), require('@tmagic/form'), require('@tmagic/table'), require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/core'), require('@tmagic/utils'), require('moveable'), require('@tmagic/stage'), require('events'), require('gesto'), require('deep-object-diff'), require('sortablejs'), require('keycon')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@tmagic/design', '@tmagic/form', '@tmagic/table', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', 'emmet-monaco-es', 'monaco-editor', '@tmagic/core', '@tmagic/utils', 'moveable', '@tmagic/stage', 'events', 'gesto', 'deep-object-diff', 'sortablejs', 'keycon'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.designPlugin, global.formPlugin, global.tablePlugin, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.emmetMonacoEs, global.monaco, global.core, global.utils, global.VanillaMoveable, global.StageCore, global.events, global.Gesto, global.deepObjectDiff, global.Sortable, global.KeyController));
5
+ })(this, (function (exports, designPlugin, formPlugin, tablePlugin, vue, iconsVue, lodashEs, serialize, emmetMonacoEs, monaco, core, utils, VanillaMoveable, StageCore, events, Gesto, deepObjectDiff, Sortable, KeyController) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -287,9 +287,7 @@
287
287
  emits: ["change"],
288
288
  setup(__props, { emit: __emit }) {
289
289
  const emit = __emit;
290
- const props = __props;
291
290
  const save = (v) => {
292
- props.model[props.name] = v;
293
291
  emit("change", v);
294
292
  };
295
293
  return (_ctx, _cache) => {
@@ -439,11 +437,13 @@
439
437
  { value: core.HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
440
438
  ],
441
439
  defaultValue: "code",
442
- onChange: (mForm, v, { model }) => {
440
+ onChange: (mForm, v, { model, prop, changeRecords }) => {
443
441
  if (v === core.HookCodeType.DATA_SOURCE_METHOD) {
444
442
  model.codeId = [];
443
+ changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: [] });
445
444
  } else {
446
445
  model.codeId = "";
446
+ changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: "" });
447
447
  }
448
448
  return v;
449
449
  }
@@ -482,9 +482,7 @@
482
482
  immediate: true
483
483
  }
484
484
  );
485
- const changeHandler = async () => {
486
- emit("change", props.model[props.name]);
487
- };
485
+ const changeHandler = (v, eventData) => emit("change", v, eventData);
488
486
  return (_ctx, _cache) => {
489
487
  return vue.openBlock(), vue.createElementBlock("div", {
490
488
  class: vue.normalizeClass(["m-fields-code-select", _ctx.config.className])
@@ -566,7 +564,7 @@
566
564
  fieldConfig: {
567
565
  type: "text"
568
566
  },
569
- disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
567
+ disabled: (_vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
570
568
  },
571
569
  {
572
570
  type: "data-source-field-select",
@@ -587,7 +585,7 @@
587
585
  fieldConfig: {
588
586
  type: "text"
589
587
  },
590
- disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
588
+ disabled: (_vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
591
589
  }
592
590
  ]
593
591
  },
@@ -836,7 +834,7 @@
836
834
  };
837
835
  const displayTabConfig = {
838
836
  title: "显示条件",
839
- display: (vm, { model }) => model.type !== "page",
837
+ display: (_vm, { model }) => model.type !== "page",
840
838
  items: [
841
839
  {
842
840
  type: "display-conds",
@@ -1160,6 +1158,70 @@
1160
1158
  }
1161
1159
  }
1162
1160
  };
1161
+ const isValueIncludeDataSource = (value) => {
1162
+ if (typeof value === "string" && /\$\{([\s\S]+?)\}/.test(value)) {
1163
+ return true;
1164
+ }
1165
+ if (Array.isArray(value) && `${value[0]}`.startsWith(utils.DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX)) {
1166
+ return true;
1167
+ }
1168
+ if (value?.isBindDataSource && value.dataSourceId) {
1169
+ return true;
1170
+ }
1171
+ if (value?.isBindDataSourceField && value.dataSourceId) {
1172
+ return true;
1173
+ }
1174
+ return false;
1175
+ };
1176
+ const isIncludeDataSourceByDiffAddResult = (diffResult) => {
1177
+ for (const value of Object.values(diffResult)) {
1178
+ const result = isValueIncludeDataSource(value);
1179
+ if (result) {
1180
+ return true;
1181
+ }
1182
+ if (lodashEs.isObject(value)) {
1183
+ return isIncludeDataSourceByDiffAddResult(value);
1184
+ }
1185
+ }
1186
+ return false;
1187
+ };
1188
+ const isIncludeDataSourceByDiffUpdatedResult = (diffResult, oldNode) => {
1189
+ for (const [key, value] of Object.entries(diffResult)) {
1190
+ if (isValueIncludeDataSource(value)) {
1191
+ return true;
1192
+ }
1193
+ if (isValueIncludeDataSource(oldNode[key])) {
1194
+ return true;
1195
+ }
1196
+ if (lodashEs.isObject(value)) {
1197
+ return isIncludeDataSourceByDiffUpdatedResult(value, oldNode[key]);
1198
+ }
1199
+ }
1200
+ return false;
1201
+ };
1202
+ const isIncludeDataSource = (node, oldNode) => {
1203
+ const diffResult = deepObjectDiff.detailedDiff(oldNode, node);
1204
+ let isIncludeDataSource2 = false;
1205
+ if (diffResult.updated) {
1206
+ if (diffResult.updated[core.NODE_CONDS_KEY]) {
1207
+ return true;
1208
+ }
1209
+ isIncludeDataSource2 = isIncludeDataSourceByDiffUpdatedResult(diffResult.updated, oldNode);
1210
+ if (isIncludeDataSource2) return true;
1211
+ }
1212
+ if (diffResult.added) {
1213
+ isIncludeDataSource2 = isIncludeDataSourceByDiffAddResult(diffResult.added);
1214
+ if (isIncludeDataSource2) return true;
1215
+ }
1216
+ if (diffResult.deleted) {
1217
+ if (diffResult.deleted[core.NODE_CONDS_KEY]) {
1218
+ return true;
1219
+ }
1220
+ isIncludeDataSource2 = isIncludeDataSourceByDiffAddResult(diffResult.deleted);
1221
+ if (isIncludeDataSource2) return true;
1222
+ }
1223
+ return isIncludeDataSource2;
1224
+ };
1163
1225
 
1164
1226
  const compose = (middleware, isAsync) => {
1165
1227
  if (!Array.isArray(middleware)) throw new TypeError("Middleware 必须是一个数组!");
@@ -2112,13 +2174,13 @@
2112
2174
  }
2113
2175
  this.emit("remove", nodes);
2114
2176
  }
2115
- async doUpdate(config) {
2177
+ async doUpdate(config, { changeRecords = [] } = {}) {
2116
2178
  const root = this.get("root");
2117
2179
  if (!root) throw new Error("root为空");
2118
2180
  if (!config?.id) throw new Error("没有配置或者配置缺少id值");
2119
2181
  const info = this.getNodeInfo(config.id, false);
2120
2182
  if (!info.node) throw new Error(`获取不到id为${config.id}的节点`);
2121
- const node = lodashEs.cloneDeep(vue.toRaw(info.node));
2183
+ const node = vue.toRaw(info.node);
2122
2184
  let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, root);
2123
2185
  newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue, key) => {
2124
2186
  if (typeof srcValue === "undefined" && Object.hasOwn(newConfig, key)) {
@@ -2134,7 +2196,11 @@
2134
2196
  if (!newConfig.type) throw new Error("配置缺少type值");
2135
2197
  if (newConfig.type === core.NodeType.ROOT) {
2136
2198
  this.set("root", newConfig);
2137
- return newConfig;
2199
+ return {
2200
+ oldNode: node,
2201
+ newNode: newConfig,
2202
+ changeRecords
2203
+ };
2138
2204
  }
2139
2205
  const { parent } = info;
2140
2206
  if (!parent) throw new Error("获取不到父级节点");
@@ -2155,21 +2221,25 @@
2155
2221
  this.set("page", newConfig);
2156
2222
  }
2157
2223
  this.addModifiedNodeId(newConfig.id);
2158
- return newConfig;
2224
+ return {
2225
+ oldNode: node,
2226
+ newNode: newConfig,
2227
+ changeRecords
2228
+ };
2159
2229
  }
2160
2230
  /**
2161
2231
  * 更新节点
2162
2232
  * @param config 新的节点配置,配置中需要有id信息
2163
2233
  * @returns 更新后的节点配置
2164
2234
  */
2165
- async update(config) {
2235
+ async update(config, data = {}) {
2166
2236
  const nodes = Array.isArray(config) ? config : [config];
2167
- const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
2168
- if (newNodes[0]?.type !== core.NodeType.ROOT) {
2237
+ const updateData = await Promise.all(nodes.map((node) => this.doUpdate(node, data)));
2238
+ if (updateData[0].oldNode?.type !== core.NodeType.ROOT) {
2169
2239
  this.pushHistoryState();
2170
2240
  }
2171
- this.emit("update", newNodes);
2172
- return Array.isArray(config) ? newNodes : newNodes[0];
2241
+ this.emit("update", updateData);
2242
+ return Array.isArray(config) ? updateData.map((item) => item.newNode) : updateData[0].newNode;
2173
2243
  }
2174
2244
  /**
2175
2245
  * 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
@@ -2363,7 +2433,7 @@
2363
2433
  parent.items?.splice(index, 1);
2364
2434
  await stage.remove({ id: node.id, parentId: parent.id, root: lodashEs.cloneDeep(root) });
2365
2435
  const layout = await this.getLayout(target);
2366
- const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config, (objValue, srcValue) => {
2436
+ const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config, (_objValue, srcValue) => {
2367
2437
  if (Array.isArray(srcValue)) {
2368
2438
  return srcValue;
2369
2439
  }
@@ -2729,6 +2799,7 @@
2729
2799
  name: "params",
2730
2800
  type: "key-value",
2731
2801
  defaultValue: {},
2802
+ advanced: true,
2732
2803
  text: "参数"
2733
2804
  },
2734
2805
  {
@@ -2742,6 +2813,7 @@
2742
2813
  name: "headers",
2743
2814
  type: "key-value",
2744
2815
  defaultValue: {},
2816
+ advanced: true,
2745
2817
  text: "请求头"
2746
2818
  }
2747
2819
  ]
@@ -2796,7 +2868,7 @@
2796
2868
  },
2797
2869
  {
2798
2870
  title: "请求参数裁剪",
2799
- display: (formState, { model }) => model.type === "http",
2871
+ display: (_formState, { model }) => model.type === "http",
2800
2872
  items: [
2801
2873
  {
2802
2874
  name: "beforeRequest",
@@ -2808,7 +2880,7 @@
2808
2880
  },
2809
2881
  {
2810
2882
  title: "响应数据裁剪",
2811
- display: (formState, { model }) => model.type === "http",
2883
+ display: (_formState, { model }) => model.type === "http",
2812
2884
  items: [
2813
2885
  {
2814
2886
  name: "afterResponse",
@@ -2975,6 +3047,10 @@
2975
3047
  class IdleTask extends events.EventEmitter {
2976
3048
  taskList = [];
2977
3049
  taskHandle = null;
3050
+ constructor() {
3051
+ super();
3052
+ this.setMaxListeners(1e3);
3053
+ }
2978
3054
  enqueueTask(taskHandler, taskData) {
2979
3055
  this.taskList.push({
2980
3056
  handler: taskHandler,
@@ -2984,6 +3060,9 @@
2984
3060
  this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
2985
3061
  }
2986
3062
  }
3063
+ clearTasks() {
3064
+ this.taskList = [];
3065
+ }
2987
3066
  on(eventName, listener) {
2988
3067
  return super.on(eventName, listener);
2989
3068
  }
@@ -2994,9 +3073,27 @@
2994
3073
  return super.emit(eventName, ...args);
2995
3074
  }
2996
3075
  runTaskQueue(deadline) {
2997
- while ((deadline.timeRemaining() > 10 || deadline.didTimeout) && this.taskList.length) {
2998
- const task = this.taskList.shift();
2999
- task.handler(task.data);
3076
+ while (deadline.timeRemaining() > 0 && this.taskList.length) {
3077
+ const timeRemaining = deadline.timeRemaining();
3078
+ let times = 0;
3079
+ if (timeRemaining <= 5) {
3080
+ times = 10;
3081
+ } else if (timeRemaining <= 10) {
3082
+ times = 100;
3083
+ } else if (timeRemaining <= 15) {
3084
+ times = 300;
3085
+ } else {
3086
+ times = 600;
3087
+ }
3088
+ for (let i = 0; i < times; i++) {
3089
+ const task = this.taskList.shift();
3090
+ if (task) {
3091
+ task.handler(task.data);
3092
+ }
3093
+ if (this.taskList.length === 0) {
3094
+ break;
3095
+ }
3096
+ }
3000
3097
  }
3001
3098
  if (this.taskList.length) {
3002
3099
  this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 300 });
@@ -3181,10 +3278,10 @@
3181
3278
  }))
3182
3279
  )
3183
3280
  );
3184
- const onParamsChangeHandler = async () => {
3281
+ const onParamsChangeHandler = async (v, eventData) => {
3185
3282
  try {
3186
3283
  const value = await form.value?.submitForm(true);
3187
- emit("change", value);
3284
+ emit("change", value, eventData);
3188
3285
  } catch (e) {
3189
3286
  error(e);
3190
3287
  }
@@ -3277,9 +3374,26 @@
3277
3374
  return codeId;
3278
3375
  }
3279
3376
  };
3280
- const onParamsChangeHandler = (value) => {
3377
+ const onCodeIdChangeHandler = (value) => {
3281
3378
  props.model.params = value.params;
3282
- emit("change", props.model);
3379
+ emit("change", props.model, {
3380
+ changeRecords: [
3381
+ {
3382
+ propPath: props.prop,
3383
+ value: value[props.name]
3384
+ }
3385
+ ]
3386
+ });
3387
+ };
3388
+ const onParamsChangeHandler = (value, eventData) => {
3389
+ props.model.params = value.params;
3390
+ emit("change", props.model, {
3391
+ ...eventData,
3392
+ changeRecords: (eventData.changeRecords || []).map((item) => ({
3393
+ prop: `${props.prop.replace(props.name, "")}${item.propPath}`,
3394
+ value: item.value
3395
+ }))
3396
+ });
3283
3397
  };
3284
3398
  const editCode = (id) => {
3285
3399
  eventBus?.emit("edit-code", id);
@@ -3292,7 +3406,7 @@
3292
3406
  config: selectConfig,
3293
3407
  model: _ctx.model,
3294
3408
  size: _ctx.size,
3295
- onChange: onParamsChangeHandler
3409
+ onChange: onCodeIdChangeHandler
3296
3410
  }, null, 8, ["model", "size"]),
3297
3411
  _ctx.model[_ctx.name] && hasCodeBlockSidePanel.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicButton), {
3298
3412
  key: 0,
@@ -3591,7 +3705,7 @@
3591
3705
  }
3592
3706
  codeConfig.value = {
3593
3707
  name: "",
3594
- content: `({app, params}) => {
3708
+ content: `({app, params, flowState}) => {
3595
3709
  // place your code here
3596
3710
  }`,
3597
3711
  params: []
@@ -3637,78 +3751,6 @@
3637
3751
  };
3638
3752
  };
3639
3753
 
3640
- const useDataSourceMethod = () => {
3641
- const codeConfig = vue.ref();
3642
- const codeBlockEditor = vue.ref();
3643
- const dataSource = vue.ref();
3644
- const dataSourceMethod = vue.ref("");
3645
- return {
3646
- codeConfig,
3647
- codeBlockEditor,
3648
- createCode: async (model) => {
3649
- codeConfig.value = {
3650
- name: "",
3651
- content: `({ params, dataSource, app }) => {
3652
- // place your code here
3653
- }`,
3654
- params: []
3655
- };
3656
- await vue.nextTick();
3657
- dataSource.value = model;
3658
- dataSourceMethod.value = "";
3659
- codeBlockEditor.value?.show();
3660
- },
3661
- editCode: async (model, methodName) => {
3662
- const method = model.methods?.find((method2) => method2.name === methodName);
3663
- if (!method) {
3664
- designPlugin.tMagicMessage.error("获取数据源方法失败");
3665
- return;
3666
- }
3667
- let codeContent = method.content || `({ params, dataSource, app }) => {
3668
- // place your code here
3669
- }`;
3670
- if (typeof codeContent !== "string") {
3671
- codeContent = codeContent.toString();
3672
- }
3673
- codeConfig.value = {
3674
- ...lodashEs.cloneDeep(method),
3675
- content: codeContent
3676
- };
3677
- await vue.nextTick();
3678
- dataSource.value = model;
3679
- dataSourceMethod.value = methodName;
3680
- codeBlockEditor.value?.show();
3681
- },
3682
- deleteCode: async (model, methodName) => {
3683
- if (!model.methods) return;
3684
- const index = model.methods.findIndex((method) => method.name === methodName);
3685
- if (index === -1) {
3686
- return;
3687
- }
3688
- model.methods.splice(index, 1);
3689
- },
3690
- submitCode: (values) => {
3691
- if (!dataSource.value) return;
3692
- if (!dataSource.value.methods) {
3693
- dataSource.value.methods = [];
3694
- }
3695
- if (values.content) {
3696
- const parseDSL = getEditorConfig("parseDSL");
3697
- if (typeof values.content === "string") {
3698
- values.content = parseDSL(values.content);
3699
- }
3700
- }
3701
- if (dataSourceMethod.value) {
3702
- const index = dataSource.value.methods.findIndex((method) => method.name === dataSourceMethod.value);
3703
- dataSource.value.methods.splice(index, 1, values);
3704
- } else {
3705
- dataSource.value.methods.push(values);
3706
- }
3707
- codeBlockEditor.value?.hide();
3708
- }
3709
- };
3710
- };
3711
-
3712
3754
  const state = vue.reactive({
3713
3755
  uiSelectMode: false,
3714
3756
  showSrc: false,
@@ -4195,14 +4237,28 @@
4195
4237
  calcBoxPosition();
4196
4238
  addDialogVisible.value = true;
4197
4239
  };
4198
- const fieldChange = ({ index, ...value }) => {
4240
+ const fieldChange = ({ index, ...value }, data) => {
4241
+ addDialogVisible.value = false;
4199
4242
  if (index > -1) {
4200
- props.model[props.name][index] = value;
4243
+ emit("change", value, {
4244
+ modifyKey: index,
4245
+ changeRecords: (data.changeRecords || []).map((item) => ({
4246
+ propPath: `${props.prop}.${index}.${item.propPath}`,
4247
+ value: item.value
4248
+ }))
4249
+ });
4201
4250
  } else {
4202
- props.model[props.name].push(value);
4251
+ const modifyKey = props.model[props.name].length;
4252
+ emit("change", value, {
4253
+ modifyKey,
4254
+ changeRecords: [
4255
+ {
4256
+ propPath: `${props.prop}.${modifyKey}`,
4257
+ value
4258
+ }
4259
+ ]
4260
+ });
4203
4261
  }
4204
- addDialogVisible.value = false;
4205
- emit("change", props.model[props.name]);
4206
4262
  };
4207
4263
  const fieldColumns = [
4208
4264
  {
@@ -4396,9 +4452,8 @@
4396
4452
  const addFromJsonFromChange = ({ data }) => {
4397
4453
  try {
4398
4454
  const value = JSON.parse(data);
4399
- props.model[props.name] = getFieldsConfig(value, props.model[props.name]);
4400
4455
  addFromJsonDialogVisible.value = false;
4401
- emit("change", props.model[props.name]);
4456
+ emit("change", getFieldsConfig(value, props.model[props.name]));
4402
4457
  } catch (e) {
4403
4458
  designPlugin.tMagicMessage.error(e.message);
4404
4459
  }
@@ -5182,9 +5237,9 @@
5182
5237
  }
5183
5238
  }
5184
5239
  ]);
5185
- const submitForm = (values) => {
5240
+ const submitForm = (values, data) => {
5186
5241
  changedValue.value = void 0;
5187
- emit("submit", values);
5242
+ emit("submit", values, data);
5188
5243
  };
5189
5244
  const errorHandler = (error) => {
5190
5245
  designPlugin.tMagicMessage.error(error.message);
@@ -5205,7 +5260,7 @@
5205
5260
  type: "warning",
5206
5261
  distinguishCancelAndClose: true
5207
5262
  }).then(() => {
5208
- changedValue.value && submitForm(changedValue.value);
5263
+ changedValue.value && submitForm(changedValue.value, { changeRecords: formBox.value?.form?.changeRecords });
5209
5264
  done();
5210
5265
  }).catch((action) => {
5211
5266
  done(action === "cancel");
@@ -5369,7 +5424,9 @@
5369
5424
  setup(__props, { emit: __emit }) {
5370
5425
  const props = __props;
5371
5426
  const emit = __emit;
5372
- const { codeConfig, codeBlockEditor, createCode, editCode, deleteCode, submitCode } = useDataSourceMethod();
5427
+ const codeConfig = vue.ref();
5428
+ const codeBlockEditor = vue.ref();
5429
+ let editIndex = -1;
5373
5430
  const methodColumns = [
5374
5431
  {
5375
5432
  label: "名称",
@@ -5394,16 +5451,29 @@
5394
5451
  actions: [
5395
5452
  {
5396
5453
  text: "编辑",
5397
- handler: (row) => {
5398
- editCode(props.model, row.name);
5399
- emit("change", props.model[props.name]);
5454
+ handler: (method, index) => {
5455
+ let codeContent = method.content || `({ params, dataSource, app }) => {
5456
+ // place your code here
5457
+ }`;
5458
+ if (typeof codeContent !== "string") {
5459
+ codeContent = codeContent.toString();
5460
+ }
5461
+ codeConfig.value = {
5462
+ ...lodashEs.cloneDeep(method),
5463
+ content: codeContent
5464
+ };
5465
+ editIndex = index;
5466
+ vue.nextTick(() => {
5467
+ codeBlockEditor.value?.show();
5468
+ });
5400
5469
  }
5401
5470
  },
5402
5471
  {
5403
5472
  text: "删除",
5404
5473
  buttonType: "danger",
5405
- handler: (row) => {
5406
- deleteCode(props.model, row.name);
5474
+ handler: async (row, index) => {
5475
+ await designPlugin.tMagicMessageBox.confirm(`确定删除${row.name}?`, "提示");
5476
+ props.model[props.name].splice(index, 1);
5407
5477
  emit("change", props.model[props.name]);
5408
5478
  }
5409
5479
  }
@@ -5411,12 +5481,48 @@
5411
5481
  }
5412
5482
  ];
5413
5483
  const createCodeHandler = () => {
5414
- createCode(props.model);
5415
- emit("change", props.model[props.name]);
5484
+ codeConfig.value = {
5485
+ name: "",
5486
+ content: `({ params, dataSource, app, flowState }) => {
5487
+ // place your code here
5488
+ }`,
5489
+ params: []
5490
+ };
5491
+ editIndex = -1;
5492
+ vue.nextTick(() => {
5493
+ codeBlockEditor.value?.show();
5494
+ });
5416
5495
  };
5417
- const submitCodeHandler = (values) => {
5418
- submitCode(values);
5419
- emit("change", props.model[props.name]);
5496
+ const submitCodeHandler = (value, data) => {
5497
+ if (value.content) {
5498
+ const parseDSL = getEditorConfig("parseDSL");
5499
+ if (typeof value.content === "string") {
5500
+ value.content = parseDSL(value.content);
5501
+ }
5502
+ }
5503
+ if (editIndex > -1) {
5504
+ emit("change", value, {
5505
+ modifyKey: editIndex,
5506
+ changeRecords: (data.changeRecords || []).map((item) => ({
5507
+ propPath: `${props.prop}.${editIndex}.${item.propPath}`,
5508
+ value: item.value
5509
+ }))
5510
+ });
5511
+ } else {
5512
+ const modifyKey = props.model[props.name].length;
5513
+ emit("change", value, {
5514
+ modifyKey,
5515
+ changeRecords: [
5516
+ {
5517
+ propPath: `${props.prop}.${modifyKey}`,
5518
+ value
5519
+ }
5520
+ ]
5521
+ });
5522
+ }
5523
+ editIndex = -1;
5524
+ codeConfig.value = void 0;
5525
+ codeBlockEditor.value?.hide();
5420
5526
  };
5421
5527
  return (_ctx, _cache) => {
5422
5528
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
@@ -5438,12 +5544,12 @@
5438
5544
  _: 1
5439
5545
  }, 8, ["disabled"])
5440
5546
  ]),
5441
- vue.unref(codeConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$L, {
5547
+ codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$L, {
5442
5548
  key: 0,
5443
5549
  ref_key: "codeBlockEditor",
5444
5550
  ref: codeBlockEditor,
5445
5551
  disabled: _ctx.disabled,
5446
- content: vue.unref(codeConfig),
5552
+ content: codeConfig.value,
5447
5553
  "is-data-source": true,
5448
5554
  "data-source-type": _ctx.model.type,
5449
5555
  onSubmit: submitCodeHandler
@@ -6041,8 +6147,11 @@
6041
6147
  }
6042
6148
  ]
6043
6149
  }));
6044
- const changeHandler = (v) => {
6045
- emit("change", v);
6150
+ const changeHandler = (v, eventData) => {
6151
+ if (!Array.isArray(props.model[props.name])) {
6152
+ props.model[props.name] = [];
6153
+ }
6154
+ emit("change", v, eventData);
6046
6155
  };
6047
6156
  return (_ctx, _cache) => {
6048
6157
  return vue.openBlock(), vue.createBlock(vue.unref(formPlugin.MGroupList), {
@@ -6326,17 +6435,19 @@
6326
6435
  if (!props.model[props.name]) {
6327
6436
  props.model[props.name] = [];
6328
6437
  }
6329
- props.model[props.name].push(defaultEvent);
6330
- onChangeHandler();
6438
+ emit("change", defaultEvent, {
6439
+ modifyKey: props.model[props.name].length
6440
+ });
6331
6441
  };
6332
6442
  const removeEvent = (index) => {
6333
6443
  if (!props.name) return;
6334
6444
  props.model[props.name].splice(index, 1);
6335
- onChangeHandler();
6445
+ emit("change", props.model[props.name]);
6336
6446
  };
6337
- const onChangeHandler = () => {
6338
- emit("change", props.model);
6447
+ const eventNameChangeHandler = (v, eventData) => {
6448
+ emit("change", props.model[props.name], eventData);
6339
6449
  };
6450
+ const onChangeHandler = (v, eventData) => emit("change", props.model[props.name], eventData);
6340
6451
  return (_ctx, _cache) => {
6341
6452
  const _component_m_form_table = vue.resolveComponent("m-form-table");
6342
6453
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
@@ -6367,6 +6478,7 @@
6367
6478
  key: index,
6368
6479
  disabled: _ctx.disabled,
6369
6480
  size: _ctx.size,
6481
+ prop: `${_ctx.prop}.${index}`,
6370
6482
  config: actionsConfig.value,
6371
6483
  model: cardItem,
6372
6484
  "label-width": _ctx.config.labelWidth || "100px",
@@ -6379,8 +6491,9 @@
6379
6491
  model: cardItem,
6380
6492
  disabled: _ctx.disabled,
6381
6493
  size: _ctx.size,
6382
- onChange: onChangeHandler
6383
- }, null, 8, ["config", "model", "disabled", "size"]),
6494
+ prop: `${_ctx.prop}.${index}`,
6495
+ onChange: eventNameChangeHandler
6496
+ }, null, 8, ["config", "model", "disabled", "size", "prop"]),
6384
6497
  vue.createVNode(vue.unref(designPlugin.TMagicButton), {
6385
6498
  style: { "color": "#f56c6c" },
6386
6499
  link: "",
@@ -6391,7 +6504,7 @@
6391
6504
  }, null, 8, ["icon", "disabled", "size", "onClick"])
6392
6505
  ]),
6393
6506
  _: 2
6394
- }, 1032, ["disabled", "size", "config", "model", "label-width"]);
6507
+ }, 1032, ["disabled", "size", "prop", "config", "model", "label-width"]);
6395
6508
  }), 128))
6396
6509
  ]))
6397
6510
  ]);
@@ -6444,14 +6557,18 @@
6444
6557
  const records = vue.ref([]);
6445
6558
  const showCode = vue.ref(false);
6446
6559
  vue.watchEffect(() => {
6447
- const initValues = Object.entries(props.model[props.name] || {});
6448
- for (const [, value] of initValues) {
6449
- if (typeof value !== "string") {
6450
- showCode.value = true;
6451
- break;
6560
+ if (typeof props.model[props.name] === "function") {
6561
+ showCode.value = true;
6562
+ } else {
6563
+ const initValues = Object.entries(props.model[props.name] || {});
6564
+ for (const [, value] of initValues) {
6565
+ if (typeof value !== "string") {
6566
+ showCode.value = true;
6567
+ break;
6568
+ }
6452
6569
  }
6570
+ records.value = initValues;
6453
6571
  }
6454
- records.value = initValues;
6455
6572
  });
6456
6573
  const getValue = () => {
6457
6574
  const record = {};
@@ -6533,7 +6650,7 @@
6533
6650
  key: 1,
6534
6651
  height: "200px",
6535
6652
  "init-values": _ctx.model[_ctx.name],
6536
- language: "json",
6653
+ language: "javascript",
6537
6654
  options: {
6538
6655
  readOnly: _ctx.disabled
6539
6656
  },
@@ -7201,7 +7318,7 @@
7201
7318
  pageBarSortOptions: {},
7202
7319
  length: {}
7203
7320
  },
7204
- setup(__props) {
7321
+ setup(__props, { expose: __expose }) {
7205
7322
  const props = __props;
7206
7323
  const services = vue.inject("services");
7207
7324
  const editorService = services?.editorService;
@@ -7231,23 +7348,28 @@
7231
7348
  });
7232
7349
  let translateLeft = 0;
7233
7350
  const scroll = (type) => {
7234
- if (!itemsContainer.value) return;
7351
+ if (!itemsContainer.value || !canScroll.value) return;
7235
7352
  const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
7236
7353
  if (type === "left") {
7237
- translateLeft += 100;
7238
- if (translateLeft > 0) {
7239
- translateLeft = 0;
7240
- }
7354
+ scrollTo(translateLeft + 200);
7241
7355
  } else if (type === "right") {
7242
- translateLeft -= 100;
7243
- if (-translateLeft > maxScrollLeft) {
7244
- translateLeft = -maxScrollLeft;
7245
- }
7356
+ scrollTo(translateLeft - 200);
7246
7357
  } else if (type === "start") {
7247
- translateLeft = 0;
7358
+ scrollTo(0);
7248
7359
  } else if (type === "end") {
7249
- translateLeft = -maxScrollLeft;
7360
+ scrollTo(-maxScrollLeft);
7250
7361
  }
7362
+ };
7363
+ const scrollTo = (value) => {
7364
+ if (!itemsContainer.value || !canScroll.value) return;
7365
+ const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
7366
+ if (value >= 0) {
7367
+ value = 0;
7368
+ }
7369
+ if (-value > maxScrollLeft) {
7370
+ value = -maxScrollLeft;
7371
+ }
7372
+ translateLeft = value;
7251
7373
  itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
7252
7374
  };
7253
7375
  vue.watch(
@@ -7255,11 +7377,13 @@
7255
7377
  (length = 0, preLength = 0) => {
7256
7378
  setTimeout(() => {
7257
7379
  setCanScroll();
7258
- if (length < preLength) {
7259
- scroll("start");
7260
- } else {
7261
- scroll("end");
7262
- }
7380
+ vue.nextTick(() => {
7381
+ if (length < preLength || preLength === 0) {
7382
+ scroll("start");
7383
+ } else {
7384
+ scroll("end");
7385
+ }
7386
+ });
7263
7387
  if (length > 1) {
7264
7388
  const el = document.querySelector(".m-editor-page-bar-items");
7265
7389
  let beforeDragList = [];
@@ -7296,6 +7420,14 @@
7296
7420
  immediate: true
7297
7421
  }
7298
7422
  );
7423
+ __expose({
7424
+ itemsContainerWidth,
7425
+ scroll,
7426
+ scrollTo,
7427
+ getTranslateLeft() {
7428
+ return translateLeft;
7429
+ }
7430
+ });
7299
7431
  return (_ctx, _cache) => {
7300
7432
  return vue.openBlock(), vue.createElementBlock("div", {
7301
7433
  class: "m-editor-page-bar",
@@ -7303,25 +7435,24 @@
7303
7435
  ref: pageBar
7304
7436
  }, [
7305
7437
  vue.renderSlot(_ctx.$slots, "prepend"),
7306
- canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
7307
- key: 0,
7308
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
7309
- onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
7310
- }, [
7311
- vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
7312
- ])) : vue.createCommentVNode("", true),
7313
7438
  _ctx.length ? (vue.openBlock(), vue.createElementBlock("div", {
7314
- key: 1,
7439
+ key: 0,
7315
7440
  class: "m-editor-page-bar-items",
7316
7441
  ref_key: "itemsContainer",
7317
- ref: itemsContainer,
7318
- style: vue.normalizeStyle(`width: ${itemsContainerWidth.value}px`)
7442
+ ref: itemsContainer
7319
7443
  }, [
7320
7444
  vue.renderSlot(_ctx.$slots, "default")
7321
- ], 4)) : vue.createCommentVNode("", true),
7445
+ ], 512)) : vue.createCommentVNode("", true),
7446
+ canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
7447
+ key: 1,
7448
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-item-left-icon",
7449
+ onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
7450
+ }, [
7451
+ vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
7452
+ ])) : vue.createCommentVNode("", true),
7322
7453
  canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
7323
7454
  key: 2,
7324
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
7455
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-item-right-icon",
7325
7456
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
7326
7457
  }, [
7327
7458
  vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.ArrowRightBold) }, null, 8, ["icon"])
@@ -7349,8 +7480,9 @@
7349
7480
  const uiService = services?.uiService;
7350
7481
  const editorService = services?.editorService;
7351
7482
  const showPageListButton = vue.computed(() => uiService?.get("showPageListButton"));
7352
- const switchPage = (id) => {
7353
- editorService?.select(id);
7483
+ const page = vue.computed(() => editorService?.get("page"));
7484
+ const switchPage = async (id) => {
7485
+ await editorService?.select(id);
7354
7486
  };
7355
7487
  return (_ctx, _cache) => {
7356
7488
  return showPageListButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
@@ -7377,6 +7509,7 @@
7377
7509
  data: {
7378
7510
  type: "button",
7379
7511
  text: item.devconfig?.tabName || item.name || item.id,
7512
+ className: item.id === page.value?.id ? "active" : "",
7380
7513
  handler: () => switchPage(item.id)
7381
7514
  },
7382
7515
  key: index
@@ -7457,7 +7590,7 @@
7457
7590
  });
7458
7591
 
7459
7592
  const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
7460
- const _hoisted_2$5 = ["page-id", "onClick"];
7593
+ const _hoisted_2$5 = ["data-page-id", "onClick"];
7461
7594
  const _hoisted_3$2 = { class: "m-editor-page-bar-title" };
7462
7595
  const _hoisted_4$2 = ["title"];
7463
7596
  const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
@@ -7508,9 +7641,38 @@
7508
7641
  const remove = (node) => {
7509
7642
  editorService?.remove(node);
7510
7643
  };
7644
+ const pageBarScrollContainer = vue.ref();
7645
+ const pageBarItems = vue.ref();
7646
+ vue.watch(page, (page2) => {
7647
+ if (!page2 || !pageBarScrollContainer.value?.itemsContainerWidth || !pageBarItems.value || pageBarItems.value.length < 2) {
7648
+ return;
7649
+ }
7650
+ const firstItem = pageBarItems.value[0];
7651
+ const lastItem = pageBarItems.value[pageBarItems.value.length - 1];
7652
+ if (page2.id === firstItem.dataset.pageId) {
7653
+ pageBarScrollContainer.value.scroll("start");
7654
+ } else if (page2.id === lastItem.dataset.pageId) {
7655
+ pageBarScrollContainer.value.scroll("end");
7656
+ } else {
7657
+ const pageItem = pageBarItems.value.find((item) => item.dataset.pageId === page2.id);
7658
+ if (!pageItem) {
7659
+ return;
7660
+ }
7661
+ const pageItemRect = pageItem.getBoundingClientRect();
7662
+ const offsetLeft = pageItemRect.left - firstItem.getBoundingClientRect().left;
7663
+ const { itemsContainerWidth } = pageBarScrollContainer.value;
7664
+ const left = itemsContainerWidth - offsetLeft - pageItemRect.width;
7665
+ const translateLeft = pageBarScrollContainer.value.getTranslateLeft();
7666
+ if (offsetLeft + translateLeft < 0 || offsetLeft + pageItemRect.width > itemsContainerWidth - translateLeft) {
7667
+ pageBarScrollContainer.value.scrollTo(left);
7668
+ }
7669
+ }
7670
+ });
7511
7671
  return (_ctx, _cache) => {
7512
7672
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
7513
7673
  vue.createVNode(_sfc_main$w, {
7674
+ ref_key: "pageBarScrollContainer",
7675
+ ref: pageBarScrollContainer,
7514
7676
  "page-bar-sort-options": _ctx.pageBarSortOptions,
7515
7677
  length: list.value.length
7516
7678
  }, {
@@ -7533,8 +7695,11 @@
7533
7695
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (item) => {
7534
7696
  return vue.openBlock(), vue.createElementBlock("div", {
7535
7697
  class: vue.normalizeClass(["m-editor-page-bar-item", { active: page.value?.id === item.id }]),
7698
+ ref_for: true,
7699
+ ref_key: "pageBarItems",
7700
+ ref: pageBarItems,
7536
7701
  key: item.id,
7537
- "page-id": item.id,
7702
+ "data-page-id": item.id,
7538
7703
  onClick: ($event) => switchPage(item.id)
7539
7704
  }, [
7540
7705
  vue.createElementVNode("div", _hoisted_3$2, [
@@ -7666,7 +7831,6 @@
7666
7831
  const root = vue.computed(() => editorService?.get("root"));
7667
7832
  const page = vue.computed(() => editorService?.get("page"));
7668
7833
  const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
7669
- const stageLoading = vue.computed(() => editorService?.get("stageLoading") || false);
7670
7834
  const showSrc = vue.computed(() => uiService?.get("showSrc"));
7671
7835
  const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
7672
7836
  const getRightColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
@@ -7717,7 +7881,6 @@
7717
7881
  }
7718
7882
  };
7719
7883
  return (_ctx, _cache) => {
7720
- const _directive_loading = vue.resolveDirective("loading");
7721
7884
  return vue.openBlock(), vue.createElementBlock("div", {
7722
7885
  class: "m-editor",
7723
7886
  ref_key: "content",
@@ -7734,9 +7897,8 @@
7734
7897
  options: vue.unref(codeOptions),
7735
7898
  onSave: saveCode
7736
7899
  }, null, 8, ["init-values", "options"])
7737
- ]) : vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$z, {
7900
+ ]) : (vue.openBlock(), vue.createBlock(_sfc_main$z, {
7738
7901
  key: 1,
7739
- "element-loading-text": "Runtime 加载中...",
7740
7902
  ref_key: "splitView",
7741
7903
  ref: splitView,
7742
7904
  class: "m-editor-content",
@@ -7796,9 +7958,7 @@
7796
7958
  ]),
7797
7959
  key: "0"
7798
7960
  } : void 0
7799
- ]), 1032, ["left", "right", "width"])), [
7800
- [_directive_loading, stageLoading.value]
7801
- ]),
7961
+ ]), 1032, ["left", "right", "width"])),
7802
7962
  vue.renderSlot(_ctx.$slots, "content-after"),
7803
7963
  vue.renderSlot(_ctx.$slots, "footer")
7804
7964
  ], 512);
@@ -8047,10 +8207,10 @@
8047
8207
  configForm.value.formState.stage = stage.value;
8048
8208
  }
8049
8209
  });
8050
- const submit = async () => {
8210
+ const submit = async (v, eventData) => {
8051
8211
  try {
8052
8212
  const values2 = await configForm.value?.submitForm();
8053
- services?.editorService.update(values2);
8213
+ services?.editorService.update(values2, { changeRecords: eventData.changeRecords });
8054
8214
  } catch (e) {
8055
8215
  emit("submit-error", e);
8056
8216
  }
@@ -8352,6 +8512,7 @@
8352
8512
  const emit = __emit;
8353
8513
  const services = vue.inject("services");
8354
8514
  const { codeBlockService, depService, editorService } = services || {};
8515
+ const collecting = vue.computed(() => depService?.get("collecting"));
8355
8516
  const codeList = vue.computed(
8356
8517
  () => Object.entries(codeBlockService?.getCodeDsl() || {}).map(([codeId, code]) => {
8357
8518
  const target = depService?.getTarget(codeId, core.DepTargetType.CODE_BLOCK);
@@ -8451,8 +8612,19 @@
8451
8612
  }, vue.toDisplayString(data.name) + " " + vue.toDisplayString(data.key ? `(${data.key})` : ""), 3)
8452
8613
  ]),
8453
8614
  "tree-node-tool": vue.withCtx(({ data }) => [
8454
- data.type === "code" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
8615
+ collecting.value && data.type === "code" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTag), {
8455
8616
  key: 0,
8617
+ type: "info",
8618
+ size: "small",
8619
+ style: { "margin-right": "5px" }
8620
+ }, {
8621
+ default: vue.withCtx(() => _cache[0] || (_cache[0] = [
8622
+ vue.createTextVNode("依赖收集中")
8623
+ ])),
8624
+ _: 1
8625
+ })) : vue.createCommentVNode("", true),
8626
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
8627
+ key: 1,
8456
8628
  effect: "dark",
8457
8629
  content: editable.value ? "编辑" : "查看",
8458
8630
  placement: "bottom"
@@ -8467,7 +8639,7 @@
8467
8639
  _: 2
8468
8640
  }, 1032, ["content"])) : vue.createCommentVNode("", true),
8469
8641
  data.type === "code" && editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
8470
- key: 1,
8642
+ key: 2,
8471
8643
  effect: "dark",
8472
8644
  content: "删除",
8473
8645
  placement: "bottom"
@@ -8583,9 +8755,9 @@
8583
8755
  dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
8584
8756
  editDialog.value.show();
8585
8757
  };
8586
- const submitDataSourceHandler = (value) => {
8758
+ const submitDataSourceHandler = (value, eventData) => {
8587
8759
  if (value.id) {
8588
- dataSourceService?.update(value);
8760
+ dataSourceService?.update(value, { changeRecords: eventData.changeRecords });
8589
8761
  } else {
8590
8762
  dataSourceService?.add(value);
8591
8763
  }
@@ -8632,8 +8804,8 @@
8632
8804
  initValues.value = props.values;
8633
8805
  dataSourceConfig.value = services?.dataSourceService.getFormConfig(initValues.value.type) || [];
8634
8806
  });
8635
- const submitHandler = (values) => {
8636
- emit("submit", values);
8807
+ const submitHandler = (values, data) => {
8808
+ emit("submit", values, data);
8637
8809
  };
8638
8810
  const errorHandler = (error) => {
8639
8811
  designPlugin.tMagicMessage.error(error.message);
@@ -8689,6 +8861,7 @@
8689
8861
  setup(__props, { expose: __expose, emit: __emit }) {
8690
8862
  const emit = __emit;
8691
8863
  const { depService, editorService, dataSourceService } = vue.inject("services") || {};
8864
+ const collecting = vue.computed(() => depService?.get("collecting"));
8692
8865
  const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
8693
8866
  const dataSources = vue.computed(() => dataSourceService?.get("dataSources") || []);
8694
8867
  const dsDep = vue.computed(() => depService?.getTargets(core.DepTargetType.DATA_SOURCE) || {});
@@ -8794,8 +8967,19 @@
8794
8967
  }, vue.toDisplayString(data.name) + " " + vue.toDisplayString(data.key ? `(${data.key})` : ""), 3)
8795
8968
  ]),
8796
8969
  "tree-node-tool": vue.withCtx(({ data }) => [
8797
- data.type === "ds" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
8970
+ collecting.value && data.type === "ds" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTag), {
8798
8971
  key: 0,
8972
+ type: "info",
8973
+ size: "small",
8974
+ style: { "margin-right": "5px" }
8975
+ }, {
8976
+ default: vue.withCtx(() => _cache[0] || (_cache[0] = [
8977
+ vue.createTextVNode("依赖收集中")
8978
+ ])),
8979
+ _: 1
8980
+ })) : vue.createCommentVNode("", true),
8981
+ data.type === "ds" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
8982
+ key: 1,
8799
8983
  effect: "dark",
8800
8984
  content: editable.value ? "编辑" : "查看",
8801
8985
  placement: "bottom"
@@ -8810,7 +8994,7 @@
8810
8994
  _: 2
8811
8995
  }, 1032, ["content"])) : vue.createCommentVNode("", true),
8812
8996
  data.type === "ds" && editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
8813
- key: 1,
8997
+ key: 2,
8814
8998
  effect: "dark",
8815
8999
  content: "删除",
8816
9000
  placement: "bottom"
@@ -10076,6 +10260,7 @@
10076
10260
  setup(__props, { expose: __expose }) {
10077
10261
  const props = __props;
10078
10262
  const services = vue.inject("services");
10263
+ const collecting = vue.computed(() => services?.depService.get("collecting"));
10079
10264
  const columnLeftWidth = vue.computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
10080
10265
  const { height: editorContentHeight } = useEditorContentHeight();
10081
10266
  const columnLeftHeight = vue.ref(0);
@@ -10218,7 +10403,7 @@
10218
10403
  ]),
10219
10404
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
10220
10405
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
10221
- class: "m-editor-sidebar-content",
10406
+ class: vue.normalizeClass(["m-editor-sidebar-content", { "m-editor-dep-collecting": collecting.value }]),
10222
10407
  key: config.$key ?? index
10223
10408
  }, [
10224
10409
  config?.component && !vue.unref(floatBoxStates)[config.$key]?.status ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({
@@ -10344,7 +10529,7 @@
10344
10529
  key: "11"
10345
10530
  } : void 0
10346
10531
  ]), 1040)) : vue.createCommentVNode("", true)
10347
- ])), [
10532
+ ], 2)), [
10348
10533
  [vue.vShow, [config.text, config.$key, `${index}`].includes(activeTabName.value)]
10349
10534
  ]);
10350
10535
  }), 128))
@@ -10925,15 +11110,17 @@
10925
11110
  },
10926
11111
  __name: "Stage",
10927
11112
  props: {
11113
+ stageOptions: {},
10928
11114
  stageContentMenu: {},
10929
11115
  disabledStageOverlay: { type: Boolean, default: false },
10930
11116
  customContentMenu: {}
10931
11117
  },
10932
11118
  setup(__props) {
11119
+ const props = __props;
10933
11120
  let stage = null;
10934
11121
  let runtime = null;
10935
11122
  const services = vue.inject("services");
10936
- const stageOptions = vue.inject("stageOptions");
11123
+ const stageLoading = vue.computed(() => services?.editorService.get("stageLoading") || false);
10937
11124
  const stageWrap = vue.ref();
10938
11125
  const stageContainer = vue.ref();
10939
11126
  const menu = vue.ref();
@@ -10948,8 +11135,8 @@
10948
11135
  vue.watchEffect(() => {
10949
11136
  if (stage || !page.value) return;
10950
11137
  if (!stageContainer.value) return;
10951
- if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value) return;
10952
- stage = useStage(stageOptions);
11138
+ if (!(props.stageOptions?.runtimeUrl || props.stageOptions?.render) || !root.value) return;
11139
+ stage = useStage(props.stageOptions);
10953
11140
  stage.on("select", () => {
10954
11141
  stageWrap.value?.container?.focus();
10955
11142
  });
@@ -10969,6 +11156,7 @@
10969
11156
  });
10970
11157
  vue.onBeforeUnmount(() => {
10971
11158
  stage?.destroy();
11159
+ services?.editorService.set("stage", null);
10972
11160
  });
10973
11161
  vue.watch(zoom, (zoom2) => {
10974
11162
  if (!stage || !zoom2) return;
@@ -11036,7 +11224,9 @@
11036
11224
  if (!config || config.dragType !== DragType.COMPONENT_LIST) return;
11037
11225
  e.preventDefault();
11038
11226
  const doc = stage?.renderer?.contentWindow?.document;
11039
- const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
11227
+ const parentEl = doc?.querySelector(
11228
+ `.${props.stageOptions?.containerHighlightClassName}`
11229
+ );
11040
11230
  let parent = page.value;
11041
11231
  const parentId = utils.getIdFromEl()(parentEl);
11042
11232
  if (parentId) {
@@ -11075,11 +11265,13 @@
11075
11265
  }
11076
11266
  };
11077
11267
  return (_ctx, _cache) => {
11078
- return vue.openBlock(), vue.createBlock(_sfc_main$8, {
11268
+ const _directive_loading = vue.resolveDirective("loading");
11269
+ return vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$8, {
11079
11270
  class: "m-editor-stage",
11080
11271
  ref_key: "stageWrap",
11081
11272
  ref: stageWrap,
11082
11273
  tabindex: "-1",
11274
+ "element-loading-text": "Runtime 加载中...",
11083
11275
  width: stageRect.value?.width,
11084
11276
  height: stageRect.value?.height,
11085
11277
  "wrap-width": stageContainerRect.value?.width,
@@ -11116,7 +11308,9 @@
11116
11308
  vue.createVNode(_sfc_main$7)
11117
11309
  ]),
11118
11310
  _: 1
11119
- }, 8, ["width", "height", "wrap-width", "wrap-height", "zoom"]);
11311
+ }, 8, ["width", "height", "wrap-width", "wrap-height", "zoom"])), [
11312
+ [_directive_loading, stageLoading.value]
11313
+ ]);
11120
11314
  };
11121
11315
  }
11122
11316
  });
@@ -11178,18 +11372,20 @@
11178
11372
  customContentMenu: {}
11179
11373
  },
11180
11374
  setup(__props) {
11375
+ const stageOptions = vue.inject("stageOptions");
11181
11376
  const services = vue.inject("services");
11182
11377
  const page = vue.computed(() => services?.editorService.get("page"));
11183
11378
  return (_ctx, _cache) => {
11184
11379
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
11185
11380
  vue.createVNode(_sfc_main$2),
11186
11381
  vue.renderSlot(_ctx.$slots, "stage", {}, () => [
11187
- page.value ? (vue.openBlock(), vue.createBlock(_sfc_main$3, {
11382
+ page.value && (vue.unref(stageOptions)?.render || vue.unref(stageOptions)?.runtimeUrl) ? (vue.openBlock(), vue.createBlock(_sfc_main$3, {
11188
11383
  key: 0,
11384
+ "stage-options": vue.unref(stageOptions),
11189
11385
  "disabled-stage-overlay": _ctx.disabledStageOverlay,
11190
11386
  "stage-content-menu": _ctx.stageContentMenu,
11191
11387
  "custom-content-menu": _ctx.customContentMenu
11192
- }, null, 8, ["disabled-stage-overlay", "stage-content-menu", "custom-content-menu"])) : vue.createCommentVNode("", true)
11388
+ }, null, 8, ["stage-options", "disabled-stage-overlay", "stage-content-menu", "custom-content-menu"])) : vue.createCommentVNode("", true)
11193
11389
  ]),
11194
11390
  vue.renderSlot(_ctx.$slots, "workspace-content")
11195
11391
  ]);
@@ -11539,12 +11735,17 @@
11539
11735
  this.emit("add", newConfig);
11540
11736
  return newConfig;
11541
11737
  }
11542
- update(config) {
11738
+ update(config, { changeRecords = [] } = {}) {
11543
11739
  const dataSources = this.get("dataSources");
11544
11740
  const index = dataSources.findIndex((ds) => ds.id === config.id);
11545
- dataSources[index] = lodashEs.cloneDeep(config);
11546
- this.emit("update", config);
11547
- return config;
11741
+ const oldConfig = dataSources[index];
11742
+ const newConfig = lodashEs.cloneDeep(config);
11743
+ dataSources[index] = newConfig;
11744
+ this.emit("update", newConfig, {
11745
+ oldConfig,
11746
+ changeRecords
11747
+ });
11748
+ return newConfig;
11548
11749
  }
11549
11750
  remove(id) {
11550
11751
  const dataSources = this.get("dataSources");
@@ -11620,7 +11821,16 @@
11620
11821
 
11621
11822
  const idleTask = new IdleTask();
11622
11823
  class Dep extends BaseService {
11824
+ state = vue.reactive({
11825
+ collecting: false
11826
+ });
11623
11827
  watcher = new core.Watcher({ initialTargets: vue.reactive({}) });
11828
+ set(name, value) {
11829
+ this.state[name] = value;
11830
+ }
11831
+ get(name) {
11832
+ return this.state[name];
11833
+ }
11624
11834
  removeTargets(type = core.DepTargetType.DEFAULT) {
11625
11835
  this.watcher.removeTargets(type);
11626
11836
  const targets = this.watcher.getTargets(type);
@@ -11647,34 +11857,30 @@
11647
11857
  this.watcher.clearTargets();
11648
11858
  }
11649
11859
  collect(nodes, depExtendedData = {}, deep = false, type) {
11860
+ this.set("collecting", true);
11650
11861
  this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
11651
11862
  this.collectNode(node, target, depExtendedData, deep);
11652
11863
  });
11864
+ this.set("collecting", false);
11653
11865
  this.emit("collected", nodes, deep);
11654
11866
  }
11655
11867
  collectIdle(nodes, depExtendedData = {}, deep = false, type) {
11868
+ this.set("collecting", true);
11656
11869
  let startTask = false;
11657
11870
  this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
11658
11871
  startTask = true;
11659
- idleTask.enqueueTask(
11660
- ({ node: node2, deep: deep2, target: target2 }) => {
11661
- this.collectNode(node2, target2, depExtendedData, deep2);
11662
- },
11663
- {
11664
- node,
11665
- deep,
11666
- target
11667
- }
11668
- );
11872
+ this.enqueueTask(node, target, depExtendedData, deep);
11669
11873
  });
11670
11874
  return new Promise((resolve) => {
11671
11875
  if (!startTask) {
11672
11876
  this.emit("collected", nodes, deep);
11877
+ this.set("collecting", false);
11673
11878
  resolve();
11674
11879
  return;
11675
11880
  }
11676
11881
  idleTask.once("finish", () => {
11677
11882
  this.emit("collected", nodes, deep);
11883
+ this.set("collecting", false);
11678
11884
  resolve();
11679
11885
  });
11680
11886
  });
@@ -11703,6 +11909,9 @@
11703
11909
  hasSpecifiedTypeTarget(type = core.DepTargetType.DEFAULT) {
11704
11910
  return this.watcher.hasSpecifiedTypeTarget(type);
11705
11911
  }
11912
+ clearIdleTasks() {
11913
+ idleTask.clearTasks();
11914
+ }
11706
11915
  on(eventName, listener) {
11707
11916
  return super.on(eventName, listener);
11708
11917
  }
@@ -11712,6 +11921,23 @@
11712
11921
  emit(eventName, ...args) {
11713
11922
  return super.emit(eventName, ...args);
11714
11923
  }
11924
+ enqueueTask(node, target, depExtendedData, deep) {
11925
+ idleTask.enqueueTask(
11926
+ ({ node: node2, deep: deep2, target: target2 }) => {
11927
+ this.collectNode(node2, target2, depExtendedData, deep2);
11928
+ },
11929
+ {
11930
+ node,
11931
+ deep: false,
11932
+ target
11933
+ }
11934
+ );
11935
+ if (deep && Array.isArray(node.items) && node.items.length) {
11936
+ node.items.forEach((item) => {
11937
+ this.enqueueTask(item, target, depExtendedData, deep);
11938
+ });
11939
+ }
11940
+ }
11715
11941
  }
11716
11942
  const depService = new Dep();
11717
11943
 
@@ -12285,6 +12511,7 @@
12285
12511
  initDataSourceDepTarget(ds);
12286
12512
  });
12287
12513
  if (Array.isArray(value.items)) {
12514
+ depService.clearIdleTasks();
12288
12515
  collectIdle(value.items, true);
12289
12516
  } else {
12290
12517
  depService.clear();
@@ -12309,10 +12536,20 @@
12309
12536
  emit("update:modelValue", value);
12310
12537
  }
12311
12538
  };
12312
- const getApp = () => {
12313
- const stage = editorService.get("stage");
12314
- return stage?.renderer?.runtime?.getApp?.();
12315
- };
12539
+ const stage = vue.computed(() => editorService.get("stage"));
12540
+ vue.watch(stage, (stage2) => {
12541
+ if (!stage2) {
12542
+ return;
12543
+ }
12544
+ stage2.on("rerender", () => {
12545
+ const node = editorService.get("node");
12546
+ if (!node) return;
12547
+ collectIdle([node], true).then(() => {
12548
+ afterUpdateNodes([node]);
12549
+ });
12550
+ });
12551
+ });
12552
+ const getApp = () => stage.value?.renderer?.runtime?.getApp?.();
12316
12553
  const updateDataSourceSchema = (nodes, deep) => {
12317
12554
  const root = editorService.get("root");
12318
12555
  const app = getApp();
@@ -12324,8 +12561,7 @@
12324
12561
  if (root?.dataSources) {
12325
12562
  getApp()?.dataSourceManager?.updateSchema(root.dataSources);
12326
12563
  }
12327
- const stage = editorService.get("stage");
12328
- if (!root || !stage) return;
12564
+ if (!root || !stage.value) return;
12329
12565
  const allNodes = [];
12330
12566
  if (deep) {
12331
12567
  nodes.forEach((node) => {
@@ -12342,7 +12578,7 @@
12342
12578
  deps.forEach((dep) => {
12343
12579
  Object.keys(dep).forEach((id) => {
12344
12580
  const node = allNodes.find((node2) => node2.id === id);
12345
- node && stage.update({
12581
+ node && stage.value?.update({
12346
12582
  config: lodashEs.cloneDeep(node),
12347
12583
  parentId: editorService.getParentById(node.id)?.id,
12348
12584
  root: lodashEs.cloneDeep(root)
@@ -12353,13 +12589,8 @@
12353
12589
  const afterUpdateNodes = (nodes) => {
12354
12590
  const root = editorService.get("root");
12355
12591
  if (!root) return;
12356
- const stage = editorService.get("stage");
12357
- const app = getApp();
12358
- if (app?.dsl) {
12359
- app.dsl.dataSourceDeps = root.dataSourceDeps;
12360
- }
12361
12592
  for (const node of nodes) {
12362
- stage?.update({
12593
+ stage.value?.update({
12363
12594
  config: lodashEs.cloneDeep(node),
12364
12595
  parentId: editorService.getParentById(node.id)?.id,
12365
12596
  root: lodashEs.cloneDeep(root)
@@ -12392,8 +12623,17 @@
12392
12623
  delete root.dataSourceCondDeps[id];
12393
12624
  }
12394
12625
  };
12626
+ const depCollectedHandler = () => {
12627
+ const root = editorService.get("root");
12628
+ if (!root) return;
12629
+ const app = getApp();
12630
+ if (app?.dsl) {
12631
+ app.dsl.dataSourceDeps = root.dataSourceDeps;
12632
+ }
12633
+ };
12395
12634
  depService.on("add-target", targetAddHandler);
12396
12635
  depService.on("remove-target", targetRemoveHandler);
12636
+ depService.on("collected", depCollectedHandler);
12397
12637
  const initDataSourceDepTarget = (ds) => {
12398
12638
  depService.addTarget(core.createDataSourceTarget(ds, vue.reactive({})));
12399
12639
  depService.addTarget(core.createDataSourceMethodTarget(ds, vue.reactive({})));
@@ -12416,10 +12656,30 @@
12416
12656
  afterUpdateNodes(nodes);
12417
12657
  });
12418
12658
  };
12419
- const nodeUpdateHandler = (nodes) => {
12420
- collectIdle(nodes, true).then(() => {
12421
- afterUpdateNodes(nodes);
12659
+ const nodeUpdateHandler = (data) => {
12660
+ const needRecollectNodes = [];
12661
+ const normalNodes = [];
12662
+ data.forEach(({ newNode, oldNode, changeRecords }) => {
12663
+ if (changeRecords?.length) {
12664
+ for (const record of changeRecords) {
12665
+ if (!record.propPath || new RegExp(`${core.NODE_CONDS_KEY}.(\\d)+.cond`).test(record.propPath) || new RegExp(`${core.NODE_CONDS_KEY}.(\\d)+.cond.(\\d)+.value`).test(record.propPath) || record.propPath === core.NODE_CONDS_KEY || isValueIncludeDataSource(record.value)) {
12666
+ needRecollectNodes.push(newNode);
12667
+ break;
12668
+ }
12669
+ }
12670
+ } else if (isIncludeDataSource(newNode, oldNode)) {
12671
+ needRecollectNodes.push(newNode);
12672
+ } else {
12673
+ normalNodes.push(newNode);
12674
+ }
12422
12675
  });
12676
+ if (needRecollectNodes.length) {
12677
+ collectIdle(needRecollectNodes, true).then(() => {
12678
+ afterUpdateNodes(needRecollectNodes);
12679
+ });
12680
+ } else if (normalNodes.length) {
12681
+ afterUpdateNodes(normalNodes);
12682
+ }
12423
12683
  };
12424
12684
  const nodeRemoveHandler = (nodes) => {
12425
12685
  depService.clear(nodes);
@@ -12450,13 +12710,30 @@
12450
12710
  initDataSourceDepTarget(config);
12451
12711
  getApp()?.dataSourceManager?.addDataSource(config);
12452
12712
  };
12453
- const dataSourceUpdateHandler = (config) => {
12713
+ const dataSourceUpdateHandler = (config, { changeRecords }) => {
12714
+ let needRecollectDep = false;
12715
+ for (const changeRecord of changeRecords) {
12716
+ if (!changeRecord.propPath) {
12717
+ continue;
12718
+ }
12719
+ needRecollectDep = changeRecord.propPath === "fields" || changeRecord.propPath === "methods" || /fields.(\d)+.name/.test(changeRecord.propPath) || /fields.(\d)+$/.test(changeRecord.propPath) || /methods.(\d)+.name/.test(changeRecord.propPath) || /methods.(\d)+$/.test(changeRecord.propPath);
12720
+ if (needRecollectDep) {
12721
+ break;
12722
+ }
12723
+ }
12454
12724
  const root = editorService.get("root");
12455
- removeDataSourceTarget(config.id);
12456
- initDataSourceDepTarget(config);
12457
- collectIdle(root?.items || [], true).then(() => {
12458
- updateDataSourceSchema(root?.items || [], true);
12459
- });
12725
+ if (needRecollectDep) {
12726
+ if (Array.isArray(root?.items)) {
12727
+ depService.clearIdleTasks();
12728
+ removeDataSourceTarget(config.id);
12729
+ initDataSourceDepTarget(config);
12730
+ collectIdle(root.items, true).then(() => {
12731
+ updateDataSourceSchema(root?.items || [], true);
12732
+ });
12733
+ }
12734
+ } else if (root?.dataSources) {
12735
+ getApp()?.dataSourceManager?.updateSchema(root.dataSources);
12736
+ }
12460
12737
  };
12461
12738
  const removeDataSourceTarget = (id) => {
12462
12739
  depService.removeTarget(id, core.DepTargetType.DATA_SOURCE);
@@ -12478,6 +12755,7 @@
12478
12755
  vue.onBeforeUnmount(() => {
12479
12756
  depService.off("add-target", targetAddHandler);
12480
12757
  depService.off("remove-target", targetRemoveHandler);
12758
+ depService.off("collected", depCollectedHandler);
12481
12759
  editorService.off("history-change", historyChangeHandler);
12482
12760
  editorService.off("root-change", rootChangeHandler);
12483
12761
  editorService.off("add", nodeAddHandler);
@@ -12846,6 +13124,8 @@
12846
13124
  exports.getRelativeStyle = getRelativeStyle;
12847
13125
  exports.historyService = historyService;
12848
13126
  exports.info = info;
13127
+ exports.isIncludeDataSource = isIncludeDataSource;
13128
+ exports.isValueIncludeDataSource = isValueIncludeDataSource;
12849
13129
  exports.log = log;
12850
13130
  exports.moveItemsInContainer = moveItemsInContainer;
12851
13131
  exports.numberOptions = numberOptions;
@@ -12861,7 +13141,6 @@
12861
13141
  exports.uiService = uiService;
12862
13142
  exports.updateStatus = updateStatus;
12863
13143
  exports.useCodeBlockEdit = useCodeBlockEdit;
12864
- exports.useDataSourceMethod = useDataSourceMethod;
12865
13144
  exports.useEditorContentHeight = useEditorContentHeight;
12866
13145
  exports.useFilter = useFilter;
12867
13146
  exports.useFloatBox = useFloatBox;