@dcodegroup-au/page-builder 0.3.5 → 0.3.6

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.
@@ -13,7 +13,7 @@ const slide = {
13
13
  label: 'Join ELAA',
14
14
  url: '/admin', // external could be an url
15
15
  type: 'site-content',
16
- is_new_tab: true,
16
+ open_in_new_tab: true,
17
17
  },
18
18
  secondary_button: {
19
19
  show: true,
@@ -35,7 +35,7 @@ const tab = {
35
35
  label: 'View all',
36
36
  url: 'google.com', // external could be an url
37
37
  type: 'external-page',
38
- is_new_tab: true,
38
+ open_in_new_tab: true,
39
39
  },
40
40
  }
41
41
 
@@ -62,7 +62,7 @@ const linkCardItem = {
62
62
  label: 'Learn more',
63
63
  url: 'https://beta-frontend.elaa.org.au/img/homepage/asset_free_resources.png', // external could be an url
64
64
  type: 'external-page',
65
- is_new_tab: true,
65
+ open_in_new_tab: true,
66
66
  },
67
67
  }
68
68
 
@@ -87,7 +87,7 @@ const breadcrumbs = [
87
87
  <div>
88
88
  <div style="margin: 40px 0">
89
89
  <h1 style="margin-bottom: 20px; font-size: 50px;">Page Render</h1>
90
- <PageRender :page="AboutUs"/>
90
+ <PageRender :page="BestLife"/>
91
91
  </div>
92
92
  <div style="margin: 40px 0">
93
93
  <h1 style="margin-bottom: 20px; font-size: 50px;">Slider Edit</h1>
@@ -103,7 +103,7 @@ const breadcrumbs = [
103
103
  </div>
104
104
  <div style="margin: 40px 0">
105
105
  <h1 style="margin-bottom: 20px; font-size: 50px;">Page Builder</h1>
106
- <PageBuilder v-model="AboutUs" :breadcrumbs="breadcrumbs"/>
106
+ <PageBuilder v-model="Home" :breadcrumbs="breadcrumbs"/>
107
107
  </div>
108
108
  </div>
109
109
  </template>
@@ -153,7 +153,7 @@ export const BestLife = {
153
153
  label: 'Learn more',
154
154
  url: 'https://beta-frontend.elaa.org.au/img/homepage/asset_free_resources.png', // external could be an url
155
155
  type: 'external-page',
156
- is_new_tab: true,
156
+ open_in_new_tab: false,
157
157
  }
158
158
  },
159
159
  {
@@ -167,7 +167,7 @@ export const BestLife = {
167
167
  label: 'Learn more',
168
168
  url: 'https://beta-frontend.elaa.org.au/img/homepage/asset_free_resources.png', // external could be an url
169
169
  type: 'external-page',
170
- is_new_tab: true,
170
+ open_in_new_tab: true,
171
171
  }
172
172
  },
173
173
  ]
@@ -223,7 +223,7 @@ export const BestLife = {
223
223
  title: 'View all news',
224
224
  url: 'google.com', // external could be an url
225
225
  type: 'external-page',
226
- is_new_tab: true,
226
+ open_in_new_tab: true,
227
227
  show: true,
228
228
  },
229
229
  content: {
@@ -23,7 +23,7 @@ export const Home = {
23
23
  label: 'Join ELAA',
24
24
  url: 'google.com', // external could be an url
25
25
  type: 'site-content',
26
- is_new_tab: true,
26
+ open_in_new_tab: true,
27
27
  },
28
28
  secondary_button: {
29
29
  show: true,
@@ -43,7 +43,7 @@ export const Home = {
43
43
  label: 'Apply now ELAA',
44
44
  url: 'facebook.com', // external could be an url
45
45
  type: 'site-content',
46
- is_new_tab: true,
46
+ open_in_new_tab: true,
47
47
  },
48
48
  secondary_button: {
49
49
  show: true,
@@ -63,7 +63,7 @@ export const Home = {
63
63
  label: 'Apply To Dcodegroup',
64
64
  url: 'facebook.com', // external could be an url
65
65
  type: 'site-content',
66
- is_new_tab: true,
66
+ open_in_new_tab: true,
67
67
  },
68
68
  secondary_button: {
69
69
  show: true,
@@ -83,7 +83,7 @@ export const Home = {
83
83
  label: 'Apply To Image Credits',
84
84
  url: '/admin', // external could be an url
85
85
  type: 'site-content',
86
- is_new_tab: true,
86
+ open_in_new_tab: true,
87
87
  },
88
88
  secondary_button: {
89
89
  show: true,
@@ -176,7 +176,7 @@ export const Home = {
176
176
  label: 'View all',
177
177
  url: 'google.com', // external could be an url
178
178
  type: 'external-page',
179
- is_new_tab: true,
179
+ open_in_new_tab: true,
180
180
  },
181
181
  },
182
182
  {
@@ -190,7 +190,7 @@ export const Home = {
190
190
  label: 'View all',
191
191
  url: 'http://google.com', // external could be an url
192
192
  type: 'external-page',
193
- is_new_tab: true,
193
+ open_in_new_tab: true,
194
194
  },
195
195
  },
196
196
  {
@@ -204,7 +204,7 @@ export const Home = {
204
204
  label: 'View all',
205
205
  url: 'google.com', // external could be an url
206
206
  type: 'external-page',
207
- is_new_tab: true,
207
+ open_in_new_tab: true,
208
208
  },
209
209
  },
210
210
  {
@@ -218,7 +218,7 @@ export const Home = {
218
218
  label: 'View all',
219
219
  url: 'google.com', // external could be an url
220
220
  type: 'external-page',
221
- is_new_tab: true,
221
+ open_in_new_tab: true,
222
222
  },
223
223
  },
224
224
  ]
@@ -280,7 +280,7 @@ export const Home = {
280
280
  title: 'View all news',
281
281
  url: 'google.com', // external could be an url
282
282
  type: 'external-page',
283
- is_new_tab: true,
283
+ open_in_new_tab: true,
284
284
  show: true,
285
285
  },
286
286
  content: {
@@ -357,7 +357,7 @@ export const Home = {
357
357
  title: 'View all events',
358
358
  url: 'google.com', // external could be an url
359
359
  type: 'external-page',
360
- is_new_tab: true,
360
+ open_in_new_tab: true,
361
361
  },
362
362
  content: {
363
363
  label: 'Content',
@@ -366,6 +366,7 @@ export const Home = {
366
366
  {
367
367
  type: 'event',
368
368
  title: 'Change Management – Drop in session',
369
+ url: 'google1.com',
369
370
  description: 'This face to face event is specifically designed for those responsible for the management of OHS in early childhood services.',
370
371
  image: 'https://beta-frontend.elaa.org.au/img/events/event_1.jpg',
371
372
  tags: ['Governance', 'CEO&Leadership', 'Zoom webinar'],
@@ -383,6 +384,7 @@ export const Home = {
383
384
  },
384
385
  {
385
386
  type: 'event',
387
+ url: 'google.com',
386
388
  title: 'Let’s start making sense of OHS: Safety – not child’s play',
387
389
  description: 'This face to face event is specifically designed for those responsible for the management of OHS in early childhood services. Guidance on how to manage risks by addressing the most common hazards faced by the early childhood sector.',
388
390
  image: 'https://beta-frontend.elaa.org.au/img/events/event_2.jpg',
@@ -401,6 +403,7 @@ export const Home = {
401
403
  },
402
404
  {
403
405
  type: 'event',
406
+ url: 'google.com',
404
407
  title: 'DE Regional Governance Training Session',
405
408
  description: 'Guidance on how to manage risks by addressing the most common hazards faced by the early childhood sector.',
406
409
  image: 'https://beta-frontend.elaa.org.au/img/events/event_3.jpg',
@@ -420,6 +423,7 @@ export const Home = {
420
423
  },
421
424
  {
422
425
  type: 'event',
426
+ url: 'google.com',
423
427
  title: 'Change Management – Drop in session 2',
424
428
  description: 'This face to face event is specifically designed for those responsible for the management of OHS in early childhood services.',
425
429
  image: 'https://beta-frontend.elaa.org.au/img/events/event_1.jpg',
@@ -438,6 +442,7 @@ export const Home = {
438
442
  },
439
443
  {
440
444
  type: 'event',
445
+ url: 'google.com',
441
446
  title: 'Let’s start making sense of OHS: Safety – not child’s play 2',
442
447
  description: 'This face to face event is specifically designed for those responsible for the management of OHS in early childhood services. Guidance on how to manage risks by addressing the most common hazards faced by the early childhood sector.',
443
448
  image: 'https://beta-frontend.elaa.org.au/img/events/event_2.jpg',
@@ -456,6 +461,7 @@ export const Home = {
456
461
  },
457
462
  {
458
463
  type: 'event',
464
+ url: 'google.com',
459
465
  title: 'Let’s start making sense of OHS: Safety – not child’s play 3',
460
466
  description: 'This face to face event is specifically designed for those responsible for the management of OHS in early childhood services. Guidance on how to manage risks by addressing the most common hazards faced by the early childhood sector.',
461
467
  image: 'https://beta-frontend.elaa.org.au/img/events/event_2.jpg',
@@ -474,6 +480,7 @@ export const Home = {
474
480
  },
475
481
  {
476
482
  type: 'event',
483
+ url: 'google.com',
477
484
  title: 'Let’s start making sense of OHS: Safety – not child’s play 4',
478
485
  description: 'This face to face event is specifically designed for those responsible for the management of OHS in early childhood services. Guidance on how to manage risks by addressing the most common hazards faced by the early childhood sector.',
479
486
  image: 'https://beta-frontend.elaa.org.au/img/events/event_2.jpg',
@@ -514,7 +521,7 @@ export const Home = {
514
521
  title: 'View all submissions',
515
522
  url: 'google.com', // external could be an url
516
523
  type: 'external-page',
517
- is_new_tab: true,
524
+ open_in_new_tab: true,
518
525
  },
519
526
  content: {
520
527
  label: 'Content',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcodegroup-au/page-builder",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/page-builder.es.js"
@@ -211,7 +211,6 @@ const basicForm = ref({
211
211
  title: props.item.title,
212
212
  description: props.item.description,
213
213
  featured_image: props.item.featured_image,
214
- lines: props.item.lines || [],
215
214
  });
216
215
 
217
216
  const advancedForm = ref({
@@ -235,20 +234,24 @@ const addLine = () => {
235
234
 
236
235
  const removeLine = (index) => {
237
236
  advancedForm.value.lines.splice(index, 1);
238
- emit("update", false);
237
+ this.save();
239
238
  };
240
239
 
241
240
  const save = () => {
242
241
  let form = hasLines.value ? advancedForm : basicForm;
243
- emit("update", form.value);
244
242
 
245
243
  if (props.saveEndpoint) {
246
- axios.post(props.saveEndpoint, form.value).then(() => {
244
+ axios.post(props.saveEndpoint, form.value).then((data) => {
245
+ emit("update", data);
247
246
  if (props.cancelEndpoint) {
248
247
  // window.location.href = props.cancelEndpoint;
249
248
  }
250
249
  });
250
+
251
+ return;
251
252
  }
253
+
254
+ emit("update", form.value);
252
255
  };
253
256
 
254
257
  const close = () => {
@@ -114,12 +114,17 @@ const save = () => {
114
114
  emit("update", form.value);
115
115
 
116
116
  if (props.saveEndpoint) {
117
- axios.post(props.saveEndpoint, form.value).then (() => {
117
+ axios.post(props.saveEndpoint, form.value).then((data) => {
118
+ emit("update", data);
118
119
  if (props.cancelEndpoint) {
119
120
  // window.location.href = props.cancelEndpoint;
120
121
  }
121
- })
122
+ });
123
+
124
+ return;
122
125
  }
126
+
127
+ emit("update", form.value);
123
128
  };
124
129
 
125
130
  const close = () => {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <card v-if="button" :title="button?.name ?? 'Primary button'" class="flex flex-col gap-4 rounded-xl px-6 py-5 mt-4" :classes="classes" :class="classes">
2
+ <card v-if="button" :title="button?.name ?? 'Button'" class="flex flex-col gap-4 rounded-xl px-6 py-5 mt-4" :classes="classes" :class="classes">
3
3
  <div class="flex flex-col gap-8">
4
4
  <VToggle name="show" v-model="button.show" title="Show Button" />
5
5
  <input-wrapper
@@ -58,4 +58,9 @@ export function parseName(str, capitalizeFirst = true) {
58
58
  }
59
59
 
60
60
  return lastWord;
61
- }
61
+ }
62
+
63
+ // Format URL
64
+ export function formatUrl(url) {
65
+ return url?.startsWith("http") ? url : `//${url}`;
66
+ };
@@ -18,7 +18,7 @@ export function createItem(overrides = {}, withSecondary = true, isTimeline = fa
18
18
  label: "",
19
19
  type: "site-content",
20
20
  url: '',
21
- is_new_tab: false,
21
+ open_in_new_tab: false,
22
22
  ...(overrides.primary_button || {}),
23
23
  },
24
24
  }
@@ -32,7 +32,7 @@ export function createItem(overrides = {}, withSecondary = true, isTimeline = fa
32
32
  label: "",
33
33
  type: "site-content",
34
34
  url: '',
35
- is_new_tab: false,
35
+ open_in_new_tab: false,
36
36
  ...(overrides.secondary_button || {}),
37
37
  };
38
38
  }
@@ -31,7 +31,10 @@
31
31
  </span>
32
32
  </div>
33
33
  <h3 class="my-3">
34
- <a class="text-[24px] font-semibold text-gray-900 leading-[32px] hover:underline" :href="slide.url" target="_blank">{{ slide?.title }}</a>
34
+ <a class="text-[24px] font-semibold text-gray-900 leading-[32px] hover:underline"
35
+ :href="formatUrl(slide.url)" target="_blank">
36
+ {{ slide?.title }}
37
+ </a>
35
38
  </h3>
36
39
  <p
37
40
  class="text-base font-normal text-gray-600 leading-[24px] multiline-ellipsis"
@@ -79,8 +82,8 @@
79
82
  <div v-if="component?.button" class="flex justify-center mb-[40px]">
80
83
  <a
81
84
  class="border-brand-300 hover:border-brand-700 border text-brand-700 h-[44px] rounded-full px-[14px] py-[10px] inline-flex gap-1.5 items-center font-semibold text-base"
82
- :href="component.button.url"
83
- :target="component.button.is_new_tab ? '_blank' : ''">
85
+ :href="formatUrl(component.button.url)"
86
+ :target="component.button.open_in_new_tab ? '_blank' : ''">
84
87
  {{ component.button.title }}
85
88
  <ArrowUpRight class="w-5 h-5"></ArrowUpRight>
86
89
  </a>
@@ -96,6 +99,7 @@ import ChevronLeft from "@/assets/img/icons/chevron-left.svg";
96
99
  import ArrowUpRight from "@/assets/img/icons/arrow-up-right.svg";
97
100
  import Ticket from "@/assets/img/icons/ticket-02.svg";
98
101
  import DefaultPrimaryButton from "@/components/presenters/overridables/VCarouselPrimaryButton.vue";
102
+ import { formatUrl } from "@/components/helpers/common";
99
103
 
100
104
  // Inject the FileUpload component or fallback to the default one
101
105
  const VCarouselPrimaryButton = inject("VCarouselPrimaryButton", DefaultPrimaryButton);
@@ -115,11 +119,6 @@ const currentSlide = ref(0); // Start at 0
115
119
  const itemsToShow = 4; // Number of items to show at a time
116
120
  const slides = [...props.component.content?.items || []];
117
121
 
118
- // Format URL
119
- const formatUrl = (url) => {
120
- return url.startsWith("http") ? url : `//${url}`;
121
- };
122
-
123
122
  // Navigate to the next slide
124
123
  const nextSlide = () => {
125
124
  if (currentSlide.value <= slides.length - itemsToShow) {
@@ -44,7 +44,7 @@
44
44
  </div>
45
45
  <a
46
46
  v-if="card?.link"
47
- :href="card.link"
47
+ :href="formatUrl(card.link)"
48
48
  class="text-gray-900 text-lg font-semibold hover:underline block mb-2 w-full"
49
49
  target="_blank"
50
50
  rel="noopener noreferrer"
@@ -61,8 +61,8 @@
61
61
  <div v-if="Object.keys(button).length && button?.show" class="flex justify-center">
62
62
  <a
63
63
  class="border-brand-300 hover:border-brand-700 border text-brand-700 h-[44px] rounded-full px-[14px] py-[10px] inline-flex gap-1.5 items-center font-semibold text-base"
64
- :href="button.url"
65
- :target="button.is_new_tab ? '_blank' : ''"
64
+ :href="formatUrl(button.url)"
65
+ :target="button.open_in_new_tab ? '_blank' : ''"
66
66
  >
67
67
  {{ button.title }}
68
68
  <ArrowUpRight class="w-5 h-5"></ArrowUpRight>
@@ -75,6 +75,7 @@
75
75
  import { ref } from "vue";
76
76
  import ArrowUpRight from "@/assets/img/icons/arrow-up-right.svg";
77
77
  import PlayButton from "@/assets/svg/play.svg";
78
+ import { formatUrl } from "@/components/helpers/common";
78
79
 
79
80
  const props = defineProps({
80
81
  component: {
@@ -45,6 +45,7 @@ import 'vue3-carousel/carousel.css';
45
45
  import { ref } from "vue";
46
46
  import ArrowUpRight from '@/assets/img/icons/arrow-up-right.svg';
47
47
  import {Carousel, Slide} from "vue3-carousel";
48
+ import { formatUrl } from "@/components/helpers/common";
48
49
 
49
50
  const props = defineProps({
50
51
  component: {
@@ -56,10 +57,6 @@ const props = defineProps({
56
57
  const currentSlide = ref(0);
57
58
  const componentData = ref(props.component);
58
59
  const slides = componentData.value.data.filter((o) => o.public);
59
-
60
- const formatUrl = (url) => {
61
- return url.startsWith('http') ? url : `//${url}`;
62
- };
63
60
  </script>
64
61
 
65
62
  <style scoped>
@@ -43,7 +43,7 @@
43
43
  <a
44
44
  v-if="selectedItem?.primary_button?.show"
45
45
  class="text-sm md:text-md font-semibold text-brand-600 flex items-center gap-2 mt-4"
46
- :target="selectedItem?.primary_button?.is_new_tab ? '_blank' : ''"
46
+ :target="selectedItem?.primary_button?.open_in_new_tab ? '_blank' : ''"
47
47
  :href="selectedItem?.primary_button?.url.startsWith('http') ? selectedItem.primary_button.url : `//${selectedItem.primary_button.url}`"
48
48
  >
49
49
  {{ selectedItem?.primary_button?.label ?? 'N/A' }}
@@ -13,8 +13,8 @@
13
13
 
14
14
  <script setup>
15
15
  import { ref, markRaw } from "vue";
16
- import VHeaderPresenter from "@/components/presenters/components/HeaderPresenter.vue";
17
- import VCollectionGridPresenter from "@/components/presenters/components/CollectionGridPresenter.vue";
16
+ import HeaderPresenter from "@/components/presenters/components/HeaderPresenter.vue";
17
+ import CollectionGridPresenter from "@/components/presenters/components/CollectionGridPresenter.vue";
18
18
 
19
19
  const props = defineProps({
20
20
  section: {
@@ -25,9 +25,9 @@ const props = defineProps({
25
25
 
26
26
  const section = ref(props.section);
27
27
  const componentMaps = ref({
28
- header: markRaw(VHeaderPresenter),
29
- news_grid: markRaw(VCollectionGridPresenter),
30
- video_grid: markRaw(VCollectionGridPresenter),
28
+ header: markRaw(HeaderPresenter),
29
+ news_grid: markRaw(CollectionGridPresenter),
30
+ video_grid: markRaw(CollectionGridPresenter),
31
31
  });
32
32
 
33
33
  const currentComponent = (component) => {
@@ -21,8 +21,8 @@
21
21
  <a
22
22
  v-if="data?.primary_button.url"
23
23
  class="text-brand-700 inline-flex gap-1.5 items-center font-semibold text-base"
24
- :href="data.primary_button.url"
25
- :target="data.primary_button.is_new_tab ? '_blank' : ''">
24
+ :href="formatUrl(data.primary_button.url)"
25
+ :target="data.primary_button.open_in_new_tab ? '_blank' : ''">
26
26
  {{ data.primary_button.label }}
27
27
  <ArrowUpRight class="w-5 h-5"></ArrowUpRight>
28
28
  </a>
@@ -36,6 +36,7 @@
36
36
  import {ref, computed} from "vue";
37
37
  import ArrowUpRight from "@/assets/img/icons/arrow-up-right.svg";
38
38
  import IconComponent from "@/components/common/Icon.vue";
39
+ import { formatUrl } from "@/components/helpers/common";
39
40
 
40
41
  const props = defineProps({
41
42
  section: {
@@ -12,7 +12,7 @@
12
12
  <a
13
13
  v-if="link.url"
14
14
  class="text-gray-900 w-full inline-flex justify-between gap-1.5 items-center leading-[28px] font-semibold text-lg hover:underline"
15
- :href="link.url"
15
+ :href="formatUrl(link.url)"
16
16
  :target="link.open_in_new_tab ? '_blank' : ''">
17
17
  <div class="flex gap-4 items-center max-w-[94%] w-full">
18
18
  <LinkExternal class="w-5 h-5"></LinkExternal>
@@ -31,6 +31,7 @@
31
31
  import {ref, computed} from "vue";
32
32
  import ArrowUpRight from "@/assets/img/icons/arrow-up-right.svg";
33
33
  import LinkExternal from "@/assets/img/icons/link-external-01.svg";
34
+ import { formatUrl } from "@/components/helpers/common";
34
35
 
35
36
  const props = defineProps({
36
37
  section: {
@@ -11,7 +11,7 @@
11
11
  </p>
12
12
  <div v-if="component?.type === 'logos'" class="flex flex-wrap justify-center" :class="{'gap-6': isHorizontal, 'gap-12': !isHorizontal}">
13
13
  <template v-for="logo in component.data">
14
- <a :href="logo?.url" title="Brand">
14
+ <a :href="logo?.url" title="Brand" target="_blank">
15
15
  <img v-if="logo?.logo" :src="logo?.logo" :class="getLogoHeight(component?.height)" alt="Brand Logo"/>
16
16
  <span v-else class="text-sm">No photo</span>
17
17
  </a>
@@ -14,6 +14,7 @@
14
14
  <script setup>
15
15
  import Plus from "@/assets/img/icons/plus.svg";
16
16
  import ShoppingCart from "@/assets/img/icons/shopping-cart-01.svg";
17
+ import { formatUrl } from "@/components/helpers/common";
17
18
 
18
19
  const props = defineProps({
19
20
  button: {
@@ -21,8 +22,4 @@ const props = defineProps({
21
22
  required: true,
22
23
  },
23
24
  });
24
-
25
- const formatUrl = (url) => {
26
- return url.startsWith("http") ? url : `//${url}`;
27
- };
28
25
  </script>