@tmagic/editor 1.7.2 → 1.7.4
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/style.css +0 -3
- package/dist/tmagic-editor.js +31 -7
- package/dist/tmagic-editor.umd.cjs +31 -7
- package/package.json +7 -7
- package/src/components/CodeBlockEditor.vue +30 -1
- package/src/fields/CodeSelect.vue +7 -0
- package/src/fields/DataSourceMethods.vue +0 -8
- package/src/theme/code-block.scss +0 -3
package/dist/style.css
CHANGED
package/dist/tmagic-editor.js
CHANGED
|
@@ -544,6 +544,10 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
|
|
|
544
544
|
}
|
|
545
545
|
return Array.isArray(model.codeId) ? model.codeId.join("/") : index;
|
|
546
546
|
}
|
|
547
|
+
const codeContent = codeBlockService.getCodeContentById(model.codeId);
|
|
548
|
+
if (codeContent) {
|
|
549
|
+
return codeContent.name;
|
|
550
|
+
}
|
|
547
551
|
return model.codeId || index;
|
|
548
552
|
},
|
|
549
553
|
items: [
|
|
@@ -5401,9 +5405,35 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
5401
5405
|
}
|
|
5402
5406
|
}
|
|
5403
5407
|
]);
|
|
5408
|
+
const parseContent = (content) => {
|
|
5409
|
+
if (typeof content === "string") {
|
|
5410
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
5411
|
+
return parseDSL(content);
|
|
5412
|
+
}
|
|
5413
|
+
return content;
|
|
5414
|
+
};
|
|
5404
5415
|
const submitForm = (values, data) => {
|
|
5405
5416
|
changedValue.value = void 0;
|
|
5406
|
-
emit(
|
|
5417
|
+
emit(
|
|
5418
|
+
"submit",
|
|
5419
|
+
{
|
|
5420
|
+
...values,
|
|
5421
|
+
content: parseContent(values.content)
|
|
5422
|
+
},
|
|
5423
|
+
{
|
|
5424
|
+
...data,
|
|
5425
|
+
changeRecords: data.changeRecords?.map((record) => {
|
|
5426
|
+
let { value } = record;
|
|
5427
|
+
if (record.propPath === "content" && typeof value === "string") {
|
|
5428
|
+
value = parseContent(value);
|
|
5429
|
+
}
|
|
5430
|
+
return {
|
|
5431
|
+
...record,
|
|
5432
|
+
value
|
|
5433
|
+
};
|
|
5434
|
+
})
|
|
5435
|
+
}
|
|
5436
|
+
);
|
|
5407
5437
|
};
|
|
5408
5438
|
const errorHandler = (error) => {
|
|
5409
5439
|
tMagicMessage.error(error.message);
|
|
@@ -5699,12 +5729,6 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
|
5699
5729
|
});
|
|
5700
5730
|
};
|
|
5701
5731
|
const submitCodeHandler = (value, data) => {
|
|
5702
|
-
if (value.content) {
|
|
5703
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
5704
|
-
if (typeof value.content === "string") {
|
|
5705
|
-
value.content = parseDSL(value.content);
|
|
5706
|
-
}
|
|
5707
|
-
}
|
|
5708
5732
|
if (editIndex > -1) {
|
|
5709
5733
|
emit("change", value, {
|
|
5710
5734
|
modifyKey: editIndex,
|
|
@@ -5337,6 +5337,10 @@
|
|
|
5337
5337
|
}
|
|
5338
5338
|
return Array.isArray(model.codeId) ? model.codeId.join("/") : index;
|
|
5339
5339
|
}
|
|
5340
|
+
const codeContent = codeBlockService.getCodeContentById(model.codeId);
|
|
5341
|
+
if (codeContent) {
|
|
5342
|
+
return codeContent.name;
|
|
5343
|
+
}
|
|
5340
5344
|
return model.codeId || index;
|
|
5341
5345
|
},
|
|
5342
5346
|
items: [
|
|
@@ -10194,9 +10198,35 @@
|
|
|
10194
10198
|
}
|
|
10195
10199
|
}
|
|
10196
10200
|
]);
|
|
10201
|
+
const parseContent = (content) => {
|
|
10202
|
+
if (typeof content === "string") {
|
|
10203
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
10204
|
+
return parseDSL(content);
|
|
10205
|
+
}
|
|
10206
|
+
return content;
|
|
10207
|
+
};
|
|
10197
10208
|
const submitForm = (values, data) => {
|
|
10198
10209
|
changedValue.value = void 0;
|
|
10199
|
-
emit(
|
|
10210
|
+
emit(
|
|
10211
|
+
"submit",
|
|
10212
|
+
{
|
|
10213
|
+
...values,
|
|
10214
|
+
content: parseContent(values.content)
|
|
10215
|
+
},
|
|
10216
|
+
{
|
|
10217
|
+
...data,
|
|
10218
|
+
changeRecords: data.changeRecords?.map((record) => {
|
|
10219
|
+
let { value } = record;
|
|
10220
|
+
if (record.propPath === "content" && typeof value === "string") {
|
|
10221
|
+
value = parseContent(value);
|
|
10222
|
+
}
|
|
10223
|
+
return {
|
|
10224
|
+
...record,
|
|
10225
|
+
value
|
|
10226
|
+
};
|
|
10227
|
+
})
|
|
10228
|
+
}
|
|
10229
|
+
);
|
|
10200
10230
|
};
|
|
10201
10231
|
const errorHandler = (error) => {
|
|
10202
10232
|
designPlugin.tMagicMessage.error(error.message);
|
|
@@ -10492,12 +10522,6 @@
|
|
|
10492
10522
|
});
|
|
10493
10523
|
};
|
|
10494
10524
|
const submitCodeHandler = (value, data) => {
|
|
10495
|
-
if (value.content) {
|
|
10496
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
10497
|
-
if (typeof value.content === "string") {
|
|
10498
|
-
value.content = parseDSL(value.content);
|
|
10499
|
-
}
|
|
10500
|
-
}
|
|
10501
10525
|
if (editIndex > -1) {
|
|
10502
10526
|
emit("change", value, {
|
|
10503
10527
|
modifyKey: editIndex,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.
|
|
2
|
+
"version": "1.7.4",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"moveable": "^0.53.0",
|
|
58
58
|
"serialize-javascript": "^7.0.0",
|
|
59
59
|
"sortablejs": "^1.15.6",
|
|
60
|
-
"@tmagic/design": "1.7.
|
|
61
|
-
"@tmagic/
|
|
62
|
-
"@tmagic/form": "1.7.
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/utils": "1.7.
|
|
60
|
+
"@tmagic/design": "1.7.4",
|
|
61
|
+
"@tmagic/stage": "1.7.4",
|
|
62
|
+
"@tmagic/form": "1.7.4",
|
|
63
|
+
"@tmagic/table": "1.7.4",
|
|
64
|
+
"@tmagic/utils": "1.7.4"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/events": "^3.0.3",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"monaco-editor": "^0.48.0",
|
|
76
76
|
"typescript": "^5.9.3",
|
|
77
77
|
"vue": "^3.5.24",
|
|
78
|
-
"@tmagic/core": "1.7.
|
|
78
|
+
"@tmagic/core": "1.7.4"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"typescript": {
|
|
@@ -217,9 +217,38 @@ const functionConfig = computed<FormConfig>(() => [
|
|
|
217
217
|
},
|
|
218
218
|
]);
|
|
219
219
|
|
|
220
|
+
const parseContent = (content: any) => {
|
|
221
|
+
if (typeof content === 'string') {
|
|
222
|
+
// 如果是字符串则转换为函数
|
|
223
|
+
const parseDSL = getEditorConfig('parseDSL');
|
|
224
|
+
return parseDSL<(..._args: any[]) => any>(content);
|
|
225
|
+
}
|
|
226
|
+
return content;
|
|
227
|
+
};
|
|
228
|
+
|
|
220
229
|
const submitForm = (values: CodeBlockContent, data: ContainerChangeEventData) => {
|
|
221
230
|
changedValue.value = undefined;
|
|
222
|
-
|
|
231
|
+
|
|
232
|
+
emit(
|
|
233
|
+
'submit',
|
|
234
|
+
{
|
|
235
|
+
...values,
|
|
236
|
+
content: parseContent(values.content),
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
...data,
|
|
240
|
+
changeRecords: data.changeRecords?.map((record) => {
|
|
241
|
+
let { value } = record;
|
|
242
|
+
if (record.propPath === 'content' && typeof value === 'string') {
|
|
243
|
+
value = parseContent(value);
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
...record,
|
|
247
|
+
value,
|
|
248
|
+
};
|
|
249
|
+
}),
|
|
250
|
+
},
|
|
251
|
+
);
|
|
223
252
|
};
|
|
224
253
|
|
|
225
254
|
const errorHandler = (error: any) => {
|
|
@@ -56,6 +56,13 @@ const codeConfig = computed<GroupListConfig>(() => ({
|
|
|
56
56
|
|
|
57
57
|
return Array.isArray(model.codeId) ? model.codeId.join('/') : index;
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
const codeContent = codeBlockService.getCodeContentById(model.codeId);
|
|
61
|
+
|
|
62
|
+
if (codeContent) {
|
|
63
|
+
return codeContent.name;
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
return model.codeId || index;
|
|
60
67
|
},
|
|
61
68
|
items: [
|
|
@@ -31,7 +31,6 @@ import { type ColumnConfig, MagicTable } from '@tmagic/table';
|
|
|
31
31
|
|
|
32
32
|
import CodeBlockEditor from '@editor/components/CodeBlockEditor.vue';
|
|
33
33
|
import type { CodeParamStatement } from '@editor/type';
|
|
34
|
-
import { getEditorConfig } from '@editor/utils/config';
|
|
35
34
|
|
|
36
35
|
defineOptions({
|
|
37
36
|
name: 'MFieldsDataSourceMethods',
|
|
@@ -119,13 +118,6 @@ const createCodeHandler = () => {
|
|
|
119
118
|
};
|
|
120
119
|
|
|
121
120
|
const submitCodeHandler = (value: CodeBlockContent, data: ContainerChangeEventData) => {
|
|
122
|
-
if (value.content) {
|
|
123
|
-
// 在保存的时候转换代码内容
|
|
124
|
-
const parseDSL = getEditorConfig('parseDSL');
|
|
125
|
-
if (typeof value.content === 'string') {
|
|
126
|
-
value.content = parseDSL<(..._args: any[]) => any>(value.content);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
121
|
if (editIndex > -1) {
|
|
130
122
|
emit('change', value, {
|
|
131
123
|
modifyKey: editIndex,
|