@dcodegroup-au/page-builder 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/page-builder.css +1 -1
- package/dist/page-builder.es.js +2496 -2456
- package/dist/page-builder.umd.js +40 -40
- package/example/src/App.vue +1 -1
- package/package.json +1 -1
- package/src/components/PageBuilder.vue +4 -18
- package/src/components/PageRender.vue +1 -1
- package/src/components/builders/VLinks.vue +3 -21
- package/src/components/builders/VSliders.vue +31 -9
- package/src/components/common/ActionMenu.vue +18 -1
- package/src/components/helpers/pageBuilderFactory.js +3 -3
- package/src/components/presenters/components/VSliderPresenter.vue +3 -3
- package/src/components/presenters/modules/HeroHeader.vue +1 -1
- package/tailwind.config.js +9 -0
package/example/src/App.vue
CHANGED
package/package.json
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
<template v-for="(component, index) in parent.components">
|
|
22
22
|
<div
|
|
23
23
|
@click="selectComponent(sectionIndex, component, index)"
|
|
24
|
-
class="flex cursor-pointer items-center justify-between rounded-lg py-1 pl-6 pr-2 hover:bg-gray-
|
|
24
|
+
class="flex cursor-pointer items-center justify-between rounded-lg py-1.5 pl-6 pr-2 hover:bg-gray-100"
|
|
25
|
+
:class="{'bg-gray-200 hover:bg-gray-200': selected?.sectionIndex === sectionIndex && selected?.componentIndex === index}"
|
|
25
26
|
>
|
|
26
27
|
<div class="flex flex-col">
|
|
27
28
|
<div class="text-xs text-gray-600">Sub-module</div>
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
{{ component.name }}
|
|
30
31
|
</div>
|
|
31
32
|
</div>
|
|
32
|
-
<div class="flex items-center justify-between gap-3">
|
|
33
|
+
<div class="flex items-center justify-between gap-3 px-[10px]">
|
|
33
34
|
<ChevronRight class="h-5 w-5" />
|
|
34
35
|
</div>
|
|
35
36
|
</div>
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
</div>
|
|
63
64
|
</template>
|
|
64
65
|
<script setup>
|
|
65
|
-
import { ref,
|
|
66
|
+
import { ref, markRaw, computed } from "vue";
|
|
66
67
|
import ChevronRight from "@/assets/img/icons/chevron-right.svg";
|
|
67
68
|
import ChevronDown from "@/assets/img/icons/chevron-down.svg";
|
|
68
69
|
import Instructions from "@/components/builders/Instructions.vue";
|
|
@@ -134,19 +135,4 @@ const currentComponent = computed(() => {
|
|
|
134
135
|
|
|
135
136
|
return componentMaps.value[selected.value?.component?.type];
|
|
136
137
|
});
|
|
137
|
-
|
|
138
|
-
const update = (data) => {
|
|
139
|
-
// content.value[selected.value.sectionIndex].value.submodules[selected.value.itemIndex] = data;
|
|
140
|
-
|
|
141
|
-
// axios
|
|
142
|
-
// .post("api.admin.pages.update-content", {
|
|
143
|
-
// attributes: content.value,
|
|
144
|
-
// })
|
|
145
|
-
// .then(() => {
|
|
146
|
-
// contentUnchanged.value = true;
|
|
147
|
-
// })
|
|
148
|
-
// .catch((error) => {
|
|
149
|
-
// console.error(error);
|
|
150
|
-
// });
|
|
151
|
-
};
|
|
152
138
|
</script>
|
|
@@ -33,18 +33,7 @@
|
|
|
33
33
|
Link #{{index + 1}}
|
|
34
34
|
</div>
|
|
35
35
|
<div class="relative flex items-end">
|
|
36
|
-
<
|
|
37
|
-
<button
|
|
38
|
-
class="flex min-w-[15rem] items-center gap-2 p-2.5 hover:rounded-md hover:bg-gray-100"
|
|
39
|
-
type="button"
|
|
40
|
-
@click="handleDeleteItem(index)"
|
|
41
|
-
>
|
|
42
|
-
<TrashIcon class="h-5 w-5 cursor-pointer stroke-gray-500"/>
|
|
43
|
-
<span class="text-sm font-medium text-gray-700">
|
|
44
|
-
Delete Link
|
|
45
|
-
</span>
|
|
46
|
-
</button>
|
|
47
|
-
</action-menu>
|
|
36
|
+
<ActionMenu @removeItem="handleDeleteItem(index)"/>
|
|
48
37
|
</div>
|
|
49
38
|
</div>
|
|
50
39
|
<div class="flex flex-col gap-6">
|
|
@@ -83,11 +72,9 @@
|
|
|
83
72
|
<script setup>
|
|
84
73
|
import {ref, nextTick} from "vue";
|
|
85
74
|
import PlusIcon from "@/assets/img/icons/plus.svg";
|
|
86
|
-
import TrashIcon from "@/assets/img/icons/trash-01.svg";
|
|
87
75
|
import {defaultProps} from "@/components/helpers/defaultProps.js";
|
|
88
|
-
import {
|
|
76
|
+
import {createLink} from "@/components/helpers/pageBuilderFactory";
|
|
89
77
|
import ActionMenu from "@/components/common/ActionMenu.vue";
|
|
90
|
-
import VToggle from "@/components/common/VToggle.vue";
|
|
91
78
|
import InputWrapper from "@/components/common/InputWrapper.vue";
|
|
92
79
|
import LinkedTo from "@/components/common/LinkedTo.vue";
|
|
93
80
|
import VModal from "@/components/common/VModal.vue";
|
|
@@ -107,12 +94,7 @@ function addItem() {
|
|
|
107
94
|
if (componentData.value.data.length >= componentData.value.max_items) {
|
|
108
95
|
return;
|
|
109
96
|
}
|
|
110
|
-
componentData.value.data.push(
|
|
111
|
-
title: "",
|
|
112
|
-
type: "site-content",
|
|
113
|
-
url: "",
|
|
114
|
-
openInNewTab: "",
|
|
115
|
-
});
|
|
97
|
+
componentData.value.data.push(createLink());
|
|
116
98
|
|
|
117
99
|
nextTick(() => {
|
|
118
100
|
if (lastItemRef.value) {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex justify-between pb-2">
|
|
3
3
|
<p class="text-lg font-semibold text-gray-900">
|
|
4
|
-
{{
|
|
4
|
+
{{ dataRef.name }}
|
|
5
5
|
</p>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="flex flex-col gap-4">
|
|
8
8
|
<div class="text-gray-600 border-b border-gray-200 pb-4 text-sm">
|
|
9
|
-
{{
|
|
9
|
+
{{ dataRef.supportive_text }}
|
|
10
10
|
</div>
|
|
11
11
|
<div class="flex flex-col gap-3">
|
|
12
12
|
<div class="flex justify-between">
|
|
13
13
|
<div class="flex flex-col gap-1">
|
|
14
14
|
<div class="font-semibold text-gray-900">Sliders</div>
|
|
15
|
-
<div class="text-sm text-gray-600">This slider can contain up to {{
|
|
15
|
+
<div class="text-sm text-gray-600">This slider can contain up to {{ dataRef.max_items }} slides</div>
|
|
16
16
|
</div>
|
|
17
17
|
<div>
|
|
18
18
|
<button
|
|
19
|
-
:disabled="dataRef.data.length >=
|
|
19
|
+
:disabled="dataRef.data.length >= dataRef.max_items"
|
|
20
20
|
@click="addItem"
|
|
21
21
|
type="button"
|
|
22
22
|
class="text-sm cursor-pointer flex items-center justify-center gap-1 rounded-[99px] border border-brand-600 bg-brand-500 px-3.5 py-2 font-semibold text-white hover:bg-brand-600"
|
|
23
|
-
:class="{ 'border-gray-100 bg-gray-100 !text-gray-400 hover:bg-gray-100': dataRef.data.length >=
|
|
23
|
+
:class="{ 'border-gray-100 bg-gray-100 !text-gray-400 hover:bg-gray-100': dataRef.data.length >= dataRef.max_items }"
|
|
24
24
|
>
|
|
25
25
|
<PlusIcon class="h-5 w-5"></PlusIcon>
|
|
26
26
|
<span>Add</span>
|
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
30
|
<div class="flex flex-col gap-3">
|
|
31
|
-
<div
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
<div v-for="(item, index) in dataRef.data"
|
|
32
|
+
class="flex items-center gap-4 px-2 py-1 hover:bg-gray-100 rounded-lg"
|
|
33
|
+
:class="{'bg-gray-200 hover:bg-gray-200': openSlideStates[index]}">
|
|
34
|
+
<div class="flex flex-1 cursor-pointer items-center justify-between relative" @click="toggleSlide(index)">
|
|
35
|
+
<div class="flex flex-1 flex-col">
|
|
34
36
|
<div class="text-xs text-gray-600">
|
|
35
37
|
Slider #{{ index + 1 }}
|
|
36
38
|
</div>
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
{{ item.title }}
|
|
39
41
|
</div>
|
|
40
42
|
</div>
|
|
41
|
-
<ActionMenu @removeItem="handleDeleteItem(index)" />
|
|
43
|
+
<ActionMenu @removeItem="handleDeleteItem(index)" :enable-edit="true" @editItem="edit(item, index)"/>
|
|
42
44
|
</div>
|
|
43
45
|
</div>
|
|
44
46
|
</div>
|
|
@@ -62,6 +64,26 @@ const props = defineProps({
|
|
|
62
64
|
const dataRef = ref(props.data.component);
|
|
63
65
|
const modalRef = ref(null);
|
|
64
66
|
|
|
67
|
+
const openSlideStates = ref(JSON.parse(window.localStorage.getItem("openSlideStates")));
|
|
68
|
+
if (!openSlideStates.value) {
|
|
69
|
+
openSlideStates.value = {};
|
|
70
|
+
|
|
71
|
+
dataRef.value.data.forEach((item, index) => {
|
|
72
|
+
openSlideStates.value[index] = false;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
console.log(openSlideStates)
|
|
76
|
+
window.localStorage.setItem("openSlideStates", JSON.stringify(openSlideStates.value));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const toggleSlide = (index) => {
|
|
80
|
+
Object.keys(openSlideStates.value).forEach((key) => {
|
|
81
|
+
openSlideStates.value[key] = false;
|
|
82
|
+
});
|
|
83
|
+
openSlideStates.value[index] = !openSlideStates.value[index];
|
|
84
|
+
window.localStorage.setItem("openSlideStates", JSON.stringify(openSlideStates.value));
|
|
85
|
+
};
|
|
86
|
+
|
|
65
87
|
const addItem = () => {
|
|
66
88
|
dataRef.value.data.push(createSlide());
|
|
67
89
|
emit("update", dataRef.value);
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
<div class="relative z-50" v-click-outside="click">
|
|
3
3
|
<DotsHorizontal @click="open = !open" class="w-5 cursor-pointer text-gray-600" />
|
|
4
4
|
<div class="absolute -left-60 top-6 w-[240px] rounded-lg border border-gray-200 bg-white" v-if="open">
|
|
5
|
-
<a class="flex items-center gap-2 p-2.5 cursor-pointer h-[48px] w-full" @click="
|
|
5
|
+
<a v-if="enableEdit" class="flex items-center gap-2 p-2.5 cursor-pointer h-[48px] w-full hover:bg-gray-100" @click="edit">
|
|
6
|
+
<Pencil class="w-5" />
|
|
7
|
+
Edit
|
|
8
|
+
</a>
|
|
9
|
+
<a class="flex items-center gap-2 p-2.5 cursor-pointer h-[48px] w-full hover:bg-gray-100" :class="{'hover:rounded-lg': !enableEdit}" @click="remove">
|
|
6
10
|
<TrashIcon class="w-5" />
|
|
7
11
|
Delete
|
|
8
12
|
</a>
|
|
@@ -23,10 +27,18 @@ export default {
|
|
|
23
27
|
<script setup>
|
|
24
28
|
import DotsHorizontal from "@/assets/img/icons/dots-horizontal.svg";
|
|
25
29
|
import TrashIcon from "@/assets/img/icons/trash-01.svg";
|
|
30
|
+
import Pencil from "@/assets/img/icons/pencil-01.svg";
|
|
26
31
|
import { ref } from "vue";
|
|
27
32
|
const open = ref(false);
|
|
28
33
|
const emit = defineEmits(['removeItem']);
|
|
29
34
|
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
enableEdit: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
30
42
|
const click = () => {
|
|
31
43
|
if (!open.value) {
|
|
32
44
|
return;
|
|
@@ -38,4 +50,9 @@ const remove = () => {
|
|
|
38
50
|
emit('removeItem');
|
|
39
51
|
open.value = false;
|
|
40
52
|
}
|
|
53
|
+
|
|
54
|
+
const edit = () => {
|
|
55
|
+
emit('editItem');
|
|
56
|
+
open.value = false;
|
|
57
|
+
}
|
|
41
58
|
</script>
|
|
@@ -26,9 +26,9 @@ export function createSlide(overrides = {}) {
|
|
|
26
26
|
|
|
27
27
|
export function createLink(overrides = {}) {
|
|
28
28
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
open_in_new_tab:
|
|
29
|
+
title: "New link",
|
|
30
|
+
link_to: "",
|
|
31
|
+
open_in_new_tab: true,
|
|
32
32
|
type: "site-content",
|
|
33
33
|
...(overrides || {}),
|
|
34
34
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex h-[872px] w-full bg-navy-800 relative rounded-[48px] z-10">
|
|
3
|
-
<Carousel :items-to-show="1" v-model="currentSlide" class="carousel" autoplay="5000" :wrap-around="true">
|
|
3
|
+
<Carousel :items-to-show="1" v-model="currentSlide" class="carousel w-full" :autoplay="5000" :wrap-around="true">
|
|
4
4
|
<Slide v-for="(slide, index) in component.data" :key="index">
|
|
5
|
-
<div class="lg:p-8 p-4 flex
|
|
5
|
+
<div class="lg:p-8 p-4 flex relative">
|
|
6
6
|
<div class="lg:w-1/2 lg:pl-8 lg:pr-16 pl-4 pr-8 flex flex-col lg:mt-[218px] mt-[100px] absolute top-0 left-5 lg:relative">
|
|
7
7
|
<div class="gap-2 flex z-10 mb-4">
|
|
8
8
|
<a v-if="component.data.length > 1"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
v-if="slide.featured_image"
|
|
33
33
|
:src="slide.featured_image"
|
|
34
34
|
alt="Slide Image"
|
|
35
|
-
class="rounded-[40px] h-[674px] lg:w-1/2 w-full object-cover"/>
|
|
35
|
+
class="rounded-[40px] h-[674px] max-w-[882px] lg:w-1/2 w-full object-cover"/>
|
|
36
36
|
</div>
|
|
37
37
|
</Slide>
|
|
38
38
|
</Carousel>
|
package/tailwind.config.js
CHANGED