comand-component-library 3.1.73 → 3.1.74

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,7 @@
15
15
  'has-state': validationStatus
16
16
  }]"
17
17
  :for="labelId"
18
+ :title="$attrs.title"
18
19
  ref="label">
19
20
 
20
21
  <!-- begin label-text (+ required asterisk) -->
@@ -23,42 +24,27 @@
23
24
  <span>{{ labelText }}<sup v-if="$attrs.required">*</sup></span>
24
25
 
25
26
  <!-- begin CmdTooltip -->
26
- <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
27
- <!-- begin CmdSystemMessage -->
28
- <CmdSystemMessage
29
- v-if="getValidationMessage"
30
- :message="getValidationMessage"
31
- :validation-status="validationStatus"
32
- :iconClose="{show: false}"
33
- />
34
- <!-- end CmdSystemMessage -->
35
-
36
- <template v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')">
37
- <!-- begin list of requirements -->
38
- <h6>
39
- {{ getMessage("cmdformelement.headline.requirements_for_input") }}<br/>
40
- "{{ labelText }}"
41
- </h6>
42
- <dl class="list-of-requirements">
43
- <template v-for="(requirement, index) in inputRequirements" :key="index">
44
- <dt aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">{{ requirement.message }}:</dt>
45
- <dd :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">
46
- <span aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? iconHasStateSuccess.iconClass : iconHasStateError.iconClass"
47
- :title="requirement.valid(modelValue, $attrs) ? iconHasStateSuccess.tooltip : iconHasStateError.tooltip"></span>
48
- </dd>
49
- </template>
50
- </dl>
51
- <!-- end list of requirements -->
52
-
53
- <!-- begin helplink -->
54
- <hr v-if="helplink?.show"/>
55
- <a v-if="helplink?.show && helplink?.url" :href="helplink.url" :target="helplink.target" @click.prevent>
56
- <span v-if="helplink.icon?.iconClass" :class="helplink.icon?.iconClass" :title="helplink.icon?.tooltip"></span>
57
- <span v-if="helplink.text">{{ helplink.text }}</span>
58
- </a>
59
- <!-- end helplink -->
60
- </template>
61
- </CmdTooltip>
27
+ <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
28
+ <!-- begin CmdSystemMessage -->
29
+ <CmdSystemMessage
30
+ v-if="getValidationMessage"
31
+ :message="getValidationMessage"
32
+ :validation-status="validationStatus"
33
+ :iconClose="{show: false}"
34
+ />
35
+ <!-- end CmdSystemMessage -->
36
+
37
+ <!-- begin CmdListOfRequirements -->
38
+ <CmdListOfRequirements
39
+ v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')"
40
+ :inputRequirements="inputRequirements"
41
+ :helplink="helplink"
42
+ :inputModelValue="modelValue"
43
+ :inputAttributes="$attrs"
44
+ :validationTooltip="validationTooltip"
45
+ />
46
+ <!-- end CmdListOfRequirements -->
47
+ </CmdTooltip>
62
48
  <!-- end CmdTooltip -->
63
49
 
64
50
  <a v-if="$attrs.required || inputRequirements.length"
@@ -226,6 +212,7 @@ import FieldValidation from "../mixins/FieldValidation.js"
226
212
  import Tooltip from "../mixins/Tooltip.js"
227
213
 
228
214
  // import components
215
+ import CmdListOfRequirements from "./CmdListOfRequirements"
229
216
  import CmdSystemMessage from "./CmdSystemMessage"
230
217
  import CmdTooltip from "./CmdTooltip"
231
218
 
@@ -233,6 +220,7 @@ export default {
233
220
  inheritAttrs: false,
234
221
  name: "FormElement",
235
222
  components: {
223
+ CmdListOfRequirements,
236
224
  CmdSystemMessage,
237
225
  CmdTooltip
238
226
  },
@@ -425,7 +413,7 @@ export default {
425
413
  /**
426
414
  * set status for label and form-element
427
415
  *
428
- * @allowedValues: error, success
416
+ * @allowedValues: error, warning, success, info
429
417
  *
430
418
  * @affectsStyling: true
431
419
  */
@@ -810,14 +798,6 @@ export default {
810
798
  right: .5rem
811
799
  }
812
800
 
813
- .cmd-tooltip {
814
- position: absolute;
815
- right: 0;
816
- transform: translateY(calc(-100% - calc(var(--default-margin) / 2)));
817
- left: auto !important;
818
- top: 0 !important;
819
- }
820
-
821
801
  &.has-state, & + .cmd-tooltip {
822
802
  ::placeholder {
823
803
  color: var(--status-color);
@@ -1,18 +1,61 @@
1
1
  <template>
2
- <div :class="['cmd-input-group label', {inline: labelInline, 'multiple-switch': multipleSwitch, disabled: disabled}]">
2
+ <div :class="[
3
+ 'cmd-input-group label',
4
+ validationStatus,
5
+ {inline: labelInline,
6
+ 'multiple-switch': multipleSwitch,
7
+ disabled: disabled,
8
+ 'toggle-switch': toggleSwitch,
9
+ 'has-state': validationStatus
10
+ }
11
+ ]">
3
12
  <span :class="['label-text', { hidden: !showLabel}]" :id="labelId" :aria-labelledby="labelId">
4
- <span>{{ labelText }}<sup v-if="$attrs.required">*</sup></span>
13
+ <span>{{ labelText }}<sup v-if="required">*</sup></span>
14
+
15
+ <!-- begin CmdTooltip -->
16
+ <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
17
+ <!-- begin CmdSystemMessage -->
18
+ <CmdSystemMessage
19
+ v-if="getValidationMessage"
20
+ :message="getValidationMessage"
21
+ :validation-status="validationStatus"
22
+ :iconClose="{show: false}"
23
+ />
24
+ <!-- end CmdSystemMessage -->
25
+
26
+ <!-- begin CmdListOfRequirements -->
27
+ <CmdListOfRequirements
28
+ v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')"
29
+ :inputRequirements="inputRequirements"
30
+ :helplink="helplink"
31
+ :inputModelValue="modelValue"
32
+ :inputAttributes="$attrs"
33
+ />
34
+ <!-- end CmdListOfRequirements -->
35
+ </CmdTooltip>
36
+ <!-- end CmdTooltip -->
37
+
38
+ <a v-if="required || inputRequirements.length"
39
+ href="#"
40
+ @click.prevent
41
+ :class="getStatusIconClass"
42
+ :title="validationTooltip"
43
+ :aria-errormessage="getValidationMessage"
44
+ aria-live="assertive"
45
+ :id="tooltipId"
46
+ :role="validationStatus === 'error' ? 'alert' : 'dialog'">
47
+ </a>
5
48
  </span>
6
49
  <span v-if="!useSlot" :class="['flex-container', {'no-flex': !stretchHorizontally, 'no-gap': multipleSwitch}]">
7
50
  <label v-for="(inputElement, index) in inputElements" :key="index" :for="inputElement.id">
8
51
  <input
9
52
  :type="inputTypes"
10
- :id="inputElement.id"
11
- :name="inputElement.name"
12
- :value="inputElement.value"
13
- v-model="inputValue"
14
- :disabled="disabled"
15
- :class="{'replace-input-type': replaceInputType}"
53
+ :id="inputElement.id"
54
+ :name="inputElement.name"
55
+ :value="inputElement.value"
56
+ v-model="inputValue"
57
+ :disabled="disabled"
58
+ :class="{'replace-input-type': replaceInputType, 'toggle-switch': toggleSwitch}"
16
59
  />
17
60
  <span v-if="multipleSwitch && inputElement.iconClass" :class="inputElement.iconClass"></span>
18
61
  <span v-if="inputElement.labelText">{{ inputElement.labelText }}</span>
@@ -32,10 +75,29 @@
32
75
  <script>
33
76
  import {createUuid} from "../utils/common"
34
77
 
78
+ // import mixins
79
+ import FieldValidation from "../mixins/FieldValidation.js"
80
+ import Tooltip from "../mixins/Tooltip.js"
81
+
82
+ // import components
83
+ import CmdListOfRequirements from "./CmdListOfRequirements"
84
+ import CmdSystemMessage from "./CmdSystemMessage"
85
+ import CmdTooltip from "./CmdTooltip"
86
+
35
87
  export default {
88
+ components: {
89
+ CmdListOfRequirements,
90
+ CmdSystemMessage,
91
+ CmdTooltip
92
+ },
93
+ mixins: [
94
+ FieldValidation,
95
+ Tooltip
96
+ ],
36
97
  data() {
37
98
  return {
38
- value: ""
99
+ value: "",
100
+ validationStatus: ""
39
101
  }
40
102
  },
41
103
  props: {
@@ -46,14 +108,28 @@ export default {
46
108
  type: [Array, String],
47
109
  required: false
48
110
  },
111
+ /**
112
+ * set if input-group should be required
113
+ */
114
+ required: {
115
+ type: Boolean,
116
+ default: false
117
+ },
118
+ /**
119
+ * tooltip for validation
120
+ */
121
+ validationTooltip: {
122
+ type: String,
123
+ default: ""
124
+ },
49
125
  /**
50
126
  * list of input-elements inside group
51
127
  *
52
128
  * useSlot-property must be set to 'false'
53
129
  */
54
130
  inputElements: {
55
- type: Array,
56
- required: false
131
+ type: Array,
132
+ required: false
57
133
  },
58
134
  /**
59
135
  * set type for inputs in group
@@ -64,15 +140,39 @@ export default {
64
140
  type: String,
65
141
  default: "radio"
66
142
  },
143
+ /**
144
+ * set status for label and inner form-elements
145
+ *
146
+ * @allowedValues: error, warning, success, info
147
+ *
148
+ * @affectsStyling: true
149
+ */
150
+ status: {
151
+ type: String,
152
+ required: false
153
+ },
67
154
  /**
68
155
  * for replacing native checkboxes/radio-buttons by custom ones (based on frontend-framework)
69
156
  *
157
+ * toggleSwitch-property must be set to 'false'
158
+ *
70
159
  * @affectsStyling: true
71
160
  */
72
161
  replaceInputType: {
73
162
  type: Boolean,
74
163
  default: false
75
164
  },
165
+ /**
166
+ * for replacing native checkboxes/radio-buttons by toggle-switches (based on frontend-framework)
167
+ *
168
+ * replaceInputType-property must be set to 'false'
169
+ *
170
+ * @affectsStyling: true
171
+ */
172
+ toggleSwitch: {
173
+ type: Boolean,
174
+ default: false
175
+ },
76
176
  /**
77
177
  * activate if input-elements should be given by slot
78
178
  */
@@ -134,7 +234,7 @@ export default {
134
234
  computed: {
135
235
  // get ID for accessibility
136
236
  labelId() {
137
- if(this.$attrs.id !== undefined) {
237
+ if (this.$attrs.id !== undefined) {
138
238
  return this.$attrs.id
139
239
  }
140
240
  return "label-" + createUuid()
@@ -164,6 +264,14 @@ export default {
164
264
  this.$emit("update:modelValue", values)
165
265
  }
166
266
  }
267
+ },
268
+ watch: {
269
+ status: {
270
+ handler() {
271
+ this.validationStatus = this.status
272
+ },
273
+ immediate: true
274
+ }
167
275
  }
168
276
  }
169
277
  </script>
@@ -174,5 +282,31 @@ export default {
174
282
  display: flex;
175
283
  gap: var(--default-gap);
176
284
  }
285
+
286
+ /* overwrite default behavior from frontend-framework */
287
+ &.toggle-switch {
288
+ display: block;
289
+ }
290
+
291
+ /* overwrite default behavior from frontend-framework */
292
+ .label-text {
293
+ display: inline-flex;
294
+
295
+ > a[class*="icon"] {
296
+ margin-left: calc(var(--default-margin) / 2);
297
+ }
298
+ }
299
+
300
+ &.has-state {
301
+ label {
302
+ color: var(--status-color);
303
+ }
304
+
305
+ &.multiple-switch {
306
+ label {
307
+ border-color: var(--status-color);
308
+ }
309
+ }
310
+ }
177
311
  }
178
312
  </style>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="cmd-list-of-requirements">
3
+ <!-- begin cmd-custom-headline -->
4
+ <CmdCustomHeadline :headline-level="cmdCustomHeadline.headlineLevel">
5
+ <!-- {{ getMessage("cmdfakeselect.headline.requirements_for_input") }}<br/>"{{ labelText }}"-->
6
+ </CmdCustomHeadline>
7
+ <!-- end cmd-custom-headline -->
8
+
9
+ <!-- begin list of requirements -->
10
+ <dl>
11
+ <template v-for="(requirement, index) in inputRequirements" :key="index">
12
+ <dt aria-live="assertive" :class="requirement.valid(inputModelValue, inputAttributes) ? 'success' : 'error'">{{ requirement.message }}:</dt>
13
+ <dd :class="requirement.valid(inputModelValue, inputAttributes) ? 'success' : 'error'">
14
+ <span
15
+ aria-live="assertive"
16
+ :class="requirement.valid(inputModelValue, inputAttributes) ? 'icon-check-circle' : 'icon-error-circle'"
17
+ :title="requirement.valid(inputModelValue, inputAttributes) ? 'success' : 'error'"
18
+ >
19
+ </span>
20
+ </dd>
21
+ </template>
22
+ </dl>
23
+ <!-- end list of requirements -->
24
+
25
+ <!-- begin helplink -->
26
+ <template v-if="helplink">
27
+ <hr v-if="helplink.show"/>
28
+ <a
29
+ v-if="helplink.show && helplink.url"
30
+ :href="helplink.url"
31
+ :target="helplink.target"
32
+ @click.prevent
33
+ >
34
+ <span v-if="helplink.icon?.iconClass"
35
+ :class="helplink.icon?.iconClass"
36
+ :title="helplink.icon?.tooltip">
37
+ </span>
38
+ <span v-if="helplink.text">
39
+ {{ helplink.text }}
40
+ </span>
41
+ </a>
42
+ </template>
43
+ <!-- end helplink -->
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import CmdCustomHeadline from "./CmdCustomHeadline"
49
+
50
+ export default {
51
+ name: "CmdListOfRequirements.vue",
52
+ components: {CmdCustomHeadline},
53
+ props: {
54
+ inputModelValue: {
55
+ type: [String, Boolean, Array, Number],
56
+ default: ""
57
+ },
58
+ inputAttributes: {
59
+ type: Object,
60
+ required: true
61
+ },
62
+ /**
63
+ * text for label
64
+ */
65
+ labelText: {
66
+ type: String,
67
+ required: false
68
+ },
69
+ inputRequirements: {
70
+ type: Array,
71
+ required: true
72
+ },
73
+ helplink: {
74
+ type: String,
75
+ required: false
76
+ },
77
+ cmdCustomHeadline: {
78
+ type: Object,
79
+ default() {
80
+ return {
81
+ headlineLevel: 4
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ </script>
88
+
89
+ <style lang="scss">
90
+ /* begin cmd-list-of-requiremnets ------------------------------------------------------------------------------------------ */
91
+ .cmd-list-of-requirements {
92
+ dl {
93
+ .error {
94
+ color: var(--error-color);
95
+ }
96
+
97
+ .warning {
98
+ color: var(--warning-color);
99
+ }
100
+
101
+ .success {
102
+ color: var(--success-color);
103
+ }
104
+
105
+ .info {
106
+ color: var(--info-color);
107
+ }
108
+
109
+ span[class*="icon"] {
110
+ font-size: 1.2rem;
111
+ color: var(--status-color);
112
+ }
113
+
114
+ & ~ a {
115
+ display: flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ text-align: center;
119
+ text-decoration: none;
120
+
121
+ span[class*="icon"] {
122
+ font-size: 1.2rem;
123
+ }
124
+ }
125
+ }
126
+ }
127
+ /* end cmd-list-of-requirements ------------------------------------------------------------------------------------------ */
128
+ </style>
@@ -305,7 +305,7 @@ export default {
305
305
 
306
306
  /* begin offcanvas-navigation */
307
307
  &:not(.persist-on-mobile) {
308
- transition: (--nav-transition);
308
+ transition: var(--nav-transition);
309
309
 
310
310
  #toggle-offcanvas {
311
311
  display: flex;
@@ -433,7 +433,7 @@ export default {
433
433
  height: auto;
434
434
  display: block;
435
435
  opacity: 1;
436
- transition: (--nav-transition);
436
+ transition: var(--nav-transition);
437
437
 
438
438
  > li {
439
439
  > a {
@@ -7,9 +7,6 @@
7
7
  :showLabel="showLabel"
8
8
  v-model="darkMode"
9
9
  :toggle-switch="true"
10
- :useIconsForToggleSwitch="true"
11
- toggle-switch-checked-icon-class="icon-home"
12
- toggle-switch-unchecked-icon-class="icon-globe"
13
10
  />
14
11
  </div>
15
12
  </template>
@@ -1,4 +1,9 @@
1
1
  {
2
+ "modelValue": {
3
+ "comments": [
4
+ "set default v-model (must be named modelValue in Vue3)"
5
+ ]
6
+ },
2
7
  "cmdCustomHeadlineCookieDisclaimer": {
3
8
  "comments": [
4
9
  "properties for CmdCustomHeadline-component at top of cookie disclaimer"
@@ -137,7 +137,7 @@
137
137
  ],
138
138
  "annotations": {
139
139
  "allowedValues": [
140
- "error, success",
140
+ "error, warning, success, info",
141
141
  ""
142
142
  ],
143
143
  "affectsStyling": [
@@ -4,6 +4,16 @@
4
4
  "set value for v-model (must be named modelValue in vue3 if default v-model should be used)"
5
5
  ]
6
6
  },
7
+ "required": {
8
+ "comments": [
9
+ "set if input-group should be required"
10
+ ]
11
+ },
12
+ "validationTooltip": {
13
+ "comments": [
14
+ "tooltip for validation"
15
+ ]
16
+ },
7
17
  "inputElements": {
8
18
  "comments": [
9
19
  "list of input-elements inside group",
@@ -21,9 +31,35 @@
21
31
  ]
22
32
  }
23
33
  },
34
+ "status": {
35
+ "comments": [
36
+ "set status for label and inner form-elements"
37
+ ],
38
+ "annotations": {
39
+ "allowedValues": [
40
+ "error, warning, success, info",
41
+ ""
42
+ ],
43
+ "affectsStyling": [
44
+ "true"
45
+ ]
46
+ }
47
+ },
24
48
  "replaceInputType": {
25
49
  "comments": [
26
- "for replacing native checkboxes/radio-buttons by custom ones (based on frontend-framework)"
50
+ "for replacing native checkboxes/radio-buttons by custom ones (based on frontend-framework)",
51
+ "toggleSwitch-property must be set to 'false'"
52
+ ],
53
+ "annotations": {
54
+ "affectsStyling": [
55
+ "true"
56
+ ]
57
+ }
58
+ },
59
+ "toggleSwitch": {
60
+ "comments": [
61
+ "for replacing native checkboxes/radio-buttons by toggle-switches (based on frontend-framework)",
62
+ "replaceInputType-property must be set to 'false'"
27
63
  ],
28
64
  "annotations": {
29
65
  "affectsStyling": [
@@ -0,0 +1,22 @@
1
+ {
2
+ "labelText": {
3
+ "comments": [
4
+ "text for label"
5
+ ]
6
+ },
7
+ "inputRequirements": {
8
+ "comments": [
9
+ "text for label"
10
+ ]
11
+ },
12
+ "helplink": {
13
+ "comments": [
14
+ "text for label"
15
+ ]
16
+ },
17
+ "cmdCustomHeadline": {
18
+ "comments": [
19
+ "text for label"
20
+ ]
21
+ }
22
+ }
@@ -0,0 +1,10 @@
1
+ export default {
2
+ data() {
3
+ return {
4
+ defaultMessageProperties: {
5
+ "cmdcookiedisclaimer.title.cookie_cannot_be_disabled": "This cookie cannot be disabled, because it is required for functionality!",
6
+ "cmdcookiedisclaimer.title.toggle_to_accept_cookie": "Toggle to accept or reject this cookie!"
7
+ }
8
+ }
9
+ }
10
+ }
@@ -187,7 +187,7 @@ export default {
187
187
  }
188
188
  })
189
189
  }
190
- // check if filed has a minimum length
190
+ // check if field has a minimum length
191
191
  if(this.$attrs.minlength) {
192
192
  standardRequirements.push({
193
193
  message: "Input has minimum length (" + this.modelValue.length + "/" + this.$attrs.minlength + ")",