@itfin/components 1.2.112 → 1.2.113
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
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
.itf-text-field {
|
|
4
4
|
&__input {
|
|
5
5
|
border-radius: $input-border-radius !important;
|
|
6
|
+
-moz-appearance: textfield; // Hide Arrows From Input Number (Firefox)
|
|
7
|
+
|
|
8
|
+
&::-webkit-outer-spin-button, // Hide Arrows From Input Number (Chrome, Safari, Edge, Opera)
|
|
9
|
+
&::-webkit-inner-spin-button {
|
|
10
|
+
-webkit-appearance: none;
|
|
11
|
+
margin: 0;
|
|
12
|
+
}
|
|
6
13
|
}
|
|
7
14
|
.addon-end {
|
|
8
15
|
pointer-events: all;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="itf-field-addon">
|
|
3
|
+
<div class="itf-field-addon__input">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div v-if="visible" class="itf-field-addon__select">
|
|
8
|
+
<span>{{ label }}<itf-icon v-if="!disabled" name="chevron_down" /></span>
|
|
9
|
+
<select v-if="!disabled" :value="getItemKey(value)" @input="onOptionChanged">
|
|
10
|
+
<template v-for="option in options">
|
|
11
|
+
<option :key="getItemKey(option)" :value="getItemKey(option)" :selected="getItemKey(value) === getItemKey(option)">
|
|
12
|
+
{{ getItemLabel(option) }}
|
|
13
|
+
</option>
|
|
14
|
+
</template>
|
|
15
|
+
</select>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<style lang="scss">
|
|
20
|
+
.itf-field-addon {
|
|
21
|
+
position: relative;
|
|
22
|
+
|
|
23
|
+
&__input input {
|
|
24
|
+
--itf-field-addon--padding-right: 10rem;
|
|
25
|
+
padding-right: var(--itf-field-addon--padding-right);
|
|
26
|
+
}
|
|
27
|
+
&__select {
|
|
28
|
+
z-index: 6;
|
|
29
|
+
position: absolute;
|
|
30
|
+
right: .75rem;
|
|
31
|
+
top: .5rem;
|
|
32
|
+
.is-invalid &, .is-valid & {
|
|
33
|
+
right: 1.75rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
select {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
opacity: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
46
|
+
<script>
|
|
47
|
+
import { Component, Emit, Model, Prop, Vue } from 'vue-property-decorator';
|
|
48
|
+
import itfIcon from '../icon/Icon';
|
|
49
|
+
|
|
50
|
+
export default @Component({
|
|
51
|
+
name: 'itfFieldAddonSelect',
|
|
52
|
+
components: {
|
|
53
|
+
itfIcon
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
class itfFieldAddonSelect extends Vue {
|
|
57
|
+
@Model('input', { default: '' }) value;
|
|
58
|
+
@Prop({ type: Boolean, default: false }) disabled;
|
|
59
|
+
@Prop({ type: Boolean, default: true }) visible;
|
|
60
|
+
@Prop({ type: Function, default: (item) => item.Id}) getItemKey;
|
|
61
|
+
@Prop({ type: Function, default: (item) => item.Name }) getItemLabel;
|
|
62
|
+
@Prop({ type: Array, default: () => ([]) }) options;
|
|
63
|
+
|
|
64
|
+
onOptionChanged(e) {
|
|
65
|
+
const opt = this.options.find((c) => this.getItemKey(c) === e.target.value);
|
|
66
|
+
this.$emit('input', opt)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get label() {
|
|
70
|
+
return this.value ? this.getItemLabel(this.value) : '';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</script>
|