@tmagic/editor 1.3.0-alpha.11 → 1.3.0-alpha.13

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.
@@ -192,7 +192,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
192
192
  }
193
193
  });
194
194
 
195
- const _hoisted_1$p = ["src"];
195
+ const _hoisted_1$q = ["src"];
196
196
  const _sfc_main$E = /* @__PURE__ */ defineComponent({
197
197
  ...{
198
198
  name: "MEditorIcon"
@@ -216,7 +216,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
216
216
  class: "magic-editor-icon"
217
217
  }, {
218
218
  default: withCtx(() => [
219
- createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$p)
219
+ createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$q)
220
220
  ]),
221
221
  _: 1
222
222
  })) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
@@ -235,7 +235,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
235
235
  }
236
236
  });
237
237
 
238
- const _hoisted_1$o = { class: "m-fields-code-select-col" };
238
+ const _hoisted_1$p = { class: "m-fields-code-select-col" };
239
239
  const _hoisted_2$f = { class: "code-select-container" };
240
240
  const _sfc_main$D = /* @__PURE__ */ defineComponent({
241
241
  ...{
@@ -329,7 +329,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
329
329
  };
330
330
  return (_ctx, _cache) => {
331
331
  const _component_m_form_container = resolveComponent("m-form-container");
332
- return openBlock(), createElementBlock("div", _hoisted_1$o, [
332
+ return openBlock(), createElementBlock("div", _hoisted_1$p, [
333
333
  createElementVNode("div", _hoisted_2$f, [
334
334
  createVNode(_component_m_form_container, {
335
335
  class: "select",
@@ -353,7 +353,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
353
353
  }
354
354
  });
355
355
 
356
- const _hoisted_1$n = { class: "m-editor-data-source-fields" };
356
+ const _hoisted_1$o = { class: "m-editor-data-source-fields" };
357
357
  const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
358
358
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
359
359
  ...{
@@ -501,7 +501,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
501
501
  }
502
502
  ];
503
503
  return (_ctx, _cache) => {
504
- return openBlock(), createElementBlock("div", _hoisted_1$n, [
504
+ return openBlock(), createElementBlock("div", _hoisted_1$o, [
505
505
  createVNode(unref(MagicTable), {
506
506
  data: _ctx.model[_ctx.name],
507
507
  columns: filedColumns
@@ -534,7 +534,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
534
534
  }
535
535
  });
536
536
 
537
- const _hoisted_1$m = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
537
+ const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
538
538
  const _hoisted_2$d = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
539
539
  const _hoisted_3$6 = { class: "el-input__inner" };
540
540
  const _sfc_main$B = /* @__PURE__ */ defineComponent({
@@ -759,7 +759,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
759
759
  createVNode(_sfc_main$E, { icon: unref(Coin) }, null, 8, ["icon"])
760
760
  ]),
761
761
  default: withCtx(({ item }) => [
762
- createElementVNode("div", _hoisted_1$m, [
762
+ createElementVNode("div", _hoisted_1$n, [
763
763
  createElementVNode("div", null, toDisplayString(item.text), 1),
764
764
  createElementVNode("span", _hoisted_2$d, toDisplayString(item.value), 1)
765
765
  ])
@@ -855,7 +855,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
855
855
  }
856
856
  });
857
857
 
858
- const _hoisted_1$l = { class: "m-fields-event-select" };
858
+ const _hoisted_1$m = { class: "m-fields-event-select" };
859
859
  const _hoisted_2$c = {
860
860
  key: 1,
861
861
  class: "fullWidth"
@@ -1022,7 +1022,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1022
1022
  const _component_m_form_table = resolveComponent("m-form-table");
1023
1023
  const _component_m_form_container = resolveComponent("m-form-container");
1024
1024
  const _component_m_form_panel = resolveComponent("m-form-panel");
1025
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
1025
+ return openBlock(), createElementBlock("div", _hoisted_1$m, [
1026
1026
  isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
1027
1027
  key: 0,
1028
1028
  ref: "eventForm",
@@ -1073,7 +1073,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1073
1073
  }
1074
1074
  });
1075
1075
 
1076
- const _hoisted_1$k = { class: "m-fields-key-value" };
1076
+ const _hoisted_1$l = { class: "m-fields-key-value" };
1077
1077
  const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
1078
1078
  const _sfc_main$y = /* @__PURE__ */ defineComponent({
1079
1079
  ...{
@@ -1118,7 +1118,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1118
1118
  records.value.splice(index, 1);
1119
1119
  };
1120
1120
  return (_ctx, _cache) => {
1121
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
1121
+ return openBlock(), createElementBlock("div", _hoisted_1$l, [
1122
1122
  (openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
1123
1123
  return openBlock(), createElementBlock("div", {
1124
1124
  class: "m-fields-key-value-item",
@@ -1169,6 +1169,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1169
1169
  }
1170
1170
  });
1171
1171
 
1172
+ const _hoisted_1$k = {
1173
+ key: 1,
1174
+ class: "m-fields-ui-select",
1175
+ style: { "display": "flex" }
1176
+ };
1172
1177
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
1173
1178
  ...{
1174
1179
  name: "MEditorUISelect"
@@ -1222,6 +1227,18 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1222
1227
  mForm?.$emit("field-change", props.prop, "");
1223
1228
  }
1224
1229
  };
1230
+ const selectNode = async (id) => {
1231
+ await services?.editorService.select(id);
1232
+ services?.editorService.get("stage")?.select(id);
1233
+ };
1234
+ const highlight = throttle((id) => {
1235
+ services?.editorService.highlight(id);
1236
+ services?.editorService.get("stage")?.highlight(id);
1237
+ }, 150);
1238
+ const unhightlight = () => {
1239
+ services?.editorService.set("highlightNode", null);
1240
+ services?.editorService.get("stage")?.clearHighlight();
1241
+ };
1225
1242
  return (_ctx, _cache) => {
1226
1243
  return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
1227
1244
  key: 0,
@@ -1239,43 +1256,62 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1239
1256
  ]),
1240
1257
  _: 1
1241
1258
  }, 8, ["icon"])
1242
- ])) : (openBlock(), createElementBlock("div", {
1243
- key: 1,
1244
- class: "m-fields-ui-select",
1245
- onClick: startSelect,
1246
- style: { "display": "flex" }
1247
- }, [
1248
- val.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
1249
- key: 0,
1250
- content: "清除"
1251
- }, {
1252
- default: withCtx(() => [
1253
- createVNode(unref(TMagicButton), {
1254
- style: { "padding": "0" },
1255
- type: "danger",
1256
- icon: unref(Close),
1257
- text: "",
1258
- onClick: withModifiers(deleteHandler, ["stop"])
1259
- }, null, 8, ["icon", "onClick"])
1260
- ]),
1261
- _: 1
1262
- })) : createCommentVNode("", true),
1263
- createVNode(unref(TMagicTooltip), {
1264
- content: val.value ? toName.value + "_" + val.value : "点击此处选择"
1259
+ ])) : (openBlock(), createElementBlock("div", _hoisted_1$k, [
1260
+ val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1261
+ createVNode(unref(TMagicTooltip), {
1262
+ content: "清除",
1263
+ placement: "top"
1264
+ }, {
1265
+ default: withCtx(() => [
1266
+ createVNode(unref(TMagicButton), {
1267
+ style: { "padding": "0" },
1268
+ type: "danger",
1269
+ icon: unref(Close),
1270
+ text: "",
1271
+ onClick: withModifiers(deleteHandler, ["stop"])
1272
+ }, null, 8, ["icon", "onClick"])
1273
+ ]),
1274
+ _: 1
1275
+ }),
1276
+ createVNode(unref(TMagicTooltip), {
1277
+ content: "点击选中组件",
1278
+ placement: "top"
1279
+ }, {
1280
+ default: withCtx(() => [
1281
+ createVNode(unref(TMagicButton), {
1282
+ text: "",
1283
+ style: { "padding": "0", "margin": "0" },
1284
+ onClick: _cache[0] || (_cache[0] = ($event) => selectNode(val.value)),
1285
+ onMouseenter: _cache[1] || (_cache[1] = ($event) => unref(highlight)(val.value)),
1286
+ onMouseleave: unhightlight
1287
+ }, {
1288
+ default: withCtx(() => [
1289
+ createTextVNode(toDisplayString(`${toName.value}_${val.value}`), 1)
1290
+ ]),
1291
+ _: 1
1292
+ })
1293
+ ]),
1294
+ _: 1
1295
+ })
1296
+ ], 64)) : (openBlock(), createBlock(unref(TMagicTooltip), {
1297
+ key: 1,
1298
+ content: "点击此处选择",
1299
+ placement: "top"
1265
1300
  }, {
1266
1301
  default: withCtx(() => [
1267
1302
  createVNode(unref(TMagicButton), {
1268
1303
  text: "",
1269
- style: { "padding": "0", "margin": "0" }
1304
+ style: { "padding": "0", "margin": "0" },
1305
+ onClick: startSelect
1270
1306
  }, {
1271
1307
  default: withCtx(() => [
1272
- createTextVNode(toDisplayString(val.value ? toName.value + "_" + val.value : "点击此处选择"), 1)
1308
+ createTextVNode("点击此处选择")
1273
1309
  ]),
1274
1310
  _: 1
1275
1311
  })
1276
1312
  ]),
1277
1313
  _: 1
1278
- }, 8, ["content"])
1314
+ }))
1279
1315
  ]));
1280
1316
  };
1281
1317
  }
@@ -4660,11 +4696,16 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
4660
4696
  const editCode = async (key) => {
4661
4697
  codeBlockService?.setCodeEditorContent(true, key);
4662
4698
  };
4663
- const deleteCode = (key) => {
4699
+ const deleteCode = async (key) => {
4664
4700
  const currentCode = codeList.value.find((codeItem) => codeItem.id === key);
4665
4701
  const existBinds = Boolean(currentCode?.children.length);
4666
4702
  const undeleteableList = codeBlockService?.getUndeletableList() || [];
4667
4703
  if (!existBinds && !undeleteableList.includes(key)) {
4704
+ await tMagicMessageBox.confirm("确定删除该代码块吗?", "提示", {
4705
+ confirmButtonText: "确定",
4706
+ cancelButtonText: "取消",
4707
+ type: "warning"
4708
+ });
4668
4709
  codeBlockService?.deleteCodeDslByIds([key]);
4669
4710
  } else {
4670
4711
  if (typeof props.customError === "function") {
@@ -5109,7 +5150,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
5109
5150
  const dragstartHandler = ({ text, type, data = {} }, e) => {
5110
5151
  if (e.dataTransfer) {
5111
5152
  e.dataTransfer.setData(
5112
- "text/html",
5153
+ "text/json",
5113
5154
  serialize({
5114
5155
  name: text,
5115
5156
  type,
@@ -6892,7 +6933,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6892
6933
  }
6893
6934
  if (e.dataTransfer && parent && stageContainer.value && stage) {
6894
6935
  const parseDSL = getConfig("parseDSL");
6895
- const data = e.dataTransfer.getData("text/html");
6936
+ const data = e.dataTransfer.getData("text/json");
6896
6937
  if (!data)
6897
6938
  return;
6898
6939
  const config = parseDSL(`(${data})`);