@eturnity/eturnity_reusable_components 1.1.42 → 1.1.45

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.1.42",
3
+ "version": "1.1.45",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <container>
3
- <input-wrapper :hasLabel="!!label && label.length > 0">
4
- <label-wrapper :alignItems="alignItems" v-if="label">
3
+ <input-wrapper
4
+ :hasLabel="!!label && label.length > 0"
5
+ :alignItems="alignItems"
6
+ >
7
+ <label-wrapper v-if="label">
5
8
  <input-label :fontSize="fontSize">{{ label }}</input-label>
6
9
  <info-text
7
10
  v-if="infoTextMessage"
@@ -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="item.type && item.type === 'template' && item.value === ''"
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 v-else>
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,26 @@ export default {
511
524
  }
512
525
  this.$emit("custom-input-change", event)
513
526
  },
527
+ setDropdownWidth(options) {
528
+ options.map((item) => {
529
+ this.optionsDisplay.map((header, index) => {
530
+ let value =
531
+ header === "template"
532
+ ? this.$gettext("No main component template")
533
+ : item[header]
534
+ if (
535
+ this.dynamicWidth.length < this.optionsDisplay.length ||
536
+ value.length > this.dynamicWidth[index]
537
+ ) {
538
+ this.dynamicGridWidth[index] = value.length + "ch"
539
+ this.dynamicWidth[index] = value.length
540
+ }
541
+ })
542
+ })
543
+ if (this.dynamicGridWidth.length === this.optionsDisplay.length) {
544
+ this.dynamicGridWidth = this.dynamicGridWidth.join(" ")
545
+ }
546
+ },
514
547
  },
515
548
  computed: {
516
549
  getCustomName() {
@@ -530,6 +563,15 @@ export default {
530
563
  })
531
564
  }
532
565
  },
566
+ optionItems(val) {
567
+ console.log("optionItems", val)
568
+ if (val.length) {
569
+ this.setDropdownWidth(val)
570
+ }
571
+ },
572
+ },
573
+ mounted() {
574
+ console.log("optionsDisplay", this.optionsDisplay)
533
575
  },
534
576
  }
535
577
  </script>