comand-component-library 3.1.55 → 3.1.58
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": "comand-component-library",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.58",
|
4
4
|
"private": false,
|
5
5
|
"scripts": {
|
6
6
|
"serve": "vue-cli-service serve",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
],
|
19
19
|
"dependencies": {
|
20
20
|
"clickout-event": "^1.1.2",
|
21
|
-
"comand-frontend-framework": "^3.2.
|
21
|
+
"comand-frontend-framework": "^3.2.44",
|
22
22
|
"core-js": "^3.20.1",
|
23
23
|
"prismjs": "^1.27.0",
|
24
24
|
"vue": "^3.2.31",
|
@@ -44,4 +44,4 @@
|
|
44
44
|
"typescript": "~3.9.3",
|
45
45
|
"vue-jest": "^5.0.0-0"
|
46
46
|
}
|
47
|
-
}
|
47
|
+
}
|
package/src/App.vue
CHANGED
@@ -8,9 +8,9 @@
|
|
8
8
|
'has-state': validationStatus && validationStatus !== 'none'
|
9
9
|
}
|
10
10
|
]"
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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="
|
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
|
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'"
|
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"
|
@@ -199,7 +202,7 @@ export default {
|
|
199
202
|
* set default v-model (must be named modelValue in Vue3)
|
200
203
|
*/
|
201
204
|
modelValue: {
|
202
|
-
type: [String, Array],
|
205
|
+
type: [String, Number, Array],
|
203
206
|
default: ""
|
204
207
|
},
|
205
208
|
/**
|
@@ -272,7 +275,7 @@ export default {
|
|
272
275
|
computed: {
|
273
276
|
// get the displayed option name
|
274
277
|
optionName() {
|
275
|
-
// fake a
|
278
|
+
// fake a native selectbox
|
276
279
|
if (this.type !== "checkboxOptions" && this.type !== "content" && this.modelValue) {
|
277
280
|
const result = this.selectData.find(option => option.value === this.modelValue)?.text
|
278
281
|
|
@@ -285,13 +288,11 @@ export default {
|
|
285
288
|
// selectbox with checkbox-options
|
286
289
|
else if (this.type === "checkboxOptions") {
|
287
290
|
if (this.modelValue.length === 1) {
|
288
|
-
return this.selectData.find(option => option.value === this.modelValue[0])?.text
|
291
|
+
return this.selectData.find(option => String(option.value) === String(this.modelValue[0]))?.text
|
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,17 +366,23 @@ export default {
|
|
365
366
|
this.showOptions = !this.showOptions
|
366
367
|
}
|
367
368
|
},
|
368
|
-
// check
|
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
|
}
|
376
383
|
|
377
384
|
this.showOptions = false
|
378
|
-
this.$emit('update:modelValue', optionValue)
|
385
|
+
this.$emit('update:modelValue', optionValue)
|
379
386
|
},
|
380
387
|
// check if a checkbox is changed for selectbox with checkboxes
|
381
388
|
optionSelect(event) {
|
@@ -383,15 +390,15 @@ export default {
|
|
383
390
|
|
384
391
|
let value = [...this.modelValue] // copy array from props
|
385
392
|
if (event.target.checked) {
|
386
|
-
value.push(event.target.value)
|
393
|
+
value.push(event.target.value) // attention: value will be transformed into string!
|
387
394
|
} else {
|
388
|
-
value = value.filter(
|
395
|
+
value = value.filter(item => item !== event.target.value && String(item) !== 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
|
|
394
|
-
this.$emit('update:modelValue', value)
|
401
|
+
this.$emit('update:modelValue', value)
|
395
402
|
},
|
396
403
|
closeOptions() {
|
397
404
|
this.showOptions = false
|
@@ -420,10 +427,10 @@ export default {
|
|
420
427
|
},
|
421
428
|
selectData: {
|
422
429
|
handler() {
|
423
|
-
|
424
|
-
|
425
|
-
|
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
|
package/src/main.js
CHANGED
@@ -5,6 +5,9 @@ import 'comand-frontend-framework/src/assets/css/normalize.css'
|
|
5
5
|
/* import framework-styles */
|
6
6
|
import 'comand-frontend-framework/src/assets/css/framework.css'
|
7
7
|
|
8
|
+
/* import breakpoints */
|
9
|
+
import 'comand-frontend-framework/src/assets/css/breakpoints.css'
|
10
|
+
|
8
11
|
/* import framework-iconfont */
|
9
12
|
import 'comand-frontend-framework/src/assets/css/framework-iconfont.css'
|
10
13
|
/* end imports css from comand-frontend-framework ---------------------------------------------------------------------------------------- */
|