@g1cloud/page-builder-editor 1.0.0-alpha.2 → 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.
@@ -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() {
@@ -6835,7 +6864,7 @@ let Model$1 = class Model {
6835
6864
  this.rootPart = ref(new RootPart());
6836
6865
  }
6837
6866
  };
6838
- const _hoisted_1$8$1 = ["data-model-id"];
6867
+ const _hoisted_1$7$1 = ["data-model-id"];
6839
6868
  const _hoisted_2$3$1 = {
6840
6869
  key: 1,
6841
6870
  class: "pb-nested-widget"
@@ -6870,11 +6899,11 @@ const _sfc_main$8$1 = /* @__PURE__ */ defineComponent({
6870
6899
  }, null, 8, ["part"]);
6871
6900
  }), 128))
6872
6901
  ])) : createCommentVNode("", true)
6873
- ], 16, _hoisted_1$8$1);
6902
+ ], 16, _hoisted_1$7$1);
6874
6903
  };
6875
6904
  }
6876
6905
  });
6877
- const _hoisted_1$7$1 = ["data-model-id"];
6906
+ const _hoisted_1$6$1 = ["data-model-id"];
6878
6907
  const _sfc_main$7$1 = /* @__PURE__ */ defineComponent({
6879
6908
  __name: "PbBlock",
6880
6909
  props: {
@@ -6898,11 +6927,11 @@ const _sfc_main$7$1 = /* @__PURE__ */ defineComponent({
6898
6927
  part: child
6899
6928
  }, null, 8, ["part"]);
6900
6929
  }), 128))
6901
- ], 16, _hoisted_1$7$1);
6930
+ ], 16, _hoisted_1$6$1);
6902
6931
  };
6903
6932
  }
6904
6933
  });
6905
- const _hoisted_1$6$1 = { class: "pb-block" };
6934
+ const _hoisted_1$5$1 = { class: "pb-block" };
6906
6935
  const _hoisted_2$2$1 = /* @__PURE__ */ createElementVNode("div", {
6907
6936
  class: "pb-widget",
6908
6937
  style: { "margin": "0 auto" }
@@ -6921,11 +6950,11 @@ const _sfc_main$6$1 = /* @__PURE__ */ defineComponent({
6921
6950
  },
6922
6951
  setup(__props) {
6923
6952
  return (_ctx, _cache) => {
6924
- return openBlock(), createElementBlock("div", _hoisted_1$6$1, _hoisted_3$2$1);
6953
+ return openBlock(), createElementBlock("div", _hoisted_1$5$1, _hoisted_3$2$1);
6925
6954
  };
6926
6955
  }
6927
6956
  });
6928
- const _hoisted_1$5$1 = ["data-model-id"];
6957
+ const _hoisted_1$4$1 = ["data-model-id"];
6929
6958
  const _sfc_main$5$1 = /* @__PURE__ */ defineComponent({
6930
6959
  __name: "PbSection",
6931
6960
  props: {
@@ -6951,11 +6980,11 @@ const _sfc_main$5$1 = /* @__PURE__ */ defineComponent({
6951
6980
  part: block
6952
6981
  }, null, 8, ["part"]);
6953
6982
  }), 128)) : createCommentVNode("", true)
6954
- ], 16, _hoisted_1$5$1);
6983
+ ], 16, _hoisted_1$4$1);
6955
6984
  };
6956
6985
  }
6957
6986
  });
6958
- const _hoisted_1$4$1 = { class: "pb-image-widget" };
6987
+ const _hoisted_1$3$1 = { class: "pb-image-widget" };
6959
6988
  const _hoisted_2$1$1 = ["src"];
6960
6989
  const _hoisted_3$1$1 = {
6961
6990
  key: 1,
@@ -6974,7 +7003,7 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
6974
7003
  setup(__props) {
6975
7004
  return (_ctx, _cache) => {
6976
7005
  var _a, _b;
6977
- return openBlock(), createElementBlock("div", _hoisted_1$4$1, [
7006
+ return openBlock(), createElementBlock("div", _hoisted_1$3$1, [
6978
7007
  ((_a = _ctx.part.properties) == null ? void 0 : _a.image) ? (openBlock(), createElementBlock("img", {
6979
7008
  key: 0,
6980
7009
  src: (_b = _ctx.part.properties) == null ? void 0 : _b.image,
@@ -6985,7 +7014,7 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
6985
7014
  };
6986
7015
  }
6987
7016
  });
6988
- const _hoisted_1$3$1 = ["textContent"];
7017
+ const _hoisted_1$2$1 = ["textContent"];
6989
7018
  const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
6990
7019
  __name: "PbTextWidget",
6991
7020
  props: {
@@ -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,13 +7045,12 @@ 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 && !((_a = _ctx.part.properties) == null ? void 0 : _a.text) ? "empty" : ""], "pb-text-widget"])
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(((_b = _ctx.part.properties) == null ? void 0 : _b.text) || (!_ctx.viewMode ? "Empty text" : " "))
7012
- }), null, 16, _hoisted_1$3$1)
7052
+ textContent: toDisplayString(text.value)
7053
+ }), null, 16, _hoisted_1$2$1)
7013
7054
  ], 2);
7014
7055
  };
7015
7056
  }
@@ -7048,7 +7089,7 @@ const PageBuilderViewerEvent = {
7048
7089
  }
7049
7090
  }
7050
7091
  };
7051
- const _hoisted_1$2$1 = { class: "pb-product-list-widget" };
7092
+ const _hoisted_1$1$1 = { class: "pb-product-list-widget" };
7052
7093
  const _hoisted_2$l = { class: "product" };
7053
7094
  const _hoisted_3$g = { class: "image" };
7054
7095
  const _hoisted_4$d = ["src"];
@@ -7090,7 +7131,7 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
7090
7131
  return (_a = props.part.properties) == null ? void 0 : _a.products;
7091
7132
  }, () => updateProducts());
7092
7133
  return (_ctx, _cache) => {
7093
- return openBlock(), createElementBlock("div", _hoisted_1$2$1, [
7134
+ return openBlock(), createElementBlock("div", _hoisted_1$1$1, [
7094
7135
  products.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(productCount.value, (index) => {
7095
7136
  return openBlock(), createElementBlock("div", {
7096
7137
  key: index,
@@ -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) => this.parsePartContent(child)).filter((part2) => !!part2);
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) {
@@ -7228,11 +7277,11 @@ const createPartComponent = (part) => {
7228
7277
  }
7229
7278
  };
7230
7279
  const getPartDefinition = (partName) => partDefinitions$1[partName];
7231
- const _hoisted_1$1$1 = { class: "pb-page-content" };
7232
7280
  const _sfc_main$1$1 = /* @__PURE__ */ defineComponent({
7233
7281
  __name: "PbPage",
7234
7282
  props: {
7235
- page: {}
7283
+ page: {},
7284
+ isMobilePage: { type: Boolean }
7236
7285
  },
7237
7286
  setup(__props) {
7238
7287
  const properties = computed(() => ({
@@ -7243,14 +7292,16 @@ const _sfc_main$1$1 = /* @__PURE__ */ defineComponent({
7243
7292
  return (_ctx, _cache) => {
7244
7293
  var _a;
7245
7294
  return openBlock(), createElementBlock("div", mergeProps({ class: "pb-page" }, properties.value), [
7246
- createElementVNode("div", _hoisted_1$1$1, [
7295
+ createElementVNode("div", {
7296
+ class: normalizeClass([[_ctx.isMobilePage ? "mobile" : "pc"], "pb-page-content"])
7297
+ }, [
7247
7298
  (openBlock(true), createElementBlock(Fragment, null, renderList((_a = _ctx.page) == null ? void 0 : _a.children, (section) => {
7248
7299
  return openBlock(), createBlock$1(_sfc_main$5$1, {
7249
7300
  key: section.partId,
7250
7301
  part: section
7251
7302
  }, null, 8, ["part"]);
7252
7303
  }), 128))
7253
- ])
7304
+ ], 2)
7254
7305
  ], 16);
7255
7306
  };
7256
7307
  }
@@ -7260,14 +7311,17 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
7260
7311
  __name: "PageBuilderViewer",
7261
7312
  props: {
7262
7313
  instanceId: {},
7263
- pageContent: {}
7314
+ pageContent: {},
7315
+ isMobilePage: { type: Boolean },
7316
+ language: {}
7264
7317
  },
7265
7318
  setup(__props) {
7266
7319
  const props = __props;
7267
7320
  const pageBuilderViewer = createPageBuilderViewer();
7268
7321
  pageBuilderViewer.instanceId = props.instanceId;
7322
+ pageBuilderViewer.language = props.language || "en";
7269
7323
  providePageBuilderViewer(pageBuilderViewer);
7270
- const page = computed(() => pageBuilderViewer.model.rootPart.value.children && pageBuilderViewer.model.rootPart.value.children[0]);
7324
+ const page = computed(() => pageBuilderViewer.model.rootPart.value.children && pageBuilderViewer.model.rootPart.value.children[props.isMobilePage ? 0 : 1]);
7271
7325
  onMounted(() => {
7272
7326
  if (props.pageContent) {
7273
7327
  pageBuilderViewer.render(props.pageContent);
@@ -7285,8 +7339,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
7285
7339
  return openBlock(), createElementBlock("div", _hoisted_1$u, [
7286
7340
  page.value ? (openBlock(), createBlock$1(_sfc_main$1$1, {
7287
7341
  key: 0,
7342
+ "is-mobile-page": _ctx.isMobilePage,
7288
7343
  page: page.value
7289
- }, null, 8, ["page"])) : createCommentVNode("", true)
7344
+ }, null, 8, ["is-mobile-page", "page"])) : createCommentVNode("", true)
7290
7345
  ]);
7291
7346
  };
7292
7347
  }
@@ -7409,10 +7464,16 @@ const syncProperties = (part, element) => {
7409
7464
  for (const name in attrs) {
7410
7465
  if (!RESERVED_ATTRIBUTES.includes(name)) {
7411
7466
  const value = attrs[name];
7412
- if (value)
7413
- part.properties[name] = value;
7414
- else
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 {
7415
7475
  delete part.properties[name];
7476
+ }
7416
7477
  }
7417
7478
  }
7418
7479
  for (const name in part.properties) {
@@ -7641,13 +7702,14 @@ class Model2 {
7641
7702
  if (element) {
7642
7703
  for (const name in param.properties) {
7643
7704
  if (!RESERVED_ATTRIBUTES.includes(name)) {
7644
- element.setAttribute(name, param.properties[name]);
7705
+ this.setElementAttribute(element, name, param.properties[name]);
7645
7706
  }
7646
7707
  }
7647
7708
  if (param.removeOtherAttributes) {
7648
7709
  const allAttributes = element.getAttributes();
7649
7710
  for (const name in allAttributes) {
7650
- if (!RESERVED_ATTRIBUTES.includes(name) && !param.properties.hasOwnProperty(name)) {
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)) {
7651
7713
  element.removeAttribute(name);
7652
7714
  }
7653
7715
  }
@@ -7680,7 +7742,7 @@ class Model2 {
7680
7742
  if (part.properties) {
7681
7743
  for (const name in part.properties) {
7682
7744
  if (!RESERVED_ATTRIBUTES.includes(name)) {
7683
- node.setAttribute(name, part.properties[name]);
7745
+ this.setElementAttribute(node, name, part.properties[name]);
7684
7746
  }
7685
7747
  }
7686
7748
  }
@@ -7692,6 +7754,23 @@ class Model2 {
7692
7754
  }
7693
7755
  return node;
7694
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
+ }
7695
7774
  getIndexOfElement(element) {
7696
7775
  if (element.parent instanceof YXmlElement) {
7697
7776
  let index = 0;
@@ -7733,7 +7812,7 @@ class Model2 {
7733
7812
  const properties = {};
7734
7813
  event.changes.keys.forEach((_, key) => {
7735
7814
  if (!RESERVED_ATTRIBUTES.includes(key)) {
7736
- properties[key] = element.getAttribute(key) || "";
7815
+ properties[key] = this.getElementAttribute(element, key) || "";
7737
7816
  }
7738
7817
  });
7739
7818
  (_a = result.updated) == null ? void 0 : _a.push({ element, properties });
@@ -7862,14 +7941,20 @@ const defaultPartPropertyEditors = () => {
7862
7941
  return {
7863
7942
  "readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-Bk0WJxA0.js")),
7864
7943
  "text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-DNdXl-Tr.js")),
7865
- "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-BMeNUGm8.js")),
7944
+ "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-CfRbKELF.js")),
7866
7945
  "select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-BJovN1su.js")),
7867
- "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-DA92v7AE.js")),
7868
- "product": () => defineAsyncComponent(() => import("./PbPropertyEditorProduct-CkydxTwD.js"))
7946
+ "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-EuqsavTF.js")),
7947
+ "product": () => defineAsyncComponent(() => import("./PbPropertyEditorProduct-COnCyYJl.js"))
7869
7948
  };
7870
7949
  };
7871
7950
  const getPropertyValueOfParts = (parts, propertyName) => {
7872
- const values = parts.map((part) => part.getProperty(propertyName) || "");
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
+ });
7873
7958
  const unique = values.filter((val, index) => values.indexOf(val) === index);
7874
7959
  return unique.length === 1 ? unique[0] : void 0;
7875
7960
  };
@@ -8854,12 +8939,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
8854
8939
  });
8855
8940
  const properties = computed(() => ({ style: props.part.getStyles() }));
8856
8941
  const disabled = computed(() => {
8857
- var _a, _b, _c;
8942
+ var _a;
8858
8943
  if (["static"].includes(((_a = props.part.properties) == null ? void 0 : _a.sectionType) || ""))
8859
8944
  return true;
8860
- if (pageBuilder.editMode === "local" && ["GlobalDesignPart"].includes(((_b = props.part.properties) == null ? void 0 : _b.sectionType) || ""))
8945
+ if (pageBuilder.editMode === "local" && props.part.isGlobalDesignPart())
8861
8946
  return true;
8862
- if (pageBuilder.editMode === "global" && ["LocalDesignPart", "LocalMarketingPart"].includes(((_c = props.part.properties) == null ? void 0 : _c.sectionType) || ""))
8947
+ if (pageBuilder.editMode === "global" && (props.part.isLocalDesignPart() || props.part.isLocalMarketingPart()))
8863
8948
  return true;
8864
8949
  return false;
8865
8950
  });
@@ -11140,7 +11225,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
11140
11225
  const emptyColor = () => {
11141
11226
  };
11142
11227
  const borderLeftWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderLeftWidth"));
11143
- const borderRightWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderRigthWidth"));
11228
+ const borderRightWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderRightWidth"));
11144
11229
  const borderTopWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderTopWidth"));
11145
11230
  const borderBottomWidth = computed(() => getPropertyValueOfParts(props.selectedParts, "borderBottomWidth"));
11146
11231
  const borderTopLeftRadius = computed(() => getPropertyValueOfParts(props.selectedParts, "borderTopLeftRadius"));
@@ -13043,6 +13128,8 @@ class PageBuilderEditorImpl {
13043
13128
  __publicField(this, "title");
13044
13129
  __publicField(this, "editMode");
13045
13130
  __publicField(this, "scale", ref(1));
13131
+ __publicField(this, "locales", ref(["en"]));
13132
+ __publicField(this, "language", ref("en"));
13046
13133
  this.model = new Model2();
13047
13134
  this.context = new PageBuilderContextImpl(this);
13048
13135
  this.editMode = "free";
@@ -13067,6 +13154,7 @@ class PageBuilderEditorImpl {
13067
13154
  }
13068
13155
  initData(content) {
13069
13156
  this.model.rootPart.pageBuilderId = this.instanceId;
13157
+ this.model.rootPart.language = this.language.value;
13070
13158
  let parts;
13071
13159
  if (content) {
13072
13160
  for (const p of content) {
@@ -13101,6 +13189,15 @@ class PageBuilderEditorImpl {
13101
13189
  zoom(scale) {
13102
13190
  this.scale.value = scale;
13103
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
+ }
13104
13201
  getEmptyPageContent() {
13105
13202
  const block = new Block();
13106
13203
  const section = new Section();
@@ -13355,6 +13452,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
13355
13452
  setup(__props) {
13356
13453
  const pageBuilder = usePageBuilderEditor();
13357
13454
  const buttonGroups = pageBuilder.toolButtonRegistry.getToolButtonGroups();
13455
+ const locales = computed(() => {
13456
+ return pageBuilder.locales.value;
13457
+ });
13358
13458
  const scale = computed(() => `${Math.round(100 * pageBuilder.scale.value)}%`);
13359
13459
  const zoom = async (scaleString) => {
13360
13460
  if (!scaleString)
@@ -13362,7 +13462,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
13362
13462
  const scale2 = parseInt(scaleString.replaceAll(/[^0-9]+/g, "")) / 100;
13363
13463
  pageBuilder.zoom(scale2);
13364
13464
  };
13365
- const lang = ref("English");
13465
+ const changeLocale = (locale) => {
13466
+ pageBuilder.setLanguage(locale);
13467
+ };
13366
13468
  return (_ctx, _cache) => {
13367
13469
  return openBlock(), createElementBlock("div", _hoisted_1$7, [
13368
13470
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttonGroups), (group) => {
@@ -13384,13 +13486,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
13384
13486
  }, null, 8, ["modelValue"])
13385
13487
  ]),
13386
13488
  createElementVNode("div", _hoisted_3$1, [
13387
- createVNode(unref(BSSelect), {
13388
- modelValue: lang.value,
13389
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => lang.value = $event),
13390
- items: ["English", "日本語", "한국어"],
13391
- "view-mode": false,
13392
- placeholder: "English"
13393
- }, null, 8, ["modelValue"])
13489
+ createVNode(unref(BSLocaleSelect), {
13490
+ locales: locales.value,
13491
+ onChangeLocale: changeLocale
13492
+ }, null, 8, ["locales"])
13394
13493
  ])
13395
13494
  ]);
13396
13495
  };
@@ -13598,13 +13697,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
13598
13697
  const props = __props;
13599
13698
  const pageBuilder = usePageBuilderEditor();
13600
13699
  const propertyEditor = computed(() => {
13601
- var _a, _b, _c, _d;
13700
+ var _a;
13602
13701
  if (pageBuilder.editMode === "local" && props.selectedParts.length > 0) {
13603
13702
  const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
13604
- if (section && ["GlobalDesignPart"].includes(((_a = section.properties) == null ? void 0 : _a.sectionType) || "")) {
13703
+ if (section && section.isGlobalDesignPart()) {
13605
13704
  return;
13606
13705
  }
13607
- if (section && ["LocalDesignPart", "LocalMarketingPart"].includes(((_b = section.properties) == null ? void 0 : _b.sectionType) || "")) {
13706
+ if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
13608
13707
  if (!props.property.localized) {
13609
13708
  return;
13610
13709
  }
@@ -13612,7 +13711,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
13612
13711
  }
13613
13712
  if (pageBuilder.editMode === "template" && props.selectedParts.length > 0) {
13614
13713
  const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
13615
- if (section && ["LocalDesignPart", "LocalMarketingPart"].includes(((_c = section.properties) == null ? void 0 : _c.sectionType) || "")) {
13714
+ if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
13616
13715
  if (props.property.localized) {
13617
13716
  return;
13618
13717
  }
@@ -13623,7 +13722,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
13623
13722
  if (editor)
13624
13723
  return editor;
13625
13724
  }
13626
- return (_d = pageBuilder.partManager.getPartPropertyEditor(props.property.propertyType)) == null ? void 0 : _d(props.property, props.selectedParts);
13725
+ return (_a = pageBuilder.partManager.getPartPropertyEditor(props.property.propertyType)) == null ? void 0 : _a(props.property, props.selectedParts);
13627
13726
  });
13628
13727
  const value = computed(() => getPropertyValueOfParts(props.selectedParts, props.property.propertyName));
13629
13728
  const updatePropertyValue = (properties) => {
@@ -13656,13 +13755,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13656
13755
  const props = __props;
13657
13756
  const pageBuilder = usePageBuilderEditor();
13658
13757
  const groupEditor = computed(() => {
13659
- var _a, _b, _c, _d, _e;
13758
+ var _a, _b;
13660
13759
  if (pageBuilder.editMode === "local" && props.selectedParts.length > 0) {
13661
13760
  const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
13662
- if (section && ["GlobalDesignPart"].includes(((_a = section.properties) == null ? void 0 : _a.sectionType) || "")) {
13761
+ if (section && section.isGlobalDesignPart()) {
13663
13762
  return;
13664
13763
  }
13665
- if (section && ["LocalDesignPart", "LocalMarketingPart"].includes(((_b = section.properties) == null ? void 0 : _b.sectionType) || "")) {
13764
+ if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
13666
13765
  if (!props.group.localized) {
13667
13766
  return;
13668
13767
  }
@@ -13670,13 +13769,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13670
13769
  }
13671
13770
  if (pageBuilder.editMode === "template" && props.selectedParts.length > 0) {
13672
13771
  const section = pageBuilder.partManager.findNearestSection(props.selectedParts[0]);
13673
- if (section && ["LocalDesignPart", "LocalMarketingPart"].includes(((_c = section.properties) == null ? void 0 : _c.sectionType) || "")) {
13772
+ if (section && (section.isLocalDesignPart() || section.isLocalMarketingPart())) {
13674
13773
  if (props.group.localized) {
13675
13774
  return;
13676
13775
  }
13677
13776
  }
13678
13777
  }
13679
- return (_e = (_d = props.group).propertyGroupEditor) == null ? void 0 : _e.call(_d, props.group, props.selectedParts);
13778
+ return (_b = (_a = props.group).propertyGroupEditor) == null ? void 0 : _b.call(_a, props.group, props.selectedParts);
13680
13779
  });
13681
13780
  return (_ctx, _cache) => {
13682
13781
  return openBlock(), createElementBlock("div", _hoisted_1$4, [
@@ -13817,16 +13916,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
13817
13916
  }
13818
13917
  });
13819
13918
  const showLocalMarketingPart = computed(() => {
13820
- var _a;
13821
13919
  if (pageBuilder.editMode === "template")
13822
13920
  return false;
13823
13921
  if (!selectedParts.length || selectedParts.length !== 1)
13824
13922
  return false;
13825
13923
  const part = selectedParts[0];
13826
- if (part.isSection() && ((_a = part.properties) == null ? void 0 : _a.sectionType) === "LocalMarketingPart") {
13827
- return true;
13828
- }
13829
- return false;
13924
+ return part.isLocalMarketingPart();
13830
13925
  });
13831
13926
  return (_ctx, _cache) => {
13832
13927
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
@@ -13868,7 +13963,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13868
13963
  instanceId: {},
13869
13964
  title: {},
13870
13965
  editMode: {},
13871
- pageContent: {}
13966
+ pageContent: {},
13967
+ locales: {},
13968
+ language: {}
13872
13969
  },
13873
13970
  setup(__props, { expose: __expose }) {
13874
13971
  const props = __props;
@@ -13877,6 +13974,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13877
13974
  pageBuilderEditor.instanceId = props.instanceId;
13878
13975
  pageBuilderEditor.title = props.title;
13879
13976
  pageBuilderEditor.editMode = props.editMode || "free";
13977
+ if (props.locales)
13978
+ pageBuilderEditor.setLocales(props.locales);
13979
+ if (props.language)
13980
+ pageBuilderEditor.setLanguage(props.language);
13880
13981
  pageBuilderEditor.registerPlugin({
13881
13982
  // TODO
13882
13983
  commands: createDefaultCommands(modal)
@@ -13895,9 +13996,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13895
13996
  return content;
13896
13997
  };
13897
13998
  const doGetLocalDesignPartContent = (part) => {
13898
- var _a;
13899
13999
  let content;
13900
- if (((_a = part.properties) == null ? void 0 : _a.sectionType) && ["LocalDesignPart", "LocalMarketingPart"].includes(part.properties.sectionType)) {
14000
+ if (part.isGlobalDesignPart() || part.isLocalMarketingPart()) {
13901
14001
  const properties = getLocalDesignPartProperties(part);
13902
14002
  if (properties) {
13903
14003
  if (!content)
@@ -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, string> | undefined;
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) => string | undefined;
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, string> | undefined;
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) => string | undefined;
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, string> | undefined;
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) => string | undefined;
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 = {