@tmagic/editor 1.5.12 → 1.5.14

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 (39) hide show
  1. package/dist/tmagic-editor.js +219 -166
  2. package/dist/tmagic-editor.umd.cjs +225 -266
  3. package/package.json +7 -7
  4. package/src/Editor.vue +4 -20
  5. package/src/components/CodeBlockEditor.vue +14 -2
  6. package/src/components/ContentMenu.vue +2 -2
  7. package/src/components/FloatingBox.vue +1 -1
  8. package/src/components/ScrollBar.vue +9 -3
  9. package/src/components/SearchInput.vue +1 -1
  10. package/src/components/Tree.vue +3 -3
  11. package/src/components/TreeNode.vue +3 -3
  12. package/src/fields/CodeSelect.vue +5 -7
  13. package/src/fields/CodeSelectCol.vue +9 -5
  14. package/src/fields/DataSourceFields.vue +4 -2
  15. package/src/fields/DataSourceInput.vue +7 -3
  16. package/src/fields/DataSourceMethodSelect.vue +17 -6
  17. package/src/fields/DataSourceMethods.vue +3 -3
  18. package/src/fields/EventSelect.vue +3 -2
  19. package/src/fields/UISelect.vue +2 -2
  20. package/src/hooks/use-code-block-edit.ts +1 -1
  21. package/src/index.ts +0 -1
  22. package/src/initService.ts +75 -65
  23. package/src/layouts/Framework.vue +1 -1
  24. package/src/layouts/NavMenu.vue +1 -1
  25. package/src/layouts/page-bar/PageBar.vue +1 -1
  26. package/src/layouts/props-panel/FormPanel.vue +2 -2
  27. package/src/layouts/props-panel/PropsPanel.vue +1 -1
  28. package/src/layouts/sidebar/ComponentListPanel.vue +1 -1
  29. package/src/layouts/sidebar/code-block/CodeBlockList.vue +2 -1
  30. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +20 -3
  31. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +13 -1
  32. package/src/layouts/sidebar/data-source/DataSourceList.vue +1 -0
  33. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +20 -3
  34. package/src/layouts/workspace/viewer/Stage.vue +1 -1
  35. package/src/services/BaseService.ts +1 -0
  36. package/src/services/editor.ts +4 -3
  37. package/src/type.ts +9 -0
  38. package/src/utils/props.ts +9 -7
  39. package/types/index.d.ts +945 -9788
@@ -2467,32 +2467,6 @@
2467
2467
  Stack.prototype.has = stackHas;
2468
2468
  Stack.prototype.set = stackSet;
2469
2469
 
2470
- /**
2471
- * The base implementation of `_.assign` without support for multiple sources
2472
- * or `customizer` functions.
2473
- *
2474
- * @private
2475
- * @param {Object} object The destination object.
2476
- * @param {Object} source The source object.
2477
- * @returns {Object} Returns `object`.
2478
- */
2479
- function baseAssign(object, source) {
2480
- return object && copyObject(source, keys(source), object);
2481
- }
2482
-
2483
- /**
2484
- * The base implementation of `_.assignIn` without support for multiple sources
2485
- * or `customizer` functions.
2486
- *
2487
- * @private
2488
- * @param {Object} object The destination object.
2489
- * @param {Object} source The source object.
2490
- * @returns {Object} Returns `object`.
2491
- */
2492
- function baseAssignIn(object, source) {
2493
- return object && copyObject(source, keysIn(source), object);
2494
- }
2495
-
2496
2470
  /** Detect free variable `exports`. */
2497
2471
  var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
2498
2472
 
@@ -2578,7 +2552,7 @@
2578
2552
  var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
2579
2553
 
2580
2554
  /* Built-in method references for those with the same name as other `lodash` methods. */
2581
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2555
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
2582
2556
 
2583
2557
  /**
2584
2558
  * Creates an array of the own enumerable symbols of `object`.
@@ -2587,59 +2561,16 @@
2587
2561
  * @param {Object} object The object to query.
2588
2562
  * @returns {Array} Returns the array of symbols.
2589
2563
  */
2590
- var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
2564
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
2591
2565
  if (object == null) {
2592
2566
  return [];
2593
2567
  }
2594
2568
  object = Object(object);
2595
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2569
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
2596
2570
  return propertyIsEnumerable.call(object, symbol);
2597
2571
  });
2598
2572
  };
2599
2573
 
2600
- /**
2601
- * Copies own symbols of `source` to `object`.
2602
- *
2603
- * @private
2604
- * @param {Object} source The object to copy symbols from.
2605
- * @param {Object} [object={}] The object to copy symbols to.
2606
- * @returns {Object} Returns `object`.
2607
- */
2608
- function copySymbols(source, object) {
2609
- return copyObject(source, getSymbols(source), object);
2610
- }
2611
-
2612
- /* Built-in method references for those with the same name as other `lodash` methods. */
2613
- var nativeGetSymbols = Object.getOwnPropertySymbols;
2614
-
2615
- /**
2616
- * Creates an array of the own and inherited enumerable symbols of `object`.
2617
- *
2618
- * @private
2619
- * @param {Object} object The object to query.
2620
- * @returns {Array} Returns the array of symbols.
2621
- */
2622
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
2623
- var result = [];
2624
- while (object) {
2625
- arrayPush(result, getSymbols(object));
2626
- object = getPrototype(object);
2627
- }
2628
- return result;
2629
- };
2630
-
2631
- /**
2632
- * Copies own and inherited symbols of `source` to `object`.
2633
- *
2634
- * @private
2635
- * @param {Object} source The object to copy symbols from.
2636
- * @param {Object} [object={}] The object to copy symbols to.
2637
- * @returns {Object} Returns `object`.
2638
- */
2639
- function copySymbolsIn(source, object) {
2640
- return copyObject(source, getSymbolsIn(source), object);
2641
- }
2642
-
2643
2574
  /**
2644
2575
  * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2645
2576
  * `keysFunc` and `symbolsFunc` to get the enumerable property names and
@@ -2667,18 +2598,6 @@
2667
2598
  return baseGetAllKeys(object, keys, getSymbols);
2668
2599
  }
2669
2600
 
2670
- /**
2671
- * Creates an array of own and inherited enumerable property names and
2672
- * symbols of `object`.
2673
- *
2674
- * @private
2675
- * @param {Object} object The object to query.
2676
- * @returns {Array} Returns the array of property names and symbols.
2677
- */
2678
- function getAllKeysIn(object) {
2679
- return baseGetAllKeys(object, keysIn, getSymbolsIn);
2680
- }
2681
-
2682
2601
  /* Built-in method references that are verified to be native. */
2683
2602
  var DataView = getNative(root$1, 'DataView');
2684
2603
 
@@ -2787,7 +2706,7 @@
2787
2706
  * @returns {Object} Returns the cloned data view.
2788
2707
  */
2789
2708
  function cloneDataView(dataView, isDeep) {
2790
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
2709
+ var buffer = cloneArrayBuffer(dataView.buffer) ;
2791
2710
  return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2792
2711
  }
2793
2712
 
@@ -2880,7 +2799,7 @@
2880
2799
  return new Ctor(+object);
2881
2800
 
2882
2801
  case dataViewTag$2:
2883
- return cloneDataView(object, isDeep);
2802
+ return cloneDataView(object);
2884
2803
 
2885
2804
  case float32Tag$1: case float64Tag$1:
2886
2805
  case int8Tag$1: case int16Tag$1: case int32Tag$1:
@@ -2991,9 +2910,7 @@
2991
2910
  var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
2992
2911
 
2993
2912
  /** Used to compose bitmasks for cloning. */
2994
- var CLONE_DEEP_FLAG$1 = 1,
2995
- CLONE_FLAT_FLAG = 2,
2996
- CLONE_SYMBOLS_FLAG$1 = 4;
2913
+ var CLONE_DEEP_FLAG$1 = 1;
2997
2914
 
2998
2915
  /** `Object#toString` result references. */
2999
2916
  var argsTag$1 = '[object Arguments]',
@@ -3058,9 +2975,7 @@
3058
2975
  */
3059
2976
  function baseClone(value, bitmask, customizer, key, object, stack) {
3060
2977
  var result,
3061
- isDeep = bitmask & CLONE_DEEP_FLAG$1,
3062
- isFlat = bitmask & CLONE_FLAT_FLAG,
3063
- isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
2978
+ isDeep = bitmask & CLONE_DEEP_FLAG$1;
3064
2979
  if (result !== undefined) {
3065
2980
  return result;
3066
2981
  }
@@ -3070,9 +2985,6 @@
3070
2985
  var isArr = isArray(value);
3071
2986
  if (isArr) {
3072
2987
  result = initCloneArray(value);
3073
- if (!isDeep) {
3074
- return copyArray(value, result);
3075
- }
3076
2988
  } else {
3077
2989
  var tag = getTag(value),
3078
2990
  isFunc = tag == funcTag || tag == genTag;
@@ -3081,12 +2993,7 @@
3081
2993
  return cloneBuffer(value, isDeep);
3082
2994
  }
3083
2995
  if (tag == objectTag$1 || tag == argsTag$1 || (isFunc && !object)) {
3084
- result = (isFlat || isFunc) ? {} : initCloneObject(value);
3085
- if (!isDeep) {
3086
- return isFlat
3087
- ? copySymbolsIn(value, baseAssignIn(result, value))
3088
- : copySymbols(value, baseAssign(result, value));
3089
- }
2996
+ result = (isFunc) ? {} : initCloneObject(value);
3090
2997
  } else {
3091
2998
  if (!cloneableTags[tag]) {
3092
2999
  return object ? value : {};
@@ -3112,9 +3019,8 @@
3112
3019
  });
3113
3020
  }
3114
3021
 
3115
- var keysFunc = isFull
3116
- ? (isFlat ? getAllKeysIn : getAllKeys)
3117
- : (isFlat ? keysIn : keys);
3022
+ var keysFunc = (getAllKeys)
3023
+ ;
3118
3024
 
3119
3025
  var props = isArr ? undefined : keysFunc(value);
3120
3026
  arrayEach(props || value, function(subValue, key) {
@@ -5358,13 +5264,11 @@
5358
5264
  { value: core.HookCodeType.DATA_SOURCE_METHOD, text: "数据源方法" }
5359
5265
  ],
5360
5266
  defaultValue: "code",
5361
- onChange: (mForm, v, { model, prop, changeRecords }) => {
5267
+ onChange: (_mForm, v, { setModel }) => {
5362
5268
  if (v === core.HookCodeType.DATA_SOURCE_METHOD) {
5363
- model.codeId = [];
5364
- changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: [] });
5269
+ setModel("codeId", []);
5365
5270
  } else {
5366
- model.codeId = "";
5367
- changeRecords.push({ propPath: prop.replace("codeType", "codeId"), value: "" });
5271
+ setModel("codeId", "");
5368
5272
  }
5369
5273
  return v;
5370
5274
  }
@@ -5374,7 +5278,7 @@
5374
5278
  name: "codeId",
5375
5279
  span: 18,
5376
5280
  labelWidth: 0,
5377
- display: (mForm, { model }) => model.codeType !== core.HookCodeType.DATA_SOURCE_METHOD,
5281
+ display: (_mForm, { model }) => model.codeType !== core.HookCodeType.DATA_SOURCE_METHOD,
5378
5282
  notEditable: () => !codeBlockService.getEditStatus()
5379
5283
  },
5380
5284
  {
@@ -5382,7 +5286,7 @@
5382
5286
  name: "codeId",
5383
5287
  span: 18,
5384
5288
  labelWidth: 0,
5385
- display: (mForm, { model }) => model.codeType === core.HookCodeType.DATA_SOURCE_METHOD,
5289
+ display: (_mForm, { model }) => model.codeType === core.HookCodeType.DATA_SOURCE_METHOD,
5386
5290
  notEditable: () => !dataSourceService.get("editable")
5387
5291
  }
5388
5292
  ]
@@ -5580,13 +5484,12 @@
5580
5484
  append: {
5581
5485
  type: "button",
5582
5486
  text: "复制",
5583
- handler: async (vm, { model }) => {
5584
- try {
5585
- await navigator.clipboard.writeText(`${model.id}`);
5487
+ handler: (vm, { model }) => {
5488
+ navigator.clipboard.writeText(`${model.id}`).then(() => {
5586
5489
  designPlugin.tMagicMessage.success("已复制");
5587
- } catch (err) {
5490
+ }).catch(() => {
5588
5491
  designPlugin.tMagicMessage.error("复制失败");
5589
- }
5492
+ });
5590
5493
  }
5591
5494
  }
5592
5495
  },
@@ -6341,7 +6244,7 @@
6341
6244
  class History extends BaseService {
6342
6245
  state = vue.reactive({
6343
6246
  pageSteps: {},
6344
- pageId: undefined,
6247
+ pageId: void 0,
6345
6248
  canRedo: false,
6346
6249
  canUndo: false
6347
6250
  });
@@ -6354,7 +6257,7 @@
6354
6257
  this.resetPage();
6355
6258
  }
6356
6259
  resetPage() {
6357
- this.state.pageId = undefined;
6260
+ this.state.pageId = void 0;
6358
6261
  this.state.canRedo = false;
6359
6262
  this.state.canUndo = false;
6360
6263
  }
@@ -6374,7 +6277,7 @@
6374
6277
  this.emit("page-change", this.state.pageSteps[this.state.pageId]);
6375
6278
  }
6376
6279
  resetState() {
6377
- this.state.pageId = undefined;
6280
+ this.state.pageId = void 0;
6378
6281
  this.state.pageSteps = {};
6379
6282
  this.state.canRedo = false;
6380
6283
  this.state.canUndo = false;
@@ -6426,7 +6329,6 @@
6426
6329
  return Protocol2;
6427
6330
  })(Protocol || {});
6428
6331
  const canUsePluginMethods$5 = {
6429
- async: [],
6430
6332
  sync: ["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]
6431
6333
  };
6432
6334
  class WebStorage extends BaseService {
@@ -6563,9 +6465,7 @@
6563
6465
  "undo",
6564
6466
  "redo",
6565
6467
  "move"
6566
- ],
6567
- sync: []
6568
- };
6468
+ ]};
6569
6469
  class Editor extends BaseService {
6570
6470
  state = vue.reactive({
6571
6471
  root: null,
@@ -7327,10 +7227,11 @@
7327
7227
  this.isHistoryStateChange = true;
7328
7228
  await this.update(value.data);
7329
7229
  this.set("modifiedNodeIds", value.modifiedNodeIds);
7330
- setTimeout(async () => {
7230
+ setTimeout(() => {
7331
7231
  if (!value.nodeId) return;
7332
- await this.select(value.nodeId);
7333
- this.get("stage")?.select(value.nodeId);
7232
+ this.select(value.nodeId).then(() => {
7233
+ this.get("stage")?.select(value.nodeId);
7234
+ });
7334
7235
  }, 0);
7335
7236
  this.emit("history-change", value.data);
7336
7237
  }
@@ -7962,7 +7863,7 @@
7962
7863
  const nodeStatus = nodeStatusMap.get(id);
7963
7864
  if (!nodeStatus) return;
7964
7865
  utils.getKeys(status).forEach((key) => {
7965
- if (nodeStatus[key] !== undefined && status[key] !== undefined) {
7866
+ if (nodeStatus[key] !== void 0 && status[key] !== void 0) {
7966
7867
  nodeStatus[key] = Boolean(status[key]);
7967
7868
  }
7968
7869
  });
@@ -8102,20 +8003,23 @@
8102
8003
  }
8103
8004
  return [];
8104
8005
  },
8105
- onChange: (formState, codeId, { model }) => {
8006
+ onChange: (formState, codeId, { setModel, model }) => {
8106
8007
  paramsConfig.value = getParamItemsConfig(codeId);
8107
8008
  if (paramsConfig.value.length) {
8108
- model.params = formPlugin.createValues(formState, paramsConfig.value, {}, model.params);
8009
+ setModel("params", formPlugin.createValues(formState, paramsConfig.value, {}, model.params));
8109
8010
  } else {
8110
- model.params = {};
8011
+ setModel("params", {});
8111
8012
  }
8112
8013
  return codeId;
8113
8014
  }
8114
8015
  };
8115
- const onCodeIdChangeHandler = (value) => {
8016
+ const onCodeIdChangeHandler = (value, eventData) => {
8116
8017
  props.model.params = value.params;
8117
8018
  emit("change", props.model, {
8118
- changeRecords: [
8019
+ changeRecords: eventData.changeRecords?.map((item) => ({
8020
+ prop: `${props.prop.replace(props.name, "")}${item.propPath}`,
8021
+ value: item.value
8022
+ })) || [
8119
8023
  {
8120
8024
  propPath: props.prop,
8121
8025
  value: value[props.name]
@@ -8480,9 +8384,7 @@
8480
8384
  const createCodeBlock = async () => {
8481
8385
  codeConfig.value = {
8482
8386
  name: "",
8483
- content: `({app, params, flowState}) => {
8484
- // place your code here
8485
- }`,
8387
+ content: "({app, params, flowState}) => {\n // place your code here\n}",
8486
8388
  params: []
8487
8389
  };
8488
8390
  codeId.value = await codeBlockService.getUniqueId();
@@ -8565,9 +8467,7 @@
8565
8467
  }
8566
8468
  });
8567
8469
  const canUsePluginMethods$3 = {
8568
- async: ["zoom", "calcZoom"],
8569
- sync: []
8570
- };
8470
+ async: ["zoom", "calcZoom"]};
8571
8471
  class Ui extends BaseService {
8572
8472
  constructor() {
8573
8473
  super(canUsePluginMethods$3.async.map((methodName) => ({ name: methodName, isAsync: true })));
@@ -9056,6 +8956,7 @@
9056
8956
  try {
9057
8957
  return JSON.stringify(row.defaultValue);
9058
8958
  } catch (e) {
8959
+ error(e);
9059
8960
  return row.defaultValue;
9060
8961
  }
9061
8962
  }
@@ -9104,9 +9005,9 @@
9104
9005
  { text: "null", value: "null" },
9105
9006
  { text: "any", value: "any" }
9106
9007
  ],
9107
- onChange: (formState, v, { model }) => {
9008
+ onChange: (_formState, v, { setModel }) => {
9108
9009
  if (!["any", "array", "object"].includes(v)) {
9109
- model.fields = [];
9010
+ setModel("fields", []);
9110
9011
  }
9111
9012
  return v;
9112
9013
  }
@@ -9975,7 +9876,7 @@
9975
9876
  "visible": { type: Boolean, ...{ default: false } },
9976
9877
  "visibleModifiers": {}
9977
9878
  }),
9978
- emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:width", "update:visible"]),
9879
+ emits: /* @__PURE__ */ vue.mergeModels(["submit", "close", "open"], ["update:width", "update:visible"]),
9979
9880
  setup(__props, { expose: __expose, emit: __emit }) {
9980
9881
  const width = vue.useModel(__props, "width");
9981
9882
  const boxVisible = vue.useModel(__props, "visible");
@@ -10088,7 +9989,7 @@
10088
9989
  }
10089
9990
  ]);
10090
9991
  const submitForm = (values, data) => {
10091
- changedValue.value = undefined;
9992
+ changedValue.value = void 0;
10092
9993
  emit("submit", values, data);
10093
9994
  };
10094
9995
  const errorHandler = (error) => {
@@ -10117,10 +10018,19 @@
10117
10018
  });
10118
10019
  };
10119
10020
  const closedHandler = () => {
10120
- changedValue.value = undefined;
10021
+ changedValue.value = void 0;
10121
10022
  };
10122
10023
  const parentFloating = vue.inject("parentFloating", vue.ref(null));
10123
10024
  const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(uiService, parentFloating);
10025
+ vue.watch(boxVisible, (visible) => {
10026
+ vue.nextTick(() => {
10027
+ if (!visible) {
10028
+ emit("close");
10029
+ } else {
10030
+ emit("open");
10031
+ }
10032
+ });
10033
+ });
10124
10034
  __expose({
10125
10035
  async show() {
10126
10036
  calcBoxPosition();
@@ -10316,9 +10226,7 @@
10316
10226
  {
10317
10227
  text: "编辑",
10318
10228
  handler: (method, index) => {
10319
- let codeContent = method.content || `({ params, dataSource, app }) => {
10320
- // place your code here
10321
- }`;
10229
+ let codeContent = method.content || "({ params, dataSource, app }) => {\n // place your code here\n}";
10322
10230
  if (typeof codeContent !== "string") {
10323
10231
  codeContent = codeContent.toString();
10324
10232
  }
@@ -10347,9 +10255,7 @@
10347
10255
  const createCodeHandler = () => {
10348
10256
  codeConfig.value = {
10349
10257
  name: "",
10350
- content: `({ params, dataSource, app, flowState }) => {
10351
- // place your code here
10352
- }`,
10258
+ content: "({ params, dataSource, app, flowState }) => {\n // place your code here\n}",
10353
10259
  params: []
10354
10260
  };
10355
10261
  editIndex = -1;
@@ -10385,7 +10291,7 @@
10385
10291
  });
10386
10292
  }
10387
10293
  editIndex = -1;
10388
- codeConfig.value = undefined;
10294
+ codeConfig.value = void 0;
10389
10295
  codeBlockEditorRef.value?.hide();
10390
10296
  };
10391
10297
  return (_ctx, _cache) => {
@@ -10468,12 +10374,12 @@
10468
10374
  }));
10469
10375
  };
10470
10376
  const paramsConfig = vue.ref(getParamItemsConfig(props.model[props.name || "dataSourceMethod"]));
10471
- const setParamsConfig = (dataSourceMethod, formState = {}) => {
10377
+ const setParamsConfig = (dataSourceMethod, formState = {}, setModel) => {
10472
10378
  paramsConfig.value = dataSourceMethod ? getParamItemsConfig(dataSourceMethod) : [];
10473
10379
  if (paramsConfig.value.length) {
10474
- props.model.params = formPlugin.createValues(formState, paramsConfig.value, {}, props.model.params);
10380
+ setModel("params", formPlugin.createValues(formState, paramsConfig.value, {}, props.model.params));
10475
10381
  } else {
10476
- props.model.params = {};
10382
+ setModel("params", {});
10477
10383
  }
10478
10384
  };
10479
10385
  const methodsOptions = vue.computed(
@@ -10494,8 +10400,8 @@
10494
10400
  name: props.name,
10495
10401
  options: methodsOptions.value,
10496
10402
  disable: props.disabled,
10497
- onChange: (formState, dataSourceMethod) => {
10498
- setParamsConfig(dataSourceMethod, formState);
10403
+ onChange: (formState, dataSourceMethod, { setModel }) => {
10404
+ setParamsConfig(dataSourceMethod, formState, setModel);
10499
10405
  return dataSourceMethod;
10500
10406
  }
10501
10407
  }));
@@ -11163,8 +11069,8 @@
11163
11069
  text: "联动组件",
11164
11070
  type: "ui-select",
11165
11071
  display: (mForm, { model }) => model.actionType === core.ActionType.COMP,
11166
- onChange: (MForm, v, { model }) => {
11167
- model.method = "";
11072
+ onChange: (MForm, v, { setModel }) => {
11073
+ setModel("method", "");
11168
11074
  return v;
11169
11075
  }
11170
11076
  };
@@ -11737,7 +11643,7 @@
11737
11643
  return target;
11738
11644
  };
11739
11645
 
11740
- const _sfc_main$13 = {};
11646
+ const _sfc_main$13 = { };
11741
11647
 
11742
11648
  const _hoisted_1$J = {
11743
11649
  xmlns: "http://www.w3.org/2000/svg",
@@ -11751,7 +11657,7 @@
11751
11657
  }
11752
11658
  const BackgroundRepeat = /*#__PURE__*/_export_sfc(_sfc_main$13, [['render',_sfc_render$k]]);
11753
11659
 
11754
- const _sfc_main$12 = {};
11660
+ const _sfc_main$12 = { };
11755
11661
 
11756
11662
  const _hoisted_1$I = {
11757
11663
  xmlns: "http://www.w3.org/2000/svg",
@@ -11768,7 +11674,7 @@
11768
11674
  }
11769
11675
  const BackgroundRepeatX = /*#__PURE__*/_export_sfc(_sfc_main$12, [['render',_sfc_render$j]]);
11770
11676
 
11771
- const _sfc_main$11 = {};
11677
+ const _sfc_main$11 = { };
11772
11678
 
11773
11679
  const _hoisted_1$H = {
11774
11680
  xmlns: "http://www.w3.org/2000/svg",
@@ -11785,7 +11691,7 @@
11785
11691
  }
11786
11692
  const BackgroundRepeatY = /*#__PURE__*/_export_sfc(_sfc_main$11, [['render',_sfc_render$i]]);
11787
11693
 
11788
- const _sfc_main$10 = {};
11694
+ const _sfc_main$10 = { };
11789
11695
 
11790
11696
  const _hoisted_1$G = {
11791
11697
  xmlns: "http://www.w3.org/2000/svg",
@@ -11877,7 +11783,7 @@
11877
11783
  }
11878
11784
  });
11879
11785
 
11880
- const _sfc_main$_ = {};
11786
+ const _sfc_main$_ = { };
11881
11787
 
11882
11788
  const _hoisted_1$F = {
11883
11789
  xmlns: "http://www.w3.org/2000/svg",
@@ -11891,7 +11797,7 @@
11891
11797
  }
11892
11798
  const AlignLeft = /*#__PURE__*/_export_sfc(_sfc_main$_, [['render',_sfc_render$g]]);
11893
11799
 
11894
- const _sfc_main$Z = {};
11800
+ const _sfc_main$Z = { };
11895
11801
 
11896
11802
  const _hoisted_1$E = {
11897
11803
  xmlns: "http://www.w3.org/2000/svg",
@@ -11905,7 +11811,7 @@
11905
11811
  }
11906
11812
  const AlignCenter = /*#__PURE__*/_export_sfc(_sfc_main$Z, [['render',_sfc_render$f]]);
11907
11813
 
11908
- const _sfc_main$Y = {};
11814
+ const _sfc_main$Y = { };
11909
11815
 
11910
11816
  const _hoisted_1$D = {
11911
11817
  xmlns: "http://www.w3.org/2000/svg",
@@ -12102,7 +12008,7 @@
12102
12008
  }
12103
12009
  });
12104
12010
 
12105
- const _sfc_main$V = {};
12011
+ const _sfc_main$V = { };
12106
12012
 
12107
12013
  const _hoisted_1$B = {
12108
12014
  xmlns: "http://www.w3.org/2000/svg",
@@ -12116,7 +12022,7 @@
12116
12022
  }
12117
12023
  const DisplayBlock = /*#__PURE__*/_export_sfc(_sfc_main$V, [['render',_sfc_render$d]]);
12118
12024
 
12119
- const _sfc_main$U = {};
12025
+ const _sfc_main$U = { };
12120
12026
 
12121
12027
  const _hoisted_1$A = {
12122
12028
  xmlns: "http://www.w3.org/2000/svg",
@@ -12130,7 +12036,7 @@
12130
12036
  }
12131
12037
  const DisplayFlex = /*#__PURE__*/_export_sfc(_sfc_main$U, [['render',_sfc_render$c]]);
12132
12038
 
12133
- const _sfc_main$T = {};
12039
+ const _sfc_main$T = { };
12134
12040
 
12135
12041
  const _hoisted_1$z = {
12136
12042
  xmlns: "http://www.w3.org/2000/svg",
@@ -12144,7 +12050,7 @@
12144
12050
  }
12145
12051
  const DisplayInline = /*#__PURE__*/_export_sfc(_sfc_main$T, [['render',_sfc_render$b]]);
12146
12052
 
12147
- const _sfc_main$S = {};
12053
+ const _sfc_main$S = { };
12148
12054
 
12149
12055
  const _hoisted_1$y = {
12150
12056
  xmlns: "http://www.w3.org/2000/svg",
@@ -12158,7 +12064,7 @@
12158
12064
  }
12159
12065
  const DisplayInlineBlock = /*#__PURE__*/_export_sfc(_sfc_main$S, [['render',_sfc_render$a]]);
12160
12066
 
12161
- const _sfc_main$R = {};
12067
+ const _sfc_main$R = { };
12162
12068
 
12163
12069
  const _hoisted_1$x = {
12164
12070
  xmlns: "http://www.w3.org/2000/svg",
@@ -12172,7 +12078,7 @@
12172
12078
  }
12173
12079
  const DisplayNone = /*#__PURE__*/_export_sfc(_sfc_main$R, [['render',_sfc_render$9]]);
12174
12080
 
12175
- const _sfc_main$Q = {};
12081
+ const _sfc_main$Q = { };
12176
12082
 
12177
12083
  const _hoisted_1$w = {
12178
12084
  xmlns: "http://www.w3.org/2000/svg",
@@ -12186,7 +12092,7 @@
12186
12092
  }
12187
12093
  const FlexDirectionColumn = /*#__PURE__*/_export_sfc(_sfc_main$Q, [['render',_sfc_render$8]]);
12188
12094
 
12189
- const _sfc_main$P = {};
12095
+ const _sfc_main$P = { };
12190
12096
 
12191
12097
  const _hoisted_1$v = {
12192
12098
  xmlns: "http://www.w3.org/2000/svg",
@@ -12200,7 +12106,7 @@
12200
12106
  }
12201
12107
  const FlexDirectionColumnReverse = /*#__PURE__*/_export_sfc(_sfc_main$P, [['render',_sfc_render$7]]);
12202
12108
 
12203
- const _sfc_main$O = {};
12109
+ const _sfc_main$O = { };
12204
12110
 
12205
12111
  const _hoisted_1$u = {
12206
12112
  xmlns: "http://www.w3.org/2000/svg",
@@ -12214,7 +12120,7 @@
12214
12120
  }
12215
12121
  const FlexDirectionRow = /*#__PURE__*/_export_sfc(_sfc_main$O, [['render',_sfc_render$6]]);
12216
12122
 
12217
- const _sfc_main$N = {};
12123
+ const _sfc_main$N = { };
12218
12124
 
12219
12125
  const _hoisted_1$t = {
12220
12126
  xmlns: "http://www.w3.org/2000/svg",
@@ -12228,7 +12134,7 @@
12228
12134
  }
12229
12135
  const FlexDirectionRowReverse = /*#__PURE__*/_export_sfc(_sfc_main$N, [['render',_sfc_render$5]]);
12230
12136
 
12231
- const _sfc_main$M = {};
12137
+ const _sfc_main$M = { };
12232
12138
 
12233
12139
  const _hoisted_1$s = {
12234
12140
  xmlns: "http://www.w3.org/2000/svg",
@@ -12242,7 +12148,7 @@
12242
12148
  }
12243
12149
  const JustifyContentCenter = /*#__PURE__*/_export_sfc(_sfc_main$M, [['render',_sfc_render$4]]);
12244
12150
 
12245
- const _sfc_main$L = {};
12151
+ const _sfc_main$L = { };
12246
12152
 
12247
12153
  const _hoisted_1$r = {
12248
12154
  xmlns: "http://www.w3.org/2000/svg",
@@ -12256,7 +12162,7 @@
12256
12162
  }
12257
12163
  const JustifyContentFlexEnd = /*#__PURE__*/_export_sfc(_sfc_main$L, [['render',_sfc_render$3]]);
12258
12164
 
12259
- const _sfc_main$K = {};
12165
+ const _sfc_main$K = { };
12260
12166
 
12261
12167
  const _hoisted_1$q = {
12262
12168
  xmlns: "http://www.w3.org/2000/svg",
@@ -12270,7 +12176,7 @@
12270
12176
  }
12271
12177
  const JustifyContentFlexStart = /*#__PURE__*/_export_sfc(_sfc_main$K, [['render',_sfc_render$2]]);
12272
12178
 
12273
- const _sfc_main$J = {};
12179
+ const _sfc_main$J = { };
12274
12180
 
12275
12181
  const _hoisted_1$p = {
12276
12182
  xmlns: "http://www.w3.org/2000/svg",
@@ -12284,7 +12190,7 @@
12284
12190
  }
12285
12191
  const JustifyContentSpaceAround = /*#__PURE__*/_export_sfc(_sfc_main$J, [['render',_sfc_render$1]]);
12286
12192
 
12287
- const _sfc_main$I = {};
12193
+ const _sfc_main$I = { };
12288
12194
 
12289
12195
  const _hoisted_1$o = {
12290
12196
  xmlns: "http://www.w3.org/2000/svg",
@@ -12882,7 +12788,7 @@
12882
12788
  emit("change", id);
12883
12789
  mForm?.$emit("field-change", props.prop, id);
12884
12790
  }
12885
- {
12791
+ if (cancelHandler) {
12886
12792
  cancelHandler();
12887
12793
  }
12888
12794
  };
@@ -14198,7 +14104,7 @@
14198
14104
  vue.renderSlot(_ctx.$slots, "props-panel")
14199
14105
  ]),
14200
14106
  key: "0"
14201
- } : undefined
14107
+ } : void 0
14202
14108
  ]), 1032, ["left", "right", "min-left", "min-right", "min-center", "width"])),
14203
14109
  vue.renderSlot(_ctx.$slots, "content-after"),
14204
14110
  vue.renderSlot(_ctx.$slots, "footer")
@@ -14255,7 +14161,7 @@
14255
14161
  type: "button",
14256
14162
  className: "delete",
14257
14163
  icon: vue.markRaw(iconsVue.Delete),
14258
- tooltip: `刪除(Delete)`,
14164
+ tooltip: "刪除(Delete)",
14259
14165
  disabled: () => editorService.get("node")?.type === core.NodeType.PAGE,
14260
14166
  handler: () => {
14261
14167
  const node = editorService.get("node");
@@ -15320,6 +15226,7 @@
15320
15226
  emit("node-contextmenu", event, data);
15321
15227
  };
15322
15228
  __expose({
15229
+ nodeStatusMap,
15323
15230
  filter: filterTextChangeHandler,
15324
15231
  deleteCode
15325
15232
  });
@@ -15481,7 +15388,7 @@
15481
15388
  const eventBus = vue.inject("eventBus");
15482
15389
  const { codeBlockService } = useServices();
15483
15390
  const editable = vue.computed(() => codeBlockService.getEditStatus());
15484
- const { codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
15391
+ const { codeId, codeBlockEditor, codeConfig, editCode, deleteCode, createCodeBlock, submitCodeBlockHandler } = useCodeBlockEdit(codeBlockService);
15485
15392
  const codeBlockListRef = vue.useTemplateRef("codeBlockList");
15486
15393
  const filterTextChangeHandler = (val) => {
15487
15394
  codeBlockListRef.value?.filter(val);
@@ -15489,6 +15396,20 @@
15489
15396
  eventBus?.on("edit-code", (id) => {
15490
15397
  editCode(id);
15491
15398
  });
15399
+ vue.watch(codeId, () => {
15400
+ if (codeBlockListRef.value) {
15401
+ for (const [statusId, status] of codeBlockListRef.value.nodeStatusMap.entries()) {
15402
+ status.selected = statusId === codeId.value;
15403
+ }
15404
+ }
15405
+ });
15406
+ const editDialogCloseHandler = () => {
15407
+ if (codeBlockListRef.value) {
15408
+ for (const [, status] of codeBlockListRef.value.nodeStatusMap.entries()) {
15409
+ status.selected = false;
15410
+ }
15411
+ }
15412
+ };
15492
15413
  const {
15493
15414
  nodeContentMenuHandler,
15494
15415
  menuData: contentMenuData,
@@ -15552,7 +15473,8 @@
15552
15473
  ref: codeBlockEditor,
15553
15474
  disabled: !editable.value,
15554
15475
  content: vue.unref(codeConfig),
15555
- onSubmit: vue.unref(submitCodeBlockHandler)
15476
+ onSubmit: vue.unref(submitCodeBlockHandler),
15477
+ onClose: editDialogCloseHandler
15556
15478
  }, null, 8, ["disabled", "content", "onSubmit"])) : vue.createCommentVNode("v-if", true),
15557
15479
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
15558
15480
  menuData.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
@@ -15617,7 +15539,7 @@
15617
15539
  "width": { default: 670 },
15618
15540
  "widthModifiers": {}
15619
15541
  }),
15620
- emits: /* @__PURE__ */ vue.mergeModels(["submit"], ["update:visible", "update:width"]),
15542
+ emits: /* @__PURE__ */ vue.mergeModels(["submit", "close", "open"], ["update:visible", "update:width"]),
15621
15543
  setup(__props, { expose: __expose, emit: __emit }) {
15622
15544
  const props = __props;
15623
15545
  const boxVisible = vue.useModel(__props, "visible");
@@ -15639,6 +15561,15 @@
15639
15561
  const errorHandler = (error) => {
15640
15562
  designPlugin.tMagicMessage.error(error.message);
15641
15563
  };
15564
+ vue.watch(boxVisible, (visible) => {
15565
+ vue.nextTick(() => {
15566
+ if (!visible) {
15567
+ emit("close");
15568
+ } else if (initValues.value?.id) {
15569
+ emit("open", initValues.value.id);
15570
+ }
15571
+ });
15572
+ });
15642
15573
  __expose({
15643
15574
  show() {
15644
15575
  calcBoxPosition();
@@ -15774,6 +15705,7 @@
15774
15705
  emit("node-contextmenu", event, data);
15775
15706
  };
15776
15707
  __expose({
15708
+ nodeStatusMap,
15777
15709
  filter: filterTextChangeHandler
15778
15710
  });
15779
15711
  return (_ctx, _cache) => {
@@ -15929,6 +15861,20 @@
15929
15861
  const eventBus = vue.inject("eventBus");
15930
15862
  const { dataSourceService } = useServices();
15931
15863
  const { editDialog, dataSourceValues, dialogTitle, editable, editHandler, submitDataSourceHandler } = useDataSourceEdit(dataSourceService);
15864
+ const editDialogCloseHandler = () => {
15865
+ if (dataSourceListRef.value) {
15866
+ for (const [, status] of dataSourceListRef.value.nodeStatusMap.entries()) {
15867
+ status.selected = false;
15868
+ }
15869
+ }
15870
+ };
15871
+ vue.watch(dataSourceValues, (dataSourceValues2) => {
15872
+ if (dataSourceListRef.value && dataSourceValues2.id) {
15873
+ for (const [statusId, status] of dataSourceListRef.value.nodeStatusMap.entries()) {
15874
+ status.selected = statusId === dataSourceValues2.id;
15875
+ }
15876
+ }
15877
+ });
15932
15878
  const datasourceTypeList = vue.computed(
15933
15879
  () => [
15934
15880
  { text: "基础", type: "base" },
@@ -15958,9 +15904,9 @@
15958
15904
  });
15959
15905
  dataSourceService.remove(id);
15960
15906
  };
15961
- const dataSourceList = vue.ref();
15907
+ const dataSourceListRef = vue.useTemplateRef("dataSourceList");
15962
15908
  const filterTextChangeHandler = (val) => {
15963
- dataSourceList.value?.filter(val);
15909
+ dataSourceListRef.value?.filter(val);
15964
15910
  };
15965
15911
  eventBus?.on("edit-data-source", (id) => {
15966
15912
  editHandler(id);
@@ -16027,8 +15973,7 @@
16027
15973
  ]),
16028
15974
  vue.createCommentVNode(" 数据源列表 "),
16029
15975
  vue.createVNode(_sfc_main$h, {
16030
- ref_key: "dataSourceList",
16031
- ref: dataSourceList,
15976
+ ref: "dataSourceList",
16032
15977
  indent: _ctx.indent,
16033
15978
  "next-level-indent-increment": _ctx.nextLevelIndentIncrement,
16034
15979
  onEdit: vue.unref(editHandler),
@@ -16045,7 +15990,8 @@
16045
15990
  disabled: !vue.unref(editable),
16046
15991
  values: vue.unref(dataSourceValues),
16047
15992
  title: vue.unref(dialogTitle),
16048
- onSubmit: vue.unref(submitDataSourceHandler)
15993
+ onSubmit: vue.unref(submitDataSourceHandler),
15994
+ onClose: editDialogCloseHandler
16049
15995
  }, null, 8, ["disabled", "values", "title", "onSubmit"]),
16050
15996
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
16051
15997
  menuData.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
@@ -16932,7 +16878,7 @@
16932
16878
  const dragendHandler = () => {
16933
16879
  if (timeout) {
16934
16880
  globalThis.clearTimeout(timeout);
16935
- timeout = undefined;
16881
+ timeout = void 0;
16936
16882
  }
16937
16883
  const doc = stage.value?.renderer?.getDocument();
16938
16884
  if (doc && stageOptions?.containerHighlightClassName) {
@@ -16947,7 +16893,7 @@
16947
16893
  clientY = e.clientY;
16948
16894
  if (timeout) {
16949
16895
  globalThis.clearTimeout(timeout);
16950
- timeout = undefined;
16896
+ timeout = void 0;
16951
16897
  }
16952
16898
  return;
16953
16899
  }
@@ -17271,14 +17217,14 @@
17271
17217
  }) : config.slots?.componentList ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentList), { key: 1 })) : vue.createCommentVNode("v-if", true)
17272
17218
  ]),
17273
17219
  key: "0"
17274
- } : undefined,
17220
+ } : void 0,
17275
17221
  config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
17276
17222
  name: "component-list-panel-header",
17277
17223
  fn: vue.withCtx(() => [
17278
17224
  config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("v-if", true)
17279
17225
  ]),
17280
17226
  key: "1"
17281
- } : undefined,
17227
+ } : void 0,
17282
17228
  config.$key === "component-list" || config.slots?.componentListItem ? {
17283
17229
  name: "component-list-item",
17284
17230
  fn: vue.withCtx(({ component }) => [
@@ -17291,21 +17237,21 @@
17291
17237
  }, null, 8, ["component"])) : vue.createCommentVNode("v-if", true)
17292
17238
  ]),
17293
17239
  key: "2"
17294
- } : undefined,
17240
+ } : void 0,
17295
17241
  config.$key === "layer" || config.slots?.layerPanelHeader ? {
17296
17242
  name: "layer-panel-header",
17297
17243
  fn: vue.withCtx(() => [
17298
17244
  config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("v-if", true)
17299
17245
  ]),
17300
17246
  key: "3"
17301
- } : undefined,
17247
+ } : void 0,
17302
17248
  config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
17303
17249
  name: "code-block-panel-header",
17304
17250
  fn: vue.withCtx(() => [
17305
17251
  config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("v-if", true)
17306
17252
  ]),
17307
17253
  key: "4"
17308
- } : undefined,
17254
+ } : void 0,
17309
17255
  config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
17310
17256
  name: "code-block-panel-tool",
17311
17257
  fn: vue.withCtx(({ id, data }) => [
@@ -17316,14 +17262,14 @@
17316
17262
  }) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("v-if", true)
17317
17263
  ]),
17318
17264
  key: "5"
17319
- } : undefined,
17265
+ } : void 0,
17320
17266
  config.$key === "code-block" || config.slots?.codeBlockPanelSearch ? {
17321
17267
  name: "code-block-panel-search",
17322
17268
  fn: vue.withCtx(() => [
17323
17269
  config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-search", { key: 0 }) : config.slots?.codeBlockPanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelSearch), { key: 1 })) : vue.createCommentVNode("v-if", true)
17324
17270
  ]),
17325
17271
  key: "6"
17326
- } : undefined,
17272
+ } : void 0,
17327
17273
  config.$key === "layer" || config.slots?.layerNodeContent ? {
17328
17274
  name: "layer-node-content",
17329
17275
  fn: vue.withCtx(({ data: nodeData }) => [
@@ -17336,7 +17282,7 @@
17336
17282
  }, null, 8, ["data"])) : vue.createCommentVNode("v-if", true)
17337
17283
  ]),
17338
17284
  key: "7"
17339
- } : undefined,
17285
+ } : void 0,
17340
17286
  config.$key === "layer" || config.slots?.layerNodeLabel ? {
17341
17287
  name: "layer-node-label",
17342
17288
  fn: vue.withCtx(({ data: nodeData }) => [
@@ -17349,7 +17295,7 @@
17349
17295
  }, null, 8, ["data"])) : vue.createCommentVNode("v-if", true)
17350
17296
  ]),
17351
17297
  key: "8"
17352
- } : undefined,
17298
+ } : void 0,
17353
17299
  config.$key === "layer" || config.slots?.layerNodeTool ? {
17354
17300
  name: "layer-node-tool",
17355
17301
  fn: vue.withCtx(({ data: nodeData }) => [
@@ -17362,7 +17308,7 @@
17362
17308
  }, null, 8, ["data"])) : vue.createCommentVNode("v-if", true)
17363
17309
  ]),
17364
17310
  key: "9"
17365
- } : undefined,
17311
+ } : void 0,
17366
17312
  config.$key === "data-source" || config.slots?.dataSourcePanelTool ? {
17367
17313
  name: "data-source-panel-tool",
17368
17314
  fn: vue.withCtx(({ data }) => [
@@ -17372,14 +17318,14 @@
17372
17318
  }) : config.slots?.DataSourcePanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : vue.createCommentVNode("v-if", true)
17373
17319
  ]),
17374
17320
  key: "10"
17375
- } : undefined,
17321
+ } : void 0,
17376
17322
  config.$key === "data-source" || config.slots?.dataSourcePanelSearch ? {
17377
17323
  name: "data-source-panel-search",
17378
17324
  fn: vue.withCtx(() => [
17379
17325
  config.$key === "data-source" ? vue.renderSlot(_ctx.$slots, "data-source-panel-search", { key: 0 }) : config.slots?.dataSourcePanelSearch ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.dataSourcePanelSearch), { key: 1 })) : vue.createCommentVNode("v-if", true)
17380
17326
  ]),
17381
17327
  key: "11"
17382
- } : undefined
17328
+ } : void 0
17383
17329
  ]),
17384
17330
  1040
17385
17331
  /* FULL_PROPS, DYNAMIC_SLOTS */
@@ -18374,7 +18320,7 @@
18374
18320
  editable: true,
18375
18321
  combineIds: [],
18376
18322
  undeletableList: [],
18377
- paramsColConfig: undefined
18323
+ paramsColConfig: void 0
18378
18324
  });
18379
18325
  constructor() {
18380
18326
  super([
@@ -18638,7 +18584,6 @@
18638
18584
  const componentListService = new ComponentList();
18639
18585
 
18640
18586
  const canUsePluginMethods$1 = {
18641
- async: [],
18642
18587
  sync: [
18643
18588
  "getFormConfig",
18644
18589
  "setFormConfig",
@@ -19160,7 +19105,6 @@
19160
19105
  const keybindingService = new Keybinding();
19161
19106
 
19162
19107
  const canUsePluginMethods = {
19163
- async: [],
19164
19108
  sync: ["openOverlay", "closeOverlay", "updateOverlay", "createStage"]
19165
19109
  };
19166
19110
  class StageOverlay extends BaseService {
@@ -19500,14 +19444,14 @@
19500
19444
  const getTMagicApp = () => {
19501
19445
  const renderer = editorService.get("stage")?.renderer;
19502
19446
  if (!renderer) {
19503
- return undefined;
19447
+ return void 0;
19504
19448
  }
19505
19449
  if (renderer.runtime) {
19506
19450
  return renderer.runtime.getApp?.();
19507
19451
  }
19508
19452
  return new Promise((resolve) => {
19509
19453
  const timeout = globalThis.setTimeout(() => {
19510
- resolve(undefined);
19454
+ resolve(void 0);
19511
19455
  }, 1e4);
19512
19456
  renderer.on("runtime-ready", () => {
19513
19457
  if (timeout) {
@@ -19541,12 +19485,13 @@
19541
19485
  app.dsl.dataSources = root.dataSources;
19542
19486
  }
19543
19487
  };
19544
- const dsDepCollectedHandler = async () => {
19488
+ const dsDepCollectedHandler = () => {
19545
19489
  const root = editorService.get("root");
19546
- const app = await getTMagicApp();
19547
- if (root && app?.dsl) {
19548
- app.dsl.dataSourceDeps = root.dataSourceDeps;
19549
- }
19490
+ getTMagicApp()?.then((app) => {
19491
+ if (root && app?.dsl) {
19492
+ app.dsl.dataSourceDeps = root.dataSourceDeps;
19493
+ }
19494
+ });
19550
19495
  };
19551
19496
  const collectIdle = (nodes, deep, type) => Promise.all(
19552
19497
  nodes.map((node) => {
@@ -19579,7 +19524,7 @@
19579
19524
  depService.addTarget(core.createDataSourceMethodTarget(ds, vue.reactive({})));
19580
19525
  depService.addTarget(core.createDataSourceCondTarget(ds, vue.reactive({})));
19581
19526
  };
19582
- const rootChangeHandler = async (value, preValue) => {
19527
+ const rootChangeHandler = (value, preValue) => {
19583
19528
  if (!value) return;
19584
19529
  value.codeBlocks = value.codeBlocks || {};
19585
19530
  value.dataSources = value.dataSources || [];
@@ -19602,29 +19547,33 @@
19602
19547
  delete value.dataSourceDeps;
19603
19548
  delete value.dataSourceCondDeps;
19604
19549
  }
19605
- const nodeId = editorService.get("node")?.id || props.defaultSelected;
19606
- let node;
19607
- if (nodeId) {
19608
- node = editorService.getNodeById(nodeId);
19609
- }
19610
- if (node && node !== value) {
19611
- await editorService.select(node.id);
19612
- } else if (value.items?.length) {
19613
- await editorService.select(value.items[0]);
19614
- } else if (value.id) {
19615
- editorService.set("nodes", [value]);
19616
- editorService.set("parent", null);
19617
- editorService.set("page", null);
19618
- }
19619
- if (vue.toRaw(value) !== vue.toRaw(preValue)) {
19620
- emit("update:modelValue", value);
19621
- }
19550
+ const handler = async () => {
19551
+ const nodeId = editorService.get("node")?.id || props.defaultSelected;
19552
+ let node;
19553
+ if (nodeId) {
19554
+ node = editorService.getNodeById(nodeId);
19555
+ }
19556
+ if (node && node !== value) {
19557
+ await editorService.select(node.id);
19558
+ } else if (value.items?.length) {
19559
+ await editorService.select(value.items[0]);
19560
+ } else if (value.id) {
19561
+ editorService.set("nodes", [value]);
19562
+ editorService.set("parent", null);
19563
+ editorService.set("page", null);
19564
+ }
19565
+ if (vue.toRaw(value) !== vue.toRaw(preValue)) {
19566
+ emit("update:modelValue", value);
19567
+ }
19568
+ };
19569
+ handler();
19622
19570
  };
19623
- const nodeAddHandler = async (nodes) => {
19624
- await collectIdle(nodes, true);
19625
- updateStageNodes(nodes);
19571
+ const nodeAddHandler = (nodes) => {
19572
+ collectIdle(nodes, true).then(() => {
19573
+ updateStageNodes(nodes);
19574
+ });
19626
19575
  };
19627
- const nodeUpdateHandler = async (data) => {
19576
+ const nodeUpdateHandler = (data) => {
19628
19577
  const needRecollectNodes = [];
19629
19578
  const normalNodes = [];
19630
19579
  for (const { newNode, oldNode, changeRecords } of data) {
@@ -19656,9 +19605,12 @@
19656
19605
  }
19657
19606
  }
19658
19607
  if (needRecollectNodes.length) {
19659
- await collectIdle(needRecollectNodes, true, core.DepTargetType.DATA_SOURCE);
19660
- await collectIdle(needRecollectNodes, true, core.DepTargetType.DATA_SOURCE_COND);
19661
- updateStageNodes(needRecollectNodes);
19608
+ const handler = async () => {
19609
+ await collectIdle(needRecollectNodes, true, core.DepTargetType.DATA_SOURCE);
19610
+ await collectIdle(needRecollectNodes, true, core.DepTargetType.DATA_SOURCE_COND);
19611
+ updateStageNodes(needRecollectNodes);
19612
+ };
19613
+ handler();
19662
19614
  } else {
19663
19615
  updateStageNodes(normalNodes);
19664
19616
  Promise.all([
@@ -19670,28 +19622,32 @@
19670
19622
  const nodeRemoveHandler = (nodes) => {
19671
19623
  depService.clear(nodes);
19672
19624
  };
19673
- const historyChangeHandler = async (page) => {
19674
- await collectIdle([page], true);
19675
- updateStageNode(page);
19625
+ const historyChangeHandler = (page) => {
19626
+ collectIdle([page], true).then(() => {
19627
+ updateStageNode(page);
19628
+ });
19676
19629
  };
19677
19630
  editorService.on("history-change", historyChangeHandler);
19678
19631
  editorService.on("root-change", rootChangeHandler);
19679
19632
  editorService.on("add", nodeAddHandler);
19680
19633
  editorService.on("remove", nodeRemoveHandler);
19681
19634
  editorService.on("update", nodeUpdateHandler);
19682
- const dataSourceAddHandler = async (config) => {
19683
- initDataSourceDepTarget(config);
19684
- const app = await getTMagicApp();
19685
- if (!app?.dataSourceManager) {
19686
- return;
19687
- }
19688
- app.dataSourceManager.addDataSource(config);
19689
- const newDs = app.dataSourceManager.get(config.id);
19690
- if (newDs) {
19691
- app.dataSourceManager.init(newDs);
19692
- }
19635
+ const dataSourceAddHandler = (config) => {
19636
+ const handler = async () => {
19637
+ initDataSourceDepTarget(config);
19638
+ const app = await getTMagicApp();
19639
+ if (!app?.dataSourceManager) {
19640
+ return;
19641
+ }
19642
+ app.dataSourceManager.addDataSource(config);
19643
+ const newDs = app.dataSourceManager.get(config.id);
19644
+ if (newDs) {
19645
+ app.dataSourceManager.init(newDs);
19646
+ }
19647
+ };
19648
+ handler();
19693
19649
  };
19694
- const dataSourceUpdateHandler = async (config, { changeRecords }) => {
19650
+ const dataSourceUpdateHandler = (config, { changeRecords }) => {
19695
19651
  const updateDsData = async () => {
19696
19652
  const app = await getTMagicApp();
19697
19653
  if (!app?.dataSourceManager) {
@@ -19752,23 +19708,26 @@
19752
19708
  depService.removeTarget(id, core.DepTargetType.DATA_SOURCE_COND);
19753
19709
  depService.removeTarget(id, core.DepTargetType.DATA_SOURCE_METHOD);
19754
19710
  };
19755
- const dataSourceRemoveHandler = async (id) => {
19711
+ const dataSourceRemoveHandler = (id) => {
19756
19712
  const root = editorService.get("root");
19757
19713
  if (!root) {
19758
19714
  return;
19759
19715
  }
19760
- const nodeIds = Object.keys(root.dataSourceDeps?.[id] || {});
19761
- const nodes = utils.getNodes(nodeIds, root.items);
19762
- await Promise.all([
19763
- collectIdle(nodes, false, core.DepTargetType.DATA_SOURCE),
19764
- collectIdle(nodes, false, core.DepTargetType.DATA_SOURCE_COND),
19765
- collectIdle(nodes, false, core.DepTargetType.DATA_SOURCE_METHOD)
19766
- ]);
19767
- updateDataSourceSchema();
19768
- const app = await getTMagicApp();
19769
- app?.dataSourceManager?.removeDataSource(id);
19770
- updateStageNodes(nodes);
19771
- removeDataSourceTarget(id);
19716
+ const handler = async () => {
19717
+ const nodeIds = Object.keys(root.dataSourceDeps?.[id] || {});
19718
+ const nodes = utils.getNodes(nodeIds, root.items);
19719
+ await Promise.all([
19720
+ collectIdle(nodes, false, core.DepTargetType.DATA_SOURCE),
19721
+ collectIdle(nodes, false, core.DepTargetType.DATA_SOURCE_COND),
19722
+ collectIdle(nodes, false, core.DepTargetType.DATA_SOURCE_METHOD)
19723
+ ]);
19724
+ updateDataSourceSchema();
19725
+ const app = await getTMagicApp();
19726
+ app?.dataSourceManager?.removeDataSource(id);
19727
+ updateStageNodes(nodes);
19728
+ removeDataSourceTarget(id);
19729
+ };
19730
+ handler();
19772
19731
  };
19773
19732
  dataSourceService.on("add", dataSourceAddHandler);
19774
19733
  dataSourceService.on("update", dataSourceUpdateHandler);