@eturnity/eturnity_reusable_components 1.0.98 → 1.1.1
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
|
@@ -28,9 +28,19 @@
|
|
|
28
28
|
<no-template v-else-if="item.type && item.type === 'no-template'">
|
|
29
29
|
{{ $gettext("No main component template") }}
|
|
30
30
|
</no-template>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
<input-container
|
|
32
|
+
v-else-if="item.type === 'input'"
|
|
33
|
+
@click.stop="onInputClick()"
|
|
34
|
+
>
|
|
35
|
+
<input-text
|
|
36
|
+
class="inputField"
|
|
37
|
+
:value="item.value"
|
|
38
|
+
:noBorder="true"
|
|
39
|
+
:disabled="customInputDisabled"
|
|
40
|
+
@input-change="$emit('custom-input-change', $event)"
|
|
41
|
+
/>
|
|
42
|
+
</input-container>
|
|
43
|
+
<span v-else> {{ item.value }}</span>
|
|
34
44
|
</component-item>
|
|
35
45
|
<et-popover
|
|
36
46
|
v-if="showArchived"
|
|
@@ -42,11 +52,11 @@
|
|
|
42
52
|
<arrow-down
|
|
43
53
|
v-if="!isOpen"
|
|
44
54
|
class="arrow-dropdown"
|
|
45
|
-
:src="require('../../assets/
|
|
55
|
+
:src="require('../../assets/images/collapse_arrow_icon.svg')"
|
|
46
56
|
/>
|
|
47
57
|
<arrow-up
|
|
48
58
|
v-else
|
|
49
|
-
:src="require('../../assets/
|
|
59
|
+
:src="require('../../assets/images/collapse_arrow_icon.svg')"
|
|
50
60
|
/>
|
|
51
61
|
</component-container>
|
|
52
62
|
<options-container
|
|
@@ -97,6 +107,13 @@
|
|
|
97
107
|
</template>
|
|
98
108
|
</options-item>
|
|
99
109
|
</options-wrapper>
|
|
110
|
+
<custom-container
|
|
111
|
+
v-if="inputText.length && allowFreeInputs"
|
|
112
|
+
@click="onCustomNameClick()"
|
|
113
|
+
>
|
|
114
|
+
<custom-name>{{ getCustomName }}!!</custom-name>
|
|
115
|
+
<custom-subtext>({{ $gettext("custom_component") }})</custom-subtext>
|
|
116
|
+
</custom-container>
|
|
100
117
|
</options-container>
|
|
101
118
|
</dropdown-row>
|
|
102
119
|
</template>
|
|
@@ -124,6 +141,7 @@
|
|
|
124
141
|
import styled from "vue-styled-components"
|
|
125
142
|
import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
|
|
126
143
|
import SearchInput from "@eturnity/eturnity_reusable_components/src/components/inputs/searchInput"
|
|
144
|
+
import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
|
|
127
145
|
|
|
128
146
|
const rowAttrs = { disabled: Boolean }
|
|
129
147
|
const DropdownRow = styled("td", rowAttrs)`
|
|
@@ -162,6 +180,7 @@ const optionsAttrs = { top: Number, width: Number }
|
|
|
162
180
|
const OptionsContainer = styled("div", optionsAttrs)`
|
|
163
181
|
position: absolute;
|
|
164
182
|
display: grid;
|
|
183
|
+
grid-template-rows: 1fr auto;
|
|
165
184
|
top: ${(props) => props.top + "px"};
|
|
166
185
|
width: ${(props) => props.width + "px"};
|
|
167
186
|
max-height: 360px;
|
|
@@ -241,6 +260,41 @@ const TemplateLink = styled.div`
|
|
|
241
260
|
grid-gap: 12px;
|
|
242
261
|
`
|
|
243
262
|
|
|
263
|
+
const InputContainer = styled.div`
|
|
264
|
+
.inputField input {
|
|
265
|
+
padding: 0 10px;
|
|
266
|
+
|
|
267
|
+
&:focus {
|
|
268
|
+
padding: 5px 10px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&:hover {
|
|
272
|
+
padding: 0 10px !important;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
`
|
|
276
|
+
|
|
277
|
+
const CustomContainer = styled.div`
|
|
278
|
+
display: grid;
|
|
279
|
+
grid-template-columns: auto 1fr;
|
|
280
|
+
padding: 10px 22px;
|
|
281
|
+
border-top: 1px solid ${(props) => props.theme.colors.grey3};
|
|
282
|
+
height: 37px;
|
|
283
|
+
|
|
284
|
+
&:hover {
|
|
285
|
+
background-color: ${(props) => props.theme.colors.grey5};
|
|
286
|
+
}
|
|
287
|
+
`
|
|
288
|
+
|
|
289
|
+
const CustomName = styled.div`
|
|
290
|
+
justify-self: flex-start;
|
|
291
|
+
`
|
|
292
|
+
|
|
293
|
+
const CustomSubtext = styled.div`
|
|
294
|
+
justify-self: flex-end;
|
|
295
|
+
color: ${(props) => props.theme.colors.grey3};
|
|
296
|
+
`
|
|
297
|
+
|
|
244
298
|
export default {
|
|
245
299
|
name: "table-dropdown",
|
|
246
300
|
components: {
|
|
@@ -259,12 +313,27 @@ export default {
|
|
|
259
313
|
TemplateButton,
|
|
260
314
|
NoTemplate,
|
|
261
315
|
TemplateLink,
|
|
316
|
+
InputText,
|
|
317
|
+
InputContainer,
|
|
318
|
+
CustomContainer,
|
|
319
|
+
CustomName,
|
|
320
|
+
CustomSubtext,
|
|
262
321
|
},
|
|
263
322
|
props: {
|
|
264
323
|
colSpan: {
|
|
265
324
|
required: false,
|
|
266
325
|
default: 1,
|
|
267
326
|
},
|
|
327
|
+
customInputDisabled: {
|
|
328
|
+
// whether the input field should be disabled
|
|
329
|
+
required: false,
|
|
330
|
+
default: true,
|
|
331
|
+
},
|
|
332
|
+
allowFreeInputs: {
|
|
333
|
+
// whether we allow the user to select a custom input
|
|
334
|
+
required: false,
|
|
335
|
+
default: false,
|
|
336
|
+
},
|
|
268
337
|
tableItems: {
|
|
269
338
|
required: true,
|
|
270
339
|
},
|
|
@@ -319,13 +388,21 @@ export default {
|
|
|
319
388
|
} else {
|
|
320
389
|
document.removeEventListener("click", this.clickOutside)
|
|
321
390
|
this.$emit("toggle-dropdown-open", { close: true })
|
|
391
|
+
this.inputText = ""
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
onInputClick() {
|
|
395
|
+
if (!this.isOpen) {
|
|
396
|
+
this.toggleOpen()
|
|
322
397
|
}
|
|
323
398
|
},
|
|
324
399
|
scrollToItem() {
|
|
325
|
-
this.$refs.optionsContainer
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
400
|
+
if (this.$refs.optionsContainer) {
|
|
401
|
+
this.$refs.optionsContainer.$el.scrollIntoView({
|
|
402
|
+
behavior: "smooth",
|
|
403
|
+
block: "center",
|
|
404
|
+
})
|
|
405
|
+
}
|
|
329
406
|
},
|
|
330
407
|
onTemplateClick(item) {
|
|
331
408
|
this.$emit("on-template-click", item)
|
|
@@ -337,6 +414,7 @@ export default {
|
|
|
337
414
|
this.$emit("item-selected", item)
|
|
338
415
|
},
|
|
339
416
|
onSearch(value) {
|
|
417
|
+
this.inputText = value
|
|
340
418
|
this.$emit("dropdown-search", value)
|
|
341
419
|
},
|
|
342
420
|
getItemLocation(value) {
|
|
@@ -351,11 +429,22 @@ export default {
|
|
|
351
429
|
if (event.target === this.$el || this.$el.contains(event.target)) {
|
|
352
430
|
return
|
|
353
431
|
}
|
|
432
|
+
this.inputText = ""
|
|
354
433
|
// 'close: true' is needed in case a box is open and another box is clicked on
|
|
355
434
|
// so this one will close properly
|
|
356
435
|
document.removeEventListener("click", this.clickOutside)
|
|
357
436
|
this.$emit("toggle-dropdown-open", { close: true })
|
|
358
437
|
},
|
|
438
|
+
onCustomNameClick() {
|
|
439
|
+
this.$emit("on-custom-input-name", this.inputText)
|
|
440
|
+
this.$emit("toggle-dropdown-open", { close: true })
|
|
441
|
+
this.inputText = ""
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
computed: {
|
|
445
|
+
getCustomName() {
|
|
446
|
+
return this.inputText
|
|
447
|
+
},
|
|
359
448
|
},
|
|
360
449
|
watch: {
|
|
361
450
|
isOpen(newVal) {
|
|
@@ -101,6 +101,7 @@ const TableContainer = styled.table`
|
|
|
101
101
|
padding: 11px 15px;
|
|
102
102
|
background-color: ${(props) => props.theme.colors.blue1};
|
|
103
103
|
cursor: auto;
|
|
104
|
+
height: 40px;
|
|
104
105
|
|
|
105
106
|
.ordering {
|
|
106
107
|
display: grid;
|
|
@@ -324,7 +325,8 @@ const TableContainer = styled.table`
|
|
|
324
325
|
.open-container {
|
|
325
326
|
border: 1px solid ${(props) => props.theme.colors.grey4};
|
|
326
327
|
border-radius: 4px;
|
|
327
|
-
margin-bottom:
|
|
328
|
+
margin-bottom: 5px;
|
|
329
|
+
cursor: auto;
|
|
328
330
|
}
|
|
329
331
|
`
|
|
330
332
|
|