@eturnity/eturnity_reusable_components 1.1.43 → 1.1.46
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
|
@@ -11,13 +11,16 @@
|
|
|
11
11
|
:key="index"
|
|
12
12
|
ref="dropdownItem"
|
|
13
13
|
:class="{
|
|
14
|
-
'table-dropdown-item':
|
|
15
|
-
item.type !== 'no-template' && item.type !== 'input',
|
|
14
|
+
'table-dropdown-item': item.type !== 'input',
|
|
16
15
|
}"
|
|
17
16
|
>
|
|
18
17
|
<template-button
|
|
19
18
|
@click.stop="onTemplateClick(item.row)"
|
|
20
|
-
v-if="
|
|
19
|
+
v-if="
|
|
20
|
+
item.type &&
|
|
21
|
+
item.type === 'template' &&
|
|
22
|
+
(item.value === '' || item.value === '-')
|
|
23
|
+
"
|
|
21
24
|
:key="idx"
|
|
22
25
|
>{{ $gettext("Use template...") }}</template-button
|
|
23
26
|
>
|
|
@@ -49,7 +52,13 @@
|
|
|
49
52
|
@input-change="onCustomInputChange($event)"
|
|
50
53
|
/>
|
|
51
54
|
</input-container>
|
|
52
|
-
<text-container
|
|
55
|
+
<text-container
|
|
56
|
+
v-else-if="
|
|
57
|
+
item.type !== 'input' &&
|
|
58
|
+
item.type !== 'no-template' &&
|
|
59
|
+
item.type !== 'template'
|
|
60
|
+
"
|
|
61
|
+
>
|
|
53
62
|
<span> {{ item.value }}</span>
|
|
54
63
|
</text-container>
|
|
55
64
|
</component-item>
|
|
@@ -98,6 +107,7 @@
|
|
|
98
107
|
<options-item
|
|
99
108
|
v-else
|
|
100
109
|
:colSpan="colSpan - 1"
|
|
110
|
+
:width="dynamicGridWidth"
|
|
101
111
|
v-for="(item, index) in optionItems"
|
|
102
112
|
:key="index"
|
|
103
113
|
@click="onItemClick(item)"
|
|
@@ -106,7 +116,7 @@
|
|
|
106
116
|
>
|
|
107
117
|
<template v-for="(option, idx) in optionsDisplay">
|
|
108
118
|
<span v-if="option !== 'template'" :key="idx">
|
|
109
|
-
{{ item[option] }}
|
|
119
|
+
{{ !!item[option] ? item[option] : "-" }}
|
|
110
120
|
</span>
|
|
111
121
|
<template-button
|
|
112
122
|
@click.stop="onTemplateClick(item)"
|
|
@@ -188,7 +198,7 @@ const ComponentItem = styled.td`
|
|
|
188
198
|
}
|
|
189
199
|
`
|
|
190
200
|
|
|
191
|
-
const containerAttrs = { colSpan: Number }
|
|
201
|
+
const containerAttrs = { colSpan: Number, width: String }
|
|
192
202
|
const ComponentContainer = styled("div", containerAttrs)`
|
|
193
203
|
display: contents;
|
|
194
204
|
align-items: center;
|
|
@@ -268,10 +278,11 @@ const OptionsWrapper = styled.div`
|
|
|
268
278
|
|
|
269
279
|
const OptionsItem = styled("div", containerAttrs)`
|
|
270
280
|
display: grid;
|
|
271
|
-
grid-template-columns: 1fr repeat(
|
|
281
|
+
/* grid-template-columns: 1fr repeat(
|
|
272
282
|
${(props) => props.colSpan},
|
|
273
283
|
minmax(50px, auto)
|
|
274
|
-
);
|
|
284
|
+
); */
|
|
285
|
+
grid-template-columns: ${(props) => props.width};
|
|
275
286
|
grid-gap: 30px;
|
|
276
287
|
padding: 10px;
|
|
277
288
|
height: max-content;
|
|
@@ -430,6 +441,8 @@ export default {
|
|
|
430
441
|
return {
|
|
431
442
|
inputText: "",
|
|
432
443
|
wasClicked: false, // prevents custom-name from being triggered on the <input-text />
|
|
444
|
+
dynamicWidth: [], // for numbers
|
|
445
|
+
dynamicGridWidth: [], // for grid values
|
|
433
446
|
}
|
|
434
447
|
},
|
|
435
448
|
methods: {
|
|
@@ -511,6 +524,31 @@ export default {
|
|
|
511
524
|
}
|
|
512
525
|
this.$emit("custom-input-change", event)
|
|
513
526
|
},
|
|
527
|
+
setDropdownWidth(options) {
|
|
528
|
+
this.dynamicWidth = []
|
|
529
|
+
options.map((item) => {
|
|
530
|
+
this.optionsDisplay.map((header, index) => {
|
|
531
|
+
let value =
|
|
532
|
+
header === "template"
|
|
533
|
+
? this.$gettext("No main component template")
|
|
534
|
+
: item[header]
|
|
535
|
+
|
|
536
|
+
value = !!value ? value : ""
|
|
537
|
+
|
|
538
|
+
if (
|
|
539
|
+
this.optionsDisplay.length &&
|
|
540
|
+
(this.dynamicWidth.length < this.optionsDisplay.length ||
|
|
541
|
+
value.length > this.dynamicWidth[index])
|
|
542
|
+
) {
|
|
543
|
+
this.dynamicGridWidth[index] = value.length + "ch"
|
|
544
|
+
this.dynamicWidth[index] = value.length
|
|
545
|
+
}
|
|
546
|
+
})
|
|
547
|
+
})
|
|
548
|
+
if (this.dynamicGridWidth.length === this.optionsDisplay.length) {
|
|
549
|
+
this.dynamicGridWidth = this.dynamicGridWidth.join(" ")
|
|
550
|
+
}
|
|
551
|
+
},
|
|
514
552
|
},
|
|
515
553
|
computed: {
|
|
516
554
|
getCustomName() {
|
|
@@ -530,6 +568,11 @@ export default {
|
|
|
530
568
|
})
|
|
531
569
|
}
|
|
532
570
|
},
|
|
571
|
+
optionItems(val) {
|
|
572
|
+
if (val && val.length) {
|
|
573
|
+
this.setDropdownWidth(val)
|
|
574
|
+
}
|
|
575
|
+
},
|
|
533
576
|
},
|
|
534
577
|
}
|
|
535
578
|
</script>
|