@g1cloud/page-builder-editor 1.0.0-alpha.3 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PageBuilderEditor.vue.d.ts +4 -0
- package/dist/{PbPropertyEditorImage-B4sYTAHu.js → PbPropertyEditorImage-EuqsavTF.js} +1 -1
- package/dist/PbPropertyEditorMultilineText-CfRbKELF.js +65 -0
- package/dist/{PbPropertyEditorProduct-qHnu5dvM.js → PbPropertyEditorProduct-COnCyYJl.js} +1 -1
- package/dist/components/sidebar/property/PbPropertyEditorMultilineText.vue.d.ts +5 -4
- package/dist/{index-DSV66_zQ.js → index-Mob7K7vK.js} +143 -47
- package/dist/model/context.d.ts +18 -6
- package/dist/model/model.d.ts +4 -2
- package/dist/model/page-builder-editor.d.ts +8 -0
- package/dist/model/page-builder-util.d.ts +2 -2
- package/dist/page-builder-editor.js +1 -1
- package/dist/page-builder-editor.umd.cjs +166 -48
- package/package.json +3 -3
- package/dist/PbPropertyEditorMultilineText-BMeNUGm8.js +0 -42
|
@@ -3,6 +3,8 @@ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimePr
|
|
|
3
3
|
title?: string | undefined;
|
|
4
4
|
editMode?: string | undefined;
|
|
5
5
|
pageContent?: any;
|
|
6
|
+
locales?: string[] | undefined;
|
|
7
|
+
language?: string | undefined;
|
|
6
8
|
}>, {
|
|
7
9
|
getLocalDesignPartContent: () => any[] | undefined;
|
|
8
10
|
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -10,6 +12,8 @@ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimePr
|
|
|
10
12
|
title?: string | undefined;
|
|
11
13
|
editMode?: string | undefined;
|
|
12
14
|
pageContent?: any;
|
|
15
|
+
locales?: string[] | undefined;
|
|
16
|
+
language?: string | undefined;
|
|
13
17
|
}>>>, {}, {}>;
|
|
14
18
|
export default _default;
|
|
15
19
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
|
|
2
2
|
import { useModal } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-Mob7K7vK.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "label" };
|
|
6
6
|
const _hoisted_3 = ["textContent"];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
|
|
2
|
+
import { BSTextArea } from "@g1cloud/bluesea";
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-Mob7K7vK.js";
|
|
4
|
+
const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
|
|
5
|
+
const _hoisted_2 = { class: "label" };
|
|
6
|
+
const _hoisted_3 = ["textContent"];
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "PbPropertyEditorMultilineText",
|
|
9
|
+
props: {
|
|
10
|
+
property: {},
|
|
11
|
+
value: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["update-property-value"],
|
|
14
|
+
setup(__props, { emit: __emit }) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const emit = __emit;
|
|
17
|
+
const emitUpdatePropertyValue = (value) => {
|
|
18
|
+
const properties = {};
|
|
19
|
+
if (props.value && typeof props.value === "object") {
|
|
20
|
+
properties[props.property.propertyName] = {
|
|
21
|
+
...props.value,
|
|
22
|
+
[language.value]: value
|
|
23
|
+
};
|
|
24
|
+
} else {
|
|
25
|
+
properties[props.property.propertyName] = {
|
|
26
|
+
[language.value]: value
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
emit("update-property-value", properties);
|
|
30
|
+
};
|
|
31
|
+
const pageBuilder = usePageBuilderEditor();
|
|
32
|
+
const language = computed(() => pageBuilder.language.value);
|
|
33
|
+
const text = computed({
|
|
34
|
+
get() {
|
|
35
|
+
return props.value && typeof props.value === "object" ? props.value[language.value] : "";
|
|
36
|
+
},
|
|
37
|
+
set() {
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return (_ctx, _cache) => {
|
|
41
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
42
|
+
createElementVNode("div", _hoisted_2, [
|
|
43
|
+
createElementVNode("label", {
|
|
44
|
+
textContent: toDisplayString(_ctx.property.caption)
|
|
45
|
+
}, null, 8, _hoisted_3)
|
|
46
|
+
]),
|
|
47
|
+
createElementVNode("div", null, [
|
|
48
|
+
createVNode(unref(BSTextArea), {
|
|
49
|
+
modelValue: text.value,
|
|
50
|
+
"onUpdate:modelValue": [
|
|
51
|
+
_cache[0] || (_cache[0] = ($event) => text.value = $event),
|
|
52
|
+
emitUpdatePropertyValue
|
|
53
|
+
],
|
|
54
|
+
prefix: language.value,
|
|
55
|
+
height: "60px",
|
|
56
|
+
width: "100%"
|
|
57
|
+
}, null, 8, ["modelValue", "prefix"])
|
|
58
|
+
])
|
|
59
|
+
]);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
_sfc_main as default
|
|
65
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
|
|
2
2
|
import { useModal } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor, P as PageBuilderEditorEvent } from "./index-Mob7K7vK.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-product flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "label" };
|
|
6
6
|
const _hoisted_3 = ["textContent"];
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { MultiLangText } from '@g1cloud/page-builder-viewer';
|
|
1
2
|
import { PartProperty } from '../../../model/part-property.ts';
|
|
2
3
|
|
|
3
4
|
declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
4
5
|
property: PartProperty;
|
|
5
|
-
value?:
|
|
6
|
+
value?: MultiLangText | undefined;
|
|
6
7
|
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
-
"update-property-value": (properties: Record<string,
|
|
8
|
+
"update-property-value": (properties: Record<string, MultiLangText>) => void;
|
|
8
9
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
9
10
|
property: PartProperty;
|
|
10
|
-
value?:
|
|
11
|
+
value?: MultiLangText | undefined;
|
|
11
12
|
}>>> & {
|
|
12
|
-
"onUpdate-property-value"?: ((properties: Record<string,
|
|
13
|
+
"onUpdate-property-value"?: ((properties: Record<string, MultiLangText>) => any) | undefined;
|
|
13
14
|
}, {}, {}>;
|
|
14
15
|
export default _default;
|
|
15
16
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { ref, defineComponent, openBlock, createElementBlock, createCommentVNode, computed, normalizeClass, createElementVNode, mergeProps, toDisplayString, onMounted, watch, Fragment, renderList, provide, inject, createBlock as createBlock$1, resolveDynamicComponent, reactive, defineAsyncComponent, withDirectives, unref, createVNode, normalizeStyle, resolveComponent, vModelText, onBeforeUnmount, resolveDirective, withModifiers, renderSlot, normalizeProps, guardReactiveProps, markRaw, Teleport, withCtx } from "vue";
|
|
8
|
-
import { notNull, BSTextInput, vClickOutside, useModal, useContextMenu, BSSelect, BSTabSheet, BSTree, BSDateRange } from "@g1cloud/bluesea";
|
|
8
|
+
import { notNull, BSTextInput, vClickOutside, useModal, useContextMenu, BSSelect, BSLocaleSelect, BSTabSheet, BSTree, BSDateRange } from "@g1cloud/bluesea";
|
|
9
9
|
const create$5 = () => /* @__PURE__ */ new Map();
|
|
10
10
|
const copy = (m) => {
|
|
11
11
|
const r = create$5();
|
|
@@ -6773,12 +6773,29 @@ class Part {
|
|
|
6773
6773
|
if (this.parent)
|
|
6774
6774
|
return this.parent.getPageBuilderId();
|
|
6775
6775
|
}
|
|
6776
|
+
getLanguage() {
|
|
6777
|
+
if (this.isRoot())
|
|
6778
|
+
return this.language;
|
|
6779
|
+
if (this.parent)
|
|
6780
|
+
return this.parent.getLanguage();
|
|
6781
|
+
}
|
|
6782
|
+
isGlobalDesignPart() {
|
|
6783
|
+
return false;
|
|
6784
|
+
}
|
|
6785
|
+
isLocalDesignPart() {
|
|
6786
|
+
return false;
|
|
6787
|
+
}
|
|
6788
|
+
isLocalMarketingPart() {
|
|
6789
|
+
return false;
|
|
6790
|
+
}
|
|
6776
6791
|
}
|
|
6777
6792
|
class RootPart extends Part {
|
|
6778
6793
|
constructor() {
|
|
6779
6794
|
super();
|
|
6780
6795
|
__publicField2(this, "pageBuilderId");
|
|
6796
|
+
__publicField2(this, "language");
|
|
6781
6797
|
this.pageBuilderId = "";
|
|
6798
|
+
this.language = "en";
|
|
6782
6799
|
this.partType = ROOT_TYPE$1;
|
|
6783
6800
|
this.partName = ROOT_TYPE$1;
|
|
6784
6801
|
}
|
|
@@ -6805,6 +6822,18 @@ class Section extends Part {
|
|
|
6805
6822
|
isSection() {
|
|
6806
6823
|
return true;
|
|
6807
6824
|
}
|
|
6825
|
+
isGlobalDesignPart() {
|
|
6826
|
+
var _a;
|
|
6827
|
+
return ((_a = this.properties) == null ? void 0 : _a.sectionType) === "GlobalDesignPart";
|
|
6828
|
+
}
|
|
6829
|
+
isLocalDesignPart() {
|
|
6830
|
+
var _a;
|
|
6831
|
+
return ((_a = this.properties) == null ? void 0 : _a.sectionType) === "LocalDesignPart";
|
|
6832
|
+
}
|
|
6833
|
+
isLocalMarketingPart() {
|
|
6834
|
+
var _a;
|
|
6835
|
+
return ((_a = this.properties) == null ? void 0 : _a.sectionType) === "LocalMarketingPart";
|
|
6836
|
+
}
|
|
6808
6837
|
}
|
|
6809
6838
|
class Block extends Part {
|
|
6810
6839
|
constructor() {
|
|
@@ -6994,6 +7023,19 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
|
|
|
6994
7023
|
},
|
|
6995
7024
|
setup(__props) {
|
|
6996
7025
|
const props = __props;
|
|
7026
|
+
const text = computed(() => {
|
|
7027
|
+
var _a;
|
|
7028
|
+
if ((_a = props.part.properties) == null ? void 0 : _a.text) {
|
|
7029
|
+
if (typeof props.part.properties.text === "string") {
|
|
7030
|
+
return props.part.properties.text;
|
|
7031
|
+
} else {
|
|
7032
|
+
return props.part.properties.text[props.part.getLanguage() || "en"];
|
|
7033
|
+
}
|
|
7034
|
+
} else if (!props.viewMode) {
|
|
7035
|
+
return "Empty text";
|
|
7036
|
+
}
|
|
7037
|
+
return "";
|
|
7038
|
+
});
|
|
6997
7039
|
const style = computed(() => {
|
|
6998
7040
|
var _a;
|
|
6999
7041
|
return {
|
|
@@ -7003,12 +7045,11 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
|
|
|
7003
7045
|
};
|
|
7004
7046
|
});
|
|
7005
7047
|
return (_ctx, _cache) => {
|
|
7006
|
-
var _a, _b;
|
|
7007
7048
|
return openBlock(), createElementBlock("div", {
|
|
7008
|
-
class: normalizeClass([[_ctx.viewMode && !
|
|
7049
|
+
class: normalizeClass([[!_ctx.viewMode && !text.value ? "empty" : ""], "pb-text-widget"])
|
|
7009
7050
|
}, [
|
|
7010
7051
|
createElementVNode("div", mergeProps({ class: "text" }, style.value, {
|
|
7011
|
-
textContent: toDisplayString(
|
|
7052
|
+
textContent: toDisplayString(text.value)
|
|
7012
7053
|
}), null, 16, _hoisted_1$2$1)
|
|
7013
7054
|
], 2);
|
|
7014
7055
|
};
|
|
@@ -7161,11 +7202,14 @@ class PageBuilderViewerImpl {
|
|
|
7161
7202
|
constructor() {
|
|
7162
7203
|
__publicField2(this, "instanceId");
|
|
7163
7204
|
__publicField2(this, "model");
|
|
7205
|
+
__publicField2(this, "language");
|
|
7164
7206
|
this.model = new Model$1();
|
|
7207
|
+
this.language = "en";
|
|
7165
7208
|
}
|
|
7166
7209
|
render(pageContent) {
|
|
7167
7210
|
const rootPart = new RootPart();
|
|
7168
7211
|
rootPart.pageBuilderId = this.instanceId;
|
|
7212
|
+
rootPart.language = this.language;
|
|
7169
7213
|
rootPart.children = this.parsePageContent(pageContent);
|
|
7170
7214
|
if (rootPart.children) {
|
|
7171
7215
|
for (let page of rootPart.children) {
|
|
@@ -7184,7 +7228,12 @@ class PageBuilderViewerImpl {
|
|
|
7184
7228
|
part.partType = partContent.partType;
|
|
7185
7229
|
part.partName = partContent.partName;
|
|
7186
7230
|
part.properties = partContent.properties ? JSON.parse(JSON.stringify(partContent.properties)) : null;
|
|
7187
|
-
part.children = (partContent.children || []).map((child) =>
|
|
7231
|
+
part.children = (partContent.children || []).map((child) => {
|
|
7232
|
+
const childPart = this.parsePartContent(child);
|
|
7233
|
+
if (childPart)
|
|
7234
|
+
childPart.parent = part;
|
|
7235
|
+
return childPart;
|
|
7236
|
+
}).filter((part2) => !!part2);
|
|
7188
7237
|
return part;
|
|
7189
7238
|
}
|
|
7190
7239
|
createPart(partType) {
|
|
@@ -7263,12 +7312,14 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7263
7312
|
props: {
|
|
7264
7313
|
instanceId: {},
|
|
7265
7314
|
pageContent: {},
|
|
7266
|
-
isMobilePage: { type: Boolean }
|
|
7315
|
+
isMobilePage: { type: Boolean },
|
|
7316
|
+
language: {}
|
|
7267
7317
|
},
|
|
7268
7318
|
setup(__props) {
|
|
7269
7319
|
const props = __props;
|
|
7270
7320
|
const pageBuilderViewer = createPageBuilderViewer();
|
|
7271
7321
|
pageBuilderViewer.instanceId = props.instanceId;
|
|
7322
|
+
pageBuilderViewer.language = props.language || "en";
|
|
7272
7323
|
providePageBuilderViewer(pageBuilderViewer);
|
|
7273
7324
|
const page = computed(() => pageBuilderViewer.model.rootPart.value.children && pageBuilderViewer.model.rootPart.value.children[props.isMobilePage ? 0 : 1]);
|
|
7274
7325
|
onMounted(() => {
|
|
@@ -7413,10 +7464,16 @@ const syncProperties = (part, element) => {
|
|
|
7413
7464
|
for (const name in attrs) {
|
|
7414
7465
|
if (!RESERVED_ATTRIBUTES.includes(name)) {
|
|
7415
7466
|
const value = attrs[name];
|
|
7416
|
-
if (value)
|
|
7417
|
-
|
|
7418
|
-
|
|
7467
|
+
if (value) {
|
|
7468
|
+
if (name.indexOf(".object") > 0) {
|
|
7469
|
+
const _name = name.substring(0, name.length - ".object".length);
|
|
7470
|
+
part.properties[_name] = JSON.parse(value);
|
|
7471
|
+
} else {
|
|
7472
|
+
part.properties[name] = value;
|
|
7473
|
+
}
|
|
7474
|
+
} else {
|
|
7419
7475
|
delete part.properties[name];
|
|
7476
|
+
}
|
|
7420
7477
|
}
|
|
7421
7478
|
}
|
|
7422
7479
|
for (const name in part.properties) {
|
|
@@ -7645,13 +7702,14 @@ class Model2 {
|
|
|
7645
7702
|
if (element) {
|
|
7646
7703
|
for (const name in param.properties) {
|
|
7647
7704
|
if (!RESERVED_ATTRIBUTES.includes(name)) {
|
|
7648
|
-
|
|
7705
|
+
this.setElementAttribute(element, name, param.properties[name]);
|
|
7649
7706
|
}
|
|
7650
7707
|
}
|
|
7651
7708
|
if (param.removeOtherAttributes) {
|
|
7652
7709
|
const allAttributes = element.getAttributes();
|
|
7653
7710
|
for (const name in allAttributes) {
|
|
7654
|
-
|
|
7711
|
+
const _name = name.indexOf(".object") > 0 ? name.substring(0, name.length - ".object".length) : name;
|
|
7712
|
+
if (!RESERVED_ATTRIBUTES.includes(name) && !param.properties.hasOwnProperty(_name)) {
|
|
7655
7713
|
element.removeAttribute(name);
|
|
7656
7714
|
}
|
|
7657
7715
|
}
|
|
@@ -7684,7 +7742,7 @@ class Model2 {
|
|
|
7684
7742
|
if (part.properties) {
|
|
7685
7743
|
for (const name in part.properties) {
|
|
7686
7744
|
if (!RESERVED_ATTRIBUTES.includes(name)) {
|
|
7687
|
-
|
|
7745
|
+
this.setElementAttribute(node, name, part.properties[name]);
|
|
7688
7746
|
}
|
|
7689
7747
|
}
|
|
7690
7748
|
}
|
|
@@ -7696,6 +7754,23 @@ class Model2 {
|
|
|
7696
7754
|
}
|
|
7697
7755
|
return node;
|
|
7698
7756
|
}
|
|
7757
|
+
setElementAttribute(node, name, value) {
|
|
7758
|
+
if (!value)
|
|
7759
|
+
return;
|
|
7760
|
+
if (typeof value === "string") {
|
|
7761
|
+
node.setAttribute(name, value);
|
|
7762
|
+
} else if (typeof value === "object") {
|
|
7763
|
+
node.setAttribute(`${name}.object`, JSON.stringify(value));
|
|
7764
|
+
}
|
|
7765
|
+
}
|
|
7766
|
+
getElementAttribute(node, name) {
|
|
7767
|
+
let value = node.getAttribute(name);
|
|
7768
|
+
if (value)
|
|
7769
|
+
return value;
|
|
7770
|
+
value = node.getAttribute(`${name}.object`);
|
|
7771
|
+
if (value)
|
|
7772
|
+
return JSON.parse(value);
|
|
7773
|
+
}
|
|
7699
7774
|
getIndexOfElement(element) {
|
|
7700
7775
|
if (element.parent instanceof YXmlElement) {
|
|
7701
7776
|
let index = 0;
|
|
@@ -7737,7 +7812,7 @@ class Model2 {
|
|
|
7737
7812
|
const properties = {};
|
|
7738
7813
|
event.changes.keys.forEach((_, key) => {
|
|
7739
7814
|
if (!RESERVED_ATTRIBUTES.includes(key)) {
|
|
7740
|
-
properties[key] =
|
|
7815
|
+
properties[key] = this.getElementAttribute(element, key) || "";
|
|
7741
7816
|
}
|
|
7742
7817
|
});
|
|
7743
7818
|
(_a = result.updated) == null ? void 0 : _a.push({ element, properties });
|
|
@@ -7866,14 +7941,20 @@ const defaultPartPropertyEditors = () => {
|
|
|
7866
7941
|
return {
|
|
7867
7942
|
"readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-Bk0WJxA0.js")),
|
|
7868
7943
|
"text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-DNdXl-Tr.js")),
|
|
7869
|
-
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-
|
|
7944
|
+
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-CfRbKELF.js")),
|
|
7870
7945
|
"select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-BJovN1su.js")),
|
|
7871
|
-
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-
|
|
7872
|
-
"product": () => defineAsyncComponent(() => import("./PbPropertyEditorProduct-
|
|
7946
|
+
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-EuqsavTF.js")),
|
|
7947
|
+
"product": () => defineAsyncComponent(() => import("./PbPropertyEditorProduct-COnCyYJl.js"))
|
|
7873
7948
|
};
|
|
7874
7949
|
};
|
|
7875
7950
|
const getPropertyValueOfParts = (parts, propertyName) => {
|
|
7876
|
-
|
|
7951
|
+
if (parts.length === 1) {
|
|
7952
|
+
return parts[0].getProperty(propertyName);
|
|
7953
|
+
}
|
|
7954
|
+
const values = parts.map((part) => {
|
|
7955
|
+
const val = part.getProperty(propertyName);
|
|
7956
|
+
return val && typeof val === "string" ? val : "";
|
|
7957
|
+
});
|
|
7877
7958
|
const unique = values.filter((val, index) => values.indexOf(val) === index);
|
|
7878
7959
|
return unique.length === 1 ? unique[0] : void 0;
|
|
7879
7960
|
};
|
|
@@ -8858,12 +8939,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
8858
8939
|
});
|
|
8859
8940
|
const properties = computed(() => ({ style: props.part.getStyles() }));
|
|
8860
8941
|
const disabled = computed(() => {
|
|
8861
|
-
var _a
|
|
8942
|
+
var _a;
|
|
8862
8943
|
if (["static"].includes(((_a = props.part.properties) == null ? void 0 : _a.sectionType) || ""))
|
|
8863
8944
|
return true;
|
|
8864
|
-
if (pageBuilder.editMode === "local" &&
|
|
8945
|
+
if (pageBuilder.editMode === "local" && props.part.isGlobalDesignPart())
|
|
8865
8946
|
return true;
|
|
8866
|
-
if (pageBuilder.editMode === "global" &&
|
|
8947
|
+
if (pageBuilder.editMode === "global" && (props.part.isLocalDesignPart() || props.part.isLocalMarketingPart()))
|
|
8867
8948
|
return true;
|
|
8868
8949
|
return false;
|
|
8869
8950
|
});
|
|
@@ -11144,7 +11225,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
11144
11225
|
const emptyColor = () => {
|
|
11145
11226
|
};
|
|
11146
11227
|
const borderLeftWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderLeftWidth"));
|
|
11147
|
-
const borderRightWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "
|
|
11228
|
+
const borderRightWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderRightWidth"));
|
|
11148
11229
|
const borderTopWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderTopWidth"));
|
|
11149
11230
|
const borderBottomWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderBottomWidth"));
|
|
11150
11231
|
const borderTopLeftRadius = computed(() => getPropertyValueOfParts(props.selectedParts, "borderTopLeftRadius"));
|
|
@@ -13047,6 +13128,8 @@ class PageBuilderEditorImpl {
|
|
|
13047
13128
|
__publicField(this, "title");
|
|
13048
13129
|
__publicField(this, "editMode");
|
|
13049
13130
|
__publicField(this, "scale", ref(1));
|
|
13131
|
+
__publicField(this, "locales", ref(["en"]));
|
|
13132
|
+
__publicField(this, "language", ref("en"));
|
|
13050
13133
|
this.model = new Model2();
|
|
13051
13134
|
this.context = new PageBuilderContextImpl(this);
|
|
13052
13135
|
this.editMode = "free";
|
|
@@ -13071,6 +13154,7 @@ class PageBuilderEditorImpl {
|
|
|
13071
13154
|
}
|
|
13072
13155
|
initData(content) {
|
|
13073
13156
|
this.model.rootPart.pageBuilderId = this.instanceId;
|
|
13157
|
+
this.model.rootPart.language = this.language.value;
|
|
13074
13158
|
let parts;
|
|
13075
13159
|
if (content) {
|
|
13076
13160
|
for (const p of content) {
|
|
@@ -13105,6 +13189,15 @@ class PageBuilderEditorImpl {
|
|
|
13105
13189
|
zoom(scale) {
|
|
13106
13190
|
this.scale.value = scale;
|
|
13107
13191
|
}
|
|
13192
|
+
setLocales(locales) {
|
|
13193
|
+
this.locales.value = locales;
|
|
13194
|
+
if (!locales.includes(this.language.value)) {
|
|
13195
|
+
this.language.value = locales[0];
|
|
13196
|
+
}
|
|
13197
|
+
}
|
|
13198
|
+
setLanguage(language) {
|
|
13199
|
+
this.language.value = language;
|
|
13200
|
+
}
|
|
13108
13201
|
getEmptyPageContent() {
|
|
13109
13202
|
const block = new Block();
|
|
13110
13203
|
const section = new Section();
|
|
@@ -13359,6 +13452,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
13359
13452
|
setup(__props) {
|
|
13360
13453
|
const pageBuilder = usePageBuilderEditor();
|
|
13361
13454
|
const buttonGroups = pageBuilder.toolButtonRegistry.getToolButtonGroups();
|
|
13455
|
+
const locales = computed(() => {
|
|
13456
|
+
return pageBuilder.locales.value;
|
|
13457
|
+
});
|
|
13362
13458
|
const scale = computed(() => `${Math.round(100 * pageBuilder.scale.value)}%`);
|
|
13363
13459
|
const zoom = async (scaleString) => {
|
|
13364
13460
|
if (!scaleString)
|
|
@@ -13366,7 +13462,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
13366
13462
|
const scale2 = parseInt(scaleString.replaceAll(/[^0-9]+/g, "")) / 100;
|
|
13367
13463
|
pageBuilder.zoom(scale2);
|
|
13368
13464
|
};
|
|
13369
|
-
const
|
|
13465
|
+
const changeLocale = (locale) => {
|
|
13466
|
+
pageBuilder.setLanguage(locale);
|
|
13467
|
+
};
|
|
13370
13468
|
return (_ctx, _cache) => {
|
|
13371
13469
|
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
13372
13470
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttonGroups), (group) => {
|
|
@@ -13388,13 +13486,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
13388
13486
|
}, null, 8, ["modelValue"])
|
|
13389
13487
|
]),
|
|
13390
13488
|
createElementVNode("div", _hoisted_3$1, [
|
|
13391
|
-
createVNode(unref(
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
"view-mode": false,
|
|
13396
|
-
placeholder: "English"
|
|
13397
|
-
}, null, 8, ["modelValue"])
|
|
13489
|
+
createVNode(unref(BSLocaleSelect), {
|
|
13490
|
+
locales: locales.value,
|
|
13491
|
+
onChangeLocale: changeLocale
|
|
13492
|
+
}, null, 8, ["locales"])
|
|
13398
13493
|
])
|
|
13399
13494
|
]);
|
|
13400
13495
|
};
|
|
@@ -13602,13 +13697,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
13602
13697
|
const props = __props;
|
|
13603
13698
|
const pageBuilder = usePageBuilderEditor();
|
|
13604
13699
|
const propertyEditor = computed(() => {
|
|
13605
|
-
var _a
|
|
13700
|
+
var _a;
|
|
13606
13701
|
if (pageBuilder.editMode === "local" && props.selectedParts.length > 0) {
|
|
13607
13702
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13608
|
-
if (section &&
|
|
13703
|
+
if (section && section.isGlobalDesignPart()) {
|
|
13609
13704
|
return;
|
|
13610
13705
|
}
|
|
13611
|
-
if (section &&
|
|
13706
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13612
13707
|
if (!props.property.localized) {
|
|
13613
13708
|
return;
|
|
13614
13709
|
}
|
|
@@ -13616,7 +13711,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
13616
13711
|
}
|
|
13617
13712
|
if (pageBuilder.editMode === "template" && props.selectedParts.length > 0) {
|
|
13618
13713
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13619
|
-
if (section &&
|
|
13714
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13620
13715
|
if (props.property.localized) {
|
|
13621
13716
|
return;
|
|
13622
13717
|
}
|
|
@@ -13627,7 +13722,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
13627
13722
|
if (editor)
|
|
13628
13723
|
return editor;
|
|
13629
13724
|
}
|
|
13630
|
-
return (
|
|
13725
|
+
return (_a = pageBuilder.partManager.getPartPropertyEditor(props.property.propertyType)) == null ? void 0 : _a(props.property, props.selectedParts);
|
|
13631
13726
|
});
|
|
13632
13727
|
const value = computed(() => getPropertyValueOfParts(props.selectedParts, props.property.propertyName));
|
|
13633
13728
|
const updatePropertyValue = (properties) => {
|
|
@@ -13660,13 +13755,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13660
13755
|
const props = __props;
|
|
13661
13756
|
const pageBuilder = usePageBuilderEditor();
|
|
13662
13757
|
const groupEditor = computed(() => {
|
|
13663
|
-
var _a, _b
|
|
13758
|
+
var _a, _b;
|
|
13664
13759
|
if (pageBuilder.editMode === "local" && props.selectedParts.length > 0) {
|
|
13665
13760
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13666
|
-
if (section &&
|
|
13761
|
+
if (section && section.isGlobalDesignPart()) {
|
|
13667
13762
|
return;
|
|
13668
13763
|
}
|
|
13669
|
-
if (section &&
|
|
13764
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13670
13765
|
if (!props.group.localized) {
|
|
13671
13766
|
return;
|
|
13672
13767
|
}
|
|
@@ -13674,13 +13769,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
13674
13769
|
}
|
|
13675
13770
|
if (pageBuilder.editMode === "template" && props.selectedParts.length > 0) {
|
|
13676
13771
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13677
|
-
if (section &&
|
|
13772
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13678
13773
|
if (props.group.localized) {
|
|
13679
13774
|
return;
|
|
13680
13775
|
}
|
|
13681
13776
|
}
|
|
13682
13777
|
}
|
|
13683
|
-
return (
|
|
13778
|
+
return (_b = (_a = props.group).propertyGroupEditor) == null ? void 0 : _b.call(_a, props.group, props.selectedParts);
|
|
13684
13779
|
});
|
|
13685
13780
|
return (_ctx, _cache) => {
|
|
13686
13781
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
@@ -13821,16 +13916,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
13821
13916
|
}
|
|
13822
13917
|
});
|
|
13823
13918
|
const showLocalMarketingPart = computed(() => {
|
|
13824
|
-
var _a;
|
|
13825
13919
|
if (pageBuilder.editMode === "template")
|
|
13826
13920
|
return false;
|
|
13827
13921
|
if (!selectedParts.length || selectedParts.length !== 1)
|
|
13828
13922
|
return false;
|
|
13829
13923
|
const part = selectedParts[0];
|
|
13830
|
-
|
|
13831
|
-
return true;
|
|
13832
|
-
}
|
|
13833
|
-
return false;
|
|
13924
|
+
return part.isLocalMarketingPart();
|
|
13834
13925
|
});
|
|
13835
13926
|
return (_ctx, _cache) => {
|
|
13836
13927
|
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
@@ -13872,7 +13963,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13872
13963
|
instanceId: {},
|
|
13873
13964
|
title: {},
|
|
13874
13965
|
editMode: {},
|
|
13875
|
-
pageContent: {}
|
|
13966
|
+
pageContent: {},
|
|
13967
|
+
locales: {},
|
|
13968
|
+
language: {}
|
|
13876
13969
|
},
|
|
13877
13970
|
setup(__props, { expose: __expose }) {
|
|
13878
13971
|
const props = __props;
|
|
@@ -13881,6 +13974,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13881
13974
|
pageBuilderEditor.instanceId = props.instanceId;
|
|
13882
13975
|
pageBuilderEditor.title = props.title;
|
|
13883
13976
|
pageBuilderEditor.editMode = props.editMode || "free";
|
|
13977
|
+
if (props.locales)
|
|
13978
|
+
pageBuilderEditor.setLocales(props.locales);
|
|
13979
|
+
if (props.language)
|
|
13980
|
+
pageBuilderEditor.setLanguage(props.language);
|
|
13884
13981
|
pageBuilderEditor.registerPlugin({
|
|
13885
13982
|
// TODO
|
|
13886
13983
|
commands: createDefaultCommands(modal)
|
|
@@ -13899,9 +13996,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13899
13996
|
return content;
|
|
13900
13997
|
};
|
|
13901
13998
|
const doGetLocalDesignPartContent = (part) => {
|
|
13902
|
-
var _a;
|
|
13903
13999
|
let content;
|
|
13904
|
-
if (
|
|
14000
|
+
if (part.isGlobalDesignPart() || part.isLocalMarketingPart()) {
|
|
13905
14001
|
const properties = getLocalDesignPartProperties(part);
|
|
13906
14002
|
if (properties) {
|
|
13907
14003
|
if (!content)
|
package/dist/model/context.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
|
|
|
35
35
|
partType: string;
|
|
36
36
|
partName: string;
|
|
37
37
|
partId: string;
|
|
38
|
-
properties?: Record<string,
|
|
38
|
+
properties?: Record<string, import('@g1cloud/page-builder-viewer').MultiLangText> | undefined;
|
|
39
39
|
children?: any[] | undefined;
|
|
40
40
|
parent?: any | undefined;
|
|
41
41
|
isRoot: () => boolean;
|
|
@@ -45,16 +45,20 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
|
|
|
45
45
|
isWidget: () => boolean;
|
|
46
46
|
isNestedWidget: () => boolean;
|
|
47
47
|
getName: () => string | undefined;
|
|
48
|
-
getProperty: (propertyName: string) =>
|
|
48
|
+
getProperty: (propertyName: string) => import('@g1cloud/page-builder-viewer').MultiLangText | undefined;
|
|
49
49
|
getClassNames: () => string;
|
|
50
50
|
getStyles: () => Record<string, string>;
|
|
51
51
|
getPageBuilderId: () => string | undefined;
|
|
52
|
+
getLanguage: () => string | undefined;
|
|
53
|
+
isGlobalDesignPart: () => boolean;
|
|
54
|
+
isLocalDesignPart: () => boolean;
|
|
55
|
+
isLocalMarketingPart: () => boolean;
|
|
52
56
|
} | undefined;
|
|
53
57
|
getSingleSelectedBlock(): {
|
|
54
58
|
partType: string;
|
|
55
59
|
partName: string;
|
|
56
60
|
partId: string;
|
|
57
|
-
properties?: Record<string,
|
|
61
|
+
properties?: Record<string, import('@g1cloud/page-builder-viewer').MultiLangText> | undefined;
|
|
58
62
|
children?: any[] | undefined;
|
|
59
63
|
parent?: any | undefined;
|
|
60
64
|
isRoot: () => boolean;
|
|
@@ -64,16 +68,20 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
|
|
|
64
68
|
isWidget: () => boolean;
|
|
65
69
|
isNestedWidget: () => boolean;
|
|
66
70
|
getName: () => string | undefined;
|
|
67
|
-
getProperty: (propertyName: string) =>
|
|
71
|
+
getProperty: (propertyName: string) => import('@g1cloud/page-builder-viewer').MultiLangText | undefined;
|
|
68
72
|
getClassNames: () => string;
|
|
69
73
|
getStyles: () => Record<string, string>;
|
|
70
74
|
getPageBuilderId: () => string | undefined;
|
|
75
|
+
getLanguage: () => string | undefined;
|
|
76
|
+
isGlobalDesignPart: () => boolean;
|
|
77
|
+
isLocalDesignPart: () => boolean;
|
|
78
|
+
isLocalMarketingPart: () => boolean;
|
|
71
79
|
} | undefined;
|
|
72
80
|
getSingleSelectedSection(): {
|
|
73
81
|
partType: string;
|
|
74
82
|
partName: string;
|
|
75
83
|
partId: string;
|
|
76
|
-
properties?: Record<string,
|
|
84
|
+
properties?: Record<string, import('@g1cloud/page-builder-viewer').MultiLangText> | undefined;
|
|
77
85
|
children?: any[] | undefined;
|
|
78
86
|
parent?: any | undefined;
|
|
79
87
|
isRoot: () => boolean;
|
|
@@ -83,10 +91,14 @@ export declare class PageBuilderContextImpl implements PageBuilderContext {
|
|
|
83
91
|
isWidget: () => boolean;
|
|
84
92
|
isNestedWidget: () => boolean;
|
|
85
93
|
getName: () => string | undefined;
|
|
86
|
-
getProperty: (propertyName: string) =>
|
|
94
|
+
getProperty: (propertyName: string) => import('@g1cloud/page-builder-viewer').MultiLangText | undefined;
|
|
87
95
|
getClassNames: () => string;
|
|
88
96
|
getStyles: () => Record<string, string>;
|
|
89
97
|
getPageBuilderId: () => string | undefined;
|
|
98
|
+
getLanguage: () => string | undefined;
|
|
99
|
+
isGlobalDesignPart: () => boolean;
|
|
100
|
+
isLocalDesignPart: () => boolean;
|
|
101
|
+
isLocalMarketingPart: () => boolean;
|
|
90
102
|
} | undefined;
|
|
91
103
|
}
|
|
92
104
|
export type ContextMenu = {
|
package/dist/model/model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPart } from '@g1cloud/page-builder-viewer';
|
|
1
|
+
import { IPart, MultiLangText } from '@g1cloud/page-builder-viewer';
|
|
2
2
|
import * as Y from 'yjs';
|
|
3
3
|
export declare const ROOT_TYPE = "Root";
|
|
4
4
|
export declare const PAGE_TYPE = "Page";
|
|
@@ -28,6 +28,8 @@ export declare class Model {
|
|
|
28
28
|
private updateParts;
|
|
29
29
|
private deleteParts;
|
|
30
30
|
private createElement;
|
|
31
|
+
private setElementAttribute;
|
|
32
|
+
private getElementAttribute;
|
|
31
33
|
private getIndexOfElement;
|
|
32
34
|
private emitUpdateModelEvent;
|
|
33
35
|
}
|
|
@@ -47,7 +49,7 @@ export type PartInsertResult = {
|
|
|
47
49
|
};
|
|
48
50
|
export type PartUpdateResult = {
|
|
49
51
|
element: Y.XmlElement;
|
|
50
|
-
properties: Record<string,
|
|
52
|
+
properties: Record<string, MultiLangText>;
|
|
51
53
|
removeOtherProperties?: boolean;
|
|
52
54
|
};
|
|
53
55
|
export type PartDeleteResult = {
|
|
@@ -22,11 +22,15 @@ export interface PageBuilderEditor {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
editMode: PageBuilderEditMode;
|
|
24
24
|
scale: Ref<number>;
|
|
25
|
+
locales: Ref<string[]>;
|
|
26
|
+
language: Ref<string>;
|
|
25
27
|
registerPlugin(plugin: PageBuilderPlugin): void;
|
|
26
28
|
initData(content?: any): void;
|
|
27
29
|
undo(): void;
|
|
28
30
|
redo(): void;
|
|
29
31
|
zoom(scale: number): void;
|
|
32
|
+
setLocales(locales: string[]): void;
|
|
33
|
+
setLanguage(language: string): void;
|
|
30
34
|
}
|
|
31
35
|
export declare class PageBuilderEditorImpl implements PageBuilderEditor {
|
|
32
36
|
instanceId?: string;
|
|
@@ -40,12 +44,16 @@ export declare class PageBuilderEditorImpl implements PageBuilderEditor {
|
|
|
40
44
|
title?: string;
|
|
41
45
|
editMode: PageBuilderEditMode;
|
|
42
46
|
scale: Ref<number>;
|
|
47
|
+
locales: Ref<string[]>;
|
|
48
|
+
language: Ref<string>;
|
|
43
49
|
constructor();
|
|
44
50
|
registerPlugin(plugin: PageBuilderPlugin): void;
|
|
45
51
|
initData(content?: any[]): void;
|
|
46
52
|
undo(): void;
|
|
47
53
|
redo(): void;
|
|
48
54
|
zoom(scale: number): void;
|
|
55
|
+
setLocales(locales: string[]): void;
|
|
56
|
+
setLanguage(language: string): void;
|
|
49
57
|
private getEmptyPageContent;
|
|
50
58
|
private initPlugins;
|
|
51
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IPart } from '@g1cloud/page-builder-viewer';
|
|
1
|
+
import { IPart, MultiLangText } from '@g1cloud/page-builder-viewer';
|
|
2
2
|
|
|
3
|
-
export declare const getPropertyValueOfParts: (parts: IPart[], propertyName: string) =>
|
|
3
|
+
export declare const getPropertyValueOfParts: (parts: IPart[], propertyName: string) => MultiLangText | undefined;
|
|
4
4
|
export declare const isCursorInElement: (event: MouseEvent, element: Element) => boolean;
|
|
5
5
|
export declare const extractCommonStylesFromProperties: (properties: Record<string, string>) => Record<string, unknown>;
|
|
@@ -6775,12 +6775,29 @@ var __publicField = (obj, key, value) => {
|
|
|
6775
6775
|
if (this.parent)
|
|
6776
6776
|
return this.parent.getPageBuilderId();
|
|
6777
6777
|
}
|
|
6778
|
+
getLanguage() {
|
|
6779
|
+
if (this.isRoot())
|
|
6780
|
+
return this.language;
|
|
6781
|
+
if (this.parent)
|
|
6782
|
+
return this.parent.getLanguage();
|
|
6783
|
+
}
|
|
6784
|
+
isGlobalDesignPart() {
|
|
6785
|
+
return false;
|
|
6786
|
+
}
|
|
6787
|
+
isLocalDesignPart() {
|
|
6788
|
+
return false;
|
|
6789
|
+
}
|
|
6790
|
+
isLocalMarketingPart() {
|
|
6791
|
+
return false;
|
|
6792
|
+
}
|
|
6778
6793
|
}
|
|
6779
6794
|
class RootPart extends Part {
|
|
6780
6795
|
constructor() {
|
|
6781
6796
|
super();
|
|
6782
6797
|
__publicField2(this, "pageBuilderId");
|
|
6798
|
+
__publicField2(this, "language");
|
|
6783
6799
|
this.pageBuilderId = "";
|
|
6800
|
+
this.language = "en";
|
|
6784
6801
|
this.partType = ROOT_TYPE$1;
|
|
6785
6802
|
this.partName = ROOT_TYPE$1;
|
|
6786
6803
|
}
|
|
@@ -6807,6 +6824,18 @@ var __publicField = (obj, key, value) => {
|
|
|
6807
6824
|
isSection() {
|
|
6808
6825
|
return true;
|
|
6809
6826
|
}
|
|
6827
|
+
isGlobalDesignPart() {
|
|
6828
|
+
var _a;
|
|
6829
|
+
return ((_a = this.properties) == null ? void 0 : _a.sectionType) === "GlobalDesignPart";
|
|
6830
|
+
}
|
|
6831
|
+
isLocalDesignPart() {
|
|
6832
|
+
var _a;
|
|
6833
|
+
return ((_a = this.properties) == null ? void 0 : _a.sectionType) === "LocalDesignPart";
|
|
6834
|
+
}
|
|
6835
|
+
isLocalMarketingPart() {
|
|
6836
|
+
var _a;
|
|
6837
|
+
return ((_a = this.properties) == null ? void 0 : _a.sectionType) === "LocalMarketingPart";
|
|
6838
|
+
}
|
|
6810
6839
|
}
|
|
6811
6840
|
class Block extends Part {
|
|
6812
6841
|
constructor() {
|
|
@@ -6996,6 +7025,19 @@ var __publicField = (obj, key, value) => {
|
|
|
6996
7025
|
},
|
|
6997
7026
|
setup(__props) {
|
|
6998
7027
|
const props = __props;
|
|
7028
|
+
const text = vue.computed(() => {
|
|
7029
|
+
var _a;
|
|
7030
|
+
if ((_a = props.part.properties) == null ? void 0 : _a.text) {
|
|
7031
|
+
if (typeof props.part.properties.text === "string") {
|
|
7032
|
+
return props.part.properties.text;
|
|
7033
|
+
} else {
|
|
7034
|
+
return props.part.properties.text[props.part.getLanguage() || "en"];
|
|
7035
|
+
}
|
|
7036
|
+
} else if (!props.viewMode) {
|
|
7037
|
+
return "Empty text";
|
|
7038
|
+
}
|
|
7039
|
+
return "";
|
|
7040
|
+
});
|
|
6999
7041
|
const style = vue.computed(() => {
|
|
7000
7042
|
var _a;
|
|
7001
7043
|
return {
|
|
@@ -7005,12 +7047,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7005
7047
|
};
|
|
7006
7048
|
});
|
|
7007
7049
|
return (_ctx, _cache) => {
|
|
7008
|
-
var _a, _b;
|
|
7009
7050
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
7010
|
-
class: vue.normalizeClass([[_ctx.viewMode && !
|
|
7051
|
+
class: vue.normalizeClass([[!_ctx.viewMode && !text.value ? "empty" : ""], "pb-text-widget"])
|
|
7011
7052
|
}, [
|
|
7012
7053
|
vue.createElementVNode("div", vue.mergeProps({ class: "text" }, style.value, {
|
|
7013
|
-
textContent: vue.toDisplayString(
|
|
7054
|
+
textContent: vue.toDisplayString(text.value)
|
|
7014
7055
|
}), null, 16, _hoisted_1$2$1)
|
|
7015
7056
|
], 2);
|
|
7016
7057
|
};
|
|
@@ -7163,11 +7204,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7163
7204
|
constructor() {
|
|
7164
7205
|
__publicField2(this, "instanceId");
|
|
7165
7206
|
__publicField2(this, "model");
|
|
7207
|
+
__publicField2(this, "language");
|
|
7166
7208
|
this.model = new Model$1();
|
|
7209
|
+
this.language = "en";
|
|
7167
7210
|
}
|
|
7168
7211
|
render(pageContent) {
|
|
7169
7212
|
const rootPart = new RootPart();
|
|
7170
7213
|
rootPart.pageBuilderId = this.instanceId;
|
|
7214
|
+
rootPart.language = this.language;
|
|
7171
7215
|
rootPart.children = this.parsePageContent(pageContent);
|
|
7172
7216
|
if (rootPart.children) {
|
|
7173
7217
|
for (let page of rootPart.children) {
|
|
@@ -7186,7 +7230,12 @@ var __publicField = (obj, key, value) => {
|
|
|
7186
7230
|
part.partType = partContent.partType;
|
|
7187
7231
|
part.partName = partContent.partName;
|
|
7188
7232
|
part.properties = partContent.properties ? JSON.parse(JSON.stringify(partContent.properties)) : null;
|
|
7189
|
-
part.children = (partContent.children || []).map((child) =>
|
|
7233
|
+
part.children = (partContent.children || []).map((child) => {
|
|
7234
|
+
const childPart = this.parsePartContent(child);
|
|
7235
|
+
if (childPart)
|
|
7236
|
+
childPart.parent = part;
|
|
7237
|
+
return childPart;
|
|
7238
|
+
}).filter((part2) => !!part2);
|
|
7190
7239
|
return part;
|
|
7191
7240
|
}
|
|
7192
7241
|
createPart(partType) {
|
|
@@ -7265,12 +7314,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7265
7314
|
props: {
|
|
7266
7315
|
instanceId: {},
|
|
7267
7316
|
pageContent: {},
|
|
7268
|
-
isMobilePage: { type: Boolean }
|
|
7317
|
+
isMobilePage: { type: Boolean },
|
|
7318
|
+
language: {}
|
|
7269
7319
|
},
|
|
7270
7320
|
setup(__props) {
|
|
7271
7321
|
const props = __props;
|
|
7272
7322
|
const pageBuilderViewer = createPageBuilderViewer();
|
|
7273
7323
|
pageBuilderViewer.instanceId = props.instanceId;
|
|
7324
|
+
pageBuilderViewer.language = props.language || "en";
|
|
7274
7325
|
providePageBuilderViewer(pageBuilderViewer);
|
|
7275
7326
|
const page = vue.computed(() => pageBuilderViewer.model.rootPart.value.children && pageBuilderViewer.model.rootPart.value.children[props.isMobilePage ? 0 : 1]);
|
|
7276
7327
|
vue.onMounted(() => {
|
|
@@ -7415,10 +7466,16 @@ var __publicField = (obj, key, value) => {
|
|
|
7415
7466
|
for (const name in attrs) {
|
|
7416
7467
|
if (!RESERVED_ATTRIBUTES.includes(name)) {
|
|
7417
7468
|
const value = attrs[name];
|
|
7418
|
-
if (value)
|
|
7419
|
-
|
|
7420
|
-
|
|
7469
|
+
if (value) {
|
|
7470
|
+
if (name.indexOf(".object") > 0) {
|
|
7471
|
+
const _name = name.substring(0, name.length - ".object".length);
|
|
7472
|
+
part.properties[_name] = JSON.parse(value);
|
|
7473
|
+
} else {
|
|
7474
|
+
part.properties[name] = value;
|
|
7475
|
+
}
|
|
7476
|
+
} else {
|
|
7421
7477
|
delete part.properties[name];
|
|
7478
|
+
}
|
|
7422
7479
|
}
|
|
7423
7480
|
}
|
|
7424
7481
|
for (const name in part.properties) {
|
|
@@ -7647,13 +7704,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7647
7704
|
if (element) {
|
|
7648
7705
|
for (const name in param.properties) {
|
|
7649
7706
|
if (!RESERVED_ATTRIBUTES.includes(name)) {
|
|
7650
|
-
|
|
7707
|
+
this.setElementAttribute(element, name, param.properties[name]);
|
|
7651
7708
|
}
|
|
7652
7709
|
}
|
|
7653
7710
|
if (param.removeOtherAttributes) {
|
|
7654
7711
|
const allAttributes = element.getAttributes();
|
|
7655
7712
|
for (const name in allAttributes) {
|
|
7656
|
-
|
|
7713
|
+
const _name = name.indexOf(".object") > 0 ? name.substring(0, name.length - ".object".length) : name;
|
|
7714
|
+
if (!RESERVED_ATTRIBUTES.includes(name) && !param.properties.hasOwnProperty(_name)) {
|
|
7657
7715
|
element.removeAttribute(name);
|
|
7658
7716
|
}
|
|
7659
7717
|
}
|
|
@@ -7686,7 +7744,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7686
7744
|
if (part.properties) {
|
|
7687
7745
|
for (const name in part.properties) {
|
|
7688
7746
|
if (!RESERVED_ATTRIBUTES.includes(name)) {
|
|
7689
|
-
|
|
7747
|
+
this.setElementAttribute(node, name, part.properties[name]);
|
|
7690
7748
|
}
|
|
7691
7749
|
}
|
|
7692
7750
|
}
|
|
@@ -7698,6 +7756,23 @@ var __publicField = (obj, key, value) => {
|
|
|
7698
7756
|
}
|
|
7699
7757
|
return node;
|
|
7700
7758
|
}
|
|
7759
|
+
setElementAttribute(node, name, value) {
|
|
7760
|
+
if (!value)
|
|
7761
|
+
return;
|
|
7762
|
+
if (typeof value === "string") {
|
|
7763
|
+
node.setAttribute(name, value);
|
|
7764
|
+
} else if (typeof value === "object") {
|
|
7765
|
+
node.setAttribute(`${name}.object`, JSON.stringify(value));
|
|
7766
|
+
}
|
|
7767
|
+
}
|
|
7768
|
+
getElementAttribute(node, name) {
|
|
7769
|
+
let value = node.getAttribute(name);
|
|
7770
|
+
if (value)
|
|
7771
|
+
return value;
|
|
7772
|
+
value = node.getAttribute(`${name}.object`);
|
|
7773
|
+
if (value)
|
|
7774
|
+
return JSON.parse(value);
|
|
7775
|
+
}
|
|
7701
7776
|
getIndexOfElement(element) {
|
|
7702
7777
|
if (element.parent instanceof YXmlElement) {
|
|
7703
7778
|
let index = 0;
|
|
@@ -7739,7 +7814,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7739
7814
|
const properties = {};
|
|
7740
7815
|
event.changes.keys.forEach((_, key) => {
|
|
7741
7816
|
if (!RESERVED_ATTRIBUTES.includes(key)) {
|
|
7742
|
-
properties[key] =
|
|
7817
|
+
properties[key] = this.getElementAttribute(element, key) || "";
|
|
7743
7818
|
}
|
|
7744
7819
|
});
|
|
7745
7820
|
(_a = result.updated) == null ? void 0 : _a.push({ element, properties });
|
|
@@ -7875,7 +7950,13 @@ var __publicField = (obj, key, value) => {
|
|
|
7875
7950
|
};
|
|
7876
7951
|
};
|
|
7877
7952
|
const getPropertyValueOfParts = (parts, propertyName) => {
|
|
7878
|
-
|
|
7953
|
+
if (parts.length === 1) {
|
|
7954
|
+
return parts[0].getProperty(propertyName);
|
|
7955
|
+
}
|
|
7956
|
+
const values = parts.map((part) => {
|
|
7957
|
+
const val = part.getProperty(propertyName);
|
|
7958
|
+
return val && typeof val === "string" ? val : "";
|
|
7959
|
+
});
|
|
7879
7960
|
const unique = values.filter((val, index) => values.indexOf(val) === index);
|
|
7880
7961
|
return unique.length === 1 ? unique[0] : void 0;
|
|
7881
7962
|
};
|
|
@@ -8860,12 +8941,12 @@ var __publicField = (obj, key, value) => {
|
|
|
8860
8941
|
});
|
|
8861
8942
|
const properties = vue.computed(() => ({ style: props.part.getStyles() }));
|
|
8862
8943
|
const disabled = vue.computed(() => {
|
|
8863
|
-
var _a
|
|
8944
|
+
var _a;
|
|
8864
8945
|
if (["static"].includes(((_a = props.part.properties) == null ? void 0 : _a.sectionType) || ""))
|
|
8865
8946
|
return true;
|
|
8866
|
-
if (pageBuilder.editMode === "local" &&
|
|
8947
|
+
if (pageBuilder.editMode === "local" && props.part.isGlobalDesignPart())
|
|
8867
8948
|
return true;
|
|
8868
|
-
if (pageBuilder.editMode === "global" &&
|
|
8949
|
+
if (pageBuilder.editMode === "global" && (props.part.isLocalDesignPart() || props.part.isLocalMarketingPart()))
|
|
8869
8950
|
return true;
|
|
8870
8951
|
return false;
|
|
8871
8952
|
});
|
|
@@ -11146,7 +11227,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11146
11227
|
const emptyColor = () => {
|
|
11147
11228
|
};
|
|
11148
11229
|
const borderLeftWidth = vue.computed(() => getPropertyValueOfParts(props.selectedParts, "borderLeftWidth"));
|
|
11149
|
-
const borderRightWidth = vue.computed(() => getPropertyValueOfParts(props.selectedParts, "
|
|
11230
|
+
const borderRightWidth = vue.computed(() => getPropertyValueOfParts(props.selectedParts, "borderRightWidth"));
|
|
11150
11231
|
const borderTopWidth = vue.computed(() => getPropertyValueOfParts(props.selectedParts, "borderTopWidth"));
|
|
11151
11232
|
const borderBottomWidth = vue.computed(() => getPropertyValueOfParts(props.selectedParts, "borderBottomWidth"));
|
|
11152
11233
|
const borderTopLeftRadius = vue.computed(() => getPropertyValueOfParts(props.selectedParts, "borderTopLeftRadius"));
|
|
@@ -13049,6 +13130,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13049
13130
|
__publicField(this, "title");
|
|
13050
13131
|
__publicField(this, "editMode");
|
|
13051
13132
|
__publicField(this, "scale", vue.ref(1));
|
|
13133
|
+
__publicField(this, "locales", vue.ref(["en"]));
|
|
13134
|
+
__publicField(this, "language", vue.ref("en"));
|
|
13052
13135
|
this.model = new Model();
|
|
13053
13136
|
this.context = new PageBuilderContextImpl(this);
|
|
13054
13137
|
this.editMode = "free";
|
|
@@ -13073,6 +13156,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13073
13156
|
}
|
|
13074
13157
|
initData(content) {
|
|
13075
13158
|
this.model.rootPart.pageBuilderId = this.instanceId;
|
|
13159
|
+
this.model.rootPart.language = this.language.value;
|
|
13076
13160
|
let parts;
|
|
13077
13161
|
if (content) {
|
|
13078
13162
|
for (const p of content) {
|
|
@@ -13107,6 +13191,15 @@ var __publicField = (obj, key, value) => {
|
|
|
13107
13191
|
zoom(scale) {
|
|
13108
13192
|
this.scale.value = scale;
|
|
13109
13193
|
}
|
|
13194
|
+
setLocales(locales) {
|
|
13195
|
+
this.locales.value = locales;
|
|
13196
|
+
if (!locales.includes(this.language.value)) {
|
|
13197
|
+
this.language.value = locales[0];
|
|
13198
|
+
}
|
|
13199
|
+
}
|
|
13200
|
+
setLanguage(language) {
|
|
13201
|
+
this.language.value = language;
|
|
13202
|
+
}
|
|
13110
13203
|
getEmptyPageContent() {
|
|
13111
13204
|
const block = new Block();
|
|
13112
13205
|
const section = new Section();
|
|
@@ -13361,6 +13454,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13361
13454
|
setup(__props) {
|
|
13362
13455
|
const pageBuilder = usePageBuilderEditor();
|
|
13363
13456
|
const buttonGroups = pageBuilder.toolButtonRegistry.getToolButtonGroups();
|
|
13457
|
+
const locales = vue.computed(() => {
|
|
13458
|
+
return pageBuilder.locales.value;
|
|
13459
|
+
});
|
|
13364
13460
|
const scale = vue.computed(() => `${Math.round(100 * pageBuilder.scale.value)}%`);
|
|
13365
13461
|
const zoom = async (scaleString) => {
|
|
13366
13462
|
if (!scaleString)
|
|
@@ -13368,7 +13464,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13368
13464
|
const scale2 = parseInt(scaleString.replaceAll(/[^0-9]+/g, "")) / 100;
|
|
13369
13465
|
pageBuilder.zoom(scale2);
|
|
13370
13466
|
};
|
|
13371
|
-
const
|
|
13467
|
+
const changeLocale = (locale) => {
|
|
13468
|
+
pageBuilder.setLanguage(locale);
|
|
13469
|
+
};
|
|
13372
13470
|
return (_ctx, _cache) => {
|
|
13373
13471
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [
|
|
13374
13472
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(buttonGroups), (group) => {
|
|
@@ -13390,13 +13488,10 @@ var __publicField = (obj, key, value) => {
|
|
|
13390
13488
|
}, null, 8, ["modelValue"])
|
|
13391
13489
|
]),
|
|
13392
13490
|
vue.createElementVNode("div", _hoisted_3$9, [
|
|
13393
|
-
vue.createVNode(vue.unref(bluesea.
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
"view-mode": false,
|
|
13398
|
-
placeholder: "English"
|
|
13399
|
-
}, null, 8, ["modelValue"])
|
|
13491
|
+
vue.createVNode(vue.unref(bluesea.BSLocaleSelect), {
|
|
13492
|
+
locales: locales.value,
|
|
13493
|
+
onChangeLocale: changeLocale
|
|
13494
|
+
}, null, 8, ["locales"])
|
|
13400
13495
|
])
|
|
13401
13496
|
]);
|
|
13402
13497
|
};
|
|
@@ -13604,13 +13699,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13604
13699
|
const props = __props;
|
|
13605
13700
|
const pageBuilder = usePageBuilderEditor();
|
|
13606
13701
|
const propertyEditor = vue.computed(() => {
|
|
13607
|
-
var _a
|
|
13702
|
+
var _a;
|
|
13608
13703
|
if (pageBuilder.editMode === "local" && props.selectedParts.length > 0) {
|
|
13609
13704
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13610
|
-
if (section &&
|
|
13705
|
+
if (section && section.isGlobalDesignPart()) {
|
|
13611
13706
|
return;
|
|
13612
13707
|
}
|
|
13613
|
-
if (section &&
|
|
13708
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13614
13709
|
if (!props.property.localized) {
|
|
13615
13710
|
return;
|
|
13616
13711
|
}
|
|
@@ -13618,7 +13713,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13618
13713
|
}
|
|
13619
13714
|
if (pageBuilder.editMode === "template" && props.selectedParts.length > 0) {
|
|
13620
13715
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13621
|
-
if (section &&
|
|
13716
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13622
13717
|
if (props.property.localized) {
|
|
13623
13718
|
return;
|
|
13624
13719
|
}
|
|
@@ -13629,7 +13724,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13629
13724
|
if (editor)
|
|
13630
13725
|
return editor;
|
|
13631
13726
|
}
|
|
13632
|
-
return (
|
|
13727
|
+
return (_a = pageBuilder.partManager.getPartPropertyEditor(props.property.propertyType)) == null ? void 0 : _a(props.property, props.selectedParts);
|
|
13633
13728
|
});
|
|
13634
13729
|
const value = vue.computed(() => getPropertyValueOfParts(props.selectedParts, props.property.propertyName));
|
|
13635
13730
|
const updatePropertyValue = (properties) => {
|
|
@@ -13662,13 +13757,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13662
13757
|
const props = __props;
|
|
13663
13758
|
const pageBuilder = usePageBuilderEditor();
|
|
13664
13759
|
const groupEditor = vue.computed(() => {
|
|
13665
|
-
var _a, _b
|
|
13760
|
+
var _a, _b;
|
|
13666
13761
|
if (pageBuilder.editMode === "local" && props.selectedParts.length > 0) {
|
|
13667
13762
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13668
|
-
if (section &&
|
|
13763
|
+
if (section && section.isGlobalDesignPart()) {
|
|
13669
13764
|
return;
|
|
13670
13765
|
}
|
|
13671
|
-
if (section &&
|
|
13766
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13672
13767
|
if (!props.group.localized) {
|
|
13673
13768
|
return;
|
|
13674
13769
|
}
|
|
@@ -13676,13 +13771,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13676
13771
|
}
|
|
13677
13772
|
if (pageBuilder.editMode === "template" && props.selectedParts.length > 0) {
|
|
13678
13773
|
const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
|
|
13679
|
-
if (section &&
|
|
13774
|
+
if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
|
|
13680
13775
|
if (props.group.localized) {
|
|
13681
13776
|
return;
|
|
13682
13777
|
}
|
|
13683
13778
|
}
|
|
13684
13779
|
}
|
|
13685
|
-
return (
|
|
13780
|
+
return (_b = (_a = props.group).propertyGroupEditor) == null ? void 0 : _b.call(_a, props.group, props.selectedParts);
|
|
13686
13781
|
});
|
|
13687
13782
|
return (_ctx, _cache) => {
|
|
13688
13783
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
@@ -13823,16 +13918,12 @@ var __publicField = (obj, key, value) => {
|
|
|
13823
13918
|
}
|
|
13824
13919
|
});
|
|
13825
13920
|
const showLocalMarketingPart = vue.computed(() => {
|
|
13826
|
-
var _a;
|
|
13827
13921
|
if (pageBuilder.editMode === "template")
|
|
13828
13922
|
return false;
|
|
13829
13923
|
if (!selectedParts.length || selectedParts.length !== 1)
|
|
13830
13924
|
return false;
|
|
13831
13925
|
const part = selectedParts[0];
|
|
13832
|
-
|
|
13833
|
-
return true;
|
|
13834
|
-
}
|
|
13835
|
-
return false;
|
|
13926
|
+
return part.isLocalMarketingPart();
|
|
13836
13927
|
});
|
|
13837
13928
|
return (_ctx, _cache) => {
|
|
13838
13929
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
@@ -13874,7 +13965,9 @@ var __publicField = (obj, key, value) => {
|
|
|
13874
13965
|
instanceId: {},
|
|
13875
13966
|
title: {},
|
|
13876
13967
|
editMode: {},
|
|
13877
|
-
pageContent: {}
|
|
13968
|
+
pageContent: {},
|
|
13969
|
+
locales: {},
|
|
13970
|
+
language: {}
|
|
13878
13971
|
},
|
|
13879
13972
|
setup(__props, { expose: __expose }) {
|
|
13880
13973
|
const props = __props;
|
|
@@ -13883,6 +13976,10 @@ var __publicField = (obj, key, value) => {
|
|
|
13883
13976
|
pageBuilderEditor.instanceId = props.instanceId;
|
|
13884
13977
|
pageBuilderEditor.title = props.title;
|
|
13885
13978
|
pageBuilderEditor.editMode = props.editMode || "free";
|
|
13979
|
+
if (props.locales)
|
|
13980
|
+
pageBuilderEditor.setLocales(props.locales);
|
|
13981
|
+
if (props.language)
|
|
13982
|
+
pageBuilderEditor.setLanguage(props.language);
|
|
13886
13983
|
pageBuilderEditor.registerPlugin({
|
|
13887
13984
|
// TODO
|
|
13888
13985
|
commands: createDefaultCommands(modal)
|
|
@@ -13901,9 +13998,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13901
13998
|
return content;
|
|
13902
13999
|
};
|
|
13903
14000
|
const doGetLocalDesignPartContent = (part) => {
|
|
13904
|
-
var _a;
|
|
13905
14001
|
let content;
|
|
13906
|
-
if (
|
|
14002
|
+
if (part.isGlobalDesignPart() || part.isLocalMarketingPart()) {
|
|
13907
14003
|
const properties = getLocalDesignPartProperties(part);
|
|
13908
14004
|
if (properties) {
|
|
13909
14005
|
if (!content)
|
|
@@ -14044,9 +14140,27 @@ var __publicField = (obj, key, value) => {
|
|
|
14044
14140
|
const emit = __emit;
|
|
14045
14141
|
const emitUpdatePropertyValue = (value) => {
|
|
14046
14142
|
const properties = {};
|
|
14047
|
-
|
|
14143
|
+
if (props.value && typeof props.value === "object") {
|
|
14144
|
+
properties[props.property.propertyName] = {
|
|
14145
|
+
...props.value,
|
|
14146
|
+
[language.value]: value
|
|
14147
|
+
};
|
|
14148
|
+
} else {
|
|
14149
|
+
properties[props.property.propertyName] = {
|
|
14150
|
+
[language.value]: value
|
|
14151
|
+
};
|
|
14152
|
+
}
|
|
14048
14153
|
emit("update-property-value", properties);
|
|
14049
14154
|
};
|
|
14155
|
+
const pageBuilder = usePageBuilderEditor();
|
|
14156
|
+
const language = vue.computed(() => pageBuilder.language.value);
|
|
14157
|
+
const text = vue.computed({
|
|
14158
|
+
get() {
|
|
14159
|
+
return props.value && typeof props.value === "object" ? props.value[language.value] : "";
|
|
14160
|
+
},
|
|
14161
|
+
set() {
|
|
14162
|
+
}
|
|
14163
|
+
});
|
|
14050
14164
|
return (_ctx, _cache) => {
|
|
14051
14165
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
14052
14166
|
vue.createElementVNode("div", _hoisted_2$5, [
|
|
@@ -14056,11 +14170,15 @@ var __publicField = (obj, key, value) => {
|
|
|
14056
14170
|
]),
|
|
14057
14171
|
vue.createElementVNode("div", null, [
|
|
14058
14172
|
vue.createVNode(vue.unref(bluesea.BSTextArea), {
|
|
14059
|
-
|
|
14173
|
+
modelValue: text.value,
|
|
14174
|
+
"onUpdate:modelValue": [
|
|
14175
|
+
_cache[0] || (_cache[0] = ($event) => text.value = $event),
|
|
14176
|
+
emitUpdatePropertyValue
|
|
14177
|
+
],
|
|
14178
|
+
prefix: language.value,
|
|
14060
14179
|
height: "60px",
|
|
14061
|
-
width: "100%"
|
|
14062
|
-
|
|
14063
|
-
}, null, 8, ["model-value"])
|
|
14180
|
+
width: "100%"
|
|
14181
|
+
}, null, 8, ["modelValue", "prefix"])
|
|
14064
14182
|
])
|
|
14065
14183
|
]);
|
|
14066
14184
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g1cloud/page-builder-editor",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.4",
|
|
5
5
|
"engins": {
|
|
6
6
|
"node": ">= 20.0.0"
|
|
7
7
|
},
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"author": "zag@g1project.net",
|
|
17
17
|
"license": "LicenseRef-LICENSE",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@g1cloud/bluesea": "5.0.0-alpha.
|
|
19
|
+
"@g1cloud/bluesea": "5.0.0-alpha.46"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@ckpack/vue-color": "^1.5.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"vue-router": "^4.3.2",
|
|
28
28
|
"vue3-click-away": "^1.2.4",
|
|
29
29
|
"yjs": "^13.6.14",
|
|
30
|
-
"@g1cloud/page-builder-viewer": "1.0.0-alpha.
|
|
30
|
+
"@g1cloud/page-builder-viewer": "1.0.0-alpha.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^20.12.7",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
|
|
2
|
-
import { BSTextArea } from "@g1cloud/bluesea";
|
|
3
|
-
const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
|
|
4
|
-
const _hoisted_2 = { class: "label" };
|
|
5
|
-
const _hoisted_3 = ["textContent"];
|
|
6
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
-
__name: "PbPropertyEditorMultilineText",
|
|
8
|
-
props: {
|
|
9
|
-
property: {},
|
|
10
|
-
value: {}
|
|
11
|
-
},
|
|
12
|
-
emits: ["update-property-value"],
|
|
13
|
-
setup(__props, { emit: __emit }) {
|
|
14
|
-
const props = __props;
|
|
15
|
-
const emit = __emit;
|
|
16
|
-
const emitUpdatePropertyValue = (value) => {
|
|
17
|
-
const properties = {};
|
|
18
|
-
properties[props.property.propertyName] = value;
|
|
19
|
-
emit("update-property-value", properties);
|
|
20
|
-
};
|
|
21
|
-
return (_ctx, _cache) => {
|
|
22
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
23
|
-
createElementVNode("div", _hoisted_2, [
|
|
24
|
-
createElementVNode("label", {
|
|
25
|
-
textContent: toDisplayString(_ctx.property.caption)
|
|
26
|
-
}, null, 8, _hoisted_3)
|
|
27
|
-
]),
|
|
28
|
-
createElementVNode("div", null, [
|
|
29
|
-
createVNode(unref(BSTextArea), {
|
|
30
|
-
"model-value": _ctx.value,
|
|
31
|
-
height: "60px",
|
|
32
|
-
width: "100%",
|
|
33
|
-
"onUpdate:modelValue": emitUpdatePropertyValue
|
|
34
|
-
}, null, 8, ["model-value"])
|
|
35
|
-
])
|
|
36
|
-
]);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
export {
|
|
41
|
-
_sfc_main as default
|
|
42
|
-
};
|