@g1cloud/page-builder-editor 1.0.0-alpha.15 → 1.0.0-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7021,7 +7021,7 @@ var __publicField = (obj, key, value) => {
7021
7021
  class: "empty"
7022
7022
  };
7023
7023
  const _hoisted_4$i = /* @__PURE__ */ vue.createElementVNode("span", { class: "font-icon" }, "image", -1);
7024
- const _hoisted_5$8 = [
7024
+ const _hoisted_5$9 = [
7025
7025
  _hoisted_4$i
7026
7026
  ];
7027
7027
  const _sfc_main$5$1 = /* @__PURE__ */ vue.defineComponent({
@@ -7039,7 +7039,7 @@ var __publicField = (obj, key, value) => {
7039
7039
  src: (_b = _ctx.part.properties) == null ? void 0 : _b.image,
7040
7040
  alt: "",
7041
7041
  class: "image"
7042
- }, null, 8, _hoisted_2$1$1)) : !_ctx.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$s, _hoisted_5$8)) : vue.createCommentVNode("", true)
7042
+ }, null, 8, _hoisted_2$1$1)) : !_ctx.viewMode ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$s, _hoisted_5$9)) : vue.createCommentVNode("", true)
7043
7043
  ]);
7044
7044
  };
7045
7045
  }
@@ -7225,15 +7225,25 @@ ${_html.style}
7225
7225
  registerCustomPlugin(plugin) {
7226
7226
  if (plugin.widgets) {
7227
7227
  plugin.widgets.forEach((v) => {
7228
- partDefinitions$1[v.partName] = {
7229
- partType: "Widget",
7230
- partName: v.partName,
7231
- creator: () => _sfc_main$B,
7232
- component: v.component
7233
- };
7228
+ const w = { ...v };
7229
+ w.partType = "Widget";
7230
+ w.creator = () => _sfc_main$B;
7231
+ partDefinitions$1[v.partName] = w;
7234
7232
  });
7235
7233
  }
7236
7234
  }
7235
+ watchCustomWidgetData(part) {
7236
+ const def = partDefinitions$1[part.partName];
7237
+ if (!def || !def.dataWatcher)
7238
+ return false;
7239
+ return def.dataWatcher(part.properties);
7240
+ }
7241
+ provideCustomWidgetData(part) {
7242
+ const def = partDefinitions$1[part.partName];
7243
+ if (!def || !def.dataProvider)
7244
+ return Promise.resolve();
7245
+ return def.dataProvider(part.properties);
7246
+ }
7237
7247
  render(pageContent) {
7238
7248
  const rootPart = new RootPart();
7239
7249
  rootPart.pageBuilderId = this.instanceId;
@@ -7396,17 +7406,28 @@ ${_html.style}
7396
7406
  __name: "PbCustomWidget",
7397
7407
  props: {
7398
7408
  part: {},
7399
- viewMode: { type: Boolean, default: false }
7409
+ dataWatcher: { type: Function },
7410
+ dataProvider: { type: Function }
7400
7411
  },
7401
7412
  setup(__props) {
7402
7413
  const props = __props;
7403
7414
  const pageBuilder = usePageBuilder();
7404
7415
  const comp = vue.computed(() => pageBuilder.getCustomWidgetComponent(props.part));
7416
+ const data = vue.ref({});
7405
7417
  const bind = vue.computed(() => ({
7406
7418
  pageBuilderId: pageBuilder.instanceId,
7407
- properties: props.part.properties,
7408
- placeholder: true
7419
+ ...props.part.properties || {},
7420
+ placeholder: true,
7421
+ ...data.value || {}
7409
7422
  }));
7423
+ const updateData = async () => {
7424
+ data.value = await pageBuilder.provideCustomWidgetData(props.part);
7425
+ };
7426
+ vue.onMounted(updateData);
7427
+ vue.watch(
7428
+ () => pageBuilder.watchCustomWidgetData(props.part),
7429
+ () => updateData()
7430
+ );
7410
7431
  return (_ctx, _cache) => {
7411
7432
  return comp.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(comp.value), vue.normalizeProps(vue.mergeProps({ key: 0 }, bind.value)), null, 16)) : vue.createCommentVNode("", true);
7412
7433
  };
@@ -7938,20 +7959,6 @@ ${_html.style}
7938
7959
  }
7939
7960
  }
7940
7961
  }
7941
- getLocalDesignPartPropertyDefinitions(partName) {
7942
- let properties;
7943
- const partDef = this.getPartDefinition(partName);
7944
- if (!partDef || !partDef.propertyGroups)
7945
- return;
7946
- for (const group of partDef.propertyGroups) {
7947
- for (const property of group.properties) {
7948
- if (property.localized) {
7949
- properties = [...properties || [], property];
7950
- }
7951
- }
7952
- }
7953
- return properties;
7954
- }
7955
7962
  createPartComponent(part) {
7956
7963
  if (part) {
7957
7964
  const def = this.getPartDefinition(part.partName);
@@ -9150,10 +9157,10 @@ ${_html.style}
9150
9157
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Position" })
9151
9158
  ], -1);
9152
9159
  const _hoisted_4$g = { class: "flex-grow-1" };
9153
- const _hoisted_5$7 = { class: "bg-gray-100 py-5 rounded-8" };
9154
- const _hoisted_6$6 = { class: "text-center" };
9155
- const _hoisted_7$5 = { class: "bs-layout-horizontal justify-content-center align-items-center" };
9156
- const _hoisted_8$5 = /* @__PURE__ */ vue.createElementVNode("div", {
9160
+ const _hoisted_5$8 = { class: "bg-gray-100 py-5 rounded-8" };
9161
+ const _hoisted_6$7 = { class: "text-center" };
9162
+ const _hoisted_7$6 = { class: "bs-layout-horizontal justify-content-center align-items-center" };
9163
+ const _hoisted_8$6 = /* @__PURE__ */ vue.createElementVNode("div", {
9157
9164
  class: "d-inline-block text-center text-gray-300",
9158
9165
  style: { "width": "30%", "font-size": "12px" }
9159
9166
  }, [
@@ -9188,8 +9195,8 @@ ${_html.style}
9188
9195
  vue.createElementVNode("div", _hoisted_2$r, [
9189
9196
  _hoisted_3$p,
9190
9197
  vue.createElementVNode("div", _hoisted_4$g, [
9191
- vue.createElementVNode("div", _hoisted_5$7, [
9192
- vue.createElementVNode("div", _hoisted_6$6, [
9198
+ vue.createElementVNode("div", _hoisted_5$8, [
9199
+ vue.createElementVNode("div", _hoisted_6$7, [
9193
9200
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
9194
9201
  "model-value": top.value,
9195
9202
  class: "ml-4",
@@ -9198,7 +9205,7 @@ ${_html.style}
9198
9205
  "onUpdate:modelValue": updateTop
9199
9206
  }, null, 8, ["model-value"])
9200
9207
  ]),
9201
- vue.createElementVNode("div", _hoisted_7$5, [
9208
+ vue.createElementVNode("div", _hoisted_7$6, [
9202
9209
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
9203
9210
  "model-value": left.value,
9204
9211
  class: "ml-4",
@@ -9206,7 +9213,7 @@ ${_html.style}
9206
9213
  width: "30%",
9207
9214
  "onUpdate:modelValue": updateLeft
9208
9215
  }, null, 8, ["model-value"]),
9209
- _hoisted_8$5,
9216
+ _hoisted_8$6,
9210
9217
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
9211
9218
  "model-value": right.value,
9212
9219
  class: "ml-4",
@@ -10979,13 +10986,13 @@ ${_html.style}
10979
10986
  const _hoisted_2$l = { class: "vc-sketch-controls" };
10980
10987
  const _hoisted_3$j = { class: "vc-sketch-sliders" };
10981
10988
  const _hoisted_4$b = { class: "vc-sketch-hue-wrap" };
10982
- const _hoisted_5$6 = {
10989
+ const _hoisted_5$7 = {
10983
10990
  key: 0,
10984
10991
  class: "vc-sketch-alpha-wrap"
10985
10992
  };
10986
- const _hoisted_6$5 = { class: "vc-sketch-color-wrap" };
10987
- const _hoisted_7$4 = ["aria-label"];
10988
- const _hoisted_8$4 = {
10993
+ const _hoisted_6$6 = { class: "vc-sketch-color-wrap" };
10994
+ const _hoisted_7$5 = ["aria-label"];
10995
+ const _hoisted_8$5 = {
10989
10996
  key: 0,
10990
10997
  class: "vc-sketch-field"
10991
10998
  };
@@ -11032,23 +11039,23 @@ ${_html.style}
11032
11039
  onChange: $options.childChange
11033
11040
  }, null, 8, ["value", "onChange"])
11034
11041
  ]),
11035
- !$props.disableAlpha ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$6, [
11042
+ !$props.disableAlpha ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$7, [
11036
11043
  vue.createVNode(_component_Alpha, {
11037
11044
  value: _ctx.colors,
11038
11045
  onChange: $options.childChange
11039
11046
  }, null, 8, ["value", "onChange"])
11040
11047
  ])) : vue.createCommentVNode("v-if", true)
11041
11048
  ]),
11042
- vue.createElementVNode("div", _hoisted_6$5, [
11049
+ vue.createElementVNode("div", _hoisted_6$6, [
11043
11050
  vue.createElementVNode("div", {
11044
11051
  "aria-label": `Current color is ${$options.activeColor}`,
11045
11052
  class: "vc-sketch-active-color",
11046
11053
  style: vue.normalizeStyle({ background: $options.activeColor })
11047
- }, null, 12, _hoisted_7$4),
11054
+ }, null, 12, _hoisted_7$5),
11048
11055
  vue.createVNode(_component_Checkboard)
11049
11056
  ])
11050
11057
  ]),
11051
- !$props.disableFields ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$4, [
11058
+ !$props.disableFields ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$5, [
11052
11059
  vue.createCommentVNode(" rgba "),
11053
11060
  vue.createElementVNode("div", _hoisted_9$4, [
11054
11061
  vue.createVNode(_component_EdIn, {
@@ -11241,7 +11248,7 @@ ${_html.style}
11241
11248
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Background" })
11242
11249
  ], -1);
11243
11250
  const _hoisted_4$9 = { class: "bs-layout-horizontal" };
11244
- const _hoisted_5$5 = { class: "color" };
11251
+ const _hoisted_5$6 = { class: "color" };
11245
11252
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
11246
11253
  __name: "PbPropertyGroupEditorBackground",
11247
11254
  props: {
@@ -11276,7 +11283,7 @@ ${_html.style}
11276
11283
  vue.createElementVNode("div", _hoisted_2$j, [
11277
11284
  _hoisted_3$h,
11278
11285
  vue.createElementVNode("div", _hoisted_4$9, [
11279
- vue.createElementVNode("div", _hoisted_5$5, [
11286
+ vue.createElementVNode("div", _hoisted_5$6, [
11280
11287
  vue.createVNode(PbColorPicker, {
11281
11288
  value: color.value,
11282
11289
  "hide-delete": "",
@@ -11311,12 +11318,12 @@ ${_html.style}
11311
11318
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Border" })
11312
11319
  ], -1);
11313
11320
  const _hoisted_4$8 = { class: "" };
11314
- const _hoisted_5$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "sub-title" }, [
11321
+ const _hoisted_5$5 = /* @__PURE__ */ vue.createElementVNode("div", { class: "sub-title" }, [
11315
11322
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Color" })
11316
11323
  ], -1);
11317
- const _hoisted_6$4 = { class: "color" };
11318
- const _hoisted_7$3 = { class: "mt-8" };
11319
- const _hoisted_8$3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "sub-title" }, [
11324
+ const _hoisted_6$5 = { class: "color" };
11325
+ const _hoisted_7$4 = { class: "mt-8" };
11326
+ const _hoisted_8$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "sub-title" }, [
11320
11327
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Border Width" })
11321
11328
  ], -1);
11322
11329
  const _hoisted_9$3 = { class: "flex-grow-1 mt-4" };
@@ -11380,8 +11387,8 @@ ${_html.style}
11380
11387
  vue.createElementVNode("div", _hoisted_2$i, [
11381
11388
  _hoisted_3$g,
11382
11389
  vue.createElementVNode("div", _hoisted_4$8, [
11383
- _hoisted_5$4,
11384
- vue.createElementVNode("div", _hoisted_6$4, [
11390
+ _hoisted_5$5,
11391
+ vue.createElementVNode("div", _hoisted_6$5, [
11385
11392
  vue.createVNode(PbColorPicker, {
11386
11393
  value: color.value,
11387
11394
  "hide-delete": "",
@@ -11399,8 +11406,8 @@ ${_html.style}
11399
11406
  }, null, 8, ["model-value"])
11400
11407
  ])
11401
11408
  ]),
11402
- vue.createElementVNode("div", _hoisted_7$3, [
11403
- _hoisted_8$3,
11409
+ vue.createElementVNode("div", _hoisted_7$4, [
11410
+ _hoisted_8$4,
11404
11411
  vue.createElementVNode("div", _hoisted_9$3, [
11405
11412
  vue.createElementVNode("div", _hoisted_10$1, [
11406
11413
  vue.createElementVNode("div", _hoisted_11$1, [
@@ -11491,10 +11498,10 @@ ${_html.style}
11491
11498
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Margin" })
11492
11499
  ], -1);
11493
11500
  const _hoisted_4$7 = { class: "flex-grow-1" };
11494
- const _hoisted_5$3 = { class: "bg-gray-100 py-5 rounded-8" };
11495
- const _hoisted_6$3 = { class: "text-center" };
11496
- const _hoisted_7$2 = { class: "bs-layout-horizontal justify-content-center align-items-center" };
11497
- const _hoisted_8$2 = /* @__PURE__ */ vue.createElementVNode("div", {
11501
+ const _hoisted_5$4 = { class: "bg-gray-100 py-5 rounded-8" };
11502
+ const _hoisted_6$4 = { class: "text-center" };
11503
+ const _hoisted_7$3 = { class: "bs-layout-horizontal justify-content-center align-items-center" };
11504
+ const _hoisted_8$3 = /* @__PURE__ */ vue.createElementVNode("div", {
11498
11505
  class: "d-inline-block text-center text-gray-300",
11499
11506
  style: { "width": "30%", "font-size": "12px" }
11500
11507
  }, [
@@ -11529,8 +11536,8 @@ ${_html.style}
11529
11536
  vue.createElementVNode("div", _hoisted_2$h, [
11530
11537
  _hoisted_3$f,
11531
11538
  vue.createElementVNode("div", _hoisted_4$7, [
11532
- vue.createElementVNode("div", _hoisted_5$3, [
11533
- vue.createElementVNode("div", _hoisted_6$3, [
11539
+ vue.createElementVNode("div", _hoisted_5$4, [
11540
+ vue.createElementVNode("div", _hoisted_6$4, [
11534
11541
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
11535
11542
  "model-value": top.value,
11536
11543
  class: "ml-4",
@@ -11539,7 +11546,7 @@ ${_html.style}
11539
11546
  "onUpdate:modelValue": updateTop
11540
11547
  }, null, 8, ["model-value"])
11541
11548
  ]),
11542
- vue.createElementVNode("div", _hoisted_7$2, [
11549
+ vue.createElementVNode("div", _hoisted_7$3, [
11543
11550
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
11544
11551
  "model-value": left.value,
11545
11552
  class: "ml-4",
@@ -11547,7 +11554,7 @@ ${_html.style}
11547
11554
  width: "30%",
11548
11555
  "onUpdate:modelValue": updateLeft
11549
11556
  }, null, 8, ["model-value"]),
11550
- _hoisted_8$2,
11557
+ _hoisted_8$3,
11551
11558
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
11552
11559
  "model-value": right.value,
11553
11560
  class: "ml-4",
@@ -11578,10 +11585,10 @@ ${_html.style}
11578
11585
  /* @__PURE__ */ vue.createElementVNode("label", { textContent: "Padding" })
11579
11586
  ], -1);
11580
11587
  const _hoisted_4$6 = { class: "flex-grow-1" };
11581
- const _hoisted_5$2 = { class: "bg-gray-100 py-5 rounded-8" };
11582
- const _hoisted_6$2 = { class: "text-center" };
11583
- const _hoisted_7$1 = { class: "bs-layout-horizontal justify-content-center align-items-center" };
11584
- const _hoisted_8$1 = /* @__PURE__ */ vue.createElementVNode("div", {
11588
+ const _hoisted_5$3 = { class: "bg-gray-100 py-5 rounded-8" };
11589
+ const _hoisted_6$3 = { class: "text-center" };
11590
+ const _hoisted_7$2 = { class: "bs-layout-horizontal justify-content-center align-items-center" };
11591
+ const _hoisted_8$2 = /* @__PURE__ */ vue.createElementVNode("div", {
11585
11592
  class: "d-inline-block text-center text-gray-300",
11586
11593
  style: { "width": "30%", "font-size": "12px" }
11587
11594
  }, [
@@ -11616,8 +11623,8 @@ ${_html.style}
11616
11623
  vue.createElementVNode("div", _hoisted_2$g, [
11617
11624
  _hoisted_3$e,
11618
11625
  vue.createElementVNode("div", _hoisted_4$6, [
11619
- vue.createElementVNode("div", _hoisted_5$2, [
11620
- vue.createElementVNode("div", _hoisted_6$2, [
11626
+ vue.createElementVNode("div", _hoisted_5$3, [
11627
+ vue.createElementVNode("div", _hoisted_6$3, [
11621
11628
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
11622
11629
  "model-value": top.value,
11623
11630
  class: "ml-4",
@@ -11626,7 +11633,7 @@ ${_html.style}
11626
11633
  "onUpdate:modelValue": updateTop
11627
11634
  }, null, 8, ["model-value"])
11628
11635
  ]),
11629
- vue.createElementVNode("div", _hoisted_7$1, [
11636
+ vue.createElementVNode("div", _hoisted_7$2, [
11630
11637
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
11631
11638
  "model-value": left.value,
11632
11639
  class: "ml-4",
@@ -11634,7 +11641,7 @@ ${_html.style}
11634
11641
  width: "30%",
11635
11642
  "onUpdate:modelValue": updateLeft
11636
11643
  }, null, 8, ["model-value"]),
11637
- _hoisted_8$1,
11644
+ _hoisted_8$2,
11638
11645
  vue.createVNode(vue.unref(bluesea.BSTextInput), {
11639
11646
  "model-value": right.value,
11640
11647
  class: "ml-4",
@@ -11998,7 +12005,7 @@ ${_html.style}
11998
12005
  {
11999
12006
  partType: "Widget",
12000
12007
  partName: "TextWidget",
12001
- caption: "Text Widget",
12008
+ caption: "Text",
12002
12009
  icon: "insert_text",
12003
12010
  propertyGroups: [
12004
12011
  {
@@ -12041,7 +12048,7 @@ ${_html.style}
12041
12048
  {
12042
12049
  partType: "Widget",
12043
12050
  partName: "ImageWidget",
12044
- caption: "Image Widget",
12051
+ caption: "Image",
12045
12052
  icon: "imagesmode",
12046
12053
  propertyGroups: [
12047
12054
  {
@@ -12067,7 +12074,7 @@ ${_html.style}
12067
12074
  {
12068
12075
  partType: "Widget",
12069
12076
  partName: "HtmlWidget",
12070
- caption: "HTML Widget",
12077
+ caption: "HTML",
12071
12078
  icon: "code",
12072
12079
  propertyGroups: [
12073
12080
  {
@@ -12122,6 +12129,13 @@ ${_html.style}
12122
12129
  ]
12123
12130
  }
12124
12131
  ];
12132
+ const widgetPartDefinitions = [
12133
+ {
12134
+ groupName: "Widget",
12135
+ caption: "Widget",
12136
+ partDefinitions: widgets
12137
+ }
12138
+ ];
12125
12139
  const blockWidgetPartDefinitions = [
12126
12140
  {
12127
12141
  groupName: "Block",
@@ -12315,6 +12329,36 @@ ${_html.style}
12315
12329
  };
12316
12330
  __publicField(_AddPartCommand, "COMMAND_ID", "AddPart");
12317
12331
  let AddPartCommand = _AddPartCommand;
12332
+ const _AddSectionCommand = class _AddSectionCommand {
12333
+ constructor(modal) {
12334
+ __publicField(this, "commandId", _AddSectionCommand.COMMAND_ID);
12335
+ __publicField(this, "caption", "Add Section");
12336
+ this.modal = modal;
12337
+ }
12338
+ execute(pageBuilder, args) {
12339
+ const def = pageBuilder.partManager.getSectionDefinition();
12340
+ if (!def)
12341
+ return;
12342
+ addPart(pageBuilder, def);
12343
+ }
12344
+ };
12345
+ __publicField(_AddSectionCommand, "COMMAND_ID", "AddSection");
12346
+ let AddSectionCommand = _AddSectionCommand;
12347
+ const _AddBlockCommand = class _AddBlockCommand {
12348
+ constructor(modal) {
12349
+ __publicField(this, "commandId", _AddBlockCommand.COMMAND_ID);
12350
+ __publicField(this, "caption", "Add Block");
12351
+ this.modal = modal;
12352
+ }
12353
+ execute(pageBuilder, args) {
12354
+ const def = pageBuilder.partManager.getBlockDefinition();
12355
+ if (!def)
12356
+ return;
12357
+ addPart(pageBuilder, def);
12358
+ }
12359
+ };
12360
+ __publicField(_AddBlockCommand, "COMMAND_ID", "AddBlock");
12361
+ let AddBlockCommand = _AddBlockCommand;
12318
12362
  const addPart = (pageBuilder, def, attrs) => {
12319
12363
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12320
12364
  const selected = pageBuilder.context.getSelectedParts()[0];
@@ -12403,29 +12447,13 @@ ${_html.style}
12403
12447
  }
12404
12448
  };
12405
12449
  const addSectionBefore = (pageBuilder, modal, args) => {
12406
- const def = args && args.partDefinition;
12407
- if (!def) {
12408
- const partDefinitionGroups = designPartDefinitions;
12409
- openPartAddModal(modal, {
12410
- ...args || {},
12411
- pageBuilder,
12412
- partDefinitionGroups
12413
- }, (part, attrs) => {
12414
- addSectionBefore(pageBuilder, modal, {
12415
- ...args || {},
12416
- partDefinition: part,
12417
- ...attrs || {}
12418
- });
12419
- });
12420
- return;
12421
- }
12422
12450
  const selected = pageBuilder.context.getSelectedParts()[0];
12423
12451
  if (!selected)
12424
12452
  return;
12425
12453
  const section = pageBuilder.partManager.findNearestSection(selected);
12426
12454
  if (!section || !section.parent || !section.parent.children)
12427
12455
  return;
12428
- const newSection = createPartWithDefinition(def);
12456
+ const newSection = createSection(pageBuilder);
12429
12457
  if (!newSection)
12430
12458
  return;
12431
12459
  const child = createBlock(pageBuilder);
@@ -12434,29 +12462,13 @@ ${_html.style}
12434
12462
  insertParts(pageBuilder, section.parent.partId, index, [newSection], true);
12435
12463
  };
12436
12464
  const addSectionAfter = (pageBuilder, modal, args) => {
12437
- const def = args && args.partDefinition;
12438
- if (!def) {
12439
- const partDefinitionGroups = designPartDefinitions;
12440
- openPartAddModal(modal, {
12441
- ...args || {},
12442
- pageBuilder,
12443
- partDefinitionGroups
12444
- }, (part, attrs) => {
12445
- addSectionAfter(pageBuilder, modal, {
12446
- ...args || {},
12447
- partDefinition: part,
12448
- ...attrs || {}
12449
- });
12450
- });
12451
- return;
12452
- }
12453
12465
  const selected = pageBuilder.context.getSelectedParts()[0];
12454
12466
  if (!selected)
12455
12467
  return;
12456
12468
  const section = pageBuilder.partManager.findNearestSection(selected);
12457
12469
  if (!section || !section.parent || !section.parent.children)
12458
12470
  return;
12459
- const newSection = createPartWithDefinition(def);
12471
+ const newSection = createSection(pageBuilder);
12460
12472
  if (!newSection)
12461
12473
  return;
12462
12474
  const child = createBlock(pageBuilder);
@@ -12579,7 +12591,7 @@ ${_html.style}
12579
12591
  this.modal = modal;
12580
12592
  }
12581
12593
  execute(pageBuilder, args) {
12582
- addSectionBefore(pageBuilder, this.modal, args);
12594
+ addSectionBefore(pageBuilder, this.modal);
12583
12595
  }
12584
12596
  };
12585
12597
  __publicField(_AddSectionAboveCommand, "COMMAND_ID", "AddSectionAbove");
@@ -12592,7 +12604,7 @@ ${_html.style}
12592
12604
  this.modal = modal;
12593
12605
  }
12594
12606
  execute(pageBuilder, args) {
12595
- addSectionAfter(pageBuilder, this.modal, args);
12607
+ addSectionAfter(pageBuilder, this.modal);
12596
12608
  }
12597
12609
  };
12598
12610
  __publicField(_AddSectionBelowCommand, "COMMAND_ID", "AddSectionBelow");
@@ -12804,6 +12816,8 @@ ${_html.style}
12804
12816
  new OpenAddPartModalCommand(modal),
12805
12817
  new OpenAddWidgetModalCommand(modal),
12806
12818
  new AddPartCommand(modal),
12819
+ new AddSectionCommand(modal),
12820
+ new AddBlockCommand(modal),
12807
12821
  new AddSectionAboveCommand(modal),
12808
12822
  new AddSectionBelowCommand(modal),
12809
12823
  new AddBlockLeftCommand(),
@@ -13096,14 +13110,20 @@ ${_html.style}
13096
13110
  groupId: "add",
13097
13111
  buttons: [
13098
13112
  {
13099
- buttonId: "core:openAddPartLayer",
13100
- caption: "Add Design Part...",
13113
+ buttonId: "core:addSection",
13114
+ caption: "Add Section",
13101
13115
  icon: "add_row_below",
13102
- handler: (modeler) => modeler.commandRegistry.executeCommand(OpenAddPartModalCommand.COMMAND_ID)
13116
+ handler: (modeler) => modeler.commandRegistry.executeCommand(AddSectionCommand.COMMAND_ID)
13103
13117
  },
13104
13118
  {
13105
- buttonId: "core:openAddWidgetLayer",
13106
- caption: "Add Widget...",
13119
+ buttonId: "core:addBlock",
13120
+ caption: "Add Block",
13121
+ icon: "add_column_right",
13122
+ handler: (modeler) => modeler.commandRegistry.executeCommand(AddBlockCommand.COMMAND_ID)
13123
+ },
13124
+ {
13125
+ buttonId: "core:addWidget",
13126
+ caption: "Add Widget",
13107
13127
  icon: "desktop_landscape_add",
13108
13128
  handler: (modeler) => modeler.commandRegistry.executeCommand(OpenAddWidgetModalCommand.COMMAND_ID)
13109
13129
  }
@@ -13309,6 +13329,8 @@ ${_html.style}
13309
13329
  __publicField(this, "scale", vue.ref(1));
13310
13330
  __publicField(this, "locale", vue.ref("en"));
13311
13331
  __publicField(this, "locales", vue.ref(["en"]));
13332
+ __publicField(this, "customWidgets", []);
13333
+ __publicField(this, "providers", {});
13312
13334
  this.model = new Model();
13313
13335
  this.context = new PageBuilderContextImpl(this);
13314
13336
  this.editMode = "free";
@@ -13333,6 +13355,21 @@ ${_html.style}
13333
13355
  return def.component;
13334
13356
  }
13335
13357
  }
13358
+ getProvider(name) {
13359
+ return this.providers[name];
13360
+ }
13361
+ watchCustomWidgetData(part) {
13362
+ const def = this.partManager.getPartDefinition(part.partName);
13363
+ if (!def || !def.dataWatcher)
13364
+ return false;
13365
+ return def.dataWatcher(part.properties);
13366
+ }
13367
+ provideCustomWidgetData(part) {
13368
+ const def = this.partManager.getPartDefinition(part.partName);
13369
+ if (!def || !def.dataProvider)
13370
+ return Promise.resolve();
13371
+ return def.dataProvider(part.properties);
13372
+ }
13336
13373
  registerPlugin(plugin) {
13337
13374
  if (plugin.partDefinitions)
13338
13375
  this.partManager.registerPartDefinitions(plugin.partDefinitions);
@@ -13354,13 +13391,23 @@ ${_html.style}
13354
13391
  const partDefinitions2 = {};
13355
13392
  plugin.widgets.forEach((v) => {
13356
13393
  const w = { ...v };
13357
- w.partName = "Widget";
13394
+ w.partType = "Widget";
13358
13395
  w.creator = () => _sfc_main$B;
13359
13396
  w.propertyGroups = [...w.propertyGroups, ...defaultWidgetPropertyGroups()];
13360
13397
  partDefinitions2[v.partName] = w;
13398
+ const found = this.customWidgets.find((x) => x.partName === v.partName);
13399
+ if (!found) {
13400
+ this.customWidgets.push(w);
13401
+ }
13361
13402
  });
13362
13403
  this.partManager.registerPartDefinitions(partDefinitions2);
13363
13404
  }
13405
+ if (plugin.providers) {
13406
+ this.providers = {
13407
+ ...this.providers,
13408
+ ...plugin.providers
13409
+ };
13410
+ }
13364
13411
  if (plugin.propertyEditors) {
13365
13412
  this.partManager.registerPartPropertyEditors(plugin.propertyEditors);
13366
13413
  }
@@ -13436,6 +13483,9 @@ ${_html.style}
13436
13483
  ]
13437
13484
  });
13438
13485
  }
13486
+ getCustomWidgets() {
13487
+ return this.customWidgets;
13488
+ }
13439
13489
  getEmptyPageContent() {
13440
13490
  const block = new Block();
13441
13491
  const section = new Section();
@@ -13481,7 +13531,7 @@ ${_html.style}
13481
13531
  const insertSection = (index) => {
13482
13532
  if (!props.page)
13483
13533
  return;
13484
- editor.commandRegistry.executeCommand(OpenAddPartModalCommand.COMMAND_ID);
13534
+ editor.commandRegistry.executeCommand(AddSectionCommand.COMMAND_ID);
13485
13535
  };
13486
13536
  return (_ctx, _cache) => {
13487
13537
  var _a;
@@ -14171,9 +14221,9 @@ ${_html.style}
14171
14221
  ], -1);
14172
14222
  const _hoisted_3$b = { class: "bs-layout-horizontal" };
14173
14223
  const _hoisted_4$4 = { class: "mr-2" };
14174
- const _hoisted_5$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "font-icon" }, "more_horiz", -1);
14175
- const _hoisted_6$1 = [
14176
- _hoisted_5$1
14224
+ const _hoisted_5$2 = /* @__PURE__ */ vue.createElementVNode("span", { class: "font-icon" }, "more_horiz", -1);
14225
+ const _hoisted_6$2 = [
14226
+ _hoisted_5$2
14177
14227
  ];
14178
14228
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
14179
14229
  __name: "PbPropertyLocalMarketingPart",
@@ -14256,7 +14306,7 @@ ${_html.style}
14256
14306
  }, null, 8, ["from-value", "to-value"])
14257
14307
  ]),
14258
14308
  vue.createElementVNode("div", null, [
14259
- vue.createElementVNode("button", { onClick: selectSchedule }, _hoisted_6$1)
14309
+ vue.createElementVNode("button", { onClick: selectSchedule }, _hoisted_6$2)
14260
14310
  ])
14261
14311
  ])
14262
14312
  ]);
@@ -14628,16 +14678,16 @@ ${_html.style}
14628
14678
  },
14629
14679
  emits: ["update-property-value"],
14630
14680
  setup(__props, { emit: __emit }) {
14631
- bluesea.useModal();
14632
14681
  const pageBuilder = usePageBuilderEditor();
14682
+ const modal = bluesea.useModal();
14633
14683
  const emit = __emit;
14634
14684
  const selectImage = () => {
14635
- PageBuilderEditorEvent.emit.requestImage({
14636
- pageBuilderId: pageBuilder.instanceId,
14637
- callback: (url) => {
14685
+ const imageProvider = pageBuilder.getProvider("image");
14686
+ if (imageProvider) {
14687
+ imageProvider({ modal }, (url) => {
14638
14688
  emit("update-property-value", { image: url });
14639
- }
14640
- });
14689
+ });
14690
+ }
14641
14691
  };
14642
14692
  return (_ctx, _cache) => {
14643
14693
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
@@ -14763,9 +14813,19 @@ ${_html.style}
14763
14813
  default: _sfc_main$3
14764
14814
  }, Symbol.toStringTag, { value: "Module" }));
14765
14815
  const _hoisted_1$2 = { class: "bs-layout-vertical pb-part-add-modal" };
14766
- const _hoisted_2$2 = ["textContent"];
14816
+ const _hoisted_2$2 = /* @__PURE__ */ vue.createElementVNode("div", {
14817
+ class: "mb-8",
14818
+ textContent: "Basic Widgets"
14819
+ }, null, -1);
14767
14820
  const _hoisted_3$2 = { class: "bs-layout-horizontal-wrap ml-16 mb-8 gap-8" };
14768
14821
  const _hoisted_4$1 = ["onClick", "textContent"];
14822
+ const _hoisted_5$1 = { class: "group mb-16" };
14823
+ const _hoisted_6$1 = /* @__PURE__ */ vue.createElementVNode("div", {
14824
+ class: "mb-8",
14825
+ textContent: "Custom Widgets"
14826
+ }, null, -1);
14827
+ const _hoisted_7$1 = { class: "bs-layout-horizontal-wrap ml-16 mb-8 gap-8" };
14828
+ const _hoisted_8$1 = ["onClick", "textContent"];
14769
14829
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
14770
14830
  __name: "PbWidgetAddModal",
14771
14831
  props: {
@@ -14774,9 +14834,12 @@ ${_html.style}
14774
14834
  },
14775
14835
  emits: ["selectHandler"],
14776
14836
  setup(__props, { emit: __emit }) {
14837
+ const props = __props;
14777
14838
  const emit = __emit;
14778
14839
  const modalHandle = bluesea.useModalHandle();
14840
+ const customWidgets = vue.computed(() => props.pageBuilder.getCustomWidgets());
14779
14841
  const select = (partDefinition) => {
14842
+ console.log(partDefinition);
14780
14843
  emit("selectHandler", partDefinition);
14781
14844
  modalHandle.close();
14782
14845
  };
@@ -14784,15 +14847,12 @@ ${_html.style}
14784
14847
  return vue.openBlock(), vue.createBlock(vue.unref(bluesea.BSModalFrame), { title: "Add Block/Widget" }, {
14785
14848
  default: vue.withCtx(() => [
14786
14849
  vue.createElementVNode("div", _hoisted_1$2, [
14787
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.partDefinitionGroups, (group) => {
14850
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(widgetPartDefinitions), (group) => {
14788
14851
  return vue.openBlock(), vue.createElementBlock("div", {
14789
14852
  key: group.groupName,
14790
14853
  class: "group mb-16"
14791
14854
  }, [
14792
- vue.createElementVNode("div", {
14793
- class: "mb-8",
14794
- textContent: vue.toDisplayString(group.caption)
14795
- }, null, 8, _hoisted_2$2),
14855
+ _hoisted_2$2,
14796
14856
  vue.createElementVNode("div", _hoisted_3$2, [
14797
14857
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.partDefinitions, (part) => {
14798
14858
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -14804,7 +14864,20 @@ ${_html.style}
14804
14864
  }), 128))
14805
14865
  ])
14806
14866
  ]);
14807
- }), 128))
14867
+ }), 128)),
14868
+ vue.createElementVNode("div", _hoisted_5$1, [
14869
+ _hoisted_6$1,
14870
+ vue.createElementVNode("div", _hoisted_7$1, [
14871
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(customWidgets.value, (part) => {
14872
+ return vue.openBlock(), vue.createElementBlock("div", {
14873
+ key: part.partName,
14874
+ class: "part",
14875
+ onClick: ($event) => select(part),
14876
+ textContent: vue.toDisplayString(part.caption)
14877
+ }, null, 8, _hoisted_8$1);
14878
+ }), 128))
14879
+ ])
14880
+ ])
14808
14881
  ])
14809
14882
  ]),
14810
14883
  _: 1