@eturnity/eturnity_reusable_components 1.1.35 → 1.1.36

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.35",
3
+ "version": "1.1.36",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -3,11 +3,18 @@
3
3
  :colspan="colSpan"
4
4
  :isOpen="isOpen"
5
5
  @click="toggleOpen"
6
- ref="dropdownItem"
7
6
  :disabled="disabled"
8
7
  >
9
8
  <component-container :colSpan="colSpan - 1" class="table-dropdown">
10
- <component-item v-for="(item, index) in tableItems" :key="index">
9
+ <component-item
10
+ v-for="(item, index) in tableItems"
11
+ :key="index"
12
+ ref="dropdownItem"
13
+ :class="{
14
+ 'table-dropdown-item':
15
+ item.type !== 'no-template' && item.type !== 'input',
16
+ }"
17
+ >
11
18
  <template-button
12
19
  @click.stop="onTemplateClick(item.row)"
13
20
  v-if="item.type && item.type === 'template' && item.value === ''"
@@ -26,7 +33,7 @@
26
33
  />
27
34
  <div>{{ item.value }}</div>
28
35
  </template-link>
29
- <no-template v-else-if="item.type && item.type === 'no-template'">
36
+ <no-template v-if="item.type && item.type === 'no-template'">
30
37
  {{ $gettext("No main component template") }}
31
38
  </no-template>
32
39
  <input-container
@@ -37,6 +44,7 @@
37
44
  class="inputField"
38
45
  :value="item.value"
39
46
  :noBorder="true"
47
+ :minWidth="item.value.length + 'ch'"
40
48
  :disabled="customInputDisabled"
41
49
  @input-change="onCustomInputChange($event)"
42
50
  />
@@ -50,20 +58,24 @@
50
58
  :text="$gettext(`Component has been archived and shouldn't be used`)"
51
59
  triggerType="hover"
52
60
  ></et-popover>
53
- <arrow-down
54
- v-if="!isOpen"
55
- class="arrow-dropdown"
56
- :src="require('../../assets/icons/collapse_arrow_icon.svg')"
57
- />
58
- <arrow-up
59
- v-else
60
- :src="require('../../assets/icons/collapse_arrow_icon.svg')"
61
- />
61
+ <arrow-container class="arrow-container">
62
+ <arrow-down
63
+ @click.native.stop="toggleOpen"
64
+ v-if="!isOpen"
65
+ class="arrow-dropdown"
66
+ :src="require('../../assets/icons/collapse_arrow_icon.svg')"
67
+ />
68
+ <arrow-up
69
+ @click.native.stop="toggleOpen"
70
+ v-else
71
+ :src="require('../../assets/icons/collapse_arrow_icon.svg')"
72
+ />
73
+ </arrow-container>
62
74
  </component-container>
63
75
  <options-container
64
76
  v-if="isOpen"
65
77
  :top="getItemLocation('top')"
66
- :width="getItemLocation('width')"
78
+ :left="getItemLocation('left')"
67
79
  ref="optionsContainer"
68
80
  >
69
81
  <options-wrapper @click.prevent.stop>
@@ -145,24 +157,33 @@ import SearchInput from "@eturnity/eturnity_reusable_components/src/components/i
145
157
  import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
146
158
 
147
159
  const rowAttrs = { disabled: Boolean, isOpen: Boolean }
148
- const DropdownRow = styled("td", rowAttrs)`
160
+ const DropdownRow = styled("div", rowAttrs)`
149
161
  cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
162
+ display: contents;
150
163
 
151
164
  input {
152
165
  cursor: ${(props) => (!props.isOpen ? "pointer !important" : "inherit")};
153
166
  }
154
167
  `
155
168
 
156
- const ComponentItem = styled.div`
169
+ const ComponentItem = styled.td`
157
170
  overflow: hidden;
158
171
  text-overflow: ellipsis;
172
+ padding-right: 0 !important;
173
+
174
+ &.table-dropdown-item {
175
+ background-clip: content-box;
176
+ padding: 8px 0 7px 0 !important;
177
+
178
+ span {
179
+ padding-left: 15px;
180
+ }
181
+ }
159
182
  `
160
183
 
161
184
  const containerAttrs = { colSpan: Number }
162
185
  const ComponentContainer = styled("div", containerAttrs)`
163
- display: grid;
164
- grid-template-columns: 1fr repeat(${(props) => props.colSpan}, auto) auto;
165
- grid-gap: 12px;
186
+ display: contents;
166
187
  align-items: center;
167
188
  background-color: ${(props) => props.theme.colors.white};
168
189
  border-radius: 4px;
@@ -181,13 +202,26 @@ const ArrowUp = styled.img`
181
202
  transition: transform 150ms ease;
182
203
  `
183
204
 
184
- const optionsAttrs = { top: Number, width: Number }
205
+ const ArrowContainer = styled.td`
206
+ border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
207
+ background-clip: content-box;
208
+ padding: 8px 0 7px 0 !important;
209
+ border-radius: 0 4px 4px 0;
210
+
211
+ .arrow-dropdown {
212
+ vertical-align: middle;
213
+ margin-left: 11px;
214
+ }
215
+ `
216
+
217
+ const optionsAttrs = { top: Number, left: Number }
185
218
  const OptionsContainer = styled("div", optionsAttrs)`
186
219
  position: absolute;
187
220
  display: grid;
188
221
  grid-template-rows: 1fr auto;
189
222
  top: ${(props) => props.top + "px"};
190
- width: ${(props) => props.width + "px"};
223
+ left: ${(props) => props.left + "px"};
224
+ width: auto;
191
225
  max-height: 360px;
192
226
  min-height: 200px;
193
227
  overflow: auto;
@@ -213,12 +247,16 @@ const OptionsWrapper = styled.div`
213
247
  font-size: 14px;
214
248
  grid-template-rows: max-content;
215
249
  height: max-content;
250
+ min-width: 350px;
216
251
  `
217
252
 
218
253
  const OptionsItem = styled("div", containerAttrs)`
219
254
  display: grid;
220
- grid-template-columns: 1fr repeat(${(props) => props.colSpan}, auto);
221
- grid-gap: 12px;
255
+ grid-template-columns: 1fr repeat(
256
+ ${(props) => props.colSpan},
257
+ minmax(50px, auto)
258
+ );
259
+ grid-gap: 30px;
222
260
  padding: 10px;
223
261
  height: max-content;
224
262
 
@@ -267,15 +305,7 @@ const TemplateLink = styled.div`
267
305
 
268
306
  const InputContainer = styled.div`
269
307
  .inputField input {
270
- padding: 0;
271
-
272
- &:focus {
273
- padding: 5px 0px;
274
- }
275
-
276
- &:hover {
277
- padding: 0px 0 !important;
278
- }
308
+ border-radius: 4px 0 0 4px;
279
309
  }
280
310
  `
281
311
 
@@ -323,6 +353,7 @@ export default {
323
353
  CustomContainer,
324
354
  CustomName,
325
355
  CustomSubtext,
356
+ ArrowContainer,
326
357
  },
327
358
  props: {
328
359
  colSpan: {
@@ -426,7 +457,7 @@ export default {
426
457
  this.$emit("dropdown-search", value)
427
458
  },
428
459
  getItemLocation(value) {
429
- let ref = this.$refs.dropdownItem
460
+ let ref = this.$refs.dropdownItem[0]
430
461
  let location = ref.$el.getBoundingClientRect()[value]
431
462
  if (value === "top") {
432
463
  location = location + window.scrollY + 40