@itfin/components 2.0.9 → 2.0.11

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.
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7 18L17 18" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
3
+ <path d="M7 13.4142V15.5C7 15.7761 7.22386 16 7.5 16H9.58579C9.851 16 10.1054 15.8946 10.2929 15.7071L17.2929 8.70711C17.6834 8.31658 17.6834 7.68342 17.2929 7.29289L15.7071 5.70711C15.3166 5.31658 14.6834 5.31658 14.2929 5.70711L7.29289 12.7071C7.10536 12.8946 7 13.149 7 13.4142Z" fill="currentColor"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M10.0004 5.40039C9.66902 5.40039 9.40039 5.66902 9.40039 6.00039C9.40039 6.33176 9.66902 6.60039 10.0004 6.60039H14.0004C14.3318 6.60039 14.6004 6.33176 14.6004 6.00039C14.6004 5.66902 14.3318 5.40039 14.0004 5.40039H10.0004ZM5.40039 8.00039C5.40039 7.66902 5.66902 7.40039 6.00039 7.40039L18.0004 7.40039C18.3318 7.40039 18.6004 7.66902 18.6004 8.00039C18.6004 8.33176 18.3318 8.60039 18.0004 8.60039H16.9458L16.0831 18.0909C16.0362 18.606 15.6044 19.0004 15.0872 19.0004H8.91361C8.3964 19.0004 7.96454 18.606 7.91771 18.0909L7.05494 8.60039H6.00039C5.66902 8.60039 5.40039 8.33176 5.40039 8.00039Z" fill="currentColor"/>
3
+ </svg>
@@ -83,6 +83,7 @@ export default @Component({
83
83
  })
84
84
  class itfPagination extends Vue {
85
85
  @Model('input') value;
86
+ @Prop() items; // deprecated
86
87
  @Prop({ type: [String, Number], default: 0 }) length;
87
88
  @Prop({ type: [String, Number], default: 20 }) size;
88
89
  @Prop({ type: [String, Number] }) pages;
@@ -276,8 +276,6 @@ export default class PanelList extends Vue {
276
276
  if (!this.panelsStack.length || openIndex === 0) {
277
277
  newPanel.isCloseable = false;
278
278
  }
279
- console.info(newPanel, this.panelsStack)
280
- console.trace();
281
279
  let newStack = [...this.panelsStack];
282
280
  if (this.panels[type].permanentExpanded && newStack.length) {
283
281
  for (const panel of newStack) {
@@ -6,9 +6,11 @@
6
6
  'table-clickable': clickable,
7
7
  'permanent-checkboxes': selectedIds.length
8
8
  }" :style="{ '--indicator-area-width': `${indicatorType === 'none' ? 1 : indicatorWidth}px`, '--shadow-area-width': `${shadowWidth}px` }">
9
- <itf-notice-popout :visible="showGroupOperations" class="rounded-pill bg-dark text-light">
10
- <div class="d-flex gap-3 px-3 align-items-center">
11
- <div><strong>{{selectedIds.length}}</strong> selected</div>
9
+ <itf-notice-popout :visible="showGroupOperations" class="rounded-3 bg-black text-white">
10
+ <div class="d-flex gap-2 ps-3 align-items-center small itf-table2_mass-operations">
11
+ <div>{{$tc('components.table.selectedItems', selectedIds.length, { n: selectedIds.length })}}</div>
12
+ <div class="opacity-50">•</div>
13
+ <a href="" class="me-3 opacity-50 text-white text-decoration-none" @click.stop.prevent="selectedIds = []">{{$t('components.table.cancelSelected')}}</a>
12
14
  <div>
13
15
  <slot name="group-operations"></slot>
14
16
  </div>
@@ -141,7 +143,7 @@ class itfTable2 extends Vue {
141
143
  };
142
144
 
143
145
  get showGroupOperations() {
144
- return !!this.$slots['group-operations'] && this.selectedIds.length > 0;
146
+ return !!(this.$slots['group-operations'] || this.$scopedSlots['group-operations']) && this.selectedIds.length > 0;
145
147
  }
146
148
 
147
149
  resetSettings() {
@@ -28,6 +28,7 @@
28
28
  }
29
29
  .item-toggle {
30
30
  width: 1.5rem;
31
+ min-width: 1.5rem;
31
32
  display: flex;
32
33
  align-items: center;
33
34
  }
@@ -84,12 +84,21 @@ body[data-theme="dark"] {
84
84
  cursor: pointer;
85
85
  }
86
86
  }
87
+
88
+ &_mass-operations {
89
+ .btn-default {
90
+ color: #fff !important;
91
+ background-color: #494A55;
92
+ }
93
+ }
94
+
87
95
  .table-view-item-actions {
88
96
  background-image: linear-gradient(90deg, transparent 0, var(--itf-table2-row-bg) 10px);
89
97
  position: sticky;
90
98
  top: 0;
91
99
  bottom: 0;
92
100
  right: -5px;
101
+ z-index: 8;
93
102
  padding-right: 5px;
94
103
  padding-left: 5px;
95
104
  display: flex;
@@ -130,6 +139,7 @@ body[data-theme="dark"] {
130
139
  }
131
140
  .last-sticky-column {
132
141
  position: relative;
142
+ border-right: 0 none !important;
133
143
  &:after {
134
144
  content: "";
135
145
  position: absolute;
@@ -528,7 +538,6 @@ body[data-theme="dark"] {
528
538
  }
529
539
 
530
540
  .table-group-operations {
531
- background: red;
532
541
  position: absolute;
533
542
  bottom: 1rem;
534
543
  left: 1rem;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="itf-money-field ph-no-capture" :class="{'currency-arrow': !currencyDisabled, 'currency-select': currencySelect}">
3
- <div class="input-group h-100" :style="`--itf-money-field-padding-left: ${noCurrencySign ? 1 : selectedCurrencySymbol.length * 0.6 + 1}rem`">
4
- <span class="input-group-text pe-1" v-if="!noCurrencySign">{{ selectedCurrencySymbol }}</span>
3
+ <div :class="{'input-group h-100': noCurrencySign}" :style="`--itf-money-field-padding-left: ${noCurrencySign ? 1 : selectedCurrencySymbol.length * 0.6 + 1}rem`">
4
+ <span class="itf-money-field__prepend" v-if="!noCurrencySign">{{ selectedCurrencySymbol }}</span>
5
5
  <i-mask-component
6
6
  ref="input"
7
7
  v-bind="mask"
@@ -12,23 +12,67 @@
12
12
  :unmask="false"
13
13
  :disabled="disabled"
14
14
  />
15
- <span v-if="currencySelect" class="input-group-text ps-1">{{ selectedCurrencyCode }}<itf-icon v-if="!currencyDisabled && currenciesList.length > 1" name="chevron_down" /></span>
16
- <select v-if="currencySelect && !disabled && !currencyDisabled" :value="currencyId" @input="onCurrencyChanged">
17
- <option v-for="currency in currenciesList" :key="currency[itemKey]" :value="currency[itemKey]" :selected="currencyId === currency[itemKey]">
18
- {{ currency[symbolKey] }}, {{ currency[codeKey] }} - {{ currency[titleKey] }}
19
- </option>
20
- </select>
21
- <slot name="postfix"></slot>
22
15
  </div>
16
+ <slot name="postfix">
17
+ <div v-if="currencySelect" class="itf-money-field__currency">
18
+ <span>{{ selectedCurrencyCode }}<itf-icon v-if="!currencyDisabled && currenciesList.length > 1" name="chevron_down" /></span>
19
+ <select v-if="!disabled && !currencyDisabled" :value="currencyId" @input="onCurrencyChanged">
20
+ <option v-for="currency in currenciesList" :key="currency.Id" :value="currency.Id" :selected="currencyId === currency.Id">
21
+ {{ currency.Symbol }}, {{ currency.Code }} - {{ currency.Title }}
22
+ </option>
23
+ </select>
24
+ </div>
25
+ </slot>
23
26
  </div>
24
27
  </template>
25
28
  <style lang="scss">
26
29
  .itf-money-field {
27
30
  position: relative;
28
31
 
29
- .form-control {
30
- padding-left: 0;
31
- padding-right: 0;
32
+ input {
33
+ padding-left: var(--itf-money-field-padding-left, 1.5rem);
34
+
35
+ &.is-invalid, &.is-valid {
36
+ padding-right: 4rem;
37
+ }
38
+ }
39
+ &.currency-select {
40
+ input {
41
+ padding-right: 3rem;
42
+ }
43
+ &.currency-arrow {
44
+ input {
45
+ padding-right: 4.5rem;
46
+ }
47
+ }
48
+ }
49
+
50
+ &__prepend {
51
+ position: absolute;
52
+ left: .75rem;
53
+ top: .5rem;
54
+ bottom: .5rem;
55
+ display: flex;
56
+ align-items: center;
57
+ }
58
+ &__currency {
59
+ position: absolute;
60
+ right: .75rem;
61
+ top: 0;
62
+ bottom: 0;
63
+ display: flex;
64
+ align-items: center;
65
+ .is-invalid &, .is-valid & {
66
+ right: 1.75rem;
67
+ }
68
+
69
+ select {
70
+ position: absolute;
71
+ height: 100%;
72
+ right: 0;
73
+ opacity: 0;
74
+ left: 0;
75
+ }
32
76
  }
33
77
  }
34
78
  </style>
@@ -62,11 +106,6 @@ class itfMoneyField extends Vue {
62
106
  @Prop({ type: Boolean, default: true }) currencySelect;
63
107
  @Prop({ type: Array, default: () => ([]) }) currencies;
64
108
  @Prop({ type: Boolean, default: false }) currencyDisabled;
65
- @Prop({ type: String, default: 'Id' }) itemKey;
66
- @Prop({ type: String, default: 'Code' }) codeKey;
67
- @Prop({ type: String, default: 'Symbol' }) symbolKey;
68
- @Prop({ type: String, default: 'Title' }) titleKey;
69
- @Prop({ type: String, default: 'Precision' }) precisionKey;
70
109
  @Prop({ type: Number, default: -1000000000}) minValue;
71
110
  @Prop({ type: Number, default: 1000000000}) maxValue;
72
111
 
@@ -101,31 +140,31 @@ class itfMoneyField extends Vue {
101
140
  }
102
141
 
103
142
  onCurrencyChanged(e) {
104
- const currency = this.currenciesList.find((c) => c[this.itemKey] === parseInt(e.target.value));
143
+ const currency = this.currenciesList.find((c) => c.Id === parseInt(e.target.value));
105
144
  this.$emit('update:currency', currency)
106
145
  }
107
146
 
108
147
  get precition() {
109
- return this.selectedCurrency ? this.selectedCurrency[this.precisionKey] : 2;
148
+ return this.selectedCurrency ? this.selectedCurrency.Precision : 2;
110
149
  }
111
150
 
112
151
  get selectedCurrencySymbol() {
113
- return this.selectedCurrency ? this.selectedCurrency[this.symbolKey] : '#';
152
+ return this.selectedCurrency ? this.selectedCurrency.Symbol : '#';
114
153
  }
115
154
 
116
155
  get selectedCurrencyCode() {
117
- return this.selectedCurrency ? this.selectedCurrency[this.codeKey] : '###';
156
+ return this.selectedCurrency ? this.selectedCurrency.Code : '###';
118
157
  }
119
158
 
120
159
  get currencyId() {
121
- return this.selectedCurrency && this.selectedCurrency[this.itemKey];
160
+ return this.selectedCurrency && this.selectedCurrency.Id;
122
161
  }
123
162
 
124
163
  get selectedCurrency() {
125
164
  if (!this.currency || !this.currenciesList) {
126
165
  return this.currenciesList.find(({ IsDefault }) => IsDefault) || null;
127
166
  }
128
- return this.currenciesList.find((itm) => this.currency[this.itemKey] === itm[this.itemKey]);
167
+ return this.currenciesList.find(({ Id }) => this.currency.Id === Id);
129
168
  }
130
169
 
131
170
  setValue (val) {
@@ -50,12 +50,15 @@
50
50
  clickable
51
51
  column-sorting
52
52
  column-resizing
53
+ indicator-type="checkbox"
53
54
  class="permanent-checkboxes"
55
+ :state-name="stateName"
54
56
  id-property="id"
55
57
  :rows="items"
56
58
  :schema="schema"
57
59
  :sorting="sorting"
58
60
  :active="activeIds"
61
+ :show-actions="showActions"
59
62
  v-model="selectedIds"
60
63
  @row-click="$emit('open', $event)"
61
64
  @update:sorting="updateSorting($event)"
@@ -88,7 +91,7 @@
88
91
 
89
92
  </template>
90
93
  <script>
91
- import { Vue, Component, Prop, Inject } from 'vue-property-decorator';
94
+ import { Vue, ModelSync, Component, Prop, Inject } from 'vue-property-decorator';
92
95
  import loading from '../../directives/loading';
93
96
  import itfTable from '../table/Table2.vue';
94
97
  import itfFilterPanel from '../filter/FilterPanel.vue';
@@ -112,6 +115,7 @@ export default @Component({
112
115
  })
113
116
  class itfView extends Vue {
114
117
  @Inject({ default: null }) panelList;
118
+ @ModelSync('value', 'input') selectedIds;
115
119
 
116
120
  @Prop({ type: Boolean }) loading;
117
121
  @Prop({ type: Array }) filters;
@@ -123,8 +127,10 @@ class itfView extends Vue {
123
127
  @Prop(String) filtersEndpoint;
124
128
  @Prop(String) itemsKey;
125
129
  @Prop(String) panelKey;
130
+ @Prop(String) stateName;
126
131
  @Prop({ type: String, default () { return this.$t('components.table.search'); } }) searchPlaceholder;
127
132
  @Prop() panel;
133
+ @Prop(Boolean) showActions;
128
134
 
129
135
  page = 1;
130
136
  total = 0;
@@ -134,7 +140,6 @@ class itfView extends Vue {
134
140
  filter = {};
135
141
  loadingData = false;
136
142
  activeIds = [];
137
- selectedIds = [];
138
143
 
139
144
  created() {
140
145
  const defaultSize = localStorage.getItem('sizePerPage') ?? 20;
package/src/locales/en.js CHANGED
@@ -128,6 +128,8 @@ module.exports = {
128
128
  columns: 'Columns',
129
129
  resetTableSettings: 'Reset table settings',
130
130
  search: 'Search',
131
+ selectedItems: '{n} item selected|{n} items selected',
132
+ cancelSelected: 'Cancel',
131
133
  },
132
134
  pagination: {
133
135
  itemsPerPage: 'Items per page',
package/src/locales/uk.js CHANGED
@@ -133,6 +133,8 @@ module.exports = {
133
133
  columns: 'Колонки',
134
134
  resetTableSettings: 'Скинути налаштування таблиці',
135
135
  search: 'Пошук',
136
+ selectedItems: '{n} елемент вибрано|{n} елементи вибрано|{n} елементів вибрано',
137
+ cancelSelected: 'Скасувати',
136
138
  },
137
139
  filter: {
138
140
  search: 'Пошук',