@dcodegroup-au/page-builder 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcodegroup-au/page-builder",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/page-builder.es.js"
@@ -31,7 +31,7 @@
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
33
  :class="{'bg-gray-200 hover:bg-gray-200': openItemStates[index]}">
34
- <div class="flex flex-1 items-center justify-between relative" @click="toggleSlide(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 }}
@@ -78,7 +78,7 @@ if (!openItemStates.value) {
78
78
  window.localStorage.setItem(key, JSON.stringify(openItemStates.value));
79
79
  }
80
80
 
81
- const toggleSlide = (index) => {
81
+ const toggleItem = (index) => {
82
82
  Object.keys(openItemStates.value).forEach((key) => {
83
83
  openItemStates.value[key] = false;
84
84
  });
@@ -87,6 +87,7 @@ const toggleSlide = (index) => {
87
87
  };
88
88
 
89
89
  const addItem = () => {
90
+ console.log(createItem({}, type.value === 'sliders'))
90
91
  dataRef.value.data.push(createItem({}, type.value === 'sliders'));
91
92
  emit("update", false);
92
93
  };
@@ -1,6 +1,6 @@
1
1
  export function createItem(overrides = {}, withSecondary = true) {
2
2
  let data = {
3
- title: "New slide",
3
+ title: "New Item",
4
4
  description: "New description",
5
5
  public: false,
6
6
  featured_image: "",
@@ -30,7 +30,7 @@ export function createItem(overrides = {}, withSecondary = true) {
30
30
  }
31
31
 
32
32
  return {
33
- data,
33
+ ...data,
34
34
  ...overrides,
35
35
  };
36
36
  }
@@ -18,8 +18,8 @@
18
18
  <p
19
19
  :class="{'text-gray-700': selectedItem === item, 'text-gray-400': selectedItem !== item}"
20
20
  class="text-sm md:text-md font-normal group-hover:text-gray-700"
21
+ v-html="item.description"
21
22
  >
22
- {{ item.description }}
23
23
  </p>
24
24
  </div>
25
25
  </div>
@@ -69,15 +69,12 @@ const props = defineProps({
69
69
  const component = ref(props.component);
70
70
  const selectedItem = ref(null);
71
71
 
72
- // Filter to get only public tabs
73
72
  const publicTabs = ref(component.value.data.filter((item) => item.public));
74
73
 
75
- // Method to select an item
76
74
  const selectItem = (item) => {
77
75
  selectedItem.value = item;
78
76
  };
79
77
 
80
- // Preselect the first public item on component mount
81
78
  onMounted(() => {
82
79
  if (publicTabs.value.length > 0) {
83
80
  selectItem(publicTabs.value[0]);