comand-component-library 3.2.8 → 3.2.9

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "3.2.08",
3
+ "version": "3.2.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -932,7 +932,7 @@
932
932
  <h2 class="headline-demopage">Fancybox</h2>
933
933
  <a href="#" @click.prevent="showFancyBox('text','Some text')">Open FancyBox with text</a>
934
934
  <a href="#"
935
- @click.prevent="showFancyBox('image', 'media/images/content-images/landscape-large.jpg', 'Alternative text')"
935
+ @click.prevent="showFancyBox('image', 'media/images/content-images/landscape-large.jpg', 'Alternative text', 'figcaption')"
936
936
  title="Open FancyBox with large image"
937
937
  >
938
938
  <img src="media/images/content-images/landscape-small.jpg" alt="Alternative text"/>
@@ -1604,11 +1604,11 @@ export default {
1604
1604
  showError() {
1605
1605
  alert("Error")
1606
1606
  },
1607
- showFancyBox(type, content, altText) {
1607
+ showFancyBox(type, content, altText, figcaption) {
1608
1608
  if (type === 'text') {
1609
1609
  openFancyBox({content: content, cmdHeadline: {show: true, headlineText: "Fancybox headline", headlineLevel: 3}})
1610
1610
  } else if (type === 'image') {
1611
- openFancyBox({url: content, altText: altText, cmdHeadline: {show: true, headlineText: "Fancybox headline", headlineLevel: 3}})
1611
+ openFancyBox({url: content, altText: altText, cmdHeadline: {show: true, headlineText: "Fancybox headline", headlineLevel: 3}, figcaption: figcaption})
1612
1612
  }
1613
1613
  },
1614
1614
  getOptionName(option) {
@@ -13,5 +13,10 @@
13
13
  "text": "Option 3",
14
14
  "value": "3",
15
15
  "iconClass": "icon-phone"
16
+ },
17
+ {
18
+ "value": "4",
19
+ "iconClass": "icon-fax",
20
+ "tooltip": "Fax"
16
21
  }
17
22
  ]
@@ -47,12 +47,26 @@
47
47
  <ul :class="{'open': showOptions}" @clickout="closeOptions" :aria-expanded="showOptions">
48
48
  <li>
49
49
  <!-- begin default/selected-option -->
50
- <a href="#" @click.prevent="toggleOptions" @blur="onBlur">
50
+ <a href="#" @click.prevent="toggleOptions" @blur="onBlur" :title="optionIcon?.tooltip">
51
+ <!-- begin show flag -->
51
52
  <img v-if="type === 'country' && optionCountry" :src="pathFlag(optionCountry)" :alt="optionCountry" :class="['flag', optionCountry]"/>
53
+ <!-- end show flag -->
54
+
55
+ <!-- begin show color-box -->
52
56
  <span v-else-if="type === 'color'" :style="'background: ' + optionColor"></span>
53
- <span v-if="optionIcon" :class="optionIcon"></span>
54
- <span class="option-name" :style="limitWidthStyle">{{ optionName }}</span>
57
+ <!-- end show color-box -->
58
+
59
+ <!-- begin optional icon -->
60
+ <span v-if="optionIcon?.iconClass" :class="optionIcon?.iconClass"></span>
61
+ <!-- end optional icon -->
62
+
63
+ <!-- begin text -->
64
+ <span v-if="optionName" class="option-name" :style="limitWidthStyle">{{ optionName }}</span>
65
+ <!-- end text -->
66
+
67
+ <!-- begin custom dropdown-icon -->
55
68
  <span v-if="dropdownIcon" :class="dropdownIcon.iconClass" :title="dropdownIcon.tooltip"></span>
69
+ <!-- end custom dropdown-icon -->
56
70
  </a>
57
71
  <!-- end default/selected-option-->
58
72
 
@@ -60,9 +74,13 @@
60
74
  <ul v-if="type === 'default' && showOptions" role="listbox">
61
75
  <li v-for="(option, index) in selectData" :key="index" role="option" :aria-selected="option.value === modelValue">
62
76
  <!-- begin type 'href' -->
63
- <a v-if="optionLinkType === 'href'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
77
+ <a v-if="optionLinkType === 'href'"
78
+ href="#" @click.prevent="selectOption(option.value)"
79
+ :class="{'active' : option.value === modelValue}"
80
+ :title="option.tooltip"
81
+ >
64
82
  <span v-if="option.iconClass" :class="option.iconClass"></span>
65
- <span>{{ option.text }}</span>
83
+ <span v-if="option.text">{{ option.text }}</span>
66
84
  </a>
67
85
  <!-- end type 'href' -->
68
86
 
@@ -76,27 +94,34 @@
76
94
  </ul>
77
95
  <!-- end default dropdown (incl. optional icon) -->
78
96
 
79
- <!-- begin dropdown with checkboxes -->
97
+ <!-- begin dropdown with checkboxes/countries/colors -->
80
98
  <ul v-else-if="type !== 'default' && type !== 'content' && showOptions" :class="{'checkbox-options': type === 'checkboxOptions'}" :aria-expanded="showOptions">
81
99
  <li v-for="(option, index) in selectData" :key="index">
100
+ <!-- begin checkboxes -->
82
101
  <label v-if="type === 'checkboxOptions'" :for="'option-' + (index + 1)" :class="{'active' : modelValue.includes(`${option.value}`)}">
83
102
  <input type="checkbox" :value="option.value" @change="optionSelect"
84
103
  :checked="compareValues(option.value)" :id="'option-' + (index + 1)"/>
85
104
  <span>{{ option.text }}</span>
86
105
  </label>
106
+ <!-- end checkboxes -->
87
107
 
108
+ <!-- begin country-flags -->
88
109
  <a v-else-if="type === 'country'" href="#"
89
110
  @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
90
111
  <img class="flag" :src="pathFlag(option.value)"
91
112
  :alt="option.text"/>
92
113
  <span>{{ option.text }}</span>
93
114
  </a>
115
+ <!-- end country-flags -->
94
116
 
117
+ <!-- begin color-boxes -->
95
118
  <a v-else-if="type === 'color'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
96
119
  <span class="color" :style="'background: ' + option.value"></span>
97
120
  <span>{{ option.text }}</span>
98
121
  </a>
122
+ <!-- end color-boxe -->
99
123
  </li>
124
+
100
125
  <!-- begin (de)select all options -->
101
126
  <li v-if="showSelectAllOptions && type === 'checkboxOptions'" class="select-all-options">
102
127
  <a href="#" @click.prevent="toggleAllOptions">
@@ -106,7 +131,7 @@
106
131
  </li>
107
132
  <!-- end (de)select all options -->
108
133
  </ul>
109
- <!-- end dropdown with checkboxes -->
134
+ <!-- end dropdown with checkboxes/countries/colors -->
110
135
 
111
136
  <!-- begin dropdown with slot -->
112
137
  <template v-else-if="type === 'content' && showOptions" :aria-expanded="showOptions">
@@ -260,11 +285,11 @@ export default {
260
285
  optionName() {
261
286
  // fake a native selectbox
262
287
  if (this.type !== "checkboxOptions" && this.type !== "content" && this.modelValue) {
263
- const result = this.selectData.find(option => option.value === this.modelValue)?.text
288
+ const result = this.selectData.find(option => option.value === this.modelValue)
264
289
 
265
290
  // if find() returns some data, return this data
266
291
  if (result) {
267
- return result
292
+ return result.text
268
293
  }
269
294
  }
270
295
 
@@ -284,9 +309,15 @@ export default {
284
309
  // get the displayed icon (only available for default selectbox)
285
310
  optionIcon() {
286
311
  if (this.type === "default") {
287
- return this.selectData.find(option => {
312
+
313
+ const selectedOption = this.selectData.find(option => {
288
314
  return option.value === this.modelValue
289
- })?.icon?.iconClass
315
+ })
316
+
317
+ return {
318
+ iconClass: selectedOption?.iconClass,
319
+ tooltip: selectedOption?.tooltip
320
+ }
290
321
  }
291
322
  return null
292
323
  },
@@ -45,6 +45,7 @@
45
45
  id="close-dialog"
46
46
  :class="fancyboxOptions.closeIcon.iconClass"
47
47
  :title="fancyboxOptions.closeIcon.tooltip"
48
+ ref="close-dialog"
48
49
  @click.prevent="close">
49
50
  </a>
50
51
  <!-- end close-icon -->
@@ -54,7 +55,7 @@
54
55
  <div :class="['outer-content-wrapper', {'grayscale' : printInGrayscale}]">
55
56
  <div v-if="fancyBoxImageUrl" class="content">
56
57
  <figure>
57
- <img :src="fancyBoxImageUrl" :alt="altText" />#
58
+ <img :src="fancyBoxImageUrl" :alt="altText" />
58
59
  <figcaption v-if="figcaption">{{ figcaption }}</figcaption>
59
60
  </figure>
60
61
  </div>
@@ -108,8 +109,8 @@ import CmdSlideButton from "./CmdSlideButton.vue"
108
109
  import CmdThumbnailScroller from './CmdThumbnailScroller.vue'
109
110
 
110
111
  const openFancyBox = (config) => {
111
- const node = document.createElement('div');
112
- document.querySelector('body').appendChild(node);
112
+ const node = document.createElement("div");
113
+ document.querySelector("body").appendChild(node);
113
114
  const fb = createApp(FancyBox, {
114
115
  ...config,
115
116
  show: true
@@ -280,10 +281,8 @@ const FancyBox = defineComponent({
280
281
  )
281
282
  },
282
283
  mounted() {
283
- // avoid scrolling if fancybox is shown
284
284
  if (this.showFancyBox) {
285
- document.querySelector("body").classList.add("avoid-scrolling")
286
- this.$refs.dialog.showModal()
285
+ this.showDialog()
287
286
  }
288
287
  },
289
288
  beforeUnmount() {
@@ -293,6 +292,14 @@ const FancyBox = defineComponent({
293
292
  }
294
293
  },
295
294
  methods: {
295
+ showDialog() {
296
+ // avoid scrolling if fancybox is shown
297
+ document.querySelector("body").classList.add("avoid-scrolling")
298
+ this.$refs.dialog.showModal()
299
+
300
+ // overwrite default behavior of dialog-element, which sets focus on first focusable element inside
301
+ this.$refs["close-dialog"].focus()
302
+ },
296
303
  updateContentOnPropertyChange() {
297
304
  this.fancyBoxImageUrl = this.fancyBoxContent = this.fancyBoxElements = null
298
305
  if (this.url) {
@@ -359,21 +366,13 @@ const FancyBox = defineComponent({
359
366
  showFancyBox: {
360
367
  handler() {
361
368
  if (this.showFancyBox) {
362
- // add listener and class to disable scroll
363
- // this.$_FancyBox_verticalScrollPosition = window.scrollY
364
- document.querySelector("body").classList.add("avoid-scrolling")
365
- // window.addEventListener("scroll", this.$_FancyBox_scrollHandler)
366
- this.$refs.dialog.showModal()
369
+ this.showDialog()
367
370
  } else {
368
371
  // remove class to re-enable scrolling
369
372
  document.querySelector("body").classList.remove("avoid-scrolling")
370
- // window.removeEventListener("scroll", this.$_FancyBox_scrollHandler)
371
- // console.log("$_FancyBox_verticalScrollPosition", this.$_FancyBox_verticalScrollPosition)
372
- // window.scrollTo(0, this.$_FancyBox_verticalScrollPosition)
373
373
  this.$refs.dialog.close()
374
374
  }
375
- },
376
- immediate: false
375
+ }
377
376
  }
378
377
  }
379
378
  })
@@ -429,7 +428,7 @@ export default FancyBox
429
428
 
430
429
  &.image {
431
430
  .outer-content-wrapper {
432
- overflow-y: hidden;
431
+ max-height: none;
433
432
  }
434
433
 
435
434
  img {
@@ -2,7 +2,7 @@ export default {
2
2
  // el = real dom-element
3
3
  mounted(el) {
4
4
  // check if element is native input-element
5
- if(el.tagName === "INPUT" || el.tagName === "SELECT" || el.tagName === "TEXTAREA") {
5
+ if(el.tagName === "INPUT" || el.tagName === "SELECT" || el.tagName === "TEXTAREA" || el.tagName === "A") {
6
6
  el.focus()
7
7
  } else {
8
8
  // check if component is used, which contains a native input-element