@g1cloud/page-builder-editor 1.0.0-alpha.10 → 1.0.0-alpha.100

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.
Files changed (120) hide show
  1. package/css/page-builder-editor.css +391 -0
  2. package/css/page-builder-viewer.css +200 -0
  3. package/dist/PageBuilderEditor.vue.d.ts +22 -11
  4. package/dist/PbHtmlEditorModal-C0MLYY66.js +193 -0
  5. package/dist/PbPropertyEditorBoolean-c5CNiTpt.js +38 -0
  6. package/dist/{PbPropertyEditorColor-B9I99uQK.js → PbPropertyEditorColor-CwgsFX20.js} +8 -9
  7. package/dist/{PbPropertyEditorText-BWOKvwD9.js → PbPropertyEditorCssLength-BimevQPh.js} +10 -9
  8. package/dist/PbPropertyEditorHtml-Dq5TqAEK.js +62 -0
  9. package/dist/PbPropertyEditorImage-Bn9LMbEK.js +122 -0
  10. package/dist/{PbPropertyEditorMultilineText-Bv4luXWg.js → PbPropertyEditorMultilineText-gDifsouH.js} +28 -27
  11. package/dist/PbPropertyEditorNumber-B76ArSb5.js +47 -0
  12. package/dist/{PbPropertyEditorReadonlyText-Dgp_AVOD.js → PbPropertyEditorReadonlyText-BJ5qx69O.js} +6 -6
  13. package/dist/{PbPropertyEditorSelect-CWedbXJI.js → PbPropertyEditorSelect-B5sfulvx.js} +5 -6
  14. package/dist/PbPropertyEditorText-C7Tr7KGc.js +50 -0
  15. package/dist/PbPropertyEditorYoutube-Ci8_jXBk.js +62 -0
  16. package/dist/PbScreenSelectModal-57LXAzjs.js +69 -0
  17. package/dist/PbWidgetAddModal-BdTUeERo.js +79 -0
  18. package/dist/PbYoutubeModal-CU8sClMD.js +73 -0
  19. package/dist/components/canvas/PbCanvas.vue.d.ts +1 -1
  20. package/dist/components/depart/PbLoginDepart.vue.d.ts +3 -3
  21. package/dist/components/menu/PbMenu.vue.d.ts +16 -1
  22. package/dist/components/menu/PbToolbar.vue.d.ts +16 -1
  23. package/dist/components/menu/PbToolbarButton.vue.d.ts +3 -3
  24. package/dist/components/menu/PbToolbarButtonGroup.vue.d.ts +3 -3
  25. package/dist/components/modal/PbHtmlEditorModal.vue.d.ts +28 -0
  26. package/dist/components/modal/PbPartAddModal.vue.d.ts +4 -4
  27. package/dist/components/modal/PbScreenSelectModal.vue.d.ts +6 -0
  28. package/dist/components/modal/PbWidgetAddModal.vue.d.ts +4 -4
  29. package/dist/components/modal/PbYoutubeModal.vue.d.ts +19 -0
  30. package/dist/components/navigator/PbNavigator.vue.d.ts +1 -1
  31. package/dist/components/part/PbAddWidgetButton.vue.d.ts +1 -1
  32. package/dist/components/part/PbBlock.vue.d.ts +7 -3
  33. package/dist/components/part/PbPage.vue.d.ts +5 -5
  34. package/dist/components/part/PbPageFrame.vue.d.ts +19 -0
  35. package/dist/components/part/PbSection.vue.d.ts +7 -3
  36. package/dist/components/part/PbWidget.vue.d.ts +5 -3
  37. package/dist/components/sidebar/PbSidebar.vue.d.ts +1 -1
  38. package/dist/components/sidebar/PbSidebarProperties.vue.d.ts +1 -1
  39. package/dist/components/sidebar/PbSidebarPropertyEditor.vue.d.ts +3 -3
  40. package/dist/components/sidebar/PbSidebarPropertyGroupEditor.vue.d.ts +3 -3
  41. package/dist/components/sidebar/property/{PbPropertyEditorProduct.vue.d.ts → PbPropertyEditorBoolean.vue.d.ts} +4 -4
  42. package/dist/components/sidebar/property/PbPropertyEditorColor.vue.d.ts +4 -4
  43. package/dist/components/sidebar/property/PbPropertyEditorCssLength.vue.d.ts +23 -0
  44. package/dist/components/sidebar/property/PbPropertyEditorHtml.vue.d.ts +4 -4
  45. package/dist/components/sidebar/property/PbPropertyEditorImage.vue.d.ts +5 -9
  46. package/dist/components/sidebar/property/PbPropertyEditorMultilineText.vue.d.ts +7 -6
  47. package/dist/components/sidebar/property/PbPropertyEditorNumber.vue.d.ts +23 -0
  48. package/dist/components/sidebar/property/PbPropertyEditorReadonlyText.vue.d.ts +3 -3
  49. package/dist/components/sidebar/property/PbPropertyEditorSelect.vue.d.ts +4 -4
  50. package/dist/components/sidebar/property/PbPropertyEditorText.vue.d.ts +9 -8
  51. package/dist/components/sidebar/property/{PbPropertyLocalMarketingPart.vue.d.ts → PbPropertyEditorYoutube.vue.d.ts} +9 -9
  52. package/dist/components/sidebar/property/PbPropertyGroupEditorBackground.vue.d.ts +3 -3
  53. package/dist/components/sidebar/property/PbPropertyGroupEditorBorder.vue.d.ts +3 -3
  54. package/dist/components/sidebar/property/PbPropertyGroupEditorMargin.vue.d.ts +3 -3
  55. package/dist/components/sidebar/property/PbPropertyGroupEditorMedia.vue.d.ts +20 -0
  56. package/dist/components/sidebar/property/PbPropertyGroupEditorPadding.vue.d.ts +3 -3
  57. package/dist/components/sidebar/property/PbPropertyGroupEditorPosition.vue.d.ts +3 -3
  58. package/dist/components/sidebar/property/PbPropertyGroupEditorSize.vue.d.ts +3 -3
  59. package/dist/components/ui/PbColorPicker.vue.d.ts +16 -7
  60. package/dist/directives/vPartHandler.d.ts +1 -0
  61. package/dist/{index-jUNIezk-.js → index-gTlPRaWE.js} +5420 -2156
  62. package/dist/index.d.ts +6 -0
  63. package/dist/model/command.d.ts +47 -34
  64. package/dist/model/context.d.ts +19 -19
  65. package/dist/model/default-part-property-group.d.ts +8 -2
  66. package/dist/model/event.d.ts +0 -56
  67. package/dist/model/model.d.ts +6 -2
  68. package/dist/model/page-builder-editor.d.ts +39 -10
  69. package/dist/model/page-builder-util.d.ts +2 -0
  70. package/dist/model/part-definintion.d.ts +2 -2
  71. package/dist/model/part-manager.d.ts +2 -1
  72. package/dist/model/part-property.d.ts +4 -3
  73. package/dist/model/plugin.d.ts +24 -0
  74. package/dist/page-builder-editor.js +20 -17
  75. package/dist/page-builder-editor.umd.cjs +6212 -2527
  76. package/dist/style.css +383 -1
  77. package/dist/text/text.d.ts +1 -0
  78. package/dist/utils/common.d.ts +1 -0
  79. package/package.json +13 -8
  80. package/scss/canvas.scss +29 -0
  81. package/{css/canvas-block.scss → scss/page-block.scss} +15 -3
  82. package/scss/page-builder-editor.scss +326 -0
  83. package/scss/page-builder-viewer.scss +1 -0
  84. package/{css/canvas-page.scss → scss/page-page.scss} +25 -16
  85. package/{css/canvas-section.scss → scss/page-section.scss} +15 -4
  86. package/scss/page-widget.scss +66 -0
  87. package/scss/page.scss +73 -0
  88. package/{css → scss}/property-editor-html.scss +4 -3
  89. package/scss/property-editor-image.scss +17 -0
  90. package/{css → scss}/property-editor-product.scss +4 -3
  91. package/scss/property-editor-text.scss +10 -0
  92. package/{css/property-editor-image.scss → scss/property-editor-youtube.scss} +4 -4
  93. package/scss/property-group-editor-background.scss +39 -0
  94. package/scss/property-group-editor-media.scss +22 -0
  95. package/{css → scss}/property-localpart.scss +2 -2
  96. package/css/bluesea.scss +0 -8244
  97. package/css/canvas-widget.scss +0 -41
  98. package/css/canvas.scss +0 -147
  99. package/css/page-builder-editor.scss +0 -265
  100. package/css/page-builder-viewer.scss +0 -1
  101. package/css/property-group-editor-background.scss +0 -28
  102. package/css/variable.scss +0 -1
  103. package/dist/HtmlEditorModal-oXFayeg-.js +0 -100
  104. package/dist/PbPartAddModal-DuLpnV4E.js +0 -50
  105. package/dist/PbPropertyEditorHtml-BVT2SwoK.js +0 -64
  106. package/dist/PbPropertyEditorImage-DLwg5dJz.js +0 -42
  107. package/dist/PbPropertyEditorProduct-6STGd-Zs.js +0 -49
  108. package/dist/PbWidgetAddModal-CQvFYzfU.js +0 -55
  109. package/dist/components/canvas/PbCanvasFrame.vue.d.ts +0 -2
  110. package/dist/components/modal/HtmlEditorModal.vue.d.ts +0 -23
  111. /package/{css → scss}/property-editor-color.scss +0 -0
  112. /package/{css → scss}/property-editor-multiline-text.scss +0 -0
  113. /package/{css/property-editor-text.scss → scss/property-editor-number.scss} +0 -0
  114. /package/{css → scss}/property-editor-readonly-text.scss +0 -0
  115. /package/{css → scss}/property-editor-select.scss +0 -0
  116. /package/{css → scss}/property-group-editor-border.scss +0 -0
  117. /package/{css → scss}/property-group-editor-margin.scss +0 -0
  118. /package/{css → scss}/property-group-editor-padding.scss +0 -0
  119. /package/{css → scss}/property-group-editor-position.scss +0 -0
  120. /package/{css → scss}/property-group-editor-size.scss +0 -0
@@ -0,0 +1,193 @@
1
+ import { defineComponent, ref, computed, onMounted, onBeforeUnmount, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createSlots, renderList, withDirectives, normalizeStyle } from "vue";
2
+ import { useModalHandle, waitDuring, BSModalFrame, BSTabSheet, vT, BSSelect, BSCodeEditor } from "@g1cloud/bluesea";
3
+ const _hoisted_1 = { class: "bs-layout-vertical flex-grow-1 h-full" };
4
+ const _hoisted_2 = { class: "bs-layout-horizontal h-full pt-8" };
5
+ const _hoisted_3 = { class: "preview" };
6
+ const _hoisted_4 = { class: "bs-layout-vertical w-full h-full" };
7
+ const _hoisted_5 = { class: "bs-layout-horizontal pb-4 align-items-center justify-content-between" };
8
+ const _hoisted_6 = { class: "title pb-4" };
9
+ const _hoisted_7 = { class: "content flex-grow-1 overflow-y-hidden" };
10
+ const _hoisted_8 = ["srcdoc"];
11
+ const _hoisted_9 = { class: "editor bs-layout-vertical pl-8 h-full" };
12
+ const _hoisted_10 = { class: "bs-layout-horizontal justify-content-center" };
13
+ const _sfc_main = /* @__PURE__ */ defineComponent({
14
+ __name: "PbHtmlEditorModal",
15
+ props: {
16
+ html: {},
17
+ locales: {},
18
+ localeTabs: {},
19
+ pageBuilder: {}
20
+ },
21
+ emits: ["updateHtml"],
22
+ setup(__props, { emit: __emit }) {
23
+ const props = __props;
24
+ const emit = __emit;
25
+ const localeTabId = ref(props.localeTabs && props.localeTabs[0].tabId);
26
+ const modalHandle = useModalHandle();
27
+ const html = ref(props.html || {});
28
+ const previewWidth = ref(480);
29
+ const previewStyle = computed(() => ({
30
+ width: `${previewWidth.value}px`,
31
+ height: "100%",
32
+ overflow: "auto",
33
+ transformOrigin: `top left`
34
+ }));
35
+ const preview = computed(() => {
36
+ var _a;
37
+ let data = {};
38
+ const externalCss = props.pageBuilder.getExternalCss();
39
+ (_a = props.locales) == null ? void 0 : _a.forEach((locale) => {
40
+ const _html = html.value[locale] || { tags: "", style: "" };
41
+ data[locale] = _html.tags ? `${externalCss}
42
+ <style>${_html.style}</style>
43
+ ${_html.tags}` : "";
44
+ });
45
+ return data;
46
+ });
47
+ const editorTabs = [
48
+ { tabId: "tags", caption: { key: "pb.modal.htmlEditor.tags" } },
49
+ { tabId: "style", caption: { key: "pb.modal.htmlEditor.style" } }
50
+ ];
51
+ const editorTabId = ref("tags");
52
+ const updateTags = (locale, value) => {
53
+ if (!html.value) html.value = {};
54
+ if (!html.value[locale]) html.value[locale] = {};
55
+ html.value[locale].tags = value;
56
+ };
57
+ const updateStyle = (locale, value) => {
58
+ if (!html.value) html.value = {};
59
+ if (!html.value[locale]) html.value[locale] = {};
60
+ html.value[locale].style = value;
61
+ };
62
+ const ok = () => {
63
+ emit("updateHtml", html.value);
64
+ modalHandle.close();
65
+ };
66
+ const editorHeight = ref("");
67
+ const updateEditorHeight = async () => {
68
+ await waitDuring(50);
69
+ if (editorHeight.value) {
70
+ const editor = document.querySelector(".bs-code-editor");
71
+ if (editor) {
72
+ editor.style.height = editorHeight.value;
73
+ }
74
+ }
75
+ };
76
+ let resizeObserver;
77
+ onMounted(async () => {
78
+ await waitDuring(50);
79
+ const editorParent = document.querySelector(".editor > .bs-tab-sheet > .bs-layout-vertical");
80
+ resizeObserver = new ResizeObserver(() => {
81
+ if (editorParent && editorParent.clientHeight) {
82
+ editorHeight.value = `${editorParent.clientHeight}px`;
83
+ updateEditorHeight();
84
+ }
85
+ });
86
+ if (editorParent) {
87
+ resizeObserver.observe(editorParent);
88
+ }
89
+ });
90
+ onBeforeUnmount(() => {
91
+ if (resizeObserver) {
92
+ resizeObserver.disconnect();
93
+ }
94
+ });
95
+ return (_ctx, _cache) => {
96
+ return openBlock(), createBlock(unref(BSModalFrame), {
97
+ title: { key: "pb.modal.htmlEditor.title" },
98
+ class: "pb-html-editor-modal"
99
+ }, {
100
+ default: withCtx(() => [
101
+ createElementVNode("div", _hoisted_1, [
102
+ createVNode(unref(BSTabSheet), {
103
+ "tab-id": localeTabId.value,
104
+ "onUpdate:tabId": [
105
+ _cache[2] || (_cache[2] = ($event) => localeTabId.value = $event),
106
+ updateEditorHeight
107
+ ],
108
+ tabs: _ctx.localeTabs,
109
+ class: "flex-grow-1"
110
+ }, createSlots({ _: 2 }, [
111
+ renderList(_ctx.locales, (locale) => {
112
+ return {
113
+ name: `tab-${locale}`,
114
+ fn: withCtx(() => [
115
+ createElementVNode("div", _hoisted_2, [
116
+ createElementVNode("div", _hoisted_3, [
117
+ createElementVNode("div", _hoisted_4, [
118
+ createElementVNode("div", _hoisted_5, [
119
+ withDirectives(createElementVNode("div", _hoisted_6, null, 512), [
120
+ [unref(vT), { key: "pb.modal.htmlEditor.preview" }]
121
+ ]),
122
+ createVNode(unref(BSSelect), {
123
+ modelValue: previewWidth.value,
124
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => previewWidth.value = $event),
125
+ items: [480, 768, 1024, 1280],
126
+ "label-provider": (v) => `Screen Size: ${v}px`,
127
+ "view-model": false
128
+ }, null, 8, ["modelValue", "label-provider"])
129
+ ]),
130
+ createElementVNode("div", _hoisted_7, [
131
+ createElementVNode("iframe", {
132
+ srcdoc: preview.value[locale],
133
+ style: normalizeStyle(previewStyle.value)
134
+ }, null, 12, _hoisted_8)
135
+ ])
136
+ ])
137
+ ]),
138
+ createElementVNode("div", _hoisted_9, [
139
+ createVNode(unref(BSTabSheet), {
140
+ "tab-id": editorTabId.value,
141
+ "onUpdate:tabId": [
142
+ _cache[1] || (_cache[1] = ($event) => editorTabId.value = $event),
143
+ updateEditorHeight
144
+ ],
145
+ tabs: editorTabs,
146
+ class: "compact flex-grow-1"
147
+ }, {
148
+ tags: withCtx(() => [
149
+ createVNode(unref(BSCodeEditor), {
150
+ "model-value": (html.value[locale] || {}).tags,
151
+ class: "border-top-0",
152
+ "editor-height": "100%",
153
+ lang: "html",
154
+ "onUpdate:modelValue": (value) => updateTags(locale, value)
155
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
156
+ ]),
157
+ style: withCtx(() => [
158
+ createVNode(unref(BSCodeEditor), {
159
+ "model-value": (html.value[locale] || {}).style,
160
+ class: "border-top-0",
161
+ "editor-height": "100%",
162
+ lang: "css",
163
+ "onUpdate:modelValue": (value) => updateStyle(locale, value)
164
+ }, null, 8, ["model-value", "onUpdate:modelValue"])
165
+ ]),
166
+ _: 2
167
+ }, 1032, ["tab-id"])
168
+ ])
169
+ ])
170
+ ])
171
+ };
172
+ })
173
+ ]), 1032, ["tab-id", "tabs"])
174
+ ])
175
+ ]),
176
+ buttons: withCtx(() => [
177
+ createElementVNode("div", _hoisted_10, [
178
+ withDirectives(createElementVNode("button", {
179
+ class: "mr-4",
180
+ onClick: ok
181
+ }, null, 512), [
182
+ [unref(vT), { key: "pb.button.ok" }]
183
+ ])
184
+ ])
185
+ ]),
186
+ _: 1
187
+ });
188
+ };
189
+ }
190
+ });
191
+ export {
192
+ _sfc_main as default
193
+ };
@@ -0,0 +1,38 @@
1
+ import { defineComponent, ref, openBlock, createElementBlock, createElementVNode, createVNode, unref } from "vue";
2
+ import { BSCheckbox } from "@g1cloud/bluesea";
3
+ const _hoisted_1 = { class: "property-editor property-editor-boolean flex-align-center my-12" };
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "PbPropertyEditorBoolean",
6
+ props: {
7
+ property: {},
8
+ value: {}
9
+ },
10
+ emits: ["update-property-value"],
11
+ setup(__props, { emit: __emit }) {
12
+ const props = __props;
13
+ const booleanValue = ref((props == null ? void 0 : props.value) === "true");
14
+ const emit = __emit;
15
+ const emitUpdatePropertyValue = (value) => {
16
+ const properties = {};
17
+ properties[props.property.propertyName] = value ? "true" : "false";
18
+ emit("update-property-value", properties);
19
+ };
20
+ return (_ctx, _cache) => {
21
+ return openBlock(), createElementBlock("div", _hoisted_1, [
22
+ createElementVNode("div", null, [
23
+ createVNode(unref(BSCheckbox), {
24
+ modelValue: booleanValue.value,
25
+ "onUpdate:modelValue": [
26
+ _cache[0] || (_cache[0] = ($event) => booleanValue.value = $event),
27
+ emitUpdatePropertyValue
28
+ ],
29
+ label: { key: _ctx.property.caption }
30
+ }, null, 8, ["modelValue", "label"])
31
+ ])
32
+ ]);
33
+ };
34
+ }
35
+ });
36
+ export {
37
+ _sfc_main as default
38
+ };
@@ -1,10 +1,9 @@
1
- import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
2
- import { BSTextInput } from "@g1cloud/bluesea";
3
- import { P as PbColorPicker } from "./index-jUNIezk-.js";
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createVNode } from "vue";
2
+ import { vT, BSTextInput } from "@g1cloud/bluesea";
3
+ import { P as PbColorPicker } from "./index-gTlPRaWE.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-color" };
5
5
  const _hoisted_2 = { class: "title" };
6
- const _hoisted_3 = ["textContent"];
7
- const _hoisted_4 = { class: "bs-layout-horizontal flex-align-center color" };
6
+ const _hoisted_3 = { class: "bs-layout-horizontal flex-align-center color" };
8
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
8
  __name: "PbPropertyEditorColor",
10
9
  props: {
@@ -27,11 +26,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
26
  return (_ctx, _cache) => {
28
27
  return openBlock(), createElementBlock("div", _hoisted_1, [
29
28
  createElementVNode("div", _hoisted_2, [
30
- createElementVNode("label", {
31
- textContent: toDisplayString(_ctx.property.caption)
32
- }, null, 8, _hoisted_3)
29
+ withDirectives(createElementVNode("label", null, null, 512), [
30
+ [unref(vT), { key: _ctx.property.caption }]
31
+ ])
33
32
  ]),
34
- createElementVNode("div", _hoisted_4, [
33
+ createElementVNode("div", _hoisted_3, [
35
34
  createVNode(PbColorPicker, {
36
35
  value: _ctx.value,
37
36
  "hide-delete": "",
@@ -1,10 +1,10 @@
1
- import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
2
- import { BSTextInput } from "@g1cloud/bluesea";
3
- const _hoisted_1 = { class: "property-editor property-editor-text flex-align-center" };
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createVNode } from "vue";
2
+ import { vT, BSTextInput } from "@g1cloud/bluesea";
3
+ import { t as toCssLength } from "./index-gTlPRaWE.js";
4
+ const _hoisted_1 = { class: "property-editor property-editor-number flex-align-center" };
4
5
  const _hoisted_2 = { class: "title" };
5
- const _hoisted_3 = ["textContent"];
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
- __name: "PbPropertyEditorText",
7
+ __name: "PbPropertyEditorCssLength",
8
8
  props: {
9
9
  property: {},
10
10
  value: {}
@@ -14,16 +14,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
14
  const props = __props;
15
15
  const emit = __emit;
16
16
  const emitUpdatePropertyValue = (value) => {
17
+ const cssLength = toCssLength(value || "");
17
18
  const properties = {};
18
- properties[props.property.propertyName] = value;
19
+ properties[props.property.propertyName] = `${cssLength}`;
19
20
  emit("update-property-value", properties);
20
21
  };
21
22
  return (_ctx, _cache) => {
22
23
  return openBlock(), createElementBlock("div", _hoisted_1, [
23
24
  createElementVNode("div", _hoisted_2, [
24
- createElementVNode("label", {
25
- textContent: toDisplayString(_ctx.property.caption)
26
- }, null, 8, _hoisted_3)
25
+ withDirectives(createElementVNode("label", null, null, 512), [
26
+ [unref(vT), { key: _ctx.property.caption }]
27
+ ])
27
28
  ]),
28
29
  createElementVNode("div", null, [
29
30
  createVNode(unref(BSTextInput), {
@@ -0,0 +1,62 @@
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createTextVNode, defineAsyncComponent } from "vue";
2
+ import { useModal, vT } from "@g1cloud/bluesea";
3
+ import { u as usePageBuilderEditor } from "./index-gTlPRaWE.js";
4
+ const _hoisted_1 = { class: "property-editor property-editor-html flex-align-center" };
5
+ const _hoisted_2 = { class: "title" };
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ __name: "PbPropertyEditorHtml",
8
+ props: {
9
+ property: {},
10
+ value: {}
11
+ },
12
+ emits: ["update-property-value"],
13
+ setup(__props, { emit: __emit }) {
14
+ const props = __props;
15
+ const modal = useModal();
16
+ const pageBuilder = usePageBuilderEditor();
17
+ const emit = __emit;
18
+ const editHtml = () => {
19
+ const locales = pageBuilder.getLocales();
20
+ const localeTabs = locales.map((v) => ({ tabId: `tab-${v}`, caption: v }));
21
+ modal.openModal({
22
+ component: defineAsyncComponent(() => import("./PbHtmlEditorModal-C0MLYY66.js")),
23
+ style: {
24
+ width: "80%",
25
+ height: "80%",
26
+ minWidth: "500px",
27
+ minHeight: "400px"
28
+ },
29
+ bind: {
30
+ html: JSON.parse(JSON.stringify(props.value || {})),
31
+ locales,
32
+ localeTabs,
33
+ pageBuilder
34
+ },
35
+ on: {
36
+ updateHtml: (html) => {
37
+ emit("update-property-value", { html });
38
+ }
39
+ }
40
+ });
41
+ };
42
+ return (_ctx, _cache) => {
43
+ return openBlock(), createElementBlock("div", _hoisted_1, [
44
+ createElementVNode("div", _hoisted_2, [
45
+ withDirectives(createElementVNode("label", null, null, 512), [
46
+ [unref(vT), { key: _ctx.property.caption }]
47
+ ])
48
+ ]),
49
+ createElementVNode("div", null, [
50
+ withDirectives((openBlock(), createElementBlock("button", { onClick: editHtml }, _cache[0] || (_cache[0] = [
51
+ createTextVNode("Edit HTML")
52
+ ]))), [
53
+ [unref(vT), { key: "pb.prop.editHtml" }]
54
+ ])
55
+ ])
56
+ ]);
57
+ };
58
+ }
59
+ });
60
+ export {
61
+ _sfc_main as default
62
+ };
@@ -0,0 +1,122 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createTextVNode, toDisplayString, createVNode, createCommentVNode, Fragment } from "vue";
2
+ import { u as usePageBuilderEditor, C as ChangePropertyCommand } from "./index-gTlPRaWE.js";
3
+ import { useModal, vT, BSButton, BSMultiLangTextInput, showNotification } from "@g1cloud/bluesea";
4
+ const _hoisted_1 = { class: "property-editor property-editor-image" };
5
+ const _hoisted_2 = { class: "title" };
6
+ const _hoisted_3 = {
7
+ key: 0,
8
+ class: "title mt-12"
9
+ };
10
+ const _hoisted_4 = { class: "mt-8" };
11
+ const _hoisted_5 = { class: "title mt-12" };
12
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
+ __name: "PbPropertyEditorImage",
14
+ props: {
15
+ property: {},
16
+ value: {}
17
+ },
18
+ setup(__props) {
19
+ const props = __props;
20
+ const pageBuilder = usePageBuilderEditor();
21
+ const part = pageBuilder.context.getSelectedParts();
22
+ const modal = useModal();
23
+ const selectMedia = () => {
24
+ var _a;
25
+ const imageProvider = pageBuilder.getProvider("imageProvider");
26
+ if (imageProvider) {
27
+ imageProvider({ modal, mediaTypes: ["Image"], selectedMediaUrls: ((_a = media.value) == null ? void 0 : _a.fileUrl) ? [media.value.fileUrl] : [] }, (media2) => {
28
+ updateProperty({ [props.property.propertyName]: media2 });
29
+ });
30
+ }
31
+ };
32
+ const updateProperty = (properties) => {
33
+ pageBuilder.commandRegistry.executeCommand(ChangePropertyCommand.COMMAND_ID, { properties, targetParts: part });
34
+ };
35
+ const updateAltText = (value) => {
36
+ updateProperty({ [props.property.propertyName]: { ...media.value, altText: value } });
37
+ };
38
+ const locales = computed(() => pageBuilder.getLocales());
39
+ const media = computed(() => {
40
+ var _a, _b;
41
+ return (_b = (_a = part == null ? void 0 : part[0]) == null ? void 0 : _a.properties) == null ? void 0 : _b[props.property.propertyName];
42
+ });
43
+ const altText = computed(() => {
44
+ var _a;
45
+ return (_a = media.value) == null ? void 0 : _a.altText;
46
+ });
47
+ const clearMedia = () => {
48
+ updateProperty({ [props.property.propertyName]: void 0 });
49
+ };
50
+ const copyUrl = () => {
51
+ if (!media.value || !media.value.fileUrl) return;
52
+ navigator.clipboard.writeText(media.value.fileUrl);
53
+ showNotification({ key: "pb.prop.copied" });
54
+ };
55
+ return (_ctx, _cache) => {
56
+ var _a, _b, _c;
57
+ return openBlock(), createElementBlock("div", _hoisted_1, [
58
+ createElementVNode("div", _hoisted_2, [
59
+ withDirectives(createElementVNode("label", null, null, 512), [
60
+ [unref(vT), { key: _ctx.property.caption || "pb.prop.image" }]
61
+ ])
62
+ ]),
63
+ createElementVNode("div", null, [
64
+ withDirectives(createElementVNode("button", {
65
+ class: "select-button",
66
+ onClick: selectMedia
67
+ }, null, 512), [
68
+ [unref(vT), { key: "pb.prop.selectMedia" }]
69
+ ])
70
+ ]),
71
+ ((_a = media.value) == null ? void 0 : _a.fileUrl) ? (openBlock(), createElementBlock("div", _hoisted_3, [
72
+ _cache[0] || (_cache[0] = createElementVNode("label", null, "URL", -1)),
73
+ createElementVNode("div", _hoisted_4, [
74
+ createTextVNode(toDisplayString((_b = media.value) == null ? void 0 : _b.fileUrl) + " ", 1),
75
+ withDirectives(createVNode(unref(BSButton), {
76
+ class: "border-0 mb-2 px-1",
77
+ "left-icon": "content_copy",
78
+ onClick: copyUrl
79
+ }, null, 512), [
80
+ [
81
+ unref(vT),
82
+ { key: "pb.menu.copy" },
83
+ void 0,
84
+ { title: true }
85
+ ]
86
+ ]),
87
+ withDirectives(createVNode(unref(BSButton), {
88
+ class: "border-0 mb-2 px-1",
89
+ "left-icon": "close",
90
+ onClick: clearMedia
91
+ }, null, 512), [
92
+ [
93
+ unref(vT),
94
+ { key: "pb.menu.delete" },
95
+ void 0,
96
+ { title: true }
97
+ ]
98
+ ])
99
+ ])
100
+ ])) : createCommentVNode("", true),
101
+ ((_c = media.value) == null ? void 0 : _c.mediaType) === "Image" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
102
+ createElementVNode("div", _hoisted_5, [
103
+ withDirectives(createElementVNode("label", null, null, 512), [
104
+ [unref(vT), { key: "pb.prop.altText" }]
105
+ ])
106
+ ]),
107
+ createElementVNode("div", null, [
108
+ createVNode(unref(BSMultiLangTextInput), {
109
+ locales: locales.value,
110
+ "model-value": altText.value,
111
+ width: "100%",
112
+ "onUpdate:modelValue": updateAltText
113
+ }, null, 8, ["locales", "model-value"])
114
+ ])
115
+ ], 64)) : createCommentVNode("", true)
116
+ ]);
117
+ };
118
+ }
119
+ });
120
+ export {
121
+ _sfc_main as default
122
+ };
@@ -1,9 +1,8 @@
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-jUNIezk-.js";
1
+ import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createBlock } from "vue";
2
+ import { vT, BSMultiLangTextArea, BSTextArea } from "@g1cloud/bluesea";
3
+ import { u as usePageBuilderEditor } from "./index-gTlPRaWE.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
5
5
  const _hoisted_2 = { class: "title" };
6
- const _hoisted_3 = ["textContent"];
7
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
7
  __name: "PbPropertyEditorMultilineText",
9
8
  props: {
@@ -14,47 +13,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
13
  setup(__props, { emit: __emit }) {
15
14
  const props = __props;
16
15
  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
16
  const pageBuilder = usePageBuilderEditor();
32
- const language = computed(() => pageBuilder.language.value);
17
+ const locales = computed(() => pageBuilder.getLocales());
33
18
  const text = computed({
34
19
  get() {
35
- return props.value && typeof props.value === "object" ? props.value[language.value] : "";
20
+ return props.value;
36
21
  },
37
- set() {
22
+ // @ts-ignore
23
+ set(value) {
38
24
  }
39
25
  });
26
+ const emitUpdatePropertyValue = (value) => {
27
+ const properties = {};
28
+ properties[props.property.propertyName] = value;
29
+ emit("update-property-value", properties);
30
+ };
40
31
  return (_ctx, _cache) => {
41
32
  return openBlock(), createElementBlock("div", _hoisted_1, [
42
33
  createElementVNode("div", _hoisted_2, [
43
- createElementVNode("label", {
44
- textContent: toDisplayString(_ctx.property.caption)
45
- }, null, 8, _hoisted_3)
34
+ withDirectives(createElementVNode("label", null, null, 512), [
35
+ [unref(vT), { key: _ctx.property.caption }]
36
+ ])
46
37
  ]),
47
38
  createElementVNode("div", null, [
48
- createVNode(unref(BSTextArea), {
39
+ _ctx.property.multiLang ? (openBlock(), createBlock(unref(BSMultiLangTextArea), {
40
+ key: 0,
49
41
  modelValue: text.value,
50
42
  "onUpdate:modelValue": [
51
43
  _cache[0] || (_cache[0] = ($event) => text.value = $event),
52
44
  emitUpdatePropertyValue
53
45
  ],
54
- prefix: language.value,
46
+ locales: locales.value,
47
+ height: "60px",
48
+ width: "100%"
49
+ }, null, 8, ["modelValue", "locales"])) : (openBlock(), createBlock(unref(BSTextArea), {
50
+ key: 1,
51
+ modelValue: text.value,
52
+ "onUpdate:modelValue": [
53
+ _cache[1] || (_cache[1] = ($event) => text.value = $event),
54
+ emitUpdatePropertyValue
55
+ ],
55
56
  height: "60px",
56
57
  width: "100%"
57
- }, null, 8, ["modelValue", "prefix"])
58
+ }, null, 8, ["modelValue"]))
58
59
  ])
59
60
  ]);
60
61
  };
@@ -0,0 +1,47 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createVNode } from "vue";
2
+ import { vT, BSNumberInput } from "@g1cloud/bluesea";
3
+ const _hoisted_1 = { class: "property-editor property-editor-number flex-align-center" };
4
+ const _hoisted_2 = { class: "title" };
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "PbPropertyEditorNumber",
7
+ props: {
8
+ property: {},
9
+ value: {}
10
+ },
11
+ emits: ["update-property-value"],
12
+ setup(__props, { emit: __emit }) {
13
+ const props = __props;
14
+ const emit = __emit;
15
+ const modelValue = computed(() => {
16
+ if (props.value && !isNaN(Number(props.value))) {
17
+ return Number(props.value);
18
+ } else {
19
+ return void 0;
20
+ }
21
+ });
22
+ const emitUpdatePropertyValue = (value) => {
23
+ const properties = {};
24
+ properties[props.property.propertyName] = `${value}`;
25
+ emit("update-property-value", properties);
26
+ };
27
+ return (_ctx, _cache) => {
28
+ return openBlock(), createElementBlock("div", _hoisted_1, [
29
+ createElementVNode("div", _hoisted_2, [
30
+ withDirectives(createElementVNode("label", null, null, 512), [
31
+ [unref(vT), { key: _ctx.property.caption }]
32
+ ])
33
+ ]),
34
+ createElementVNode("div", null, [
35
+ createVNode(unref(BSNumberInput), {
36
+ "model-value": modelValue.value,
37
+ width: "100%",
38
+ "onUpdate:modelValue": emitUpdatePropertyValue
39
+ }, null, 8, ["model-value"])
40
+ ])
41
+ ]);
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
@@ -1,8 +1,8 @@
1
- import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref, toDisplayString } from "vue";
2
+ import { vT } from "@g1cloud/bluesea";
2
3
  const _hoisted_1 = { class: "property-editor property-editor-readonly-text" };
3
4
  const _hoisted_2 = { class: "title" };
4
5
  const _hoisted_3 = ["textContent"];
5
- const _hoisted_4 = ["textContent"];
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "PbPropertyEditorReadonlyText",
8
8
  props: {
@@ -13,14 +13,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13
13
  return (_ctx, _cache) => {
14
14
  return openBlock(), createElementBlock("div", _hoisted_1, [
15
15
  createElementVNode("div", _hoisted_2, [
16
- createElementVNode("label", {
17
- textContent: toDisplayString(_ctx.property.caption)
18
- }, null, 8, _hoisted_3)
16
+ withDirectives(createElementVNode("label", null, null, 512), [
17
+ [unref(vT), { key: _ctx.property.caption }]
18
+ ])
19
19
  ]),
20
20
  createElementVNode("div", null, [
21
21
  createElementVNode("div", {
22
22
  textContent: toDisplayString(_ctx.value)
23
- }, null, 8, _hoisted_4)
23
+ }, null, 8, _hoisted_3)
24
24
  ])
25
25
  ]);
26
26
  };