super-page-designer 2.0.23 → 2.0.26
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/es/components/design/utils/assemblys-config.js +6 -41
- package/dist/es/components/design/utils/data-table-util.js +1 -1
- package/dist/es/components/design/utils/page-helper-util.d.ts +1 -0
- package/dist/es/components/design/utils/page-helper-util.js +8 -0
- package/dist/es/components/design/utils/page-permission-util.js +6 -0
- package/dist/es/components/design/utils/page-table-util.js +6 -4
- package/dist/es/components/design/views/assemblys/data/bar-code/barcode-attr-base.vue.js +88 -10
- package/dist/es/components/design/views/assemblys/data/bar-code/barcode-design.vue2.js +22 -9
- package/dist/es/components/design/views/assemblys/data/component/data-origin.vue.js +1 -1
- package/dist/es/components/design/views/assemblys/data/table/table-design.vue.js +1 -1
- package/dist/es/components/design/views/assemblys/data/table/tablecolumn-attr-base.vue.js +1 -1
- package/dist/es/components/design/views/assemblys/data/table/tablecolumn-attr-event.vue.js +0 -1
- package/dist/es/components/design/views/assemblys/form/common/attr-event.vue.js +1 -1
- package/dist/es/components/design/views/assemblys/form/common/attr-event.vue2.js +2 -2
- package/dist/es/components/design/views/assemblys/form/common/bar-code-rule.vue.js +411 -112
- package/dist/es/components/design/views/assemblys/form/input-text/inputtext-attr-base.vue.js +2 -1
- package/dist/es/components/design/views/assemblys/form/input-text/inputtext-design.vue2.js +21 -15
- package/dist/es/components/design/views/assemblys/object-design.vue.js +11 -8
- package/dist/es/components/design/views/assemblys/workflow/component/combination.vue.js +19 -5
- package/dist/es/components/design/views/design/page-design.vue.js +35 -10
- package/dist/es/components/design/views/design/page-event/config.vue.d.ts +12 -1
- package/dist/es/components/design/views/design/page-event/config.vue.js +3 -3
- package/dist/es/components/design/views/design/page-event/config.vue2.js +1 -325
- package/dist/es/components/design/views/design/page-event/config.vue3.js +336 -1
- package/dist/es/components/design/views/design/page-event/page-event-container.vue.d.ts +1 -8
- package/dist/es/components/design/views/design/page-event/page-event-container.vue.js +226 -569
- package/dist/es/components/design/views/design/page-event/page-event-content.vue.d.ts +11 -5
- package/dist/es/components/design/views/design/page-event/page-event-content.vue.js +1 -1
- package/dist/es/components/design/views/design/page-event/page-event-content.vue2.js +510 -366
- package/dist/es/components/design/views/design/page-event/page-event-view.vue.d.ts +8 -0
- package/dist/es/components/design/views/design/page-event/page-event-view.vue.js +48 -0
- package/dist/es/components/design/views/design/page-event/page-event-view.vue2.js +4 -0
- package/dist/es/components/design/views/design/view/assemblys-container.vue.d.ts +0 -6
- package/dist/es/components/design/views/design/view/assemblys-container.vue.js +14 -58
- package/dist/es/components/design/views/design/view/page-switch.vue.js +1 -1
- package/dist/es/components/design/views/design/view/page-switch.vue2.js +1 -0
- package/dist/es/components/design/views/design/view/view-design-display.vue.d.ts +2 -2
- package/dist/es/components/design/views/design/view/view-design-display.vue.js +35 -42
- package/dist/es/components/design/views/design/view/view-design-preview.vue.js +1 -1
- package/dist/es/stores/event-undo-redo-store.d.ts +22 -0
- package/dist/es/stores/event-undo-redo-store.js +56 -0
- package/dist/es/style.css +105 -105
- package/package.json +4 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 重新设置尺寸
|
|
3
|
+
*/
|
|
4
|
+
declare function resize(): void;
|
|
5
|
+
declare const _default: import('vue').DefineComponent<{}, {
|
|
6
|
+
resize: typeof resize;
|
|
7
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{}>>, {}, {}>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createVNode } from "vue";
|
|
2
|
+
import _sfc_main$1 from "./page-event-container.vue.js";
|
|
3
|
+
import pageEventContent from "./page-event-content.vue.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "page-event-view",
|
|
6
|
+
setup(__props, { expose: __expose }) {
|
|
7
|
+
const contentRef = ref(null);
|
|
8
|
+
function resize() {
|
|
9
|
+
if (contentRef.value && contentRef.value.resize) {
|
|
10
|
+
contentRef.value.resize();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
__expose({ resize });
|
|
14
|
+
return (_ctx, _cache) => {
|
|
15
|
+
const _component_el_aside = resolveComponent("el-aside");
|
|
16
|
+
const _component_el_main = resolveComponent("el-main");
|
|
17
|
+
const _component_el_container = resolveComponent("el-container");
|
|
18
|
+
return openBlock(), createBlock(_component_el_container, { class: "amb-container" }, {
|
|
19
|
+
default: withCtx(() => [
|
|
20
|
+
createVNode(_component_el_aside, { class: "amb-container-left" }, {
|
|
21
|
+
default: withCtx(() => [
|
|
22
|
+
createVNode(_sfc_main$1, {
|
|
23
|
+
ref: "pageEventContainerRef",
|
|
24
|
+
configure: _ctx.configure
|
|
25
|
+
}, null, 8, ["configure"])
|
|
26
|
+
]),
|
|
27
|
+
_: 1
|
|
28
|
+
}),
|
|
29
|
+
createVNode(_component_el_main, { class: "amb-container-main" }, {
|
|
30
|
+
default: withCtx(() => [
|
|
31
|
+
createVNode(pageEventContent, {
|
|
32
|
+
configure: {},
|
|
33
|
+
eventForm: {},
|
|
34
|
+
ref_key: "contentRef",
|
|
35
|
+
ref: contentRef
|
|
36
|
+
}, null, 512)
|
|
37
|
+
]),
|
|
38
|
+
_: 1
|
|
39
|
+
})
|
|
40
|
+
]),
|
|
41
|
+
_: 1
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
_sfc_main as default
|
|
48
|
+
};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
declare function changeSelectEvent(customEvent: any): void;
|
|
2
|
-
declare function doCreateEvent(eventForm: any): void;
|
|
3
|
-
declare function changeSelectStandardEvent(eventName: string, eventLabel: string): void;
|
|
4
1
|
declare const _default: import('vue').DefineComponent<{
|
|
5
2
|
designItems: ArrayConstructor;
|
|
6
3
|
selectWidget: ObjectConstructor;
|
|
7
4
|
configure: ObjectConstructor;
|
|
8
5
|
}, {
|
|
9
|
-
changeSelectEvent: typeof changeSelectEvent;
|
|
10
|
-
doCreateEvent: typeof doCreateEvent;
|
|
11
|
-
changeSelectStandardEvent: typeof changeSelectStandardEvent;
|
|
12
6
|
selAsselbyType: string;
|
|
13
7
|
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
8
|
onSelectWidget: (...args: any[]) => void;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, onMounted,
|
|
1
|
+
import { defineComponent, ref, computed, onMounted, openBlock, createElementBlock, normalizeStyle, createElementVNode, normalizeClass, withDirectives, createVNode, vShow } from "vue";
|
|
2
2
|
import _sfc_main$1 from "./assemblys-container-list.vue.js";
|
|
3
3
|
import _sfc_main$2 from "./assemblys-container-explore.vue.js";
|
|
4
4
|
import _sfc_main$3 from "./assemblys-container-template.vue.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import "@element-plus/icons-vue";
|
|
6
|
+
import "element-plus";
|
|
7
|
+
import "../../../utils/assemblys-config.js";
|
|
8
|
+
import "uuid";
|
|
9
|
+
import "../../../utils/eventBus.js";
|
|
10
|
+
import "../../../../../stores/page-store.js";
|
|
7
11
|
const _hoisted_1 = { class: "amb-assembly-header" };
|
|
8
12
|
const _hoisted_2 = { class: "amb-assembly-header-type" };
|
|
9
13
|
const _hoisted_3 = { class: "amb-design-assembly-list" };
|
|
@@ -18,14 +22,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
22
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
19
23
|
const props = __props;
|
|
20
24
|
const $emit = __emit;
|
|
21
|
-
|
|
25
|
+
props.configure;
|
|
22
26
|
let selAsselbyType = "assembly";
|
|
23
27
|
const typeAssemblyClass = ref("selected");
|
|
24
28
|
const typeExplorerClass = ref("");
|
|
25
29
|
const typeTemplateClass = ref("");
|
|
26
30
|
const typeEventClass = ref("");
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
ref(null);
|
|
32
|
+
ref(null);
|
|
29
33
|
function changeType(typeName) {
|
|
30
34
|
if (typeName == "assembly") {
|
|
31
35
|
typeAssemblyClass.value = "selected";
|
|
@@ -67,42 +71,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
});
|
|
70
|
-
watch(typeEventClass, (newValue) => {
|
|
71
|
-
$emit("onSelectEvent", newValue);
|
|
72
|
-
});
|
|
73
74
|
function onSelectWidget(selIndex, selConfigure) {
|
|
74
75
|
$emit("onSelectWidget", selIndex, selConfigure);
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
eventBus.$on("editEvent", ({ configureObj, event }) => {
|
|
78
|
-
selectPageEventTab();
|
|
79
|
-
configureObjVal.value = configureObj;
|
|
80
|
-
editEventVal.value = event;
|
|
81
|
-
refreshEventContainer();
|
|
82
|
-
});
|
|
83
|
-
function refreshEventContainer() {
|
|
84
|
-
isShowEvent.value = false;
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
isShowEvent.value = true;
|
|
87
|
-
}, 1);
|
|
88
|
-
}
|
|
89
|
-
function addEvent(eventForm, handleType) {
|
|
90
|
-
$emit("addEvent", eventForm, handleType);
|
|
91
|
-
}
|
|
92
|
-
function changeEvent(eventForm) {
|
|
93
|
-
$emit("changeEvent", eventForm);
|
|
94
|
-
}
|
|
95
|
-
const pageEventContainerRef = ref(null);
|
|
96
|
-
function changeSelectEvent(customEvent) {
|
|
97
|
-
pageEventContainerRef.value.changeSelectEvent(customEvent);
|
|
98
|
-
}
|
|
99
|
-
function doCreateEvent(eventForm) {
|
|
100
|
-
pageEventContainerRef.value.doCreateEvent(eventForm);
|
|
101
|
-
}
|
|
102
|
-
function changeSelectStandardEvent(eventName, eventLabel) {
|
|
103
|
-
pageEventContainerRef.value.changeSelectStandardEvent(eventName, eventLabel);
|
|
104
|
-
}
|
|
105
|
-
__expose({ changeSelectEvent, doCreateEvent, changeSelectStandardEvent, selAsselbyType });
|
|
77
|
+
__expose({ selAsselbyType });
|
|
106
78
|
return (_ctx, _cache) => {
|
|
107
79
|
return openBlock(), createElementBlock("div", {
|
|
108
80
|
class: "amb-design-assembly-content",
|
|
@@ -116,17 +88,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
116
88
|
class: normalizeClass(typeAssemblyClass.value),
|
|
117
89
|
onClick: _cache[0] || (_cache[0] = ($event) => changeType("assembly"))
|
|
118
90
|
}, "组件", 2),
|
|
119
|
-
createElementVNode("label", {
|
|
120
|
-
class: normalizeClass(typeEventClass.value),
|
|
121
|
-
onClick: _cache[1] || (_cache[1] = ($event) => changeType("pageEvent"))
|
|
122
|
-
}, "事件", 2),
|
|
123
91
|
createElementVNode("label", {
|
|
124
92
|
class: normalizeClass(typeExplorerClass.value),
|
|
125
|
-
onClick: _cache[
|
|
93
|
+
onClick: _cache[1] || (_cache[1] = ($event) => changeType("explorer"))
|
|
126
94
|
}, "大纲", 2),
|
|
127
95
|
createElementVNode("label", {
|
|
128
96
|
class: normalizeClass(typeTemplateClass.value),
|
|
129
|
-
onClick: _cache[
|
|
97
|
+
onClick: _cache[2] || (_cache[2] = ($event) => changeType("template"))
|
|
130
98
|
}, "模板库", 2)
|
|
131
99
|
])
|
|
132
100
|
]),
|
|
@@ -143,19 +111,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
143
111
|
]),
|
|
144
112
|
withDirectives(createVNode(_sfc_main$3, null, null, 512), [
|
|
145
113
|
[vShow, typeTemplateClass.value]
|
|
146
|
-
])
|
|
147
|
-
isShowEvent.value ? withDirectives((openBlock(), createBlock(_sfc_main$4, {
|
|
148
|
-
key: 0,
|
|
149
|
-
ref_key: "pageEventContainerRef",
|
|
150
|
-
ref: pageEventContainerRef,
|
|
151
|
-
configure: unref(configure),
|
|
152
|
-
configureObj: configureObjVal.value,
|
|
153
|
-
editEvent: editEventVal.value,
|
|
154
|
-
onAddEvent: addEvent,
|
|
155
|
-
onChangeEvent: changeEvent
|
|
156
|
-
}, null, 8, ["configure", "configureObj", "editEvent"])), [
|
|
157
|
-
[vShow, typeEventClass.value]
|
|
158
|
-
]) : createCommentVNode("", true)
|
|
114
|
+
])
|
|
159
115
|
])
|
|
160
116
|
], 4);
|
|
161
117
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./page-switch.vue2.js";
|
|
2
2
|
import "./page-switch.vue3.js";
|
|
3
3
|
import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const PageSwitch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const PageSwitch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a34d32af"]]);
|
|
5
5
|
export {
|
|
6
6
|
PageSwitch as default
|
|
7
7
|
};
|
|
@@ -14,10 +14,10 @@ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimePr
|
|
|
14
14
|
changeEvent: typeof changeEvent;
|
|
15
15
|
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
16
16
|
onSelectWidget: (...args: any[]) => void;
|
|
17
|
-
changeSelectEvent: (...args: any[]) => void;
|
|
18
|
-
changeSelectStandardEvent: (...args: any[]) => void;
|
|
19
17
|
addEvent: (...args: any[]) => void;
|
|
20
18
|
onCustomAttrWidget: (...args: any[]) => void;
|
|
19
|
+
changeSelectEvent: (...args: any[]) => void;
|
|
20
|
+
changeSelectStandardEvent: (...args: any[]) => void;
|
|
21
21
|
revocation: (...args: any[]) => void;
|
|
22
22
|
regain: (...args: any[]) => void;
|
|
23
23
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<MyProps>>> & {
|
|
@@ -6,11 +6,24 @@ import { deepCopy, getUuidv4, findDesignItemByUuid } from "../../../utils/common
|
|
|
6
6
|
import { addComponentRef } from "../../../utils/page-helper-util.js";
|
|
7
7
|
import { caculatePageStyle } from "../../../utils/container-design-util.js";
|
|
8
8
|
import _sfc_main$2 from "./view-design-preview.vue.js";
|
|
9
|
-
import
|
|
9
|
+
import { ElMessageBox, ElMessage } from "element-plus";
|
|
10
|
+
import "@vueuse/core";
|
|
11
|
+
import "@element-plus/icons-vue";
|
|
12
|
+
import "codemirror";
|
|
13
|
+
import "@codemirror/lang-javascript";
|
|
14
|
+
import "@codemirror/state";
|
|
15
|
+
import "@codemirror/autocomplete";
|
|
16
|
+
import "@codemirror/language";
|
|
17
|
+
import "@codemirror/search";
|
|
18
|
+
import "../page-event/config.vue2.js";
|
|
19
|
+
import "../../../utils/assemblys-config.js";
|
|
20
|
+
import "../../../../../stores/page-store.js";
|
|
21
|
+
import "../../../../../stores/event-undo-redo-store.js";
|
|
22
|
+
import "../../../utils/eventBus.js";
|
|
23
|
+
import "../page-event/page-event-content.vue3.js";
|
|
10
24
|
import _sfc_main$3 from "./components/quick-add-dialog.vue.js";
|
|
11
25
|
import { setTableRuntimesFromConfigure } from "../../../utils/page-table-util.js";
|
|
12
26
|
import http from "agilebuilder-ui/src/utils/request";
|
|
13
|
-
import { ElMessageBox, ElMessage } from "element-plus";
|
|
14
27
|
const _hoisted_1 = { class: "amb-design-tool" };
|
|
15
28
|
const _hoisted_2 = { style: { "float": "right", "margin-right": "10px" } };
|
|
16
29
|
const _hoisted_3 = /* @__PURE__ */ createElementVNode("label", null, "快捷添加", -1);
|
|
@@ -121,26 +134,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
121
134
|
}
|
|
122
135
|
function deleteItem(sourceItem) {
|
|
123
136
|
if (sourceItem.items && sourceItem.items.length > 0) {
|
|
124
|
-
ElMessageBox.confirm(
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
type: "warning"
|
|
131
|
-
}
|
|
132
|
-
).then(() => {
|
|
133
|
-
const index = pageItems.indexOf(sourceItem);
|
|
134
|
-
if (index > -1) {
|
|
135
|
-
pageItems.splice(index, 1);
|
|
136
|
-
}
|
|
137
|
+
ElMessageBox.confirm("还有子元素,确定要删除吗?", "删除", {
|
|
138
|
+
confirmButtonText: "确认",
|
|
139
|
+
cancelButtonText: "取消",
|
|
140
|
+
type: "warning"
|
|
141
|
+
}).then(() => {
|
|
142
|
+
_deleteItem(sourceItem);
|
|
137
143
|
}).catch((err) => {
|
|
138
144
|
console.log(err);
|
|
139
145
|
});
|
|
146
|
+
} else {
|
|
147
|
+
_deleteItem(sourceItem);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function _deleteItem(sourceItem) {
|
|
151
|
+
const index = pageItems.indexOf(sourceItem);
|
|
152
|
+
if (index > -1) {
|
|
153
|
+
pageItems.splice(index, 1);
|
|
140
154
|
}
|
|
141
155
|
}
|
|
142
156
|
const pageDesignBoardMain = ref(null);
|
|
143
157
|
useDraggable(pageDesignBoardMain, pageItems, {
|
|
158
|
+
filter: ".el-scrollbar__bar",
|
|
159
|
+
// 拖动表格滚动条时,不拖拽表格需要的配置
|
|
160
|
+
preventOnFilter: false,
|
|
161
|
+
// 拖动表格滚动条时,不拖拽表格需要的配置
|
|
144
162
|
group: "amb-assembly-item",
|
|
145
163
|
animation: 300,
|
|
146
164
|
ghostClass: "amb-item-ghost",
|
|
@@ -159,7 +177,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
159
177
|
}
|
|
160
178
|
});
|
|
161
179
|
}
|
|
162
|
-
http.post("/component/super-page-design/save", { id: props.configure.id, designJson: JSON.stringify(configureCopy) }).then((res) => {
|
|
180
|
+
http.post(window["$vueApp"].config.globalProperties.baseAPI + "/component/super-page-design/save", { id: props.configure.id, designJson: JSON.stringify(configureCopy) }).then((res) => {
|
|
163
181
|
console.log(res);
|
|
164
182
|
ElMessage({
|
|
165
183
|
message: "保存成功",
|
|
@@ -247,15 +265,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
247
265
|
}
|
|
248
266
|
}
|
|
249
267
|
}
|
|
250
|
-
function changeSelectEvent(customEvent) {
|
|
251
|
-
$emits("changeSelectEvent", customEvent);
|
|
252
|
-
}
|
|
253
|
-
function addEventClick(eventForm) {
|
|
254
|
-
$emits("addEvent", eventForm);
|
|
255
|
-
}
|
|
256
|
-
function changeSelectStandardEvent(eventName, eventLabel) {
|
|
257
|
-
$emits("changeSelectStandardEvent", eventName, eventLabel);
|
|
258
|
-
}
|
|
259
268
|
__expose({ onSelectEvent, addEvent, changeEvent });
|
|
260
269
|
return (_ctx, _cache) => {
|
|
261
270
|
const _component_el_icon = resolveComponent("el-icon");
|
|
@@ -402,23 +411,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
402
411
|
}), 128))
|
|
403
412
|
], 6), [
|
|
404
413
|
[vShow, _ctx.selAsselbyType === "assembly"]
|
|
405
|
-
])
|
|
406
|
-
isShowEventContent.value ? (openBlock(), createElementBlock("div", {
|
|
407
|
-
key: 0,
|
|
408
|
-
class: normalizeClass(["amb-design-board", designClass.value]),
|
|
409
|
-
style: normalizeStyle(dynamicPageSizeStyle.value)
|
|
410
|
-
}, [
|
|
411
|
-
createVNode(pageEventContent, {
|
|
412
|
-
ref: "pageEventContentRef",
|
|
413
|
-
configure: _ctx.configure,
|
|
414
|
-
handleType: handleTypeVal.value,
|
|
415
|
-
eventForm: eventFormContent.value,
|
|
416
|
-
customEvent: customEventContent.value,
|
|
417
|
-
onChangeSelectEvent: changeSelectEvent,
|
|
418
|
-
onAddEvent: addEventClick,
|
|
419
|
-
onChangeSelectStandardEvent: changeSelectStandardEvent
|
|
420
|
-
}, null, 8, ["configure", "handleType", "eventForm", "customEvent"])
|
|
421
|
-
], 6)) : createCommentVNode("", true)
|
|
414
|
+
])
|
|
422
415
|
], 4),
|
|
423
416
|
previewVisible.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
424
417
|
key: 0,
|
|
@@ -18,7 +18,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
18
|
const _component_el_dialog = resolveComponent("el-dialog");
|
|
19
19
|
return openBlock(), createBlock(_component_el_dialog, {
|
|
20
20
|
fullscreen: "",
|
|
21
|
-
"close-on-press-escape":
|
|
21
|
+
"close-on-press-escape": false,
|
|
22
22
|
title: title.value,
|
|
23
23
|
onClose: _cache[0] || (_cache[0] = ($event) => emits("close"))
|
|
24
24
|
}, {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const undoRedo: import('pinia').StoreDefinition<"event-snapshot", import('pinia')._UnwrapAll<Pick<{
|
|
2
|
+
addSnapshot: (configure: any, callback: any) => void;
|
|
3
|
+
undo: (configure: any) => void;
|
|
4
|
+
record: (configure: any) => void;
|
|
5
|
+
clearSnapshot: () => void;
|
|
6
|
+
getCurrentIndex: () => number;
|
|
7
|
+
getTotalLen: () => number;
|
|
8
|
+
}, never>>, Pick<{
|
|
9
|
+
addSnapshot: (configure: any, callback: any) => void;
|
|
10
|
+
undo: (configure: any) => void;
|
|
11
|
+
record: (configure: any) => void;
|
|
12
|
+
clearSnapshot: () => void;
|
|
13
|
+
getCurrentIndex: () => number;
|
|
14
|
+
getTotalLen: () => number;
|
|
15
|
+
}, never>, Pick<{
|
|
16
|
+
addSnapshot: (configure: any, callback: any) => void;
|
|
17
|
+
undo: (configure: any) => void;
|
|
18
|
+
record: (configure: any) => void;
|
|
19
|
+
clearSnapshot: () => void;
|
|
20
|
+
getCurrentIndex: () => number;
|
|
21
|
+
getTotalLen: () => number;
|
|
22
|
+
}, "addSnapshot" | "undo" | "record" | "clearSnapshot" | "getCurrentIndex" | "getTotalLen">>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
const undoRedo = defineStore("event-snapshot", () => {
|
|
4
|
+
const snapshotData = ref([]);
|
|
5
|
+
const maxStep = ref(30);
|
|
6
|
+
const curIndex = ref(-1);
|
|
7
|
+
const isSnapshot = ref(true);
|
|
8
|
+
let timeoutObj = null;
|
|
9
|
+
function getCurrentIndex() {
|
|
10
|
+
return curIndex.value;
|
|
11
|
+
}
|
|
12
|
+
function getTotalLen() {
|
|
13
|
+
return snapshotData.value ? snapshotData.value.length : 0;
|
|
14
|
+
}
|
|
15
|
+
function clearSnapshot() {
|
|
16
|
+
snapshotData.value = [];
|
|
17
|
+
curIndex.value = -1;
|
|
18
|
+
isSnapshot.value = true;
|
|
19
|
+
}
|
|
20
|
+
function addSnapshot(configure, callback) {
|
|
21
|
+
if (timeoutObj) {
|
|
22
|
+
clearTimeout(timeoutObj);
|
|
23
|
+
}
|
|
24
|
+
timeoutObj = setTimeout(function() {
|
|
25
|
+
snapshotData.value.push(JSON.stringify(configure.value));
|
|
26
|
+
curIndex.value++;
|
|
27
|
+
if (snapshotData.value.length > maxStep.value) {
|
|
28
|
+
snapshotData.value.splice(0, 1);
|
|
29
|
+
curIndex.value--;
|
|
30
|
+
}
|
|
31
|
+
if (callback) {
|
|
32
|
+
callback();
|
|
33
|
+
}
|
|
34
|
+
}, 400);
|
|
35
|
+
}
|
|
36
|
+
function undo(configure) {
|
|
37
|
+
isSnapshot.value = false;
|
|
38
|
+
if (curIndex.value > 0) {
|
|
39
|
+
let t = JSON.parse(snapshotData.value[curIndex.value - 1]);
|
|
40
|
+
configure.value = t;
|
|
41
|
+
curIndex.value--;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function record(configure) {
|
|
45
|
+
if (curIndex.value > -1 && curIndex.value + 1 < snapshotData.value.length) {
|
|
46
|
+
const valueStr = snapshotData.value[curIndex.value + 1];
|
|
47
|
+
let t = JSON.parse(valueStr);
|
|
48
|
+
configure.value = t;
|
|
49
|
+
curIndex.value++;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { addSnapshot, undo, record, clearSnapshot, getCurrentIndex, getTotalLen };
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
undoRedo
|
|
56
|
+
};
|