@tmagic/editor 1.7.14-beta.0 → 1.7.14-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.
@@ -5146,10 +5146,10 @@
5146
5146
  const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
5147
5147
  if (item === null) return null;
5148
5148
  switch (protocol) {
5149
- case Protocol.OBJECT: return getEditorConfig("parseDSL")(`(${item})`);
5150
- case Protocol.JSON: return JSON.parse(item);
5151
- case Protocol.NUMBER: return Number(item);
5152
- case Protocol.BOOLEAN:
5149
+ case "object": return getEditorConfig("parseDSL")(`(${item})`);
5150
+ case "json": return JSON.parse(item);
5151
+ case "number": return Number(item);
5152
+ case "boolean":
5153
5153
  if (item === "true") return true;
5154
5154
  if (item === "false") return false;
5155
5155
  default: return item;
@@ -5177,7 +5177,7 @@
5177
5177
  const namespace = this.getNamespace();
5178
5178
  let item = value;
5179
5179
  const protocol = options.protocol ? `${options.protocol}:` : "";
5180
- if (typeof value === Protocol.STRING || typeof value === Protocol.NUMBER) item = `${protocol}${value}`;
5180
+ if (typeof value === "string" || typeof value === "number") item = `${protocol}${value}`;
5181
5181
  else item = `${protocol}${(0, serialize_javascript.default)(value)}`;
5182
5182
  storage.setItem(`${options.namespace || namespace}:${key}`, item);
5183
5183
  }
@@ -7674,7 +7674,7 @@
7674
7674
  var SplitView_default = SplitView_vue_vue_type_script_setup_true_lang_default;
7675
7675
  //#endregion
7676
7676
  //#region packages/editor/src/components/Icon.vue?vue&type=script&setup=true&lang.ts
7677
- var _hoisted_1$63 = ["src"];
7677
+ var _hoisted_1$64 = ["src"];
7678
7678
  var Icon_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
7679
7679
  name: "MEditorIcon",
7680
7680
  __name: "Icon",
@@ -7692,7 +7692,7 @@
7692
7692
  key: 1,
7693
7693
  class: "magic-editor-icon"
7694
7694
  }, {
7695
- default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("img", { src: __props.icon }, null, 8, _hoisted_1$63)]),
7695
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("img", { src: __props.icon }, null, 8, _hoisted_1$64)]),
7696
7696
  _: 1
7697
7697
  })) : typeof __props.icon === "string" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("i", {
7698
7698
  key: 2,
@@ -7712,7 +7712,7 @@
7712
7712
  var Icon_default = Icon_vue_vue_type_script_setup_true_lang_default;
7713
7713
  //#endregion
7714
7714
  //#region packages/editor/src/components/ToolButton.vue?vue&type=script&setup=true&lang.ts
7715
- var _hoisted_1$62 = {
7715
+ var _hoisted_1$63 = {
7716
7716
  key: 1,
7717
7717
  class: "menu-item-text"
7718
7718
  };
@@ -7727,9 +7727,11 @@
7727
7727
  }) },
7728
7728
  eventType: { default: "click" }
7729
7729
  },
7730
- setup(__props) {
7730
+ setup(__props, { expose: __expose }) {
7731
7731
  const props = __props;
7732
7732
  const services = useServices();
7733
+ const rootElRef = (0, vue.useTemplateRef)("rootEl");
7734
+ const getElRef = () => rootElRef;
7733
7735
  const disabled = (0, vue.computed)(() => {
7734
7736
  if (typeof props.data === "string") return false;
7735
7737
  if (props.data.type === "component") return false;
@@ -7761,9 +7763,11 @@
7761
7763
  if (props.eventType !== "mouseup") return;
7762
7764
  if (item.type === "button" && event.button === 0) buttonHandler(item, event);
7763
7765
  };
7766
+ __expose({ getElRef });
7764
7767
  return (_ctx, _cache) => {
7765
7768
  return display.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
7766
7769
  key: 0,
7770
+ ref: "rootEl",
7767
7771
  class: (0, vue.normalizeClass)(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
7768
7772
  onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(__props.data, $event)),
7769
7773
  onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
@@ -7771,7 +7775,7 @@
7771
7775
  }, [__props.data.type === "divider" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicDivider), {
7772
7776
  key: 0,
7773
7777
  direction: __props.data.direction || "vertical"
7774
- }, null, 8, ["direction"])) : __props.data.type === "text" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$62, (0, vue.toDisplayString)(__props.data.text), 1)) : __props.data.type === "button" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [__props.data.tooltip ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
7778
+ }, null, 8, ["direction"])) : __props.data.type === "text" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$63, (0, vue.toDisplayString)(__props.data.text), 1)) : __props.data.type === "button" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [__props.data.tooltip ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
7775
7779
  key: 0,
7776
7780
  effect: "dark",
7777
7781
  placement: "bottom-start",
@@ -7840,7 +7844,7 @@
7840
7844
  var ToolButton_default = ToolButton_vue_vue_type_script_setup_true_lang_default;
7841
7845
  //#endregion
7842
7846
  //#region packages/editor/src/layouts/page-bar/AddButton.vue?vue&type=script&setup=true&lang.ts
7843
- var _hoisted_1$61 = {
7847
+ var _hoisted_1$62 = {
7844
7848
  key: 0,
7845
7849
  id: "m-editor-page-bar-add-icon",
7846
7850
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
@@ -7866,7 +7870,7 @@
7866
7870
  editorService.add(pageConfig);
7867
7871
  };
7868
7872
  return (_ctx, _cache) => {
7869
- return showAddPageButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$61, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
7873
+ return showAddPageButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$62, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
7870
7874
  reference: (0, vue.withCtx)(() => [(0, vue.createVNode)(Icon_default, { icon: (0, vue.unref)(_element_plus_icons_vue.Plus) }, null, 8, ["icon"])]),
7871
7875
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)(ToolButton_default, { data: {
7872
7876
  type: "button",
@@ -7891,7 +7895,7 @@
7891
7895
  var AddButton_default = AddButton_vue_vue_type_script_setup_true_lang_default;
7892
7896
  //#endregion
7893
7897
  //#region packages/editor/src/layouts/page-bar/PageBarScrollContainer.vue?vue&type=script&setup=true&lang.ts
7894
- var _hoisted_1$60 = {
7898
+ var _hoisted_1$61 = {
7895
7899
  class: "m-editor-page-bar",
7896
7900
  ref: "pageBar"
7897
7901
  };
@@ -7985,7 +7989,7 @@
7985
7989
  }
7986
7990
  });
7987
7991
  return (_ctx, _cache) => {
7988
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$60, [
7992
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$61, [
7989
7993
  (0, vue.renderSlot)(_ctx.$slots, "prepend"),
7990
7994
  __props.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2$22, [(0, vue.renderSlot)(_ctx.$slots, "default")], 512)) : (0, vue.createCommentVNode)("v-if", true),
7991
7995
  canScroll.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
@@ -8007,7 +8011,7 @@
8007
8011
  var PageBarScrollContainer_default = PageBarScrollContainer_vue_vue_type_script_setup_true_lang_default;
8008
8012
  //#endregion
8009
8013
  //#region packages/editor/src/layouts/page-bar/PageList.vue?vue&type=script&setup=true&lang.ts
8010
- var _hoisted_1$59 = {
8014
+ var _hoisted_1$60 = {
8011
8015
  key: 0,
8012
8016
  id: "m-editor-page-bar-list-icon",
8013
8017
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
@@ -8026,7 +8030,7 @@
8026
8030
  await editorService.select(id);
8027
8031
  };
8028
8032
  return (_ctx, _cache) => {
8029
- return showPageListButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$59, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), {
8033
+ return showPageListButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$60, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), {
8030
8034
  "popper-class": "page-bar-popover",
8031
8035
  placement: "top",
8032
8036
  trigger: "hover",
@@ -8058,7 +8062,7 @@
8058
8062
  var PageList_default = PageList_vue_vue_type_script_setup_true_lang_default;
8059
8063
  //#endregion
8060
8064
  //#region packages/editor/src/layouts/page-bar/Search.vue?vue&type=script&setup=true&lang.ts
8061
- var _hoisted_1$58 = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
8065
+ var _hoisted_1$59 = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
8062
8066
  var Search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
8063
8067
  __name: "Search",
8064
8068
  props: {
@@ -8091,7 +8095,7 @@
8091
8095
  emit("search", values);
8092
8096
  };
8093
8097
  return (_ctx, _cache) => {
8094
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$58, [(0, vue.createVNode)(Icon_default, {
8098
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$59, [(0, vue.createVNode)(Icon_default, {
8095
8099
  icon: (0, vue.unref)(_element_plus_icons_vue.Search),
8096
8100
  onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value),
8097
8101
  class: (0, vue.normalizeClass)({ "icon-active": visible.value })
@@ -8115,7 +8119,7 @@
8115
8119
  var Search_default = Search_vue_vue_type_script_setup_true_lang_default;
8116
8120
  //#endregion
8117
8121
  //#region packages/editor/src/layouts/page-bar/PageBar.vue?vue&type=script&setup=true&lang.ts
8118
- var _hoisted_1$57 = { class: "m-editor-page-bar-tabs" };
8122
+ var _hoisted_1$58 = { class: "m-editor-page-bar-tabs" };
8119
8123
  var _hoisted_2$20 = ["data-page-id", "onClick"];
8120
8124
  var _hoisted_3$6 = { class: "m-editor-page-bar-title" };
8121
8125
  var _hoisted_4$5 = ["title"];
@@ -8183,7 +8187,7 @@
8183
8187
  }
8184
8188
  });
8185
8189
  return (_ctx, _cache) => {
8186
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$57, [(0, vue.createVNode)(PageBarScrollContainer_default, {
8190
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$58, [(0, vue.createVNode)(PageBarScrollContainer_default, {
8187
8191
  ref: "pageBarScrollContainer",
8188
8192
  "page-bar-sort-options": __props.pageBarSortOptions,
8189
8193
  length: list.value.length
@@ -8242,7 +8246,7 @@
8242
8246
  var PageBar_default = PageBar_vue_vue_type_script_setup_true_lang_default;
8243
8247
  //#endregion
8244
8248
  //#region packages/editor/src/layouts/AddPageBox.vue?vue&type=script&setup=true&lang.ts
8245
- var _hoisted_1$56 = { class: "m-editor-empty-panel" };
8249
+ var _hoisted_1$57 = { class: "m-editor-empty-panel" };
8246
8250
  var _hoisted_2$19 = { class: "m-editor-empty-content" };
8247
8251
  var AddPageBox_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
8248
8252
  name: "MEditorAddPageBox",
@@ -8260,7 +8264,7 @@
8260
8264
  });
8261
8265
  };
8262
8266
  return (_ctx, _cache) => {
8263
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$56, [(0, vue.createElementVNode)("div", _hoisted_2$19, [(0, vue.createElementVNode)("div", {
8267
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$57, [(0, vue.createElementVNode)("div", _hoisted_2$19, [(0, vue.createElementVNode)("div", {
8264
8268
  class: "m-editor-empty-button",
8265
8269
  onClick: _cache[0] || (_cache[0] = ($event) => clickHandler((0, vue.unref)(_tmagic_core.NodeType).PAGE))
8266
8270
  }, [(0, vue.createElementVNode)("div", null, [(0, vue.createVNode)(Icon_default, { icon: (0, vue.unref)(_element_plus_icons_vue.Plus) }, null, 8, ["icon"])]), _cache[2] || (_cache[2] = (0, vue.createElementVNode)("p", null, "新增页面", -1))]), !__props.disabledPageFragment ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
@@ -8276,7 +8280,7 @@
8276
8280
  var AddPageBox_default = AddPageBox_vue_vue_type_script_setup_true_lang_default;
8277
8281
  //#endregion
8278
8282
  //#region packages/editor/src/layouts/CodeEditor.vue?vue&type=script&setup=true&lang.ts
8279
- var _hoisted_1$55 = { class: "magic-code-editor" };
8283
+ var _hoisted_1$56 = { class: "magic-code-editor" };
8280
8284
  var _hoisted_2$18 = {
8281
8285
  ref: "codeEditor",
8282
8286
  class: "magic-code-editor-content"
@@ -8393,23 +8397,23 @@
8393
8397
  if (props.type === "diff") {
8394
8398
  const originalModel = monaco.editor.createModel(values.value, "text/javascript");
8395
8399
  const modifiedModel = monaco.editor.createModel(toString(m, props.language), "text/javascript");
8396
- const position = vsDiffEditor?.getPosition();
8400
+ const viewState = vsDiffEditor?.saveViewState();
8397
8401
  const result = vsDiffEditor?.setModel({
8398
8402
  original: originalModel,
8399
8403
  modified: modifiedModel
8400
8404
  });
8401
- if (position) {
8402
- vsDiffEditor?.setPosition(position);
8405
+ if (viewState) (0, vue.nextTick)(() => {
8406
+ vsDiffEditor?.restoreViewState(viewState);
8403
8407
  vsDiffEditor?.focus();
8404
- }
8408
+ });
8405
8409
  return result;
8406
8410
  }
8407
- const position = vsEditor?.getPosition();
8411
+ const viewState = vsEditor?.saveViewState();
8408
8412
  const result = vsEditor?.setValue(values.value);
8409
- if (position) {
8410
- vsEditor?.setPosition(position);
8413
+ if (viewState) (0, vue.nextTick)(() => {
8414
+ vsEditor?.restoreViewState(viewState);
8411
8415
  vsEditor?.focus();
8412
- }
8416
+ });
8413
8417
  return result;
8414
8418
  };
8415
8419
  const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
@@ -8513,7 +8517,7 @@
8513
8517
  }
8514
8518
  });
8515
8519
  return (_ctx, _cache) => {
8516
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$55, [((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
8520
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$56, [((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
8517
8521
  to: "body",
8518
8522
  disabled: !fullScreen.value
8519
8523
  }, [(0, vue.createElementVNode)("div", {
@@ -8540,7 +8544,7 @@
8540
8544
  var CodeEditor_default = CodeEditor_vue_vue_type_script_setup_true_lang_default;
8541
8545
  //#endregion
8542
8546
  //#region packages/editor/src/layouts/Framework.vue?vue&type=script&setup=true&lang.ts
8543
- var _hoisted_1$54 = {
8547
+ var _hoisted_1$55 = {
8544
8548
  class: "m-editor",
8545
8549
  ref: "content",
8546
8550
  style: { "min-width": "900px" }
@@ -8602,7 +8606,7 @@
8602
8606
  }
8603
8607
  };
8604
8608
  return (_ctx, _cache) => {
8605
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$54, [
8609
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$55, [
8606
8610
  (0, vue.renderSlot)(_ctx.$slots, "header"),
8607
8611
  (0, vue.renderSlot)(_ctx.$slots, "nav"),
8608
8612
  (0, vue.renderSlot)(_ctx.$slots, "content-before"),
@@ -8666,6 +8670,205 @@
8666
8670
  //#region packages/editor/src/layouts/Framework.vue
8667
8671
  var Framework_default = Framework_vue_vue_type_script_setup_true_lang_default;
8668
8672
  //#endregion
8673
+ //#region packages/editor/src/layouts/NavMenuColumn.vue?vue&type=script&setup=true&lang.ts
8674
+ var _hoisted_1$54 = { class: "m-editor-nav-menu-overflow-list" };
8675
+ var NavMenuColumn_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
8676
+ name: "MEditorNavMenuColumn",
8677
+ __name: "NavMenuColumn",
8678
+ props: {
8679
+ columnKey: {},
8680
+ items: { default: () => [] },
8681
+ width: {},
8682
+ gap: { default: 3 },
8683
+ popoverWidth: { default: 180 }
8684
+ },
8685
+ setup(__props) {
8686
+ const props = __props;
8687
+ const columnEl = (0, vue.useTemplateRef)("columnEl");
8688
+ const moreWrapperEl = (0, vue.useTemplateRef)("moreWrapperEl");
8689
+ const popoverVisible = (0, vue.ref)(false);
8690
+ const togglePopover = () => {
8691
+ popoverVisible.value = !popoverVisible.value;
8692
+ };
8693
+ const itemInstances = (0, vue.ref)([]);
8694
+ let slotsRO;
8695
+ const observedEls = /* @__PURE__ */ new Set();
8696
+ const setItemRef = (inst, index) => {
8697
+ itemInstances.value[index] = inst ?? null;
8698
+ };
8699
+ const itemEls = (0, vue.computed)(() => itemInstances.value.map((inst) => inst?.getElRef?.().value ?? null));
8700
+ const reobserveSlots = () => {
8701
+ if (!slotsRO) return;
8702
+ for (const el of observedEls) slotsRO.unobserve(el);
8703
+ observedEls.clear();
8704
+ for (const el of itemEls.value) if (el) {
8705
+ slotsRO.observe(el);
8706
+ observedEls.add(el);
8707
+ }
8708
+ };
8709
+ const cachedWidths = (0, vue.ref)(/* @__PURE__ */ new Map());
8710
+ const moreWidth = (0, vue.ref)(0);
8711
+ const containerWidth = (0, vue.ref)(0);
8712
+ const hiddenIndexSet = (0, vue.ref)(/* @__PURE__ */ new Set());
8713
+ const hasOverflow = (0, vue.computed)(() => hiddenIndexSet.value.size > 0);
8714
+ const overflowItems = (0, vue.computed)(() => props.items.filter((_, index) => hiddenIndexSet.value.has(index)));
8715
+ const measureAndCompute = () => {
8716
+ if (!columnEl.value) return;
8717
+ containerWidth.value = columnEl.value.clientWidth;
8718
+ const els = itemEls.value;
8719
+ for (let i = 0; i < props.items.length; i++) {
8720
+ const el = els[i];
8721
+ if (!el) {
8722
+ cachedWidths.value.delete(i);
8723
+ continue;
8724
+ }
8725
+ const w = el.getBoundingClientRect().width;
8726
+ if (w > 0) cachedWidths.value.set(i, w);
8727
+ else cachedWidths.value.delete(i);
8728
+ }
8729
+ if (moreWrapperEl.value) {
8730
+ const w = moreWrapperEl.value.getBoundingClientRect().width;
8731
+ if (w > 0) moreWidth.value = w;
8732
+ }
8733
+ const total = props.items.length;
8734
+ if (total === 0 || containerWidth.value <= 0) {
8735
+ if (hiddenIndexSet.value.size > 0) hiddenIndexSet.value = /* @__PURE__ */ new Set();
8736
+ return;
8737
+ }
8738
+ let fullSum = 0;
8739
+ let positive = 0;
8740
+ for (let i = 0; i < total; i++) {
8741
+ const w = cachedWidths.value.get(i) ?? 0;
8742
+ if (w > 0) {
8743
+ fullSum += w;
8744
+ positive += 1;
8745
+ }
8746
+ }
8747
+ fullSum += props.gap * Math.max(0, positive - 1);
8748
+ const effectiveMoreWidth = moreWidth.value > 0 ? moreWidth.value : 32;
8749
+ const reservedMore = effectiveMoreWidth + (positive > 0 ? props.gap : 0);
8750
+ let nextHidden = null;
8751
+ if (fullSum + reservedMore <= containerWidth.value + .5) {
8752
+ if (hiddenIndexSet.value.size > 0) nextHidden = /* @__PURE__ */ new Set();
8753
+ } else {
8754
+ const newHidden = /* @__PURE__ */ new Set();
8755
+ let used = effectiveMoreWidth;
8756
+ let cutoff = -1;
8757
+ for (let i = 0; i < total; i++) {
8758
+ const w = cachedWidths.value.get(i) ?? 0;
8759
+ if (w === 0) continue;
8760
+ const need = props.gap + w;
8761
+ if (used + need > containerWidth.value) {
8762
+ cutoff = i;
8763
+ break;
8764
+ }
8765
+ used += need;
8766
+ }
8767
+ if (cutoff >= 0) for (let j = cutoff; j < total; j++) newHidden.add(j);
8768
+ nextHidden = newHidden;
8769
+ }
8770
+ if (nextHidden) {
8771
+ if (!(nextHidden.size === hiddenIndexSet.value.size && [...nextHidden].every((v) => hiddenIndexSet.value.has(v)))) hiddenIndexSet.value = nextHidden;
8772
+ }
8773
+ };
8774
+ let raf = 0;
8775
+ const scheduleMeasure = () => {
8776
+ if (raf) cancelAnimationFrame(raf);
8777
+ raf = requestAnimationFrame(() => {
8778
+ raf = 0;
8779
+ measureAndCompute();
8780
+ if (hasOverflow.value && moreWidth.value === 0) raf = requestAnimationFrame(() => {
8781
+ raf = 0;
8782
+ measureAndCompute();
8783
+ });
8784
+ });
8785
+ };
8786
+ (0, vue.watch)(hasOverflow, (value) => {
8787
+ if (!value) popoverVisible.value = false;
8788
+ });
8789
+ (0, vue.watch)(() => props.items, () => {
8790
+ cachedWidths.value = /* @__PURE__ */ new Map();
8791
+ hiddenIndexSet.value = /* @__PURE__ */ new Set();
8792
+ }, { deep: true });
8793
+ (0, vue.watch)(itemEls, () => {
8794
+ cachedWidths.value = /* @__PURE__ */ new Map();
8795
+ reobserveSlots();
8796
+ scheduleMeasure();
8797
+ });
8798
+ (0, vue.watch)(() => props.width, () => scheduleMeasure());
8799
+ let ro;
8800
+ (0, vue.onMounted)(() => {
8801
+ if (typeof ResizeObserver !== "undefined") {
8802
+ if (columnEl.value) {
8803
+ ro = new ResizeObserver(() => scheduleMeasure());
8804
+ ro.observe(columnEl.value);
8805
+ }
8806
+ slotsRO = new ResizeObserver(() => scheduleMeasure());
8807
+ reobserveSlots();
8808
+ }
8809
+ scheduleMeasure();
8810
+ });
8811
+ (0, vue.onBeforeUnmount)(() => {
8812
+ if (raf) cancelAnimationFrame(raf);
8813
+ ro?.disconnect();
8814
+ slotsRO?.disconnect();
8815
+ slotsRO = void 0;
8816
+ observedEls.clear();
8817
+ });
8818
+ return (_ctx, _cache) => {
8819
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
8820
+ class: (0, vue.normalizeClass)(`menu-${__props.columnKey} m-editor-nav-menu-column`),
8821
+ style: (0, vue.normalizeStyle)(__props.width != null ? `width: ${__props.width}px` : ""),
8822
+ ref_key: "columnEl",
8823
+ ref: columnEl
8824
+ }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.items, (item, index) => {
8825
+ return (0, vue.openBlock)(), (0, vue.createBlock)(ToolButton_default, {
8826
+ data: item,
8827
+ key: `item-${index}`,
8828
+ class: (0, vue.normalizeClass)({ "m-editor-nav-menu-slot-hidden": hiddenIndexSet.value.has(index) }),
8829
+ ref_for: true,
8830
+ ref: (comp) => setItemRef(comp, index)
8831
+ }, null, 8, ["data", "class"]);
8832
+ }), 128)), (0, vue.createElementVNode)("div", {
8833
+ class: (0, vue.normalizeClass)(["m-editor-nav-menu-more-wrapper", { "m-editor-nav-menu-more-wrapper-hidden": !hasOverflow.value }]),
8834
+ ref_key: "moreWrapperEl",
8835
+ ref: moreWrapperEl
8836
+ }, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), {
8837
+ placement: "bottom-end",
8838
+ "popper-class": "m-editor-nav-menu-popover",
8839
+ width: __props.popoverWidth,
8840
+ visible: popoverVisible.value
8841
+ }, {
8842
+ reference: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", {
8843
+ class: "menu-item button m-editor-nav-menu-more",
8844
+ ref: "referenceEl",
8845
+ onClick: togglePopover
8846
+ }, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
8847
+ size: "small",
8848
+ text: "",
8849
+ icon: popoverVisible.value ? (0, vue.unref)(_element_plus_icons_vue.ArrowUp) : (0, vue.unref)(_element_plus_icons_vue.ArrowDown),
8850
+ bg: popoverVisible.value,
8851
+ type: popoverVisible.value ? "primary" : ""
8852
+ }, null, 8, [
8853
+ "icon",
8854
+ "bg",
8855
+ "type"
8856
+ ])], 512)]),
8857
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$54, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(overflowItems.value, (item, index) => {
8858
+ return (0, vue.openBlock)(), (0, vue.createBlock)(ToolButton_default, {
8859
+ data: item,
8860
+ key: `o-${index}`
8861
+ }, null, 8, ["data"]);
8862
+ }), 128))])]),
8863
+ _: 1
8864
+ }, 8, ["width", "visible"])], 2)], 6);
8865
+ };
8866
+ }
8867
+ });
8868
+ //#endregion
8869
+ //#region packages/editor/src/layouts/NavMenuColumn.vue
8870
+ var NavMenuColumn_default = NavMenuColumn_vue_vue_type_script_setup_true_lang_default;
8871
+ //#endregion
8669
8872
  //#region packages/editor/src/layouts/NavMenu.vue?vue&type=script&setup=true&lang.ts
8670
8873
  var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
8671
8874
  name: "MEditorNavMenu",
@@ -8827,16 +9030,16 @@
8827
9030
  style: (0, vue.normalizeStyle)({ height: `${__props.height}px` }),
8828
9031
  ref: "navMenu"
8829
9032
  }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(keys), (key) => {
8830
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
8831
- class: (0, vue.normalizeClass)(`menu-${key}`),
9033
+ return (0, vue.openBlock)(), (0, vue.createBlock)(NavMenuColumn_default, {
8832
9034
  key,
8833
- style: (0, vue.normalizeStyle)(`width: ${columnWidth.value?.[key]}px`)
8834
- }, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(buttons.value[key], (item, index) => {
8835
- return (0, vue.openBlock)(), (0, vue.createBlock)(ToolButton_default, {
8836
- data: item,
8837
- key: index
8838
- }, null, 8, ["data"]);
8839
- }), 128))], 6);
9035
+ "column-key": key,
9036
+ items: buttons.value[key],
9037
+ width: columnWidth.value?.[key]
9038
+ }, null, 8, [
9039
+ "column-key",
9040
+ "items",
9041
+ "width"
9042
+ ]);
8840
9043
  }), 128))], 4);
8841
9044
  };
8842
9045
  }
@@ -11315,97 +11518,97 @@
11315
11518
  {
11316
11519
  command: KeyBindingCommand.DELETE_NODE,
11317
11520
  keybinding: ["delete", "backspace"],
11318
- when: [[KeyBindingContainerKey.STAGE, "keyup"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11521
+ when: [["stage", "keyup"], ["layer-panel", "keydown"]]
11319
11522
  },
11320
11523
  {
11321
11524
  command: KeyBindingCommand.COPY_NODE,
11322
11525
  keybinding: "ctrl+c",
11323
- when: [[KeyBindingContainerKey.STAGE, "keydown"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11526
+ when: [["stage", "keydown"], ["layer-panel", "keydown"]]
11324
11527
  },
11325
11528
  {
11326
11529
  command: KeyBindingCommand.PASTE_NODE,
11327
11530
  keybinding: "ctrl+v",
11328
- when: [[KeyBindingContainerKey.STAGE, "keydown"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11531
+ when: [["stage", "keydown"], ["layer-panel", "keydown"]]
11329
11532
  },
11330
11533
  {
11331
11534
  command: KeyBindingCommand.CUT_NODE,
11332
11535
  keybinding: "ctrl+x",
11333
- when: [[KeyBindingContainerKey.STAGE, "keydown"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11536
+ when: [["stage", "keydown"], ["layer-panel", "keydown"]]
11334
11537
  },
11335
11538
  {
11336
11539
  command: KeyBindingCommand.UNDO,
11337
11540
  keybinding: "ctrl+z",
11338
- when: [[KeyBindingContainerKey.STAGE, "keydown"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11541
+ when: [["stage", "keydown"], ["layer-panel", "keydown"]]
11339
11542
  },
11340
11543
  {
11341
11544
  command: KeyBindingCommand.REDO,
11342
11545
  keybinding: "ctrl+shift+z",
11343
- when: [[KeyBindingContainerKey.STAGE, "keydown"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11546
+ when: [["stage", "keydown"], ["layer-panel", "keydown"]]
11344
11547
  },
11345
11548
  {
11346
11549
  command: KeyBindingCommand.MOVE_UP_1,
11347
11550
  keybinding: "up",
11348
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11551
+ when: [["stage", "keydown"]]
11349
11552
  },
11350
11553
  {
11351
11554
  command: KeyBindingCommand.MOVE_DOWN_1,
11352
11555
  keybinding: "down",
11353
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11556
+ when: [["stage", "keydown"]]
11354
11557
  },
11355
11558
  {
11356
11559
  command: KeyBindingCommand.MOVE_LEFT_1,
11357
11560
  keybinding: "left",
11358
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11561
+ when: [["stage", "keydown"]]
11359
11562
  },
11360
11563
  {
11361
11564
  command: KeyBindingCommand.MOVE_RIGHT_1,
11362
11565
  keybinding: "right",
11363
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11566
+ when: [["stage", "keydown"]]
11364
11567
  },
11365
11568
  {
11366
11569
  command: KeyBindingCommand.MOVE_UP_10,
11367
11570
  keybinding: "ctrl+up",
11368
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11571
+ when: [["stage", "keydown"]]
11369
11572
  },
11370
11573
  {
11371
11574
  command: KeyBindingCommand.MOVE_DOWN_10,
11372
11575
  keybinding: "ctrl+down",
11373
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11576
+ when: [["stage", "keydown"]]
11374
11577
  },
11375
11578
  {
11376
11579
  command: KeyBindingCommand.MOVE_LEFT_10,
11377
11580
  keybinding: "ctrl+left",
11378
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11581
+ when: [["stage", "keydown"]]
11379
11582
  },
11380
11583
  {
11381
11584
  command: KeyBindingCommand.MOVE_RIGHT_10,
11382
11585
  keybinding: "ctrl+right",
11383
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11586
+ when: [["stage", "keydown"]]
11384
11587
  },
11385
11588
  {
11386
11589
  command: KeyBindingCommand.SWITCH_NODE,
11387
11590
  keybinding: "tab",
11388
- when: [[KeyBindingContainerKey.STAGE, "keydown"], [KeyBindingContainerKey.LAYER_PANEL, "keydown"]]
11591
+ when: [["stage", "keydown"], ["layer-panel", "keydown"]]
11389
11592
  },
11390
11593
  {
11391
11594
  command: KeyBindingCommand.ZOOM_IN,
11392
11595
  keybinding: ["ctrl+=", "ctrl+numpadplus"],
11393
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11596
+ when: [["stage", "keydown"]]
11394
11597
  },
11395
11598
  {
11396
11599
  command: KeyBindingCommand.ZOOM_OUT,
11397
11600
  keybinding: ["ctrl+-", "ctrl+numpad-"],
11398
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11601
+ when: [["stage", "keydown"]]
11399
11602
  },
11400
11603
  {
11401
11604
  command: KeyBindingCommand.ZOOM_FIT,
11402
11605
  keybinding: "ctrl+0",
11403
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11606
+ when: [["stage", "keydown"]]
11404
11607
  },
11405
11608
  {
11406
11609
  command: KeyBindingCommand.ZOOM_RESET,
11407
11610
  keybinding: "ctrl+1",
11408
- when: [[KeyBindingContainerKey.STAGE, "keydown"]]
11611
+ when: [["stage", "keydown"]]
11409
11612
  }
11410
11613
  ];
11411
11614
  //#endregion
@@ -18627,7 +18830,8 @@
18627
18830
  const collapseValue = (0, vue.shallowRef)(Array(list.length).fill(1).map((x, i) => `${i}`));
18628
18831
  const change = (v, eventData) => {
18629
18832
  eventData.changeRecords?.forEach((record) => {
18630
- record.propPath = `${props.name}.${record.propPath}`;
18833
+ if (props.prop) record.propPath = `${props.prop}.${record.propPath}`;
18834
+ else if (props.name) record.propPath = `${props.name}.${record.propPath}`;
18631
18835
  });
18632
18836
  emit("change", v, eventData);
18633
18837
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.14-beta.0",
2
+ "version": "1.7.14-beta.2",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -58,11 +58,11 @@
58
58
  "moveable": "^0.53.0",
59
59
  "serialize-javascript": "^7.0.0",
60
60
  "sortablejs": "^1.15.6",
61
- "@tmagic/design": "1.7.14-beta.0",
62
- "@tmagic/form": "1.7.14-beta.0",
63
- "@tmagic/table": "1.7.14-beta.0",
64
- "@tmagic/stage": "1.7.14-beta.0",
65
- "@tmagic/utils": "1.7.14-beta.0"
61
+ "@tmagic/design": "1.7.14-beta.2",
62
+ "@tmagic/form": "1.7.14-beta.2",
63
+ "@tmagic/stage": "1.7.14-beta.2",
64
+ "@tmagic/table": "1.7.14-beta.2",
65
+ "@tmagic/utils": "1.7.14-beta.2"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/events": "^3.0.3",
@@ -75,8 +75,8 @@
75
75
  "monaco-editor": "^0.55.1 ",
76
76
  "type-fest": "^5.2.0",
77
77
  "typescript": "^6.0.3",
78
- "vue": "^3.5.33",
79
- "@tmagic/core": "1.7.14-beta.0"
78
+ "vue": "^3.5.34",
79
+ "@tmagic/core": "1.7.14-beta.2"
80
80
  },
81
81
  "peerDependenciesMeta": {
82
82
  "typescript": {