@tmagic/editor 1.2.0-beta.17 → 1.2.0-beta.19

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('@tmagic/form'), require('keycon')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', '@tmagic/form', 'keycon'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.schema, global.iconsVue, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.form, global.KeyController));
5
- })(this, (function (exports, vue, serialize, lodashEs, schema, iconsVue, design, monaco, StageCore, Gesto, utils, events, core, form, KeyController) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('serialize-javascript'), require('lodash-es'), require('@tmagic/form'), require('@tmagic/schema'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('monaco-editor'), require('@tmagic/stage'), require('gesto'), require('@tmagic/utils'), require('events'), require('@tmagic/core'), require('keycon')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'serialize-javascript', 'lodash-es', '@tmagic/form', '@tmagic/schema', '@element-plus/icons-vue', '@tmagic/design', 'monaco-editor', '@tmagic/stage', 'gesto', '@tmagic/utils', 'events', '@tmagic/core', 'keycon'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.lodashEs, global.form, global.schema, global.iconsVue, global.design, global.monaco, global.StageCore, global.Gesto, global.utils, global.events, global.core, global.KeyController));
5
+ })(this, (function (exports, vue, serialize, lodashEs, form, schema, iconsVue, design, monaco, StageCore, Gesto, utils, events, core, KeyController) { 'use strict';
6
6
 
7
7
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
8
8
 
@@ -153,6 +153,7 @@
153
153
  setup(__props, { emit }) {
154
154
  const props = __props;
155
155
  const services = vue.inject("services");
156
+ const mForm = vue.inject("mForm");
156
157
  const codeDsl = vue.computed(() => services?.codeBlockService.getCodeDslSync());
157
158
  const tableConfig = vue.computed(() => {
158
159
  const defaultConfig = {
@@ -183,7 +184,15 @@
183
184
  name: "params",
184
185
  label: "\u53C2\u6570",
185
186
  defaultValue: {},
186
- itemsFunction: (row) => getParamsConfig(row.codeId)
187
+ itemsFunction: (row) => {
188
+ const paramsConfig = getParamsConfig(row.codeId);
189
+ if (!row.params)
190
+ row.params = {};
191
+ if (lodashEs.isEmpty(row.params)) {
192
+ form.createValues(mForm, paramsConfig, {}, row.params);
193
+ }
194
+ return paramsConfig;
195
+ }
187
196
  }
188
197
  ]
189
198
  };
@@ -1168,6 +1177,7 @@
1168
1177
  this.state.pageSteps[this.state.pageId] = undoRedo;
1169
1178
  }
1170
1179
  this.setCanUndoRedo();
1180
+ this.emit("page-change", this.state.pageSteps[this.state.pageId]);
1171
1181
  }
1172
1182
  empty() {
1173
1183
  this.state.pageId = void 0;
@@ -1498,7 +1508,7 @@
1498
1508
  this.setPropsValue(utils.toLine(type), values[type]);
1499
1509
  });
1500
1510
  }
1501
- setPropsValue(type, value) {
1511
+ async setPropsValue(type, value) {
1502
1512
  this.state.propsValueMap[type] = value;
1503
1513
  }
1504
1514
  async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
@@ -2583,7 +2593,7 @@
2583
2593
  stage.on("highlight", (el) => {
2584
2594
  editorService.highlight(el.id);
2585
2595
  });
2586
- stage.on("multiSelect", (els) => {
2596
+ stage.on("multi-select", (els) => {
2587
2597
  editorService.multiSelect(els.map((el) => el.id));
2588
2598
  });
2589
2599
  stage.on("update", (ev) => {
@@ -2603,7 +2613,7 @@
2603
2613
  editorService.select(parent);
2604
2614
  editorService.get("stage").select(parent.id);
2605
2615
  });
2606
- stage.on("changeGuides", (e) => {
2616
+ stage.on("change-guides", (e) => {
2607
2617
  uiService.set("showGuides", true);
2608
2618
  if (!root.value || !page.value)
2609
2619
  return;
@@ -5480,6 +5490,14 @@
5480
5490
  runtime.updateRootConfig?.(lodashEs.cloneDeep(vue.toRaw(root2)));
5481
5491
  }
5482
5492
  });
5493
+ vue.watch(page, (page2) => {
5494
+ if (runtime && page2) {
5495
+ runtime.updatePageId?.(page2.id);
5496
+ vue.nextTick(() => {
5497
+ stage?.select(page2.id);
5498
+ });
5499
+ }
5500
+ });
5483
5501
  const resizeObserver = new ResizeObserver((entries) => {
5484
5502
  for (const { contentRect } of entries) {
5485
5503
  services?.uiService.set("stageContainerRect", {
@@ -5701,10 +5719,10 @@
5701
5719
  }, [
5702
5720
  vue.createVNode(_sfc_main$8),
5703
5721
  vue.renderSlot(_ctx.$slots, "stage", {}, () => [
5704
- (vue.openBlock(), vue.createBlock(_sfc_main$2, {
5705
- key: vue.unref(page)?.id,
5722
+ vue.unref(page) ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
5723
+ key: 0,
5706
5724
  "stage-content-menu": __props.stageContentMenu
5707
- }, null, 8, ["stage-content-menu"]))
5725
+ }, null, 8, ["stage-content-menu"])) : vue.createCommentVNode("", true)
5708
5726
  ]),
5709
5727
  vue.renderSlot(_ctx.$slots, "workspace-content"),
5710
5728
  vue.createVNode(_sfc_main$6, null, {
@@ -5763,6 +5781,10 @@
5763
5781
  sidebar: {
5764
5782
  type: Object
5765
5783
  },
5784
+ menu: {
5785
+ type: Object,
5786
+ default: () => ({ left: [], right: [] })
5787
+ },
5766
5788
  layerContentMenu: {
5767
5789
  type: Array,
5768
5790
  default: () => []
@@ -5771,10 +5793,6 @@
5771
5793
  type: Array,
5772
5794
  default: () => []
5773
5795
  },
5774
- menu: {
5775
- type: Object,
5776
- default: () => ({ left: [], right: [] })
5777
- },
5778
5796
  render: {
5779
5797
  type: Function
5780
5798
  },
@@ -5808,7 +5826,7 @@
5808
5826
  },
5809
5827
  containerHighlightClassName: {
5810
5828
  type: String,
5811
- default: StageCore.CONTAINER_HIGHLIGHT_CLASS
5829
+ default: StageCore.CONTAINER_HIGHLIGHT_CLASS_NAME
5812
5830
  },
5813
5831
  containerHighlightDuration: {
5814
5832
  type: Number,