@tmagic/editor 1.7.10 → 1.7.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.
@@ -42,6 +42,7 @@ var DisplayConds_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
42
42
  name: props.name,
43
43
  titlePrefix: props.config.titlePrefix,
44
44
  expandAll: true,
45
+ enableToggleMode: false,
45
46
  items: [{
46
47
  type: "table",
47
48
  name: "cond",
@@ -42,7 +42,10 @@ var useStage = (stageOptions) => {
42
42
  if (disabledMultiSelect) stage.disableMultiSelect();
43
43
  else stage.enableMultiSelect();
44
44
  });
45
- stage.mask?.setGuides([getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)), getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))]);
45
+ const hGuidesCache = getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY));
46
+ const vGuidesCache = getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY));
47
+ stage.mask?.setGuides([hGuidesCache, vGuidesCache]);
48
+ ui_default.set("hasGuides", hGuidesCache.length > 0 || vGuidesCache.length > 0);
46
49
  stage.on("page-el-update", () => {
47
50
  editor_default.set("stageLoading", false);
48
51
  });
@@ -96,6 +99,7 @@ var useStage = (stageOptions) => {
96
99
  });
97
100
  stage.on("change-guides", (e) => {
98
101
  ui_default.set("showGuides", true);
102
+ ui_default.set("hasGuides", (stage.mask?.horizontalGuidelines.length ?? 0) > 0 || (stage.mask?.verticalGuidelines.length ?? 0) > 0);
99
103
  if (!root.value || !page.value) return;
100
104
  const storageKey = getGuideLineKey(e.type === GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY);
101
105
  if (e.guides.length) globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
@@ -18,6 +18,7 @@ var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
18
18
  const columnWidth = computed(() => uiService.get("columnWidth"));
19
19
  const keys = Object.values(ColumnLayout);
20
20
  const showGuides = computed(() => uiService.get("showGuides"));
21
+ const hasGuides = computed(() => uiService.get("hasGuides"));
21
22
  const showRule = computed(() => uiService.get("showRule"));
22
23
  const zoom = computed(() => uiService.get("zoom"));
23
24
  const ctrl = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "Command" : "Ctrl";
@@ -113,6 +114,7 @@ var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
113
114
  });
114
115
  break;
115
116
  case "guides":
117
+ if (!hasGuides.value) break;
116
118
  config.push({
117
119
  type: "button",
118
120
  className: "guides",
@@ -22,7 +22,9 @@ var Props = class extends BaseService_default {
22
22
  propsConfigMap: {},
23
23
  propsValueMap: {},
24
24
  relateIdMap: {},
25
+ /** 禁用数据源 */
25
26
  disabledDataSource: false,
27
+ /** 禁用代码块 */
26
28
  disabledCodeBlock: false
27
29
  });
28
30
  constructor() {
@@ -24,6 +24,7 @@ var state = shallowReactive({
24
24
  right: storage_default.getItem("$MagicEditorRightColumnWidthData", { protocol: Protocol.NUMBER }) || 480
25
25
  },
26
26
  showGuides: true,
27
+ hasGuides: false,
27
28
  showRule: true,
28
29
  propsPanelSize: "small",
29
30
  showAddPageButton: true,
@@ -1,9 +1,8 @@
1
1
  import base_default from "./formConfigs/base.js";
2
2
  import http_default from "./formConfigs/http.js";
3
- import { defineFormItem } from "@tmagic/form";
4
3
  import { dataSourceTemplateRegExp, getKeysArray, isNumber } from "@tmagic/utils";
5
4
  //#region packages/editor/src/utils/data-source/index.ts
6
- var dataSourceFormConfig = defineFormItem({
5
+ var dataSourceFormConfig = {
7
6
  type: "tab",
8
7
  items: [
9
8
  {
@@ -65,7 +64,7 @@ var dataSourceFormConfig = defineFormItem({
65
64
  }]
66
65
  }
67
66
  ]
68
- });
67
+ };
69
68
  var fillConfig = (config) => [
70
69
  ...base_default(),
71
70
  ...config,
@@ -98,7 +98,8 @@ var styleTabConfig = {
98
98
  "borderLeftColor",
99
99
  "borderWidth",
100
100
  "borderStyle",
101
- "borderColor"
101
+ "borderColor",
102
+ "opacity"
102
103
  ] }, {
103
104
  name: "transform",
104
105
  defaultValue: () => ({})
@@ -44,15 +44,15 @@
44
44
  enumerable: true
45
45
  }) : target, mod));
46
46
  //#endregion
47
- _tmagic_form = __toESM(_tmagic_form);
48
- _tmagic_table = __toESM(_tmagic_table);
49
- _tmagic_stage = __toESM(_tmagic_stage);
50
- _tmagic_design = __toESM(_tmagic_design);
51
- serialize_javascript = __toESM(serialize_javascript);
52
- gesto = __toESM(gesto);
53
- sortablejs = __toESM(sortablejs);
54
- moveable = __toESM(moveable);
55
- keycon = __toESM(keycon);
47
+ _tmagic_form = __toESM(_tmagic_form, 1);
48
+ _tmagic_table = __toESM(_tmagic_table, 1);
49
+ _tmagic_stage = __toESM(_tmagic_stage, 1);
50
+ _tmagic_design = __toESM(_tmagic_design, 1);
51
+ serialize_javascript = __toESM(serialize_javascript, 1);
52
+ gesto = __toESM(gesto, 1);
53
+ sortablejs = __toESM(sortablejs, 1);
54
+ moveable = __toESM(moveable, 1);
55
+ keycon = __toESM(keycon, 1);
56
56
  //#region packages/editor/src/type.ts
57
57
  var ColumnLayout = /* @__PURE__ */ function(ColumnLayout) {
58
58
  ColumnLayout["LEFT"] = "left";
@@ -2297,7 +2297,8 @@
2297
2297
  * @param {Array} [entries] The key-value pairs to cache.
2298
2298
  */
2299
2299
  function Stack(entries) {
2300
- this.size = (this.__data__ = new ListCache(entries)).size;
2300
+ var data = this.__data__ = new ListCache(entries);
2301
+ this.size = data.size;
2301
2302
  }
2302
2303
  Stack.prototype.clear = stackClear;
2303
2304
  Stack.prototype["delete"] = stackDelete;
@@ -4602,7 +4603,8 @@
4602
4603
  "borderLeftColor",
4603
4604
  "borderWidth",
4604
4605
  "borderStyle",
4605
- "borderColor"
4606
+ "borderColor",
4607
+ "opacity"
4606
4608
  ] }, {
4607
4609
  name: "transform",
4608
4610
  defaultValue: () => ({})
@@ -4753,7 +4755,9 @@
4753
4755
  propsConfigMap: {},
4754
4756
  propsValueMap: {},
4755
4757
  relateIdMap: {},
4758
+ /** 禁用数据源 */
4756
4759
  disabledDataSource: false,
4760
+ /** 禁用代码块 */
4757
4761
  disabledCodeBlock: false
4758
4762
  });
4759
4763
  constructor() {
@@ -6565,6 +6569,7 @@
6565
6569
  right: storage_default.getItem("$MagicEditorRightColumnWidthData", { protocol: Protocol.NUMBER }) || 480
6566
6570
  },
6567
6571
  showGuides: true,
6572
+ hasGuides: false,
6568
6573
  showRule: true,
6569
6574
  propsPanelSize: "small",
6570
6575
  showAddPageButton: true,
@@ -6687,7 +6692,10 @@
6687
6692
  if (disabledMultiSelect) stage.disableMultiSelect();
6688
6693
  else stage.enableMultiSelect();
6689
6694
  });
6690
- stage.mask?.setGuides([getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)), getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))]);
6695
+ const hGuidesCache = getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY));
6696
+ const vGuidesCache = getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY));
6697
+ stage.mask?.setGuides([hGuidesCache, vGuidesCache]);
6698
+ ui_default.set("hasGuides", hGuidesCache.length > 0 || vGuidesCache.length > 0);
6691
6699
  stage.on("page-el-update", () => {
6692
6700
  editor_default.set("stageLoading", false);
6693
6701
  });
@@ -6741,6 +6749,7 @@
6741
6749
  });
6742
6750
  stage.on("change-guides", (e) => {
6743
6751
  ui_default.set("showGuides", true);
6752
+ ui_default.set("hasGuides", (stage.mask?.horizontalGuidelines.length ?? 0) > 0 || (stage.mask?.verticalGuidelines.length ?? 0) > 0);
6744
6753
  if (!root.value || !page.value) return;
6745
6754
  const storageKey = getGuideLineKey(e.type === _tmagic_stage.GuidesType.HORIZONTAL ? H_GUIDE_LINE_STORAGE_KEY : V_GUIDE_LINE_STORAGE_KEY);
6746
6755
  if (e.guides.length) globalThis.localStorage.setItem(storageKey, JSON.stringify(e.guides));
@@ -7091,7 +7100,7 @@
7091
7100
  ]);
7092
7101
  //#endregion
7093
7102
  //#region packages/editor/src/utils/data-source/index.ts
7094
- var dataSourceFormConfig = (0, _tmagic_form.defineFormItem)({
7103
+ var dataSourceFormConfig = {
7095
7104
  type: "tab",
7096
7105
  items: [
7097
7106
  {
@@ -7153,7 +7162,7 @@
7153
7162
  }]
7154
7163
  }
7155
7164
  ]
7156
- });
7165
+ };
7157
7166
  var fillConfig$1 = (config) => [
7158
7167
  ...base_default(),
7159
7168
  ...config,
@@ -8649,6 +8658,7 @@
8649
8658
  const columnWidth = (0, vue.computed)(() => uiService.get("columnWidth"));
8650
8659
  const keys = Object.values(ColumnLayout);
8651
8660
  const showGuides = (0, vue.computed)(() => uiService.get("showGuides"));
8661
+ const hasGuides = (0, vue.computed)(() => uiService.get("hasGuides"));
8652
8662
  const showRule = (0, vue.computed)(() => uiService.get("showRule"));
8653
8663
  const zoom = (0, vue.computed)(() => uiService.get("zoom"));
8654
8664
  const ctrl = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "Command" : "Ctrl";
@@ -8744,6 +8754,7 @@
8744
8754
  });
8745
8755
  break;
8746
8756
  case "guides":
8757
+ if (!hasGuides.value) break;
8747
8758
  config.push({
8748
8759
  type: "button",
8749
8760
  className: "guides",
@@ -16955,6 +16966,7 @@
16955
16966
  name: props.name,
16956
16967
  titlePrefix: props.config.titlePrefix,
16957
16968
  expandAll: true,
16969
+ enableToggleMode: false,
16958
16970
  items: [{
16959
16971
  type: "table",
16960
16972
  name: "cond",
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.10",
2
+ "version": "1.7.12",
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.10",
62
- "@tmagic/form": "1.7.10",
63
- "@tmagic/table": "1.7.10",
64
- "@tmagic/stage": "1.7.10",
65
- "@tmagic/utils": "1.7.10"
61
+ "@tmagic/design": "1.7.12",
62
+ "@tmagic/form": "1.7.12",
63
+ "@tmagic/stage": "1.7.12",
64
+ "@tmagic/utils": "1.7.12",
65
+ "@tmagic/table": "1.7.12"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/events": "^3.0.3",
@@ -74,9 +74,9 @@
74
74
  "peerDependencies": {
75
75
  "monaco-editor": "^0.55.1 ",
76
76
  "type-fest": "^5.2.0",
77
- "typescript": "^6.0.2",
78
- "vue": "^3.5.24",
79
- "@tmagic/core": "1.7.10"
77
+ "typescript": "^6.0.3",
78
+ "vue": "^3.5.33",
79
+ "@tmagic/core": "1.7.12"
80
80
  },
81
81
  "peerDependenciesMeta": {
82
82
  "typescript": {
@@ -67,6 +67,7 @@ const config = computed<GroupListConfig>(() => ({
67
67
  name: props.name,
68
68
  titlePrefix: props.config.titlePrefix,
69
69
  expandAll: true,
70
+ enableToggleMode: false,
70
71
  items: [
71
72
  {
72
73
  type: 'table',
@@ -59,10 +59,12 @@ export const useStage = (stageOptions: StageOptions) => {
59
59
  },
60
60
  );
61
61
 
62
- stage.mask?.setGuides([
63
- getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
64
- getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY)),
65
- ]);
62
+ const hGuidesCache = getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY));
63
+ const vGuidesCache = getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY));
64
+
65
+ stage.mask?.setGuides([hGuidesCache, vGuidesCache]);
66
+
67
+ uiService.set('hasGuides', hGuidesCache.length > 0 || vGuidesCache.length > 0);
66
68
 
67
69
  stage.on('page-el-update', () => {
68
70
  editorService.set('stageLoading', false);
@@ -124,6 +126,11 @@ export const useStage = (stageOptions: StageOptions) => {
124
126
  stage.on('change-guides', (e) => {
125
127
  uiService.set('showGuides', true);
126
128
 
129
+ uiService.set(
130
+ 'hasGuides',
131
+ (stage.mask?.horizontalGuidelines.length ?? 0) > 0 || (stage.mask?.verticalGuidelines.length ?? 0) > 0,
132
+ );
133
+
127
134
  if (!root.value || !page.value) return;
128
135
 
129
136
  const storageKey = getGuideLineKey(
@@ -37,6 +37,7 @@ const columnWidth = computed(() => uiService.get('columnWidth'));
37
37
  const keys = Object.values(ColumnLayout);
38
38
 
39
39
  const showGuides = computed((): boolean => uiService.get('showGuides'));
40
+ const hasGuides = computed((): boolean => uiService.get('hasGuides'));
40
41
  const showRule = computed((): boolean => uiService.get('showRule'));
41
42
  const zoom = computed((): number => uiService.get('zoom'));
42
43
 
@@ -143,6 +144,7 @@ const getConfig = (item: MenuItem): (MenuButton | MenuComponent)[] => {
143
144
  });
144
145
  break;
145
146
  case 'guides':
147
+ if (!hasGuides.value) break;
146
148
  config.push({
147
149
  type: 'button',
148
150
  className: 'guides',
@@ -55,6 +55,7 @@ const state = shallowReactive<UiState>({
55
55
  DEFAULT_RIGHT_COLUMN_WIDTH,
56
56
  },
57
57
  showGuides: true,
58
+ hasGuides: false,
58
59
  showRule: true,
59
60
  propsPanelSize: 'small',
60
61
  showAddPageButton: true,
package/src/type.ts CHANGED
@@ -253,6 +253,8 @@ export interface UiState {
253
253
  columnWidth: GetColumnWidth;
254
254
  /** 是否显示画布参考线,true: 显示,false: 不显示,默认为true */
255
255
  showGuides: boolean;
256
+ /** 画布上是否存在参考线 */
257
+ hasGuides: boolean;
256
258
  /** 是否显示标尺,true: 显示,false: 不显示,默认为true */
257
259
  showRule: boolean;
258
260
  /** 用于控制该属性配置表单内组件的尺寸 */
@@ -1,11 +1,11 @@
1
1
  import type { DataSchema, DataSourceFieldType, DataSourceSchema } from '@tmagic/core';
2
- import { type CascaderOption, defineFormItem, type FormConfig } from '@tmagic/form';
2
+ import { type CascaderOption, type FormConfig, type TabConfig } from '@tmagic/form';
3
3
  import { dataSourceTemplateRegExp, getKeysArray, isNumber } from '@tmagic/utils';
4
4
 
5
5
  import BaseFormConfig from './formConfigs/base';
6
6
  import HttpFormConfig from './formConfigs/http';
7
7
 
8
- const dataSourceFormConfig = defineFormItem({
8
+ const dataSourceFormConfig: TabConfig = {
9
9
  type: 'tab',
10
10
  items: [
11
11
  {
@@ -73,9 +73,13 @@ const dataSourceFormConfig = defineFormItem({
73
73
  ],
74
74
  },
75
75
  ],
76
- });
76
+ };
77
77
 
78
- const fillConfig = (config: FormConfig): FormConfig => [...BaseFormConfig(), ...config, dataSourceFormConfig];
78
+ const fillConfig = <T = never>(config: FormConfig<T>): FormConfig<T> => [
79
+ ...BaseFormConfig(),
80
+ ...config,
81
+ dataSourceFormConfig,
82
+ ];
79
83
 
80
84
  export const getFormConfig = (type: string, configs: Record<string, FormConfig>): FormConfig => {
81
85
  switch (type) {
@@ -106,6 +106,7 @@ export const styleTabConfig: TabPaneConfig = {
106
106
  'borderWidth',
107
107
  'borderStyle',
108
108
  'borderColor',
109
+ 'opacity',
109
110
  ],
110
111
  } as unknown as ChildConfig,
111
112
  {