comand-component-library 3.1.25 → 3.1.29

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.25",
3
+ "version": "3.1.29",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -41,7 +41,6 @@
41
41
  <li><a href="#section-upload-form">Upload-Form</a></li>
42
42
  </ul>
43
43
  </div>
44
-
45
44
  <hr/>
46
45
  </CmdWidthLimitationWrapper>
47
46
 
@@ -65,13 +64,14 @@
65
64
  closeIconClass="icon-single-arrow-down"
66
65
  ref="accordionGroup2"
67
66
  />
68
- <h3>Customized headline-level</h3>
67
+ <h3>Customized headline-level (without transition of content)</h3>
69
68
  <CmdAccordion :accordionData="accordionData.accordionData2"
70
69
  toggleMode="multiple"
71
70
  tooltip="Click to toggle content"
72
71
  openIconClass="icon-single-arrow-up"
73
72
  closeIconClass="icon-single-arrow-down"
74
73
  accordion-headline-level="h4"
74
+ :use-transition="false"
75
75
  />
76
76
  <h3>Data given by slots</h3>
77
77
  <CmdAccordion :accordionData="1">
@@ -137,6 +137,7 @@
137
137
  <CmdFormElement labelText="Input for selectbox:"
138
138
  element="select"
139
139
  :status="formElementStatus"
140
+ v-model:value="selectedOption"
140
141
  :selectOptions="selectOptions"
141
142
  />
142
143
  <CmdFormElement labelText="Input for datalist:"
@@ -904,6 +905,7 @@ export default {
904
905
  multipleSwitchCheckbox: ['b'],
905
906
  multipleSwitchRadio: 'c',
906
907
  fancyBoxCookieDisclaimer: false,
908
+ selectedOption: "2",
907
909
  selectOptions: [
908
910
  {
909
911
  text: "Option 1",
@@ -911,8 +913,7 @@ export default {
911
913
  },
912
914
  {
913
915
  text: "Option 2",
914
- value: "2",
915
- selected: true
916
+ value: "2"
916
917
  },
917
918
  {
918
919
  text: "Option 3",
@@ -2,19 +2,28 @@
2
2
  "accordionData1": [
3
3
  {
4
4
  "headline": "First",
5
- "iconClass": "icon-globe",
5
+ "icon": {
6
+ "iconClass": "icon-globe",
7
+ "tooltip": "Globe"
8
+ },
6
9
  "content": "Text 1",
7
10
  "status": false
8
11
  },
9
12
  {
10
13
  "headline": "Second",
11
- "iconClass": "icon-user-profile",
14
+ "icon": {
15
+ "iconClass": "icon-user-profile",
16
+ "tooltip": "User profile"
17
+ },
12
18
  "content": "Text 2",
13
19
  "status": true
14
20
  },
15
21
  {
16
22
  "headline": "Third",
17
- "iconClass": "icon-home",
23
+ "icon": {
24
+ "iconClass": "icon-home",
25
+ "tooltip": "Home"
26
+ },
18
27
  "content": "Text 3",
19
28
  "status": false
20
29
  }
@@ -1,21 +1,27 @@
1
1
  [
2
2
  {
3
- "type": "href",
3
+ "linkType": "href",
4
4
  "path": "http://www.comand-cms.com",
5
5
  "target": "_blank",
6
- "iconClass": "icon-globe",
7
- "linkName": "CoManD-CMS"
6
+ "icon": {
7
+ "iconClass": "icon-globe",
8
+ "tooltip": "CoManD-CMS"
9
+ }
8
10
  },
9
11
  {
10
- "type": "href",
12
+ "linkType": "href",
11
13
  "path": "#anchor-section4",
12
- "iconClass": "icon-mail",
13
- "linkName": "Contact"
14
+ "icon": {
15
+ "iconClass": "icon-mail",
16
+ "tooltip": "Contact"
17
+ }
14
18
  },
15
19
  {
16
- "type": "href",
20
+ "linkType": "href",
17
21
  "path": "#anchor-section3",
18
- "iconClass": "icon-user-profile",
19
- "tooltip": "Login"
22
+ "icon": {
23
+ "iconClass": "icon-user-profile",
24
+ "tooltip": "Login"
25
+ }
20
26
  }
21
27
  ]
@@ -1,20 +1,20 @@
1
1
  <template>
2
2
  <div :class="['cmd-accordion flex-container vertical', {'no-gap' : !gapBetween, 'active' : active}]">
3
3
  <div v-for="(accordionContent, index) in accordion" :key="index">
4
- <a v-if="!useCustomHeader" href="#" :title="tooltip" @click.prevent="toggleContentVisibility(accordionContent)">
4
+ <a v-if="!useCustomHeader" href="#" :title="accordionContent.status ? iconOpen.icon.tooltip : iconClosed.icon.tooltip" @click.prevent="toggleContentVisibility(accordionContent)">
5
5
  <slot :name="'accordionHeadline' + index">
6
6
  <component :is="accordionHeadlineLevel">
7
- <span v-if="accordionContent.iconClass" :class="accordionContent.iconClass"></span>
7
+ <span v-if="accordionContent.icon && accordionContent.icon.iconClass" :class="accordionContent.icon.iconClass" :title="accordionContent.icon.tooltip"></span>
8
8
  <span v-if="accordionContent.headline">{{ accordionContent.headline }}</span>
9
9
  </component>
10
10
  </slot>
11
- <span class="toggle-icon" :class="[accordionContent.status ? openIconClass : closeIconClass]"></span>
11
+ <span class="toggle-icon" :class="[accordionContent.status ? iconOpen.icon.iconClass : iconClosed.icon.iconClass]"></span>
12
12
  </a>
13
13
  <a v-else href="#" :title="tooltip" @click.prevent="toggleContentVisibility(accordionContent)">
14
14
  <slot :name="'customHeadline' + index"><p>{{ accordionContent.headline }}</p></slot>
15
- <span class="toggle-icon" :class="[accordionContent.status ? openIconClass : closeIconClass]"></span>
15
+ <span class="toggle-icon" :class="[accordionContent.status ? iconOpen.icon.iconClass : iconClosed.icon.iconClass]"></span>
16
16
  </a>
17
- <transition name="fade">
17
+ <transition :name="toggleTransition">
18
18
  <div class="accordion-content" v-if="accordionContent.status" aria-expanded="true">
19
19
  <slot :name="'accordionContent' + index">
20
20
  <p>{{ accordionContent.content }}</p>
@@ -36,9 +36,12 @@ export default {
36
36
  },
37
37
  props: {
38
38
  /**
39
- *
39
+ * use transition to expand accordion-content
40
40
  */
41
-
41
+ useTransition: {
42
+ type: Boolean,
43
+ default: true
44
+ },
42
45
  /**
43
46
  * toggle if mode if only one accordion can be opened (or multiple ones)
44
47
  *
@@ -87,25 +90,37 @@ export default {
87
90
  required: true
88
91
  },
89
92
  /**
90
- * iconClass for icon to expand an accordion
93
+ * icon to expand an accordion
91
94
  */
92
- openIconClass: {
93
- type: String,
94
- default: "icon-single-arrow-up"
95
- },
96
- /**
97
- * iconClass for icon to collapse an accordion
98
- */
99
- closeIconClass: {
100
- type: String,
101
- default: "icon-single-arrow-down"
95
+ iconOpen: {
96
+ type: Object,
97
+ default: function() {
98
+ return {
99
+ icon: {
100
+ iconClass: "icon-single-arrow-up",
101
+ tooltip: "Close content"
102
+ }
103
+ }
104
+ },
102
105
  },
103
106
  /**
104
- * tooltip shown on hover for open/close-icon
107
+ * icon to collapse an accordion
105
108
  */
106
- tooltip: {
107
- type: String,
108
- required: false
109
+ iconClosed: {
110
+ type: Object,
111
+ default: function() {
112
+ return {
113
+ icon: {
114
+ iconClass: "icon-single-arrow-down",
115
+ tooltip: "Show content"
116
+ }
117
+ }
118
+ }
119
+ }
120
+ },
121
+ computed: {
122
+ toggleTransition() {
123
+ return this.useTransition && 'fade'
109
124
  }
110
125
  },
111
126
  methods: {
@@ -1,18 +1,19 @@
1
1
  <template>
2
2
  <label v-if="(element === 'input' || element === 'select' || element === 'textarea')"
3
3
  :for="id"
4
- :class="['cmd-form-element', status, {'inline' : displayinline, 'checked': isChecked}]"
4
+ :class="['cmd-form-element', status, {'inline' : displayLabelInline, 'checked': isChecked}]"
5
5
  ref="label">
6
6
  <!-- begin label (+ required) -->
7
7
  <span v-if="labelText && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
8
- :class="{'hidden': hideLabelText}">
9
- <span>{{ labelText }}</span><sup v-if="$attrs.required && !hideLabel">*</sup>
10
- </span>
8
+ :class="{'hidden': hideLabel}">
9
+ <span>{{ labelText }}</span>
10
+ <sup v-if="$attrs.required">*</sup>
11
+ </span>
11
12
  <!-- end label (+ required) -->
12
13
 
13
14
  <!-- begin icon -->
14
- <span v-if="$attrs.type !== 'checkbox' && $attrs.type !== 'radio' && iconClass" class="place-inside"
15
- :class="[status, iconClass]"></span>
15
+ <span v-if="$attrs.type !== 'checkbox' && $attrs.type !== 'radio' && innerIconClass" class="place-inside"
16
+ :class="[status, innerIconClass]"></span>
16
17
  <!-- end icon -->
17
18
 
18
19
  <!-- begin inputfield -->
@@ -69,7 +70,7 @@
69
70
  @change="$emit('input', $event.target.value)"
70
71
  >
71
72
  <option v-for="(option, index) in selectOptions" :key="index" :value="option.value"
72
- :selected="option.selected">{{ option.text }}
73
+ :selected="option.value === value">{{ option.text }}
73
74
  </option>
74
75
  </select>
75
76
  <!-- end selectbox -->
@@ -127,11 +128,18 @@ export default {
127
128
  }
128
129
  },
129
130
  props: {
131
+ /**
132
+ * set value for v-model
133
+ */
130
134
  value: {
131
135
  type: [String, Boolean, Array, Number],
132
- required: false,
133
136
  default: ""
134
137
  },
138
+ /**
139
+ * set type of native form-element
140
+ *
141
+ * values: input, select, textarea, button
142
+ */
135
143
  element: {
136
144
  type: String,
137
145
  validator(value) {
@@ -142,67 +150,114 @@ export default {
142
150
  },
143
151
  required: true
144
152
  },
153
+ /**
154
+ * hide label (and asterisk if mandatory)
155
+ *
156
+ * label may not be removed, because it is required for accessibility
157
+ */
145
158
  hideLabel: {
146
159
  type: Boolean,
147
160
  default: false
148
161
  },
162
+ /**
163
+ * text for label
164
+ */
149
165
  labelText: {
150
166
  type: String,
151
167
  required: false
152
168
  },
153
- hideLabelText: {
154
- type: Boolean,
155
- default: false
156
- },
169
+ /**
170
+ * allow checkbox/radio-buttons to get value from outside
171
+ */
157
172
  inputValue: {
158
- /* allow checkbox/radiobuttons to get value from outside */
159
173
  type: String,
160
174
  required: false
161
175
  },
162
- /* for replacing native checkboxes/radiobuttons by custom ones */
176
+ /**
177
+ * for replacing native checkboxes/radio-buttons by custom ones (based on frontend-framework)
178
+ */
163
179
  replaceInputType: {
164
180
  type: Boolean,
165
181
  default: false
166
182
  },
183
+ /**
184
+ * set an optional class on native form-element (use native class="" on component ot set class on outer-component-element)
185
+ *
186
+ * may not be named as 'class' because it is a reserved keyword in JavaScript
187
+ */
167
188
  htmlClass: {
168
- /* may not be named as 'class' because it is a reserved keyword in JavaScript */
169
189
  type: String,
170
190
  required: false
171
191
  },
192
+ /**
193
+ * if for native form-element
194
+ */
172
195
  id: {
173
196
  type: String,
174
197
  required: false
175
198
  },
199
+ /**
200
+ * set if a native datalist should be used
201
+ */
176
202
  datalist: {
177
203
  type: Object,
178
204
  required: false
179
205
  },
206
+ /**
207
+ * list of options for selectbox
208
+ *
209
+ * element-property must be 'select'
210
+ */
180
211
  selectOptions: {
181
212
  type: Array,
182
213
  required: false
183
214
  },
215
+ /**
216
+ * text for native button
217
+ */
184
218
  buttonText: {
185
219
  type: String,
186
220
  required: false
187
221
  },
222
+ /**
223
+ * set icon for native button
224
+ */
188
225
  buttonIcon: {
189
226
  type: Object,
190
227
  default() {
191
228
  return {}
192
229
  }
193
230
  },
231
+ /**
232
+ * set text for tooltip
233
+ */
194
234
  tooltipText: {
195
235
  type: String,
196
236
  required: false
197
237
  },
198
- iconClass: {
238
+ /**
239
+ * set class for inner icon (icon placed 'inside' input/ left of input-text)
240
+ *
241
+ * element-property must be 'input' and type-property may not be checkbox or radio
242
+ */
243
+ innerIconClass: {
199
244
  type: String,
200
245
  required: false
201
246
  },
202
- displayinline: {
247
+ /**
248
+ * activate if label-text should be place inline/left of form-element (and not above)
249
+ *
250
+ * type-property may not be checkbox or radio
251
+ */
252
+ displayLabelInline: {
203
253
  type: Boolean,
204
254
  required: false
205
255
  },
256
+ /**
257
+ * set status for label and form-element
258
+ *
259
+ * values: error (red-styling), success (green-styling)
260
+ */
206
261
  status: {
207
262
  type: String,
208
263
  required: false
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <a href="#"
3
3
  @click.prevent
4
- :class="['cmd-slide-button', 'button', slideButtonType.buttonType]"
5
- :title="slideButtonType.buttonType === 'next' ? slideButtonType.tooltip : slideButtonType.tooltip">
4
+ :class="['cmd-slide-button', 'button', slideButtons.next ? 'next' : 'previous']"
5
+ :title="slideButtons.next ? slideButtons.next.tooltip : slideButtons.prev.tooltip">
6
6
  <span
7
- :class="slideButtonType.buttonType === 'next' ? slideButtonType.iconClass : slideButtonType.iconClass"></span>
7
+ :class="slideButtons.next ? slideButtons.next.iconClass : slideButtons.prev.iconClass"></span>
8
8
  </a>
9
9
  </template>
10
10
 
@@ -15,9 +15,20 @@ export default {
15
15
  /**
16
16
  * set slide-button to "next" (= right), else it will be displayed as previous (=left) button
17
17
  */
18
- slideButtonType: {
18
+ slideButtons: {
19
19
  type: Object,
20
- required: true
20
+ default: function() {
21
+ return {
22
+ prev: {
23
+ iconClass: "icon-single-arrow-left",
24
+ tooltip: "Previous"
25
+ },
26
+ next: {
27
+ iconClass: "icon-single-arrow-right",
28
+ tooltip: "Next"
29
+ }
30
+ }
31
+ }
21
32
  }
22
33
  }
23
34
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="cmd-slideshow" :class="{'full-width': fullWidth}">
3
3
  <div class="inner-slideshow-wrapper" @mouseenter="pause = true" @mouseleave="pause = false">
4
- <CmdSlideButton @click.prevent="showPrevItem" :slideButtonType="slideButtons.previous"/>
4
+ <CmdSlideButton @click.prevent="showPrevItem" :slideButtons="slideButtons.prev"/>
5
5
  <transition name="fade">
6
6
  <a v-if="currentItem.href" :href="currentItem.href" :key="index" :title="currentItem.title">
7
7
  <figure v-if="currentItem && !useSlot" class="slideshow-item">
@@ -22,7 +22,7 @@
22
22
  <slot :name="'item' + currentSlotItem"></slot>
23
23
  </div>
24
24
  </transition>
25
- <CmdSlideButton @click.prevent="showNextItem" :slideButtonType="slideButtons.next"/>
25
+ <CmdSlideButton @click.prevent="showNextItem" :slideButtons="slideButtons.next"/>
26
26
  <ol v-if="showQuickLinkIcons">
27
27
  <li v-for="(item, i) in slideshowItems" :key="i" :class="{active: i === index }">
28
28
  <a href="#" @click.prevent="index = i" :aria-label="index"></a>
@@ -104,15 +104,18 @@ export default {
104
104
  type: Object,
105
105
  default() {
106
106
  return {
107
- "next": {
108
- "buttonType": "next",
109
- "iconClass": "icon-single-arrow-right",
110
- "tooltip": "Next"
107
+ next: {
108
+ next: {
109
+ "iconClass": "icon-single-arrow-right",
110
+ "tooltip": "Next"
111
+ }
111
112
  },
112
- "previous": {
113
- "buttonType": "previous",
114
- "iconClass": "icon-single-arrow-left",
115
- "tooltip": "Previous"
113
+ prev: {
114
+ prev: {
115
+ "type": "prev",
116
+ "iconClass": "icon-single-arrow-left",
117
+ "tooltip": "Previous"
118
+ }
116
119
  }
117
120
  }
118
121
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <label :class="['toggle-switch',
2
+ <label :class="['cmd-switch-button', 'toggle-switch',
3
3
  {'switch-label': onLabel && offLabel && !labelText,
4
4
  'colored' : colored, 'on' : colored && isChecked,
5
5
  'off' : colored && !isChecked, 'disabled': $attrs.disabled
@@ -19,38 +19,78 @@ export default {
19
19
  name: "SwitchButton",
20
20
  emits: ["update:value"],
21
21
  props: {
22
+ /**
23
+ * set type for input
24
+ *
25
+ * values: checkbox, radio
26
+ */
22
27
  type: {
23
28
  type: String,
24
29
  required: true
25
30
  },
31
+ /**
32
+ * set id for input
33
+ *
34
+ * required for accessibility
35
+ *
36
+ */
26
37
  id: {
27
38
  type: String,
28
39
  required: true
29
40
  },
41
+ /**
42
+ * set name for input
43
+ *
44
+ * require for radio-buttons (and form-submit by browser)
45
+ */
30
46
  name: {
31
47
  type: String,
32
48
  required: false
33
49
  },
50
+ /**
51
+ * value for v-model
52
+ */
34
53
  value: {
35
54
  type: [String, Array, Boolean],
36
55
  required: false
37
56
  },
57
+ /**
58
+ * set value to pre-check toggle-switch
59
+ */
38
60
  inputValue: {
39
61
  type: String,
40
62
  required: false
41
63
  },
64
+ /**
65
+ * text for label
66
+ *
67
+ * required if onLabel/offLabel are not set
68
+ */
42
69
  labelText: {
43
70
  type: String,
44
71
  required: false
45
72
  },
73
+ /**
74
+ * text for on-label
75
+ *
76
+ * set to activate switch-label (=label is placed on toggle-switch (not behind))
77
+ */
46
78
  onLabel: {
47
79
  type: String,
48
80
  required: false
49
81
  },
82
+ /**
83
+ * text for off-label
84
+ *
85
+ * set to activate switch-label (=label is placed on toggle-switch (not behind))
86
+ */
50
87
  offLabel: {
51
88
  type: String,
52
89
  required: false
53
90
  },
91
+ /**
92
+ * set to true, if checkbox/radio-buttons should have green/checked and red/unchecked color-coding
93
+ */
54
94
  colored: {
55
95
  type: Boolean,
56
96
  required: false
@@ -88,6 +128,8 @@ export default {
88
128
  </script>
89
129
 
90
130
  <style lang="scss">
131
+ /* begin cmd-switch-button ------------------------------------------------------------------------------------------ */
132
+ /* no cmd-prefix-styling (class based on frontend-framework */
91
133
  .toggle-switch {
92
134
  &.switch-label {
93
135
  &.colored {
@@ -123,4 +165,5 @@ export default {
123
165
  }
124
166
  }
125
167
  }
168
+ /* end cmd-switch-button ------------------------------------------------------------------------------------------ */
126
169
  </style>
@@ -1,20 +1,19 @@
1
1
  <template>
2
2
  <transition name="fade">
3
3
  <div
4
- class="cmd-system-message system-message"
5
- :class="[{ 'full-width': fullWidth }, status]"
6
- role="alert"
7
4
  v-if="showSystemMessage"
5
+ :class="['cmd-system-message', 'system-message', { 'full-width': fullWidth }, status]"
6
+ role="alert"
8
7
  >
9
8
  <a
10
- :class="closeIcon.iconClass"
9
+ v-if="iconClose.iconClass"
10
+ :class="iconClose.iconClass"
11
11
  href="#"
12
12
  @click.prevent="showSystemMessage = false"
13
- :title="closeIcon.tooltip"
14
- v-if="closeIcon.iconClass"
13
+ :title="iconClose.tooltip"
15
14
  ></a>
16
15
  <h6>
17
- <span :class="iconClass" v-if="iconClass"></span>
16
+ <span v-if="iconMessage && iconMessage.iconClass && iconMessage.show" :class="iconMessage.iconClass"></span>
18
17
  <strong v-if="message">{{ message }}</strong>
19
18
  </h6>
20
19
  <slot></slot>
@@ -31,23 +30,45 @@ export default {
31
30
  }
32
31
  },
33
32
  props: {
33
+ /**
34
+ * status of message
35
+ *
36
+ * values: error (red), warning (yellow), success (grenn), info (blue)
37
+ */
34
38
  status: {
35
39
  type: String,
36
40
  required: true
37
41
  },
42
+ /**
43
+ * activate to stretch message-box as wide as parent container (else message-box is as wide as message)
44
+ */
38
45
  fullWidth: {
39
46
  type: Boolean,
40
47
  default: true
41
48
  },
42
- iconClass: {
43
- type: String,
44
- default: "icon-warning"
49
+ /**
50
+ * set icon-class for message (will be displayed left from
51
+ */
52
+ iconMessage: {
53
+ type: Object,
54
+ default: function() {
55
+ return {
56
+ iconClass: "icon-warning",
57
+ show: true
58
+ }
59
+ }
45
60
  },
61
+ /**
62
+ * the system-message-text
63
+ */
46
64
  message: {
47
65
  type: String,
48
66
  required: false
49
67
  },
50
- closeIcon: {
68
+ /**
69
+ * icon to close system-message
70
+ */
71
+ iconClose: {
51
72
  type: Object,
52
73
  default: function () {
53
74
  return {