@tmagic/editor 1.5.14 → 1.5.16
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/dist/tmagic-editor.js +52 -47
- package/dist/tmagic-editor.umd.cjs +52 -47
- package/package.json +7 -7
- package/src/initService.ts +4 -4
- package/src/utils/props.ts +59 -48
package/dist/tmagic-editor.js
CHANGED
|
@@ -668,52 +668,57 @@ const displayTabConfig = {
|
|
|
668
668
|
}
|
|
669
669
|
]
|
|
670
670
|
};
|
|
671
|
-
const fillConfig$1 = (config = [], labelWidth = "80px") =>
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
// 组件类型,必须要有
|
|
680
|
-
{
|
|
681
|
-
text: "type",
|
|
682
|
-
name: "type",
|
|
683
|
-
type: "hidden"
|
|
684
|
-
},
|
|
685
|
-
// 组件id,必须要有
|
|
686
|
-
{
|
|
687
|
-
name: "id",
|
|
688
|
-
text: "ID",
|
|
689
|
-
type: "text",
|
|
690
|
-
disabled: true,
|
|
691
|
-
append: {
|
|
692
|
-
type: "button",
|
|
693
|
-
text: "复制",
|
|
694
|
-
handler: (vm, { model }) => {
|
|
695
|
-
navigator.clipboard.writeText(`${model.id}`).then(() => {
|
|
696
|
-
tMagicMessage.success("已复制");
|
|
697
|
-
}).catch(() => {
|
|
698
|
-
tMagicMessage.error("复制失败");
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
name: "name",
|
|
705
|
-
text: "组件名称"
|
|
706
|
-
},
|
|
707
|
-
...config
|
|
708
|
-
]
|
|
709
|
-
},
|
|
710
|
-
{ ...styleTabConfig },
|
|
711
|
-
{ ...eventTabConfig },
|
|
712
|
-
{ ...advancedTabConfig },
|
|
713
|
-
{ ...displayTabConfig }
|
|
714
|
-
]
|
|
671
|
+
const fillConfig$1 = (config = [], labelWidth = "80px") => {
|
|
672
|
+
const propsConfig = [];
|
|
673
|
+
if (!config.find((item) => item.name === "type")) {
|
|
674
|
+
propsConfig.push({
|
|
675
|
+
text: "type",
|
|
676
|
+
name: "type",
|
|
677
|
+
type: "hidden"
|
|
678
|
+
});
|
|
715
679
|
}
|
|
716
|
-
|
|
680
|
+
if (!config.find((item) => item.name === "id")) {
|
|
681
|
+
propsConfig.push({
|
|
682
|
+
name: "id",
|
|
683
|
+
text: "ID",
|
|
684
|
+
type: "text",
|
|
685
|
+
disabled: true,
|
|
686
|
+
append: {
|
|
687
|
+
type: "button",
|
|
688
|
+
text: "复制",
|
|
689
|
+
handler: (vm, { model }) => {
|
|
690
|
+
navigator.clipboard.writeText(`${model.id}`).then(() => {
|
|
691
|
+
tMagicMessage.success("已复制");
|
|
692
|
+
}).catch(() => {
|
|
693
|
+
tMagicMessage.error("复制失败");
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
if (!config.find((item) => item.name === "name")) {
|
|
700
|
+
propsConfig.push({
|
|
701
|
+
name: "name",
|
|
702
|
+
text: "组件名称"
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
return [
|
|
706
|
+
{
|
|
707
|
+
type: "tab",
|
|
708
|
+
labelWidth,
|
|
709
|
+
items: [
|
|
710
|
+
{
|
|
711
|
+
title: "属性",
|
|
712
|
+
items: [...propsConfig, ...config]
|
|
713
|
+
},
|
|
714
|
+
{ ...styleTabConfig },
|
|
715
|
+
{ ...eventTabConfig },
|
|
716
|
+
{ ...advancedTabConfig },
|
|
717
|
+
{ ...displayTabConfig }
|
|
718
|
+
]
|
|
719
|
+
}
|
|
720
|
+
];
|
|
721
|
+
};
|
|
717
722
|
|
|
718
723
|
const log = (...args) => {
|
|
719
724
|
if (process.env.NODE_ENV === "development") {
|
|
@@ -14651,10 +14656,10 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
14651
14656
|
const getTMagicApp = () => {
|
|
14652
14657
|
const renderer = editorService.get("stage")?.renderer;
|
|
14653
14658
|
if (!renderer) {
|
|
14654
|
-
return void 0;
|
|
14659
|
+
return Promise.resolve(void 0);
|
|
14655
14660
|
}
|
|
14656
14661
|
if (renderer.runtime) {
|
|
14657
|
-
return renderer.runtime.getApp?.();
|
|
14662
|
+
return Promise.resolve(renderer.runtime.getApp?.());
|
|
14658
14663
|
}
|
|
14659
14664
|
return new Promise((resolve) => {
|
|
14660
14665
|
const timeout = globalThis.setTimeout(() => {
|
|
@@ -5461,52 +5461,57 @@
|
|
|
5461
5461
|
}
|
|
5462
5462
|
]
|
|
5463
5463
|
};
|
|
5464
|
-
const fillConfig$1 = (config = [], labelWidth = "80px") =>
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
// 组件类型,必须要有
|
|
5473
|
-
{
|
|
5474
|
-
text: "type",
|
|
5475
|
-
name: "type",
|
|
5476
|
-
type: "hidden"
|
|
5477
|
-
},
|
|
5478
|
-
// 组件id,必须要有
|
|
5479
|
-
{
|
|
5480
|
-
name: "id",
|
|
5481
|
-
text: "ID",
|
|
5482
|
-
type: "text",
|
|
5483
|
-
disabled: true,
|
|
5484
|
-
append: {
|
|
5485
|
-
type: "button",
|
|
5486
|
-
text: "复制",
|
|
5487
|
-
handler: (vm, { model }) => {
|
|
5488
|
-
navigator.clipboard.writeText(`${model.id}`).then(() => {
|
|
5489
|
-
designPlugin.tMagicMessage.success("已复制");
|
|
5490
|
-
}).catch(() => {
|
|
5491
|
-
designPlugin.tMagicMessage.error("复制失败");
|
|
5492
|
-
});
|
|
5493
|
-
}
|
|
5494
|
-
}
|
|
5495
|
-
},
|
|
5496
|
-
{
|
|
5497
|
-
name: "name",
|
|
5498
|
-
text: "组件名称"
|
|
5499
|
-
},
|
|
5500
|
-
...config
|
|
5501
|
-
]
|
|
5502
|
-
},
|
|
5503
|
-
{ ...styleTabConfig },
|
|
5504
|
-
{ ...eventTabConfig },
|
|
5505
|
-
{ ...advancedTabConfig },
|
|
5506
|
-
{ ...displayTabConfig }
|
|
5507
|
-
]
|
|
5464
|
+
const fillConfig$1 = (config = [], labelWidth = "80px") => {
|
|
5465
|
+
const propsConfig = [];
|
|
5466
|
+
if (!config.find((item) => item.name === "type")) {
|
|
5467
|
+
propsConfig.push({
|
|
5468
|
+
text: "type",
|
|
5469
|
+
name: "type",
|
|
5470
|
+
type: "hidden"
|
|
5471
|
+
});
|
|
5508
5472
|
}
|
|
5509
|
-
|
|
5473
|
+
if (!config.find((item) => item.name === "id")) {
|
|
5474
|
+
propsConfig.push({
|
|
5475
|
+
name: "id",
|
|
5476
|
+
text: "ID",
|
|
5477
|
+
type: "text",
|
|
5478
|
+
disabled: true,
|
|
5479
|
+
append: {
|
|
5480
|
+
type: "button",
|
|
5481
|
+
text: "复制",
|
|
5482
|
+
handler: (vm, { model }) => {
|
|
5483
|
+
navigator.clipboard.writeText(`${model.id}`).then(() => {
|
|
5484
|
+
designPlugin.tMagicMessage.success("已复制");
|
|
5485
|
+
}).catch(() => {
|
|
5486
|
+
designPlugin.tMagicMessage.error("复制失败");
|
|
5487
|
+
});
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
});
|
|
5491
|
+
}
|
|
5492
|
+
if (!config.find((item) => item.name === "name")) {
|
|
5493
|
+
propsConfig.push({
|
|
5494
|
+
name: "name",
|
|
5495
|
+
text: "组件名称"
|
|
5496
|
+
});
|
|
5497
|
+
}
|
|
5498
|
+
return [
|
|
5499
|
+
{
|
|
5500
|
+
type: "tab",
|
|
5501
|
+
labelWidth,
|
|
5502
|
+
items: [
|
|
5503
|
+
{
|
|
5504
|
+
title: "属性",
|
|
5505
|
+
items: [...propsConfig, ...config]
|
|
5506
|
+
},
|
|
5507
|
+
{ ...styleTabConfig },
|
|
5508
|
+
{ ...eventTabConfig },
|
|
5509
|
+
{ ...advancedTabConfig },
|
|
5510
|
+
{ ...displayTabConfig }
|
|
5511
|
+
]
|
|
5512
|
+
}
|
|
5513
|
+
];
|
|
5514
|
+
};
|
|
5510
5515
|
|
|
5511
5516
|
const log = (...args) => {
|
|
5512
5517
|
if (process.env.NODE_ENV === "development") {
|
|
@@ -19444,10 +19449,10 @@
|
|
|
19444
19449
|
const getTMagicApp = () => {
|
|
19445
19450
|
const renderer = editorService.get("stage")?.renderer;
|
|
19446
19451
|
if (!renderer) {
|
|
19447
|
-
return void 0;
|
|
19452
|
+
return Promise.resolve(void 0);
|
|
19448
19453
|
}
|
|
19449
19454
|
if (renderer.runtime) {
|
|
19450
|
-
return renderer.runtime.getApp?.();
|
|
19455
|
+
return Promise.resolve(renderer.runtime.getApp?.());
|
|
19451
19456
|
}
|
|
19452
19457
|
return new Promise((resolve) => {
|
|
19453
19458
|
const timeout = globalThis.setTimeout(() => {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.16",
|
|
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": "^6.0.0",
|
|
60
60
|
"sortablejs": "^1.15.2",
|
|
61
|
-
"@tmagic/
|
|
62
|
-
"@tmagic/
|
|
63
|
-
"@tmagic/table": "1.5.
|
|
64
|
-
"@tmagic/
|
|
65
|
-
"@tmagic/utils": "1.5.
|
|
61
|
+
"@tmagic/form": "1.5.16",
|
|
62
|
+
"@tmagic/stage": "1.5.16",
|
|
63
|
+
"@tmagic/table": "1.5.16",
|
|
64
|
+
"@tmagic/design": "1.5.16",
|
|
65
|
+
"@tmagic/utils": "1.5.16"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/events": "^3.0.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"monaco-editor": "^0.48.0",
|
|
77
77
|
"typescript": "*",
|
|
78
78
|
"vue": ">=3.5.0",
|
|
79
|
-
"@tmagic/core": "1.5.
|
|
79
|
+
"@tmagic/core": "1.5.16"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"typescript": {
|
package/src/initService.ts
CHANGED
|
@@ -214,20 +214,20 @@ export const initServiceEvents = (
|
|
|
214
214
|
((event: 'update:modelValue', value: MApp | null) => void),
|
|
215
215
|
{ editorService, codeBlockService, dataSourceService, depService }: Services,
|
|
216
216
|
) => {
|
|
217
|
-
const getTMagicApp = () => {
|
|
217
|
+
const getTMagicApp = (): Promise<TMagicCore | undefined> => {
|
|
218
218
|
const renderer = editorService.get('stage')?.renderer;
|
|
219
219
|
if (!renderer) {
|
|
220
|
-
return
|
|
220
|
+
return Promise.resolve(void 0);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
if (renderer.runtime) {
|
|
224
|
-
return renderer.runtime.getApp?.();
|
|
224
|
+
return Promise.resolve(renderer.runtime.getApp?.());
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
return new Promise<TMagicCore | undefined>((resolve) => {
|
|
228
228
|
// 设置 10s 超时
|
|
229
229
|
const timeout = globalThis.setTimeout(() => {
|
|
230
|
-
resolve(
|
|
230
|
+
resolve(void 0);
|
|
231
231
|
}, 10000);
|
|
232
232
|
|
|
233
233
|
renderer.on('runtime-ready', () => {
|
package/src/utils/props.ts
CHANGED
|
@@ -156,52 +156,63 @@ export const displayTabConfig: TabPaneConfig = {
|
|
|
156
156
|
* @param config 组件属性配置
|
|
157
157
|
* @returns Object
|
|
158
158
|
*/
|
|
159
|
-
export const fillConfig = (config: FormConfig = [], labelWidth = '80px'): FormConfig =>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: 'name',
|
|
196
|
-
text: '组件名称',
|
|
197
|
-
},
|
|
198
|
-
...config,
|
|
199
|
-
],
|
|
159
|
+
export const fillConfig = (config: FormConfig = [], labelWidth = '80px'): FormConfig => {
|
|
160
|
+
const propsConfig: FormConfig = [];
|
|
161
|
+
|
|
162
|
+
// 组件类型,必须要有
|
|
163
|
+
if (!config.find((item) => item.name === 'type')) {
|
|
164
|
+
propsConfig.push({
|
|
165
|
+
text: 'type',
|
|
166
|
+
name: 'type',
|
|
167
|
+
type: 'hidden',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!config.find((item) => item.name === 'id')) {
|
|
172
|
+
// 组件id,必须要有
|
|
173
|
+
propsConfig.push({
|
|
174
|
+
name: 'id',
|
|
175
|
+
text: 'ID',
|
|
176
|
+
type: 'text',
|
|
177
|
+
disabled: true,
|
|
178
|
+
append: {
|
|
179
|
+
type: 'button',
|
|
180
|
+
text: '复制',
|
|
181
|
+
handler: (vm, { model }) => {
|
|
182
|
+
navigator.clipboard
|
|
183
|
+
.writeText(`${model.id}`)
|
|
184
|
+
.then(() => {
|
|
185
|
+
tMagicMessage.success('已复制');
|
|
186
|
+
})
|
|
187
|
+
.catch(() => {
|
|
188
|
+
tMagicMessage.error('复制失败');
|
|
189
|
+
});
|
|
190
|
+
},
|
|
200
191
|
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!config.find((item) => item.name === 'name')) {
|
|
196
|
+
propsConfig.push({
|
|
197
|
+
name: 'name',
|
|
198
|
+
text: '组件名称',
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return [
|
|
203
|
+
{
|
|
204
|
+
type: 'tab',
|
|
205
|
+
labelWidth,
|
|
206
|
+
items: [
|
|
207
|
+
{
|
|
208
|
+
title: '属性',
|
|
209
|
+
items: [...propsConfig, ...config],
|
|
210
|
+
},
|
|
211
|
+
{ ...styleTabConfig },
|
|
212
|
+
{ ...eventTabConfig },
|
|
213
|
+
{ ...advancedTabConfig },
|
|
214
|
+
{ ...displayTabConfig },
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
};
|