@itfin/components 1.3.35 → 1.3.36

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.3.35",
3
+ "version": "1.3.36",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,6 +1,6 @@
1
1
 
2
2
  $bootstrap-icons-font: "bootstrap-icons" !default;
3
- $bootstrap-icons-font-dir: "../fonts" !default;
3
+ $bootstrap-icons-font-dir: "/fonts" !default;
4
4
  $bootstrap-icons-font-file: "#{$bootstrap-icons-font-dir}/#{$bootstrap-icons-font}" !default;
5
5
  $bootstrap-icons-font-hash: "24e3eb84d0bcaf83d77f904c78ac1f47" !default;
6
6
  $bootstrap-icons-font-src: url("#{$bootstrap-icons-font-file}.woff2?#{$bootstrap-icons-font-hash}") format("woff2"),
@@ -24,6 +24,7 @@ class itfDropdown extends Vue {
24
24
  @Prop({ type: Boolean }) disabled;
25
25
  @Prop({ type: Boolean }) text;
26
26
  @Prop({ type: Boolean }) appendToBody;
27
+ @Prop({ type: Boolean }) appendToContext;
27
28
  @Prop({ validator: (value) => [true, false, 'inside', 'outside'].includes(value), default: true }) autoclose;
28
29
  @Prop({ type: Object, default: () => ({}) }) buttonOptions;
29
30
  @Prop({ type: Object, default: () => ({}) }) menuOptions;
@@ -22,6 +22,7 @@ class itfDropdownMenu extends Vue {
22
22
  @Prop({ type: Boolean }) disabled;
23
23
  @Prop({ type: Boolean }) text;
24
24
  @Prop({ type: Boolean }) appendToBody;
25
+ @Prop({ type: Boolean }) appendToContext;
25
26
  @Prop({ type: String }) toggleId;
26
27
  @Prop({ validator: (value) => [true, false, 'inside', 'outside'].includes(value), default: true }) autoclose;
27
28
  @Prop({ type: Object, default: () => ({}) }) buttonOptions;
@@ -39,10 +40,14 @@ class itfDropdownMenu extends Vue {
39
40
  const { default: Dropdown } = await import('bootstrap/js/src/dropdown.js');
40
41
  let context = document.body;
41
42
  this.modalEl = new Dropdown(toggle, {
42
- reference: 'toggle',
43
+ reference: 'parent',
43
44
  autoClose: this.autoclose
44
45
  });
45
- if (this.appendToBody && this.$el instanceof Node && this.$el.parentNode) {
46
+ if (this.appendToContext && this.$el instanceof Node && this.$el.parentNode) {
47
+ context = this.$el.closest('.itf-append-context') || document.body;
48
+ this.$el.parentNode.removeChild(this.$el);
49
+ context.appendChild(this.$el); // should append only to body
50
+ } else if (this.appendToBody && this.$el instanceof Node && this.$el.parentNode) {
46
51
  this.$el.parentNode.removeChild(this.$el);
47
52
  context.appendChild(this.$el); // should append only to body
48
53
  }
@@ -6,6 +6,7 @@
6
6
  <div class="table-view-body">
7
7
  <itf-table-group
8
8
  :key="index"
9
+ @update="$emit('update', { ...$event, group, groupIndex: index })"
9
10
  :id-property="idProperty"
10
11
  :columns="columns"
11
12
  @update:columns="onColumnsUpdate"
@@ -75,6 +76,7 @@ import itfButton from '../button/Button.vue';
75
76
  import itfIcon from '../icon/Icon.vue';
76
77
  import itfTableGroup from './TableGroup.vue';
77
78
  import itfTableHeader from './TableHeader.vue';
79
+ import itfTableBody from "@/components/table/TableBody.vue";
78
80
 
79
81
  export default @Component({
80
82
  name: 'itfTable2',
@@ -82,6 +84,7 @@ export default @Component({
82
84
  return { tableEl: this }; // do not use Provide from vue-property-decorator
83
85
  },
84
86
  components: {
87
+ itfTableBody,
85
88
  itfCheckboxGroup,
86
89
  itfTableHeader,
87
90
  itfButton,
@@ -19,24 +19,28 @@
19
19
  </div>
20
20
  <div class="indicator sticky">
21
21
  <div class="fill on-rest table-view-row-count">
22
- <!-- <span>{{ item[idProperty] }}</span>-->
22
+ <!-- <span>{{ item[idProperty] }}</span>-->
23
23
  </div>
24
24
  <div class="fill on-hover">
25
25
  <itf-checkbox :value="item[idProperty]" />
26
26
  </div>
27
27
  </div>
28
28
  <div accept-group="items" class="table-item-inner">
29
- <template v-for="(column, n) in visibleAttributes">
29
+ <template v-for="(column, k) in visibleAttributes">
30
30
  <div
31
31
  v-if="column.visible !== false"
32
- :data-column="n"
32
+ :data-column="k"
33
33
  :style="`width: ${column.width}px; left: ${column.left}px;`"
34
- :class="{'sticky': column.pinned, 'last-sticky-column': n === lastPinnedIndex, 'flex-grow-1': column.grow}"
34
+ :class="{'sticky': column.pinned, 'last-sticky-column': k === lastPinnedIndex, 'flex-grow-1': column.grow}"
35
35
  class="table-view-item-value d-flex h-100 align-items-stretch">
36
36
  <slot :name="`column.${column.name}`" :item="item" :column="column">
37
37
  <template v-if="column.editable">
38
38
  <slot :name="`edit.${column.type}`" :value="getValue(item, column)" :item="item" :column="column">
39
- <div class="px-1 py-1 w-100"><itf-text-field :value="getValue(item, column)" /></div>
39
+ <div class="px-1 py-1 w-100">
40
+ <itf-text-field v-if="column.type === 'text'" :value="getValue(item, column)" @input="updateValue(item, $event, n)" />
41
+ <itf-textarea autogrow v-else-if="column.type === 'textarea'" :value="getValue(item, column)" @input="updateValue(item, $event)" />
42
+ <itf-money-field v-else-if="column.type === 'money'" no-currency-sign currency-disabled :currency-select="false" :value="getValue(item, column)" @input="updateValue(item, $event)" />
43
+ </div>
40
44
  </slot>
41
45
  </template>
42
46
  <template v-else>
@@ -208,18 +212,21 @@
208
212
  <script>
209
213
  import { Vue, Component, Prop } from 'vue-property-decorator';
210
214
  import get from 'lodash/get';
211
- import { RecycleScroller } from 'vue-virtual-scroller'
215
+ // import { RecycleScroller } from 'vue-virtual-scroller'
212
216
  import itfCheckbox from '../checkbox/Checkbox.vue';
213
217
  import itfTextField from '../text-field/TextField.vue';
214
- import { INLINE_TYPES } from '../customize/constants';
215
- import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
218
+ import itfMoneyField from '../text-field/MoneyField.vue';
219
+ import itfTextarea from '../text-field/Textarea.vue';
220
+ // import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
216
221
 
217
222
  export default @Component({
218
223
  name: 'itfTableBody',
219
224
  components: {
220
225
  itfCheckbox,
226
+ itfMoneyField,
227
+ itfTextarea,
221
228
  itfTextField,
222
- RecycleScroller
229
+ // RecycleScroller
223
230
  }
224
231
  })
225
232
  class itfTableBody extends Vue {
@@ -228,8 +235,6 @@ class itfTableBody extends Vue {
228
235
  @Prop() idProperty;
229
236
  @Prop(Boolean) showAddColumn;
230
237
 
231
- editTypes = {};
232
-
233
238
  getValue(item, column) {
234
239
  return get(item, column.property);
235
240
  }
@@ -242,10 +247,8 @@ class itfTableBody extends Vue {
242
247
  return this.columns.findIndex((column) => column.lastPinned);
243
248
  }
244
249
 
245
- mounted() {
246
- for (const { Type } of INLINE_TYPES) {
247
- this.editTypes[Type] = true;
248
- }
250
+ updateValue(item, value, index) {
251
+ this.$emit('update', { index, item, value });
249
252
  }
250
253
  }
251
254
  </script>
@@ -52,6 +52,7 @@
52
52
  <!-- Сама таблиця -->
53
53
  <div v-if="isShowTable">
54
54
  <itf-table-body
55
+ @update="$emit('update', $event)"
55
56
  :id-property="idProperty"
56
57
  :rows="rows"
57
58
  :columns="visibleColumns"
@@ -305,7 +306,7 @@ import itfButton from '../button/Button.vue';
305
306
  import itfIcon from '../icon/Icon.vue';
306
307
  import itfTableBody from './TableBody.vue';
307
308
  import itfTableHeader from './TableHeader.vue';
308
- import Sticky from "@/components/table/sticky";
309
+ import Sticky from "./sticky";
309
310
 
310
311
  export default @Component({
311
312
  name: 'itfTableGroup',
@@ -85,7 +85,7 @@
85
85
  </div>
86
86
  </template>
87
87
  <div v-if="showAddColumn" class="table-view-header-value flex-grow-1 justify-content-start">
88
- <itf-dropdown v-if="visibleHeader" ref="newDd" text append-to-body shadow autoclose="outside" class="table-header table-header-add-column" data-test="table-header-add-column">
88
+ <itf-dropdown v-if="visibleHeader" ref="newDd" text append-to-context shadow autoclose="outside" class="table-header table-header-add-column" data-test="table-header-add-column">
89
89
  <template #button>
90
90
  <span class="nom-layout-three-columns"></span>
91
91
  </template>
@@ -131,7 +131,7 @@ storiesOf('Common', module)
131
131
  {
132
132
  "property": "Description",
133
133
  "title": { "en_US": "Description", "uk_UA": "Прізвище" },
134
- "type": "text",
134
+ "type": "textarea",
135
135
  "editable": true,
136
136
  "sortable": false,
137
137
  width: 200,
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="itf-money-field" :class="{'currency-arrow': !currencyDisabled, 'currency-select': currencySelect}">
3
- <div :style="`--itf-money-field-padding-left: ${selectedCurrencySymbol.length * 0.6 + 1}rem`">
4
- <span class="itf-money-field__prepend">{{ selectedCurrencySymbol }}</span>
3
+ <div :style="`--itf-money-field-padding-left: ${noCurrencySign ? 0 : 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"
@@ -93,6 +93,7 @@ class itfMoneyField extends Vue {
93
93
 
94
94
  @Model('input', { default: '' }) value;
95
95
  @Prop({ type: Object, default: null }) currency;
96
+ @Prop({ type: Boolean, default: false }) noCurrencySign;
96
97
  @Prop({ type: Boolean, default: false }) disabled;
97
98
  @Prop({ type: Boolean, default: true }) currencySelect;
98
99
  @Prop({ type: Array, default: () => ([]) }) currencies;
package/src/locales/en.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable comma-dangle */
2
2
  module.exports = {
3
+ new: 'New',
3
4
  today: 'Today',
4
5
  tomorrow: 'Tomorrow',
5
6
  inAWeek: 'In a week',
package/src/locales/uk.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable comma-dangle */
2
2
  module.exports = {
3
+ new: 'Додати',
3
4
  today: 'Сьогодні',
4
5
  tomorrow: 'Завтра',
5
6
  inAWeek: 'Через тиждень',