@g1cloud/page-builder-editor 1.0.0-alpha.6 → 1.0.0-alpha.60

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 (99) hide show
  1. package/css/canvas.scss +16 -137
  2. package/css/{canvas-block.scss → page-block.scss} +15 -3
  3. package/css/page-builder-editor.scss +108 -22
  4. package/css/{canvas-page.scss → page-page.scss} +24 -16
  5. package/css/{canvas-section.scss → page-section.scss} +17 -3
  6. package/css/{canvas-widget.scss → page-widget.scss} +28 -3
  7. package/css/page.scss +74 -0
  8. package/css/property-editor-color.scss +5 -0
  9. package/css/property-editor-html.scss +16 -0
  10. package/css/property-editor-image.scss +2 -2
  11. package/css/property-editor-number.scss +10 -0
  12. package/css/property-editor-youtube.scss +16 -0
  13. package/css/property-group-editor-background.scss +1 -13
  14. package/css/property-group-editor-border.scss +6 -12
  15. package/css/property-group-editor-margin.scss +0 -11
  16. package/css/property-group-editor-media.scss +16 -0
  17. package/css/property-group-editor-padding.scss +0 -11
  18. package/css/property-group-editor-position.scss +0 -11
  19. package/css/property-group-editor-size.scss +0 -11
  20. package/css/property-localpart.scss +2 -2
  21. package/dist/PageBuilderEditor.vue.d.ts +22 -11
  22. package/dist/PbHtmlEditorModal-C0MLYY66.js +193 -0
  23. package/dist/PbPropertyEditorBoolean-c5CNiTpt.js +38 -0
  24. package/dist/PbPropertyEditorColor-ecbXEcYN.js +56 -0
  25. package/dist/PbPropertyEditorHtml-CN43bcbD.js +62 -0
  26. package/dist/PbPropertyEditorImage-BrP5jFP2.js +106 -0
  27. package/dist/{PbPropertyEditorMultilineText-BFzT7dlG.js → PbPropertyEditorMultilineText-B5-0rW_W.js} +29 -28
  28. package/dist/PbPropertyEditorNumber-B76ArSb5.js +47 -0
  29. package/dist/{PbPropertyEditorReadonlyText-Bk0WJxA0.js → PbPropertyEditorReadonlyText-BJ5qx69O.js} +7 -7
  30. package/dist/{PbPropertyEditorSelect-BJovN1su.js → PbPropertyEditorSelect-B5sfulvx.js} +6 -7
  31. package/dist/PbPropertyEditorText-B_ZEAlMz.js +50 -0
  32. package/dist/PbPropertyEditorYoutube-CYWYEZe0.js +40 -0
  33. package/dist/PbScreenSelectModal-57LXAzjs.js +69 -0
  34. package/dist/PbWidgetAddModal-CDxfMi_c.js +79 -0
  35. package/dist/PbYoutubeModal-CU8sClMD.js +73 -0
  36. package/dist/components/canvas/PbCanvas.vue.d.ts +1 -1
  37. package/dist/components/depart/PbLoginDepart.vue.d.ts +3 -3
  38. package/dist/components/menu/PbMenu.vue.d.ts +16 -1
  39. package/dist/components/menu/PbToolbar.vue.d.ts +16 -1
  40. package/dist/components/menu/PbToolbarButton.vue.d.ts +3 -3
  41. package/dist/components/menu/PbToolbarButtonGroup.vue.d.ts +3 -3
  42. package/dist/components/modal/PbHtmlEditorModal.vue.d.ts +28 -0
  43. package/dist/components/modal/PbPartAddModal.vue.d.ts +4 -4
  44. package/dist/components/modal/PbScreenSelectModal.vue.d.ts +6 -0
  45. package/dist/components/modal/PbWidgetAddModal.vue.d.ts +4 -4
  46. package/dist/components/modal/PbYoutubeModal.vue.d.ts +19 -0
  47. package/dist/components/navigator/PbNavigator.vue.d.ts +1 -1
  48. package/dist/components/part/PbAddWidgetButton.vue.d.ts +1 -1
  49. package/dist/components/part/PbBlock.vue.d.ts +7 -3
  50. package/dist/components/part/PbPage.vue.d.ts +5 -5
  51. package/dist/components/part/PbPageFrame.vue.d.ts +19 -0
  52. package/dist/components/part/PbSection.vue.d.ts +7 -3
  53. package/dist/components/part/PbWidget.vue.d.ts +5 -3
  54. package/dist/components/sidebar/PbSidebar.vue.d.ts +1 -1
  55. package/dist/components/sidebar/PbSidebarProperties.vue.d.ts +1 -1
  56. package/dist/components/sidebar/PbSidebarPropertyEditor.vue.d.ts +3 -3
  57. package/dist/components/sidebar/PbSidebarPropertyGroupEditor.vue.d.ts +3 -3
  58. package/dist/components/sidebar/property/{PbPropertyEditorProduct.vue.d.ts → PbPropertyEditorBoolean.vue.d.ts} +4 -4
  59. package/dist/components/sidebar/property/{PbPropertyLocalMarketingPart.vue.d.ts → PbPropertyEditorColor.vue.d.ts} +9 -9
  60. package/dist/components/sidebar/property/PbPropertyEditorHtml.vue.d.ts +23 -0
  61. package/dist/components/sidebar/property/PbPropertyEditorImage.vue.d.ts +5 -9
  62. package/dist/components/sidebar/property/PbPropertyEditorMultilineText.vue.d.ts +7 -6
  63. package/dist/components/sidebar/property/PbPropertyEditorNumber.vue.d.ts +23 -0
  64. package/dist/components/sidebar/property/PbPropertyEditorReadonlyText.vue.d.ts +3 -3
  65. package/dist/components/sidebar/property/PbPropertyEditorSelect.vue.d.ts +4 -4
  66. package/dist/components/sidebar/property/PbPropertyEditorText.vue.d.ts +9 -8
  67. package/dist/components/sidebar/property/PbPropertyEditorYoutube.vue.d.ts +23 -0
  68. package/dist/components/sidebar/property/PbPropertyGroupEditorBackground.vue.d.ts +3 -3
  69. package/dist/components/sidebar/property/PbPropertyGroupEditorBorder.vue.d.ts +3 -3
  70. package/dist/components/sidebar/property/PbPropertyGroupEditorMargin.vue.d.ts +3 -3
  71. package/dist/components/sidebar/property/PbPropertyGroupEditorMedia.vue.d.ts +20 -0
  72. package/dist/components/sidebar/property/PbPropertyGroupEditorPadding.vue.d.ts +3 -3
  73. package/dist/components/sidebar/property/PbPropertyGroupEditorPosition.vue.d.ts +3 -3
  74. package/dist/components/sidebar/property/PbPropertyGroupEditorSize.vue.d.ts +3 -3
  75. package/dist/components/ui/PbColorPicker.vue.d.ts +17 -8
  76. package/dist/directives/vPartHandler.d.ts +1 -0
  77. package/dist/{index-DQLcq5fP.js → index-CSLr4i8b.js} +4542 -2157
  78. package/dist/index.d.ts +6 -0
  79. package/dist/model/command.d.ts +47 -34
  80. package/dist/model/context.d.ts +22 -22
  81. package/dist/model/default-part-property-group.d.ts +4 -0
  82. package/dist/model/event.d.ts +0 -56
  83. package/dist/model/model.d.ts +9 -5
  84. package/dist/model/page-builder-editor.d.ts +39 -10
  85. package/dist/model/page-builder-util.d.ts +2 -0
  86. package/dist/model/part-definintion.d.ts +3 -2
  87. package/dist/model/part-manager.d.ts +2 -1
  88. package/dist/model/part-property.d.ts +4 -3
  89. package/dist/model/plugin.d.ts +23 -0
  90. package/dist/page-builder-editor.js +25 -21
  91. package/dist/page-builder-editor.umd.cjs +5299 -2355
  92. package/dist/text/text.d.ts +1 -0
  93. package/package.json +9 -6
  94. package/dist/PbPartAddModal-DuLpnV4E.js +0 -50
  95. package/dist/PbPropertyEditorImage-D85hteOg.js +0 -42
  96. package/dist/PbPropertyEditorProduct-CUSpnV8o.js +0 -49
  97. package/dist/PbPropertyEditorText-DNdXl-Tr.js +0 -41
  98. package/dist/PbWidgetAddModal-CQvFYzfU.js +0 -55
  99. package/dist/components/canvas/PbCanvasFrame.vue.d.ts +0 -2
@@ -1,16 +1,4 @@
1
1
  .group-editor-border {
2
- padding: 4px 8px;
3
- font-size: 0.9em;
4
-
5
- > div {
6
- > label {
7
- min-width: 6em;
8
- max-width: 6em;
9
- padding-right: 0.5em;
10
- font-weight: bold;
11
- }
12
- }
13
-
14
2
  .color {
15
3
  width: 50%;
16
4
  flex: 1;
@@ -22,4 +10,10 @@
22
10
  flex-grow: 1;
23
11
  }
24
12
  }
13
+
14
+ .corner-icon {
15
+ width: 1.1em;
16
+ height: 1.1em;
17
+ fill: #000;
18
+ }
25
19
  }
@@ -1,13 +1,2 @@
1
1
  .group-editor-margin {
2
- padding: 4px 8px;
3
- font-size: 0.9em;
4
-
5
- > div {
6
- > label {
7
- min-width: 6em;
8
- max-width: 6em;
9
- padding-right: 0.5em;
10
- font-weight: bold;
11
- }
12
- }
13
2
  }
@@ -0,0 +1,16 @@
1
+ .group-editor-media {
2
+ button.select-button {
3
+ color: #fff;
4
+ border: none;
5
+ padding: 4px 12px;
6
+ cursor: pointer;
7
+ line-height: 1;
8
+ width: 120px;
9
+ height: 28px;
10
+ background-color: #1f8fff;
11
+ }
12
+
13
+ .input-area {
14
+ height: 24px;
15
+ }
16
+ }
@@ -1,13 +1,2 @@
1
1
  .group-editor-padding {
2
- padding: 4px 8px;
3
- font-size: 0.9em;
4
-
5
- > div {
6
- > label {
7
- min-width: 6em;
8
- max-width: 6em;
9
- padding-right: 0.5em;
10
- font-weight: bold;
11
- }
12
- }
13
2
  }
@@ -1,13 +1,2 @@
1
1
  .group-editor-position {
2
- padding: 4px 8px;
3
- font-size: 0.9em;
4
-
5
- > div {
6
- > label {
7
- min-width: 6em;
8
- max-width: 6em;
9
- padding-right: 0.5em;
10
- font-weight: bold;
11
- }
12
- }
13
2
  }
@@ -1,13 +1,2 @@
1
1
  .group-editor-size {
2
- padding: 4px 8px;
3
- font-size: 0.9em;
4
-
5
- > div {
6
- > label {
7
- min-width: 6em;
8
- max-width: 6em;
9
- padding-right: 0.5em;
10
- font-weight: bold;
11
- }
12
- }
13
2
  }
@@ -1,7 +1,7 @@
1
1
  .property-editor-local-part {
2
2
 
3
- .label {
4
- font-weight: bold;
3
+ .title {
4
+ font-weight: 600;
5
5
  }
6
6
 
7
7
  button {
@@ -1,18 +1,29 @@
1
- declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
1
+ import { PageBuilderToolbarPlugin } from './model/plugin.ts';
2
+
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
4
  instanceId?: string | undefined;
3
5
  title?: string | undefined;
4
- editMode?: string | undefined;
5
- pageContent?: any;
6
- language?: string | undefined;
7
- }>, {
8
- getLocalDesignPartContent: () => any[] | undefined;
9
- }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
+ pageContent?: string | undefined;
7
+ locales?: string[] | undefined;
8
+ locale?: string | undefined;
9
+ toolbarPlugin?: PageBuilderToolbarPlugin | undefined;
10
+ plugin?: unknown;
11
+ }>>, {
12
+ getPageContent: () => string;
13
+ pastePageContent: (contentJson: string) => void;
14
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
15
+ "update-model": (modified: boolean) => void;
16
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
10
17
  instanceId?: string | undefined;
11
18
  title?: string | undefined;
12
- editMode?: string | undefined;
13
- pageContent?: any;
14
- language?: string | undefined;
15
- }>>>, {}, {}>;
19
+ pageContent?: string | undefined;
20
+ locales?: string[] | undefined;
21
+ locale?: string | undefined;
22
+ toolbarPlugin?: PageBuilderToolbarPlugin | undefined;
23
+ plugin?: unknown;
24
+ }>>> & Readonly<{
25
+ "onUpdate-model"?: ((modified: boolean) => any) | undefined;
26
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
16
27
  export default _default;
17
28
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
29
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -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
+ };
@@ -0,0 +1,56 @@
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-CSLr4i8b.js";
4
+ const _hoisted_1 = { class: "property-editor property-editor-color" };
5
+ const _hoisted_2 = { class: "title" };
6
+ const _hoisted_3 = { class: "bs-layout-horizontal flex-align-center color" };
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "PbPropertyEditorColor",
9
+ props: {
10
+ property: {},
11
+ value: {}
12
+ },
13
+ emits: ["update-property-value"],
14
+ setup(__props, { emit: __emit }) {
15
+ const props = __props;
16
+ const emit = __emit;
17
+ const emptyColor = () => {
18
+ };
19
+ const saveOriginalColor = () => {
20
+ };
21
+ const updateColor = (value) => {
22
+ const properties = {};
23
+ properties[props.property.propertyName] = value;
24
+ emit("update-property-value", properties);
25
+ };
26
+ return (_ctx, _cache) => {
27
+ return openBlock(), createElementBlock("div", _hoisted_1, [
28
+ createElementVNode("div", _hoisted_2, [
29
+ withDirectives(createElementVNode("label", null, null, 512), [
30
+ [unref(vT), { key: _ctx.property.caption }]
31
+ ])
32
+ ]),
33
+ createElementVNode("div", _hoisted_3, [
34
+ createVNode(PbColorPicker, {
35
+ value: _ctx.value,
36
+ "hide-delete": "",
37
+ onEmpty: _cache[0] || (_cache[0] = ($event) => emptyColor()),
38
+ onHide: _cache[1] || (_cache[1] = ($event) => updateColor($event)),
39
+ onShow: saveOriginalColor,
40
+ onChangeColor: _cache[2] || (_cache[2] = ($event) => updateColor($event))
41
+ }, null, 8, ["value"]),
42
+ createVNode(unref(BSTextInput), {
43
+ "model-value": _ctx.value,
44
+ prefix: { type: "font-icon", value: "palette" },
45
+ class: "ml-4",
46
+ width: "",
47
+ "onUpdate:modelValue": updateColor
48
+ }, null, 8, ["model-value"])
49
+ ])
50
+ ]);
51
+ };
52
+ }
53
+ });
54
+ export {
55
+ _sfc_main as default
56
+ };
@@ -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-CSLr4i8b.js";
4
+ const _hoisted_1 = { class: "property-editor property-editor-image 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,106 @@
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-CSLr4i8b.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
+ const imageProvider = pageBuilder.getProvider("imageProvider");
25
+ if (imageProvider) {
26
+ imageProvider({ modal, mediaTypes: ["Image"] }, (media2) => {
27
+ updateProperty({ [props.property.propertyName]: media2 });
28
+ });
29
+ }
30
+ };
31
+ const updateProperty = (properties) => {
32
+ pageBuilder.commandRegistry.executeCommand(ChangePropertyCommand.COMMAND_ID, { properties, targetParts: part });
33
+ };
34
+ const updateAltText = (value) => {
35
+ updateProperty({ [props.property.propertyName]: { ...media.value, altText: value } });
36
+ };
37
+ const locales = computed(() => pageBuilder.getLocales());
38
+ const media = computed(() => {
39
+ var _a, _b;
40
+ return (_b = (_a = part == null ? void 0 : part[0]) == null ? void 0 : _a.properties) == null ? void 0 : _b[props.property.propertyName];
41
+ });
42
+ const altText = computed(() => {
43
+ var _a;
44
+ return (_a = media.value) == null ? void 0 : _a.altText;
45
+ });
46
+ const copyUrl = () => {
47
+ if (!media.value || !media.value.fileUrl) return;
48
+ navigator.clipboard.writeText(media.value.fileUrl);
49
+ showNotification({ key: "pb.prop.copied" });
50
+ };
51
+ return (_ctx, _cache) => {
52
+ var _a, _b, _c;
53
+ return openBlock(), createElementBlock("div", _hoisted_1, [
54
+ createElementVNode("div", _hoisted_2, [
55
+ withDirectives(createElementVNode("label", null, null, 512), [
56
+ [unref(vT), { key: _ctx.property.caption || "pb.prop.image" }]
57
+ ])
58
+ ]),
59
+ createElementVNode("div", null, [
60
+ withDirectives(createElementVNode("button", {
61
+ class: "select-button",
62
+ onClick: selectMedia
63
+ }, null, 512), [
64
+ [unref(vT), { key: "pb.prop.selectMedia" }]
65
+ ])
66
+ ]),
67
+ ((_a = media.value) == null ? void 0 : _a.fileUrl) ? (openBlock(), createElementBlock("div", _hoisted_3, [
68
+ _cache[0] || (_cache[0] = createElementVNode("label", null, "URL", -1)),
69
+ createElementVNode("div", _hoisted_4, [
70
+ createTextVNode(toDisplayString((_b = media.value) == null ? void 0 : _b.fileUrl) + " ", 1),
71
+ withDirectives(createVNode(unref(BSButton), {
72
+ class: "border-0 mb-2 pl-0",
73
+ "left-icon": "content_copy",
74
+ onClick: copyUrl
75
+ }, null, 512), [
76
+ [
77
+ unref(vT),
78
+ { key: "pb.menu.copy" },
79
+ void 0,
80
+ { title: true }
81
+ ]
82
+ ])
83
+ ])
84
+ ])) : createCommentVNode("", true),
85
+ ((_c = media.value) == null ? void 0 : _c.mediaType) === "Image" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
86
+ createElementVNode("div", _hoisted_5, [
87
+ withDirectives(createElementVNode("label", null, null, 512), [
88
+ [unref(vT), { key: "pb.prop.altText" }]
89
+ ])
90
+ ]),
91
+ createElementVNode("div", null, [
92
+ createVNode(unref(BSMultiLangTextInput), {
93
+ locales: locales.value,
94
+ "model-value": altText.value,
95
+ width: "100%",
96
+ "onUpdate:modelValue": updateAltText
97
+ }, null, 8, ["locales", "model-value"])
98
+ ])
99
+ ], 64)) : createCommentVNode("", true)
100
+ ]);
101
+ };
102
+ }
103
+ });
104
+ export {
105
+ _sfc_main as default
106
+ };