comand-component-library 3.1.56 → 3.1.57

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.1.56",
3
+ "version": "3.1.57",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -125,7 +125,6 @@
125
125
  v-model="fakeSelectCheckbox"
126
126
  defaultOptionName="Options:"
127
127
  :required="true"
128
- :showLabel="false"
129
128
  id="selectbox-with-checkboxes"
130
129
  type="checkboxOptions"
131
130
  :useCustomTooltip="true"
@@ -8,9 +8,9 @@
8
8
  'has-state': validationStatus && validationStatus !== 'none'
9
9
  }
10
10
  ]"
11
- :aria-labelledby="labelText"
12
- :aria-required="$attrs.required !== undefined"
13
- ref="fakeselect"
11
+ :aria-labelledby="labelText"
12
+ :aria-required="$attrs.required !== undefined"
13
+ ref="fakeselect"
14
14
  >
15
15
  <span v-if="showLabel">
16
16
  <!-- begin label -->
@@ -19,14 +19,14 @@
19
19
  </span>
20
20
  <!-- end label -->
21
21
  <a v-if="$attrs.required || inputRequirements.length"
22
- href="#"
23
- @click.prevent
24
- :class="getStatusIconClass"
25
- :title="!useCustomTooltip ? getValidationMessage : ''"
26
- :aria-errormessage="getValidationMessage"
27
- aria-live="assertive"
28
- :id="tooltipId"
29
- :role="validationStatus === 'error' ? 'alert' : 'dialog'">
22
+ href="#"
23
+ @click.prevent
24
+ :class="getStatusIconClass"
25
+ :title="!useCustomTooltip ? getValidationMessage : ''"
26
+ :aria-errormessage="getValidationMessage"
27
+ aria-live="assertive"
28
+ :id="tooltipId"
29
+ :role="validationStatus === 'error' ? 'alert' : 'dialog'">
30
30
  </a>
31
31
  </span>
32
32
  <ul :class="{'open': showOptions}" @clickout="closeOptions">
@@ -66,7 +66,7 @@
66
66
  <li v-for="(option, index) in selectData" :key="index">
67
67
  <label v-if="type === 'checkboxOptions'" :for="'option-' + (index + 1)" :class="{'active' : modelValue.includes(`${option.value}`)}">
68
68
  <input type="checkbox" :value="option.value" @change="optionSelect"
69
- :checked="modelValue.includes(option.value)" :id="'option-' + (index + 1)"/>
69
+ :checked="compareValues(option.value)" :id="'option-' + (index + 1)"/>
70
70
  <span>{{ option.text }}</span>
71
71
  </label>
72
72
 
@@ -82,12 +82,14 @@
82
82
  <span>{{ option.text }}</span>
83
83
  </a>
84
84
  </li>
85
+ <!-- begin (de)select all options -->
85
86
  <li v-if="showSelectAllOptions && type === 'checkboxOptions'" class="select-all-options">
86
87
  <a href="#" @click.prevent="toggleAllOptions">
87
88
  <span :class="selectAllOptionsIcon"></span>
88
89
  <span>{{ selectAllOptionsText }}</span>
89
90
  </a>
90
91
  </li>
92
+ <!-- end (de)select all options -->
91
93
  </ul>
92
94
  <!-- end dropdown with checkboxes -->
93
95
 
@@ -112,12 +114,13 @@
112
114
 
113
115
  <template v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')">
114
116
  <!-- begin list of requirements -->
115
- <h6>{{ getMessage("cmdfakeselect.headline.requirements_for_input") }}<br />"{{labelText}}"</h6>
117
+ <h6>{{ getMessage("cmdfakeselect.headline.requirements_for_input") }}<br/>"{{ labelText }}"</h6>
116
118
  <dl class="list-of-requirements">
117
119
  <template v-for="(requirement, index) in inputRequirements" :key="index">
118
- <dt aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">{{requirement.message}}:</dt>
120
+ <dt aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">{{ requirement.message }}:</dt>
119
121
  <dd :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">
120
- <span aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'icon-check-circle' : 'icon-error-circle'" :title="requirement.valid(modelValue, $attrs) ? 'success' : 'error'"></span>
122
+ <span aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'icon-check-circle' : 'icon-error-circle'"
123
+ :title="requirement.valid(modelValue, $attrs) ? 'success' : 'error'"></span>
121
124
  </dd>
122
125
  </template>
123
126
  </dl>
@@ -125,7 +128,7 @@
125
128
 
126
129
  <!-- begin helplink -->
127
130
  <template v-if="helplink">
128
- <hr v-if="helplink.show" />
131
+ <hr v-if="helplink.show"/>
129
132
  <a v-if="helplink.show && helplink.url"
130
133
  :href="helplink.url"
131
134
  :target="helplink.target"
@@ -289,9 +292,7 @@ export default {
289
292
  } else if (this.modelValue.length > 1) {
290
293
  return this.modelValue.length + " options selected"
291
294
  }
292
- }
293
-
294
- else if (this.selectData?.length) {
295
+ } else if (this.selectData?.length) {
295
296
  return this.selectData[0].text
296
297
  }
297
298
 
@@ -319,7 +320,7 @@ export default {
319
320
  return null
320
321
  },
321
322
  selectAllOptionsText() {
322
- if(Array.isArray(this.modelValue) && this.modelValue.length === this.selectData.length) {
323
+ if (Array.isArray(this.modelValue) && this.modelValue.length === this.selectData.length) {
323
324
  return "Deselect all options"
324
325
  }
325
326
  return "Select all options"
@@ -342,20 +343,20 @@ export default {
342
343
  toggleAllOptions() {
343
344
  this.validationStatus = "success"
344
345
  const checkboxValues = []
345
- if(this.modelValue.length === this.selectData.length) {
346
- if(this.$attrs.required) {
346
+ if (this.modelValue.length === this.selectData.length) {
347
+ if (this.$attrs.required) {
347
348
  this.validationStatus = "error"
348
349
  }
349
350
  } else {
350
351
  for (let i = 0; i < this.selectData.length; i++) {
351
- checkboxValues.push(this.selectData[i].value)
352
+ checkboxValues.push(String(this.selectData[i].value))
352
353
  }
353
354
  }
354
355
 
355
356
  this.$emit("update:modelValue", checkboxValues)
356
357
  },
357
358
  limitWidth() {
358
- if(this.$refs.fakeselect) {
359
+ if (this.$refs.fakeselect) {
359
360
  const outerWidth = this.$refs.fakeselect.offsetWidth
360
361
  this.limitWidthStyle = {width: outerWidth / 100 * 90 + "px"}
361
362
  }
@@ -365,11 +366,17 @@ export default {
365
366
  this.showOptions = !this.showOptions
366
367
  }
367
368
  },
368
- // check is an option is selected for default-selectbox
369
+ // check if array of selected options includes number or string version of value
370
+ compareValues(option) {
371
+ return this.modelValue.some((item) => {
372
+ return item === option || item === String(option)
373
+ })
374
+ },
375
+ // check if an option is selected for default-selectbox
369
376
  selectOption(optionValue) {
370
377
  this.validationStatus = "success"
371
- if(this.$attrs.required !== undefined) {
372
- if(!optionValue) {
378
+ if (this.$attrs.required !== undefined) {
379
+ if (!optionValue) {
373
380
  this.validationStatus = "error"
374
381
  }
375
382
  }
@@ -387,7 +394,7 @@ export default {
387
394
  } else {
388
395
  value = value.filter(v => v !== event.target.value);
389
396
  }
390
- if(this.$attrs.required !== undefined && !value.length) {
397
+ if (this.$attrs.required !== undefined && !value.length) {
391
398
  this.validationStatus = "error"
392
399
  }
393
400
 
@@ -420,10 +427,10 @@ export default {
420
427
  },
421
428
  selectData: {
422
429
  handler() {
423
- // check if given value by modelValue exists (else pre-select first option)
424
- if(this.type === "default" && this.selectData?.length && !this.selectData.some((option) => option.value === this.modelValue)) {
425
- this.$emit("update:modelValue", this.selectData[0].value)
426
- }
430
+ // check if given value by modelValue exists (else pre-select first option)
431
+ if (this.type === "default" && this.selectData?.length && !this.selectData.some((option) => option.value === this.modelValue)) {
432
+ this.$emit("update:modelValue", this.selectData[0].value)
433
+ }
427
434
  },
428
435
  immediate: true,
429
436
  deep: true