@tmagic/editor 1.7.3 → 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/tmagic-editor.js
CHANGED
|
@@ -5405,9 +5405,35 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
|
|
|
5405
5405
|
}
|
|
5406
5406
|
}
|
|
5407
5407
|
]);
|
|
5408
|
+
const parseContent = (content) => {
|
|
5409
|
+
if (typeof content === "string") {
|
|
5410
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
5411
|
+
return parseDSL(content);
|
|
5412
|
+
}
|
|
5413
|
+
return content;
|
|
5414
|
+
};
|
|
5408
5415
|
const submitForm = (values, data) => {
|
|
5409
5416
|
changedValue.value = void 0;
|
|
5410
|
-
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
|
+
);
|
|
5411
5437
|
};
|
|
5412
5438
|
const errorHandler = (error) => {
|
|
5413
5439
|
tMagicMessage.error(error.message);
|
|
@@ -5703,12 +5729,6 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
|
|
|
5703
5729
|
});
|
|
5704
5730
|
};
|
|
5705
5731
|
const submitCodeHandler = (value, data) => {
|
|
5706
|
-
if (value.content) {
|
|
5707
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
5708
|
-
if (typeof value.content === "string") {
|
|
5709
|
-
value.content = parseDSL(value.content);
|
|
5710
|
-
}
|
|
5711
|
-
}
|
|
5712
5732
|
if (editIndex > -1) {
|
|
5713
5733
|
emit("change", value, {
|
|
5714
5734
|
modifyKey: editIndex,
|
|
@@ -10198,9 +10198,35 @@
|
|
|
10198
10198
|
}
|
|
10199
10199
|
}
|
|
10200
10200
|
]);
|
|
10201
|
+
const parseContent = (content) => {
|
|
10202
|
+
if (typeof content === "string") {
|
|
10203
|
+
const parseDSL = getEditorConfig("parseDSL");
|
|
10204
|
+
return parseDSL(content);
|
|
10205
|
+
}
|
|
10206
|
+
return content;
|
|
10207
|
+
};
|
|
10201
10208
|
const submitForm = (values, data) => {
|
|
10202
10209
|
changedValue.value = void 0;
|
|
10203
|
-
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
|
+
);
|
|
10204
10230
|
};
|
|
10205
10231
|
const errorHandler = (error) => {
|
|
10206
10232
|
designPlugin.tMagicMessage.error(error.message);
|
|
@@ -10496,12 +10522,6 @@
|
|
|
10496
10522
|
});
|
|
10497
10523
|
};
|
|
10498
10524
|
const submitCodeHandler = (value, data) => {
|
|
10499
|
-
if (value.content) {
|
|
10500
|
-
const parseDSL = getEditorConfig("parseDSL");
|
|
10501
|
-
if (typeof value.content === "string") {
|
|
10502
|
-
value.content = parseDSL(value.content);
|
|
10503
|
-
}
|
|
10504
|
-
}
|
|
10505
10525
|
if (editIndex > -1) {
|
|
10506
10526
|
emit("change", value, {
|
|
10507
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/stage": "1.7.
|
|
62
|
-
"@tmagic/
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
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) => {
|
|
@@ -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,
|