@tmagic/editor 1.5.4 → 1.5.6

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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.4",
2
+ "version": "1.5.6",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -58,39 +58,29 @@
58
58
  "moveable": "^0.53.0",
59
59
  "serialize-javascript": "^6.0.0",
60
60
  "sortablejs": "^1.15.2",
61
- "@tmagic/design": "1.5.4",
62
- "@tmagic/stage": "1.5.4",
63
- "@tmagic/form": "1.5.4",
64
- "@tmagic/table": "1.5.4",
65
- "@tmagic/utils": "1.5.4"
61
+ "@tmagic/design": "1.5.6",
62
+ "@tmagic/form": "1.5.6",
63
+ "@tmagic/utils": "1.5.6",
64
+ "@tmagic/stage": "1.5.6",
65
+ "@tmagic/table": "1.5.6"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/events": "^3.0.0",
69
69
  "@types/lodash-es": "^4.17.4",
70
- "@types/node": "^18.19.0",
71
70
  "@types/serialize-javascript": "^5.0.1",
72
71
  "@types/sortablejs": "^1.15.8",
73
- "@vitejs/plugin-vue": "^5.2.1",
74
- "@vue/compiler-sfc": "^3.5.12",
75
72
  "@vue/test-utils": "^2.4.6",
76
- "rimraf": "^3.0.2",
77
- "sass": "^1.83.0",
78
- "tsc-alias": "^1.8.5",
79
- "type-fest": "^4.10.3",
80
- "vite": "^6.0.3"
73
+ "type-fest": "^4.10.3"
81
74
  },
82
75
  "peerDependencies": {
83
76
  "monaco-editor": "^0.48.0",
84
77
  "typescript": "*",
85
78
  "vue": ">=3.5.0",
86
- "@tmagic/core": "1.5.4"
79
+ "@tmagic/core": "1.5.6"
87
80
  },
88
81
  "peerDependenciesMeta": {
89
82
  "typescript": {
90
83
  "optional": true
91
84
  }
92
- },
93
- "scripts": {
94
- "build": "vite build"
95
85
  }
96
86
  }
@@ -45,7 +45,7 @@ const props = withDefaults(
45
45
  centerClass?: string;
46
46
  }>(),
47
47
  {
48
- minLeft: 46,
48
+ minLeft: 1,
49
49
  minRight: 1,
50
50
  minCenter: 5,
51
51
  },
@@ -65,12 +65,21 @@ const getCenterWidth = (l = 0, r = 0) => {
65
65
  let center = clientWidth - left - right;
66
66
 
67
67
  if (center < props.minCenter) {
68
+ const diff = props.minCenter - center;
69
+
68
70
  center = props.minCenter;
69
- if (right > center + props.minRight) {
70
- right = clientWidth - left - center;
71
- } else {
71
+
72
+ if (right - diff < props.minRight) {
72
73
  right = props.minRight;
73
- left = clientWidth - right - center;
74
+ } else {
75
+ right -= diff;
76
+ }
77
+
78
+ left = clientWidth - right - center;
79
+
80
+ if (left < props.minLeft) {
81
+ left -= diff / 2;
82
+ right -= diff / 2;
74
83
  }
75
84
  }
76
85
  return {
@@ -86,8 +95,8 @@ const widthChange = (width: number) => {
86
95
  }
87
96
 
88
97
  clientWidth = width;
89
- let left = props.left || 0;
90
- let right = props.right || 0;
98
+ let left = props.left || props.minLeft || 0;
99
+ let right = props.right || props.minRight || 0;
91
100
 
92
101
  if (left > clientWidth) {
93
102
  left = clientWidth / 3;
@@ -27,7 +27,7 @@ defineOptions({
27
27
  name: 'MFieldsStyleSetter',
28
28
  });
29
29
 
30
- defineProps<FieldProps<StyleSchema>>();
30
+ const props = defineProps<FieldProps<StyleSchema>>();
31
31
 
32
32
  const emit = defineEmits<{
33
33
  change: [v: any, eventData: ContainerChangeEventData];
@@ -64,6 +64,9 @@ const collapseValue = shallowRef(
64
64
  );
65
65
 
66
66
  const change = (v: any, eventData: ContainerChangeEventData) => {
67
+ eventData.changeRecords?.forEach((record) => {
68
+ record.propPath = `${props.name}.${record.propPath}`;
69
+ });
67
70
  emit('change', v, eventData);
68
71
  };
69
72
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <MContainer :config="config" :model="values" @change="change"></MContainer>
3
- <Box :model="values" @change="change"></Box>
3
+ <Box v-show="!['fixed', 'absolute'].includes(values.position)" :model="values" @change="change"></Box>
4
4
  </template>
5
5
 
6
6
  <script lang="ts" setup>
@@ -125,7 +125,7 @@ const config = {
125
125
  },
126
126
  {
127
127
  name: 'height',
128
- text: '宽度',
128
+ text: '高度',
129
129
  labelWidth: '68px',
130
130
  type: 'data-source-field-select',
131
131
  fieldConfig: {
@@ -135,25 +135,41 @@ const config = {
135
135
  ],
136
136
  },
137
137
  {
138
- type: 'data-source-field-select',
139
- text: 'overflow',
140
- name: 'overflow',
141
- checkStrictly: false,
142
- dataSourceFieldType: ['string'],
143
- fieldConfig: {
144
- type: 'select',
145
- clearable: true,
146
- allowCreate: true,
147
- options: [
148
- { text: 'visible', value: 'visible' },
149
- { text: 'hidden', value: 'hidden' },
150
- { text: 'clip', value: 'clip' },
151
- { text: 'scroll', value: 'scroll' },
152
- { text: 'auto', value: 'auto' },
153
- { text: 'overlay', value: 'overlay' },
154
- { text: 'initial', value: 'initial' },
155
- ],
156
- },
138
+ type: 'row',
139
+ items: [
140
+ {
141
+ type: 'data-source-field-select',
142
+ text: 'overflow',
143
+ name: 'overflow',
144
+ labelWidth: '68px',
145
+ checkStrictly: false,
146
+ dataSourceFieldType: ['string'],
147
+ fieldConfig: {
148
+ type: 'select',
149
+ clearable: true,
150
+ allowCreate: true,
151
+ options: [
152
+ { text: 'visible', value: 'visible' },
153
+ { text: 'hidden', value: 'hidden' },
154
+ { text: 'clip', value: 'clip' },
155
+ { text: 'scroll', value: 'scroll' },
156
+ { text: 'auto', value: 'auto' },
157
+ { text: 'overlay', value: 'overlay' },
158
+ { text: 'initial', value: 'initial' },
159
+ ],
160
+ },
161
+ },
162
+ {
163
+ type: 'data-source-field-select',
164
+ text: '透明度',
165
+ name: 'opacity',
166
+ labelWidth: '68px',
167
+ dataSourceFieldType: ['string', 'number'],
168
+ fieldConfig: {
169
+ type: 'text',
170
+ },
171
+ },
172
+ ],
157
173
  },
158
174
  ],
159
175
  };
@@ -1,15 +1,12 @@
1
1
  <template>
2
2
  <MContainer :config="config" :model="values" @change="change"></MContainer>
3
- <Position v-show="values['position'] !== 'static'" :model="values" @change="change"></Position>
4
3
  </template>
5
4
 
6
5
  <script lang="ts" setup>
7
6
  import { ContainerChangeEventData, MContainer } from '@tmagic/form';
8
7
  import type { StyleSchema } from '@tmagic/schema';
9
8
 
10
- import Position from '../components/Position.vue';
11
-
12
- defineProps<{ values: Partial<StyleSchema> }>();
9
+ const props = defineProps<{ values: Partial<StyleSchema> }>();
13
10
 
14
11
  const emit = defineEmits<{
15
12
  change: [v: string | StyleSchema, eventData: ContainerChangeEventData];
@@ -30,6 +27,52 @@ const config = {
30
27
  })),
31
28
  },
32
29
  },
30
+ {
31
+ type: 'row',
32
+ labelWidth: '68px',
33
+ display: () => props.values.position !== 'static',
34
+ items: [
35
+ {
36
+ name: 'left',
37
+ type: 'data-source-field-select',
38
+ text: 'left',
39
+ fieldConfig: {
40
+ type: 'text',
41
+ },
42
+ },
43
+ {
44
+ name: 'top',
45
+ type: 'data-source-field-select',
46
+ text: 'top',
47
+ fieldConfig: {
48
+ type: 'text',
49
+ },
50
+ },
51
+ ],
52
+ },
53
+ {
54
+ type: 'row',
55
+ labelWidth: '68px',
56
+ display: () => props.values.position !== 'static',
57
+ items: [
58
+ {
59
+ name: 'right',
60
+ type: 'data-source-field-select',
61
+ text: 'right',
62
+ fieldConfig: {
63
+ type: 'text',
64
+ },
65
+ },
66
+ {
67
+ name: 'bottom',
68
+ type: 'data-source-field-select',
69
+ text: 'bottom',
70
+ fieldConfig: {
71
+ type: 'text',
72
+ },
73
+ },
74
+ ],
75
+ },
33
76
  {
34
77
  labelWidth: '68px',
35
78
  name: 'zIndex',