@itfin/components 1.2.23 → 1.2.25
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,20 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<div class="itf-segmeneted-control d-none d-lg-grid">
|
|
4
|
+
<span v-if="!isUndefined" ref="slider" class="selection" :class="{'elevation-1': !disabled}"></span>
|
|
5
|
+
|
|
6
|
+
<div class="option" v-for="(item, n) in itemsWithNames" :key="n">
|
|
7
|
+
<label>
|
|
8
|
+
<input
|
|
9
|
+
ref="input"
|
|
10
|
+
type="radio"
|
|
11
|
+
:name="name"
|
|
12
|
+
:value="n"
|
|
13
|
+
:checked="isChecked(item)"
|
|
14
|
+
@change="onItemChanged(item)" />
|
|
15
|
+
<span>
|
|
15
16
|
<slot name="item" :item="item" :itemKey="n">{{item[itemText]}}</slot>
|
|
16
17
|
</span>
|
|
17
|
-
|
|
18
|
+
</label>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="d-lg-none">
|
|
22
|
+
<itf-select
|
|
23
|
+
:value="value"
|
|
24
|
+
@input="$emit('input', $event)"
|
|
25
|
+
:options="itemsWithNames"
|
|
26
|
+
:reduce="(item) => item[itemKey]"
|
|
27
|
+
:get-option-label="(item) => item[itemText]"
|
|
28
|
+
/>
|
|
18
29
|
</div>
|
|
19
30
|
</div>
|
|
20
31
|
</template>
|
|
@@ -67,15 +78,22 @@
|
|
|
67
78
|
opacity: 0;
|
|
68
79
|
}
|
|
69
80
|
}
|
|
81
|
+
&:last-of-type {
|
|
82
|
+
label::after {
|
|
83
|
+
opacity: 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
70
86
|
label {
|
|
87
|
+
justify-content: center;
|
|
88
|
+
height: 100%;
|
|
89
|
+
align-items: center;
|
|
90
|
+
display: flex;
|
|
71
91
|
cursor: pointer;
|
|
72
92
|
position: relative;
|
|
73
|
-
display: block;
|
|
74
93
|
text-align: center;
|
|
75
94
|
padding: .25rem 1.5rem;
|
|
76
95
|
background: rgba(255, 255, 255, 0);
|
|
77
96
|
color: rgba(0, 0, 0, 1);
|
|
78
|
-
font-size: 14px;
|
|
79
97
|
|
|
80
98
|
&::before,
|
|
81
99
|
&::after {
|
|
@@ -136,6 +154,7 @@
|
|
|
136
154
|
}
|
|
137
155
|
}
|
|
138
156
|
.selection {
|
|
157
|
+
margin-right: 1px;
|
|
139
158
|
background: rgba(255, 255, 255, 1);
|
|
140
159
|
border: .5px solid rgba(0, 0, 0, 0.04);
|
|
141
160
|
box-shadow: var(--itf-segmeneted-control--shadow);
|
|
@@ -152,10 +171,13 @@
|
|
|
152
171
|
</style>
|
|
153
172
|
<script>
|
|
154
173
|
import { Vue, Component, Model, Prop, Watch } from 'vue-property-decorator';
|
|
174
|
+
import itfSelect from '../select/Select';
|
|
155
175
|
|
|
156
176
|
export default @Component({
|
|
157
177
|
name: 'itfSegmentedControl',
|
|
158
|
-
components: {
|
|
178
|
+
components: {
|
|
179
|
+
itfSelect
|
|
180
|
+
}
|
|
159
181
|
})
|
|
160
182
|
class itfSegmentedControl extends Vue {
|
|
161
183
|
@Model('input') value;
|
|
@@ -57,13 +57,19 @@ export function formatRangeDates(begin, end = null) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function firstLetters(name) {
|
|
60
|
-
|
|
60
|
+
let [first, second] = (name || '').trim()
|
|
61
61
|
.replace(/[\u0250-\u0400\u04FF-\ue0070-9]/g, '')
|
|
62
62
|
.replace(/ +/g, ' ')
|
|
63
|
-
.split(' ')
|
|
64
|
-
|
|
63
|
+
.split(' ');
|
|
64
|
+
|
|
65
|
+
if (first === 'undefined') {
|
|
66
|
+
first = '';
|
|
67
|
+
}
|
|
68
|
+
if (second === 'undefined') {
|
|
69
|
+
second = '';
|
|
70
|
+
}
|
|
65
71
|
if (!second) {
|
|
66
|
-
return first[0];
|
|
72
|
+
return first[0] || '';
|
|
67
73
|
}
|
|
68
|
-
return first[0] + second[0];
|
|
74
|
+
return (first[0] || '') + (second[0] || '');
|
|
69
75
|
}
|