@tmagic/editor 1.3.1 → 1.3.2
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 +50 -0
- package/dist/tmagic-editor.js +577 -574
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +586 -585
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +15 -13
- package/src/components/CodeBlockEditor.vue +6 -4
- package/src/fields/DataSourceSelect.vue +15 -9
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-code-block-edit.ts +2 -0
- package/src/hooks/use-float-box.ts +153 -0
- package/src/index.ts +1 -0
- package/src/initService.ts +12 -11
- package/src/layouts/Framework.vue +10 -1
- package/src/layouts/sidebar/Sidebar.vue +90 -5
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +2 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +11 -10
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +6 -4
- package/src/layouts/sidebar/data-source/DataSourceList.vue +9 -8
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +15 -15
- package/src/layouts/sidebar/layer/use-drag.ts +4 -0
- package/src/layouts/sidebar/layer/use-node-status.ts +20 -15
- package/src/services/dataSource.ts +4 -0
- package/src/services/dep.ts +22 -284
- package/src/services/ui.ts +15 -0
- package/src/theme/code-block.scss +5 -0
- package/src/theme/floatbox.scss +48 -0
- package/src/theme/sidebar.scss +1 -0
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +30 -20
- package/types/components/CodeBlockEditor.vue.d.ts +3 -0
- package/types/fields/DataSourceSelect.vue.d.ts +6 -4
- package/types/hooks/index.d.ts +1 -0
- package/types/hooks/use-code-block-edit.d.ts +26 -46
- package/types/hooks/use-data-source-method.d.ts +26 -46
- package/types/hooks/use-float-box.d.ts +15 -0
- package/types/index.d.ts +1 -0
- package/types/layouts/PropsPanel.vue.d.ts +92 -59
- package/types/layouts/sidebar/Sidebar.vue.d.ts +1 -2
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -1
- package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +3 -1
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +3 -0
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +15 -2
- package/types/layouts/sidebar/layer/use-click.d.ts +7 -46
- package/types/services/dataSource.d.ts +10 -2
- package/types/services/dep.d.ts +12 -112
- package/types/services/ui.d.ts +8 -0
- package/types/type.d.ts +23 -18
- package/src/utils/dep.ts +0 -81
- package/types/utils/dep.d.ts +0 -6
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, createTextVNode, createCommentVNode, toRaw,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, onUnmounted, openBlock, createElementBlock, createBlock, Teleport, createElementVNode, normalizeClass, normalizeStyle, createVNode, unref, computed, reactive, resolveComponent, inject, withCtx, Fragment, resolveDynamicComponent, createTextVNode, createCommentVNode, toRaw, nextTick, mergeProps, toDisplayString, renderList, watchEffect, withModifiers, renderSlot, createSlots, normalizeProps, markRaw, getCurrentInstance, withDirectives, vShow, createStaticVNode, provide, Transition, toHandlers, mergeDefaults } from 'vue';
|
|
2
2
|
import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Search, Aim, ArrowRight, CopyDocument, DocumentCopy, Files, Hide, Goods, List, EditPen, Top, Bottom, ArrowLeftBold, ArrowRightBold, CaretBottom } from '@element-plus/icons-vue';
|
|
3
3
|
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has, pick, keys } from 'lodash-es';
|
|
4
4
|
import * as monaco from 'monaco-editor';
|
|
5
5
|
import serialize from 'serialize-javascript';
|
|
6
6
|
import { TMagicButton, TMagicCard, tMagicMessage, TMagicDialog, TMagicTag, tMagicMessageBox, TMagicIcon, getConfig as getConfig$1, TMagicSwitch, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicTree, TMagicPopover, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
7
7
|
import { HookType, NodeType, ActionType } from '@tmagic/schema';
|
|
8
|
-
import { MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
|
|
8
|
+
import { MFormBox, MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
|
|
9
9
|
import { MagicTable } from '@tmagic/table';
|
|
10
|
-
import { guid, isPop, getNodePath, isNumber, isPage, toLine, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getDefaultValueFromFields, getKeys, addClassName, removeClassName, removeClassNameByClassName, getNodes
|
|
10
|
+
import { guid, isPop, getNodePath, isNumber, isPage, toLine, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getDefaultValueFromFields, getKeys, addClassName, removeClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
11
11
|
import Gesto from 'gesto';
|
|
12
|
+
import Moveable from 'moveable';
|
|
13
|
+
import { DepTargetType, Watcher, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/dep';
|
|
12
14
|
import StageCore, { GuidesType, StageDragStatus, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
13
15
|
import { EventEmitter } from 'events';
|
|
14
16
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
@@ -41,8 +43,9 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
41
43
|
parse: { type: Boolean, default: false }
|
|
42
44
|
},
|
|
43
45
|
emits: ["initd", "save"],
|
|
44
|
-
setup(__props, { expose: __expose, emit }) {
|
|
46
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
45
47
|
const props = __props;
|
|
48
|
+
const emit = __emit;
|
|
46
49
|
const toString = (v, language) => {
|
|
47
50
|
let value = "";
|
|
48
51
|
if (typeof v !== "string") {
|
|
@@ -225,7 +228,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
225
228
|
lastValues: {}
|
|
226
229
|
},
|
|
227
230
|
emits: ["change"],
|
|
228
|
-
setup(__props, { emit }) {
|
|
231
|
+
setup(__props, { emit: __emit }) {
|
|
232
|
+
const emit = __emit;
|
|
229
233
|
const props = __props;
|
|
230
234
|
const save = (v) => {
|
|
231
235
|
props.model[props.name] = v;
|
|
@@ -264,8 +268,9 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
264
268
|
lastValues: {}
|
|
265
269
|
},
|
|
266
270
|
emits: ["change"],
|
|
267
|
-
setup(__props, { emit }) {
|
|
271
|
+
setup(__props, { emit: __emit }) {
|
|
268
272
|
const props = __props;
|
|
273
|
+
const emit = __emit;
|
|
269
274
|
const formConfig = computed(() => {
|
|
270
275
|
const { codeOptions, ...config } = props.config;
|
|
271
276
|
return {
|
|
@@ -343,9 +348,10 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
343
348
|
lastValues: {}
|
|
344
349
|
},
|
|
345
350
|
emits: ["change"],
|
|
346
|
-
setup(__props, { emit }) {
|
|
347
|
-
const
|
|
351
|
+
setup(__props, { emit: __emit }) {
|
|
352
|
+
const emit = __emit;
|
|
348
353
|
const services = inject("services");
|
|
354
|
+
const props = __props;
|
|
349
355
|
const codeConfig = computed(() => ({
|
|
350
356
|
type: "group-list",
|
|
351
357
|
name: "hookData",
|
|
@@ -411,11 +417,13 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
411
417
|
content: {},
|
|
412
418
|
disabled: { type: Boolean },
|
|
413
419
|
isDataSource: { type: Boolean },
|
|
414
|
-
dataSourceType: {}
|
|
420
|
+
dataSourceType: {},
|
|
421
|
+
slideType: {}
|
|
415
422
|
},
|
|
416
423
|
emits: ["submit"],
|
|
417
|
-
setup(__props, { expose: __expose, emit }) {
|
|
424
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
418
425
|
const props = __props;
|
|
426
|
+
const emit = __emit;
|
|
419
427
|
const services = inject("services");
|
|
420
428
|
const difVisible = ref(false);
|
|
421
429
|
const height = ref(globalThis.innerHeight);
|
|
@@ -582,7 +590,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
582
590
|
});
|
|
583
591
|
return (_ctx, _cache) => {
|
|
584
592
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
585
|
-
|
|
593
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.slideType === "box" ? unref(MFormBox) : unref(MFormDrawer)), {
|
|
586
594
|
class: "m-editor-code-block-editor",
|
|
587
595
|
ref_key: "fomDrawer",
|
|
588
596
|
ref: fomDrawer,
|
|
@@ -613,7 +621,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
613
621
|
})
|
|
614
622
|
]),
|
|
615
623
|
_: 1
|
|
616
|
-
},
|
|
624
|
+
}, 40, ["title", "width", "config", "values", "disabled"])),
|
|
617
625
|
createVNode(unref(TMagicDialog), {
|
|
618
626
|
modelValue: difVisible.value,
|
|
619
627
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => difVisible.value = $event),
|
|
@@ -1122,12 +1130,14 @@ class DataSource extends BaseService {
|
|
|
1122
1130
|
};
|
|
1123
1131
|
this.get("dataSources").push(newConfig);
|
|
1124
1132
|
this.emit("add", newConfig);
|
|
1133
|
+
return newConfig;
|
|
1125
1134
|
}
|
|
1126
1135
|
update(config) {
|
|
1127
1136
|
const dataSources = this.get("dataSources");
|
|
1128
1137
|
const index = dataSources.findIndex((ds) => ds.id === config.id);
|
|
1129
1138
|
dataSources[index] = cloneDeep(config);
|
|
1130
1139
|
this.emit("update", config);
|
|
1140
|
+
return config;
|
|
1131
1141
|
}
|
|
1132
1142
|
remove(id) {
|
|
1133
1143
|
const dataSources = this.get("dataSources");
|
|
@@ -1550,14 +1560,6 @@ var KeyBindingCommand = /* @__PURE__ */ ((KeyBindingCommand2) => {
|
|
|
1550
1560
|
KeyBindingCommand2["SWITCH_NODE"] = "tmagic-system-switch-node";
|
|
1551
1561
|
return KeyBindingCommand2;
|
|
1552
1562
|
})(KeyBindingCommand || {});
|
|
1553
|
-
var DepTargetType = /* @__PURE__ */ ((DepTargetType2) => {
|
|
1554
|
-
DepTargetType2["DEFAULT"] = "default";
|
|
1555
|
-
DepTargetType2["CODE_BLOCK"] = "code-block";
|
|
1556
|
-
DepTargetType2["DATA_SOURCE"] = "data-source";
|
|
1557
|
-
DepTargetType2["DATA_SOURCE_METHOD"] = "data-source-method";
|
|
1558
|
-
DepTargetType2["DATA_SOURCE_COND"] = "data-source-cond";
|
|
1559
|
-
return DepTargetType2;
|
|
1560
|
-
})(DepTargetType || {});
|
|
1561
1563
|
var DragType = /* @__PURE__ */ ((DragType2) => {
|
|
1562
1564
|
DragType2["COMPONENT_LIST"] = "component-list";
|
|
1563
1565
|
DragType2["LAYER_TREE"] = "layer-tree";
|
|
@@ -2977,8 +2979,9 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
2977
2979
|
paramsConfig: {}
|
|
2978
2980
|
},
|
|
2979
2981
|
emits: ["change"],
|
|
2980
|
-
setup(__props, { emit }) {
|
|
2982
|
+
setup(__props, { emit: __emit }) {
|
|
2981
2983
|
const props = __props;
|
|
2984
|
+
const emit = __emit;
|
|
2982
2985
|
const form = ref();
|
|
2983
2986
|
const getFormConfig = (items = []) => [
|
|
2984
2987
|
{
|
|
@@ -3102,6 +3105,7 @@ const useCodeBlockEdit = (codeBlockService) => {
|
|
|
3102
3105
|
if (!codeId.value)
|
|
3103
3106
|
return;
|
|
3104
3107
|
await codeBlockService?.setCodeDslById(codeId.value, values);
|
|
3108
|
+
tMagicMessage.success("代码块保存成功");
|
|
3105
3109
|
codeBlockEditor.value?.hide();
|
|
3106
3110
|
};
|
|
3107
3111
|
return {
|
|
@@ -3134,9 +3138,10 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
3134
3138
|
lastValues: {}
|
|
3135
3139
|
},
|
|
3136
3140
|
emits: ["change"],
|
|
3137
|
-
setup(__props, { emit }) {
|
|
3138
|
-
const props = __props;
|
|
3141
|
+
setup(__props, { emit: __emit }) {
|
|
3139
3142
|
const services = inject("services");
|
|
3143
|
+
const emit = __emit;
|
|
3144
|
+
const props = __props;
|
|
3140
3145
|
const getParamItemsConfig = (codeId) => {
|
|
3141
3146
|
if (!codeDsl.value || !codeId)
|
|
3142
3147
|
return [];
|
|
@@ -3245,8 +3250,9 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
3245
3250
|
lastValues: {}
|
|
3246
3251
|
},
|
|
3247
3252
|
emits: ["change"],
|
|
3248
|
-
setup(__props, { emit }) {
|
|
3253
|
+
setup(__props, { emit: __emit }) {
|
|
3249
3254
|
const props = __props;
|
|
3255
|
+
const emit = __emit;
|
|
3250
3256
|
const services = inject("services");
|
|
3251
3257
|
const addDialog = ref();
|
|
3252
3258
|
const fieldValues = ref({});
|
|
@@ -3530,9 +3536,10 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
3530
3536
|
lastValues: {}
|
|
3531
3537
|
},
|
|
3532
3538
|
emits: ["change"],
|
|
3533
|
-
setup(__props, { emit }) {
|
|
3534
|
-
const props = __props;
|
|
3539
|
+
setup(__props, { emit: __emit }) {
|
|
3535
3540
|
const services = inject("services");
|
|
3541
|
+
const emit = __emit;
|
|
3542
|
+
const props = __props;
|
|
3536
3543
|
const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
|
|
3537
3544
|
const getOptionChildren = (fields = []) => fields.map((field) => ({
|
|
3538
3545
|
label: field.title || field.name,
|
|
@@ -3590,8 +3597,9 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
3590
3597
|
lastValues: {}
|
|
3591
3598
|
},
|
|
3592
3599
|
emits: ["change"],
|
|
3593
|
-
setup(__props, { emit }) {
|
|
3600
|
+
setup(__props, { emit: __emit }) {
|
|
3594
3601
|
const props = __props;
|
|
3602
|
+
const emit = __emit;
|
|
3595
3603
|
const { dataSourceService } = inject("services") || {};
|
|
3596
3604
|
const autocomplete = ref();
|
|
3597
3605
|
const isFocused = ref(false);
|
|
@@ -3899,8 +3907,9 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
3899
3907
|
lastValues: {}
|
|
3900
3908
|
},
|
|
3901
3909
|
emits: ["change"],
|
|
3902
|
-
setup(__props, { emit }) {
|
|
3910
|
+
setup(__props, { emit: __emit }) {
|
|
3903
3911
|
const props = __props;
|
|
3912
|
+
const emit = __emit;
|
|
3904
3913
|
const { codeConfig, codeBlockEditor, createCode, editCode, deleteCode, submitCode } = useDataSourceMethod();
|
|
3905
3914
|
const methodColumns = [
|
|
3906
3915
|
{
|
|
@@ -4004,10 +4013,11 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
4004
4013
|
lastValues: {}
|
|
4005
4014
|
},
|
|
4006
4015
|
emits: ["change"],
|
|
4007
|
-
setup(__props, { emit }) {
|
|
4008
|
-
const props = __props;
|
|
4016
|
+
setup(__props, { emit: __emit }) {
|
|
4009
4017
|
const services = inject("services");
|
|
4018
|
+
const emit = __emit;
|
|
4010
4019
|
const dataSourceService = services?.dataSourceService;
|
|
4020
|
+
const props = __props;
|
|
4011
4021
|
const dataSources = computed(() => dataSourceService?.get("dataSources"));
|
|
4012
4022
|
const getParamItemsConfig = ([dataSourceId, medthodName] = ["", ""]) => {
|
|
4013
4023
|
if (!dataSourceId)
|
|
@@ -4125,8 +4135,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
4125
4135
|
lastValues: {}
|
|
4126
4136
|
},
|
|
4127
4137
|
emits: ["change"],
|
|
4128
|
-
setup(__props, { emit }) {
|
|
4138
|
+
setup(__props, { emit: __emit }) {
|
|
4129
4139
|
const props = __props;
|
|
4140
|
+
const emit = __emit;
|
|
4130
4141
|
const services = inject("services");
|
|
4131
4142
|
const width = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
4132
4143
|
const addDialog = ref();
|
|
@@ -4356,18 +4367,20 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
4356
4367
|
lastValues: {}
|
|
4357
4368
|
},
|
|
4358
4369
|
emits: ["change"],
|
|
4359
|
-
setup(__props, { emit }) {
|
|
4370
|
+
setup(__props, { emit: __emit }) {
|
|
4371
|
+
const emit = __emit;
|
|
4360
4372
|
const props = __props;
|
|
4361
4373
|
const { dataSourceService } = inject("services") || {};
|
|
4362
4374
|
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
4363
4375
|
const selectConfig = computed(() => {
|
|
4364
|
-
const { type, dataSourceType, ...config } = props.config;
|
|
4376
|
+
const { type, dataSourceType, value, ...config } = props.config;
|
|
4377
|
+
const valueIsId = props.config.value === "id";
|
|
4365
4378
|
return {
|
|
4366
4379
|
...config,
|
|
4367
4380
|
type: "select",
|
|
4368
4381
|
valueKey: "dataSourceId",
|
|
4369
|
-
options: dataSources.value.filter((ds) => !dataSourceType || ds.type === dataSourceType).map((ds) => ({
|
|
4370
|
-
value: {
|
|
4382
|
+
options: dataSources.value.filter((ds) => !props.config.dataSourceType || ds.type === props.config.dataSourceType).map((ds) => ({
|
|
4383
|
+
value: valueIsId ? ds.id : {
|
|
4371
4384
|
isBindDataSource: true,
|
|
4372
4385
|
dataSourceType: ds.type,
|
|
4373
4386
|
dataSourceId: ds.id
|
|
@@ -4416,8 +4429,9 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
4416
4429
|
lastValues: {}
|
|
4417
4430
|
},
|
|
4418
4431
|
emits: ["change"],
|
|
4419
|
-
setup(__props, { emit }) {
|
|
4432
|
+
setup(__props, { emit: __emit }) {
|
|
4420
4433
|
const props = __props;
|
|
4434
|
+
const emit = __emit;
|
|
4421
4435
|
const services = inject("services");
|
|
4422
4436
|
const editorService = services?.editorService;
|
|
4423
4437
|
const dataSourceService = services?.dataSourceService;
|
|
@@ -4680,8 +4694,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
4680
4694
|
lastValues: {}
|
|
4681
4695
|
},
|
|
4682
4696
|
emits: ["change"],
|
|
4683
|
-
setup(__props, { emit }) {
|
|
4697
|
+
setup(__props, { emit: __emit }) {
|
|
4684
4698
|
const props = __props;
|
|
4699
|
+
const emit = __emit;
|
|
4685
4700
|
const records = ref([]);
|
|
4686
4701
|
watchEffect(() => {
|
|
4687
4702
|
records.value = Object.entries(props.model[props.name] || {});
|
|
@@ -4784,8 +4799,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
4784
4799
|
lastValues: {}
|
|
4785
4800
|
},
|
|
4786
4801
|
emits: ["change"],
|
|
4787
|
-
setup(__props, { emit }) {
|
|
4802
|
+
setup(__props, { emit: __emit }) {
|
|
4788
4803
|
const props = __props;
|
|
4804
|
+
const emit = __emit;
|
|
4789
4805
|
const services = inject("services");
|
|
4790
4806
|
const mForm = inject("mForm");
|
|
4791
4807
|
const val = computed(() => props.model[props.name]);
|
|
@@ -4959,7 +4975,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4959
4975
|
},
|
|
4960
4976
|
__name: "Resizer",
|
|
4961
4977
|
emits: ["change"],
|
|
4962
|
-
setup(__props, { emit }) {
|
|
4978
|
+
setup(__props, { emit: __emit }) {
|
|
4979
|
+
const emit = __emit;
|
|
4963
4980
|
const target = ref();
|
|
4964
4981
|
const { isDraging } = useGetSo(target, emit);
|
|
4965
4982
|
return (_ctx, _cache) => {
|
|
@@ -4990,7 +5007,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
4990
5007
|
centerClass: {}
|
|
4991
5008
|
},
|
|
4992
5009
|
emits: ["update:left", "change", "update:right"],
|
|
4993
|
-
setup(__props, { expose: __expose, emit }) {
|
|
5010
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
5011
|
+
const emit = __emit;
|
|
4994
5012
|
const props = __props;
|
|
4995
5013
|
const el = ref();
|
|
4996
5014
|
const hasLeft = computed(() => typeof props.left !== "undefined");
|
|
@@ -5179,7 +5197,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5179
5197
|
const root = computed(() => editorService?.get("root"));
|
|
5180
5198
|
const pageLength = computed(() => editorService?.get("pageLength") || 0);
|
|
5181
5199
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
5182
|
-
const
|
|
5200
|
+
const getLeftColumnWidthCacheData = () => Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
5201
|
+
const leftColumnWidthCacheData = getLeftColumnWidthCacheData();
|
|
5183
5202
|
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
5184
5203
|
const columnWidth = ref({
|
|
5185
5204
|
left: leftColumnWidthCacheData,
|
|
@@ -5209,6 +5228,12 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
5209
5228
|
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
5210
5229
|
}
|
|
5211
5230
|
);
|
|
5231
|
+
watch(
|
|
5232
|
+
() => uiService?.get("hideSlideBar"),
|
|
5233
|
+
(hideSlideBar) => {
|
|
5234
|
+
columnWidth.value.left = hideSlideBar ? 0 : getLeftColumnWidthCacheData();
|
|
5235
|
+
}
|
|
5236
|
+
);
|
|
5212
5237
|
const columnWidthChange = (columnW) => {
|
|
5213
5238
|
columnWidth.value.left = columnW.left;
|
|
5214
5239
|
columnWidth.value.center = columnW.center;
|
|
@@ -5637,7 +5662,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
5637
5662
|
extendState: { type: Function }
|
|
5638
5663
|
},
|
|
5639
5664
|
emits: ["mounted"],
|
|
5640
|
-
setup(__props, { expose: __expose, emit }) {
|
|
5665
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
5666
|
+
const emit = __emit;
|
|
5641
5667
|
const internalInstance = getCurrentInstance();
|
|
5642
5668
|
const values = ref({});
|
|
5643
5669
|
const configForm = ref();
|
|
@@ -5701,13 +5727,145 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
5701
5727
|
}
|
|
5702
5728
|
});
|
|
5703
5729
|
|
|
5730
|
+
const useFloatBox = (slideKeys) => {
|
|
5731
|
+
const services = inject("services");
|
|
5732
|
+
const moveable = ref();
|
|
5733
|
+
const floatBox = ref();
|
|
5734
|
+
const floatBoxStates = computed(() => services?.uiService.get("floatBox"));
|
|
5735
|
+
const curKey = ref("");
|
|
5736
|
+
const target = computed(
|
|
5737
|
+
() => floatBox.value ? floatBox.value.find((item) => item.classList.contains(`m-editor-float-box-${curKey.value}`)) : void 0
|
|
5738
|
+
);
|
|
5739
|
+
const showingBoxKeys = computed(
|
|
5740
|
+
() => [...floatBoxStates.value?.keys() ?? []].filter((key) => floatBoxStates.value?.get(key)?.status)
|
|
5741
|
+
);
|
|
5742
|
+
const isDraging = ref(false);
|
|
5743
|
+
const showFloatBox = async (key) => {
|
|
5744
|
+
const curBoxStatus = floatBoxStates.value?.get(curKey.value)?.status;
|
|
5745
|
+
if (curKey.value === key && curBoxStatus)
|
|
5746
|
+
return;
|
|
5747
|
+
curKey.value = key;
|
|
5748
|
+
setSlideState(key, {
|
|
5749
|
+
zIndex: getMaxZIndex() + 1,
|
|
5750
|
+
status: true
|
|
5751
|
+
});
|
|
5752
|
+
await nextTick();
|
|
5753
|
+
if (moveable.value) {
|
|
5754
|
+
moveable.value.target = target.value;
|
|
5755
|
+
moveable.value.dragTarget = getDragTarget();
|
|
5756
|
+
moveable.value.updateRect();
|
|
5757
|
+
} else {
|
|
5758
|
+
initFloatBoxMoveable();
|
|
5759
|
+
}
|
|
5760
|
+
};
|
|
5761
|
+
const setSlideState = (key, data) => {
|
|
5762
|
+
const slideState = floatBoxStates.value?.get(key);
|
|
5763
|
+
if (!slideState)
|
|
5764
|
+
return;
|
|
5765
|
+
floatBoxStates.value?.set(key, {
|
|
5766
|
+
...slideState,
|
|
5767
|
+
...data
|
|
5768
|
+
});
|
|
5769
|
+
};
|
|
5770
|
+
const getDragTarget = (key) => `.m-editor-float-box-header-${key ?? curKey.value}`;
|
|
5771
|
+
const closeFloatBox = (key) => {
|
|
5772
|
+
setSlideState(key, {
|
|
5773
|
+
status: false
|
|
5774
|
+
});
|
|
5775
|
+
if (!floatBoxStates.value?.values)
|
|
5776
|
+
return;
|
|
5777
|
+
const keys = [...floatBoxStates.value?.keys()];
|
|
5778
|
+
const values = [...floatBoxStates.value?.values()];
|
|
5779
|
+
const lastFloatBoxLen = values.filter((state) => state.status).length;
|
|
5780
|
+
if (lastFloatBoxLen === 0) {
|
|
5781
|
+
moveable.value?.destroy();
|
|
5782
|
+
moveable.value = void 0;
|
|
5783
|
+
return;
|
|
5784
|
+
}
|
|
5785
|
+
if (key === curKey.value) {
|
|
5786
|
+
const zIndexList = values.filter((item) => item.status).map((item) => item.zIndex);
|
|
5787
|
+
const maxZIndex = Math.max(...zIndexList);
|
|
5788
|
+
const key2 = keys.find((key3) => floatBoxStates.value?.get(key3)?.zIndex === maxZIndex);
|
|
5789
|
+
if (!key2)
|
|
5790
|
+
return;
|
|
5791
|
+
showFloatBox(key2);
|
|
5792
|
+
}
|
|
5793
|
+
};
|
|
5794
|
+
const getMaxZIndex = () => {
|
|
5795
|
+
if (!floatBoxStates.value?.values())
|
|
5796
|
+
return 0;
|
|
5797
|
+
const list = [...floatBoxStates.value?.values()].map((state) => state.zIndex);
|
|
5798
|
+
return Math.max(...list) ?? 0;
|
|
5799
|
+
};
|
|
5800
|
+
const initFloatBoxMoveable = () => {
|
|
5801
|
+
const dragTarget = getDragTarget();
|
|
5802
|
+
moveable.value = new Moveable(document.body, {
|
|
5803
|
+
target: target.value,
|
|
5804
|
+
draggable: true,
|
|
5805
|
+
resizable: true,
|
|
5806
|
+
edge: true,
|
|
5807
|
+
keepRatio: false,
|
|
5808
|
+
origin: false,
|
|
5809
|
+
snappable: true,
|
|
5810
|
+
dragTarget,
|
|
5811
|
+
dragTargetSelf: false,
|
|
5812
|
+
linePadding: 10,
|
|
5813
|
+
controlPadding: 10,
|
|
5814
|
+
elementGuidelines: [...floatBoxStates.value?.keys() ?? []].map((key) => getDragTarget(key)),
|
|
5815
|
+
bounds: { left: 0, top: 0, right: 0, bottom: 0, position: "css" }
|
|
5816
|
+
});
|
|
5817
|
+
moveable.value.on("drag", (e) => {
|
|
5818
|
+
e.target.style.transform = e.transform;
|
|
5819
|
+
});
|
|
5820
|
+
moveable.value.on("resize", (e) => {
|
|
5821
|
+
e.target.style.width = `${e.width}px`;
|
|
5822
|
+
e.target.style.height = `${e.height}px`;
|
|
5823
|
+
e.target.style.transform = e.drag.transform;
|
|
5824
|
+
});
|
|
5825
|
+
};
|
|
5826
|
+
const dragendHandler = (key, e) => {
|
|
5827
|
+
setSlideState(key, {
|
|
5828
|
+
left: e.clientX,
|
|
5829
|
+
top: e.clientY
|
|
5830
|
+
});
|
|
5831
|
+
showFloatBox(key);
|
|
5832
|
+
isDraging.value = false;
|
|
5833
|
+
};
|
|
5834
|
+
document.body.addEventListener("dragover", (e) => {
|
|
5835
|
+
if (!isDraging.value)
|
|
5836
|
+
return;
|
|
5837
|
+
e.preventDefault();
|
|
5838
|
+
});
|
|
5839
|
+
const dragstartHandler = () => isDraging.value = true;
|
|
5840
|
+
watch(
|
|
5841
|
+
() => slideKeys.value,
|
|
5842
|
+
() => {
|
|
5843
|
+
services?.uiService.setFloatBox(slideKeys.value);
|
|
5844
|
+
},
|
|
5845
|
+
{
|
|
5846
|
+
deep: true,
|
|
5847
|
+
immediate: true
|
|
5848
|
+
}
|
|
5849
|
+
);
|
|
5850
|
+
return {
|
|
5851
|
+
showFloatBox,
|
|
5852
|
+
closeFloatBox,
|
|
5853
|
+
dragstartHandler,
|
|
5854
|
+
dragendHandler,
|
|
5855
|
+
floatBoxStates,
|
|
5856
|
+
floatBox,
|
|
5857
|
+
showingBoxKeys
|
|
5858
|
+
};
|
|
5859
|
+
};
|
|
5860
|
+
|
|
5704
5861
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
5705
5862
|
...{
|
|
5706
5863
|
name: "MEditorSearchInput"
|
|
5707
5864
|
},
|
|
5708
5865
|
__name: "SearchInput",
|
|
5709
5866
|
emits: ["search"],
|
|
5710
|
-
setup(__props, { emit }) {
|
|
5867
|
+
setup(__props, { emit: __emit }) {
|
|
5868
|
+
const emit = __emit;
|
|
5711
5869
|
const filterText = ref("");
|
|
5712
5870
|
let timer = null;
|
|
5713
5871
|
const filterTextChangeHandler = () => {
|
|
@@ -5803,8 +5961,9 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
5803
5961
|
customError: { type: Function }
|
|
5804
5962
|
},
|
|
5805
5963
|
emits: ["edit", "remove"],
|
|
5806
|
-
setup(__props, { expose: __expose, emit }) {
|
|
5964
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
5807
5965
|
const props = __props;
|
|
5966
|
+
const emit = __emit;
|
|
5808
5967
|
const { codeBlockService, depService, editorService } = inject("services") || {};
|
|
5809
5968
|
const codeList = computed(
|
|
5810
5969
|
() => Object.values(depService?.getTargets(DepTargetType.CODE_BLOCK) || {}).map((target) => {
|
|
@@ -5958,7 +6117,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
5958
6117
|
},
|
|
5959
6118
|
__name: "CodeBlockListPanel",
|
|
5960
6119
|
props: {
|
|
5961
|
-
customError: { type: Function }
|
|
6120
|
+
customError: { type: Function },
|
|
6121
|
+
slideType: {}
|
|
5962
6122
|
},
|
|
5963
6123
|
setup(__props) {
|
|
5964
6124
|
const { codeBlockService } = inject("services") || {};
|
|
@@ -5969,52 +6129,55 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
5969
6129
|
codeBlockList.value?.filter(val);
|
|
5970
6130
|
};
|
|
5971
6131
|
return (_ctx, _cache) => {
|
|
5972
|
-
return openBlock(),
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
createVNode(_sfc_main$r, {
|
|
5993
|
-
ref_key: "codeBlockList",
|
|
5994
|
-
ref: codeBlockList,
|
|
5995
|
-
"custom-error": _ctx.customError,
|
|
5996
|
-
onEdit: unref(editCode),
|
|
5997
|
-
onRemove: unref(deleteCode)
|
|
5998
|
-
}, {
|
|
5999
|
-
"code-block-panel-tool": withCtx(({ id, data }) => [
|
|
6000
|
-
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
6001
|
-
id,
|
|
6002
|
-
data
|
|
6003
|
-
})
|
|
6132
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
6133
|
+
createVNode(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
6134
|
+
default: withCtx(() => [
|
|
6135
|
+
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
6136
|
+
createElementVNode("div", _hoisted_1$f, [
|
|
6137
|
+
createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
|
|
6138
|
+
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
6139
|
+
key: 0,
|
|
6140
|
+
class: "create-code-button",
|
|
6141
|
+
type: "primary",
|
|
6142
|
+
size: "small",
|
|
6143
|
+
onClick: unref(createCodeBlock)
|
|
6144
|
+
}, {
|
|
6145
|
+
default: withCtx(() => [
|
|
6146
|
+
createTextVNode("新增")
|
|
6147
|
+
]),
|
|
6148
|
+
_: 1
|
|
6149
|
+
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
6150
|
+
renderSlot(_ctx.$slots, "code-block-panel-search")
|
|
6151
|
+
])
|
|
6004
6152
|
]),
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6153
|
+
createVNode(_sfc_main$r, {
|
|
6154
|
+
ref_key: "codeBlockList",
|
|
6155
|
+
ref: codeBlockList,
|
|
6156
|
+
"custom-error": _ctx.customError,
|
|
6157
|
+
onEdit: unref(editCode),
|
|
6158
|
+
onRemove: unref(deleteCode)
|
|
6159
|
+
}, {
|
|
6160
|
+
"code-block-panel-tool": withCtx(({ id, data }) => [
|
|
6161
|
+
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
6162
|
+
id,
|
|
6163
|
+
data
|
|
6164
|
+
})
|
|
6165
|
+
]),
|
|
6166
|
+
_: 3
|
|
6167
|
+
}, 8, ["custom-error", "onEdit", "onRemove"])
|
|
6168
|
+
]),
|
|
6169
|
+
_: 3
|
|
6170
|
+
}),
|
|
6171
|
+
unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$P, {
|
|
6172
|
+
key: 0,
|
|
6173
|
+
ref_key: "codeBlockEditor",
|
|
6174
|
+
ref: codeBlockEditor,
|
|
6175
|
+
disabled: !editable.value,
|
|
6176
|
+
content: unref(codeConfig),
|
|
6177
|
+
slideType: _ctx.slideType,
|
|
6178
|
+
onSubmit: unref(submitCodeBlockHandler)
|
|
6179
|
+
}, null, 8, ["disabled", "content", "slideType", "onSubmit"])) : createCommentVNode("", true)
|
|
6180
|
+
], 64);
|
|
6018
6181
|
};
|
|
6019
6182
|
}
|
|
6020
6183
|
});
|
|
@@ -6027,11 +6190,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6027
6190
|
props: {
|
|
6028
6191
|
title: {},
|
|
6029
6192
|
values: {},
|
|
6030
|
-
disabled: { type: Boolean }
|
|
6193
|
+
disabled: { type: Boolean },
|
|
6194
|
+
slideType: {}
|
|
6031
6195
|
},
|
|
6032
6196
|
emits: ["submit"],
|
|
6033
|
-
setup(__props, { expose: __expose, emit }) {
|
|
6197
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6034
6198
|
const props = __props;
|
|
6199
|
+
const emit = __emit;
|
|
6035
6200
|
const services = inject("services");
|
|
6036
6201
|
const size = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
|
|
6037
6202
|
const fomDrawer = ref();
|
|
@@ -6056,7 +6221,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6056
6221
|
}
|
|
6057
6222
|
});
|
|
6058
6223
|
return (_ctx, _cache) => {
|
|
6059
|
-
return openBlock(), createBlock(unref(MFormDrawer), {
|
|
6224
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.slideType === "box" ? unref(MFormBox) : unref(MFormDrawer)), {
|
|
6060
6225
|
ref_key: "fomDrawer",
|
|
6061
6226
|
ref: fomDrawer,
|
|
6062
6227
|
"label-width": "80px",
|
|
@@ -6068,7 +6233,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
6068
6233
|
disabled: _ctx.disabled,
|
|
6069
6234
|
onSubmit: submitHandler,
|
|
6070
6235
|
onError: errorHandler
|
|
6071
|
-
}, null,
|
|
6236
|
+
}, null, 40, ["title", "width", "config", "values", "disabled"]);
|
|
6072
6237
|
};
|
|
6073
6238
|
}
|
|
6074
6239
|
});
|
|
@@ -6085,7 +6250,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6085
6250
|
},
|
|
6086
6251
|
__name: "DataSourceList",
|
|
6087
6252
|
emits: ["edit", "remove"],
|
|
6088
|
-
setup(__props, { expose: __expose, emit }) {
|
|
6253
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6254
|
+
const emit = __emit;
|
|
6089
6255
|
const { depService, editorService, dataSourceService } = inject("services") || {};
|
|
6090
6256
|
const editable = computed(() => dataSourceService?.get("editable") ?? true);
|
|
6091
6257
|
const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
|
|
@@ -6111,9 +6277,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6111
6277
|
};
|
|
6112
6278
|
const list = computed(
|
|
6113
6279
|
() => dataSources.value.map((ds) => {
|
|
6114
|
-
const dsDeps = dsDep.value[ds.id]
|
|
6115
|
-
const dsMethodDeps = dsMethodDep.value[ds.id]
|
|
6116
|
-
const dsCondDeps = dsCondDep.value[ds.id]
|
|
6280
|
+
const dsDeps = dsDep.value[ds.id]?.deps || {};
|
|
6281
|
+
const dsMethodDeps = dsMethodDep.value[ds.id]?.deps || {};
|
|
6282
|
+
const dsCondDeps = dsCondDep.value[ds.id]?.deps || {};
|
|
6117
6283
|
const children = [];
|
|
6118
6284
|
mergeChildren(children, dsDeps);
|
|
6119
6285
|
mergeChildren(children, dsMethodDeps, "method");
|
|
@@ -6235,6 +6401,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6235
6401
|
name: "MEditorDataSourceListPanel"
|
|
6236
6402
|
},
|
|
6237
6403
|
__name: "DataSourceListPanel",
|
|
6404
|
+
props: {
|
|
6405
|
+
slideType: {}
|
|
6406
|
+
},
|
|
6238
6407
|
setup(__props) {
|
|
6239
6408
|
const { dataSourceService } = inject("services") || {};
|
|
6240
6409
|
const editDialog = ref();
|
|
@@ -6269,7 +6438,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6269
6438
|
dataSourceValues.value = {
|
|
6270
6439
|
...dataSourceService?.getDataSourceById(id)
|
|
6271
6440
|
};
|
|
6272
|
-
dialogTitle.value =
|
|
6441
|
+
dialogTitle.value = `编辑${dataSourceValues.value.title || ""}`;
|
|
6273
6442
|
editDialog.value.show();
|
|
6274
6443
|
};
|
|
6275
6444
|
const removeHandler = (id) => {
|
|
@@ -6288,64 +6457,62 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
6288
6457
|
dataSourceList.value?.filter(val);
|
|
6289
6458
|
};
|
|
6290
6459
|
return (_ctx, _cache) => {
|
|
6291
|
-
return openBlock(),
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
(
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
createVNode(_sfc_main$o, {
|
|
6330
|
-
onEdit: editHandler,
|
|
6331
|
-
onRemove: removeHandler
|
|
6332
|
-
}, {
|
|
6333
|
-
"data-source-panel-tool": withCtx(({ data }) => [
|
|
6334
|
-
renderSlot(_ctx.$slots, "data-source-panel-tool", { data })
|
|
6460
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
6461
|
+
createVNode(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
6462
|
+
default: withCtx(() => [
|
|
6463
|
+
createElementVNode("div", _hoisted_1$d, [
|
|
6464
|
+
createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
|
|
6465
|
+
editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
6466
|
+
key: 0,
|
|
6467
|
+
placement: "right"
|
|
6468
|
+
}, {
|
|
6469
|
+
reference: withCtx(() => [
|
|
6470
|
+
createVNode(unref(TMagicButton), {
|
|
6471
|
+
type: "primary",
|
|
6472
|
+
size: "small"
|
|
6473
|
+
}, {
|
|
6474
|
+
default: withCtx(() => [
|
|
6475
|
+
createTextVNode("新增")
|
|
6476
|
+
]),
|
|
6477
|
+
_: 1
|
|
6478
|
+
})
|
|
6479
|
+
]),
|
|
6480
|
+
default: withCtx(() => [
|
|
6481
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
6482
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
|
|
6483
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
6484
|
+
data: {
|
|
6485
|
+
type: "button",
|
|
6486
|
+
text: item.text,
|
|
6487
|
+
handler: () => {
|
|
6488
|
+
addHandler(item.type);
|
|
6489
|
+
}
|
|
6490
|
+
},
|
|
6491
|
+
key: index
|
|
6492
|
+
}, null, 8, ["data"]);
|
|
6493
|
+
}), 128))
|
|
6494
|
+
])
|
|
6495
|
+
]),
|
|
6496
|
+
_: 1
|
|
6497
|
+
})) : createCommentVNode("", true)
|
|
6335
6498
|
]),
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6499
|
+
createVNode(_sfc_main$o, {
|
|
6500
|
+
onEdit: editHandler,
|
|
6501
|
+
onRemove: removeHandler
|
|
6502
|
+
})
|
|
6503
|
+
]),
|
|
6504
|
+
_: 1
|
|
6505
|
+
}),
|
|
6506
|
+
createVNode(_sfc_main$p, {
|
|
6507
|
+
ref_key: "editDialog",
|
|
6508
|
+
ref: editDialog,
|
|
6509
|
+
disabled: !editable.value,
|
|
6510
|
+
values: dataSourceValues.value,
|
|
6511
|
+
title: dialogTitle.value,
|
|
6512
|
+
slideType: _ctx.slideType,
|
|
6513
|
+
onSubmit: submitDataSourceHandler
|
|
6514
|
+
}, null, 8, ["disabled", "values", "title", "slideType"])
|
|
6515
|
+
], 64);
|
|
6349
6516
|
};
|
|
6350
6517
|
}
|
|
6351
6518
|
});
|
|
@@ -6379,9 +6546,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
6379
6546
|
indent: { default: 0 }
|
|
6380
6547
|
},
|
|
6381
6548
|
emits: ["node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
|
|
6382
|
-
setup(__props, { emit }) {
|
|
6383
|
-
const props = __props;
|
|
6549
|
+
setup(__props, { emit: __emit }) {
|
|
6384
6550
|
const treeEmit = inject("treeEmit");
|
|
6551
|
+
const props = __props;
|
|
6385
6552
|
const nodeStatus = computed(
|
|
6386
6553
|
() => props.nodeStatusMap?.get(props.data.id) || {
|
|
6387
6554
|
selected: false,
|
|
@@ -6491,7 +6658,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
6491
6658
|
emptyText: { default: "暂无数据" }
|
|
6492
6659
|
},
|
|
6493
6660
|
emits: ["node-dragover", "node-dragstart", "node-dragleave", "node-dragend", "node-contextmenu", "node-mouseenter", "node-click"],
|
|
6494
|
-
setup(__props, { emit }) {
|
|
6661
|
+
setup(__props, { emit: __emit }) {
|
|
6662
|
+
const emit = __emit;
|
|
6495
6663
|
provide("treeEmit", emit);
|
|
6496
6664
|
const handleDragOver = (event) => {
|
|
6497
6665
|
emit("node-dragover", event);
|
|
@@ -6536,8 +6704,9 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
6536
6704
|
autoHide: { type: Boolean, default: true }
|
|
6537
6705
|
},
|
|
6538
6706
|
emits: ["hide", "show", "mouseenter"],
|
|
6539
|
-
setup(__props, { expose: __expose, emit }) {
|
|
6707
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6540
6708
|
const props = __props;
|
|
6709
|
+
const emit = __emit;
|
|
6541
6710
|
const menu = ref();
|
|
6542
6711
|
const buttons = ref();
|
|
6543
6712
|
const subMenu = ref();
|
|
@@ -6805,8 +6974,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
6805
6974
|
layerContentMenu: {}
|
|
6806
6975
|
},
|
|
6807
6976
|
emits: ["collapse-all"],
|
|
6808
|
-
setup(__props, { expose: __expose, emit }) {
|
|
6977
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
6809
6978
|
const props = __props;
|
|
6979
|
+
const emit = __emit;
|
|
6810
6980
|
const services = inject("services");
|
|
6811
6981
|
const menu = ref();
|
|
6812
6982
|
const node = computed(() => services?.editorService.get("node"));
|
|
@@ -7089,6 +7259,9 @@ const useDrag = (services) => {
|
|
|
7089
7259
|
return;
|
|
7090
7260
|
removeStatusClass(dragState.container);
|
|
7091
7261
|
if (node && dragState.dragOverNodeId && dragState.dropType && services) {
|
|
7262
|
+
if (dragState.dragOverNodeId === node.id) {
|
|
7263
|
+
return;
|
|
7264
|
+
}
|
|
7092
7265
|
const targetInfo = services.editorService.getNodeInfo(dragState.dragOverNodeId, false);
|
|
7093
7266
|
const targetNode = targetInfo.node;
|
|
7094
7267
|
let targetParent = targetInfo.parent;
|
|
@@ -7324,7 +7497,7 @@ const useKeybinding = (services, contianer) => {
|
|
|
7324
7497
|
};
|
|
7325
7498
|
};
|
|
7326
7499
|
|
|
7327
|
-
const createPageNodeStatus = (services, pageId) => {
|
|
7500
|
+
const createPageNodeStatus = (services, pageId, initalLayerNodeStatus) => {
|
|
7328
7501
|
const map = /* @__PURE__ */ new Map();
|
|
7329
7502
|
map.set(pageId, {
|
|
7330
7503
|
visible: true,
|
|
@@ -7334,12 +7507,15 @@ const createPageNodeStatus = (services, pageId) => {
|
|
|
7334
7507
|
});
|
|
7335
7508
|
services?.editorService.getNodeById(pageId)?.items.forEach(
|
|
7336
7509
|
(node) => traverseNode(node, (node2) => {
|
|
7337
|
-
map.set(
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7510
|
+
map.set(
|
|
7511
|
+
node2.id,
|
|
7512
|
+
initalLayerNodeStatus?.get(node2.id) || {
|
|
7513
|
+
visible: true,
|
|
7514
|
+
expand: false,
|
|
7515
|
+
selected: false,
|
|
7516
|
+
draggable: true
|
|
7517
|
+
}
|
|
7518
|
+
);
|
|
7343
7519
|
})
|
|
7344
7520
|
);
|
|
7345
7521
|
return map;
|
|
@@ -7351,12 +7527,12 @@ const useNodeStatus = (services, page) => {
|
|
|
7351
7527
|
() => page.value ? nodeStatusMaps.value.get(page.value.id) : /* @__PURE__ */ new Map()
|
|
7352
7528
|
);
|
|
7353
7529
|
watch(
|
|
7354
|
-
|
|
7355
|
-
(
|
|
7356
|
-
if (!
|
|
7530
|
+
page,
|
|
7531
|
+
(page2) => {
|
|
7532
|
+
if (!page2) {
|
|
7357
7533
|
return;
|
|
7358
7534
|
}
|
|
7359
|
-
nodeStatusMaps.value.set(
|
|
7535
|
+
nodeStatusMaps.value.set(page2.id, createPageNodeStatus(services, page2.id, nodeStatusMaps.value.get(page2.id)));
|
|
7360
7536
|
},
|
|
7361
7537
|
{
|
|
7362
7538
|
immediate: true
|
|
@@ -7629,11 +7805,14 @@ const _hoisted_1$8 = {
|
|
|
7629
7805
|
class: "m-editor-sidebar"
|
|
7630
7806
|
};
|
|
7631
7807
|
const _hoisted_2$6 = { class: "m-editor-sidebar-header" };
|
|
7632
|
-
const _hoisted_3$3 = ["onClick"];
|
|
7808
|
+
const _hoisted_3$3 = ["onClick", "onDragend"];
|
|
7633
7809
|
const _hoisted_4$3 = {
|
|
7634
7810
|
key: 1,
|
|
7635
7811
|
class: "magic-editor-tab-panel-title"
|
|
7636
7812
|
};
|
|
7813
|
+
const _hoisted_5$3 = { class: "m-editor-float-box-list" };
|
|
7814
|
+
const _hoisted_6$2 = ["onClick"];
|
|
7815
|
+
const _hoisted_7 = { class: "m-editor-float-box-body" };
|
|
7637
7816
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
7638
7817
|
...{
|
|
7639
7818
|
name: "MEditorSidebar"
|
|
@@ -7645,6 +7824,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7645
7824
|
},
|
|
7646
7825
|
setup(__props, { expose: __expose }) {
|
|
7647
7826
|
const props = __props;
|
|
7827
|
+
const services = inject("services");
|
|
7648
7828
|
const activeTabName = ref(props.data?.status);
|
|
7649
7829
|
const getItemConfig = (data) => {
|
|
7650
7830
|
const map = {
|
|
@@ -7673,7 +7853,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7673
7853
|
icon: EditPen,
|
|
7674
7854
|
text: "代码编辑",
|
|
7675
7855
|
component: _sfc_main$q,
|
|
7676
|
-
slots: {}
|
|
7856
|
+
slots: {},
|
|
7857
|
+
boxComponentConfig: {
|
|
7858
|
+
props: {
|
|
7859
|
+
slideType: "box"
|
|
7860
|
+
}
|
|
7861
|
+
}
|
|
7677
7862
|
},
|
|
7678
7863
|
"data-source": {
|
|
7679
7864
|
$key: "data-source",
|
|
@@ -7681,7 +7866,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7681
7866
|
icon: Coin,
|
|
7682
7867
|
text: "数据源",
|
|
7683
7868
|
component: _sfc_main$n,
|
|
7684
|
-
slots: {}
|
|
7869
|
+
slots: {},
|
|
7870
|
+
boxComponentConfig: {
|
|
7871
|
+
props: {
|
|
7872
|
+
slideType: "box"
|
|
7873
|
+
}
|
|
7874
|
+
}
|
|
7685
7875
|
}
|
|
7686
7876
|
};
|
|
7687
7877
|
return typeof data === "string" ? map[data] : data;
|
|
@@ -7693,119 +7883,182 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7693
7883
|
activeTabName.value = status || "0";
|
|
7694
7884
|
}
|
|
7695
7885
|
);
|
|
7886
|
+
const slideKeys = computed(() => sideBarItems.value.map((sideBarItem) => sideBarItem.$key));
|
|
7887
|
+
const { showFloatBox, closeFloatBox, dragstartHandler, dragendHandler, floatBoxStates, floatBox, showingBoxKeys } = useFloatBox(slideKeys);
|
|
7888
|
+
watch(
|
|
7889
|
+
() => showingBoxKeys.value.length,
|
|
7890
|
+
() => {
|
|
7891
|
+
const isActiveTabShow = showingBoxKeys.value.some(
|
|
7892
|
+
(key) => activeTabName.value === sideBarItems.value.find((v) => v.$key === key)?.text
|
|
7893
|
+
);
|
|
7894
|
+
if (!isActiveTabShow && activeTabName.value)
|
|
7895
|
+
return;
|
|
7896
|
+
const nextSlideBarItem = sideBarItems.value.find((sideBarItem) => !showingBoxKeys.value.includes(sideBarItem.$key));
|
|
7897
|
+
if (!nextSlideBarItem) {
|
|
7898
|
+
activeTabName.value = "";
|
|
7899
|
+
services?.uiService.set("hideSlideBar", true);
|
|
7900
|
+
return;
|
|
7901
|
+
}
|
|
7902
|
+
services?.uiService.set("hideSlideBar", false);
|
|
7903
|
+
activeTabName.value = nextSlideBarItem?.text;
|
|
7904
|
+
}
|
|
7905
|
+
);
|
|
7696
7906
|
__expose({
|
|
7697
7907
|
activeTabName
|
|
7698
7908
|
});
|
|
7699
7909
|
return (_ctx, _cache) => {
|
|
7700
|
-
return
|
|
7701
|
-
|
|
7910
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
7911
|
+
_ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
7912
|
+
createElementVNode("div", _hoisted_2$6, [
|
|
7913
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
7914
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
7915
|
+
class: normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
|
|
7916
|
+
key: config.$key ?? index,
|
|
7917
|
+
onClick: ($event) => activeTabName.value = config.text || `${index}`,
|
|
7918
|
+
draggable: "true",
|
|
7919
|
+
onDragstart: _cache[0] || (_cache[0] = //@ts-ignore
|
|
7920
|
+
(...args) => unref(dragstartHandler) && unref(dragstartHandler)(...args)),
|
|
7921
|
+
onDragend: ($event) => unref(dragendHandler)(config.$key, $event)
|
|
7922
|
+
}, [
|
|
7923
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$N, {
|
|
7924
|
+
key: 0,
|
|
7925
|
+
icon: config.icon
|
|
7926
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
7927
|
+
config.text ? (openBlock(), createElementBlock("div", _hoisted_4$3, toDisplayString(config.text), 1)) : createCommentVNode("", true)
|
|
7928
|
+
], 42, _hoisted_3$3)), [
|
|
7929
|
+
[vShow, !unref(floatBoxStates)?.get(config.$key)?.status]
|
|
7930
|
+
]);
|
|
7931
|
+
}), 128))
|
|
7932
|
+
]),
|
|
7702
7933
|
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
7703
|
-
return openBlock(), createElementBlock("div", {
|
|
7704
|
-
class:
|
|
7705
|
-
key: config.$key ?? index
|
|
7706
|
-
onClick: ($event) => activeTabName.value = config.text || `${index}`
|
|
7934
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
7935
|
+
class: "m-editor-sidebar-content",
|
|
7936
|
+
key: config.$key ?? index
|
|
7707
7937
|
}, [
|
|
7708
|
-
config
|
|
7709
|
-
key
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7938
|
+
config && !unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({ key: 0 }, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
|
|
7939
|
+
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
7940
|
+
name: "component-list-panel-header",
|
|
7941
|
+
fn: withCtx(() => [
|
|
7942
|
+
config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
7943
|
+
]),
|
|
7944
|
+
key: "0"
|
|
7945
|
+
} : void 0,
|
|
7946
|
+
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
7947
|
+
name: "component-list-item",
|
|
7948
|
+
fn: withCtx(({ component }) => [
|
|
7949
|
+
config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-item", {
|
|
7950
|
+
key: 0,
|
|
7951
|
+
component
|
|
7952
|
+
}) : config.slots?.componentListItem ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListItem), {
|
|
7953
|
+
key: 1,
|
|
7954
|
+
component
|
|
7955
|
+
}, null, 8, ["component"])) : createCommentVNode("", true)
|
|
7956
|
+
]),
|
|
7957
|
+
key: "1"
|
|
7958
|
+
} : void 0,
|
|
7959
|
+
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
7960
|
+
name: "layer-panel-header",
|
|
7961
|
+
fn: withCtx(() => [
|
|
7962
|
+
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
7963
|
+
]),
|
|
7964
|
+
key: "2"
|
|
7965
|
+
} : void 0,
|
|
7966
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
7967
|
+
name: "code-block-panel-header",
|
|
7968
|
+
fn: withCtx(() => [
|
|
7969
|
+
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
7970
|
+
]),
|
|
7971
|
+
key: "3"
|
|
7972
|
+
} : void 0,
|
|
7973
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
7974
|
+
name: "code-block-panel-tool",
|
|
7975
|
+
fn: withCtx(({ id, data }) => [
|
|
7976
|
+
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
7977
|
+
key: 0,
|
|
7978
|
+
id,
|
|
7979
|
+
data
|
|
7980
|
+
}) : config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
7981
|
+
]),
|
|
7982
|
+
key: "4"
|
|
7983
|
+
} : void 0,
|
|
7984
|
+
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
7985
|
+
name: "layer-node-content",
|
|
7986
|
+
fn: withCtx(({ data: nodeData }) => [
|
|
7987
|
+
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", {
|
|
7988
|
+
key: 0,
|
|
7989
|
+
data: nodeData
|
|
7990
|
+
}) : config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
7991
|
+
key: 1,
|
|
7992
|
+
data: nodeData
|
|
7993
|
+
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
7994
|
+
]),
|
|
7995
|
+
key: "5"
|
|
7996
|
+
} : void 0,
|
|
7997
|
+
config.$key === "layer" || config.slots?.layerNodeTool ? {
|
|
7998
|
+
name: "layer-node-tool",
|
|
7999
|
+
fn: withCtx(({ data: nodeData }) => [
|
|
8000
|
+
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-tool", {
|
|
8001
|
+
key: 0,
|
|
8002
|
+
data: nodeData
|
|
8003
|
+
}) : config.slots?.layerNodeTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
8004
|
+
key: 1,
|
|
8005
|
+
data: nodeData
|
|
8006
|
+
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
8007
|
+
]),
|
|
8008
|
+
key: "6"
|
|
8009
|
+
} : void 0,
|
|
8010
|
+
config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
|
|
8011
|
+
name: "data-source-panel-tool",
|
|
8012
|
+
fn: withCtx(({ data }) => [
|
|
8013
|
+
config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", {
|
|
8014
|
+
key: 0,
|
|
8015
|
+
data
|
|
8016
|
+
}) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
8017
|
+
]),
|
|
8018
|
+
key: "7"
|
|
8019
|
+
} : void 0
|
|
8020
|
+
]), 1040)) : createCommentVNode("", true)
|
|
8021
|
+
])), [
|
|
8022
|
+
[vShow, activeTabName.value === config.text]
|
|
8023
|
+
]);
|
|
7714
8024
|
}), 128))
|
|
7715
|
-
]),
|
|
7716
|
-
(openBlock(
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
]
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
7753
|
-
]),
|
|
7754
|
-
key: "3"
|
|
7755
|
-
} : void 0,
|
|
7756
|
-
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
7757
|
-
name: "code-block-panel-tool",
|
|
7758
|
-
fn: withCtx(({ id, data }) => [
|
|
7759
|
-
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
7760
|
-
key: 0,
|
|
7761
|
-
id,
|
|
7762
|
-
data
|
|
7763
|
-
}) : config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
7764
|
-
]),
|
|
7765
|
-
key: "4"
|
|
7766
|
-
} : void 0,
|
|
7767
|
-
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
7768
|
-
name: "layer-node-content",
|
|
7769
|
-
fn: withCtx(({ data: nodeData }) => [
|
|
7770
|
-
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", {
|
|
7771
|
-
key: 0,
|
|
7772
|
-
data: nodeData
|
|
7773
|
-
}) : config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
7774
|
-
key: 1,
|
|
7775
|
-
data: nodeData
|
|
7776
|
-
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
7777
|
-
]),
|
|
7778
|
-
key: "5"
|
|
7779
|
-
} : void 0,
|
|
7780
|
-
config.$key === "layer" || config.slots?.layerNodeTool ? {
|
|
7781
|
-
name: "layer-node-tool",
|
|
7782
|
-
fn: withCtx(({ data: nodeData }) => [
|
|
7783
|
-
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-tool", {
|
|
7784
|
-
key: 0,
|
|
7785
|
-
data: nodeData
|
|
7786
|
-
}) : config.slots?.layerNodeTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeTool), {
|
|
7787
|
-
key: 1,
|
|
7788
|
-
data: nodeData
|
|
7789
|
-
}, null, 8, ["data"])) : createCommentVNode("", true)
|
|
7790
|
-
]),
|
|
7791
|
-
key: "6"
|
|
7792
|
-
} : void 0,
|
|
7793
|
-
config.$key === "data-source" || config.slots?.codeBlockPanelTool ? {
|
|
7794
|
-
name: "data-source-panel-tool",
|
|
7795
|
-
fn: withCtx(({ data }) => [
|
|
7796
|
-
config.$key === "data-source" ? renderSlot(_ctx.$slots, "data-source-panel-tool", {
|
|
7797
|
-
key: 0,
|
|
7798
|
-
data
|
|
7799
|
-
}) : config.slots?.DataSourcePanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.DataSourcePanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
7800
|
-
]),
|
|
7801
|
-
key: "7"
|
|
7802
|
-
} : void 0
|
|
7803
|
-
]), 1040)) : createCommentVNode("", true)
|
|
7804
|
-
])), [
|
|
7805
|
-
[vShow, activeTabName.value === config.text]
|
|
7806
|
-
]);
|
|
7807
|
-
}), 128))
|
|
7808
|
-
])) : createCommentVNode("", true);
|
|
8025
|
+
])) : createCommentVNode("", true),
|
|
8026
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
8027
|
+
createElementVNode("div", _hoisted_5$3, [
|
|
8028
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(sideBarItems.value, (config, index) => {
|
|
8029
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
8030
|
+
key: config.$key ?? index,
|
|
8031
|
+
ref_for: true,
|
|
8032
|
+
ref_key: "floatBox",
|
|
8033
|
+
ref: floatBox,
|
|
8034
|
+
class: normalizeClass(["m-editor-float-box", `m-editor-float-box-${config.$key}`]),
|
|
8035
|
+
style: normalizeStyle({
|
|
8036
|
+
left: `${unref(floatBoxStates)?.get(config.$key)?.left}px`,
|
|
8037
|
+
top: `${unref(floatBoxStates)?.get(config.$key)?.top}px`,
|
|
8038
|
+
zIndex: unref(floatBoxStates)?.get(config.$key)?.zIndex
|
|
8039
|
+
})
|
|
8040
|
+
}, [
|
|
8041
|
+
createElementVNode("div", {
|
|
8042
|
+
class: normalizeClass(["m-editor-float-box-header", `m-editor-float-box-header-${config.$key}`]),
|
|
8043
|
+
onClick: ($event) => unref(showFloatBox)(config.$key)
|
|
8044
|
+
}, [
|
|
8045
|
+
createElementVNode("div", null, toDisplayString(config.text), 1),
|
|
8046
|
+
createVNode(_sfc_main$N, {
|
|
8047
|
+
class: "m-editor-float-box-close",
|
|
8048
|
+
icon: unref(Close),
|
|
8049
|
+
onClick: withModifiers(($event) => unref(closeFloatBox)(config.$key), ["stop"])
|
|
8050
|
+
}, null, 8, ["icon", "onClick"])
|
|
8051
|
+
], 10, _hoisted_6$2),
|
|
8052
|
+
createElementVNode("div", _hoisted_7, [
|
|
8053
|
+
config && unref(floatBoxStates)?.get(config.$key)?.status ? (openBlock(), createBlock(resolveDynamicComponent(config.boxComponentConfig?.component || config.component), mergeProps({ key: 0 }, config.boxComponentConfig?.props || config.props || {}, toHandlers(config?.listeners || {})), null, 16)) : createCommentVNode("", true)
|
|
8054
|
+
])
|
|
8055
|
+
], 6)), [
|
|
8056
|
+
[vShow, unref(floatBoxStates)?.get(config.$key)?.status]
|
|
8057
|
+
]);
|
|
8058
|
+
}), 128))
|
|
8059
|
+
])
|
|
8060
|
+
]))
|
|
8061
|
+
], 64);
|
|
7809
8062
|
};
|
|
7810
8063
|
}
|
|
7811
8064
|
});
|
|
@@ -7950,8 +8203,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
7950
8203
|
pos: {}
|
|
7951
8204
|
},
|
|
7952
8205
|
emits: ["scroll"],
|
|
7953
|
-
setup(__props, { emit }) {
|
|
8206
|
+
setup(__props, { emit: __emit }) {
|
|
7954
8207
|
const props = __props;
|
|
8208
|
+
const emit = __emit;
|
|
7955
8209
|
const bar = ref();
|
|
7956
8210
|
const thumb = ref();
|
|
7957
8211
|
const thumbSize = computed(() => props.size * (props.size / props.scrollSize));
|
|
@@ -8153,7 +8407,9 @@ const state = reactive({
|
|
|
8153
8407
|
showGuides: true,
|
|
8154
8408
|
showRule: true,
|
|
8155
8409
|
propsPanelSize: "small",
|
|
8156
|
-
showAddPageButton: true
|
|
8410
|
+
showAddPageButton: true,
|
|
8411
|
+
floatBox: /* @__PURE__ */ new Map(),
|
|
8412
|
+
hideSlideBar: false
|
|
8157
8413
|
});
|
|
8158
8414
|
class Ui extends BaseService {
|
|
8159
8415
|
constructor() {
|
|
@@ -8193,6 +8449,19 @@ class Ui extends BaseService {
|
|
|
8193
8449
|
}
|
|
8194
8450
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
8195
8451
|
}
|
|
8452
|
+
async setFloatBox(keys) {
|
|
8453
|
+
const map = state.floatBox;
|
|
8454
|
+
for (const key of keys) {
|
|
8455
|
+
if (map.get(key))
|
|
8456
|
+
continue;
|
|
8457
|
+
map.set(key, {
|
|
8458
|
+
status: false,
|
|
8459
|
+
zIndex: 99,
|
|
8460
|
+
top: 0,
|
|
8461
|
+
left: 0
|
|
8462
|
+
});
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8196
8465
|
resetState() {
|
|
8197
8466
|
this.set("showSrc", false);
|
|
8198
8467
|
this.set("uiSelectMode", false);
|
|
@@ -8405,8 +8674,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
8405
8674
|
pinned: { type: Boolean }
|
|
8406
8675
|
},
|
|
8407
8676
|
emits: ["close", "update:pinned", "change"],
|
|
8408
|
-
setup(__props, { emit }) {
|
|
8677
|
+
setup(__props, { emit: __emit }) {
|
|
8409
8678
|
const props = __props;
|
|
8679
|
+
const emit = __emit;
|
|
8410
8680
|
const pinHandler = () => {
|
|
8411
8681
|
emit("update:pinned", !props.pinned);
|
|
8412
8682
|
};
|
|
@@ -9469,254 +9739,41 @@ class ComponentList extends BaseService {
|
|
|
9469
9739
|
}
|
|
9470
9740
|
const componentListService = new ComponentList();
|
|
9471
9741
|
|
|
9472
|
-
class
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
/**
|
|
9478
|
-
* 目标id,不可重复
|
|
9479
|
-
* 例如目标是代码块,则为代码块id
|
|
9480
|
-
*/
|
|
9481
|
-
id;
|
|
9482
|
-
/**
|
|
9483
|
-
* 目标名称,用于显示在依赖列表中
|
|
9484
|
-
*/
|
|
9485
|
-
name;
|
|
9486
|
-
/**
|
|
9487
|
-
* 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
|
|
9488
|
-
*/
|
|
9489
|
-
type = DepTargetType.DEFAULT;
|
|
9490
|
-
/**
|
|
9491
|
-
* 依赖详情
|
|
9492
|
-
* 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
|
|
9493
|
-
*/
|
|
9494
|
-
deps = reactive({});
|
|
9495
|
-
constructor(options) {
|
|
9496
|
-
super();
|
|
9497
|
-
this.isTarget = options.isTarget;
|
|
9498
|
-
this.id = options.id;
|
|
9499
|
-
this.name = options.name;
|
|
9500
|
-
if (options.type) {
|
|
9501
|
-
this.type = options.type;
|
|
9502
|
-
}
|
|
9503
|
-
}
|
|
9504
|
-
/**
|
|
9505
|
-
* 更新依赖
|
|
9506
|
-
* @param node 节点配置
|
|
9507
|
-
* @param key 哪个key配置了这个目标的id
|
|
9508
|
-
*/
|
|
9509
|
-
updateDep(node, key) {
|
|
9510
|
-
const dep = this.deps[node.id] || {
|
|
9511
|
-
name: node.name,
|
|
9512
|
-
keys: []
|
|
9513
|
-
};
|
|
9514
|
-
if (node.name) {
|
|
9515
|
-
dep.name = node.name;
|
|
9516
|
-
}
|
|
9517
|
-
this.deps[node.id] = dep;
|
|
9518
|
-
if (dep.keys.indexOf(key) === -1) {
|
|
9519
|
-
dep.keys.push(key);
|
|
9520
|
-
}
|
|
9521
|
-
this.emit("change");
|
|
9522
|
-
}
|
|
9523
|
-
/**
|
|
9524
|
-
* 删除依赖
|
|
9525
|
-
* @param node 哪个节点的依赖需要移除,如果为空,则移除所有依赖
|
|
9526
|
-
* @param key 节点下哪个key需要移除,如果为空,则移除改节点下的所有依赖key
|
|
9527
|
-
* @returns void
|
|
9528
|
-
*/
|
|
9529
|
-
removeDep(node, key) {
|
|
9530
|
-
if (!node) {
|
|
9531
|
-
Object.keys(this.deps).forEach((depKey) => {
|
|
9532
|
-
delete this.deps[depKey];
|
|
9533
|
-
});
|
|
9534
|
-
this.emit("change");
|
|
9535
|
-
return;
|
|
9536
|
-
}
|
|
9537
|
-
const dep = this.deps[node.id];
|
|
9538
|
-
if (!dep)
|
|
9539
|
-
return;
|
|
9540
|
-
if (key) {
|
|
9541
|
-
const index = dep.keys.indexOf(key);
|
|
9542
|
-
dep.keys.splice(index, 1);
|
|
9543
|
-
if (dep.keys.length === 0) {
|
|
9544
|
-
delete this.deps[node.id];
|
|
9545
|
-
}
|
|
9546
|
-
} else {
|
|
9547
|
-
delete this.deps[node.id];
|
|
9548
|
-
}
|
|
9549
|
-
this.emit("change");
|
|
9550
|
-
}
|
|
9551
|
-
/**
|
|
9552
|
-
* 判断指定节点下的指定key是否存在在依赖列表中
|
|
9553
|
-
* @param node 哪个节点
|
|
9554
|
-
* @param key 哪个key
|
|
9555
|
-
* @returns boolean
|
|
9556
|
-
*/
|
|
9557
|
-
hasDep(node, key) {
|
|
9558
|
-
const dep = this.deps[node.id];
|
|
9559
|
-
return Boolean(dep?.keys.find((d) => d === key));
|
|
9560
|
-
}
|
|
9561
|
-
destroy() {
|
|
9562
|
-
this.removeAllListeners();
|
|
9742
|
+
class Dep extends BaseService {
|
|
9743
|
+
watcher = new Watcher({ initialTargets: reactive({}) });
|
|
9744
|
+
removeTargets(type = DepTargetType.DEFAULT) {
|
|
9745
|
+
this.watcher.removeTargets(type);
|
|
9746
|
+
this.emit("remove-target");
|
|
9563
9747
|
}
|
|
9564
|
-
}
|
|
9565
|
-
class Watcher extends EventEmitter {
|
|
9566
|
-
targets = reactive({});
|
|
9567
|
-
/**
|
|
9568
|
-
* 获取指定类型中的所有target
|
|
9569
|
-
* @param type 分类
|
|
9570
|
-
* @returns Target[]
|
|
9571
|
-
*/
|
|
9572
9748
|
getTargets(type = DepTargetType.DEFAULT) {
|
|
9573
|
-
return this.
|
|
9574
|
-
}
|
|
9575
|
-
/**
|
|
9576
|
-
* 添加新的目标
|
|
9577
|
-
* @param target Target
|
|
9578
|
-
*/
|
|
9579
|
-
addTarget(target) {
|
|
9580
|
-
const targets = this.getTargets(target.type) || {};
|
|
9581
|
-
this.targets[target.type] = targets;
|
|
9582
|
-
targets[target.id] = target;
|
|
9583
|
-
this.emit("add-target", target);
|
|
9749
|
+
return this.watcher.getTargets(type);
|
|
9584
9750
|
}
|
|
9585
|
-
/**
|
|
9586
|
-
* 获取指定id的target
|
|
9587
|
-
* @param id target id
|
|
9588
|
-
* @returns Target
|
|
9589
|
-
*/
|
|
9590
9751
|
getTarget(id) {
|
|
9591
|
-
|
|
9592
|
-
for (const targets of allTargets) {
|
|
9593
|
-
if (targets[id]) {
|
|
9594
|
-
return targets[id];
|
|
9595
|
-
}
|
|
9596
|
-
}
|
|
9752
|
+
return this.watcher.getTarget(id);
|
|
9597
9753
|
}
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
* @returns boolean
|
|
9602
|
-
*/
|
|
9603
|
-
hasTarget(id) {
|
|
9604
|
-
const allTargets = Object.values(this.targets);
|
|
9605
|
-
for (const targets of allTargets) {
|
|
9606
|
-
if (targets[id]) {
|
|
9607
|
-
return true;
|
|
9608
|
-
}
|
|
9609
|
-
}
|
|
9610
|
-
return false;
|
|
9754
|
+
addTarget(target) {
|
|
9755
|
+
this.watcher.addTarget(target);
|
|
9756
|
+
this.emit("add-target", target);
|
|
9611
9757
|
}
|
|
9612
|
-
/**
|
|
9613
|
-
* 删除指定id的target
|
|
9614
|
-
* @param id target id
|
|
9615
|
-
*/
|
|
9616
9758
|
removeTarget(id) {
|
|
9617
|
-
|
|
9618
|
-
for (const targets of allTargets) {
|
|
9619
|
-
if (targets[id]) {
|
|
9620
|
-
targets[id].destroy();
|
|
9621
|
-
delete targets[id];
|
|
9622
|
-
}
|
|
9623
|
-
}
|
|
9624
|
-
this.emit("remove-target");
|
|
9625
|
-
}
|
|
9626
|
-
/**
|
|
9627
|
-
* 删除指定分类的所有target
|
|
9628
|
-
* @param type 分类
|
|
9629
|
-
* @returns void
|
|
9630
|
-
*/
|
|
9631
|
-
removeTargets(type = DepTargetType.DEFAULT) {
|
|
9632
|
-
const targets = this.targets[type];
|
|
9633
|
-
if (!targets)
|
|
9634
|
-
return;
|
|
9635
|
-
for (const target of Object.values(targets)) {
|
|
9636
|
-
target.destroy();
|
|
9637
|
-
}
|
|
9638
|
-
delete this.targets[type];
|
|
9759
|
+
this.watcher.removeTarget(id);
|
|
9639
9760
|
this.emit("remove-target");
|
|
9640
9761
|
}
|
|
9641
|
-
/**
|
|
9642
|
-
* 删除所有target
|
|
9643
|
-
*/
|
|
9644
9762
|
clearTargets() {
|
|
9645
|
-
|
|
9646
|
-
delete this.targets[key];
|
|
9647
|
-
});
|
|
9763
|
+
this.watcher.clearTargets();
|
|
9648
9764
|
}
|
|
9649
|
-
/**
|
|
9650
|
-
* 收集依赖
|
|
9651
|
-
* @param nodes 需要收集的节点
|
|
9652
|
-
* @param deep 是否需要收集子节点
|
|
9653
|
-
*/
|
|
9654
9765
|
collect(nodes, deep = false) {
|
|
9655
|
-
|
|
9656
|
-
Object.values(targets).forEach((target) => {
|
|
9657
|
-
nodes.forEach((node) => {
|
|
9658
|
-
target.removeDep(node);
|
|
9659
|
-
this.collectItem(node, target, deep);
|
|
9660
|
-
});
|
|
9661
|
-
});
|
|
9662
|
-
});
|
|
9766
|
+
this.watcher.collect(nodes, deep);
|
|
9663
9767
|
this.emit("collected", nodes, deep);
|
|
9664
9768
|
}
|
|
9665
|
-
/**
|
|
9666
|
-
* 清除依赖
|
|
9667
|
-
* @param nodes 需要清除依赖的节点
|
|
9668
|
-
*/
|
|
9669
9769
|
clear(nodes) {
|
|
9670
|
-
|
|
9671
|
-
Object.values(this.targets).forEach((targets) => {
|
|
9672
|
-
Object.values(targets).forEach((target) => {
|
|
9673
|
-
if (nodes) {
|
|
9674
|
-
nodes.forEach((node) => {
|
|
9675
|
-
target.removeDep(node);
|
|
9676
|
-
if (Array.isArray(node.items) && node.items.length && !clearedItemsNodeIds.includes(node.id)) {
|
|
9677
|
-
clearedItemsNodeIds.push(node.id);
|
|
9678
|
-
this.clear(node.items);
|
|
9679
|
-
}
|
|
9680
|
-
});
|
|
9681
|
-
} else {
|
|
9682
|
-
target.removeDep();
|
|
9683
|
-
}
|
|
9684
|
-
});
|
|
9685
|
-
});
|
|
9770
|
+
return this.watcher.clear(nodes);
|
|
9686
9771
|
}
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
const doCollect = (key, value) => {
|
|
9690
|
-
const keyIsItems = key === "items";
|
|
9691
|
-
const fullKey = prop ? `${prop}.${key}` : key;
|
|
9692
|
-
if (target.isTarget(fullKey, value)) {
|
|
9693
|
-
target.updateDep(node, fullKey);
|
|
9694
|
-
this.emit("update-dep", node, fullKey);
|
|
9695
|
-
} else if (!keyIsItems && Array.isArray(value)) {
|
|
9696
|
-
value.forEach((item, index) => {
|
|
9697
|
-
if (isObject$1(item)) {
|
|
9698
|
-
collectTarget(item, `${fullKey}.${index}`);
|
|
9699
|
-
}
|
|
9700
|
-
});
|
|
9701
|
-
} else if (isObject$1(value)) {
|
|
9702
|
-
collectTarget(value, fullKey);
|
|
9703
|
-
}
|
|
9704
|
-
if (keyIsItems && deep && Array.isArray(value)) {
|
|
9705
|
-
value.forEach((child) => {
|
|
9706
|
-
this.collectItem(child, target, deep);
|
|
9707
|
-
});
|
|
9708
|
-
}
|
|
9709
|
-
};
|
|
9710
|
-
Object.entries(config).forEach(([key, value]) => {
|
|
9711
|
-
if (typeof value === "undefined" || value === "")
|
|
9712
|
-
return;
|
|
9713
|
-
doCollect(key, value);
|
|
9714
|
-
});
|
|
9715
|
-
};
|
|
9716
|
-
collectTarget(node);
|
|
9772
|
+
hasTarget(id) {
|
|
9773
|
+
return this.watcher.hasTarget(id);
|
|
9717
9774
|
}
|
|
9718
9775
|
}
|
|
9719
|
-
const depService = new
|
|
9776
|
+
const depService = new Dep();
|
|
9720
9777
|
|
|
9721
9778
|
let eventMap = reactive({});
|
|
9722
9779
|
let methodMap = reactive({});
|
|
@@ -9940,61 +9997,6 @@ const defaultEditorProps = {
|
|
|
9940
9997
|
codeOptions: () => ({})
|
|
9941
9998
|
};
|
|
9942
9999
|
|
|
9943
|
-
const createCodeBlockTarget = (id, codeBlock) => new Target({
|
|
9944
|
-
type: DepTargetType.CODE_BLOCK,
|
|
9945
|
-
id,
|
|
9946
|
-
name: codeBlock.name,
|
|
9947
|
-
isTarget: (key, value) => {
|
|
9948
|
-
if (id === value) {
|
|
9949
|
-
return true;
|
|
9950
|
-
}
|
|
9951
|
-
if (value?.hookType === HookType.CODE && !isEmpty(value.hookData)) {
|
|
9952
|
-
const index = value.hookData.findIndex((item) => item.codeId === id);
|
|
9953
|
-
return Boolean(index > -1);
|
|
9954
|
-
}
|
|
9955
|
-
return false;
|
|
9956
|
-
}
|
|
9957
|
-
});
|
|
9958
|
-
const createDataSourceTarget = (id) => new Target({
|
|
9959
|
-
type: DepTargetType.DATA_SOURCE,
|
|
9960
|
-
id,
|
|
9961
|
-
isTarget: (key, value) => {
|
|
9962
|
-
if (value?.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)) {
|
|
9963
|
-
return true;
|
|
9964
|
-
}
|
|
9965
|
-
if (!Array.isArray(value) || typeof value[0] !== "string") {
|
|
9966
|
-
return false;
|
|
9967
|
-
}
|
|
9968
|
-
const [prefixId] = value;
|
|
9969
|
-
const prefixIndex = prefixId.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);
|
|
9970
|
-
if (prefixIndex === -1) {
|
|
9971
|
-
return false;
|
|
9972
|
-
}
|
|
9973
|
-
const dsId = prefixId.substring(prefixIndex + DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length);
|
|
9974
|
-
return dsId === id && Boolean(dataSourceService.getDataSourceById(id));
|
|
9975
|
-
}
|
|
9976
|
-
});
|
|
9977
|
-
const createDataSourceCondTarget = (id) => new Target({
|
|
9978
|
-
type: DepTargetType.DATA_SOURCE_COND,
|
|
9979
|
-
id,
|
|
9980
|
-
isTarget: (key, value) => {
|
|
9981
|
-
if (!Array.isArray(value) || value[0] !== id || !`${key}`.startsWith("displayConds"))
|
|
9982
|
-
return false;
|
|
9983
|
-
const ds = dataSourceService.getDataSourceById(id);
|
|
9984
|
-
return Boolean(ds?.fields?.find((field) => field.name === value[1]));
|
|
9985
|
-
}
|
|
9986
|
-
});
|
|
9987
|
-
const createDataSourceMethodTarget = (id) => new Target({
|
|
9988
|
-
type: DepTargetType.DATA_SOURCE_METHOD,
|
|
9989
|
-
id,
|
|
9990
|
-
isTarget: (key, value) => {
|
|
9991
|
-
if (!Array.isArray(value) || value[0] !== id)
|
|
9992
|
-
return false;
|
|
9993
|
-
const ds = dataSourceService.getDataSourceById(id);
|
|
9994
|
-
return Boolean(ds?.methods?.find((method) => method.name === value[1]));
|
|
9995
|
-
}
|
|
9996
|
-
});
|
|
9997
|
-
|
|
9998
10000
|
const initServiceState = (props, {
|
|
9999
10001
|
editorService,
|
|
10000
10002
|
historyService,
|
|
@@ -10200,9 +10202,9 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
10200
10202
|
depService.on("dep-update", depUpdateHandler);
|
|
10201
10203
|
depService.on("collected", collectedHandler);
|
|
10202
10204
|
const initDataSourceDepTarget = (ds) => {
|
|
10203
|
-
depService.addTarget(createDataSourceTarget(ds
|
|
10204
|
-
depService.addTarget(createDataSourceMethodTarget(ds
|
|
10205
|
-
depService.addTarget(createDataSourceCondTarget(ds
|
|
10205
|
+
depService.addTarget(createDataSourceTarget(ds, reactive({})));
|
|
10206
|
+
depService.addTarget(createDataSourceMethodTarget(ds, reactive({})));
|
|
10207
|
+
depService.addTarget(createDataSourceCondTarget(ds, reactive({})));
|
|
10206
10208
|
};
|
|
10207
10209
|
const rootChangeHandler = async (value, preValue) => {
|
|
10208
10210
|
if (!value)
|
|
@@ -10342,7 +10344,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10342
10344
|
extendFormState: { type: Function }
|
|
10343
10345
|
}, defaultEditorProps),
|
|
10344
10346
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
10345
|
-
setup(__props, { expose: __expose, emit }) {
|
|
10347
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
10348
|
+
const emit = __emit;
|
|
10346
10349
|
const props = __props;
|
|
10347
10350
|
const services = {
|
|
10348
10351
|
componentListService,
|
|
@@ -10510,5 +10513,5 @@ const index = {
|
|
|
10510
10513
|
}
|
|
10511
10514
|
};
|
|
10512
10515
|
|
|
10513
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$r as CodeBlockList, _sfc_main$q as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$k as ContentMenu, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect,
|
|
10516
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$r as CodeBlockList, _sfc_main$q as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$k as ContentMenu, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$N as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$A as LayoutContainer, _sfc_main$v as PropsPanel, _sfc_main$B as Resizer, _sfc_main$A as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChilrenLayout, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useFloatBox, useStage, warn };
|
|
10514
10517
|
//# sourceMappingURL=tmagic-editor.js.map
|