comand-component-library 4.3.27 → 5.0.0
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/dist/comand-component-library.css +1 -1
- package/dist/comand-component-library.js +7568 -7448
- package/dist/styles/demopage-only.css +35 -1
- package/package.json +47 -46
- package/src/ComponentLibrary.vue +2697 -2688
- package/src/assets/data/component-structure.json +1 -1
- package/src/assets/data/form-elements.json +224 -224
- package/src/assets/data/social-networks-page-by-json.json +43 -43
- package/src/assets/styles/component-library-global-styles.scss +296 -295
- package/src/componentSettingsDataAndControls.vue +1 -18
- package/src/components/CmdAccordion.vue +1 -1
- package/src/components/CmdAddressData.vue +6 -1
- package/src/components/CmdAddressDataItem.vue +6 -1
- package/src/components/CmdBasicForm.vue +2 -2
- package/src/components/CmdBox.vue +1103 -1086
- package/src/components/CmdBoxWrapper.vue +11 -1
- package/src/components/CmdBreadcrumbs.vue +2 -2
- package/src/components/CmdCodeOutput.vue +1 -1
- package/src/components/CmdContainer.vue +13 -1
- package/src/components/CmdCookieDisclaimer.vue +480 -480
- package/src/components/CmdFakeSelect.vue +930 -917
- package/src/components/CmdFlexibleScrollContainer.vue +42 -42
- package/src/components/CmdForm.vue +481 -481
- package/src/components/CmdFormElement.vue +1110 -1091
- package/src/components/CmdFormFilters.vue +146 -146
- package/src/components/CmdGoogleMaps.vue +1 -1
- package/src/components/CmdHeadline.vue +21 -4
- package/src/components/CmdIcon.vue +8 -2
- package/src/components/CmdImage.vue +27 -21
- package/src/components/CmdImageZoom.vue +9 -8
- package/src/components/CmdInputGroup.vue +436 -435
- package/src/components/CmdLink.vue +1 -1
- package/src/components/CmdList.vue +3 -3
- package/src/components/CmdListOfRequirements.vue +192 -192
- package/src/components/CmdLoginForm.vue +618 -618
- package/src/components/CmdMailToolFilter.vue +217 -217
- package/src/components/CmdMainNavigation.vue +581 -572
- package/src/components/CmdMultistepFormProgressBar.vue +9 -9
- package/src/components/CmdNewsletterSubscription.vue +199 -199
- package/src/components/CmdPagination.vue +4 -2
- package/src/components/CmdParagraph.vue +10 -4
- package/src/components/CmdProgressBar.vue +72 -72
- package/src/components/CmdSiteHeader.vue +382 -389
- package/src/components/CmdSiteSearch.vue +420 -420
- package/src/components/CmdSiteWrapper.vue +12 -5
- package/src/components/CmdSlideshow.vue +519 -519
- package/src/components/CmdSmartSearch.vue +291 -291
- package/src/components/CmdSystemMessage.vue +3 -2
- package/src/components/CmdTable.vue +401 -401
- package/src/components/CmdTabs.vue +262 -262
- package/src/components/CmdTag.vue +2 -2
- package/src/components/CmdTextImageBlock.vue +8 -2
- package/src/components/CmdThumbnailScroller.vue +0 -7
- package/src/components/CmdToast.vue +1 -1
- package/src/components/CmdToggleDarkMode.vue +13 -11
- package/src/components/CmdTooltip.vue +305 -301
- package/src/components/CmdUploadForm.vue +1299 -1305
- package/src/components/CmdWidthLimitationWrapper.vue +1 -1
- package/src/components/EditComponentWrapper.vue +5 -5
- package/src/index.js +5 -0
- package/src/main.js +4 -3
- package/src/utils/template.js +57 -0
- package/dist/styles/templates/casual.css +0 -3
- package/src/assets/styles/template.css +0 -1
|
@@ -1,402 +1,402 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- begin CmdTableWrapper ---------------------------------------------------------------------------------------- -->
|
|
3
|
-
<div
|
|
4
|
-
:class="['cmd-table-wrapper', {'collapsed': !showTableData, 'full-width': fullWidth, 'has-caption': hasCaption, 'has-overflow': hasOverflow}]">
|
|
5
|
-
<div v-if="collapsible || userCanToggleWidth" class="button-wrapper">
|
|
6
|
-
<!-- begin button to toggle table-width -->
|
|
7
|
-
<CmdLink
|
|
8
|
-
v-if="userCanToggleWidth"
|
|
9
|
-
v-bind="cmdLinkToggleWidthProperties"
|
|
10
|
-
@click="fullWidth = !fullWidth"
|
|
11
|
-
/>
|
|
12
|
-
<!-- end button to toggle table-width -->
|
|
13
|
-
|
|
14
|
-
<!-- begin button to collapse table-content -->
|
|
15
|
-
<CmdLink v-if="collapsible"
|
|
16
|
-
v-bind="cmdLinkToggleExpandProperties"
|
|
17
|
-
@click.prevent="showTableData = !showTableData"
|
|
18
|
-
:title="showTableData ? iconCollapse.tooltip : iconExpand.tooltip"
|
|
19
|
-
>
|
|
20
|
-
<!-- begin CmdIcon -->
|
|
21
|
-
<CmdIcon :iconClass="showTableData ? iconCollapse.iconClass : iconExpand.iconClass"
|
|
22
|
-
:type="showTableData ? iconCollapse.iconType : iconExpand.iconType"/>
|
|
23
|
-
<!-- end CmdIcon -->
|
|
24
|
-
</CmdLink>
|
|
25
|
-
<!-- end button to collapse table-content -->
|
|
26
|
-
</div>
|
|
27
|
-
<div class="inner-wrapper" ref="innerWrapper" @scroll="updatePosition">
|
|
28
|
-
<!-- begin CmdSlideButton -->
|
|
29
|
-
<CmdSlideButton
|
|
30
|
-
v-if="showSlideButtons"
|
|
31
|
-
@click.prevent="scrollLeft"
|
|
32
|
-
slideButtonType="left"
|
|
33
|
-
/>
|
|
34
|
-
<!-- end CmdSlideButton -->
|
|
35
|
-
|
|
36
|
-
<!-- begin table -->
|
|
37
|
-
<table ref="table" :class="{'full-width': fullWidth}">
|
|
38
|
-
<slot name="table-caption">
|
|
39
|
-
<caption v-if="tableData.caption?.text || caption?.text" :class="{ hidden: hideCaption }">
|
|
40
|
-
{{ caption?.text || tableData.caption?.text }}
|
|
41
|
-
</caption>
|
|
42
|
-
</slot>
|
|
43
|
-
<slot name="table-head">
|
|
44
|
-
<thead>
|
|
45
|
-
<tr>
|
|
46
|
-
<th v-for="(tablehead, indexHead) in tableData.thead" :key="indexHead" v-html="tablehead"></th>
|
|
47
|
-
</tr>
|
|
48
|
-
</thead>
|
|
49
|
-
</slot>
|
|
50
|
-
<transition :name="transition">
|
|
51
|
-
<slot name="table-body">
|
|
52
|
-
<tbody v-show="showTableData"
|
|
53
|
-
<tr :class="{'active' : tableData.rowIndexHighlighted === indexRows}"
|
|
54
|
-
v-for="(tablerows, indexRows) in tableData.tbody" :key="indexRows">
|
|
55
|
-
<td :class="{'active' : tableData.columnIndexHighlighted === indexData}"
|
|
56
|
-
v-for="(tabledata, indexData) in tablerows" :key="indexData" v-html="tabledata">
|
|
57
|
-
</td>
|
|
58
|
-
</tr>
|
|
59
|
-
</tbody>
|
|
60
|
-
</slot>
|
|
61
|
-
</transition>
|
|
62
|
-
<transition :name="transition">
|
|
63
|
-
<slot name="table-foot">
|
|
64
|
-
<tfoot v-if="tableData.tfoot && tableData.tfoot.length && showTableData"
|
|
65
|
-
<tr>
|
|
66
|
-
<td :class="{'active' : tableData.columnIndexHighlighted === indexFoot}"
|
|
67
|
-
v-for="(tablefoot, indexFoot) in tableData.tfoot" :key="indexFoot" v-html="tablefoot">
|
|
68
|
-
</td>
|
|
69
|
-
</tr>
|
|
70
|
-
</tfoot>
|
|
71
|
-
</slot>
|
|
72
|
-
</transition>
|
|
73
|
-
</table>
|
|
74
|
-
<!-- end table -->
|
|
75
|
-
|
|
76
|
-
<!-- begin CmdSlideButton -->
|
|
77
|
-
<CmdSlideButton
|
|
78
|
-
v-if="showSlideButtons"
|
|
79
|
-
@click.prevent="scrollRight"
|
|
80
|
-
/>
|
|
81
|
-
<!-- end CmdSlideButton -->
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
<!-- end CmdTableWrapper ---------------------------------------------------------------------------------------- -->
|
|
85
|
-
</template>
|
|
86
|
-
|
|
87
|
-
<script>
|
|
88
|
-
import {ref} from 'vue'
|
|
89
|
-
|
|
90
|
-
export default {
|
|
91
|
-
name: "CmdTable",
|
|
92
|
-
data() {
|
|
93
|
-
return {
|
|
94
|
-
showTableData: true,
|
|
95
|
-
fullWidth: false,
|
|
96
|
-
hasOverflow: false
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
props: {
|
|
100
|
-
/**
|
|
101
|
-
* define the transition for table-body and -footer when collapsible table-data is used
|
|
102
|
-
*
|
|
103
|
-
* @allowedValues: "none", "fade", "scroll"
|
|
104
|
-
*/
|
|
105
|
-
transition: {
|
|
106
|
-
type: String,
|
|
107
|
-
default: "fade"
|
|
108
|
-
},
|
|
109
|
-
/**
|
|
110
|
-
* table data (incl. caption, thead, tbody)
|
|
111
|
-
*/
|
|
112
|
-
tableData: {
|
|
113
|
-
type: Object,
|
|
114
|
-
required: true
|
|
115
|
-
},
|
|
116
|
-
/**
|
|
117
|
-
* caption for table (shown above table)
|
|
118
|
-
*
|
|
119
|
-
* @requiredForAccessibility: true
|
|
120
|
-
*/
|
|
121
|
-
caption: {
|
|
122
|
-
type: Object,
|
|
123
|
-
required: false
|
|
124
|
-
},
|
|
125
|
-
/**
|
|
126
|
-
* activate if table should be collapsible
|
|
127
|
-
*/
|
|
128
|
-
collapsible: {
|
|
129
|
-
type: Boolean,
|
|
130
|
-
default: false
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* activate if table should be stretched to full width of its parent-container (else table will be as wide as its content)
|
|
134
|
-
*/
|
|
135
|
-
fullWidthOnDefault: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
default: false
|
|
138
|
-
},
|
|
139
|
-
/**
|
|
140
|
-
* user can toggle width (full-width (=100% of parent container or as wide as table content) with button above table)
|
|
141
|
-
*/
|
|
142
|
-
userCanToggleWidth: {
|
|
143
|
-
type: Boolean,
|
|
144
|
-
default: true
|
|
145
|
-
},
|
|
146
|
-
/**
|
|
147
|
-
* user can toggle width (full-width (=100% of parent container or as wide as table content) with button above table)
|
|
148
|
-
*/
|
|
149
|
-
showSlideButtons: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
default: true
|
|
152
|
-
},
|
|
153
|
-
/**
|
|
154
|
-
* icon to expand table (vertically)
|
|
155
|
-
*
|
|
156
|
-
* @requiredForAccessibility: partial
|
|
157
|
-
*/
|
|
158
|
-
iconExpand: {
|
|
159
|
-
type: Object,
|
|
160
|
-
default: function () {
|
|
161
|
-
return {
|
|
162
|
-
iconClass: "icon-chevron-one-stripe-down",
|
|
163
|
-
tooltip: "Expand table"
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
/**
|
|
168
|
-
* icon to collapse table (vertically)
|
|
169
|
-
*
|
|
170
|
-
* @requiredForAccessibility: partial
|
|
171
|
-
*/
|
|
172
|
-
iconCollapse: {
|
|
173
|
-
type: Object,
|
|
174
|
-
default: function () {
|
|
175
|
-
return {
|
|
176
|
-
iconClass: "icon-chevron-one-stripe-up",
|
|
177
|
-
tooltip: "Collapse table"
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
/**
|
|
182
|
-
* icon to stretch table (horizontally)
|
|
183
|
-
*
|
|
184
|
-
* @requiredForAccessibility: partial
|
|
185
|
-
*/
|
|
186
|
-
iconStretch: {
|
|
187
|
-
type: Object,
|
|
188
|
-
default: function () {
|
|
189
|
-
return {
|
|
190
|
-
iconClass: "icon-chevron-one-stripe-right",
|
|
191
|
-
tooltip: "Stretch table"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
/**
|
|
196
|
-
* properties for CmdLink-component to expand/collapse table
|
|
197
|
-
*
|
|
198
|
-
* icon is set separately by iconExpand-property and iconCollapse-property
|
|
199
|
-
*/
|
|
200
|
-
cmdLinkToggleExpand: {
|
|
201
|
-
type: Object,
|
|
202
|
-
required: false
|
|
203
|
-
},
|
|
204
|
-
/**
|
|
205
|
-
* properties for CmdLink-component strtech/shrink table
|
|
206
|
-
*
|
|
207
|
-
* @requiredForAccessibility: partial
|
|
208
|
-
*/
|
|
209
|
-
cmdLinkToggleWidth: {
|
|
210
|
-
type: Object,
|
|
211
|
-
required: false
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
mounted() {
|
|
215
|
-
this.hasOverflow = this.$refs.table.clientWidth > this.$refs.innerWrapper.clientWidth
|
|
216
|
-
},
|
|
217
|
-
computed: {
|
|
218
|
-
cmdLinkToggleWidthProperties() {
|
|
219
|
-
return {
|
|
220
|
-
linkType: "button",
|
|
221
|
-
icon: {
|
|
222
|
-
iconClass: "icon-toggle-table-width",
|
|
223
|
-
tooltip: "Toggle table width"
|
|
224
|
-
},
|
|
225
|
-
...this.cmdLinkToggleWidth
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
cmdLinkToggleExpandProperties() {
|
|
229
|
-
return {
|
|
230
|
-
linkType: "button",
|
|
231
|
-
...this.cmdLinkToggleExpand
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
hasCaption() {
|
|
235
|
-
if (this.hideCaption) {
|
|
236
|
-
return false
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// check is a caption-text is defined
|
|
240
|
-
return this.tableData.caption?.text || this.caption?.text
|
|
241
|
-
},
|
|
242
|
-
hideCaption() {
|
|
243
|
-
return this.caption?.show === false || (this.caption?.show !== true && !this.tableData.caption?.show)
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
methods: {
|
|
247
|
-
scrollLeft() {
|
|
248
|
-
this.$refs.innerWrapper.scrollLeft = 0
|
|
249
|
-
this.$refs.table.previousElementSibling.style.cssText = "left: 0;"
|
|
250
|
-
this.updatePosition()
|
|
251
|
-
},
|
|
252
|
-
scrollRight() {
|
|
253
|
-
this.$refs.table.querySelector("th:last-child").scrollIntoView()
|
|
254
|
-
this.$refs.table.nextElementSibling.style.cssText = "right: auto;"
|
|
255
|
-
this.updatePosition()
|
|
256
|
-
},
|
|
257
|
-
updatePosition() {
|
|
258
|
-
const leftSlidebutton = this.$refs.table.previousElementSibling
|
|
259
|
-
const rightSlidebutton = this.$refs.table.nextElementSibling
|
|
260
|
-
const innerWrapper = this.$refs.innerWrapper
|
|
261
|
-
|
|
262
|
-
const parentRect = innerWrapper.getBoundingClientRect();
|
|
263
|
-
const newRight = parentRect.width + innerWrapper.scrollLeft - rightSlidebutton.getBoundingClientRect().width
|
|
264
|
-
const newLeft = innerWrapper.scrollLeft
|
|
265
|
-
|
|
266
|
-
console.log("parentRect", parentRect)
|
|
267
|
-
|
|
268
|
-
leftSlidebutton.style.left = `${newLeft}px`
|
|
269
|
-
rightSlidebutton.style.left = `${newRight}px`;
|
|
270
|
-
|
|
271
|
-
if(newLeft === 0) {
|
|
272
|
-
leftSlidebutton.style.display = "none"
|
|
273
|
-
} else {
|
|
274
|
-
leftSlidebutton.style.display = "flex"
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if(newLeft === innerWrapper.scrollLeftMax) {
|
|
278
|
-
rightSlidebutton.style.display = "none"
|
|
279
|
-
} else {
|
|
280
|
-
rightSlidebutton.style.display = "flex"
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// const parentRect = this.$refs.innerWrapper.getBoundingClientRect();
|
|
284
|
-
// const rightSlidebutton = this.$refs.table.nextElementSibling.getBoundingClientRect();
|
|
285
|
-
// const leftSlidebutton = this.$refs.table.previousElementSibling.getBoundingClientRect();
|
|
286
|
-
//
|
|
287
|
-
// // Calculate the new right position
|
|
288
|
-
// const newRight = rightSlidebutton.width + parentRect.right;
|
|
289
|
-
// const newLeft = parentRect.width - parentRect.left;
|
|
290
|
-
// console.log("parentRect.width", parentRect.width)
|
|
291
|
-
// console.log("parentRect.right", parentRect.right)
|
|
292
|
-
// console.log("parentRect.left", parentRect.left)
|
|
293
|
-
//
|
|
294
|
-
// // Apply the new right position
|
|
295
|
-
// this.$refs.table.nextElementSibling.style.left = `${newRight}px`;
|
|
296
|
-
// this.$refs.table.previousElementSibling.style.right = `${newLeft}px`;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
},
|
|
300
|
-
watch: {
|
|
301
|
-
fullWidthOnDefault: {
|
|
302
|
-
handler() {
|
|
303
|
-
this.fullWidth = this.fullWidthOnDefault
|
|
304
|
-
},
|
|
305
|
-
immediate: true
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
</script>
|
|
310
|
-
|
|
311
|
-
<style>
|
|
312
|
-
/* begin cmd-table-wrapper ---------------------------------------------------------------------------------------- */
|
|
313
|
-
.cmd-table-wrapper {
|
|
314
|
-
display: inline-flex;
|
|
315
|
-
flex-direction: column;
|
|
316
|
-
max-width: 100%;
|
|
317
|
-
margin-bottom: var(--default-margin);
|
|
318
|
-
gap: calc(var(--default-margin) / 2);
|
|
319
|
-
|
|
320
|
-
&.collapsed, &.full-width {
|
|
321
|
-
overflow: hidden;
|
|
322
|
-
|
|
323
|
-
table {
|
|
324
|
-
th {
|
|
325
|
-
white-space: normal;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
> .button-wrapper {
|
|
331
|
-
right: 0;
|
|
332
|
-
z-index: 100;
|
|
333
|
-
gap: calc(var(--default-gap) / 2);
|
|
334
|
-
|
|
335
|
-
.button {
|
|
336
|
-
padding: 0;
|
|
337
|
-
min-width: 2rem;
|
|
338
|
-
min-height: 2rem;
|
|
339
|
-
|
|
340
|
-
[class*="icon-"] {
|
|
341
|
-
font-size: var(--icon-size-small);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.cmd-slide-button {
|
|
347
|
-
top: 50% !important;
|
|
348
|
-
display: none;
|
|
349
|
-
height: auto;
|
|
350
|
-
transform: translateY(-50%);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.inner-wrapper {
|
|
354
|
-
display: flex;
|
|
355
|
-
overflow-x: auto;
|
|
356
|
-
width: 100%;
|
|
357
|
-
|
|
358
|
-
.cmd-slide-button {
|
|
359
|
-
left: 0;
|
|
360
|
-
|
|
361
|
-
&:last-child {
|
|
362
|
-
right: 0;
|
|
363
|
-
left: auto;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
table {
|
|
368
|
-
table-layout: fixed;
|
|
369
|
-
margin: 0;
|
|
370
|
-
|
|
371
|
-
th {
|
|
372
|
-
a[class*='icon-'] {
|
|
373
|
-
&, &:hover, &:active, &:focus {
|
|
374
|
-
font-size: var(--icon-size-small);
|
|
375
|
-
color: var(--color
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
&.has-caption {
|
|
383
|
-
flex-direction: row;
|
|
384
|
-
|
|
385
|
-
.button-wrapper {
|
|
386
|
-
position: absolute;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
table {
|
|
390
|
-
margin-top: calc(var(--default-margin) / 2);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
&.has-overflow {
|
|
395
|
-
.cmd-slide-button {
|
|
396
|
-
display: flex;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/* end cmd-table-wrapper ------------------------------------------------------------------------------------------ */
|
|
1
|
+
<template>
|
|
2
|
+
<!-- begin CmdTableWrapper ---------------------------------------------------------------------------------------- -->
|
|
3
|
+
<div
|
|
4
|
+
:class="['cmd-table-wrapper', {'collapsed': !showTableData, 'full-width': fullWidth, 'has-caption': hasCaption, 'has-overflow': hasOverflow}]">
|
|
5
|
+
<div v-if="collapsible || userCanToggleWidth" class="button-wrapper">
|
|
6
|
+
<!-- begin button to toggle table-width -->
|
|
7
|
+
<CmdLink
|
|
8
|
+
v-if="userCanToggleWidth"
|
|
9
|
+
v-bind="cmdLinkToggleWidthProperties"
|
|
10
|
+
@click="fullWidth = !fullWidth"
|
|
11
|
+
/>
|
|
12
|
+
<!-- end button to toggle table-width -->
|
|
13
|
+
|
|
14
|
+
<!-- begin button to collapse table-content -->
|
|
15
|
+
<CmdLink v-if="collapsible"
|
|
16
|
+
v-bind="cmdLinkToggleExpandProperties"
|
|
17
|
+
@click.prevent="showTableData = !showTableData"
|
|
18
|
+
:title="showTableData ? iconCollapse.tooltip : iconExpand.tooltip"
|
|
19
|
+
>
|
|
20
|
+
<!-- begin CmdIcon -->
|
|
21
|
+
<CmdIcon :iconClass="showTableData ? iconCollapse.iconClass : iconExpand.iconClass"
|
|
22
|
+
:type="showTableData ? iconCollapse.iconType : iconExpand.iconType"/>
|
|
23
|
+
<!-- end CmdIcon -->
|
|
24
|
+
</CmdLink>
|
|
25
|
+
<!-- end button to collapse table-content -->
|
|
26
|
+
</div>
|
|
27
|
+
<div class="inner-wrapper" ref="innerWrapper" @scroll="updatePosition">
|
|
28
|
+
<!-- begin CmdSlideButton -->
|
|
29
|
+
<CmdSlideButton
|
|
30
|
+
v-if="showSlideButtons"
|
|
31
|
+
@click.prevent="scrollLeft"
|
|
32
|
+
slideButtonType="left"
|
|
33
|
+
/>
|
|
34
|
+
<!-- end CmdSlideButton -->
|
|
35
|
+
|
|
36
|
+
<!-- begin table -->
|
|
37
|
+
<table ref="table" :class="{'full-width': fullWidth}">
|
|
38
|
+
<slot name="table-caption">
|
|
39
|
+
<caption v-if="tableData.caption?.text || caption?.text" :class="{ 'visually-hidden': hideCaption }">
|
|
40
|
+
{{ caption?.text || tableData.caption?.text }}
|
|
41
|
+
</caption>
|
|
42
|
+
</slot>
|
|
43
|
+
<slot name="table-head">
|
|
44
|
+
<thead>
|
|
45
|
+
<tr>
|
|
46
|
+
<th v-for="(tablehead, indexHead) in tableData.thead" :key="indexHead" v-html="tablehead"></th>
|
|
47
|
+
</tr>
|
|
48
|
+
</thead>
|
|
49
|
+
</slot>
|
|
50
|
+
<transition :name="transition">
|
|
51
|
+
<slot name="table-body">
|
|
52
|
+
<tbody v-show="showTableData">
|
|
53
|
+
<tr :class="{'active' : tableData.rowIndexHighlighted === indexRows}"
|
|
54
|
+
v-for="(tablerows, indexRows) in tableData.tbody" :key="indexRows">
|
|
55
|
+
<td :class="{'active' : tableData.columnIndexHighlighted === indexData}"
|
|
56
|
+
v-for="(tabledata, indexData) in tablerows" :key="indexData" v-html="tabledata">
|
|
57
|
+
</td>
|
|
58
|
+
</tr>
|
|
59
|
+
</tbody>
|
|
60
|
+
</slot>
|
|
61
|
+
</transition>
|
|
62
|
+
<transition :name="transition">
|
|
63
|
+
<slot name="table-foot">
|
|
64
|
+
<tfoot v-if="tableData.tfoot && tableData.tfoot.length && showTableData">
|
|
65
|
+
<tr>
|
|
66
|
+
<td :class="{'active' : tableData.columnIndexHighlighted === indexFoot}"
|
|
67
|
+
v-for="(tablefoot, indexFoot) in tableData.tfoot" :key="indexFoot" v-html="tablefoot">
|
|
68
|
+
</td>
|
|
69
|
+
</tr>
|
|
70
|
+
</tfoot>
|
|
71
|
+
</slot>
|
|
72
|
+
</transition>
|
|
73
|
+
</table>
|
|
74
|
+
<!-- end table -->
|
|
75
|
+
|
|
76
|
+
<!-- begin CmdSlideButton -->
|
|
77
|
+
<CmdSlideButton
|
|
78
|
+
v-if="showSlideButtons"
|
|
79
|
+
@click.prevent="scrollRight"
|
|
80
|
+
/>
|
|
81
|
+
<!-- end CmdSlideButton -->
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<!-- end CmdTableWrapper ---------------------------------------------------------------------------------------- -->
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script>
|
|
88
|
+
import {ref} from 'vue'
|
|
89
|
+
|
|
90
|
+
export default {
|
|
91
|
+
name: "CmdTable",
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
showTableData: true,
|
|
95
|
+
fullWidth: false,
|
|
96
|
+
hasOverflow: false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
props: {
|
|
100
|
+
/**
|
|
101
|
+
* define the transition for table-body and -footer when collapsible table-data is used
|
|
102
|
+
*
|
|
103
|
+
* @allowedValues: "none", "fade", "scroll"
|
|
104
|
+
*/
|
|
105
|
+
transition: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: "fade"
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* table data (incl. caption, thead, tbody)
|
|
111
|
+
*/
|
|
112
|
+
tableData: {
|
|
113
|
+
type: Object,
|
|
114
|
+
required: true
|
|
115
|
+
},
|
|
116
|
+
/**
|
|
117
|
+
* caption for table (shown above table)
|
|
118
|
+
*
|
|
119
|
+
* @requiredForAccessibility: true
|
|
120
|
+
*/
|
|
121
|
+
caption: {
|
|
122
|
+
type: Object,
|
|
123
|
+
required: false
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* activate if table should be collapsible
|
|
127
|
+
*/
|
|
128
|
+
collapsible: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* activate if table should be stretched to full width of its parent-container (else table will be as wide as its content)
|
|
134
|
+
*/
|
|
135
|
+
fullWidthOnDefault: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: false
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* user can toggle width (full-width (=100% of parent container or as wide as table content) with button above table)
|
|
141
|
+
*/
|
|
142
|
+
userCanToggleWidth: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
default: true
|
|
145
|
+
},
|
|
146
|
+
/**
|
|
147
|
+
* user can toggle width (full-width (=100% of parent container or as wide as table content) with button above table)
|
|
148
|
+
*/
|
|
149
|
+
showSlideButtons: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: true
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* icon to expand table (vertically)
|
|
155
|
+
*
|
|
156
|
+
* @requiredForAccessibility: partial
|
|
157
|
+
*/
|
|
158
|
+
iconExpand: {
|
|
159
|
+
type: Object,
|
|
160
|
+
default: function () {
|
|
161
|
+
return {
|
|
162
|
+
iconClass: "icon-chevron-one-stripe-down",
|
|
163
|
+
tooltip: "Expand table"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* icon to collapse table (vertically)
|
|
169
|
+
*
|
|
170
|
+
* @requiredForAccessibility: partial
|
|
171
|
+
*/
|
|
172
|
+
iconCollapse: {
|
|
173
|
+
type: Object,
|
|
174
|
+
default: function () {
|
|
175
|
+
return {
|
|
176
|
+
iconClass: "icon-chevron-one-stripe-up",
|
|
177
|
+
tooltip: "Collapse table"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
* icon to stretch table (horizontally)
|
|
183
|
+
*
|
|
184
|
+
* @requiredForAccessibility: partial
|
|
185
|
+
*/
|
|
186
|
+
iconStretch: {
|
|
187
|
+
type: Object,
|
|
188
|
+
default: function () {
|
|
189
|
+
return {
|
|
190
|
+
iconClass: "icon-chevron-one-stripe-right",
|
|
191
|
+
tooltip: "Stretch table"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* properties for CmdLink-component to expand/collapse table
|
|
197
|
+
*
|
|
198
|
+
* icon is set separately by iconExpand-property and iconCollapse-property
|
|
199
|
+
*/
|
|
200
|
+
cmdLinkToggleExpand: {
|
|
201
|
+
type: Object,
|
|
202
|
+
required: false
|
|
203
|
+
},
|
|
204
|
+
/**
|
|
205
|
+
* properties for CmdLink-component strtech/shrink table
|
|
206
|
+
*
|
|
207
|
+
* @requiredForAccessibility: partial
|
|
208
|
+
*/
|
|
209
|
+
cmdLinkToggleWidth: {
|
|
210
|
+
type: Object,
|
|
211
|
+
required: false
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
mounted() {
|
|
215
|
+
this.hasOverflow = this.$refs.table.clientWidth > this.$refs.innerWrapper.clientWidth
|
|
216
|
+
},
|
|
217
|
+
computed: {
|
|
218
|
+
cmdLinkToggleWidthProperties() {
|
|
219
|
+
return {
|
|
220
|
+
linkType: "button",
|
|
221
|
+
icon: {
|
|
222
|
+
iconClass: "icon-toggle-table-width",
|
|
223
|
+
tooltip: "Toggle table width"
|
|
224
|
+
},
|
|
225
|
+
...this.cmdLinkToggleWidth
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
cmdLinkToggleExpandProperties() {
|
|
229
|
+
return {
|
|
230
|
+
linkType: "button",
|
|
231
|
+
...this.cmdLinkToggleExpand
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
hasCaption() {
|
|
235
|
+
if (this.hideCaption) {
|
|
236
|
+
return false
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// check is a caption-text is defined
|
|
240
|
+
return this.tableData.caption?.text || this.caption?.text
|
|
241
|
+
},
|
|
242
|
+
hideCaption() {
|
|
243
|
+
return this.caption?.show === false || (this.caption?.show !== true && !this.tableData.caption?.show)
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
methods: {
|
|
247
|
+
scrollLeft() {
|
|
248
|
+
this.$refs.innerWrapper.scrollLeft = 0
|
|
249
|
+
this.$refs.table.previousElementSibling.style.cssText = "left: 0;"
|
|
250
|
+
this.updatePosition()
|
|
251
|
+
},
|
|
252
|
+
scrollRight() {
|
|
253
|
+
this.$refs.table.querySelector("th:last-child").scrollIntoView()
|
|
254
|
+
this.$refs.table.nextElementSibling.style.cssText = "right: auto;"
|
|
255
|
+
this.updatePosition()
|
|
256
|
+
},
|
|
257
|
+
updatePosition() {
|
|
258
|
+
const leftSlidebutton = this.$refs.table.previousElementSibling
|
|
259
|
+
const rightSlidebutton = this.$refs.table.nextElementSibling
|
|
260
|
+
const innerWrapper = this.$refs.innerWrapper
|
|
261
|
+
|
|
262
|
+
const parentRect = innerWrapper.getBoundingClientRect();
|
|
263
|
+
const newRight = parentRect.width + innerWrapper.scrollLeft - rightSlidebutton.getBoundingClientRect().width
|
|
264
|
+
const newLeft = innerWrapper.scrollLeft
|
|
265
|
+
|
|
266
|
+
console.log("parentRect", parentRect)
|
|
267
|
+
|
|
268
|
+
leftSlidebutton.style.left = `${newLeft}px`
|
|
269
|
+
rightSlidebutton.style.left = `${newRight}px`;
|
|
270
|
+
|
|
271
|
+
if(newLeft === 0) {
|
|
272
|
+
leftSlidebutton.style.display = "none"
|
|
273
|
+
} else {
|
|
274
|
+
leftSlidebutton.style.display = "flex"
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if(newLeft === innerWrapper.scrollLeftMax) {
|
|
278
|
+
rightSlidebutton.style.display = "none"
|
|
279
|
+
} else {
|
|
280
|
+
rightSlidebutton.style.display = "flex"
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// const parentRect = this.$refs.innerWrapper.getBoundingClientRect();
|
|
284
|
+
// const rightSlidebutton = this.$refs.table.nextElementSibling.getBoundingClientRect();
|
|
285
|
+
// const leftSlidebutton = this.$refs.table.previousElementSibling.getBoundingClientRect();
|
|
286
|
+
//
|
|
287
|
+
// // Calculate the new right position
|
|
288
|
+
// const newRight = rightSlidebutton.width + parentRect.right;
|
|
289
|
+
// const newLeft = parentRect.width - parentRect.left;
|
|
290
|
+
// console.log("parentRect.width", parentRect.width)
|
|
291
|
+
// console.log("parentRect.right", parentRect.right)
|
|
292
|
+
// console.log("parentRect.left", parentRect.left)
|
|
293
|
+
//
|
|
294
|
+
// // Apply the new right position
|
|
295
|
+
// this.$refs.table.nextElementSibling.style.left = `${newRight}px`;
|
|
296
|
+
// this.$refs.table.previousElementSibling.style.right = `${newLeft}px`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
},
|
|
300
|
+
watch: {
|
|
301
|
+
fullWidthOnDefault: {
|
|
302
|
+
handler() {
|
|
303
|
+
this.fullWidth = this.fullWidthOnDefault
|
|
304
|
+
},
|
|
305
|
+
immediate: true
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
</script>
|
|
310
|
+
|
|
311
|
+
<style>
|
|
312
|
+
/* begin cmd-table-wrapper ---------------------------------------------------------------------------------------- */
|
|
313
|
+
.cmd-table-wrapper {
|
|
314
|
+
display: inline-flex;
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
max-width: 100%;
|
|
317
|
+
margin-bottom: var(--default-margin);
|
|
318
|
+
gap: calc(var(--default-margin) / 2);
|
|
319
|
+
|
|
320
|
+
&.collapsed, &.full-width {
|
|
321
|
+
overflow: hidden;
|
|
322
|
+
|
|
323
|
+
table {
|
|
324
|
+
th {
|
|
325
|
+
white-space: normal;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
> .button-wrapper {
|
|
331
|
+
right: 0;
|
|
332
|
+
z-index: 100;
|
|
333
|
+
gap: calc(var(--default-gap) / 2);
|
|
334
|
+
|
|
335
|
+
.button {
|
|
336
|
+
padding: 0;
|
|
337
|
+
min-width: 2rem;
|
|
338
|
+
min-height: 2rem;
|
|
339
|
+
|
|
340
|
+
[class*="icon-"] {
|
|
341
|
+
font-size: var(--icon-size-small);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.cmd-slide-button {
|
|
347
|
+
top: 50% !important;
|
|
348
|
+
display: none;
|
|
349
|
+
height: auto;
|
|
350
|
+
transform: translateY(-50%);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.inner-wrapper {
|
|
354
|
+
display: flex;
|
|
355
|
+
overflow-x: auto;
|
|
356
|
+
width: 100%;
|
|
357
|
+
|
|
358
|
+
.cmd-slide-button {
|
|
359
|
+
left: 0;
|
|
360
|
+
|
|
361
|
+
&:last-child {
|
|
362
|
+
right: 0;
|
|
363
|
+
left: auto;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
table {
|
|
368
|
+
table-layout: fixed;
|
|
369
|
+
margin: 0;
|
|
370
|
+
|
|
371
|
+
th {
|
|
372
|
+
a[class*='icon-'] {
|
|
373
|
+
&, &:hover, &:active, &:focus {
|
|
374
|
+
font-size: var(--icon-size-small);
|
|
375
|
+
color: var(--table-head-text-color);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
&.has-caption {
|
|
383
|
+
flex-direction: row;
|
|
384
|
+
|
|
385
|
+
.button-wrapper {
|
|
386
|
+
position: absolute;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
table {
|
|
390
|
+
margin-top: calc(var(--default-margin) / 2);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
&.has-overflow {
|
|
395
|
+
.cmd-slide-button {
|
|
396
|
+
display: flex;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* end cmd-table-wrapper ------------------------------------------------------------------------------------------ */
|
|
402
402
|
</style>
|