@itfin/components 1.2.21 → 1.2.24

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": "@itfin/components",
3
- "version": "1.2.21",
3
+ "version": "1.2.24",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,20 +1,31 @@
1
1
  <template>
2
- <div class="itf-segmeneted-control">
3
- <span v-if="!isUndefined" ref="slider" class="selection" :class="{'elevation-1': !disabled}"></span>
4
-
5
- <div class="option" v-for="(item, n) in itemsWithNames" :key="n">
6
- <label>
7
- <input
8
- ref="input"
9
- type="radio"
10
- :name="name"
11
- :value="n"
12
- :checked="isChecked(item)"
13
- @change="onItemChanged(item)" />
14
- <span>
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
- </label>
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;
@@ -3,6 +3,9 @@ import '../assets/scss/directives/tooltip.scss';
3
3
 
4
4
  export default {
5
5
  bind(el, { value, modifiers }) {
6
+ if (value === null) {
7
+ return;
8
+ }
6
9
  tippy(el, {
7
10
  content: value,
8
11
  allowHTML: true,
@@ -58,7 +58,7 @@ export function formatRangeDates(begin, end = null) {
58
58
 
59
59
  export function firstLetters(name) {
60
60
  const [first, second] = (name || '').trim()
61
- .replace(/[\u0250-\ue0070-9]/g, '')
61
+ .replace(/[\u0250-\u0400\u04FF-\ue0070-9]/g, '')
62
62
  .replace(/ +/g, ' ')
63
63
  .split(' ')
64
64
  ;