@dcodegroup-au/page-builder 0.1.5 → 0.1.7
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.es.js +884 -882
- package/dist/page-builder.umd.js +42 -42
- package/package.json +1 -1
- package/src/components/builders/PageBuilderCarousel.vue +1 -1
- package/src/components/builders/PageBuilderGrid.vue +1 -1
- package/src/components/builders/PageBuilderLogos.vue +1 -1
- package/src/components/builders/PageBuilderSectionHeader.vue +1 -1
- package/src/components/builders/VHeader.vue +1 -1
- package/src/components/builders/VItems.vue +17 -15
- package/src/components/helpers/pageBuilderFactory.js +25 -14
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
<script setup>
|
|
13
|
-
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps
|
|
13
|
+
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps";
|
|
14
14
|
|
|
15
15
|
const props = defineProps({
|
|
16
16
|
...defaultProps,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
<script setup>
|
|
13
|
-
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps
|
|
13
|
+
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps";
|
|
14
14
|
|
|
15
15
|
const props = defineProps({
|
|
16
16
|
...defaultProps,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</div>
|
|
17
17
|
</template>
|
|
18
18
|
<script setup>
|
|
19
|
-
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps
|
|
19
|
+
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps";
|
|
20
20
|
|
|
21
21
|
const emit = defineEmits(["update"]);
|
|
22
22
|
const route = inject("route");
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
19
|
<script setup>
|
|
20
|
-
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps
|
|
20
|
+
import { defaultProps } from "@/js/vue/components/admin/pages/common/defaultProps";
|
|
21
21
|
|
|
22
22
|
const emit = defineEmits(["update"]);
|
|
23
23
|
const route = inject("route");
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
<script setup>
|
|
43
43
|
import { ref } from "vue";
|
|
44
|
-
import { defaultProps } from "@/components/helpers/defaultProps
|
|
44
|
+
import { defaultProps } from "@/components/helpers/defaultProps";
|
|
45
45
|
import InputWrapper from "@/components/common/InputWrapper.vue";
|
|
46
46
|
|
|
47
47
|
const emit = defineEmits(["update"]);
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
<div class="flex flex-col gap-3">
|
|
31
31
|
<div v-for="(item, index) in dataRef.data"
|
|
32
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':
|
|
34
|
-
<div class="flex flex-1 items-center justify-between relative" @click="
|
|
33
|
+
:class="{'bg-gray-200 hover:bg-gray-200': openItemStates[index]}">
|
|
34
|
+
<div class="flex flex-1 items-center justify-between relative" @click="toggleItem(index);">
|
|
35
35
|
<div class="flex flex-1 flex-col cursor-pointer" @click="edit(item, index)">
|
|
36
36
|
<div class="text-xs text-gray-600">
|
|
37
37
|
{{ singularize(parseName(type)) }} #{{ index + 1 }}
|
|
@@ -53,7 +53,7 @@ import {ref} from "vue";
|
|
|
53
53
|
import PlusIcon from "@/assets/img/icons/plus.svg";
|
|
54
54
|
import { defaultProps } from "@/components/helpers/defaultProps";
|
|
55
55
|
import { singularize, parseName } from "@/components/helpers/common";
|
|
56
|
-
import {
|
|
56
|
+
import { createItem } from "@/components/helpers/pageBuilderFactory";
|
|
57
57
|
import ActionMenu from "@/components/common/ActionMenu.vue";
|
|
58
58
|
import VModal from "@/components/common/VModal.vue";
|
|
59
59
|
|
|
@@ -66,27 +66,29 @@ const dataRef = ref(props.data.component);
|
|
|
66
66
|
const type = dataRef.value.type;
|
|
67
67
|
const modalRef = ref(null);
|
|
68
68
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const key = `${type.value}-openItemStates`;
|
|
70
|
+
const openItemStates = ref(JSON.parse(window.localStorage.getItem(key)));
|
|
71
|
+
if (!openItemStates.value) {
|
|
72
|
+
openItemStates.value = {};
|
|
72
73
|
|
|
73
74
|
dataRef.value.data.forEach((item, index) => {
|
|
74
|
-
|
|
75
|
+
openItemStates.value[index] = false;
|
|
75
76
|
});
|
|
76
77
|
|
|
77
|
-
window.localStorage.setItem(
|
|
78
|
+
window.localStorage.setItem(key, JSON.stringify(openItemStates.value));
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
const
|
|
81
|
-
Object.keys(
|
|
82
|
-
|
|
81
|
+
const toggleItem = (index) => {
|
|
82
|
+
Object.keys(openItemStates.value).forEach((key) => {
|
|
83
|
+
openItemStates.value[key] = false;
|
|
83
84
|
});
|
|
84
|
-
|
|
85
|
-
window.localStorage.setItem(
|
|
85
|
+
openItemStates.value[index] = !openItemStates.value[index];
|
|
86
|
+
window.localStorage.setItem(key, JSON.stringify(openItemStates.value));
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
const addItem = () => {
|
|
89
|
-
|
|
90
|
+
console.log(createItem({}, type.value === 'sliders'))
|
|
91
|
+
dataRef.value.data.push(createItem({}, type.value === 'sliders'));
|
|
90
92
|
emit("update", false);
|
|
91
93
|
};
|
|
92
94
|
|
|
@@ -104,6 +106,6 @@ const edit = (item, index) => {
|
|
|
104
106
|
window.location.href = item.edit_url;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
window.location.href = `/admin/pages/${props?.data?.page?.id}/sections/${props?.data?.sectionIndex}/components/${props?.data?.componentIndex}/
|
|
109
|
+
window.location.href = `/admin/pages/${props?.data?.page?.id}/sections/${props?.data?.sectionIndex}/components/${props?.data?.componentIndex}/items/${index}`;
|
|
108
110
|
};
|
|
109
111
|
</script>
|
|
@@ -1,25 +1,36 @@
|
|
|
1
|
-
export function
|
|
2
|
-
|
|
3
|
-
title: "New
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export function createItem(overrides = {}, withSecondary = true) {
|
|
2
|
+
let data = {
|
|
3
|
+
title: "New Item",
|
|
4
|
+
description: "New description",
|
|
5
|
+
public: false,
|
|
6
|
+
featured_image: "",
|
|
7
|
+
primary_button: {
|
|
8
8
|
show: false,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
label: "",
|
|
10
|
+
type: "site-content",
|
|
11
|
+
url: '',
|
|
12
|
+
is_new_tab: false,
|
|
13
|
+
...(overrides.primary_button || {}),
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!withSecondary) {
|
|
18
|
+
data.primary_button.name = 'Linked to';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (withSecondary) {
|
|
22
|
+
data.secondary_button = {
|
|
16
23
|
show: false,
|
|
17
24
|
label: "",
|
|
18
25
|
type: "site-content",
|
|
19
26
|
url: '',
|
|
20
27
|
is_new_tab: false,
|
|
21
28
|
...(overrides.secondary_button || {}),
|
|
22
|
-
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
...data,
|
|
23
34
|
...overrides,
|
|
24
35
|
};
|
|
25
36
|
}
|