comand-component-library 3.1.54 → 3.1.57
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/comand-component-library.css +1 -1
- package/dist/comand-component-library.umd.min.js +1 -1
- package/package.json +3 -3
- package/src/App.vue +0 -1
- package/src/components/CmdBox.vue +6 -3
- package/src/components/CmdFakeSelect.vue +40 -33
- package/src/components/CmdUploadForm.vue +5 -0
- package/src/main.js +3 -0
- package/src/mixins/GlobalCurrency.js +16 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "comand-component-library",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.57",
|
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
@@ -61,7 +61,7 @@
|
|
61
61
|
</div>
|
62
62
|
<div class="box-body">
|
63
63
|
<p v-if="product.articleNumber">{{ getMessage("cmdbox.productbox.article_no") }} {{ product.articleNumber }}</p>
|
64
|
-
<p v-if="product.price" class="price">{{ product.price }}</p>
|
64
|
+
<p v-if="product.price" class="price"><span>{{ product.price }}</span><span :title="globalCurrency.name">{{ globalCurrency.symbol }}</span></p>
|
65
65
|
<p v-if="product.description">{{ product.description }}</p>
|
66
66
|
</div>
|
67
67
|
</a>
|
@@ -94,6 +94,7 @@
|
|
94
94
|
// import mixins
|
95
95
|
import I18n from "../mixins/I18n"
|
96
96
|
import DefaultMessageProperties from "../mixins/CmdBox/DefaultMessageProperties"
|
97
|
+
import GlobalCurrency from "../mixins/GlobalCurrency"
|
97
98
|
|
98
99
|
// import components
|
99
100
|
import CmdCustomHeadline from "./CmdCustomHeadline"
|
@@ -106,7 +107,9 @@ export default {
|
|
106
107
|
CmdListOfLinks,
|
107
108
|
},
|
108
109
|
mixins: [
|
109
|
-
I18n,
|
110
|
+
I18n,
|
111
|
+
DefaultMessageProperties,
|
112
|
+
GlobalCurrency
|
110
113
|
],
|
111
114
|
data() {
|
112
115
|
return {
|
@@ -114,7 +117,7 @@ export default {
|
|
114
117
|
active: true
|
115
118
|
}
|
116
119
|
},
|
117
|
-
emits: [
|
120
|
+
emits: ["click"],
|
118
121
|
props: {
|
119
122
|
collapsingBoxesOpen: {
|
120
123
|
type: Boolean,
|
@@ -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
|
/**
|
@@ -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
|
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
|
-
|
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
|
@@ -857,6 +857,11 @@ export default {
|
|
857
857
|
<style lang="scss">
|
858
858
|
/* begin cmd-upload-form -------------------------------------------------------------------------------------------- */
|
859
859
|
.cmd-upload-form {
|
860
|
+
|
861
|
+
.cmd-custom-headline {
|
862
|
+
margin: 0;
|
863
|
+
}
|
864
|
+
|
860
865
|
.box {
|
861
866
|
background: var(--pure-white-reduced-opacity);
|
862
867
|
|
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 ---------------------------------------------------------------------------------------- */
|