@itfin/components 1.3.89 → 1.3.90

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.89",
3
+ "version": "1.3.90",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -14,6 +14,10 @@ class ITFSettings {
14
14
  moneyDisplayFormat: '{symbol}{value}',
15
15
  moneyThousandSeparator: ',',
16
16
  moneyDecimalSeparator: '.',
17
+ supportLanguages: [
18
+ { shortCode: 'en', locale: 'en_US', name: 'English', dateFormat: 'MM/dd/yyyy', moneyDisplayFormat: '{symbol}{value}', moneyThousandSeparator: ',', moneyDecimalSeparator: '.' },
19
+ { shortCode: 'uk', locale: 'uk_UA', name: 'Українська (Ukrainian)', dateFormat: 'dd.MM.yyyy', moneyDisplayFormat: '{value}\xA0{symbol}', moneyThousandSeparator: '\xA0', moneyDecimalSeparator: ',' },
20
+ ]
17
21
  };
18
22
 
19
23
  get moneyDisplayFormat() {
@@ -33,16 +37,14 @@ class ITFSettings {
33
37
  }
34
38
 
35
39
  set defaultLocale(val) {
36
- this.options.defaultLocale = val;
37
- if (val === 'uk_UA') {
38
- this.options.moneyDisplayFormat = '{value}\xA0{symbol}';
39
- this.options.moneyThousandSeparator = '\xA0';
40
- this.options.moneyDecimalSeparator = ',';
41
- } else {
42
- this.options.moneyDisplayFormat = '{symbol}{value}';
43
- this.options.moneyThousandSeparator = ',';
44
- this.options.moneyDecimalSeparator = '.';
40
+ let lang = this.options.supportLanguages.find((l) => l.shortCode === val || l.locale === val);
41
+ if (!lang) {
42
+ lang = this.options.supportLanguages[0];
45
43
  }
44
+ this.options.defaultLocale = lang.locale;
45
+ this.options.moneyDisplayFormat = lang.moneyDisplayFormat;
46
+ this.options.moneyDecimalSeparator = lang.moneyDecimalSeparator;
47
+ this.options.moneyThousandSeparator = lang.moneyThousandSeparator;
46
48
  }
47
49
 
48
50
  get currencies() {
@@ -54,10 +56,7 @@ class ITFSettings {
54
56
  }
55
57
 
56
58
  get supportLanguages() {
57
- return [
58
- { locale: 'en_US', name: 'English', dateFormat: 'MM/dd/yyyy' },
59
- { locale: 'uk_UA', name: 'Українська (Ukrainian)', dateFormat: 'dd.MM.yyyy' },
60
- ];
59
+ return this.options.supportLanguages;
61
60
  }
62
61
 
63
62
  get firstDayOfWeek() {
@@ -768,7 +768,7 @@ $bootstrap-icons-map: (
768
768
  //"gear-fill": "\f3e2",
769
769
  //"gear-wide-connected": "\f3e3",
770
770
  //"gear-wide": "\f3e4",
771
- //"gear": "\f3e5",
771
+ "gear": "\f3e5",
772
772
  //"gem": "\f3e6",
773
773
  //"geo-alt-fill": "\f3e7",
774
774
  //"geo-alt": "\f3e8",
@@ -896,7 +896,7 @@ $bootstrap-icons-map: (
896
896
  //"layout-text-sidebar": "\f462",
897
897
  //"layout-text-window-reverse": "\f463",
898
898
  //"layout-text-window": "\f464",
899
- "layout-three-columns": "\f465",
899
+ //"layout-three-columns": "\f465",
900
900
  //"layout-wtf": "\f466",
901
901
  //"life-preserver": "\f467",
902
902
  //"lightbulb-fill": "\f468",
@@ -25,6 +25,7 @@
25
25
  :show-grouping="showGrouping"
26
26
  :show-summary="showSummary"
27
27
  :show-add-column="showAddColumn"
28
+ :show-actions="showActions"
28
29
  :show-header="!noHeader"
29
30
  :schema="schema"
30
31
  :editable="editable"
@@ -106,6 +107,7 @@ class itfTable2 extends Vue {
106
107
  @Prop(Boolean) columnResizing;
107
108
  @Prop(Boolean) showAddColumn;
108
109
  @Prop(Boolean) showGrouping;
110
+ @Prop(Boolean) showActions;
109
111
  @Prop(Boolean) showSummary;
110
112
  @Prop(Boolean) noHeader;
111
113
  @Prop(Boolean) noColumnMenu;
@@ -8,6 +8,7 @@
8
8
  :id-property="idProperty"
9
9
  :subrows-property="subrowsProperty"
10
10
  :show-add-column="showAddColumn"
11
+ :show-actions="showActions"
11
12
  :no-select-all="noSelectAll"
12
13
  :editable="editable"
13
14
  :currency="currency"
@@ -118,38 +119,6 @@
118
119
  }
119
120
  }
120
121
 
121
- .table-item-inner .boundary {
122
- z-index: 3;
123
- position: absolute;
124
- }
125
-
126
- .table-item-inner .boundary.top, .table-item-inner .boundary.bottom {
127
- width: 100%;
128
- border-top: thin solid #0000;
129
- top: 0;
130
- }
131
-
132
- .table-item-inner .boundary {
133
- z-index: 3;
134
- position: absolute;
135
- }
136
-
137
- .table-item-inner .boundary.left, .table-item-inner .boundary.right {
138
- height: 100%;
139
- border-left: thin solid #0000;
140
- left: 0;
141
- }
142
-
143
- .table-item-inner .boundary.right {
144
- left: auto;
145
- border-right: 1px solid var(--itf-table-border-color);
146
- right: 0;
147
- }
148
-
149
- .table-item-inner .boundary.bottom {
150
- top: auto;
151
- bottom: 0;
152
- }
153
122
  .table-small-row .table-view-item {
154
123
  // height: var(--table-row-height);
155
124
  }
@@ -185,6 +154,7 @@ class itfTableBody extends Vue {
185
154
  @Prop() subrowsProperty;
186
155
  @Prop() active;
187
156
  @Prop(Boolean) showAddColumn;
157
+ @Prop(Boolean) showActions;
188
158
  @Prop(Boolean) noSelectAll;
189
159
  @Prop(Boolean) editable;
190
160
  @Prop(Boolean) expandedAll;
@@ -37,6 +37,7 @@
37
37
  :column-resizing="columnResizing"
38
38
  :column-sorting="columnSorting"
39
39
  :show-add-column="showAddColumn"
40
+ :show-actions="showActions"
40
41
  :rows="rows"
41
42
  :schema="schema"
42
43
  :editable="editable"
@@ -69,6 +70,7 @@
69
70
  :expanded-all="expandedAll"
70
71
  :striped="striped"
71
72
  :show-add-column="showAddColumn"
73
+ :show-actions="showActions"
72
74
  :expanded-ids="expandedIds"
73
75
  :css-property="cssProperty"
74
76
  :editable-property="editableProperty"
@@ -349,6 +351,7 @@ class itfTableGroup extends Vue {
349
351
  @Prop(Boolean) columnSorting;
350
352
  @Prop(Boolean) columnResizing;
351
353
  @Prop(Boolean) showAddColumn;
354
+ @Prop(Boolean) showActions;
352
355
  @Prop(Boolean) showHeader;
353
356
  @Prop(Boolean) noColumnMenu;
354
357
  @Prop(Boolean) noSelectAll;
@@ -33,9 +33,9 @@
33
33
  v-draggable="{ handle: true, payload: { index: n, item: column }, mirror: {yAxis:false} }">
34
34
  <itf-dropdown text append-to-body shadow ref="dropdown" class="w-100" :disabled="noColumnMenu">
35
35
  <template #button>
36
- <span class="itf-table2__header-title text-truncate" :title="column.title[locale] || column.title['en_US']" :class="{'ms-auto': column.align === 'end'}">
36
+ <span class="itf-table2__header-title text-truncate" :title="getTitle(column.title)" :class="{'ms-auto': column.align === 'end'}">
37
37
  <span v-if="column.icon" :class="column.icon"></span>
38
- {{column.title[locale] || column.title['en_US']}}
38
+ {{getTitle(column.title)}}
39
39
  <div v-if="column.prefix" class="itf-table2__subtitle" v-text="column.prefix" />
40
40
  </span>
41
41
  <itf-icon v-if="_sorting[column.property]" :name="_sorting[column.property] === 'asc' ? 'arrow_up' : 'arrow_down'" :size="16" class="ms-1" />
@@ -85,10 +85,10 @@
85
85
  <div v-if="visibleHeader && columnResizing && !column.grow" ref="resizeHandle" class="resize-handle"></div>
86
86
  </div>
87
87
  </template>
88
- <div v-if="showAddColumn" class="table-view-header-value flex-grow-1 justify-content-start">
89
- <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">
88
+ <div class="table-view-item-value extra flex-grow-1"></div>
89
+ <itf-dropdown v-if="showAddColumn && visibleHeader" ref="newDd" text append-to-context shadow autoclose="outside" class="table-header-add-column table-view-item-actions" data-test="table-header-add-column">
90
90
  <template #button>
91
- <span class="nom-layout-three-columns"></span>
91
+ <itf-button icon small><span class="nom-gear"></span></itf-button>
92
92
  </template>
93
93
 
94
94
  <itf-sortable :value="sortedColumns" @input="onSortColumns">
@@ -99,7 +99,7 @@
99
99
  <div>
100
100
  <span class="nom-grip-vertical"></span>
101
101
  <span v-if="column.icon" :class="column.icon"></span>
102
- {{column.title[locale] || column.title['en_US']}}
102
+ {{getTitle(column.title)}}
103
103
  </div>
104
104
  <span v-if="column.pinned" class="nom-pin-fill"></span>
105
105
  </div>
@@ -117,13 +117,17 @@
117
117
  <a href="" @click.prevent="addColumn(column)" :key="`inv-column${k}`" class="dropdown-item d-flex align-items-center justify-content-between px-2 py-1">
118
118
  <div>
119
119
  <span class="nom-plus"></span>
120
- {{column.title[locale] || column.title['en_US']}}
120
+ {{getTitle(column.title)}}
121
121
  </div>
122
122
  </a>
123
123
  </template>
124
124
  </div>
125
125
  </itf-dropdown>
126
- </div>
126
+
127
+ <div class="boundary top"></div>
128
+ <div class="boundary right"></div>
129
+ <div class="boundary bottom"></div>
130
+ <div class="boundary left"></div>
127
131
  </div>
128
132
  </div>
129
133
 
@@ -182,6 +186,13 @@ class itfTableHeader extends Vue {
182
186
  }
183
187
  }
184
188
 
189
+ getTitle(title) {
190
+ if (typeof title === 'string') {
191
+ return title;
192
+ }
193
+ return title[this.locale] || title['en_US'];
194
+ }
195
+
185
196
  get locale() {
186
197
  return settings.defaultLocale;
187
198
  }
@@ -78,7 +78,10 @@
78
78
  </slot>
79
79
  </div>
80
80
  </template>
81
- <div v-if="showAddColumn" class="table-view-item-value extra bg-light"></div>
81
+ <div class="table-view-item-value extra"></div>
82
+ <div v-if="showActions" class="table-view-item-actions">
83
+ <slot name="actions" :level="level" :toggle="() => $emit('toggle', item)" :item="item"></slot>
84
+ </div>
82
85
  <div class="boundary top"></div>
83
86
  <div class="boundary right"></div>
84
87
  <div class="boundary bottom"></div>
@@ -95,6 +98,7 @@
95
98
  :id-property="idProperty"
96
99
  :subrows-property="subrowsProperty"
97
100
  :show-add-column="showAddColumn"
101
+ :show-actions="showActions"
98
102
  :no-select-all="noSelectAll"
99
103
  :editable="editable"
100
104
  :currency="currency"
@@ -157,6 +161,7 @@ class itfTableRows extends Vue {
157
161
  @Prop(Boolean) editable;
158
162
  @Prop(Boolean) expandedAll;
159
163
  @Prop(Boolean) striped;
164
+ @Prop(Boolean) showActions;
160
165
  @Prop() editableProperty;
161
166
  @Prop() selectedIds;
162
167
  @Prop() expandedIds;
@@ -67,8 +67,35 @@ body[data-theme="dark"] {
67
67
  cursor: pointer;
68
68
  }
69
69
  }
70
+ .table-view-item-actions {
71
+ background-image: linear-gradient(90deg, transparent 0, var(--itf-table2-row-bg) 10px);
72
+ position: sticky;
73
+ top: 0;
74
+ bottom: 0;
75
+ right: -5px;
76
+ padding-right: 5px;
77
+ padding-left: 5px;
78
+ display: flex;
79
+ align-items: center;
80
+ }
81
+ .on-hover {
82
+ opacity: 0;
83
+ pointer-events: none;
84
+ }
85
+ .table-row-template:hover .on-hover {
86
+ opacity: 1;
87
+ pointer-events: all;
88
+ }
89
+ .table-row-template:hover .hide-hover {
90
+ opacity: 0;
91
+ pointer-events: none;
92
+ }
93
+ .table-header-add-column {
94
+ background-image: linear-gradient(90deg, transparent 0, var(--itf-table-header-bg) 10px);
95
+ }
70
96
 
71
97
  &__header {
98
+ --itf-table2-row-bg: --itf-table-header-bg;
72
99
  background-color: var(--itf-table-header-bg);
73
100
  position: sticky;
74
101
  top: 0;
@@ -87,8 +114,12 @@ body[data-theme="dark"] {
87
114
  z-index: 100000001;
88
115
  background: rgba(235,237,239,0.75);
89
116
  }
117
+ .itf-table2 & .boundary.top, .itf-table2 & .boundary.bottom {
118
+ border-color: var(--itf-table-border-color)
119
+ }
90
120
  .table-row-template {
91
121
  display: flex;
122
+ position: relative;
92
123
  align-items: stretch;
93
124
  height: auto;
94
125
  user-select: none;
@@ -305,4 +336,33 @@ body[data-theme="dark"] {
305
336
  position: sticky;
306
337
  }
307
338
  }
339
+
340
+
341
+ .boundary {
342
+ z-index: 3;
343
+ position: absolute;
344
+
345
+ &.top, &.bottom {
346
+ width: 100%;
347
+ border-top: thin solid #0000;
348
+ top: 0;
349
+ }
350
+
351
+ &.left, &.right {
352
+ height: 100%;
353
+ border-left: thin solid #0000;
354
+ left: 0;
355
+ }
356
+
357
+ &.right {
358
+ left: auto;
359
+ border-right: 1px solid var(--itf-table-border-color);
360
+ right: 0;
361
+ }
362
+
363
+ &.bottom {
364
+ top: auto;
365
+ bottom: 0;
366
+ }
367
+ }
308
368
  }
@@ -46,8 +46,10 @@ export function formatMoney (val, symbol = '', digits = null) {
46
46
  if (Number.isNaN(val) || val === null) {
47
47
  return '—';
48
48
  }
49
-
50
- let symbolStr = symbol?.symbol ?? symbol?.Symbol ?? symbol ?? '';
49
+ let symbolStr = symbol?.currencySymbol ?? symbol?.symbol ?? symbol?.Symbol ?? '';
50
+ if (typeof symbol === 'string') {
51
+ symbolStr = symbol;
52
+ }
51
53
  if (digits === null) {
52
54
  digits = symbol.precision ?? symbol.Precision ?? 2;
53
55
  }