comand-component-library 4.1.1 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,141 +1,141 @@
1
1
  <template>
2
- <teleport to="body">
3
- <dialog
4
- ref="dialog"
5
- :class="['cmd-fancybox', {'show-overlay': showOverlay, 'image' : fancyBoxImageUrl || fancyBoxGallery, 'image-gallery': fancyBoxGallery}]"
6
- :aria-label="ariaLabelText"
7
- @cancel="onDialogCancel"
8
- >
9
- <header class="flex-container">
10
- <!-- begin CmdHeadline -->
11
- <CmdHeadline
12
- v-if="cmdHeadline?.headlineText"
13
- v-bind="cmdHeadline"
14
- :id="htmlId"
15
- />
16
- <!-- end CmdHeadline -->
17
-
18
- <!-- begin button-wrapper -->
19
- <div
20
- v-if="(fancyboxOptions.printButtons?.color || fancyboxOptions.printButtons?.grayscale) || fancyboxOptions.closeIcon"
21
- class="button-wrapper no-flex"
22
- > <!-- begin print buttons -->
23
- <a v-if="showPrintButtons && fancyboxOptions.printButtons?.color"
24
- href="#"
25
- class="button print-color"
26
- :title="fancyboxOptions.printButtons.color?.tooltip"
27
- @click.prevent="printInGrayscale = false">
28
- <!-- begin CmdIcon -->
29
- <CmdIcon
30
- :iconClass="fancyboxOptions.printButtons.color?.iconClass"
31
- :type="fancyboxOptions.printButtons.color?.iconType"
32
- />
33
- <!-- end CmdIcon -->
34
- </a>
35
- <a v-if="showPrintButtons && fancyboxOptions.printButtons?.grayscale"
36
- href="#"
37
- class="button print-grayscale"
38
- :title="fancyboxOptions.printButtons.grayscale?.tooltip"
39
- @click.prevent="printInGrayscale = true">
40
- <!-- begin CmdIcon -->
41
- <CmdIcon
42
- :iconClass="fancyboxOptions.printButtons.grayscale?.iconClass"
43
- :type="fancyboxOptions.printButtons.grayscale?.iconType"
44
- />
45
- <!-- end CmdIcon -->
46
- </a>
47
- <!-- end print buttons -->
48
-
49
- <!-- begin close-icon -->
50
- <a v-if="fancyboxOptions.closeIcon"
51
- href="#"
52
- class="button"
53
- id="close-dialog"
54
- :title="fancyboxOptions.closeIcon.tooltip"
55
- ref="close-dialog"
56
- @click.prevent="close">
57
- <!-- begin CmdIcon -->
58
- <CmdIcon
59
- :iconClass="fancyboxOptions.closeIcon.iconClass"
60
- :type="fancyboxOptions.closeIcon.iconType"
61
- />
62
- <!-- end CmdIcon -->
63
- </a>
64
- <!-- end close-icon -->
65
- </div>
66
- <!-- end button-wrapper -->
67
- </header>
68
- <div :class="['outer-content-wrapper', {'grayscale' : printInGrayscale}]">
69
- <div v-if="fancyBoxImageUrl || cmdImage?.image" class="content">
70
- <!-- begin CmdImage -->
71
- <CmdImage :image="largeSingleImage" :figcaption="cmdImage?.figcaption" />
72
- <!-- end CmdImage -->
73
- </div>
74
- <div v-else-if="fancyBoxContent" class="content" v-html="fancyBoxContent"></div>
75
- <div v-else-if="fancyBoxElements" class="content" ref="elements"></div>
76
- <div v-else-if="fancyBoxGallery" class="content">
77
- <!-- begin CmdSlideButton -->
78
- <CmdSlideButton @click.prevent="showPrevItem" slideButtonType="prev"/>
79
- <!-- end CmdSlideButton -->
80
-
81
- <!-- begin enlarged image -->
82
- <!-- begin CmdImage -->
83
- <CmdImage :image="largeGalleryImage" :figcaption="fancyBoxGallery[index].figcaption" />
84
- <!-- end CmdImage -->
85
- <!-- end enlarged image -->
86
-
87
- <!-- begin CmdSlideButton -->
88
- <CmdSlideButton @click.prevent="showNextItem"/>
89
- <!-- end CmdSlideButton -->
90
- </div>
91
- <div v-else class="content">
92
- <!-- begin slot-content -->
93
- <slot></slot>
94
- <!-- end slot-content -->
95
- </div>
96
- </div>
97
-
98
- <footer v-if="showSubmitButtons && fancyboxOptions.submitButtons" class="flex-container no-flex">
99
- <!-- begin cancel-button -->
100
- <button
101
- v-if="fancyboxOptions.submitButtons?.cancel"
102
- @click="cancel"
103
- :title="fancyboxOptions.submitButtons.cancel?.tooltip">
2
+ <dialog
3
+ ref="dialog"
4
+ :class="['cmd-fancybox', {'show-overlay': showOverlay, 'image' : fancyBoxImageUrl || fancyBoxGallery, 'image-gallery': fancyBoxGallery}]"
5
+ :aria-label="ariaLabelText"
6
+ @cancel="onDialogCancel"
7
+ >
8
+ <header class="flex-container">
9
+ <!-- begin CmdHeadline -->
10
+ <CmdHeadline
11
+ v-if="cmdHeadline?.headlineText"
12
+ v-bind="cmdHeadline"
13
+ :id="htmlId"
14
+ />
15
+ <!-- end CmdHeadline -->
16
+
17
+ <!-- begin button-wrapper -->
18
+ <div
19
+ v-if="(fancyboxOptions.printButtons?.color || fancyboxOptions.printButtons?.grayscale) || fancyboxOptions.closeIcon"
20
+ class="button-wrapper no-flex"
21
+ > <!-- begin print buttons -->
22
+ <a v-if="showPrintButtons && fancyboxOptions.printButtons?.color"
23
+ href="#"
24
+ class="button print-color"
25
+ :title="fancyboxOptions.printButtons.color?.tooltip"
26
+ @click.prevent="printInGrayscale = false">
27
+ <!-- begin CmdIcon -->
104
28
  <CmdIcon
105
- v-if="fancyboxOptions.submitButtons.cancel?.iconClass"
106
- :iconClass="fancyboxOptions.submitButtons.cancel?.iconClass"
107
- :type="fancyboxOptions.submitButtons.cancel?.iconType"
29
+ :iconClass="fancyboxOptions.printButtons.color?.iconClass"
30
+ :type="fancyboxOptions.printButtons.color?.iconType"
108
31
  />
109
- <span v-if="fancyboxOptions.submitButtons.cancel?.buttonText">{{fancyboxOptions.submitButtons.cancel?.buttonText}}</span>
110
- </button>
111
- <!-- end cancel-button -->
112
-
113
- <!-- begin confirm-button -->
114
- <button
115
- v-if="fancyboxOptions.submitButtons?.confirm"
116
- @click="confirm"
117
- :title="fancyboxOptions.submitButtons.cancel?.tooltip">
32
+ <!-- end CmdIcon -->
33
+ </a>
34
+ <a v-if="showPrintButtons && fancyboxOptions.printButtons?.grayscale"
35
+ href="#"
36
+ class="button print-grayscale"
37
+ :title="fancyboxOptions.printButtons.grayscale?.tooltip"
38
+ @click.prevent="printInGrayscale = true">
39
+ <!-- begin CmdIcon -->
118
40
  <CmdIcon
119
- v-if="fancyboxOptions.submitButtons.confirm?.iconClass"
120
- :iconClass="fancyboxOptions.submitButtons.confirm?.iconClass"
121
- :type="fancyboxOptions.submitButtons.confirm?.iconType"
41
+ :iconClass="fancyboxOptions.printButtons.grayscale?.iconClass"
42
+ :type="fancyboxOptions.printButtons.grayscale?.iconType"
122
43
  />
123
- <span v-if="fancyboxOptions.submitButtons.confirm?.buttonText">{{fancyboxOptions.submitButtons.confirm?.buttonText}}</span>
124
- </button>
125
- <!-- end confirm-button -->
126
- </footer>
127
-
128
- <!-- begin CmdThumbnailScroller -->
129
- <CmdThumbnailScroller
130
- v-if="fancyBoxGallery"
131
- :thumbnailScrollerItems="[...fancyBoxGallery]"
132
- :allowOpenFancyBox="false"
133
- @click="showItem"
134
- :activeItemIndex="index"
135
- />
136
- <!-- end CmdThumbnailScroller -->
137
- </dialog>
138
- </teleport>
44
+ <!-- end CmdIcon -->
45
+ </a>
46
+ <!-- end print buttons -->
47
+
48
+ <!-- begin close-icon -->
49
+ <a v-if="fancyboxOptions.closeIcon"
50
+ href="#"
51
+ class="button"
52
+ id="close-dialog"
53
+ :title="fancyboxOptions.closeIcon.tooltip"
54
+ ref="close-dialog"
55
+ @click.prevent="close">
56
+ <!-- begin CmdIcon -->
57
+ <CmdIcon
58
+ :iconClass="fancyboxOptions.closeIcon.iconClass"
59
+ :type="fancyboxOptions.closeIcon.iconType"
60
+ />
61
+ <!-- end CmdIcon -->
62
+ </a>
63
+ <!-- end close-icon -->
64
+ </div>
65
+ <!-- end button-wrapper -->
66
+ </header>
67
+ <div :class="['outer-content-wrapper', {'grayscale' : printInGrayscale}]">
68
+ <div v-if="fancyBoxImageUrl || cmdImage?.image" class="content">
69
+ <!-- begin CmdImage -->
70
+ <CmdImage :image="largeSingleImage" :figcaption="cmdImage?.figcaption"/>
71
+ <!-- end CmdImage -->
72
+ </div>
73
+ <div v-else-if="fancyBoxContent" class="content" v-html="fancyBoxContent"></div>
74
+ <div v-else-if="fancyBoxElements" class="content" ref="elements"></div>
75
+ <div v-else-if="fancyBoxGallery" class="content">
76
+ <!-- begin CmdSlideButton -->
77
+ <CmdSlideButton @click.prevent="showPrevItem" slideButtonType="prev"/>
78
+ <!-- end CmdSlideButton -->
79
+
80
+ <!-- begin enlarged image -->
81
+ <!-- begin CmdImage -->
82
+ <CmdImage :image="largeGalleryImage" :figcaption="fancyBoxGallery[index].figcaption"/>
83
+ <!-- end CmdImage -->
84
+ <!-- end enlarged image -->
85
+
86
+ <!-- begin CmdSlideButton -->
87
+ <CmdSlideButton @click.prevent="showNextItem"/>
88
+ <!-- end CmdSlideButton -->
89
+ </div>
90
+ <div v-else class="content">
91
+ <!-- begin slot-content -->
92
+ <slot></slot>
93
+ <!-- end slot-content -->
94
+ </div>
95
+ </div>
96
+
97
+ <footer v-if="showSubmitButtons && fancyboxOptions.submitButtons" class="flex-container no-flex">
98
+ <!-- begin cancel-button -->
99
+ <button
100
+ v-if="fancyboxOptions.submitButtons?.cancel"
101
+ @click="cancel"
102
+ :title="fancyboxOptions.submitButtons.cancel?.tooltip">
103
+ <CmdIcon
104
+ v-if="fancyboxOptions.submitButtons.cancel?.iconClass"
105
+ :iconClass="fancyboxOptions.submitButtons.cancel?.iconClass"
106
+ :type="fancyboxOptions.submitButtons.cancel?.iconType"
107
+ />
108
+ <span
109
+ v-if="fancyboxOptions.submitButtons.cancel?.buttonText">{{ fancyboxOptions.submitButtons.cancel?.buttonText }}</span>
110
+ </button>
111
+ <!-- end cancel-button -->
112
+
113
+ <!-- begin confirm-button -->
114
+ <button
115
+ v-if="fancyboxOptions.submitButtons?.confirm"
116
+ @click="confirm"
117
+ :title="fancyboxOptions.submitButtons.cancel?.tooltip">
118
+ <CmdIcon
119
+ v-if="fancyboxOptions.submitButtons.confirm?.iconClass"
120
+ :iconClass="fancyboxOptions.submitButtons.confirm?.iconClass"
121
+ :type="fancyboxOptions.submitButtons.confirm?.iconType"
122
+ />
123
+ <span
124
+ v-if="fancyboxOptions.submitButtons.confirm?.buttonText">{{ fancyboxOptions.submitButtons.confirm?.buttonText }}</span>
125
+ </button>
126
+ <!-- end confirm-button -->
127
+ </footer>
128
+
129
+ <!-- begin CmdThumbnailScroller -->
130
+ <CmdThumbnailScroller
131
+ v-if="fancyBoxGallery"
132
+ :thumbnailScrollerItems="[...fancyBoxGallery]"
133
+ :allowOpenFancyBox="false"
134
+ @click="showItem"
135
+ :activeItemIndex="index"
136
+ />
137
+ <!-- end CmdThumbnailScroller -->
138
+ </dialog>
139
139
  </template>
140
140
 
141
141
  <script>
@@ -333,27 +333,27 @@ const FancyBox = defineComponent({
333
333
  }
334
334
  },
335
335
  computed: {
336
- largeGalleryImage() {
337
- // change src-key for a single item/image in gallery to fit CmdImage-properties
338
- const fancyBoxItem = {...this.fancyBoxGallery[this.index].image}
339
- fancyBoxItem.src = fancyBoxItem.srcImageLarge
340
- return fancyBoxItem
341
- },
342
- largeSingleImage() {
343
- // change src-key for a single item/image to fit CmdImage-properties
344
- const fancyBoxItem = {...this.cmdImage?.image || {}}
345
- if(this.fancyBoxImageUrl) {
346
- fancyBoxItem.src = this.fancyBoxImageUrl
347
- }
348
- return fancyBoxItem
349
- },
350
- ariaLabelText() {
351
- if(this.fancyBoxGallery?.length) {
352
- return this.fancyBoxGallery[this.index].figcaption.text
353
- } else {
354
- return this.defaultAriaLabelText
355
- }
356
- }
336
+ largeGalleryImage() {
337
+ // change src-key for a single item/image in gallery to fit CmdImage-properties
338
+ const fancyBoxItem = {...this.fancyBoxGallery[this.index].image}
339
+ fancyBoxItem.src = fancyBoxItem.srcImageLarge
340
+ return fancyBoxItem
341
+ },
342
+ largeSingleImage() {
343
+ // change src-key for a single item/image to fit CmdImage-properties
344
+ const fancyBoxItem = {...this.cmdImage?.image || {}}
345
+ if (this.fancyBoxImageUrl) {
346
+ fancyBoxItem.src = this.fancyBoxImageUrl
347
+ }
348
+ return fancyBoxItem
349
+ },
350
+ ariaLabelText() {
351
+ if (this.fancyBoxGallery?.length) {
352
+ return this.fancyBoxGallery[this.index].figcaption.text
353
+ } else {
354
+ return this.defaultAriaLabelText
355
+ }
356
+ }
357
357
  },
358
358
  methods: {
359
359
  onDialogCancel(event) {
@@ -370,7 +370,7 @@ const FancyBox = defineComponent({
370
370
  this.$refs.dialog.showModal()
371
371
 
372
372
  // overwrite default behavior of dialog-element, which sets focus on first focusable element inside
373
- this.$refs["close-dialog"].focus()
373
+ this.$refs["close-dialog"]?.focus()
374
374
  },
375
375
  updateContentOnPropertyChange() {
376
376
  this.fancyBoxImageUrl = this.fancyBoxContent = this.fancyBoxElements = null
@@ -629,6 +629,7 @@ export default FancyBox
629
629
 
630
630
  <style lang="scss">
631
631
  @import "../assets/styles/variables";
632
+
632
633
  .cmd-fancybox {
633
634
  @media only screen and (max-width: $medium-max-width) {
634
635
  .outer-content-wrapper {
@@ -678,5 +679,6 @@ export default FancyBox
678
679
  margin-top: var(--default-margin);
679
680
  }
680
681
  }
682
+
681
683
  /* end cmd-fancybox ------------------------------------------------------------------------------------------ */
682
684
  </style>