@tmagic/editor 1.5.0-beta.0 → 1.5.0-beta.2

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.
@@ -3234,7 +3234,7 @@
3234
3234
  });
3235
3235
 
3236
3236
  const _hoisted_1$u = { class: "m-fields-code-select-col" };
3237
- const _hoisted_2$k = { class: "code-select-container" };
3237
+ const _hoisted_2$j = { class: "code-select-container" };
3238
3238
  const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
3239
3239
  ...{
3240
3240
  name: "MFieldsCodeSelectCol"
@@ -3315,7 +3315,7 @@
3315
3315
  };
3316
3316
  return (_ctx, _cache) => {
3317
3317
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$u, [
3318
- vue.createElementVNode("div", _hoisted_2$k, [
3318
+ vue.createElementVNode("div", _hoisted_2$j, [
3319
3319
  vue.createVNode(vue.unref(form.MContainer), {
3320
3320
  class: "select",
3321
3321
  config: selectConfig,
@@ -4065,6 +4065,68 @@
4065
4065
  };
4066
4066
  };
4067
4067
 
4068
+ const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
4069
+ const filterIsMatch = (value, data) => {
4070
+ const string = !Array.isArray(value) ? [value] : value;
4071
+ if (!string.length) {
4072
+ return true;
4073
+ }
4074
+ return string.some((v) => filterNodeMethod(v, data));
4075
+ };
4076
+ const filter = (text) => {
4077
+ if (!nodeData.value.length) return;
4078
+ nodeData.value.forEach((node) => {
4079
+ traverseNode(node, (node2, parents) => {
4080
+ if (!nodeStatusMap.value) return;
4081
+ const visible = filterIsMatch(text, node2);
4082
+ if (visible && parents.length) {
4083
+ parents.forEach((parent) => {
4084
+ updateStatus(nodeStatusMap.value, parent.id, {
4085
+ visible,
4086
+ expand: true
4087
+ });
4088
+ });
4089
+ }
4090
+ updateStatus(nodeStatusMap.value, node2.id, {
4091
+ visible
4092
+ });
4093
+ });
4094
+ });
4095
+ };
4096
+ return {
4097
+ filterText: vue.ref(""),
4098
+ filterTextChangeHandler(text) {
4099
+ filter(text);
4100
+ }
4101
+ };
4102
+ };
4103
+
4104
+ const useGetSo = (target, emit) => {
4105
+ let getso;
4106
+ const isDraging = vue.ref(false);
4107
+ vue.onMounted(() => {
4108
+ if (!target.value) return;
4109
+ getso = new Gesto(target.value, {
4110
+ container: window,
4111
+ pinchOutside: true
4112
+ }).on("drag", (e) => {
4113
+ if (!target.value) return;
4114
+ emit("change", e);
4115
+ }).on("dragStart", () => {
4116
+ isDraging.value = true;
4117
+ }).on("dragEnd", () => {
4118
+ isDraging.value = false;
4119
+ });
4120
+ });
4121
+ vue.onBeforeUnmount(() => {
4122
+ getso?.unset();
4123
+ isDraging.value = false;
4124
+ });
4125
+ return {
4126
+ isDraging
4127
+ };
4128
+ };
4129
+
4068
4130
  const useNextFloatBoxPosition = (uiService, parent) => {
4069
4131
  const boxPosition = vue.ref({
4070
4132
  left: 0,
@@ -4089,8 +4151,42 @@
4089
4151
  };
4090
4152
  };
4091
4153
 
4154
+ const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
4155
+ const map = /* @__PURE__ */ new Map();
4156
+ nodeData.forEach(
4157
+ (node) => traverseNode(node, (node2) => {
4158
+ map.set(
4159
+ node2.id,
4160
+ initialLayerNodeStatus?.get(node2.id) || {
4161
+ visible: true,
4162
+ expand: false,
4163
+ selected: false,
4164
+ draggable: false
4165
+ }
4166
+ );
4167
+ })
4168
+ );
4169
+ return map;
4170
+ };
4171
+ const useNodeStatus$1 = (nodeData) => {
4172
+ const nodeStatusMap = vue.ref(/* @__PURE__ */ new Map());
4173
+ vue.watch(
4174
+ nodeData,
4175
+ (nodeData2) => {
4176
+ nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
4177
+ },
4178
+ {
4179
+ immediate: true,
4180
+ deep: true
4181
+ }
4182
+ );
4183
+ return {
4184
+ nodeStatusMap
4185
+ };
4186
+ };
4187
+
4092
4188
  const _hoisted_1$t = { class: "m-editor-data-source-fields" };
4093
- const _hoisted_2$j = { class: "m-editor-data-source-fields-footer" };
4189
+ const _hoisted_2$i = { class: "m-editor-data-source-fields-footer" };
4094
4190
  const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
4095
4191
  ...{
4096
4192
  name: "MFieldsDataSourceFields"
@@ -4347,7 +4443,7 @@
4347
4443
  data: _ctx.model[_ctx.name],
4348
4444
  columns: fieldColumns
4349
4445
  }, null, 8, ["data"]),
4350
- vue.createElementVNode("div", _hoisted_2$j, [
4446
+ vue.createElementVNode("div", _hoisted_2$i, [
4351
4447
  vue.createVNode(vue.unref(design.TMagicButton), {
4352
4448
  size: "small",
4353
4449
  disabled: _ctx.disabled,
@@ -4706,7 +4802,7 @@
4706
4802
  "last-values": _ctx.lastValues,
4707
4803
  "init-values": _ctx.initValues,
4708
4804
  values: _ctx.values,
4709
- prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.name}`,
4805
+ prop: _ctx.prop,
4710
4806
  onChange: onChangeHandler
4711
4807
  }, null, 40, ["config", "model", "name", "disabled", "size", "last-values", "init-values", "values", "prop"])),
4712
4808
  _ctx.config.fieldConfig ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
@@ -4735,7 +4831,7 @@
4735
4831
  });
4736
4832
 
4737
4833
  const _hoisted_1$q = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
4738
- const _hoisted_2$i = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
4834
+ const _hoisted_2$h = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
4739
4835
  const _hoisted_3$8 = { class: "el-input__inner t-input__inner" };
4740
4836
  const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
4741
4837
  ...{
@@ -4942,7 +5038,7 @@
4942
5038
  default: vue.withCtx(({ item }) => [
4943
5039
  vue.createElementVNode("div", _hoisted_1$q, [
4944
5040
  vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
4945
- vue.createElementVNode("span", _hoisted_2$i, vue.toDisplayString(item.value), 1)
5041
+ vue.createElementVNode("span", _hoisted_2$h, vue.toDisplayString(item.value), 1)
4946
5042
  ])
4947
5043
  ]),
4948
5044
  _: 1
@@ -4984,7 +5080,7 @@
4984
5080
  });
4985
5081
 
4986
5082
  const _hoisted_1$p = { style: { "display": "flex", "margin-bottom": "10px" } };
4987
- const _hoisted_2$h = { style: { "flex": "1" } };
5083
+ const _hoisted_2$g = { style: { "flex": "1" } };
4988
5084
  const _hoisted_3$7 = { style: { "flex": "1" } };
4989
5085
  const _hoisted_4$7 = { class: "dialog-footer" };
4990
5086
  const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
@@ -5238,7 +5334,7 @@
5238
5334
  ]),
5239
5335
  default: vue.withCtx(() => [
5240
5336
  vue.createElementVNode("div", _hoisted_1$p, [
5241
- vue.createElementVNode("div", _hoisted_2$h, [
5337
+ vue.createElementVNode("div", _hoisted_2$g, [
5242
5338
  vue.createVNode(vue.unref(design.TMagicTag), {
5243
5339
  size: "small",
5244
5340
  type: "info"
@@ -5281,7 +5377,7 @@
5281
5377
  });
5282
5378
 
5283
5379
  const _hoisted_1$o = { class: "m-editor-data-source-methods" };
5284
- const _hoisted_2$g = { class: "m-editor-data-source-methods-footer" };
5380
+ const _hoisted_2$f = { class: "m-editor-data-source-methods-footer" };
5285
5381
  const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
5286
5382
  ...{
5287
5383
  name: "MFieldsDataSourceMethods"
@@ -5357,7 +5453,7 @@
5357
5453
  data: _ctx.model[_ctx.name],
5358
5454
  columns: methodColumns
5359
5455
  }, null, 8, ["data"]),
5360
- vue.createElementVNode("div", _hoisted_2$g, [
5456
+ vue.createElementVNode("div", _hoisted_2$f, [
5361
5457
  vue.createVNode(vue.unref(design.TMagicButton), {
5362
5458
  size: "small",
5363
5459
  type: "primary",
@@ -5387,7 +5483,7 @@
5387
5483
  });
5388
5484
 
5389
5485
  const _hoisted_1$n = { class: "m-fields-data-source-method-select" };
5390
- const _hoisted_2$f = { class: "data-source-method-select-container" };
5486
+ const _hoisted_2$e = { class: "data-source-method-select-container" };
5391
5487
  const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
5392
5488
  ...{
5393
5489
  name: "MFieldsDataSourceMethodSelect"
@@ -5475,7 +5571,7 @@
5475
5571
  };
5476
5572
  return (_ctx, _cache) => {
5477
5573
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
5478
- vue.createElementVNode("div", _hoisted_2$f, [
5574
+ vue.createElementVNode("div", _hoisted_2$e, [
5479
5575
  vue.createVNode(vue.unref(form.MContainer), {
5480
5576
  class: "select",
5481
5577
  config: cascaderConfig.value,
@@ -5519,7 +5615,7 @@
5519
5615
  });
5520
5616
 
5521
5617
  const _hoisted_1$m = { class: "m-editor-data-source-fields" };
5522
- const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
5618
+ const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
5523
5619
  const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
5524
5620
  ...{
5525
5621
  name: "MFieldsDataSourceMocks"
@@ -5729,7 +5825,7 @@
5729
5825
  data: _ctx.model[_ctx.name],
5730
5826
  columns
5731
5827
  }, null, 8, ["data"]),
5732
- vue.createElementVNode("div", _hoisted_2$e, [
5828
+ vue.createElementVNode("div", _hoisted_2$d, [
5733
5829
  vue.createVNode(vue.unref(design.TMagicButton), {
5734
5830
  size: "small",
5735
5831
  type: "primary",
@@ -5994,7 +6090,7 @@
5994
6090
  });
5995
6091
 
5996
6092
  const _hoisted_1$k = { class: "m-fields-event-select" };
5997
- const _hoisted_2$d = {
6093
+ const _hoisted_2$c = {
5998
6094
  key: 1,
5999
6095
  class: "fullWidth"
6000
6096
  };
@@ -6282,7 +6378,7 @@
6282
6378
  model: _ctx.model,
6283
6379
  config: tableConfig.value,
6284
6380
  onChange: onChangeHandler
6285
- }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d, [
6381
+ }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
6286
6382
  vue.createVNode(vue.unref(design.TMagicButton), {
6287
6383
  class: "create-button",
6288
6384
  type: "primary",
@@ -6338,9 +6434,9 @@
6338
6434
  xmlns: "http://www.w3.org/2000/svg",
6339
6435
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
6340
6436
  };
6341
- const _hoisted_2$c = /* @__PURE__ */ 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);
6437
+ const _hoisted_2$b = /* @__PURE__ */ 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);
6342
6438
  const _hoisted_4$6 = [
6343
- _hoisted_2$c
6439
+ _hoisted_2$b
6344
6440
  ];
6345
6441
  const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
6346
6442
  ...{
@@ -6355,7 +6451,7 @@
6355
6451
  });
6356
6452
 
6357
6453
  const _hoisted_1$i = { class: "m-fields-key-value" };
6358
- const _hoisted_2$b = { key: 0 };
6454
+ const _hoisted_2$a = { key: 0 };
6359
6455
  const _hoisted_3$6 = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
6360
6456
  const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
6361
6457
  ...{
@@ -6416,7 +6512,7 @@
6416
6512
  };
6417
6513
  return (_ctx, _cache) => {
6418
6514
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
6419
- !showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
6515
+ !showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
6420
6516
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
6421
6517
  return vue.openBlock(), vue.createElementBlock("div", {
6422
6518
  class: "m-fields-key-value-item",
@@ -6490,7 +6586,7 @@
6490
6586
  });
6491
6587
 
6492
6588
  const _hoisted_1$h = { class: "m-fields-page-fragment-select" };
6493
- const _hoisted_2$a = { class: "page-fragment-select-container" };
6589
+ const _hoisted_2$9 = { class: "page-fragment-select-container" };
6494
6590
  const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
6495
6591
  ...{
6496
6592
  name: "MFieldsPageFragmentSelect"
@@ -6538,7 +6634,7 @@
6538
6634
  return (_ctx, _cache) => {
6539
6635
  const _component_m_form_container = vue.resolveComponent("m-form-container");
6540
6636
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
6541
- vue.createElementVNode("div", _hoisted_2$a, [
6637
+ vue.createElementVNode("div", _hoisted_2$9, [
6542
6638
  vue.createVNode(_component_m_form_container, {
6543
6639
  class: "select",
6544
6640
  config: selectConfig,
@@ -6725,32 +6821,6 @@
6725
6821
  }
6726
6822
  });
6727
6823
 
6728
- const useGetSo = (target, emit) => {
6729
- let getso;
6730
- const isDraging = vue.ref(false);
6731
- vue.onMounted(() => {
6732
- if (!target.value) return;
6733
- getso = new Gesto(target.value, {
6734
- container: window,
6735
- pinchOutside: true
6736
- }).on("drag", (e) => {
6737
- if (!target.value) return;
6738
- emit("change", e);
6739
- }).on("dragStart", () => {
6740
- isDraging.value = true;
6741
- }).on("dragEnd", () => {
6742
- isDraging.value = false;
6743
- });
6744
- });
6745
- vue.onBeforeUnmount(() => {
6746
- getso?.unset();
6747
- isDraging.value = false;
6748
- });
6749
- return {
6750
- isDraging
6751
- };
6752
- };
6753
-
6754
6824
  const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
6755
6825
  ...{
6756
6826
  name: "MEditorResizer"
@@ -6937,7 +7007,7 @@
6937
7007
  key: 1,
6938
7008
  class: "menu-item-text"
6939
7009
  };
6940
- const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
7010
+ const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
6941
7011
  const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
6942
7012
  ...{
6943
7013
  name: "MEditorToolButton"
@@ -7074,7 +7144,7 @@
7074
7144
  })) : vue.createCommentVNode("", true)
7075
7145
  ]),
7076
7146
  default: vue.withCtx(() => [
7077
- vue.createElementVNode("span", _hoisted_2$9, [
7147
+ vue.createElementVNode("span", _hoisted_2$8, [
7078
7148
  vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
7079
7149
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
7080
7150
  default: vue.withCtx(() => [
@@ -7319,8 +7389,9 @@
7319
7389
  vue.createVNode(vue.unref(design.TMagicPopover), {
7320
7390
  "popper-class": "page-bar-popover",
7321
7391
  placement: "top",
7392
+ trigger: "hover",
7322
7393
  width: 160,
7323
- trigger: "hover"
7394
+ "destroy-on-close": true
7324
7395
  }, {
7325
7396
  reference: vue.withCtx(() => [
7326
7397
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "m-editor-page-list-menu-icon" }, {
@@ -7398,7 +7469,7 @@
7398
7469
  });
7399
7470
 
7400
7471
  const _hoisted_1$c = { class: "m-editor-page-bar-tabs" };
7401
- const _hoisted_2$8 = ["page-id", "onClick"];
7472
+ const _hoisted_2$7 = ["page-id", "onClick"];
7402
7473
  const _hoisted_3$5 = { class: "m-editor-page-bar-title" };
7403
7474
  const _hoisted_4$5 = ["title"];
7404
7475
  const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
@@ -7517,8 +7588,9 @@
7517
7588
  vue.createVNode(vue.unref(design.TMagicPopover), {
7518
7589
  "popper-class": "page-bar-popover",
7519
7590
  placement: "top",
7591
+ trigger: "hover",
7520
7592
  width: 160,
7521
- trigger: "hover"
7593
+ "destroy-on-close": true
7522
7594
  }, {
7523
7595
  reference: vue.withCtx(() => [
7524
7596
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
@@ -7552,7 +7624,7 @@
7552
7624
  ]),
7553
7625
  _: 2
7554
7626
  }, 1024)
7555
- ], 10, _hoisted_2$8);
7627
+ ], 10, _hoisted_2$7);
7556
7628
  }), 128))
7557
7629
  ]),
7558
7630
  _: 3
@@ -7563,7 +7635,7 @@
7563
7635
  });
7564
7636
 
7565
7637
  const _hoisted_1$b = { class: "m-editor-empty-panel" };
7566
- const _hoisted_2$7 = { class: "m-editor-empty-content" };
7638
+ const _hoisted_2$6 = { class: "m-editor-empty-content" };
7567
7639
  const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
7568
7640
  const _hoisted_4$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面片", -1);
7569
7641
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
@@ -7589,7 +7661,7 @@
7589
7661
  };
7590
7662
  return (_ctx, _cache) => {
7591
7663
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
7592
- vue.createElementVNode("div", _hoisted_2$7, [
7664
+ vue.createElementVNode("div", _hoisted_2$6, [
7593
7665
  vue.createElementVNode("div", {
7594
7666
  class: "m-editor-empty-button",
7595
7667
  onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(vue.unref(schema.NodeType).PAGE))
@@ -8114,7 +8186,7 @@
8114
8186
  });
8115
8187
 
8116
8188
  const _hoisted_1$9 = ["draggable", "data-node-id", "data-parent-id", "data-parents-id", "data-is-container"];
8117
- const _hoisted_2$6 = { class: "tree-node-label" };
8189
+ const _hoisted_2$5 = { class: "tree-node-label" };
8118
8190
  const _hoisted_3$3 = { class: "tree-node-tool" };
8119
8191
  const _hoisted_4$3 = {
8120
8192
  key: 0,
@@ -8204,7 +8276,7 @@
8204
8276
  onClick: nodeClickHandler
8205
8277
  }, [
8206
8278
  vue.renderSlot(_ctx.$slots, "tree-node-content", { data: _ctx.data }, () => [
8207
- vue.createElementVNode("div", _hoisted_2$6, [
8279
+ vue.createElementVNode("div", _hoisted_2$5, [
8208
8280
  vue.renderSlot(_ctx.$slots, "tree-node-label", { data: _ctx.data }, () => [
8209
8281
  vue.createTextVNode(vue.toDisplayString(`${_ctx.data.name} (${_ctx.data.id})`), 1)
8210
8282
  ])
@@ -8298,76 +8370,6 @@
8298
8370
  }
8299
8371
  });
8300
8372
 
8301
- const useFilter = (nodeData, nodeStatusMap, filterNodeMethod) => {
8302
- const filterIsMatch = (value, data) => {
8303
- const string = !Array.isArray(value) ? [value] : value;
8304
- if (!string.length) {
8305
- return true;
8306
- }
8307
- return string.some((v) => filterNodeMethod(v, data));
8308
- };
8309
- const filter = (text) => {
8310
- if (!nodeData.value.length) return;
8311
- nodeData.value.forEach((node) => {
8312
- traverseNode(node, (node2, parents) => {
8313
- if (!nodeStatusMap.value) return;
8314
- const visible = filterIsMatch(text, node2);
8315
- if (visible && parents.length) {
8316
- parents.forEach((parent) => {
8317
- updateStatus(nodeStatusMap.value, parent.id, {
8318
- visible,
8319
- expand: true
8320
- });
8321
- });
8322
- }
8323
- updateStatus(nodeStatusMap.value, node2.id, {
8324
- visible
8325
- });
8326
- });
8327
- });
8328
- };
8329
- return {
8330
- filterText: vue.ref(""),
8331
- filterTextChangeHandler(text) {
8332
- filter(text);
8333
- }
8334
- };
8335
- };
8336
-
8337
- const createPageNodeStatus$1 = (nodeData, initialLayerNodeStatus) => {
8338
- const map = /* @__PURE__ */ new Map();
8339
- nodeData.forEach(
8340
- (node) => traverseNode(node, (node2) => {
8341
- map.set(
8342
- node2.id,
8343
- initialLayerNodeStatus?.get(node2.id) || {
8344
- visible: true,
8345
- expand: false,
8346
- selected: false,
8347
- draggable: false
8348
- }
8349
- );
8350
- })
8351
- );
8352
- return map;
8353
- };
8354
- const useNodeStatus$1 = (nodeData) => {
8355
- const nodeStatusMap = vue.ref(/* @__PURE__ */ new Map());
8356
- vue.watch(
8357
- nodeData,
8358
- (nodeData2) => {
8359
- nodeStatusMap.value = createPageNodeStatus$1(nodeData2, nodeStatusMap.value);
8360
- },
8361
- {
8362
- immediate: true,
8363
- deep: true
8364
- }
8365
- );
8366
- return {
8367
- nodeStatusMap
8368
- };
8369
- };
8370
-
8371
8373
  const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
8372
8374
  ...{
8373
8375
  name: "MEditorCodeBlockList"
@@ -8851,7 +8853,6 @@
8851
8853
  });
8852
8854
 
8853
8855
  const _hoisted_1$6 = { class: "search-wrapper" };
8854
- const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
8855
8856
  const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
8856
8857
  ...{
8857
8858
  name: "MEditorDataSourceListPanel"
@@ -8900,7 +8901,10 @@
8900
8901
  vue.createVNode(_sfc_main$o, { onSearch: filterTextChangeHandler }),
8901
8902
  vue.unref(editable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
8902
8903
  key: 0,
8903
- placement: "right"
8904
+ placement: "right",
8905
+ trigger: "hover",
8906
+ "popper-class": "data-source-list-panel-add-menu",
8907
+ "destroy-on-close": true
8904
8908
  }, {
8905
8909
  reference: vue.withCtx(() => [
8906
8910
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -8914,20 +8918,18 @@
8914
8918
  })
8915
8919
  ]),
8916
8920
  default: vue.withCtx(() => [
8917
- vue.createElementVNode("div", _hoisted_2$5, [
8918
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
8919
- return vue.openBlock(), vue.createBlock(_sfc_main$y, {
8920
- data: {
8921
- type: "button",
8922
- text: item.text,
8923
- handler: () => {
8924
- addHandler(item.type);
8925
- }
8926
- },
8927
- key: index
8928
- }, null, 8, ["data"]);
8929
- }), 128))
8930
- ])
8921
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
8922
+ return vue.openBlock(), vue.createBlock(_sfc_main$y, {
8923
+ data: {
8924
+ type: "button",
8925
+ text: item.text,
8926
+ handler: () => {
8927
+ addHandler(item.type);
8928
+ }
8929
+ },
8930
+ key: index
8931
+ }, null, 8, ["data"]);
8932
+ }), 128))
8931
8933
  ]),
8932
8934
  _: 1
8933
8935
  })) : vue.createCommentVNode("", true),
@@ -10086,7 +10088,22 @@
10086
10088
  const props = __props;
10087
10089
  const services = vue.inject("services");
10088
10090
  const columnLeftWidth = vue.computed(() => services?.uiService.get("columnWidth")[ColumnLayout.LEFT] || 0);
10089
- const { height: columnLeftHeight } = useEditorContentHeight();
10091
+ const { height: editorContentHeight } = useEditorContentHeight();
10092
+ const columnLeftHeight = vue.ref(0);
10093
+ const unWatchEditorContentHeight = vue.watch(
10094
+ editorContentHeight,
10095
+ (height) => {
10096
+ if (height) {
10097
+ columnLeftHeight.value = height * 0.5;
10098
+ vue.nextTick().then(() => {
10099
+ unWatchEditorContentHeight();
10100
+ });
10101
+ }
10102
+ },
10103
+ {
10104
+ immediate: true
10105
+ }
10106
+ );
10090
10107
  const activeTabName = vue.ref(props.data?.status);
10091
10108
  const getItemConfig = (data) => {
10092
10109
  const map = {
@@ -10340,8 +10357,8 @@
10340
10357
  key: config.$key ?? index,
10341
10358
  visible: vue.unref(floatBoxStates)[config.$key].status,
10342
10359
  "onUpdate:visible": ($event) => vue.unref(floatBoxStates)[config.$key].status = $event,
10343
- height: vue.unref(columnLeftHeight),
10344
- "onUpdate:height": _cache[1] || (_cache[1] = ($event) => vue.isRef(columnLeftHeight) ? columnLeftHeight.value = $event : null),
10360
+ height: columnLeftHeight.value,
10361
+ "onUpdate:height": _cache[1] || (_cache[1] = ($event) => columnLeftHeight.value = $event),
10345
10362
  width: columnLeftWidth.value,
10346
10363
  title: config.text,
10347
10364
  position: {
@@ -12723,6 +12740,8 @@
12723
12740
  exports.TMagicCodeEditor = _sfc_main$X;
12724
12741
  exports.TMagicEditor = _sfc_main;
12725
12742
  exports.ToolButton = _sfc_main$y;
12743
+ exports.Tree = _sfc_main$m;
12744
+ exports.TreeNode = _sfc_main$n;
12726
12745
  exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
12727
12746
  exports.UndoRedo = UndoRedo;
12728
12747
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
@@ -12782,7 +12801,11 @@
12782
12801
  exports.useCodeBlockEdit = useCodeBlockEdit;
12783
12802
  exports.useDataSourceMethod = useDataSourceMethod;
12784
12803
  exports.useEditorContentHeight = useEditorContentHeight;
12804
+ exports.useFilter = useFilter;
12785
12805
  exports.useFloatBox = useFloatBox;
12806
+ exports.useGetSo = useGetSo;
12807
+ exports.useNextFloatBoxPosition = useNextFloatBoxPosition;
12808
+ exports.useNodeStatus = useNodeStatus$1;
12786
12809
  exports.useStage = useStage;
12787
12810
  exports.useWindowRect = useWindowRect;
12788
12811
  exports.warn = warn;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.0-beta.0",
2
+ "version": "1.5.0-beta.2",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -55,8 +55,8 @@
55
55
  "moveable": "^0.53.0",
56
56
  "serialize-javascript": "^6.0.0",
57
57
  "sortablejs": "^1.15.2",
58
- "@tmagic/dep": "1.5.0-beta.0",
59
- "@tmagic/table": "1.5.0-beta.0"
58
+ "@tmagic/dep": "1.5.0-beta.2",
59
+ "@tmagic/table": "1.5.0-beta.2"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/events": "^3.0.0",
@@ -77,12 +77,12 @@
77
77
  "monaco-editor": "^0.48.0",
78
78
  "typescript": "*",
79
79
  "vue": "^3.4.35",
80
- "@tmagic/form": "1.5.0-beta.0",
81
- "@tmagic/core": "1.5.0-beta.0",
82
- "@tmagic/schema": "1.5.0-beta.0",
83
- "@tmagic/stage": "1.5.0-beta.0",
84
- "@tmagic/design": "1.5.0-beta.0",
85
- "@tmagic/utils": "1.5.0-beta.0"
80
+ "@tmagic/form": "1.5.0-beta.2",
81
+ "@tmagic/schema": "1.5.0-beta.2",
82
+ "@tmagic/design": "1.5.0-beta.2",
83
+ "@tmagic/stage": "1.5.0-beta.2",
84
+ "@tmagic/core": "1.5.0-beta.2",
85
+ "@tmagic/utils": "1.5.0-beta.2"
86
86
  },
87
87
  "peerDependenciesMeta": {
88
88
  "typescript": {
package/src/Editor.vue CHANGED
@@ -141,7 +141,15 @@ import uiService from './services/ui';
141
141
  import keybindingConfig from './utils/keybinding-config';
142
142
  import { defaultEditorProps, EditorProps } from './editorProps';
143
143
  import { initServiceEvents, initServiceState } from './initService';
144
- import type { EventBus, FrameworkSlots, PropsPanelSlots, Services, SidebarSlots, WorkspaceSlots } from './type';
144
+ import type {
145
+ EventBus,
146
+ FrameworkSlots,
147
+ PropsPanelSlots,
148
+ Services,
149
+ SidebarSlots,
150
+ StageOptions,
151
+ WorkspaceSlots,
152
+ } from './type';
145
153
 
146
154
  defineSlots<
147
155
  FrameworkSlots &
@@ -186,7 +194,7 @@ initServiceState(props, services);
186
194
  keybindingService.register(keybindingConfig);
187
195
  keybindingService.registerEl('global');
188
196
 
189
- const stageOptions = {
197
+ const stageOptions: StageOptions = {
190
198
  runtimeUrl: props.runtimeUrl,
191
199
  autoScrollIntoView: props.autoScrollIntoView,
192
200
  render: props.render,