@tmagic/editor 1.5.0-beta.11 → 1.5.0-beta.13
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 +15 -11
- package/dist/tmagic-editor.js +308 -288
- package/dist/tmagic-editor.umd.cjs +304 -284
- package/package.json +7 -7
- package/src/Editor.vue +6 -1
- package/src/editorProps.ts +3 -1
- package/src/initService.ts +94 -70
- package/src/layouts/Framework.vue +8 -1
- package/src/layouts/page-bar/AddButton.vue +29 -9
- package/src/layouts/page-bar/PageBar.vue +35 -65
- package/src/layouts/page-bar/PageBarScrollContainer.vue +45 -84
- package/src/layouts/page-bar/PageList.vue +1 -1
- package/src/layouts/page-bar/Search.vue +67 -0
- package/src/layouts/workspace/viewer/Stage.vue +11 -0
- package/src/services/dep.ts +12 -2
- package/src/services/editor.ts +20 -40
- package/src/theme/page-bar.scss +19 -12
- package/src/type.ts +2 -1
- package/src/utils/idle-task.ts +3 -2
- package/types/index.d.ts +38 -2
- package/src/layouts/page-bar/SwitchTypeButton.vue +0 -45
package/dist/tmagic-editor.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import designPlugin__default, { TMagicIcon, TMagicButton, TMagicCard, getDesignConfig, TMagicSelect, useZIndex, tMagicMessage, tMagicMessageBox, TMagicCascader, TMagicTooltip, TMagicTag, TMagicDialog, TMagicSwitch, TMagicInput, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicPopover, TMagicScrollbar, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
|
|
2
2
|
export * from '@tmagic/design';
|
|
3
3
|
export { default as designPlugin } from '@tmagic/design';
|
|
4
|
-
import formPlugin__default, { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel } from '@tmagic/form';
|
|
4
|
+
import formPlugin__default, { MContainer, MForm, filterFunction, createValues, MFormBox, MSelect, MGroupList, MPanel, createForm } from '@tmagic/form';
|
|
5
5
|
export * from '@tmagic/form';
|
|
6
6
|
export { default as formPlugin } from '@tmagic/form';
|
|
7
7
|
import tablePlugin__default, { MagicTable } from '@tmagic/table';
|
|
8
8
|
export * from '@tmagic/table';
|
|
9
9
|
export { default as tablePlugin } from '@tmagic/table';
|
|
10
10
|
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createElementBlock, normalizeClass, resolveDynamicComponent, toRaw, ref, watch, onMounted, onBeforeUnmount, Teleport, normalizeStyle, computed, reactive, resolveComponent, inject, createCommentVNode, Fragment, renderList, mergeProps, mergeModels, useModel, nextTick, provide, renderSlot, toDisplayString, createTextVNode, isRef, createStaticVNode, watchEffect, withModifiers, toHandlers, resolveDirective, withDirectives, createSlots, markRaw, getCurrentInstance, vShow, Transition, mergeDefaults } from 'vue';
|
|
11
|
-
import { Edit, FullScreen, View, Close, Coin, Delete, Plus, ArrowDown, ArrowLeftBold, ArrowRightBold, Files, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Document,
|
|
12
|
-
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys
|
|
11
|
+
import { Edit, FullScreen, View, Close, Coin, Delete, Plus, ArrowDown, ArrowLeftBold, ArrowRightBold, Files, Search, CaretBottom, DocumentCopy, Grid, Memo, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, Document, ArrowRight, CopyDocument, Hide, Goods, List, EditPen, CloseBold, Top, Bottom } from '@element-plus/icons-vue';
|
|
12
|
+
import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, get, map, has, pick, keys } from 'lodash-es';
|
|
13
13
|
import serialize from 'serialize-javascript';
|
|
14
14
|
import { emmetHTML, emmetCSS } from 'emmet-monaco-es';
|
|
15
15
|
import * as monaco from 'monaco-editor';
|
|
16
16
|
import { HookCodeType, HookType, NODE_CONDS_KEY, Target, Watcher, NodeType, ActionType, DepTargetType, DEFAULT_EVENTS, DEFAULT_METHODS, createCodeBlockTarget, createDataSourceTarget, createDataSourceMethodTarget, createDataSourceCondTarget } from '@tmagic/core';
|
|
17
17
|
export { DepTargetType } from '@tmagic/core';
|
|
18
|
-
import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, toLine, guid, getValueByKeyPath, setValueByKeyPath, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, traverseNode, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName } from '@tmagic/utils';
|
|
18
|
+
import { isPage, isPageFragment, isPop, getNodePath, isNumber, getElById, calcValueByFontsize, toLine, guid, getValueByKeyPath, setValueByKeyPath, getNodeInfo, dataSourceTemplateRegExp, getKeysArray, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, getKeys, convertToNumber, getIdFromEl, traverseNode, getDefaultValueFromFields, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, removeClassName, addClassName, removeClassNameByClassName, getNodes } from '@tmagic/utils';
|
|
19
19
|
export * from '@tmagic/utils';
|
|
20
20
|
import VanillaMoveable from 'moveable';
|
|
21
21
|
import StageCore__default, { isFixed, GuidesType, getOffset, RenderType, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
|
|
@@ -26,7 +26,7 @@ import Gesto from 'gesto';
|
|
|
26
26
|
import Sortable from 'sortablejs';
|
|
27
27
|
import KeyController from 'keycon';
|
|
28
28
|
|
|
29
|
-
const _hoisted_1$
|
|
29
|
+
const _hoisted_1$x = ["src"];
|
|
30
30
|
const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
31
31
|
...{
|
|
32
32
|
name: "MEditorIcon"
|
|
@@ -51,7 +51,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
|
|
|
51
51
|
class: "magic-editor-icon"
|
|
52
52
|
}, {
|
|
53
53
|
default: withCtx(() => [
|
|
54
|
-
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
54
|
+
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$x)
|
|
55
55
|
]),
|
|
56
56
|
_: 1
|
|
57
57
|
})) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
@@ -79,7 +79,7 @@ const getEditorConfig = (key) => $TMAGIC_EDITOR[key];
|
|
|
79
79
|
emmetHTML(monaco);
|
|
80
80
|
emmetCSS(monaco, ["css", "scss"]);
|
|
81
81
|
|
|
82
|
-
const _hoisted_1$
|
|
82
|
+
const _hoisted_1$w = {
|
|
83
83
|
class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
|
|
84
84
|
};
|
|
85
85
|
const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
@@ -239,7 +239,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
|
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
241
|
return (_ctx, _cache) => {
|
|
242
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
242
|
+
return openBlock(), createElementBlock("div", _hoisted_1$w, [
|
|
243
243
|
(openBlock(), createBlock(Teleport, {
|
|
244
244
|
to: "body",
|
|
245
245
|
disabled: !fullScreen.value
|
|
@@ -1868,28 +1868,7 @@ class Editor extends BaseService {
|
|
|
1868
1868
|
if (raw) {
|
|
1869
1869
|
root = toRaw(root);
|
|
1870
1870
|
}
|
|
1871
|
-
|
|
1872
|
-
node: null,
|
|
1873
|
-
parent: null,
|
|
1874
|
-
page: null
|
|
1875
|
-
};
|
|
1876
|
-
if (!root) return info;
|
|
1877
|
-
if (id === root.id) {
|
|
1878
|
-
info.node = root;
|
|
1879
|
-
return info;
|
|
1880
|
-
}
|
|
1881
|
-
const path = getNodePath(id, root.items);
|
|
1882
|
-
if (!path.length) return info;
|
|
1883
|
-
path.unshift(root);
|
|
1884
|
-
info.node = path[path.length - 1];
|
|
1885
|
-
info.parent = path[path.length - 2];
|
|
1886
|
-
path.forEach((item) => {
|
|
1887
|
-
if (isPage(item) || isPageFragment(item)) {
|
|
1888
|
-
info.page = item;
|
|
1889
|
-
return;
|
|
1890
|
-
}
|
|
1891
|
-
});
|
|
1892
|
-
return info;
|
|
1871
|
+
return getNodeInfo(id, root);
|
|
1893
1872
|
}
|
|
1894
1873
|
/**
|
|
1895
1874
|
* 根据ID获取指点节点配置
|
|
@@ -2110,10 +2089,10 @@ class Editor extends BaseService {
|
|
|
2110
2089
|
const rootItems = root.items || [];
|
|
2111
2090
|
if (isPage(node)) {
|
|
2112
2091
|
this.state.pageLength -= 1;
|
|
2113
|
-
await selectDefault(
|
|
2092
|
+
await selectDefault(rootItems);
|
|
2114
2093
|
} else if (isPageFragment(node)) {
|
|
2115
2094
|
this.state.pageFragmentLength -= 1;
|
|
2116
|
-
await selectDefault(
|
|
2095
|
+
await selectDefault(rootItems);
|
|
2117
2096
|
} else {
|
|
2118
2097
|
await this.select(parent);
|
|
2119
2098
|
stage?.select(parent.id);
|
|
@@ -2175,11 +2154,6 @@ class Editor extends BaseService {
|
|
|
2175
2154
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
2176
2155
|
nodes.splice(targetIndex, 1, newConfig);
|
|
2177
2156
|
this.set("nodes", [...nodes]);
|
|
2178
|
-
this.get("stage")?.update({
|
|
2179
|
-
config: cloneDeep(newConfig),
|
|
2180
|
-
parentId: parent.id,
|
|
2181
|
-
root: cloneDeep(root)
|
|
2182
|
-
});
|
|
2183
2157
|
if (isPage(newConfig) || isPageFragment(newConfig)) {
|
|
2184
2158
|
this.set("page", newConfig);
|
|
2185
2159
|
}
|
|
@@ -2401,7 +2375,11 @@ class Editor extends BaseService {
|
|
|
2401
2375
|
target.items.push(newConfig);
|
|
2402
2376
|
await stage.select(targetId);
|
|
2403
2377
|
const targetParent = this.getParentById(target.id);
|
|
2404
|
-
await stage.update({
|
|
2378
|
+
await stage.update({
|
|
2379
|
+
config: cloneDeep(target),
|
|
2380
|
+
parentId: targetParent?.id,
|
|
2381
|
+
root: cloneDeep(root)
|
|
2382
|
+
});
|
|
2405
2383
|
await this.select(newConfig);
|
|
2406
2384
|
stage.select(newConfig.id);
|
|
2407
2385
|
this.addModifiedNodeId(target.id);
|
|
@@ -3019,12 +2997,12 @@ class IdleTask extends EventEmitter {
|
|
|
3019
2997
|
return super.emit(eventName, ...args);
|
|
3020
2998
|
}
|
|
3021
2999
|
runTaskQueue(deadline) {
|
|
3022
|
-
while ((deadline.timeRemaining() >
|
|
3000
|
+
while ((deadline.timeRemaining() > 10 || deadline.didTimeout) && this.taskList.length) {
|
|
3023
3001
|
const task = this.taskList.shift();
|
|
3024
3002
|
task.handler(task.data);
|
|
3025
3003
|
}
|
|
3026
3004
|
if (this.taskList.length) {
|
|
3027
|
-
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout:
|
|
3005
|
+
this.taskHandle = globalThis.requestIdleCallback(this.runTaskQueue.bind(this), { timeout: 300 });
|
|
3028
3006
|
} else {
|
|
3029
3007
|
this.taskHandle = 0;
|
|
3030
3008
|
this.emit("finish");
|
|
@@ -3229,8 +3207,8 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3229
3207
|
}
|
|
3230
3208
|
});
|
|
3231
3209
|
|
|
3232
|
-
const _hoisted_1$
|
|
3233
|
-
const _hoisted_2$
|
|
3210
|
+
const _hoisted_1$v = { class: "m-fields-code-select-col" };
|
|
3211
|
+
const _hoisted_2$h = { class: "code-select-container" };
|
|
3234
3212
|
const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
3235
3213
|
...{
|
|
3236
3214
|
name: "MFieldsCodeSelectCol"
|
|
@@ -3310,8 +3288,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
|
3310
3288
|
eventBus?.emit("edit-code", id);
|
|
3311
3289
|
};
|
|
3312
3290
|
return (_ctx, _cache) => {
|
|
3313
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3314
|
-
createElementVNode("div", _hoisted_2$
|
|
3291
|
+
return openBlock(), createElementBlock("div", _hoisted_1$v, [
|
|
3292
|
+
createElementVNode("div", _hoisted_2$h, [
|
|
3315
3293
|
createVNode(unref(MContainer), {
|
|
3316
3294
|
class: "select",
|
|
3317
3295
|
config: selectConfig,
|
|
@@ -4181,8 +4159,8 @@ const useNodeStatus$1 = (nodeData) => {
|
|
|
4181
4159
|
};
|
|
4182
4160
|
};
|
|
4183
4161
|
|
|
4184
|
-
const _hoisted_1$
|
|
4185
|
-
const _hoisted_2$
|
|
4162
|
+
const _hoisted_1$u = { class: "m-editor-data-source-fields" };
|
|
4163
|
+
const _hoisted_2$g = { class: "m-editor-data-source-fields-footer" };
|
|
4186
4164
|
const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
4187
4165
|
...{
|
|
4188
4166
|
name: "MFieldsDataSourceFields"
|
|
@@ -4434,12 +4412,12 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4434
4412
|
const parentFloating = inject("parentFloating", ref(null));
|
|
4435
4413
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
4436
4414
|
return (_ctx, _cache) => {
|
|
4437
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4415
|
+
return openBlock(), createElementBlock("div", _hoisted_1$u, [
|
|
4438
4416
|
createVNode(unref(MagicTable), {
|
|
4439
4417
|
data: _ctx.model[_ctx.name],
|
|
4440
4418
|
columns: fieldColumns
|
|
4441
4419
|
}, null, 8, ["data"]),
|
|
4442
|
-
createElementVNode("div", _hoisted_2$
|
|
4420
|
+
createElementVNode("div", _hoisted_2$g, [
|
|
4443
4421
|
createVNode(unref(TMagicButton), {
|
|
4444
4422
|
size: "small",
|
|
4445
4423
|
disabled: _ctx.disabled,
|
|
@@ -4512,7 +4490,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
4512
4490
|
}
|
|
4513
4491
|
});
|
|
4514
4492
|
|
|
4515
|
-
const _hoisted_1$
|
|
4493
|
+
const _hoisted_1$t = { class: "m-editor-data-source-field-select" };
|
|
4516
4494
|
const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
4517
4495
|
__name: "FieldSelect",
|
|
4518
4496
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -4594,7 +4572,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
4594
4572
|
eventBus?.emit("edit-data-source", removeDataSourceFieldPrefix(id));
|
|
4595
4573
|
};
|
|
4596
4574
|
return (_ctx, _cache) => {
|
|
4597
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4575
|
+
return openBlock(), createElementBlock("div", _hoisted_1$t, [
|
|
4598
4576
|
_ctx.checkStrictly ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4599
4577
|
createVNode(unref(TMagicSelect), {
|
|
4600
4578
|
"model-value": selectDataSourceId.value,
|
|
@@ -4676,7 +4654,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
|
|
|
4676
4654
|
}
|
|
4677
4655
|
});
|
|
4678
4656
|
|
|
4679
|
-
const _hoisted_1$
|
|
4657
|
+
const _hoisted_1$s = { class: "m-fields-data-source-field-select" };
|
|
4680
4658
|
const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
4681
4659
|
...{
|
|
4682
4660
|
name: "MFieldsDataSourceFieldSelect"
|
|
@@ -4778,7 +4756,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
4778
4756
|
}
|
|
4779
4757
|
};
|
|
4780
4758
|
return (_ctx, _cache) => {
|
|
4781
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4759
|
+
return openBlock(), createElementBlock("div", _hoisted_1$s, [
|
|
4782
4760
|
showDataSourceFieldSelect.value || !_ctx.config.fieldConfig ? (openBlock(), createBlock(_sfc_main$O, {
|
|
4783
4761
|
key: 0,
|
|
4784
4762
|
"model-value": _ctx.model[_ctx.name],
|
|
@@ -4826,8 +4804,8 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
|
|
|
4826
4804
|
}
|
|
4827
4805
|
});
|
|
4828
4806
|
|
|
4829
|
-
const _hoisted_1$
|
|
4830
|
-
const _hoisted_2$
|
|
4807
|
+
const _hoisted_1$r = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
4808
|
+
const _hoisted_2$f = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
4831
4809
|
const _hoisted_3$4 = { class: "el-input__inner t-input__inner" };
|
|
4832
4810
|
const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
4833
4811
|
...{
|
|
@@ -5032,9 +5010,9 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
5032
5010
|
createVNode(_sfc_main$Y, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
5033
5011
|
]),
|
|
5034
5012
|
default: withCtx(({ item }) => [
|
|
5035
|
-
createElementVNode("div", _hoisted_1$
|
|
5013
|
+
createElementVNode("div", _hoisted_1$r, [
|
|
5036
5014
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
5037
|
-
createElementVNode("span", _hoisted_2$
|
|
5015
|
+
createElementVNode("span", _hoisted_2$f, toDisplayString(item.value), 1)
|
|
5038
5016
|
])
|
|
5039
5017
|
]),
|
|
5040
5018
|
_: 1
|
|
@@ -5075,8 +5053,8 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
5075
5053
|
}
|
|
5076
5054
|
});
|
|
5077
5055
|
|
|
5078
|
-
const _hoisted_1$
|
|
5079
|
-
const _hoisted_2$
|
|
5056
|
+
const _hoisted_1$q = { style: { "display": "flex", "margin-bottom": "10px" } };
|
|
5057
|
+
const _hoisted_2$e = { style: { "flex": "1" } };
|
|
5080
5058
|
const _hoisted_3$3 = { style: { "flex": "1" } };
|
|
5081
5059
|
const _hoisted_4$3 = { class: "dialog-footer" };
|
|
5082
5060
|
const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
@@ -5329,8 +5307,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5329
5307
|
])
|
|
5330
5308
|
]),
|
|
5331
5309
|
default: withCtx(() => [
|
|
5332
|
-
createElementVNode("div", _hoisted_1$
|
|
5333
|
-
createElementVNode("div", _hoisted_2$
|
|
5310
|
+
createElementVNode("div", _hoisted_1$q, [
|
|
5311
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
5334
5312
|
createVNode(unref(TMagicTag), {
|
|
5335
5313
|
size: "small",
|
|
5336
5314
|
type: "info"
|
|
@@ -5372,8 +5350,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
|
|
|
5372
5350
|
}
|
|
5373
5351
|
});
|
|
5374
5352
|
|
|
5375
|
-
const _hoisted_1$
|
|
5376
|
-
const _hoisted_2$
|
|
5353
|
+
const _hoisted_1$p = { class: "m-editor-data-source-methods" };
|
|
5354
|
+
const _hoisted_2$d = { class: "m-editor-data-source-methods-footer" };
|
|
5377
5355
|
const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
5378
5356
|
...{
|
|
5379
5357
|
name: "MFieldsDataSourceMethods"
|
|
@@ -5444,12 +5422,12 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5444
5422
|
emit("change", props.model[props.name]);
|
|
5445
5423
|
};
|
|
5446
5424
|
return (_ctx, _cache) => {
|
|
5447
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5425
|
+
return openBlock(), createElementBlock("div", _hoisted_1$p, [
|
|
5448
5426
|
createVNode(unref(MagicTable), {
|
|
5449
5427
|
data: _ctx.model[_ctx.name],
|
|
5450
5428
|
columns: methodColumns
|
|
5451
5429
|
}, null, 8, ["data"]),
|
|
5452
|
-
createElementVNode("div", _hoisted_2$
|
|
5430
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
5453
5431
|
createVNode(unref(TMagicButton), {
|
|
5454
5432
|
size: "small",
|
|
5455
5433
|
type: "primary",
|
|
@@ -5478,8 +5456,8 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
5478
5456
|
}
|
|
5479
5457
|
});
|
|
5480
5458
|
|
|
5481
|
-
const _hoisted_1$
|
|
5482
|
-
const _hoisted_2$
|
|
5459
|
+
const _hoisted_1$o = { class: "m-fields-data-source-method-select" };
|
|
5460
|
+
const _hoisted_2$c = { class: "data-source-method-select-container" };
|
|
5483
5461
|
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
5484
5462
|
...{
|
|
5485
5463
|
name: "MFieldsDataSourceMethodSelect"
|
|
@@ -5566,8 +5544,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5566
5544
|
eventBus?.emit("edit-data-source", id);
|
|
5567
5545
|
};
|
|
5568
5546
|
return (_ctx, _cache) => {
|
|
5569
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5570
|
-
createElementVNode("div", _hoisted_2$
|
|
5547
|
+
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
5548
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
5571
5549
|
createVNode(unref(MContainer), {
|
|
5572
5550
|
class: "select",
|
|
5573
5551
|
config: cascaderConfig.value,
|
|
@@ -5610,8 +5588,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5610
5588
|
}
|
|
5611
5589
|
});
|
|
5612
5590
|
|
|
5613
|
-
const _hoisted_1$
|
|
5614
|
-
const _hoisted_2$
|
|
5591
|
+
const _hoisted_1$n = { class: "m-editor-data-source-fields" };
|
|
5592
|
+
const _hoisted_2$b = { class: "m-editor-data-source-fields-footer" };
|
|
5615
5593
|
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
5616
5594
|
...{
|
|
5617
5595
|
name: "MFieldsDataSourceMocks"
|
|
@@ -5816,12 +5794,12 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5816
5794
|
const parentFloating = inject("parentFloating", ref(null));
|
|
5817
5795
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(services?.uiService, parentFloating);
|
|
5818
5796
|
return (_ctx, _cache) => {
|
|
5819
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5797
|
+
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
5820
5798
|
createVNode(unref(MagicTable), {
|
|
5821
5799
|
data: _ctx.model[_ctx.name],
|
|
5822
5800
|
columns
|
|
5823
5801
|
}, null, 8, ["data"]),
|
|
5824
|
-
createElementVNode("div", _hoisted_2$
|
|
5802
|
+
createElementVNode("div", _hoisted_2$b, [
|
|
5825
5803
|
createVNode(unref(TMagicButton), {
|
|
5826
5804
|
size: "small",
|
|
5827
5805
|
type: "primary",
|
|
@@ -5863,7 +5841,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5863
5841
|
}
|
|
5864
5842
|
});
|
|
5865
5843
|
|
|
5866
|
-
const _hoisted_1$
|
|
5844
|
+
const _hoisted_1$m = { class: "m-fields-data-source-select" };
|
|
5867
5845
|
const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
5868
5846
|
...{
|
|
5869
5847
|
name: "MFieldsDataSourceSelect"
|
|
@@ -5921,7 +5899,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5921
5899
|
eventBus?.emit("edit-data-source", id);
|
|
5922
5900
|
};
|
|
5923
5901
|
return (_ctx, _cache) => {
|
|
5924
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
5902
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
5925
5903
|
createVNode(unref(MSelect), {
|
|
5926
5904
|
model: _ctx.model,
|
|
5927
5905
|
name: _ctx.name,
|
|
@@ -6085,8 +6063,8 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
6085
6063
|
}
|
|
6086
6064
|
});
|
|
6087
6065
|
|
|
6088
|
-
const _hoisted_1$
|
|
6089
|
-
const _hoisted_2$
|
|
6066
|
+
const _hoisted_1$l = { class: "m-fields-event-select" };
|
|
6067
|
+
const _hoisted_2$a = {
|
|
6090
6068
|
key: 1,
|
|
6091
6069
|
class: "fullWidth"
|
|
6092
6070
|
};
|
|
@@ -6364,7 +6342,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6364
6342
|
};
|
|
6365
6343
|
return (_ctx, _cache) => {
|
|
6366
6344
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
6367
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6345
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
6368
6346
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
6369
6347
|
key: 0,
|
|
6370
6348
|
ref: "eventForm",
|
|
@@ -6374,7 +6352,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6374
6352
|
model: _ctx.model,
|
|
6375
6353
|
config: tableConfig.value,
|
|
6376
6354
|
onChange: onChangeHandler
|
|
6377
|
-
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
6355
|
+
}, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$a, [
|
|
6378
6356
|
createVNode(unref(TMagicButton), {
|
|
6379
6357
|
class: "create-button",
|
|
6380
6358
|
type: "primary",
|
|
@@ -6424,7 +6402,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
6424
6402
|
}
|
|
6425
6403
|
});
|
|
6426
6404
|
|
|
6427
|
-
const _hoisted_1$
|
|
6405
|
+
const _hoisted_1$k = {
|
|
6428
6406
|
viewBox: "0 0 32 32",
|
|
6429
6407
|
version: "1.1",
|
|
6430
6408
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6437,15 +6415,15 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
6437
6415
|
__name: "CodeIcon",
|
|
6438
6416
|
setup(__props) {
|
|
6439
6417
|
return (_ctx, _cache) => {
|
|
6440
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
6418
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$k, _cache[0] || (_cache[0] = [
|
|
6441
6419
|
createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2)
|
|
6442
6420
|
]));
|
|
6443
6421
|
};
|
|
6444
6422
|
}
|
|
6445
6423
|
});
|
|
6446
6424
|
|
|
6447
|
-
const _hoisted_1$
|
|
6448
|
-
const _hoisted_2$
|
|
6425
|
+
const _hoisted_1$j = { class: "m-fields-key-value" };
|
|
6426
|
+
const _hoisted_2$9 = { key: 0 };
|
|
6449
6427
|
const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
6450
6428
|
...{
|
|
6451
6429
|
name: "MFieldsKeyValue"
|
|
@@ -6504,8 +6482,8 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6504
6482
|
emit("change", v);
|
|
6505
6483
|
};
|
|
6506
6484
|
return (_ctx, _cache) => {
|
|
6507
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6508
|
-
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
6485
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
6486
|
+
!showCode.value ? (openBlock(), createElementBlock("div", _hoisted_2$9, [
|
|
6509
6487
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
6510
6488
|
return openBlock(), createElementBlock("div", {
|
|
6511
6489
|
class: "m-fields-key-value-item",
|
|
@@ -6578,8 +6556,8 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
6578
6556
|
}
|
|
6579
6557
|
});
|
|
6580
6558
|
|
|
6581
|
-
const _hoisted_1$
|
|
6582
|
-
const _hoisted_2$
|
|
6559
|
+
const _hoisted_1$i = { class: "m-fields-page-fragment-select" };
|
|
6560
|
+
const _hoisted_2$8 = { class: "page-fragment-select-container" };
|
|
6583
6561
|
const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
6584
6562
|
...{
|
|
6585
6563
|
name: "MFieldsPageFragmentSelect"
|
|
@@ -6626,8 +6604,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6626
6604
|
};
|
|
6627
6605
|
return (_ctx, _cache) => {
|
|
6628
6606
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
6629
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
6630
|
-
createElementVNode("div", _hoisted_2$
|
|
6607
|
+
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
6608
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
6631
6609
|
createVNode(_component_m_form_container, {
|
|
6632
6610
|
class: "select",
|
|
6633
6611
|
config: selectConfig,
|
|
@@ -6647,7 +6625,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
6647
6625
|
}
|
|
6648
6626
|
});
|
|
6649
6627
|
|
|
6650
|
-
const _hoisted_1$
|
|
6628
|
+
const _hoisted_1$h = {
|
|
6651
6629
|
key: 1,
|
|
6652
6630
|
class: "m-fields-ui-select",
|
|
6653
6631
|
style: { "display": "flex" }
|
|
@@ -6747,7 +6725,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
6747
6725
|
])),
|
|
6748
6726
|
_: 1
|
|
6749
6727
|
}, 8, ["icon", "disabled", "size"])
|
|
6750
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
6728
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
6751
6729
|
val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6752
6730
|
createVNode(unref(TMagicTooltip), {
|
|
6753
6731
|
content: "清除",
|
|
@@ -6996,11 +6974,11 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
6996
6974
|
}
|
|
6997
6975
|
});
|
|
6998
6976
|
|
|
6999
|
-
const _hoisted_1$
|
|
6977
|
+
const _hoisted_1$g = {
|
|
7000
6978
|
key: 1,
|
|
7001
6979
|
class: "menu-item-text"
|
|
7002
6980
|
};
|
|
7003
|
-
const _hoisted_2$
|
|
6981
|
+
const _hoisted_2$7 = { class: "el-dropdown-link menubar-menu-button" };
|
|
7004
6982
|
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
7005
6983
|
...{
|
|
7006
6984
|
name: "MEditorToolButton"
|
|
@@ -7072,7 +7050,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7072
7050
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
7073
7051
|
key: 0,
|
|
7074
7052
|
direction: _ctx.data.direction || "vertical"
|
|
7075
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
7053
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$g, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
7076
7054
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
7077
7055
|
key: 0,
|
|
7078
7056
|
effect: "dark",
|
|
@@ -7137,7 +7115,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7137
7115
|
})) : createCommentVNode("", true)
|
|
7138
7116
|
]),
|
|
7139
7117
|
default: withCtx(() => [
|
|
7140
|
-
createElementVNode("span", _hoisted_2$
|
|
7118
|
+
createElementVNode("span", _hoisted_2$7, [
|
|
7141
7119
|
createTextVNode(toDisplayString(_ctx.data.text), 1),
|
|
7142
7120
|
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
7143
7121
|
default: withCtx(() => [
|
|
@@ -7154,7 +7132,12 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7154
7132
|
}
|
|
7155
7133
|
});
|
|
7156
7134
|
|
|
7157
|
-
const _hoisted_1$
|
|
7135
|
+
const _hoisted_1$f = {
|
|
7136
|
+
key: 0,
|
|
7137
|
+
id: "m-editor-page-bar-add-icon",
|
|
7138
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
7139
|
+
};
|
|
7140
|
+
const _hoisted_2$6 = {
|
|
7158
7141
|
key: 1,
|
|
7159
7142
|
style: { "width": "21px" }
|
|
7160
7143
|
};
|
|
@@ -7163,35 +7146,51 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
7163
7146
|
name: "MEditorPageBarAddButton"
|
|
7164
7147
|
},
|
|
7165
7148
|
__name: "AddButton",
|
|
7166
|
-
props: {
|
|
7167
|
-
type: {}
|
|
7168
|
-
},
|
|
7169
7149
|
setup(__props) {
|
|
7170
|
-
const props = __props;
|
|
7171
7150
|
const services = inject("services");
|
|
7172
7151
|
const uiService = services?.uiService;
|
|
7173
7152
|
const editorService = services?.editorService;
|
|
7174
7153
|
const showAddPageButton = computed(() => uiService?.get("showAddPageButton"));
|
|
7175
|
-
const addPage = () => {
|
|
7154
|
+
const addPage = (type) => {
|
|
7176
7155
|
if (!editorService) return;
|
|
7177
7156
|
const root = toRaw(editorService.get("root"));
|
|
7178
7157
|
if (!root) throw new Error("root 不能为空");
|
|
7179
7158
|
const pageConfig = {
|
|
7180
|
-
type
|
|
7181
|
-
name: generatePageNameByApp(root,
|
|
7159
|
+
type,
|
|
7160
|
+
name: generatePageNameByApp(root, type),
|
|
7182
7161
|
items: []
|
|
7183
7162
|
};
|
|
7184
7163
|
editorService.add(pageConfig);
|
|
7185
7164
|
};
|
|
7186
7165
|
return (_ctx, _cache) => {
|
|
7187
|
-
return showAddPageButton.value ? (openBlock(), createElementBlock("div",
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7166
|
+
return showAddPageButton.value ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
7167
|
+
createVNode(unref(TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
|
|
7168
|
+
reference: withCtx(() => [
|
|
7169
|
+
createVNode(_sfc_main$Y, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
7170
|
+
]),
|
|
7171
|
+
default: withCtx(() => [
|
|
7172
|
+
createVNode(_sfc_main$y, {
|
|
7173
|
+
data: {
|
|
7174
|
+
type: "button",
|
|
7175
|
+
text: "页面",
|
|
7176
|
+
handler: () => {
|
|
7177
|
+
addPage(unref(NodeType).PAGE);
|
|
7178
|
+
}
|
|
7179
|
+
}
|
|
7180
|
+
}, null, 8, ["data"]),
|
|
7181
|
+
createVNode(_sfc_main$y, {
|
|
7182
|
+
data: {
|
|
7183
|
+
type: "button",
|
|
7184
|
+
text: "页面片",
|
|
7185
|
+
handler: () => {
|
|
7186
|
+
addPage(unref(NodeType).PAGE_FRAGMENT);
|
|
7187
|
+
}
|
|
7188
|
+
}
|
|
7189
|
+
}, null, 8, ["data"])
|
|
7190
|
+
]),
|
|
7191
|
+
_: 1
|
|
7192
|
+
})
|
|
7193
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_2$6));
|
|
7195
7194
|
};
|
|
7196
7195
|
}
|
|
7197
7196
|
});
|
|
@@ -7202,8 +7201,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7202
7201
|
},
|
|
7203
7202
|
__name: "PageBarScrollContainer",
|
|
7204
7203
|
props: {
|
|
7205
|
-
|
|
7206
|
-
|
|
7204
|
+
pageBarSortOptions: {},
|
|
7205
|
+
length: {}
|
|
7207
7206
|
},
|
|
7208
7207
|
setup(__props) {
|
|
7209
7208
|
const props = __props;
|
|
@@ -7216,7 +7215,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7216
7215
|
const showPageListButton = computed(() => uiService?.get("showPageListButton"));
|
|
7217
7216
|
const itemsContainerWidth = ref(0);
|
|
7218
7217
|
const setCanScroll = () => {
|
|
7219
|
-
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
|
|
7218
|
+
itemsContainerWidth.value = (pageBar.value?.clientWidth || 0) - 37 * 2 - 37 - (showAddPageButton.value ? 37 : 21) - (showPageListButton.value ? 37 : 0);
|
|
7220
7219
|
nextTick(() => {
|
|
7221
7220
|
if (itemsContainer.value) {
|
|
7222
7221
|
canScroll.value = itemsContainer.value.scrollWidth - itemsContainerWidth.value > 1;
|
|
@@ -7254,19 +7253,17 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7254
7253
|
}
|
|
7255
7254
|
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
7256
7255
|
};
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
length,
|
|
7261
|
-
(length2 = 0, preLength = 0) => {
|
|
7256
|
+
watch(
|
|
7257
|
+
() => props.length,
|
|
7258
|
+
(length = 0, preLength = 0) => {
|
|
7262
7259
|
setTimeout(() => {
|
|
7263
7260
|
setCanScroll();
|
|
7264
|
-
if (
|
|
7261
|
+
if (length < preLength) {
|
|
7265
7262
|
scroll("start");
|
|
7266
7263
|
} else {
|
|
7267
7264
|
scroll("end");
|
|
7268
7265
|
}
|
|
7269
|
-
if (
|
|
7266
|
+
if (length > 1) {
|
|
7270
7267
|
const el = document.querySelector(".m-editor-page-bar-items");
|
|
7271
7268
|
let beforeDragList = [];
|
|
7272
7269
|
const options = {
|
|
@@ -7302,25 +7299,6 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7302
7299
|
immediate: true
|
|
7303
7300
|
}
|
|
7304
7301
|
);
|
|
7305
|
-
let unWatchPageLength;
|
|
7306
|
-
let unWatchPageFragmentLength;
|
|
7307
|
-
watch(
|
|
7308
|
-
() => props.type,
|
|
7309
|
-
(type) => {
|
|
7310
|
-
if (type === NodeType.PAGE) {
|
|
7311
|
-
unWatchPageFragmentLength?.();
|
|
7312
|
-
unWatchPageFragmentLength = null;
|
|
7313
|
-
unWatchPageLength = crateWatchLength(pageLength);
|
|
7314
|
-
} else {
|
|
7315
|
-
unWatchPageLength?.();
|
|
7316
|
-
unWatchPageLength = null;
|
|
7317
|
-
unWatchPageFragmentLength = crateWatchLength(pageFragmentLength);
|
|
7318
|
-
}
|
|
7319
|
-
},
|
|
7320
|
-
{
|
|
7321
|
-
immediate: true
|
|
7322
|
-
}
|
|
7323
|
-
);
|
|
7324
7302
|
return (_ctx, _cache) => {
|
|
7325
7303
|
return openBlock(), createElementBlock("div", {
|
|
7326
7304
|
class: "m-editor-page-bar",
|
|
@@ -7335,7 +7313,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7335
7313
|
}, [
|
|
7336
7314
|
createVNode(_sfc_main$Y, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
7337
7315
|
])) : createCommentVNode("", true),
|
|
7338
|
-
_ctx.
|
|
7316
|
+
_ctx.length ? (openBlock(), createElementBlock("div", {
|
|
7339
7317
|
key: 1,
|
|
7340
7318
|
class: "m-editor-page-bar-items",
|
|
7341
7319
|
ref_key: "itemsContainer",
|
|
@@ -7356,7 +7334,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
7356
7334
|
}
|
|
7357
7335
|
});
|
|
7358
7336
|
|
|
7359
|
-
const _hoisted_1$
|
|
7337
|
+
const _hoisted_1$e = {
|
|
7360
7338
|
key: 0,
|
|
7361
7339
|
id: "m-editor-page-bar-list-icon",
|
|
7362
7340
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
@@ -7378,7 +7356,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
7378
7356
|
editorService?.select(id);
|
|
7379
7357
|
};
|
|
7380
7358
|
return (_ctx, _cache) => {
|
|
7381
|
-
return showPageListButton.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
7359
|
+
return showPageListButton.value ? (openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
7382
7360
|
createVNode(unref(TMagicPopover), {
|
|
7383
7361
|
"popper-class": "page-bar-popover",
|
|
7384
7362
|
placement: "top",
|
|
@@ -7417,46 +7395,66 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
7417
7395
|
}
|
|
7418
7396
|
});
|
|
7419
7397
|
|
|
7398
|
+
const _hoisted_1$d = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
|
|
7420
7399
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
7421
|
-
|
|
7422
|
-
name: "MEditorPageBarSwitchTypeButton"
|
|
7423
|
-
},
|
|
7424
|
-
__name: "SwitchTypeButton",
|
|
7400
|
+
__name: "Search",
|
|
7425
7401
|
props: {
|
|
7426
|
-
|
|
7402
|
+
"query": {},
|
|
7403
|
+
"queryModifiers": {}
|
|
7427
7404
|
},
|
|
7428
|
-
emits: ["update:
|
|
7405
|
+
emits: /* @__PURE__ */ mergeModels(["search"], ["update:query"]),
|
|
7429
7406
|
setup(__props, { emit: __emit }) {
|
|
7430
|
-
const
|
|
7407
|
+
const emit = __emit;
|
|
7408
|
+
const query = useModel(__props, "query");
|
|
7409
|
+
const formConfig = createForm([
|
|
7431
7410
|
{
|
|
7432
|
-
type:
|
|
7433
|
-
|
|
7411
|
+
type: "checkbox-group",
|
|
7412
|
+
name: "pageType",
|
|
7413
|
+
options: [
|
|
7414
|
+
{
|
|
7415
|
+
value: NodeType.PAGE,
|
|
7416
|
+
text: "页面"
|
|
7417
|
+
},
|
|
7418
|
+
{
|
|
7419
|
+
value: NodeType.PAGE_FRAGMENT,
|
|
7420
|
+
text: "页面片段"
|
|
7421
|
+
}
|
|
7422
|
+
]
|
|
7434
7423
|
},
|
|
7435
7424
|
{
|
|
7436
|
-
|
|
7437
|
-
|
|
7425
|
+
name: "keyword",
|
|
7426
|
+
type: "text",
|
|
7427
|
+
placeholder: "请输入关键字",
|
|
7428
|
+
clearable: true
|
|
7438
7429
|
}
|
|
7439
|
-
];
|
|
7440
|
-
const
|
|
7441
|
-
const
|
|
7442
|
-
|
|
7430
|
+
]);
|
|
7431
|
+
const visible = ref(false);
|
|
7432
|
+
const onFormChange = (values) => {
|
|
7433
|
+
query.value = values;
|
|
7434
|
+
emit("search", values);
|
|
7443
7435
|
};
|
|
7444
7436
|
return (_ctx, _cache) => {
|
|
7445
|
-
return openBlock(), createElementBlock(
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7437
|
+
return openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
7438
|
+
createVNode(_sfc_main$Y, {
|
|
7439
|
+
icon: unref(Search),
|
|
7440
|
+
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value),
|
|
7441
|
+
class: normalizeClass({ "icon-active": visible.value })
|
|
7442
|
+
}, null, 8, ["icon", "class"]),
|
|
7443
|
+
visible.value ? (openBlock(), createBlock(Teleport, {
|
|
7444
|
+
key: 0,
|
|
7445
|
+
to: ".m-editor-page-bar-tabs"
|
|
7446
|
+
}, [
|
|
7447
|
+
query.value ? (openBlock(), createBlock(unref(MForm), {
|
|
7448
|
+
key: 0,
|
|
7449
|
+
class: "m-editor-page-bar-search-panel",
|
|
7450
|
+
inline: true,
|
|
7451
|
+
config: unref(formConfig),
|
|
7452
|
+
"init-values": query.value,
|
|
7453
|
+
"prevent-submit-default": true,
|
|
7454
|
+
onChange: onFormChange
|
|
7455
|
+
}, null, 8, ["config", "init-values"])) : createCommentVNode("", true)
|
|
7456
|
+
])) : createCommentVNode("", true)
|
|
7457
|
+
]);
|
|
7460
7458
|
};
|
|
7461
7459
|
}
|
|
7462
7460
|
});
|
|
@@ -7472,63 +7470,33 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7472
7470
|
__name: "PageBar",
|
|
7473
7471
|
props: {
|
|
7474
7472
|
disabledPageFragment: { type: Boolean },
|
|
7475
|
-
pageBarSortOptions: {}
|
|
7473
|
+
pageBarSortOptions: {},
|
|
7474
|
+
filterFunction: { type: Function, default: (page, keyword) => page.name?.includes(keyword) || `${page.id}`.includes(keyword) }
|
|
7476
7475
|
},
|
|
7477
7476
|
setup(__props) {
|
|
7478
|
-
const
|
|
7477
|
+
const props = __props;
|
|
7479
7478
|
const services = inject("services");
|
|
7480
7479
|
const editorService = services?.editorService;
|
|
7481
7480
|
const root = computed(() => editorService?.get("root"));
|
|
7482
7481
|
const page = computed(() => editorService?.get("page"));
|
|
7483
|
-
const
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
const
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
if (!page2) {
|
|
7492
|
-
if (active.value === NodeType.PAGE) {
|
|
7493
|
-
activePage.value = "";
|
|
7494
|
-
}
|
|
7495
|
-
if (active.value === NodeType.PAGE_FRAGMENT) {
|
|
7496
|
-
activePageFragment.value = "";
|
|
7497
|
-
}
|
|
7498
|
-
return;
|
|
7499
|
-
}
|
|
7500
|
-
if (isPage(page2)) {
|
|
7501
|
-
activePage.value = page2?.id;
|
|
7502
|
-
if (active.value !== NodeType.PAGE) {
|
|
7503
|
-
active.value = NodeType.PAGE;
|
|
7504
|
-
}
|
|
7505
|
-
} else if (isPageFragment(page2)) {
|
|
7506
|
-
activePageFragment.value = page2?.id;
|
|
7507
|
-
if (active.value !== NodeType.PAGE_FRAGMENT) {
|
|
7508
|
-
active.value = NodeType.PAGE_FRAGMENT;
|
|
7509
|
-
}
|
|
7510
|
-
}
|
|
7511
|
-
},
|
|
7512
|
-
{
|
|
7513
|
-
immediate: true
|
|
7514
|
-
}
|
|
7515
|
-
);
|
|
7516
|
-
watch(active, (active2) => {
|
|
7517
|
-
if (active2 === NodeType.PAGE) {
|
|
7518
|
-
if (!activePage.value && !pageList.value.length) {
|
|
7519
|
-
editorService?.selectRoot();
|
|
7520
|
-
return;
|
|
7521
|
-
}
|
|
7522
|
-
switchPage(activePage.value);
|
|
7523
|
-
return;
|
|
7482
|
+
const query = ref({
|
|
7483
|
+
pageType: [NodeType.PAGE, NodeType.PAGE_FRAGMENT],
|
|
7484
|
+
keyword: ""
|
|
7485
|
+
});
|
|
7486
|
+
const list = computed(() => {
|
|
7487
|
+
const { pageType, keyword } = query.value;
|
|
7488
|
+
if (pageType.length === 0) {
|
|
7489
|
+
return [];
|
|
7524
7490
|
}
|
|
7525
|
-
|
|
7526
|
-
if (
|
|
7527
|
-
|
|
7528
|
-
|
|
7491
|
+
return (root.value?.items || []).filter((item) => {
|
|
7492
|
+
if (pageType.includes(item.type)) {
|
|
7493
|
+
if (keyword) {
|
|
7494
|
+
return props.filterFunction(item, keyword);
|
|
7495
|
+
}
|
|
7496
|
+
return true;
|
|
7529
7497
|
}
|
|
7530
|
-
|
|
7531
|
-
}
|
|
7498
|
+
return false;
|
|
7499
|
+
});
|
|
7532
7500
|
});
|
|
7533
7501
|
const switchPage = (id) => {
|
|
7534
7502
|
editorService?.select(id);
|
|
@@ -7545,17 +7513,18 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7545
7513
|
};
|
|
7546
7514
|
return (_ctx, _cache) => {
|
|
7547
7515
|
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
7548
|
-
!_ctx.disabledPageFragment ? (openBlock(), createBlock(_sfc_main$u, {
|
|
7549
|
-
key: 0,
|
|
7550
|
-
modelValue: active.value,
|
|
7551
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => active.value = $event)
|
|
7552
|
-
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
|
|
7553
7516
|
createVNode(_sfc_main$w, {
|
|
7554
|
-
|
|
7555
|
-
|
|
7517
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
7518
|
+
length: list.value.length
|
|
7556
7519
|
}, {
|
|
7557
7520
|
prepend: withCtx(() => [
|
|
7558
|
-
|
|
7521
|
+
renderSlot(_ctx.$slots, "page-bar-add-button", {}, () => [
|
|
7522
|
+
createVNode(_sfc_main$x)
|
|
7523
|
+
]),
|
|
7524
|
+
createVNode(_sfc_main$u, {
|
|
7525
|
+
query: query.value,
|
|
7526
|
+
"onUpdate:query": _cache[0] || (_cache[0] = ($event) => query.value = $event)
|
|
7527
|
+
}, null, 8, ["query"]),
|
|
7559
7528
|
createVNode(_sfc_main$v, { list: list.value }, {
|
|
7560
7529
|
"page-list-popover": withCtx(({ list: list2 }) => [
|
|
7561
7530
|
renderSlot(_ctx.$slots, "page-list-popover", { list: list2 })
|
|
@@ -7621,7 +7590,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7621
7590
|
}), 128))
|
|
7622
7591
|
]),
|
|
7623
7592
|
_: 3
|
|
7624
|
-
}, 8, ["
|
|
7593
|
+
}, 8, ["page-bar-sort-options", "length"])
|
|
7625
7594
|
]);
|
|
7626
7595
|
};
|
|
7627
7596
|
}
|
|
@@ -7689,7 +7658,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7689
7658
|
__name: "Framework",
|
|
7690
7659
|
props: {
|
|
7691
7660
|
disabledPageFragment: { type: Boolean },
|
|
7692
|
-
pageBarSortOptions: {}
|
|
7661
|
+
pageBarSortOptions: {},
|
|
7662
|
+
pageFilterFunction: { type: Function }
|
|
7693
7663
|
},
|
|
7694
7664
|
setup(__props) {
|
|
7695
7665
|
const codeOptions = inject("codeOptions", {});
|
|
@@ -7796,8 +7766,12 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7796
7766
|
renderSlot(_ctx.$slots, "page-bar", {}, () => [
|
|
7797
7767
|
createVNode(_sfc_main$t, {
|
|
7798
7768
|
"disabled-page-fragment": _ctx.disabledPageFragment,
|
|
7799
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
7769
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
7770
|
+
"filter-function": _ctx.pageFilterFunction
|
|
7800
7771
|
}, {
|
|
7772
|
+
"page-bar-add-button": withCtx(() => [
|
|
7773
|
+
renderSlot(_ctx.$slots, "page-bar-add-button")
|
|
7774
|
+
]),
|
|
7801
7775
|
"page-bar-title": withCtx(({ page: page2 }) => [
|
|
7802
7776
|
renderSlot(_ctx.$slots, "page-bar-title", { page: page2 })
|
|
7803
7777
|
]),
|
|
@@ -7808,7 +7782,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
7808
7782
|
renderSlot(_ctx.$slots, "page-list-popover", { list })
|
|
7809
7783
|
]),
|
|
7810
7784
|
_: 3
|
|
7811
|
-
}, 8, ["disabled-page-fragment", "page-bar-sort-options"])
|
|
7785
|
+
}, 8, ["disabled-page-fragment", "page-bar-sort-options", "filter-function"])
|
|
7812
7786
|
])
|
|
7813
7787
|
]),
|
|
7814
7788
|
_: 2
|
|
@@ -11003,9 +10977,17 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
11003
10977
|
if (!stage || !zoom2) return;
|
|
11004
10978
|
stage.setZoom(zoom2);
|
|
11005
10979
|
});
|
|
10980
|
+
let timeoutId = null;
|
|
11006
10981
|
watch(page, (page2) => {
|
|
11007
10982
|
if (runtime && page2) {
|
|
11008
10983
|
services?.editorService.set("stageLoading", true);
|
|
10984
|
+
if (timeoutId) {
|
|
10985
|
+
globalThis.clearTimeout(timeoutId);
|
|
10986
|
+
}
|
|
10987
|
+
timeoutId = globalThis.setTimeout(() => {
|
|
10988
|
+
services?.editorService.set("stageLoading", false);
|
|
10989
|
+
timeoutId = null;
|
|
10990
|
+
}, 3e3);
|
|
11009
10991
|
runtime.updatePageId?.(page2.id);
|
|
11010
10992
|
nextTick(() => {
|
|
11011
10993
|
stage?.select(page2.id);
|
|
@@ -11674,7 +11656,9 @@ class Dep extends BaseService {
|
|
|
11674
11656
|
this.emit("collected", nodes, deep);
|
|
11675
11657
|
}
|
|
11676
11658
|
collectIdle(nodes, depExtendedData = {}, deep = false, type) {
|
|
11659
|
+
let startTask = false;
|
|
11677
11660
|
this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
|
|
11661
|
+
startTask = true;
|
|
11678
11662
|
idleTask.enqueueTask(
|
|
11679
11663
|
({ node: node2, deep: deep2, target: target2 }) => {
|
|
11680
11664
|
this.collectNode(node2, target2, depExtendedData, deep2);
|
|
@@ -11686,8 +11670,16 @@ class Dep extends BaseService {
|
|
|
11686
11670
|
}
|
|
11687
11671
|
);
|
|
11688
11672
|
});
|
|
11689
|
-
|
|
11690
|
-
|
|
11673
|
+
return new Promise((resolve) => {
|
|
11674
|
+
if (!startTask) {
|
|
11675
|
+
this.emit("collected", nodes, deep);
|
|
11676
|
+
resolve();
|
|
11677
|
+
return;
|
|
11678
|
+
}
|
|
11679
|
+
idleTask.once("finish", () => {
|
|
11680
|
+
this.emit("collected", nodes, deep);
|
|
11681
|
+
resolve();
|
|
11682
|
+
});
|
|
11691
11683
|
});
|
|
11692
11684
|
}
|
|
11693
11685
|
collectNode(node, target, depExtendedData = {}, deep = false) {
|
|
@@ -12324,49 +12316,19 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12324
12316
|
const stage = editorService.get("stage");
|
|
12325
12317
|
return stage?.renderer?.runtime?.getApp?.();
|
|
12326
12318
|
};
|
|
12327
|
-
const updateDataSourceSchema = () => {
|
|
12328
|
-
const root = editorService.get("root");
|
|
12329
|
-
if (root?.dataSources) {
|
|
12330
|
-
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
12331
|
-
}
|
|
12332
|
-
};
|
|
12333
|
-
const targetAddHandler = (target) => {
|
|
12334
|
-
const root = editorService.get("root");
|
|
12335
|
-
if (!root) return;
|
|
12336
|
-
if (target.type === DepTargetType.DATA_SOURCE) {
|
|
12337
|
-
if (!root.dataSourceDeps) {
|
|
12338
|
-
root.dataSourceDeps = {};
|
|
12339
|
-
}
|
|
12340
|
-
root.dataSourceDeps[target.id] = target.deps;
|
|
12341
|
-
}
|
|
12342
|
-
if (target.type === DepTargetType.DATA_SOURCE_COND) {
|
|
12343
|
-
if (!root.dataSourceCondDeps) {
|
|
12344
|
-
root.dataSourceCondDeps = {};
|
|
12345
|
-
}
|
|
12346
|
-
root.dataSourceCondDeps[target.id] = target.deps;
|
|
12347
|
-
}
|
|
12348
|
-
};
|
|
12349
|
-
const targetRemoveHandler = (id) => {
|
|
12319
|
+
const updateDataSourceSchema = (nodes, deep) => {
|
|
12350
12320
|
const root = editorService.get("root");
|
|
12351
|
-
if (root?.dataSourceDeps) {
|
|
12352
|
-
delete root.dataSourceDeps[id];
|
|
12353
|
-
}
|
|
12354
|
-
if (root?.dataSourceCondDeps) {
|
|
12355
|
-
delete root.dataSourceCondDeps[id];
|
|
12356
|
-
}
|
|
12357
|
-
};
|
|
12358
|
-
const collectedHandler = debounce((nodes, deep) => {
|
|
12359
|
-
const root = editorService.get("root");
|
|
12360
|
-
const stage = editorService.get("stage");
|
|
12361
|
-
if (!root || !stage) return;
|
|
12362
12321
|
const app = getApp();
|
|
12363
|
-
if (
|
|
12364
|
-
if (app.dsl) {
|
|
12322
|
+
if (root && app?.dsl) {
|
|
12365
12323
|
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
12366
12324
|
app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
|
|
12367
12325
|
app.dsl.dataSources = root.dataSources;
|
|
12368
12326
|
}
|
|
12369
|
-
|
|
12327
|
+
if (root?.dataSources) {
|
|
12328
|
+
getApp()?.dataSourceManager?.updateSchema(root.dataSources);
|
|
12329
|
+
}
|
|
12330
|
+
const stage = editorService.get("stage");
|
|
12331
|
+
if (!root || !stage) return;
|
|
12370
12332
|
const allNodes = [];
|
|
12371
12333
|
if (deep) {
|
|
12372
12334
|
nodes.forEach((node) => {
|
|
@@ -12390,17 +12352,58 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12390
12352
|
});
|
|
12391
12353
|
});
|
|
12392
12354
|
});
|
|
12393
|
-
}
|
|
12355
|
+
};
|
|
12356
|
+
const afterUpdateNodes = (nodes) => {
|
|
12357
|
+
const root = editorService.get("root");
|
|
12358
|
+
if (!root) return;
|
|
12359
|
+
const stage = editorService.get("stage");
|
|
12360
|
+
const app = getApp();
|
|
12361
|
+
if (app?.dsl) {
|
|
12362
|
+
app.dsl.dataSourceDeps = root.dataSourceDeps;
|
|
12363
|
+
}
|
|
12364
|
+
for (const node of nodes) {
|
|
12365
|
+
stage?.update({
|
|
12366
|
+
config: cloneDeep(node),
|
|
12367
|
+
parentId: editorService.getParentById(node.id)?.id,
|
|
12368
|
+
root: cloneDeep(root)
|
|
12369
|
+
});
|
|
12370
|
+
}
|
|
12371
|
+
};
|
|
12372
|
+
const targetAddHandler = (target) => {
|
|
12373
|
+
const root = editorService.get("root");
|
|
12374
|
+
if (!root) return;
|
|
12375
|
+
if (target.type === DepTargetType.DATA_SOURCE) {
|
|
12376
|
+
if (!root.dataSourceDeps) {
|
|
12377
|
+
root.dataSourceDeps = {};
|
|
12378
|
+
}
|
|
12379
|
+
root.dataSourceDeps[target.id] = target.deps;
|
|
12380
|
+
}
|
|
12381
|
+
if (target.type === DepTargetType.DATA_SOURCE_COND) {
|
|
12382
|
+
if (!root.dataSourceCondDeps) {
|
|
12383
|
+
root.dataSourceCondDeps = {};
|
|
12384
|
+
}
|
|
12385
|
+
root.dataSourceCondDeps[target.id] = target.deps;
|
|
12386
|
+
}
|
|
12387
|
+
};
|
|
12388
|
+
const targetRemoveHandler = (id) => {
|
|
12389
|
+
const root = editorService.get("root");
|
|
12390
|
+
if (!root) return;
|
|
12391
|
+
if (root.dataSourceDeps) {
|
|
12392
|
+
delete root.dataSourceDeps[id];
|
|
12393
|
+
}
|
|
12394
|
+
if (root.dataSourceCondDeps) {
|
|
12395
|
+
delete root.dataSourceCondDeps[id];
|
|
12396
|
+
}
|
|
12397
|
+
};
|
|
12394
12398
|
depService.on("add-target", targetAddHandler);
|
|
12395
12399
|
depService.on("remove-target", targetRemoveHandler);
|
|
12396
|
-
depService.on("collected", collectedHandler);
|
|
12397
12400
|
const initDataSourceDepTarget = (ds) => {
|
|
12398
12401
|
depService.addTarget(createDataSourceTarget(ds, reactive({})));
|
|
12399
12402
|
depService.addTarget(createDataSourceMethodTarget(ds, reactive({})));
|
|
12400
12403
|
depService.addTarget(createDataSourceCondTarget(ds, reactive({})));
|
|
12401
12404
|
};
|
|
12402
|
-
const collectIdle = (nodes, deep) =>
|
|
12403
|
-
nodes.
|
|
12405
|
+
const collectIdle = (nodes, deep) => Promise.all(
|
|
12406
|
+
nodes.map((node) => {
|
|
12404
12407
|
let pageId;
|
|
12405
12408
|
if (isPage(node)) {
|
|
12406
12409
|
pageId = node.id;
|
|
@@ -12408,20 +12411,26 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12408
12411
|
const info = editorService.getNodeInfo(node.id);
|
|
12409
12412
|
pageId = info.page?.id;
|
|
12410
12413
|
}
|
|
12411
|
-
depService.collectIdle([node], { pageId }, deep);
|
|
12412
|
-
})
|
|
12413
|
-
|
|
12414
|
+
return depService.collectIdle([node], { pageId }, deep);
|
|
12415
|
+
})
|
|
12416
|
+
);
|
|
12414
12417
|
const nodeAddHandler = (nodes) => {
|
|
12415
|
-
collectIdle(nodes, true)
|
|
12418
|
+
collectIdle(nodes, true).then(() => {
|
|
12419
|
+
afterUpdateNodes(nodes);
|
|
12420
|
+
});
|
|
12416
12421
|
};
|
|
12417
12422
|
const nodeUpdateHandler = (nodes) => {
|
|
12418
|
-
collectIdle(nodes, true)
|
|
12423
|
+
collectIdle(nodes, true).then(() => {
|
|
12424
|
+
afterUpdateNodes(nodes);
|
|
12425
|
+
});
|
|
12419
12426
|
};
|
|
12420
12427
|
const nodeRemoveHandler = (nodes) => {
|
|
12421
12428
|
depService.clear(nodes);
|
|
12422
12429
|
};
|
|
12423
12430
|
const historyChangeHandler = (page) => {
|
|
12424
|
-
collectIdle([page], true)
|
|
12431
|
+
collectIdle([page], true).then(() => {
|
|
12432
|
+
updateDataSourceSchema([page], true);
|
|
12433
|
+
});
|
|
12425
12434
|
};
|
|
12426
12435
|
editorService.on("history-change", historyChangeHandler);
|
|
12427
12436
|
editorService.on("root-change", rootChangeHandler);
|
|
@@ -12448,7 +12457,9 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12448
12457
|
const root = editorService.get("root");
|
|
12449
12458
|
removeDataSourceTarget(config.id);
|
|
12450
12459
|
initDataSourceDepTarget(config);
|
|
12451
|
-
collectIdle(root?.items || [], true)
|
|
12460
|
+
collectIdle(root?.items || [], true).then(() => {
|
|
12461
|
+
updateDataSourceSchema(root?.items || [], true);
|
|
12462
|
+
});
|
|
12452
12463
|
};
|
|
12453
12464
|
const removeDataSourceTarget = (id) => {
|
|
12454
12465
|
depService.removeTarget(id, DepTargetType.DATA_SOURCE);
|
|
@@ -12456,8 +12467,13 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12456
12467
|
depService.removeTarget(id, DepTargetType.DATA_SOURCE_METHOD);
|
|
12457
12468
|
};
|
|
12458
12469
|
const dataSourceRemoveHandler = (id) => {
|
|
12470
|
+
const root = editorService.get("root");
|
|
12471
|
+
const nodeIds = Object.keys(root?.dataSourceDeps?.[id] || {});
|
|
12472
|
+
const nodes = getNodes(nodeIds, root?.items);
|
|
12473
|
+
collectIdle(nodes, false).then(() => {
|
|
12474
|
+
updateDataSourceSchema(nodes, false);
|
|
12475
|
+
});
|
|
12459
12476
|
removeDataSourceTarget(id);
|
|
12460
|
-
getApp()?.dataSourceManager?.removeDataSource(id);
|
|
12461
12477
|
};
|
|
12462
12478
|
dataSourceService.on("add", dataSourceAddHandler);
|
|
12463
12479
|
dataSourceService.on("update", dataSourceUpdateHandler);
|
|
@@ -12465,7 +12481,6 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
|
|
|
12465
12481
|
onBeforeUnmount(() => {
|
|
12466
12482
|
depService.off("add-target", targetAddHandler);
|
|
12467
12483
|
depService.off("remove-target", targetRemoveHandler);
|
|
12468
|
-
depService.off("collected", collectedHandler);
|
|
12469
12484
|
editorService.off("history-change", historyChangeHandler);
|
|
12470
12485
|
editorService.off("root-change", rootChangeHandler);
|
|
12471
12486
|
editorService.off("add", nodeAddHandler);
|
|
@@ -12522,7 +12537,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12522
12537
|
isContainer: { type: Function },
|
|
12523
12538
|
customContentMenu: { type: Function },
|
|
12524
12539
|
extendFormState: { type: Function },
|
|
12525
|
-
pageBarSortOptions: {}
|
|
12540
|
+
pageBarSortOptions: {},
|
|
12541
|
+
pageFilterFunction: { type: Function }
|
|
12526
12542
|
}, defaultEditorProps),
|
|
12527
12543
|
emits: ["props-panel-mounted", "update:modelValue", "props-form-error", "props-submit-error"],
|
|
12528
12544
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -12571,7 +12587,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12571
12587
|
return (_ctx, _cache) => {
|
|
12572
12588
|
return openBlock(), createBlock(_sfc_main$r, {
|
|
12573
12589
|
"disabled-page-fragment": _ctx.disabledPageFragment,
|
|
12574
|
-
"page-bar-sort-options": _ctx.pageBarSortOptions
|
|
12590
|
+
"page-bar-sort-options": _ctx.pageBarSortOptions,
|
|
12591
|
+
"page-filter-function": _ctx.pageFilterFunction
|
|
12575
12592
|
}, {
|
|
12576
12593
|
header: withCtx(() => [
|
|
12577
12594
|
renderSlot(_ctx.$slots, "header")
|
|
@@ -12684,6 +12701,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12684
12701
|
"page-bar": withCtx(() => [
|
|
12685
12702
|
renderSlot(_ctx.$slots, "page-bar")
|
|
12686
12703
|
]),
|
|
12704
|
+
"page-bar-add-button": withCtx(() => [
|
|
12705
|
+
renderSlot(_ctx.$slots, "page-bar-add-button")
|
|
12706
|
+
]),
|
|
12687
12707
|
"page-bar-title": withCtx(({ page }) => [
|
|
12688
12708
|
renderSlot(_ctx.$slots, "page-bar-title", { page })
|
|
12689
12709
|
]),
|
|
@@ -12694,7 +12714,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12694
12714
|
renderSlot(_ctx.$slots, "page-list-popover", { list })
|
|
12695
12715
|
]),
|
|
12696
12716
|
_: 3
|
|
12697
|
-
}, 8, ["disabled-page-fragment", "page-bar-sort-options"]);
|
|
12717
|
+
}, 8, ["disabled-page-fragment", "page-bar-sort-options", "page-filter-function"]);
|
|
12698
12718
|
};
|
|
12699
12719
|
}
|
|
12700
12720
|
});
|