@g1cloud/page-builder-editor 1.0.0-alpha.15 → 1.0.0-alpha.16
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/{PbPropertyEditorColor-DI5Bm25g.js → PbPropertyEditorColor-Bw7qz0-r.js} +1 -1
- package/dist/{PbPropertyEditorHtml-Bb_kuc4m.js → PbPropertyEditorHtml-DH2Qep1X.js} +1 -1
- package/dist/{PbPropertyEditorImage-DbxF_eg7.js → PbPropertyEditorImage-GN536Jw2.js} +7 -7
- package/dist/{PbPropertyEditorMultilineText-CefJbbiM.js → PbPropertyEditorMultilineText-B5HryveI.js} +1 -1
- package/dist/{PbWidgetAddModal-CQvFYzfU.js → PbWidgetAddModal-Zpo-ZeNH.js} +32 -8
- package/dist/{index-BIoyBfxM.js → index-BcD7YsdY.js} +126 -75
- package/dist/model/command.d.ts +17 -1
- package/dist/model/page-builder-editor.d.ts +9 -0
- package/dist/model/part-definintion.d.ts +2 -0
- package/dist/model/part-manager.d.ts +0 -1
- package/dist/page-builder-editor.js +2 -2
- package/dist/page-builder-editor.umd.cjs +203 -130
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
|
|
2
2
|
import { BSTextInput } from "@g1cloud/bluesea";
|
|
3
|
-
import { P as PbColorPicker } from "./index-
|
|
3
|
+
import { P as PbColorPicker } from "./index-BcD7YsdY.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-color" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _hoisted_3 = ["textContent"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, defineAsyncComponent } from "vue";
|
|
2
2
|
import { useModal } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-BcD7YsdY.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _hoisted_3 = ["textContent"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
|
|
2
|
+
import { u as usePageBuilderEditor } from "./index-BcD7YsdY.js";
|
|
2
3
|
import { useModal } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor, a as PageBuilderEditorEvent } from "./index-BIoyBfxM.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _hoisted_3 = ["textContent"];
|
|
@@ -12,16 +12,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
12
|
},
|
|
13
13
|
emits: ["update-property-value"],
|
|
14
14
|
setup(__props, { emit: __emit }) {
|
|
15
|
-
useModal();
|
|
16
15
|
const pageBuilder = usePageBuilderEditor();
|
|
16
|
+
const modal = useModal();
|
|
17
17
|
const emit = __emit;
|
|
18
18
|
const selectImage = () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const imageProvider = pageBuilder.getProvider("image");
|
|
20
|
+
if (imageProvider) {
|
|
21
|
+
imageProvider({ modal }, (url) => {
|
|
22
22
|
emit("update-property-value", { image: url });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
25
|
};
|
|
26
26
|
return (_ctx, _cache) => {
|
|
27
27
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
package/dist/{PbPropertyEditorMultilineText-CefJbbiM.js → PbPropertyEditorMultilineText-B5HryveI.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createBlock, unref } from "vue";
|
|
2
2
|
import { BSMultiLangTextArea, BSTextArea } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-BcD7YsdY.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _hoisted_3 = ["textContent"];
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString } from "vue";
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString } from "vue";
|
|
2
2
|
import { useModalHandle, BSModalFrame } from "@g1cloud/bluesea";
|
|
3
|
+
import { w as widgetPartDefinitions } from "./index-BcD7YsdY.js";
|
|
3
4
|
const _hoisted_1 = { class: "bs-layout-vertical pb-part-add-modal" };
|
|
4
|
-
const _hoisted_2 =
|
|
5
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", {
|
|
6
|
+
class: "mb-8",
|
|
7
|
+
textContent: "Basic Widgets"
|
|
8
|
+
}, null, -1);
|
|
5
9
|
const _hoisted_3 = { class: "bs-layout-horizontal-wrap ml-16 mb-8 gap-8" };
|
|
6
10
|
const _hoisted_4 = ["onClick", "textContent"];
|
|
11
|
+
const _hoisted_5 = { class: "group mb-16" };
|
|
12
|
+
const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", {
|
|
13
|
+
class: "mb-8",
|
|
14
|
+
textContent: "Custom Widgets"
|
|
15
|
+
}, null, -1);
|
|
16
|
+
const _hoisted_7 = { class: "bs-layout-horizontal-wrap ml-16 mb-8 gap-8" };
|
|
17
|
+
const _hoisted_8 = ["onClick", "textContent"];
|
|
7
18
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
19
|
__name: "PbWidgetAddModal",
|
|
9
20
|
props: {
|
|
@@ -12,9 +23,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
23
|
},
|
|
13
24
|
emits: ["selectHandler"],
|
|
14
25
|
setup(__props, { emit: __emit }) {
|
|
26
|
+
const props = __props;
|
|
15
27
|
const emit = __emit;
|
|
16
28
|
const modalHandle = useModalHandle();
|
|
29
|
+
const customWidgets = computed(() => props.pageBuilder.getCustomWidgets());
|
|
17
30
|
const select = (partDefinition) => {
|
|
31
|
+
console.log(partDefinition);
|
|
18
32
|
emit("selectHandler", partDefinition);
|
|
19
33
|
modalHandle.close();
|
|
20
34
|
};
|
|
@@ -22,15 +36,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
36
|
return openBlock(), createBlock(unref(BSModalFrame), { title: "Add Block/Widget" }, {
|
|
23
37
|
default: withCtx(() => [
|
|
24
38
|
createElementVNode("div", _hoisted_1, [
|
|
25
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
39
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(widgetPartDefinitions), (group) => {
|
|
26
40
|
return openBlock(), createElementBlock("div", {
|
|
27
41
|
key: group.groupName,
|
|
28
42
|
class: "group mb-16"
|
|
29
43
|
}, [
|
|
30
|
-
|
|
31
|
-
class: "mb-8",
|
|
32
|
-
textContent: toDisplayString(group.caption)
|
|
33
|
-
}, null, 8, _hoisted_2),
|
|
44
|
+
_hoisted_2,
|
|
34
45
|
createElementVNode("div", _hoisted_3, [
|
|
35
46
|
(openBlock(true), createElementBlock(Fragment, null, renderList(group.partDefinitions, (part) => {
|
|
36
47
|
return openBlock(), createElementBlock("div", {
|
|
@@ -42,7 +53,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
42
53
|
}), 128))
|
|
43
54
|
])
|
|
44
55
|
]);
|
|
45
|
-
}), 128))
|
|
56
|
+
}), 128)),
|
|
57
|
+
createElementVNode("div", _hoisted_5, [
|
|
58
|
+
_hoisted_6,
|
|
59
|
+
createElementVNode("div", _hoisted_7, [
|
|
60
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(customWidgets.value, (part) => {
|
|
61
|
+
return openBlock(), createElementBlock("div", {
|
|
62
|
+
key: part.partName,
|
|
63
|
+
class: "part",
|
|
64
|
+
onClick: ($event) => select(part),
|
|
65
|
+
textContent: toDisplayString(part.caption)
|
|
66
|
+
}, null, 8, _hoisted_8);
|
|
67
|
+
}), 128))
|
|
68
|
+
])
|
|
69
|
+
])
|
|
46
70
|
])
|
|
47
71
|
]),
|
|
48
72
|
_: 1
|
|
@@ -7223,15 +7223,25 @@ class PageBuilderViewerImpl {
|
|
|
7223
7223
|
registerCustomPlugin(plugin) {
|
|
7224
7224
|
if (plugin.widgets) {
|
|
7225
7225
|
plugin.widgets.forEach((v) => {
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
component: v.component
|
|
7231
|
-
};
|
|
7226
|
+
const w = { ...v };
|
|
7227
|
+
w.partType = "Widget";
|
|
7228
|
+
w.creator = () => _sfc_main$q;
|
|
7229
|
+
partDefinitions$1[v.partName] = w;
|
|
7232
7230
|
});
|
|
7233
7231
|
}
|
|
7234
7232
|
}
|
|
7233
|
+
watchCustomWidgetData(part) {
|
|
7234
|
+
const def = partDefinitions$1[part.partName];
|
|
7235
|
+
if (!def || !def.dataWatcher)
|
|
7236
|
+
return false;
|
|
7237
|
+
return def.dataWatcher(part.properties);
|
|
7238
|
+
}
|
|
7239
|
+
provideCustomWidgetData(part) {
|
|
7240
|
+
const def = partDefinitions$1[part.partName];
|
|
7241
|
+
if (!def || !def.dataProvider)
|
|
7242
|
+
return Promise.resolve();
|
|
7243
|
+
return def.dataProvider(part.properties);
|
|
7244
|
+
}
|
|
7235
7245
|
render(pageContent) {
|
|
7236
7246
|
const rootPart = new RootPart();
|
|
7237
7247
|
rootPart.pageBuilderId = this.instanceId;
|
|
@@ -7394,17 +7404,28 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7394
7404
|
__name: "PbCustomWidget",
|
|
7395
7405
|
props: {
|
|
7396
7406
|
part: {},
|
|
7397
|
-
|
|
7407
|
+
dataWatcher: { type: Function },
|
|
7408
|
+
dataProvider: { type: Function }
|
|
7398
7409
|
},
|
|
7399
7410
|
setup(__props) {
|
|
7400
7411
|
const props = __props;
|
|
7401
7412
|
const pageBuilder = usePageBuilder();
|
|
7402
7413
|
const comp = computed(() => pageBuilder.getCustomWidgetComponent(props.part));
|
|
7414
|
+
const data = ref({});
|
|
7403
7415
|
const bind = computed(() => ({
|
|
7404
7416
|
pageBuilderId: pageBuilder.instanceId,
|
|
7405
|
-
|
|
7406
|
-
placeholder: true
|
|
7417
|
+
...props.part.properties || {},
|
|
7418
|
+
placeholder: true,
|
|
7419
|
+
...data.value || {}
|
|
7407
7420
|
}));
|
|
7421
|
+
const updateData = async () => {
|
|
7422
|
+
data.value = await pageBuilder.provideCustomWidgetData(props.part);
|
|
7423
|
+
};
|
|
7424
|
+
onMounted(updateData);
|
|
7425
|
+
watch(
|
|
7426
|
+
() => pageBuilder.watchCustomWidgetData(props.part),
|
|
7427
|
+
() => updateData()
|
|
7428
|
+
);
|
|
7408
7429
|
return (_ctx, _cache) => {
|
|
7409
7430
|
return comp.value ? (openBlock(), createBlock$1(resolveDynamicComponent(comp.value), normalizeProps(mergeProps({ key: 0 }, bind.value)), null, 16)) : createCommentVNode("", true);
|
|
7410
7431
|
};
|
|
@@ -7936,20 +7957,6 @@ class PartManager {
|
|
|
7936
7957
|
}
|
|
7937
7958
|
}
|
|
7938
7959
|
}
|
|
7939
|
-
getLocalDesignPartPropertyDefinitions(partName) {
|
|
7940
|
-
let properties;
|
|
7941
|
-
const partDef = this.getPartDefinition(partName);
|
|
7942
|
-
if (!partDef || !partDef.propertyGroups)
|
|
7943
|
-
return;
|
|
7944
|
-
for (const group of partDef.propertyGroups) {
|
|
7945
|
-
for (const property of group.properties) {
|
|
7946
|
-
if (property.localized) {
|
|
7947
|
-
properties = [...properties || [], property];
|
|
7948
|
-
}
|
|
7949
|
-
}
|
|
7950
|
-
}
|
|
7951
|
-
return properties;
|
|
7952
|
-
}
|
|
7953
7960
|
createPartComponent(part) {
|
|
7954
7961
|
if (part) {
|
|
7955
7962
|
const def = this.getPartDefinition(part.partName);
|
|
@@ -8029,11 +8036,11 @@ const defaultPartPropertyEditors = () => {
|
|
|
8029
8036
|
return {
|
|
8030
8037
|
"readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-Dgp_AVOD.js")),
|
|
8031
8038
|
"text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-BWOKvwD9.js")),
|
|
8032
|
-
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-
|
|
8039
|
+
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-B5HryveI.js")),
|
|
8033
8040
|
"select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-CWedbXJI.js")),
|
|
8034
|
-
"color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-
|
|
8035
|
-
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-
|
|
8036
|
-
"html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-
|
|
8041
|
+
"color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-Bw7qz0-r.js")),
|
|
8042
|
+
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-GN536Jw2.js")),
|
|
8043
|
+
"html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-DH2Qep1X.js"))
|
|
8037
8044
|
};
|
|
8038
8045
|
};
|
|
8039
8046
|
const getPropertyValueOfParts = (parts, propertyName) => {
|
|
@@ -11996,7 +12003,7 @@ const widgets = [
|
|
|
11996
12003
|
{
|
|
11997
12004
|
partType: "Widget",
|
|
11998
12005
|
partName: "TextWidget",
|
|
11999
|
-
caption: "Text
|
|
12006
|
+
caption: "Text",
|
|
12000
12007
|
icon: "insert_text",
|
|
12001
12008
|
propertyGroups: [
|
|
12002
12009
|
{
|
|
@@ -12039,7 +12046,7 @@ const widgets = [
|
|
|
12039
12046
|
{
|
|
12040
12047
|
partType: "Widget",
|
|
12041
12048
|
partName: "ImageWidget",
|
|
12042
|
-
caption: "Image
|
|
12049
|
+
caption: "Image",
|
|
12043
12050
|
icon: "imagesmode",
|
|
12044
12051
|
propertyGroups: [
|
|
12045
12052
|
{
|
|
@@ -12065,7 +12072,7 @@ const widgets = [
|
|
|
12065
12072
|
{
|
|
12066
12073
|
partType: "Widget",
|
|
12067
12074
|
partName: "HtmlWidget",
|
|
12068
|
-
caption: "HTML
|
|
12075
|
+
caption: "HTML",
|
|
12069
12076
|
icon: "code",
|
|
12070
12077
|
propertyGroups: [
|
|
12071
12078
|
{
|
|
@@ -12120,6 +12127,13 @@ const designPartDefinitions = [
|
|
|
12120
12127
|
]
|
|
12121
12128
|
}
|
|
12122
12129
|
];
|
|
12130
|
+
const widgetPartDefinitions = [
|
|
12131
|
+
{
|
|
12132
|
+
groupName: "Widget",
|
|
12133
|
+
caption: "Widget",
|
|
12134
|
+
partDefinitions: widgets
|
|
12135
|
+
}
|
|
12136
|
+
];
|
|
12123
12137
|
const blockWidgetPartDefinitions = [
|
|
12124
12138
|
{
|
|
12125
12139
|
groupName: "Block",
|
|
@@ -12209,7 +12223,7 @@ const openPartAddModal = (modal, args, callback) => {
|
|
|
12209
12223
|
};
|
|
12210
12224
|
const openWidgetAddModal = (modal, args, callback) => {
|
|
12211
12225
|
modal.openModal({
|
|
12212
|
-
component: defineAsyncComponent(() => import("./PbWidgetAddModal-
|
|
12226
|
+
component: defineAsyncComponent(() => import("./PbWidgetAddModal-Zpo-ZeNH.js")),
|
|
12213
12227
|
style: {
|
|
12214
12228
|
width: "80%",
|
|
12215
12229
|
height: "80%",
|
|
@@ -12313,6 +12327,36 @@ const _AddPartCommand = class _AddPartCommand {
|
|
|
12313
12327
|
};
|
|
12314
12328
|
__publicField(_AddPartCommand, "COMMAND_ID", "AddPart");
|
|
12315
12329
|
let AddPartCommand = _AddPartCommand;
|
|
12330
|
+
const _AddSectionCommand = class _AddSectionCommand {
|
|
12331
|
+
constructor(modal) {
|
|
12332
|
+
__publicField(this, "commandId", _AddSectionCommand.COMMAND_ID);
|
|
12333
|
+
__publicField(this, "caption", "Add Section");
|
|
12334
|
+
this.modal = modal;
|
|
12335
|
+
}
|
|
12336
|
+
execute(pageBuilder, args) {
|
|
12337
|
+
const def = pageBuilder.partManager.getSectionDefinition();
|
|
12338
|
+
if (!def)
|
|
12339
|
+
return;
|
|
12340
|
+
addPart(pageBuilder, def);
|
|
12341
|
+
}
|
|
12342
|
+
};
|
|
12343
|
+
__publicField(_AddSectionCommand, "COMMAND_ID", "AddSection");
|
|
12344
|
+
let AddSectionCommand = _AddSectionCommand;
|
|
12345
|
+
const _AddBlockCommand = class _AddBlockCommand {
|
|
12346
|
+
constructor(modal) {
|
|
12347
|
+
__publicField(this, "commandId", _AddBlockCommand.COMMAND_ID);
|
|
12348
|
+
__publicField(this, "caption", "Add Block");
|
|
12349
|
+
this.modal = modal;
|
|
12350
|
+
}
|
|
12351
|
+
execute(pageBuilder, args) {
|
|
12352
|
+
const def = pageBuilder.partManager.getBlockDefinition();
|
|
12353
|
+
if (!def)
|
|
12354
|
+
return;
|
|
12355
|
+
addPart(pageBuilder, def);
|
|
12356
|
+
}
|
|
12357
|
+
};
|
|
12358
|
+
__publicField(_AddBlockCommand, "COMMAND_ID", "AddBlock");
|
|
12359
|
+
let AddBlockCommand = _AddBlockCommand;
|
|
12316
12360
|
const addPart = (pageBuilder, def, attrs) => {
|
|
12317
12361
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12318
12362
|
const selected = pageBuilder.context.getSelectedParts()[0];
|
|
@@ -12401,29 +12445,13 @@ const addPart = (pageBuilder, def, attrs) => {
|
|
|
12401
12445
|
}
|
|
12402
12446
|
};
|
|
12403
12447
|
const addSectionBefore = (pageBuilder, modal, args) => {
|
|
12404
|
-
const def = args && args.partDefinition;
|
|
12405
|
-
if (!def) {
|
|
12406
|
-
const partDefinitionGroups = designPartDefinitions;
|
|
12407
|
-
openPartAddModal(modal, {
|
|
12408
|
-
...args || {},
|
|
12409
|
-
pageBuilder,
|
|
12410
|
-
partDefinitionGroups
|
|
12411
|
-
}, (part, attrs) => {
|
|
12412
|
-
addSectionBefore(pageBuilder, modal, {
|
|
12413
|
-
...args || {},
|
|
12414
|
-
partDefinition: part,
|
|
12415
|
-
...attrs || {}
|
|
12416
|
-
});
|
|
12417
|
-
});
|
|
12418
|
-
return;
|
|
12419
|
-
}
|
|
12420
12448
|
const selected = pageBuilder.context.getSelectedParts()[0];
|
|
12421
12449
|
if (!selected)
|
|
12422
12450
|
return;
|
|
12423
12451
|
const section = pageBuilder.partManager.findNearestSection(selected);
|
|
12424
12452
|
if (!section || !section.parent || !section.parent.children)
|
|
12425
12453
|
return;
|
|
12426
|
-
const newSection =
|
|
12454
|
+
const newSection = createSection(pageBuilder);
|
|
12427
12455
|
if (!newSection)
|
|
12428
12456
|
return;
|
|
12429
12457
|
const child = createBlock(pageBuilder);
|
|
@@ -12432,29 +12460,13 @@ const addSectionBefore = (pageBuilder, modal, args) => {
|
|
|
12432
12460
|
insertParts(pageBuilder, section.parent.partId, index, [newSection], true);
|
|
12433
12461
|
};
|
|
12434
12462
|
const addSectionAfter = (pageBuilder, modal, args) => {
|
|
12435
|
-
const def = args && args.partDefinition;
|
|
12436
|
-
if (!def) {
|
|
12437
|
-
const partDefinitionGroups = designPartDefinitions;
|
|
12438
|
-
openPartAddModal(modal, {
|
|
12439
|
-
...args || {},
|
|
12440
|
-
pageBuilder,
|
|
12441
|
-
partDefinitionGroups
|
|
12442
|
-
}, (part, attrs) => {
|
|
12443
|
-
addSectionAfter(pageBuilder, modal, {
|
|
12444
|
-
...args || {},
|
|
12445
|
-
partDefinition: part,
|
|
12446
|
-
...attrs || {}
|
|
12447
|
-
});
|
|
12448
|
-
});
|
|
12449
|
-
return;
|
|
12450
|
-
}
|
|
12451
12463
|
const selected = pageBuilder.context.getSelectedParts()[0];
|
|
12452
12464
|
if (!selected)
|
|
12453
12465
|
return;
|
|
12454
12466
|
const section = pageBuilder.partManager.findNearestSection(selected);
|
|
12455
12467
|
if (!section || !section.parent || !section.parent.children)
|
|
12456
12468
|
return;
|
|
12457
|
-
const newSection =
|
|
12469
|
+
const newSection = createSection(pageBuilder);
|
|
12458
12470
|
if (!newSection)
|
|
12459
12471
|
return;
|
|
12460
12472
|
const child = createBlock(pageBuilder);
|
|
@@ -12577,7 +12589,7 @@ const _AddSectionAboveCommand = class _AddSectionAboveCommand {
|
|
|
12577
12589
|
this.modal = modal;
|
|
12578
12590
|
}
|
|
12579
12591
|
execute(pageBuilder, args) {
|
|
12580
|
-
addSectionBefore(pageBuilder, this.modal
|
|
12592
|
+
addSectionBefore(pageBuilder, this.modal);
|
|
12581
12593
|
}
|
|
12582
12594
|
};
|
|
12583
12595
|
__publicField(_AddSectionAboveCommand, "COMMAND_ID", "AddSectionAbove");
|
|
@@ -12590,7 +12602,7 @@ const _AddSectionBelowCommand = class _AddSectionBelowCommand {
|
|
|
12590
12602
|
this.modal = modal;
|
|
12591
12603
|
}
|
|
12592
12604
|
execute(pageBuilder, args) {
|
|
12593
|
-
addSectionAfter(pageBuilder, this.modal
|
|
12605
|
+
addSectionAfter(pageBuilder, this.modal);
|
|
12594
12606
|
}
|
|
12595
12607
|
};
|
|
12596
12608
|
__publicField(_AddSectionBelowCommand, "COMMAND_ID", "AddSectionBelow");
|
|
@@ -12802,6 +12814,8 @@ const createDefaultCommands = (modal) => {
|
|
|
12802
12814
|
new OpenAddPartModalCommand(modal),
|
|
12803
12815
|
new OpenAddWidgetModalCommand(modal),
|
|
12804
12816
|
new AddPartCommand(modal),
|
|
12817
|
+
new AddSectionCommand(modal),
|
|
12818
|
+
new AddBlockCommand(modal),
|
|
12805
12819
|
new AddSectionAboveCommand(modal),
|
|
12806
12820
|
new AddSectionBelowCommand(modal),
|
|
12807
12821
|
new AddBlockLeftCommand(),
|
|
@@ -13094,14 +13108,20 @@ const createDefaultToolButtonGroups = () => {
|
|
|
13094
13108
|
groupId: "add",
|
|
13095
13109
|
buttons: [
|
|
13096
13110
|
{
|
|
13097
|
-
buttonId: "core:
|
|
13098
|
-
caption: "Add
|
|
13111
|
+
buttonId: "core:addSection",
|
|
13112
|
+
caption: "Add Section",
|
|
13099
13113
|
icon: "add_row_below",
|
|
13100
|
-
handler: (modeler) => modeler.commandRegistry.executeCommand(
|
|
13114
|
+
handler: (modeler) => modeler.commandRegistry.executeCommand(AddSectionCommand.COMMAND_ID)
|
|
13101
13115
|
},
|
|
13102
13116
|
{
|
|
13103
|
-
buttonId: "core:
|
|
13104
|
-
caption: "Add
|
|
13117
|
+
buttonId: "core:addBlock",
|
|
13118
|
+
caption: "Add Block",
|
|
13119
|
+
icon: "add_column_right",
|
|
13120
|
+
handler: (modeler) => modeler.commandRegistry.executeCommand(AddBlockCommand.COMMAND_ID)
|
|
13121
|
+
},
|
|
13122
|
+
{
|
|
13123
|
+
buttonId: "core:addWidget",
|
|
13124
|
+
caption: "Add Widget",
|
|
13105
13125
|
icon: "desktop_landscape_add",
|
|
13106
13126
|
handler: (modeler) => modeler.commandRegistry.executeCommand(OpenAddWidgetModalCommand.COMMAND_ID)
|
|
13107
13127
|
}
|
|
@@ -13307,6 +13327,8 @@ class PageBuilderEditorImpl {
|
|
|
13307
13327
|
__publicField(this, "scale", ref(1));
|
|
13308
13328
|
__publicField(this, "locale", ref("en"));
|
|
13309
13329
|
__publicField(this, "locales", ref(["en"]));
|
|
13330
|
+
__publicField(this, "customWidgets", []);
|
|
13331
|
+
__publicField(this, "providers", {});
|
|
13310
13332
|
this.model = new Model2();
|
|
13311
13333
|
this.context = new PageBuilderContextImpl(this);
|
|
13312
13334
|
this.editMode = "free";
|
|
@@ -13331,6 +13353,21 @@ class PageBuilderEditorImpl {
|
|
|
13331
13353
|
return def.component;
|
|
13332
13354
|
}
|
|
13333
13355
|
}
|
|
13356
|
+
getProvider(name) {
|
|
13357
|
+
return this.providers[name];
|
|
13358
|
+
}
|
|
13359
|
+
watchCustomWidgetData(part) {
|
|
13360
|
+
const def = this.partManager.getPartDefinition(part.partName);
|
|
13361
|
+
if (!def || !def.dataWatcher)
|
|
13362
|
+
return false;
|
|
13363
|
+
return def.dataWatcher(part.properties);
|
|
13364
|
+
}
|
|
13365
|
+
provideCustomWidgetData(part) {
|
|
13366
|
+
const def = this.partManager.getPartDefinition(part.partName);
|
|
13367
|
+
if (!def || !def.dataProvider)
|
|
13368
|
+
return Promise.resolve();
|
|
13369
|
+
return def.dataProvider(part.properties);
|
|
13370
|
+
}
|
|
13334
13371
|
registerPlugin(plugin) {
|
|
13335
13372
|
if (plugin.partDefinitions)
|
|
13336
13373
|
this.partManager.registerPartDefinitions(plugin.partDefinitions);
|
|
@@ -13352,13 +13389,23 @@ class PageBuilderEditorImpl {
|
|
|
13352
13389
|
const partDefinitions2 = {};
|
|
13353
13390
|
plugin.widgets.forEach((v) => {
|
|
13354
13391
|
const w = { ...v };
|
|
13355
|
-
w.
|
|
13392
|
+
w.partType = "Widget";
|
|
13356
13393
|
w.creator = () => _sfc_main$q;
|
|
13357
13394
|
w.propertyGroups = [...w.propertyGroups, ...defaultWidgetPropertyGroups()];
|
|
13358
13395
|
partDefinitions2[v.partName] = w;
|
|
13396
|
+
const found = this.customWidgets.find((x) => x.partName === v.partName);
|
|
13397
|
+
if (!found) {
|
|
13398
|
+
this.customWidgets.push(w);
|
|
13399
|
+
}
|
|
13359
13400
|
});
|
|
13360
13401
|
this.partManager.registerPartDefinitions(partDefinitions2);
|
|
13361
13402
|
}
|
|
13403
|
+
if (plugin.providers) {
|
|
13404
|
+
this.providers = {
|
|
13405
|
+
...this.providers,
|
|
13406
|
+
...plugin.providers
|
|
13407
|
+
};
|
|
13408
|
+
}
|
|
13362
13409
|
if (plugin.propertyEditors) {
|
|
13363
13410
|
this.partManager.registerPartPropertyEditors(plugin.propertyEditors);
|
|
13364
13411
|
}
|
|
@@ -13434,6 +13481,9 @@ class PageBuilderEditorImpl {
|
|
|
13434
13481
|
]
|
|
13435
13482
|
});
|
|
13436
13483
|
}
|
|
13484
|
+
getCustomWidgets() {
|
|
13485
|
+
return this.customWidgets;
|
|
13486
|
+
}
|
|
13437
13487
|
getEmptyPageContent() {
|
|
13438
13488
|
const block = new Block();
|
|
13439
13489
|
const section = new Section();
|
|
@@ -13479,7 +13529,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
13479
13529
|
const insertSection = (index) => {
|
|
13480
13530
|
if (!props.page)
|
|
13481
13531
|
return;
|
|
13482
|
-
editor.commandRegistry.executeCommand(
|
|
13532
|
+
editor.commandRegistry.executeCommand(AddSectionCommand.COMMAND_ID);
|
|
13483
13533
|
};
|
|
13484
13534
|
return (_ctx, _cache) => {
|
|
13485
13535
|
var _a;
|
|
@@ -14411,5 +14461,6 @@ export {
|
|
|
14411
14461
|
providePageBuilderViewer as t,
|
|
14412
14462
|
usePageBuilderEditor as u,
|
|
14413
14463
|
usePageBuilder as v,
|
|
14414
|
-
|
|
14464
|
+
widgetPartDefinitions as w,
|
|
14465
|
+
usePageBuilderViewer as x
|
|
14415
14466
|
};
|
package/dist/model/command.d.ts
CHANGED
|
@@ -53,6 +53,22 @@ export declare class AddPartCommand implements Command {
|
|
|
53
53
|
constructor(modal: BSModal);
|
|
54
54
|
execute(pageBuilder: PageBuilderEditor, args?: any): void;
|
|
55
55
|
}
|
|
56
|
+
export declare class AddSectionCommand implements Command {
|
|
57
|
+
private modal;
|
|
58
|
+
static readonly COMMAND_ID = "AddSection";
|
|
59
|
+
readonly commandId = "AddSection";
|
|
60
|
+
readonly caption = "Add Section";
|
|
61
|
+
constructor(modal: BSModal);
|
|
62
|
+
execute(pageBuilder: PageBuilderEditor, args?: any): void;
|
|
63
|
+
}
|
|
64
|
+
export declare class AddBlockCommand implements Command {
|
|
65
|
+
private modal;
|
|
66
|
+
static readonly COMMAND_ID = "AddBlock";
|
|
67
|
+
readonly commandId = "AddBlock";
|
|
68
|
+
readonly caption = "Add Block";
|
|
69
|
+
constructor(modal: BSModal);
|
|
70
|
+
execute(pageBuilder: PageBuilderEditor, args?: any): void;
|
|
71
|
+
}
|
|
56
72
|
export declare class AddSectionAboveCommand implements Command {
|
|
57
73
|
private modal;
|
|
58
74
|
static readonly COMMAND_ID = "AddSectionAbove";
|
|
@@ -181,7 +197,7 @@ export declare class SelectAllPartsCommand implements Command {
|
|
|
181
197
|
readonly commandId = "SelectAllParts";
|
|
182
198
|
execute(pageBuilder: PageBuilderEditor): void;
|
|
183
199
|
}
|
|
184
|
-
export declare const createDefaultCommands: (modal: BSModal) => (OpenAddPartModalCommand | OpenAddWidgetModalCommand | AddPartCommand | AddSectionAboveCommand | AddSectionBelowCommand | AddBlockLeftCommand | AddBlockRightCommand | AddBlockAboveCommand | AddBlockBelowCommand | AddWidgetLeftCommand | AddWidgetRightCommand | AddWidgetAboveCommand | AddWidgetBelowCommand | AddWidgetInsideCommand | ChangePropertyCommand | DeletePartCommand | CopyPartCommand | CutPartCommand | PastePartCommand | SelectAllPartsCommand)[];
|
|
200
|
+
export declare const createDefaultCommands: (modal: BSModal) => (OpenAddPartModalCommand | OpenAddWidgetModalCommand | AddPartCommand | AddSectionCommand | AddBlockCommand | AddSectionAboveCommand | AddSectionBelowCommand | AddBlockLeftCommand | AddBlockRightCommand | AddBlockAboveCommand | AddBlockBelowCommand | AddWidgetLeftCommand | AddWidgetRightCommand | AddWidgetAboveCommand | AddWidgetBelowCommand | AddWidgetInsideCommand | ChangePropertyCommand | DeletePartCommand | CopyPartCommand | CutPartCommand | PastePartCommand | SelectAllPartsCommand)[];
|
|
185
201
|
export declare const menuItemForCommand: (pageBuilder: PageBuilderEditor, commandId: string, caption?: string) => MenuItem;
|
|
186
202
|
export declare const createDefaultContextMenus: () => ContextMenu[];
|
|
187
203
|
export declare const createDefaultKeyHandlers: () => KeyHandler[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PartDefinition } from './part-definintion.ts';
|
|
1
2
|
import { ContextMenuRegistry, ContextMenuRegistryImpl, KeyHandlers, PageBuilderContext, PageBuilderContextImpl } from './context.ts';
|
|
2
3
|
import { ToolButtonRegistry } from './toolbar.ts';
|
|
3
4
|
import { PageBuilderPlugin } from './plugin.ts';
|
|
@@ -36,6 +37,8 @@ export interface PageBuilderEditor extends PageBuilder {
|
|
|
36
37
|
setLocales(locales?: string[]): void;
|
|
37
38
|
makeSingleScreen(screenToKeep: number): void;
|
|
38
39
|
makeMultipleScreen(): void;
|
|
40
|
+
getCustomWidgets(): PartDefinition[];
|
|
41
|
+
getProvider(name: string): (args?: any, callback?: (result?: any) => void) => unknown;
|
|
39
42
|
}
|
|
40
43
|
export declare class PageBuilderEditorImpl implements PageBuilderEditor {
|
|
41
44
|
instanceId?: string;
|
|
@@ -51,12 +54,17 @@ export declare class PageBuilderEditorImpl implements PageBuilderEditor {
|
|
|
51
54
|
scale: Ref<number>;
|
|
52
55
|
locale: Ref<string>;
|
|
53
56
|
locales: Ref<string[]>;
|
|
57
|
+
customWidgets: PartDefinition[];
|
|
58
|
+
providers: Record<string, unknown>;
|
|
54
59
|
constructor();
|
|
55
60
|
getLocale(): string;
|
|
56
61
|
setLocale(locale?: string): void;
|
|
57
62
|
getLocales(): string[];
|
|
58
63
|
setLocales(locales?: string[]): void;
|
|
59
64
|
getCustomWidgetComponent(part: IPart): Component | undefined;
|
|
65
|
+
getProvider(name: string): (args?: any, callback?: (result?: any) => void) => unknown;
|
|
66
|
+
watchCustomWidgetData(part: IPart): unknown;
|
|
67
|
+
provideCustomWidgetData(part: IPart): Promise<unknown>;
|
|
60
68
|
registerPlugin(plugin: PageBuilderPlugin): void;
|
|
61
69
|
registerCustomPlugin(plugin: any): void;
|
|
62
70
|
initData(content?: any[]): void;
|
|
@@ -65,6 +73,7 @@ export declare class PageBuilderEditorImpl implements PageBuilderEditor {
|
|
|
65
73
|
zoom(scale: number): void;
|
|
66
74
|
makeSingleScreen(screenToKeep: number): void;
|
|
67
75
|
makeMultipleScreen(): void;
|
|
76
|
+
getCustomWidgets(): PartDefinition[];
|
|
68
77
|
private getEmptyPageContent;
|
|
69
78
|
private initPlugins;
|
|
70
79
|
}
|
|
@@ -14,6 +14,8 @@ export type PartDefinition = {
|
|
|
14
14
|
allowsChild: (partOrName?: IPart | string | undefined) => boolean;
|
|
15
15
|
creator: PartCreator;
|
|
16
16
|
component?: Component;
|
|
17
|
+
dataWatcher?: (properties?: Record<string, unknown>) => unknown;
|
|
18
|
+
dataProvider?: (properties?: Record<string, unknown>) => Promise<unknown>;
|
|
17
19
|
};
|
|
18
20
|
export type PartDefinitionGroup = {
|
|
19
21
|
groupName: string;
|
|
@@ -15,7 +15,6 @@ export declare class PartManager {
|
|
|
15
15
|
registerPartDefinitions(partDefinitions: Record<string, PartDefinition>): void;
|
|
16
16
|
getPartDefinition(partName: string): PartDefinition | undefined;
|
|
17
17
|
getPropertyDefinition(partName: string, propertyName: string): PartProperty | undefined;
|
|
18
|
-
getLocalDesignPartPropertyDefinitions(partName: string): PartProperty[] | undefined;
|
|
19
18
|
createPartComponent(part?: IPart): Component | undefined;
|
|
20
19
|
createPartComponents(parts?: IPart[]): PartComponent[];
|
|
21
20
|
registerPartPropertyGroupEditors(editors: Record<string, PartPropertyGroupEditor>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B, b, M, c, d, e, _, a, f, g, h, i, j, k, l, R, m, S, n, W, o, p, q, r, s, t, v,
|
|
1
|
+
import { B, b, M, c, d, e, _, a, f, g, h, i, j, k, l, R, m, S, n, W, o, p, q, r, s, t, v, x } from "./index-BcD7YsdY.js";
|
|
2
2
|
export {
|
|
3
3
|
B as BLOCK_TYPE,
|
|
4
4
|
b as Block,
|
|
@@ -27,5 +27,5 @@ export {
|
|
|
27
27
|
s as providePageBuilder,
|
|
28
28
|
t as providePageBuilderViewer,
|
|
29
29
|
v as usePageBuilder,
|
|
30
|
-
|
|
30
|
+
x as usePageBuilderViewer
|
|
31
31
|
};
|