@tmagic/editor 1.5.0-beta.10 → 1.5.0-beta.12

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.
@@ -23,7 +23,7 @@
23
23
 
24
24
  const monaco__namespace = /*#__PURE__*/_interopNamespaceDefault(monaco);
25
25
 
26
- const _hoisted_1$w = ["src"];
26
+ const _hoisted_1$x = ["src"];
27
27
  const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
28
28
  ...{
29
29
  name: "MEditorIcon"
@@ -48,7 +48,7 @@
48
48
  class: "magic-editor-icon"
49
49
  }, {
50
50
  default: vue.withCtx(() => [
51
- vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$w)
51
+ vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$x)
52
52
  ]),
53
53
  _: 1
54
54
  })) : typeof _ctx.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
@@ -76,7 +76,7 @@
76
76
  emmetMonacoEs.emmetHTML(monaco__namespace);
77
77
  emmetMonacoEs.emmetCSS(monaco__namespace, ["css", "scss"]);
78
78
 
79
- const _hoisted_1$v = {
79
+ const _hoisted_1$w = {
80
80
  class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
81
81
  };
82
82
  const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
@@ -236,7 +236,7 @@
236
236
  }
237
237
  });
238
238
  return (_ctx, _cache) => {
239
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$v, [
239
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$w, [
240
240
  (vue.openBlock(), vue.createBlock(vue.Teleport, {
241
241
  to: "body",
242
242
  disabled: !fullScreen.value
@@ -1865,28 +1865,7 @@
1865
1865
  if (raw) {
1866
1866
  root = vue.toRaw(root);
1867
1867
  }
1868
- const info = {
1869
- node: null,
1870
- parent: null,
1871
- page: null
1872
- };
1873
- if (!root) return info;
1874
- if (id === root.id) {
1875
- info.node = root;
1876
- return info;
1877
- }
1878
- const path = utils.getNodePath(id, root.items);
1879
- if (!path.length) return info;
1880
- path.unshift(root);
1881
- info.node = path[path.length - 1];
1882
- info.parent = path[path.length - 2];
1883
- path.forEach((item) => {
1884
- if (utils.isPage(item) || utils.isPageFragment(item)) {
1885
- info.page = item;
1886
- return;
1887
- }
1888
- });
1889
- return info;
1868
+ return utils.getNodeInfo(id, root);
1890
1869
  }
1891
1870
  /**
1892
1871
  * 根据ID获取指点节点配置
@@ -2107,10 +2086,10 @@
2107
2086
  const rootItems = root.items || [];
2108
2087
  if (utils.isPage(node)) {
2109
2088
  this.state.pageLength -= 1;
2110
- await selectDefault(getPageList(root));
2089
+ await selectDefault(rootItems);
2111
2090
  } else if (utils.isPageFragment(node)) {
2112
2091
  this.state.pageFragmentLength -= 1;
2113
- await selectDefault(getPageFragmentList(root));
2092
+ await selectDefault(rootItems);
2114
2093
  } else {
2115
2094
  await this.select(parent);
2116
2095
  stage?.select(parent.id);
@@ -2172,11 +2151,6 @@
2172
2151
  const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
2173
2152
  nodes.splice(targetIndex, 1, newConfig);
2174
2153
  this.set("nodes", [...nodes]);
2175
- this.get("stage")?.update({
2176
- config: lodashEs.cloneDeep(newConfig),
2177
- parentId: parent.id,
2178
- root: lodashEs.cloneDeep(root)
2179
- });
2180
2154
  if (utils.isPage(newConfig) || utils.isPageFragment(newConfig)) {
2181
2155
  this.set("page", newConfig);
2182
2156
  }
@@ -2398,7 +2372,11 @@
2398
2372
  target.items.push(newConfig);
2399
2373
  await stage.select(targetId);
2400
2374
  const targetParent = this.getParentById(target.id);
2401
- await stage.update({ config: lodashEs.cloneDeep(target), parentId: targetParent?.id, root: lodashEs.cloneDeep(root) });
2375
+ await stage.update({
2376
+ config: lodashEs.cloneDeep(target),
2377
+ parentId: targetParent?.id,
2378
+ root: lodashEs.cloneDeep(root)
2379
+ });
2402
2380
  await this.select(newConfig);
2403
2381
  stage.select(newConfig.id);
2404
2382
  this.addModifiedNodeId(target.id);
@@ -3016,12 +2994,12 @@
3016
2994
  return super.emit(eventName, ...args);
3017
2995
  }
3018
2996
  runTaskQueue(deadline) {
3019
- while ((deadline.timeRemaining() > 15 || deadline.didTimeout) && this.taskList.length) {
2997
+ while ((deadline.timeRemaining() > 10 || deadline.didTimeout) && this.taskList.length) {
3020
2998
  const task = this.taskList.shift();
3021
2999
  task.handler(task.data);
3022
3000
  }
3023
3001
  if (this.taskList.length) {
3024
- this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 1e4 });
3002
+ this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 300 });
3025
3003
  } else {
3026
3004
  this.taskHandle = 0;
3027
3005
  this.emit("finish");
@@ -3226,8 +3204,8 @@
3226
3204
  }
3227
3205
  });
3228
3206
 
3229
- const _hoisted_1$u = { class: "m-fields-code-select-col" };
3230
- const _hoisted_2$g = { class: "code-select-container" };
3207
+ const _hoisted_1$v = { class: "m-fields-code-select-col" };
3208
+ const _hoisted_2$h = { class: "code-select-container" };
3231
3209
  const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
3232
3210
  ...{
3233
3211
  name: "MFieldsCodeSelectCol"
@@ -3307,8 +3285,8 @@
3307
3285
  eventBus?.emit("edit-code", id);
3308
3286
  };
3309
3287
  return (_ctx, _cache) => {
3310
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$u, [
3311
- vue.createElementVNode("div", _hoisted_2$g, [
3288
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$v, [
3289
+ vue.createElementVNode("div", _hoisted_2$h, [
3312
3290
  vue.createVNode(vue.unref(formPlugin.MContainer), {
3313
3291
  class: "select",
3314
3292
  config: selectConfig,
@@ -4178,8 +4156,8 @@
4178
4156
  };
4179
4157
  };
4180
4158
 
4181
- const _hoisted_1$t = { class: "m-editor-data-source-fields" };
4182
- const _hoisted_2$f = { class: "m-editor-data-source-fields-footer" };
4159
+ const _hoisted_1$u = { class: "m-editor-data-source-fields" };
4160
+ const _hoisted_2$g = { class: "m-editor-data-source-fields-footer" };
4183
4161
  const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
4184
4162
  ...{
4185
4163
  name: "MFieldsDataSourceFields"
@@ -4431,12 +4409,12 @@
4431
4409
  const parentFloating = vue.inject("parentFloating", vue.ref(null));
4432
4410
  const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
4433
4411
  return (_ctx, _cache) => {
4434
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
4412
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$u, [
4435
4413
  vue.createVNode(vue.unref(tablePlugin.MagicTable), {
4436
4414
  data: _ctx.model[_ctx.name],
4437
4415
  columns: fieldColumns
4438
4416
  }, null, 8, ["data"]),
4439
- vue.createElementVNode("div", _hoisted_2$f, [
4417
+ vue.createElementVNode("div", _hoisted_2$g, [
4440
4418
  vue.createVNode(vue.unref(designPlugin.TMagicButton), {
4441
4419
  size: "small",
4442
4420
  disabled: _ctx.disabled,
@@ -4509,7 +4487,7 @@
4509
4487
  }
4510
4488
  });
4511
4489
 
4512
- const _hoisted_1$s = { class: "m-editor-data-source-field-select" };
4490
+ const _hoisted_1$t = { class: "m-editor-data-source-field-select" };
4513
4491
  const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
4514
4492
  __name: "FieldSelect",
4515
4493
  props: /* @__PURE__ */ vue.mergeModels({
@@ -4591,7 +4569,7 @@
4591
4569
  eventBus?.emit("edit-data-source", removeDataSourceFieldPrefix(id));
4592
4570
  };
4593
4571
  return (_ctx, _cache) => {
4594
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$s, [
4572
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$t, [
4595
4573
  _ctx.checkStrictly ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4596
4574
  vue.createVNode(vue.unref(designPlugin.TMagicSelect), {
4597
4575
  "model-value": selectDataSourceId.value,
@@ -4673,7 +4651,7 @@
4673
4651
  }
4674
4652
  });
4675
4653
 
4676
- const _hoisted_1$r = { class: "m-fields-data-source-field-select" };
4654
+ const _hoisted_1$s = { class: "m-fields-data-source-field-select" };
4677
4655
  const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
4678
4656
  ...{
4679
4657
  name: "MFieldsDataSourceFieldSelect"
@@ -4775,7 +4753,7 @@
4775
4753
  }
4776
4754
  };
4777
4755
  return (_ctx, _cache) => {
4778
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$r, [
4756
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$s, [
4779
4757
  showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(_sfc_main$O, {
4780
4758
  key: 0,
4781
4759
  "model-value": _ctx.model[_ctx.name],
@@ -4823,8 +4801,8 @@
4823
4801
  }
4824
4802
  });
4825
4803
 
4826
- const _hoisted_1$q = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
4827
- const _hoisted_2$e = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
4804
+ const _hoisted_1$r = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
4805
+ const _hoisted_2$f = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
4828
4806
  const _hoisted_3$4 = { class: "el-input__inner t-input__inner" };
4829
4807
  const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
4830
4808
  ...{
@@ -5029,9 +5007,9 @@
5029
5007
  vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
5030
5008
  ]),
5031
5009
  default: vue.withCtx(({ item }) => [
5032
- vue.createElementVNode("div", _hoisted_1$q, [
5010
+ vue.createElementVNode("div", _hoisted_1$r, [
5033
5011
  vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
5034
- vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(item.value), 1)
5012
+ vue.createElementVNode("span", _hoisted_2$f, vue.toDisplayString(item.value), 1)
5035
5013
  ])
5036
5014
  ]),
5037
5015
  _: 1
@@ -5072,8 +5050,8 @@
5072
5050
  }
5073
5051
  });
5074
5052
 
5075
- const _hoisted_1$p = { style: { "display": "flex", "margin-bottom": "10px" } };
5076
- const _hoisted_2$d = { style: { "flex": "1" } };
5053
+ const _hoisted_1$q = { style: { "display": "flex", "margin-bottom": "10px" } };
5054
+ const _hoisted_2$e = { style: { "flex": "1" } };
5077
5055
  const _hoisted_3$3 = { style: { "flex": "1" } };
5078
5056
  const _hoisted_4$3 = { class: "dialog-footer" };
5079
5057
  const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
@@ -5326,8 +5304,8 @@
5326
5304
  ])
5327
5305
  ]),
5328
5306
  default: vue.withCtx(() => [
5329
- vue.createElementVNode("div", _hoisted_1$p, [
5330
- vue.createElementVNode("div", _hoisted_2$d, [
5307
+ vue.createElementVNode("div", _hoisted_1$q, [
5308
+ vue.createElementVNode("div", _hoisted_2$e, [
5331
5309
  vue.createVNode(vue.unref(designPlugin.TMagicTag), {
5332
5310
  size: "small",
5333
5311
  type: "info"
@@ -5369,8 +5347,8 @@
5369
5347
  }
5370
5348
  });
5371
5349
 
5372
- const _hoisted_1$o = { class: "m-editor-data-source-methods" };
5373
- const _hoisted_2$c = { class: "m-editor-data-source-methods-footer" };
5350
+ const _hoisted_1$p = { class: "m-editor-data-source-methods" };
5351
+ const _hoisted_2$d = { class: "m-editor-data-source-methods-footer" };
5374
5352
  const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
5375
5353
  ...{
5376
5354
  name: "MFieldsDataSourceMethods"
@@ -5441,12 +5419,12 @@
5441
5419
  emit("change", props.model[props.name]);
5442
5420
  };
5443
5421
  return (_ctx, _cache) => {
5444
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
5422
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
5445
5423
  vue.createVNode(vue.unref(tablePlugin.MagicTable), {
5446
5424
  data: _ctx.model[_ctx.name],
5447
5425
  columns: methodColumns
5448
5426
  }, null, 8, ["data"]),
5449
- vue.createElementVNode("div", _hoisted_2$c, [
5427
+ vue.createElementVNode("div", _hoisted_2$d, [
5450
5428
  vue.createVNode(vue.unref(designPlugin.TMagicButton), {
5451
5429
  size: "small",
5452
5430
  type: "primary",
@@ -5475,8 +5453,8 @@
5475
5453
  }
5476
5454
  });
5477
5455
 
5478
- const _hoisted_1$n = { class: "m-fields-data-source-method-select" };
5479
- const _hoisted_2$b = { class: "data-source-method-select-container" };
5456
+ const _hoisted_1$o = { class: "m-fields-data-source-method-select" };
5457
+ const _hoisted_2$c = { class: "data-source-method-select-container" };
5480
5458
  const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
5481
5459
  ...{
5482
5460
  name: "MFieldsDataSourceMethodSelect"
@@ -5563,8 +5541,8 @@
5563
5541
  eventBus?.emit("edit-data-source", id);
5564
5542
  };
5565
5543
  return (_ctx, _cache) => {
5566
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
5567
- vue.createElementVNode("div", _hoisted_2$b, [
5544
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$o, [
5545
+ vue.createElementVNode("div", _hoisted_2$c, [
5568
5546
  vue.createVNode(vue.unref(formPlugin.MContainer), {
5569
5547
  class: "select",
5570
5548
  config: cascaderConfig.value,
@@ -5607,8 +5585,8 @@
5607
5585
  }
5608
5586
  });
5609
5587
 
5610
- const _hoisted_1$m = { class: "m-editor-data-source-fields" };
5611
- const _hoisted_2$a = { class: "m-editor-data-source-fields-footer" };
5588
+ const _hoisted_1$n = { class: "m-editor-data-source-fields" };
5589
+ const _hoisted_2$b = { class: "m-editor-data-source-fields-footer" };
5612
5590
  const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
5613
5591
  ...{
5614
5592
  name: "MFieldsDataSourceMocks"
@@ -5813,12 +5791,12 @@
5813
5791
  const parentFloating = vue.inject("parentFloating", vue.ref(null));
5814
5792
  const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
5815
5793
  return (_ctx, _cache) => {
5816
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
5794
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
5817
5795
  vue.createVNode(vue.unref(tablePlugin.MagicTable), {
5818
5796
  data: _ctx.model[_ctx.name],
5819
5797
  columns
5820
5798
  }, null, 8, ["data"]),
5821
- vue.createElementVNode("div", _hoisted_2$a, [
5799
+ vue.createElementVNode("div", _hoisted_2$b, [
5822
5800
  vue.createVNode(vue.unref(designPlugin.TMagicButton), {
5823
5801
  size: "small",
5824
5802
  type: "primary",
@@ -5860,7 +5838,7 @@
5860
5838
  }
5861
5839
  });
5862
5840
 
5863
- const _hoisted_1$l = { class: "m-fields-data-source-select" };
5841
+ const _hoisted_1$m = { class: "m-fields-data-source-select" };
5864
5842
  const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
5865
5843
  ...{
5866
5844
  name: "MFieldsDataSourceSelect"
@@ -5918,7 +5896,7 @@
5918
5896
  eventBus?.emit("edit-data-source", id);
5919
5897
  };
5920
5898
  return (_ctx, _cache) => {
5921
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
5899
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
5922
5900
  vue.createVNode(vue.unref(formPlugin.MSelect), {
5923
5901
  model: _ctx.model,
5924
5902
  name: _ctx.name,
@@ -6082,8 +6060,8 @@
6082
6060
  }
6083
6061
  });
6084
6062
 
6085
- const _hoisted_1$k = { class: "m-fields-event-select" };
6086
- const _hoisted_2$9 = {
6063
+ const _hoisted_1$l = { class: "m-fields-event-select" };
6064
+ const _hoisted_2$a = {
6087
6065
  key: 1,
6088
6066
  class: "fullWidth"
6089
6067
  };
@@ -6361,7 +6339,7 @@
6361
6339
  };
6362
6340
  return (_ctx, _cache) => {
6363
6341
  const _component_m_form_table = vue.resolveComponent("m-form-table");
6364
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
6342
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
6365
6343
  isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
6366
6344
  key: 0,
6367
6345
  ref: "eventForm",
@@ -6371,7 +6349,7 @@
6371
6349
  model: _ctx.model,
6372
6350
  config: tableConfig.value,
6373
6351
  onChange: onChangeHandler
6374
- }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$9, [
6352
+ }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
6375
6353
  vue.createVNode(vue.unref(designPlugin.TMagicButton), {
6376
6354
  class: "create-button",
6377
6355
  type: "primary",
@@ -6421,7 +6399,7 @@
6421
6399
  }
6422
6400
  });
6423
6401
 
6424
- const _hoisted_1$j = {
6402
+ const _hoisted_1$k = {
6425
6403
  viewBox: "0 0 32 32",
6426
6404
  version: "1.1",
6427
6405
  xmlns: "http://www.w3.org/2000/svg",
@@ -6434,15 +6412,15 @@
6434
6412
  __name: "CodeIcon",
6435
6413
  setup(__props) {
6436
6414
  return (_ctx, _cache) => {
6437
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$j, _cache[0] || (_cache[0] = [
6415
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$k, _cache[0] || (_cache[0] = [
6438
6416
  vue.createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2)
6439
6417
  ]));
6440
6418
  };
6441
6419
  }
6442
6420
  });
6443
6421
 
6444
- const _hoisted_1$i = { class: "m-fields-key-value" };
6445
- const _hoisted_2$8 = { key: 0 };
6422
+ const _hoisted_1$j = { class: "m-fields-key-value" };
6423
+ const _hoisted_2$9 = { key: 0 };
6446
6424
  const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
6447
6425
  ...{
6448
6426
  name: "MFieldsKeyValue"
@@ -6501,8 +6479,8 @@
6501
6479
  emit("change", v);
6502
6480
  };
6503
6481
  return (_ctx, _cache) => {
6504
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
6505
- !showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$8, [
6482
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
6483
+ !showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$9, [
6506
6484
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
6507
6485
  return vue.openBlock(), vue.createElementBlock("div", {
6508
6486
  class: "m-fields-key-value-item",
@@ -6575,8 +6553,8 @@
6575
6553
  }
6576
6554
  });
6577
6555
 
6578
- const _hoisted_1$h = { class: "m-fields-page-fragment-select" };
6579
- const _hoisted_2$7 = { class: "page-fragment-select-container" };
6556
+ const _hoisted_1$i = { class: "m-fields-page-fragment-select" };
6557
+ const _hoisted_2$8 = { class: "page-fragment-select-container" };
6580
6558
  const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
6581
6559
  ...{
6582
6560
  name: "MFieldsPageFragmentSelect"
@@ -6623,8 +6601,8 @@
6623
6601
  };
6624
6602
  return (_ctx, _cache) => {
6625
6603
  const _component_m_form_container = vue.resolveComponent("m-form-container");
6626
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
6627
- vue.createElementVNode("div", _hoisted_2$7, [
6604
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
6605
+ vue.createElementVNode("div", _hoisted_2$8, [
6628
6606
  vue.createVNode(_component_m_form_container, {
6629
6607
  class: "select",
6630
6608
  config: selectConfig,
@@ -6644,7 +6622,7 @@
6644
6622
  }
6645
6623
  });
6646
6624
 
6647
- const _hoisted_1$g = {
6625
+ const _hoisted_1$h = {
6648
6626
  key: 1,
6649
6627
  class: "m-fields-ui-select",
6650
6628
  style: { "display": "flex" }
@@ -6744,7 +6722,7 @@
6744
6722
  ])),
6745
6723
  _: 1
6746
6724
  }, 8, ["icon", "disabled", "size"])
6747
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
6725
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
6748
6726
  val.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
6749
6727
  vue.createVNode(vue.unref(designPlugin.TMagicTooltip), {
6750
6728
  content: "清除",
@@ -6993,11 +6971,11 @@
6993
6971
  }
6994
6972
  });
6995
6973
 
6996
- const _hoisted_1$f = {
6974
+ const _hoisted_1$g = {
6997
6975
  key: 1,
6998
6976
  class: "menu-item-text"
6999
6977
  };
7000
- const _hoisted_2$6 = { class: "el-dropdown-link menubar-menu-button" };
6978
+ const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
7001
6979
  const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
7002
6980
  ...{
7003
6981
  name: "MEditorToolButton"
@@ -7069,7 +7047,7 @@
7069
7047
  _ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicDivider), {
7070
7048
  key: 0,
7071
7049
  direction: _ctx.data.direction || "vertical"
7072
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
7050
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
7073
7051
  _ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(designPlugin.TMagicTooltip), {
7074
7052
  key: 0,
7075
7053
  effect: "dark",
@@ -7134,7 +7112,7 @@
7134
7112
  })) : vue.createCommentVNode("", true)
7135
7113
  ]),
7136
7114
  default: vue.withCtx(() => [
7137
- vue.createElementVNode("span", _hoisted_2$6, [
7115
+ vue.createElementVNode("span", _hoisted_2$7, [
7138
7116
  vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
7139
7117
  vue.createVNode(vue.unref(designPlugin.TMagicIcon), { class: "el-icon--right" }, {
7140
7118
  default: vue.withCtx(() => [
@@ -7151,7 +7129,12 @@
7151
7129
  }
7152
7130
  });
7153
7131
 
7154
- const _hoisted_1$e = {
7132
+ const _hoisted_1$f = {
7133
+ key: 0,
7134
+ id: "m-editor-page-bar-add-icon",
7135
+ class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
7136
+ };
7137
+ const _hoisted_2$6 = {
7155
7138
  key: 1,
7156
7139
  style: { "width": "21px" }
7157
7140
  };
@@ -7160,35 +7143,51 @@
7160
7143
  name: "MEditorPageBarAddButton"
7161
7144
  },
7162
7145
  __name: "AddButton",
7163
- props: {
7164
- type: {}
7165
- },
7166
7146
  setup(__props) {
7167
- const props = __props;
7168
7147
  const services = vue.inject("services");
7169
7148
  const uiService = services?.uiService;
7170
7149
  const editorService = services?.editorService;
7171
7150
  const showAddPageButton = vue.computed(() => uiService?.get("showAddPageButton"));
7172
- const addPage = () => {
7151
+ const addPage = (type) => {
7173
7152
  if (!editorService) return;
7174
7153
  const root = vue.toRaw(editorService.get("root"));
7175
7154
  if (!root) throw new Error("root 不能为空");
7176
7155
  const pageConfig = {
7177
- type: props.type,
7178
- name: generatePageNameByApp(root, props.type),
7156
+ type,
7157
+ name: generatePageNameByApp(root, type),
7179
7158
  items: []
7180
7159
  };
7181
7160
  editorService.add(pageConfig);
7182
7161
  };
7183
7162
  return (_ctx, _cache) => {
7184
- return showAddPageButton.value ? (vue.openBlock(), vue.createElementBlock("div", {
7185
- key: 0,
7186
- id: "m-editor-page-bar-add-icon",
7187
- class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
7188
- onClick: addPage
7189
- }, [
7190
- vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
7191
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e));
7163
+ return showAddPageButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
7164
+ vue.createVNode(vue.unref(designPlugin.TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
7165
+ reference: vue.withCtx(() => [
7166
+ vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
7167
+ ]),
7168
+ default: vue.withCtx(() => [
7169
+ vue.createVNode(_sfc_main$y, {
7170
+ data: {
7171
+ type: "button",
7172
+ text: "页面",
7173
+ handler: () => {
7174
+ addPage(vue.unref(core.NodeType).PAGE);
7175
+ }
7176
+ }
7177
+ }, null, 8, ["data"]),
7178
+ vue.createVNode(_sfc_main$y, {
7179
+ data: {
7180
+ type: "button",
7181
+ text: "页面片",
7182
+ handler: () => {
7183
+ addPage(vue.unref(core.NodeType).PAGE_FRAGMENT);
7184
+ }
7185
+ }
7186
+ }, null, 8, ["data"])
7187
+ ]),
7188
+ _: 1
7189
+ })
7190
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$6));
7192
7191
  };
7193
7192
  }
7194
7193
  });
@@ -7199,8 +7198,8 @@
7199
7198
  },
7200
7199
  __name: "PageBarScrollContainer",
7201
7200
  props: {
7202
- type: {},
7203
- pageBarSortOptions: {}
7201
+ pageBarSortOptions: {},
7202
+ length: {}
7204
7203
  },
7205
7204
  setup(__props) {
7206
7205
  const props = __props;
@@ -7213,7 +7212,7 @@
7213
7212
  const showPageListButton = vue.computed(() => uiService?.get("showPageListButton"));
7214
7213
  const itemsContainerWidth = vue.ref(0);
7215
7214
  const setCanScroll = () => {
7216
- itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
7215
+ itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - 37 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
7217
7216
  vue.nextTick(() => {
7218
7217
  if (itemsContainer.value) {
7219
7218
  canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
@@ -7251,19 +7250,17 @@
7251
7250
  }
7252
7251
  itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
7253
7252
  };
7254
- const pageLength = vue.computed(() => editorService?.get("pageLength") || 0);
7255
- const pageFragmentLength = vue.computed(() => editorService?.get("pageFragmentLength") || 0);
7256
- const crateWatchLength = (length) => vue.watch(
7257
- length,
7258
- (length2 = 0, preLength = 0) => {
7253
+ vue.watch(
7254
+ () => props.length,
7255
+ (length = 0, preLength = 0) => {
7259
7256
  setTimeout(() => {
7260
7257
  setCanScroll();
7261
- if (length2 < preLength) {
7258
+ if (length < preLength) {
7262
7259
  scroll("start");
7263
7260
  } else {
7264
7261
  scroll("end");
7265
7262
  }
7266
- if (length2 > 1) {
7263
+ if (length > 1) {
7267
7264
  const el = document.querySelector(".m-editor-page-bar-items");
7268
7265
  let beforeDragList = [];
7269
7266
  const options = {
@@ -7299,25 +7296,6 @@
7299
7296
  immediate: true
7300
7297
  }
7301
7298
  );
7302
- let unWatchPageLength;
7303
- let unWatchPageFragmentLength;
7304
- vue.watch(
7305
- () => props.type,
7306
- (type) => {
7307
- if (type === core.NodeType.PAGE) {
7308
- unWatchPageFragmentLength?.();
7309
- unWatchPageFragmentLength = null;
7310
- unWatchPageLength = crateWatchLength(pageLength);
7311
- } else {
7312
- unWatchPageLength?.();
7313
- unWatchPageLength = null;
7314
- unWatchPageFragmentLength = crateWatchLength(pageFragmentLength);
7315
- }
7316
- },
7317
- {
7318
- immediate: true
7319
- }
7320
- );
7321
7299
  return (_ctx, _cache) => {
7322
7300
  return vue.openBlock(), vue.createElementBlock("div", {
7323
7301
  class: "m-editor-page-bar",
@@ -7332,7 +7310,7 @@
7332
7310
  }, [
7333
7311
  vue.createVNode(_sfc_main$Y, { icon: vue.unref(iconsVue.ArrowLeftBold) }, null, 8, ["icon"])
7334
7312
  ])) : vue.createCommentVNode("", true),
7335
- _ctx.type === vue.unref(core.NodeType).PAGE && pageLength.value || _ctx.type === vue.unref(core.NodeType).PAGE_FRAGMENT && pageFragmentLength.value ? (vue.openBlock(), vue.createElementBlock("div", {
7313
+ _ctx.length ? (vue.openBlock(), vue.createElementBlock("div", {
7336
7314
  key: 1,
7337
7315
  class: "m-editor-page-bar-items",
7338
7316
  ref_key: "itemsContainer",
@@ -7353,7 +7331,7 @@
7353
7331
  }
7354
7332
  });
7355
7333
 
7356
- const _hoisted_1$d = {
7334
+ const _hoisted_1$e = {
7357
7335
  key: 0,
7358
7336
  id: "m-editor-page-bar-list-icon",
7359
7337
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
@@ -7375,7 +7353,7 @@
7375
7353
  editorService?.select(id);
7376
7354
  };
7377
7355
  return (_ctx, _cache) => {
7378
- return showPageListButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
7356
+ return showPageListButton.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
7379
7357
  vue.createVNode(vue.unref(designPlugin.TMagicPopover), {
7380
7358
  "popper-class": "page-bar-popover",
7381
7359
  placement: "top",
@@ -7414,46 +7392,63 @@
7414
7392
  }
7415
7393
  });
7416
7394
 
7395
+ const _hoisted_1$d = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
7417
7396
  const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
7418
- ...{
7419
- name: "MEditorPageBarSwitchTypeButton"
7420
- },
7421
- __name: "SwitchTypeButton",
7397
+ __name: "Search",
7422
7398
  props: {
7423
- modelValue: {}
7399
+ "query": {},
7400
+ "queryModifiers": {}
7424
7401
  },
7425
- emits: ["update:modelValue"],
7402
+ emits: /* @__PURE__ */ vue.mergeModels(["search"], ["update:query"]),
7426
7403
  setup(__props, { emit: __emit }) {
7427
- const data = [
7404
+ const emit = __emit;
7405
+ const query = vue.useModel(__props, "query");
7406
+ const formConfig = formPlugin.createForm([
7428
7407
  {
7429
- type: core.NodeType.PAGE,
7430
- text: "页面"
7408
+ type: "checkbox-group",
7409
+ name: "pageType",
7410
+ options: [
7411
+ {
7412
+ value: core.NodeType.PAGE,
7413
+ text: "页面"
7414
+ },
7415
+ {
7416
+ value: core.NodeType.PAGE_FRAGMENT,
7417
+ text: "页面片段"
7418
+ }
7419
+ ]
7431
7420
  },
7432
7421
  {
7433
- type: core.NodeType.PAGE_FRAGMENT,
7434
- text: "页面片"
7422
+ name: "keyword",
7423
+ placeholder: "请输入关键字"
7435
7424
  }
7436
- ];
7437
- const emit = __emit;
7438
- const clickHandler = (value) => {
7439
- emit("update:modelValue", value);
7425
+ ]);
7426
+ const visible = vue.ref(false);
7427
+ const onFormChange = (values) => {
7428
+ query.value = values;
7429
+ emit("search", values);
7440
7430
  };
7441
7431
  return (_ctx, _cache) => {
7442
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(data, (item) => {
7443
- return vue.createVNode(vue.unref(designPlugin.TMagicButton), {
7444
- class: vue.normalizeClass(["m-editor-page-bar-switch-type-button", { active: _ctx.modelValue === item.type }]),
7445
- size: "small",
7446
- key: item.type,
7447
- link: "",
7448
- type: _ctx.modelValue === item.type ? "primary" : "",
7449
- onClick: ($event) => clickHandler(item.type)
7450
- }, {
7451
- default: vue.withCtx(() => [
7452
- vue.createTextVNode(vue.toDisplayString(item.text), 1)
7453
- ]),
7454
- _: 2
7455
- }, 1032, ["class", "type", "onClick"]);
7456
- }), 64);
7432
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
7433
+ vue.createVNode(_sfc_main$Y, {
7434
+ icon: vue.unref(iconsVue.Search),
7435
+ onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value),
7436
+ class: vue.normalizeClass({ "icon-active": visible.value })
7437
+ }, null, 8, ["icon", "class"]),
7438
+ visible.value ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
7439
+ key: 0,
7440
+ to: ".m-editor-page-bar-tabs"
7441
+ }, [
7442
+ query.value ? (vue.openBlock(), vue.createBlock(vue.unref(formPlugin.MForm), {
7443
+ key: 0,
7444
+ class: "m-editor-page-bar-search-panel",
7445
+ inline: true,
7446
+ config: vue.unref(formConfig),
7447
+ "init-values": query.value,
7448
+ onChange: onFormChange
7449
+ }, null, 8, ["config", "init-values"])) : vue.createCommentVNode("", true)
7450
+ ])) : vue.createCommentVNode("", true)
7451
+ ]);
7457
7452
  };
7458
7453
  }
7459
7454
  });
@@ -7472,60 +7467,28 @@
7472
7467
  pageBarSortOptions: {}
7473
7468
  },
7474
7469
  setup(__props) {
7475
- const active = vue.ref(core.NodeType.PAGE);
7476
7470
  const services = vue.inject("services");
7477
7471
  const editorService = services?.editorService;
7478
7472
  const root = vue.computed(() => editorService?.get("root"));
7479
7473
  const page = vue.computed(() => editorService?.get("page"));
7480
- const pageList = vue.computed(() => getPageList(root.value));
7481
- const pageFragmentList = vue.computed(() => getPageFragmentList(root.value));
7482
- const list = vue.computed(() => active.value === core.NodeType.PAGE ? pageList.value : pageFragmentList.value);
7483
- const activePage = vue.ref("");
7484
- const activePageFragment = vue.ref("");
7485
- vue.watch(
7486
- page,
7487
- (page2) => {
7488
- if (!page2) {
7489
- if (active.value === core.NodeType.PAGE) {
7490
- activePage.value = "";
7491
- }
7492
- if (active.value === core.NodeType.PAGE_FRAGMENT) {
7493
- activePageFragment.value = "";
7494
- }
7495
- return;
7496
- }
7497
- if (utils.isPage(page2)) {
7498
- activePage.value = page2?.id;
7499
- if (active.value !== core.NodeType.PAGE) {
7500
- active.value = core.NodeType.PAGE;
7501
- }
7502
- } else if (utils.isPageFragment(page2)) {
7503
- activePageFragment.value = page2?.id;
7504
- if (active.value !== core.NodeType.PAGE_FRAGMENT) {
7505
- active.value = core.NodeType.PAGE_FRAGMENT;
7506
- }
7507
- }
7508
- },
7509
- {
7510
- immediate: true
7511
- }
7512
- );
7513
- vue.watch(active, (active2) => {
7514
- if (active2 === core.NodeType.PAGE) {
7515
- if (!activePage.value && !pageList.value.length) {
7516
- editorService?.selectRoot();
7517
- return;
7518
- }
7519
- switchPage(activePage.value);
7520
- return;
7474
+ const query = vue.ref({
7475
+ pageType: [core.NodeType.PAGE, core.NodeType.PAGE_FRAGMENT],
7476
+ keyword: ""
7477
+ });
7478
+ const list = vue.computed(() => {
7479
+ const { pageType, keyword } = query.value;
7480
+ if (pageType.length === 0) {
7481
+ return [];
7521
7482
  }
7522
- if (active2 === core.NodeType.PAGE_FRAGMENT) {
7523
- if (!activePageFragment.value && !pageFragmentList.value.length) {
7524
- editorService?.selectRoot();
7525
- return;
7483
+ return (root.value?.items || []).filter((item) => {
7484
+ if (pageType.includes(item.type)) {
7485
+ if (keyword) {
7486
+ return item.name?.includes(keyword);
7487
+ }
7488
+ return true;
7526
7489
  }
7527
- switchPage(activePageFragment.value || pageFragmentList.value[0].id);
7528
- }
7490
+ return false;
7491
+ });
7529
7492
  });
7530
7493
  const switchPage = (id) => {
7531
7494
  editorService?.select(id);
@@ -7542,17 +7505,18 @@
7542
7505
  };
7543
7506
  return (_ctx, _cache) => {
7544
7507
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
7545
- !_ctx.disabledPageFragment ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
7546
- key: 0,
7547
- modelValue: active.value,
7548
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
7549
- }, null, 8, ["modelValue"])) : vue.createCommentVNode("", true),
7550
7508
  vue.createVNode(_sfc_main$w, {
7551
- type: active.value,
7552
- "page-bar-sort-options": _ctx.pageBarSortOptions
7509
+ "page-bar-sort-options": _ctx.pageBarSortOptions,
7510
+ length: list.value.length
7553
7511
  }, {
7554
7512
  prepend: vue.withCtx(() => [
7555
- vue.createVNode(_sfc_main$x, { type: active.value }, null, 8, ["type"]),
7513
+ vue.renderSlot(_ctx.$slots, "page-bar-add-button", {}, () => [
7514
+ vue.createVNode(_sfc_main$x)
7515
+ ]),
7516
+ vue.createVNode(_sfc_main$u, {
7517
+ query: query.value,
7518
+ "onUpdate:query": _cache[0] || (_cache[0] = ($event) => query.value = $event)
7519
+ }, null, 8, ["query"]),
7556
7520
  vue.createVNode(_sfc_main$v, { list: list.value }, {
7557
7521
  "page-list-popover": vue.withCtx(({ list: list2 }) => [
7558
7522
  vue.renderSlot(_ctx.$slots, "page-list-popover", { list: list2 })
@@ -7618,7 +7582,7 @@
7618
7582
  }), 128))
7619
7583
  ]),
7620
7584
  _: 3
7621
- }, 8, ["type", "page-bar-sort-options"])
7585
+ }, 8, ["page-bar-sort-options", "length"])
7622
7586
  ]);
7623
7587
  };
7624
7588
  }
@@ -7795,6 +7759,9 @@
7795
7759
  "disabled-page-fragment": _ctx.disabledPageFragment,
7796
7760
  "page-bar-sort-options": _ctx.pageBarSortOptions
7797
7761
  }, {
7762
+ "page-bar-add-button": vue.withCtx(() => [
7763
+ vue.renderSlot(_ctx.$slots, "page-bar-add-button")
7764
+ ]),
7798
7765
  "page-bar-title": vue.withCtx(({ page: page2 }) => [
7799
7766
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
7800
7767
  ]),
@@ -11000,9 +10967,17 @@
11000
10967
  if (!stage || !zoom2) return;
11001
10968
  stage.setZoom(zoom2);
11002
10969
  });
10970
+ let timeoutId = null;
11003
10971
  vue.watch(page, (page2) => {
11004
10972
  if (runtime && page2) {
11005
10973
  services?.editorService.set("stageLoading", true);
10974
+ if (timeoutId) {
10975
+ globalThis.clearTimeout(timeoutId);
10976
+ }
10977
+ timeoutId = globalThis.setTimeout(() => {
10978
+ services?.editorService.set("stageLoading", false);
10979
+ timeoutId = null;
10980
+ }, 3e3);
11006
10981
  runtime.updatePageId?.(page2.id);
11007
10982
  vue.nextTick(() => {
11008
10983
  stage?.select(page2.id);
@@ -11683,8 +11658,11 @@
11683
11658
  }
11684
11659
  );
11685
11660
  });
11686
- idleTask.once("finish", () => {
11687
- this.emit("collected", nodes, deep);
11661
+ return new Promise((resolve) => {
11662
+ idleTask.once("finish", () => {
11663
+ this.emit("collected", nodes, deep);
11664
+ resolve();
11665
+ });
11688
11666
  });
11689
11667
  }
11690
11668
  collectNode(node, target, depExtendedData = {}, deep = false) {
@@ -12321,49 +12299,19 @@
12321
12299
  const stage = editorService.get("stage");
12322
12300
  return stage?.renderer?.runtime?.getApp?.();
12323
12301
  };
12324
- const updateDataSourceSchema = () => {
12325
- const root = editorService.get("root");
12326
- if (root?.dataSources) {
12327
- getApp()?.dataSourceManager?.updateSchema(root.dataSources);
12328
- }
12329
- };
12330
- const targetAddHandler = (target) => {
12302
+ const updateDataSourceSchema = (nodes, deep) => {
12331
12303
  const root = editorService.get("root");
12332
- if (!root) return;
12333
- if (target.type === core.DepTargetType.DATA_SOURCE) {
12334
- if (!root.dataSourceDeps) {
12335
- root.dataSourceDeps = {};
12336
- }
12337
- root.dataSourceDeps[target.id] = target.deps;
12338
- }
12339
- if (target.type === core.DepTargetType.DATA_SOURCE_COND) {
12340
- if (!root.dataSourceCondDeps) {
12341
- root.dataSourceCondDeps = {};
12342
- }
12343
- root.dataSourceCondDeps[target.id] = target.deps;
12344
- }
12345
- };
12346
- const targetRemoveHandler = (id) => {
12347
- const root = editorService.get("root");
12348
- if (root?.dataSourceDeps) {
12349
- delete root.dataSourceDeps[id];
12350
- }
12351
- if (root?.dataSourceCondDeps) {
12352
- delete root.dataSourceCondDeps[id];
12353
- }
12354
- };
12355
- const collectedHandler = lodashEs.debounce((nodes, deep) => {
12356
- const root = editorService.get("root");
12357
- const stage = editorService.get("stage");
12358
- if (!root || !stage) return;
12359
12304
  const app = getApp();
12360
- if (!app) return;
12361
- if (app.dsl) {
12305
+ if (root && app?.dsl) {
12362
12306
  app.dsl.dataSourceDeps = root.dataSourceDeps;
12363
12307
  app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
12364
12308
  app.dsl.dataSources = root.dataSources;
12365
12309
  }
12366
- updateDataSourceSchema();
12310
+ if (root?.dataSources) {
12311
+ getApp()?.dataSourceManager?.updateSchema(root.dataSources);
12312
+ }
12313
+ const stage = editorService.get("stage");
12314
+ if (!root || !stage) return;
12367
12315
  const allNodes = [];
12368
12316
  if (deep) {
12369
12317
  nodes.forEach((node) => {
@@ -12387,17 +12335,58 @@
12387
12335
  });
12388
12336
  });
12389
12337
  });
12390
- }, 300);
12338
+ };
12339
+ const afterUpdateNodes = (nodes) => {
12340
+ const root = editorService.get("root");
12341
+ if (!root) return;
12342
+ const stage = editorService.get("stage");
12343
+ const app = getApp();
12344
+ if (app?.dsl) {
12345
+ app.dsl.dataSourceDeps = root.dataSourceDeps;
12346
+ }
12347
+ for (const node of nodes) {
12348
+ stage?.update({
12349
+ config: lodashEs.cloneDeep(node),
12350
+ parentId: editorService.getParentById(node.id)?.id,
12351
+ root: lodashEs.cloneDeep(root)
12352
+ });
12353
+ }
12354
+ };
12355
+ const targetAddHandler = (target) => {
12356
+ const root = editorService.get("root");
12357
+ if (!root) return;
12358
+ if (target.type === core.DepTargetType.DATA_SOURCE) {
12359
+ if (!root.dataSourceDeps) {
12360
+ root.dataSourceDeps = {};
12361
+ }
12362
+ root.dataSourceDeps[target.id] = target.deps;
12363
+ }
12364
+ if (target.type === core.DepTargetType.DATA_SOURCE_COND) {
12365
+ if (!root.dataSourceCondDeps) {
12366
+ root.dataSourceCondDeps = {};
12367
+ }
12368
+ root.dataSourceCondDeps[target.id] = target.deps;
12369
+ }
12370
+ };
12371
+ const targetRemoveHandler = (id) => {
12372
+ const root = editorService.get("root");
12373
+ if (!root) return;
12374
+ if (root.dataSourceDeps) {
12375
+ delete root.dataSourceDeps[id];
12376
+ }
12377
+ if (root.dataSourceCondDeps) {
12378
+ delete root.dataSourceCondDeps[id];
12379
+ }
12380
+ };
12391
12381
  depService.on("add-target", targetAddHandler);
12392
12382
  depService.on("remove-target", targetRemoveHandler);
12393
- depService.on("collected", collectedHandler);
12394
12383
  const initDataSourceDepTarget = (ds) => {
12395
12384
  depService.addTarget(core.createDataSourceTarget(ds, vue.reactive({})));
12396
12385
  depService.addTarget(core.createDataSourceMethodTarget(ds, vue.reactive({})));
12397
12386
  depService.addTarget(core.createDataSourceCondTarget(ds, vue.reactive({})));
12398
12387
  };
12399
- const collectIdle = (nodes, deep) => {
12400
- nodes.forEach((node) => {
12388
+ const collectIdle = (nodes, deep) => Promise.all(
12389
+ nodes.map((node) => {
12401
12390
  let pageId;
12402
12391
  if (utils.isPage(node)) {
12403
12392
  pageId = node.id;
@@ -12405,20 +12394,26 @@
12405
12394
  const info = editorService.getNodeInfo(node.id);
12406
12395
  pageId = info.page?.id;
12407
12396
  }
12408
- depService.collectIdle([node], { pageId }, deep);
12409
- });
12410
- };
12397
+ return depService.collectIdle([node], { pageId }, deep);
12398
+ })
12399
+ );
12411
12400
  const nodeAddHandler = (nodes) => {
12412
- collectIdle(nodes, true);
12401
+ collectIdle(nodes, true).then(() => {
12402
+ afterUpdateNodes(nodes);
12403
+ });
12413
12404
  };
12414
12405
  const nodeUpdateHandler = (nodes) => {
12415
- collectIdle(nodes, true);
12406
+ collectIdle(nodes, true).then(() => {
12407
+ afterUpdateNodes(nodes);
12408
+ });
12416
12409
  };
12417
12410
  const nodeRemoveHandler = (nodes) => {
12418
12411
  depService.clear(nodes);
12419
12412
  };
12420
12413
  const historyChangeHandler = (page) => {
12421
- collectIdle([page], true);
12414
+ collectIdle([page], true).then(() => {
12415
+ updateDataSourceSchema([page], true);
12416
+ });
12422
12417
  };
12423
12418
  editorService.on("history-change", historyChangeHandler);
12424
12419
  editorService.on("root-change", rootChangeHandler);
@@ -12445,7 +12440,9 @@
12445
12440
  const root = editorService.get("root");
12446
12441
  removeDataSourceTarget(config.id);
12447
12442
  initDataSourceDepTarget(config);
12448
- collectIdle(root?.items || [], true);
12443
+ collectIdle(root?.items || [], true).then(() => {
12444
+ updateDataSourceSchema(root?.items || [], true);
12445
+ });
12449
12446
  };
12450
12447
  const removeDataSourceTarget = (id) => {
12451
12448
  depService.removeTarget(id, core.DepTargetType.DATA_SOURCE);
@@ -12453,8 +12450,13 @@
12453
12450
  depService.removeTarget(id, core.DepTargetType.DATA_SOURCE_METHOD);
12454
12451
  };
12455
12452
  const dataSourceRemoveHandler = (id) => {
12453
+ const root = editorService.get("root");
12454
+ const nodeIds = Object.keys(root?.dataSourceDeps?.[id] || {});
12455
+ const nodes = utils.getNodes(nodeIds, root?.items);
12456
+ collectIdle(nodes, false).then(() => {
12457
+ updateDataSourceSchema(nodes, false);
12458
+ });
12456
12459
  removeDataSourceTarget(id);
12457
- getApp()?.dataSourceManager?.removeDataSource(id);
12458
12460
  };
12459
12461
  dataSourceService.on("add", dataSourceAddHandler);
12460
12462
  dataSourceService.on("update", dataSourceUpdateHandler);
@@ -12462,7 +12464,6 @@
12462
12464
  vue.onBeforeUnmount(() => {
12463
12465
  depService.off("add-target", targetAddHandler);
12464
12466
  depService.off("remove-target", targetRemoveHandler);
12465
- depService.off("collected", collectedHandler);
12466
12467
  editorService.off("history-change", historyChangeHandler);
12467
12468
  editorService.off("root-change", rootChangeHandler);
12468
12469
  editorService.off("add", nodeAddHandler);
@@ -12681,6 +12682,9 @@
12681
12682
  "page-bar": vue.withCtx(() => [
12682
12683
  vue.renderSlot(_ctx.$slots, "page-bar")
12683
12684
  ]),
12685
+ "page-bar-add-button": vue.withCtx(() => [
12686
+ vue.renderSlot(_ctx.$slots, "page-bar-add-button")
12687
+ ]),
12684
12688
  "page-bar-title": vue.withCtx(({ page }) => [
12685
12689
  vue.renderSlot(_ctx.$slots, "page-bar-title", { page })
12686
12690
  ]),