@itfin/components 1.3.70 → 1.3.72

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.70",
3
+ "version": "1.3.72",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -18,7 +18,11 @@
18
18
  background-color: #ccc;
19
19
 
20
20
  &.badge {
21
- padding: 0.1875rem 0.5rem;
21
+ padding: 0.075rem 0.1rem 0.075rem 0.5rem;
22
+ border-radius: .325rem !important;
23
+ font-size: 0.875rem;
24
+ font-family: var(--bs-font-sans-serif);
25
+ padding-right: .1rem;
22
26
  }
23
27
  }
24
28
  [data-theme="dark"] {
@@ -83,7 +83,7 @@ import itfIcon from '../icon/Icon';
83
83
  import itfButton from '../button/Button';
84
84
  import itfDateRangePickerInline from './DateRangePickerInline.vue';
85
85
  import ITFSettings from '../../ITFSettings';
86
- import itfDatePickerInline from "@/components/datepicker/DatePickerInline.vue";
86
+ import itfDatePickerInline from "./DatePickerInline.vue";
87
87
 
88
88
  export default @Component({
89
89
  name: 'itfDateRangePicker',
@@ -131,9 +131,13 @@ export default @Component({
131
131
  directives: {
132
132
  },
133
133
  filters: {
134
+ },
135
+ provide() {
136
+ return { currentPanel: this };
134
137
  }
135
138
  })
136
139
  class Panel extends Vue {
140
+ @Prop(Number) index;
137
141
  @Prop() title;
138
142
  @Prop() icon;
139
143
  @Prop() payload;
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <a :href="link" :target="target" v-on="on"><slot></slot></a>
3
+ </template>
4
+ <script lang="ts">
5
+ import { Vue, Component, Inject, Prop } from 'vue-property-decorator';
6
+ import { IPanel } from './PanelList.vue';
7
+
8
+ @Component({
9
+ components: {
10
+ },
11
+ directives: {
12
+ },
13
+ filters: {
14
+ }
15
+ })
16
+ export default class PanelLink extends Vue {
17
+ @Inject({ default: null }) panelList;
18
+ @Inject({ default: null }) currentPanel;
19
+
20
+ @Prop(String) panel: string;
21
+ @Prop() payload: payload;
22
+ @Prop() target: string;
23
+ @Prop(Boolean) append: boolean;
24
+
25
+ get on() {
26
+ const handlers = {};
27
+ if (!this.target) {
28
+ handlers.click = this.onClick;
29
+ }
30
+ return handlers;
31
+ }
32
+
33
+ get link() {
34
+ let stack = this.panelList.getCurrentStack();
35
+ if (!this.append) {
36
+ stack = stack.splice(0, this.currentPanel.index + 1);
37
+ }
38
+ const hash = this.panelList.getLink([
39
+ ...stack,
40
+ {
41
+ type: this.panel,
42
+ payload: this.payload || {}
43
+ }
44
+ ]);
45
+ return `#${hash}`;
46
+ }
47
+
48
+ onClick(e) {
49
+ e.preventDefault();
50
+ e.stopPropagation();
51
+ const stack = this.panelList.getCurrentStack();
52
+ stack[stack.length - 1].open(this.panel, this.payload || {});
53
+ }
54
+ }
55
+ </script>
@@ -10,6 +10,7 @@
10
10
  <template v-for="(panel, n) of panelsStack">
11
11
  <panel
12
12
  :key="n"
13
+ :index="n"
13
14
  :title="panel.title"
14
15
  :icon="panel.icon"
15
16
  :payload="panel.payload"
@@ -144,7 +145,7 @@ interface VisualOptions {
144
145
  icon?: string;
145
146
  }
146
147
 
147
- interface IPanel {
148
+ export interface IPanel {
148
149
  id: number;
149
150
  title: string;
150
151
  icon: string;
@@ -161,6 +162,7 @@ interface IPanel {
161
162
  emit: (event: string, ...args: any[]) => void;
162
163
  isMultiple: () => boolean;
163
164
  fullsize: () => void;
165
+ getPanels: (type: string) => any;
164
166
  getPayload: () => any;
165
167
  setPayload: (value: any) => void;
166
168
  __events: Record<string, ((event: string, ...args: any[]) => any)[]>;
@@ -173,6 +175,9 @@ interface IPanel {
173
175
  directives: {
174
176
  },
175
177
  filters: {
178
+ },
179
+ provide() {
180
+ return { panelList: this };
176
181
  }
177
182
  })
178
183
  export default class PanelList extends Vue {
@@ -254,7 +259,7 @@ export default class PanelList extends Vue {
254
259
  isCloseable: true,
255
260
  __events: {},
256
261
  };
257
- if (!this.panelsStack.length) {
262
+ if (!this.panelsStack.length || openIndex === 0) {
258
263
  newPanel.isCloseable = false;
259
264
  }
260
265
  let newStack = [...this.panelsStack];
@@ -301,6 +306,7 @@ export default class PanelList extends Vue {
301
306
  };
302
307
  newPanel.isMultiple = () => this.isOpenMultiple;
303
308
  newPanel.fullsize = () => this.fullsizePanel(newPanel);
309
+ newPanel.getPanels = (type) => this.getPanels(type);
304
310
  newPanel.getPayload = () => newPanel.payload;
305
311
  newPanel.setPayload = (value: any) => {
306
312
  newPanel.payload = value;
@@ -311,6 +317,8 @@ export default class PanelList extends Vue {
311
317
  newStack.push(newPanel);
312
318
  this.panelsStack = newStack;
313
319
  this.ensureOnlyTwoOpenPanels(newPanel.id);
320
+ this.emitEvent('panel.open', newPanel);
321
+ this.emitEvent('panels.changed', this.panelsStack);
314
322
  return res(newPanel);
315
323
  })
316
324
  });
@@ -343,7 +351,9 @@ export default class PanelList extends Vue {
343
351
  this.panelsStack[openPanelIndex - 1].isCollapsed = false;
344
352
  }
345
353
  this.ensureOnlyTwoOpenPanels(openPanel.id);
346
- this.setPanelHash()
354
+ this.setPanelHash();
355
+ this.emitEvent('panels.closed', panel);
356
+ this.emitEvent('panels.changed', this.panelsStack);
347
357
  }
348
358
 
349
359
  fullsizePanel(panel: IPanel) {
@@ -354,10 +364,22 @@ export default class PanelList extends Vue {
354
364
  this.panelsStack = newStack;
355
365
  }
356
366
 
357
- setPanelHash() {
358
- const hash = this.panelsStack.map(panel => {
367
+ getPanels(type) {
368
+ return this.panelsStack.filter(panel => panel.type === type);
369
+ }
370
+
371
+ getCurrentStack() {
372
+ return [...this.panelsStack];
373
+ }
374
+
375
+ getLink(stack: IPanel[]) {
376
+ return stack.map(panel => {
359
377
  return `${panel.type}=${JSON.stringify(panel.payload || {})}`;
360
378
  }).join('&');
379
+ }
380
+
381
+ setPanelHash() {
382
+ const hash = this.getLink(this.panelsStack);
361
383
  this.$router.push({ hash });
362
384
  }
363
385
 
@@ -377,6 +399,7 @@ export default class PanelList extends Vue {
377
399
  newStack.push(resPanel);
378
400
  }
379
401
  this.panelsStack = newStack;
402
+ this.emitEvent('panels.changed', this.panelsStack);
380
403
  }
381
404
  }
382
405
 
@@ -42,6 +42,7 @@
42
42
  :sticky-header="stickyHeader"
43
43
  :editable-property="editableProperty"
44
44
  :sorting.sync="_sorting"
45
+ :active="active"
45
46
  @update:expanded-ids="$emit('update:expanded-ids', $event)"
46
47
  @new="$emit('new', $event)"
47
48
  @add-column="$emit('add-column', $event)"
@@ -89,6 +90,7 @@ class itfTable2 extends Vue {
89
90
  @Prop({ type: String, default: null }) cssProperty;
90
91
  @Prop({ type: String, default: null }) subrowsProperty;
91
92
  @Prop({ type: String, default: null }) editableProperty;
93
+ @Prop({ default: null }) active;
92
94
  @Prop({ default: 45 }) indicatorWidth;
93
95
  @Prop({ type: String, default: null, validator: (val) => ['order', 'checkbox', 'toggle', 'property'].includes(val) }) indicatorType;
94
96
  @Prop({ type: String, default: null }) stateName; // save state to storage
@@ -18,6 +18,7 @@
18
18
  :expanded-all="expandedAll"
19
19
  :css-property="cssProperty"
20
20
  :editable-property="editableProperty"
21
+ :active="active"
21
22
  @update:expanded-ids="$emit('update:expanded-ids', $event)"
22
23
  @row-click="$emit('row-click', $event)"
23
24
  @update="$emit('update', $event)"
@@ -182,6 +183,7 @@ class itfTableBody extends Vue {
182
183
  @Prop() rows;
183
184
  @Prop() idProperty;
184
185
  @Prop() subrowsProperty;
186
+ @Prop() active;
185
187
  @Prop(Boolean) showAddColumn;
186
188
  @Prop(Boolean) noSelectAll;
187
189
  @Prop(Boolean) editable;
@@ -72,6 +72,7 @@
72
72
  :expanded-ids="expandedIds"
73
73
  :css-property="cssProperty"
74
74
  :editable-property="editableProperty"
75
+ :active="active"
75
76
  @update:expanded-ids="$emit('update:expanded-ids', $event)"
76
77
  >
77
78
  <template v-for="(_, name) in $slots" #[name]="slotData">
@@ -341,6 +342,7 @@ class itfTableGroup extends Vue {
341
342
  @Prop() subrowsProperty;
342
343
  @Prop() currency;
343
344
  @Prop() currencies;
345
+ @Prop() active;
344
346
  @Prop(Boolean) showGrouping;
345
347
  @Prop(Boolean) showSummary;
346
348
  @Prop(Boolean) addNewRows;
@@ -6,7 +6,7 @@
6
6
  group="items"
7
7
  data-test="table-item"
8
8
  class="table-view-item grouped draggable-item"
9
- :class="{'selected': selectedIds.includes(item[idProperty]), [cssProperty && item[cssProperty]]: !!item[cssProperty]}"
9
+ :class="{'selected': selectedIds.includes(item[idProperty]), 'active': isActive(item[idProperty]), [cssProperty && item[cssProperty]]: !!item[cssProperty]}"
10
10
  >
11
11
  <div class="table-row-template">
12
12
  <div accept-group="items" class="table-view-body-space"></div>
@@ -151,6 +151,7 @@ class itfTableRows extends Vue {
151
151
  @Prop() rows;
152
152
  @Prop() idProperty;
153
153
  @Prop() subrowsProperty;
154
+ @Prop() active;
154
155
  @Prop(Boolean) showAddColumn;
155
156
  @Prop(Boolean) noSelectAll;
156
157
  @Prop(Boolean) editable;
@@ -191,6 +192,13 @@ class itfTableRows extends Vue {
191
192
  }
192
193
  }
193
194
 
195
+ isActive(id) {
196
+ if (Array.isArray(this.active)) {
197
+ return this.active.includes(id);
198
+ }
199
+ return this.active === id;
200
+ }
201
+
194
202
  isExpanded(item) {
195
203
  const isExpanded = this.expandedIds.includes(item[this.idProperty]);
196
204
  return this.expandedAll ? !isExpanded : isExpanded;
@@ -3,6 +3,7 @@
3
3
  --itf-table-header-bg: #f8f8f8;
4
4
  --itf-table-font-size: 1rem;
5
5
  --itf-table-selected-bg: #f0f0f0;
6
+ --itf-table-active-bg: #e0e0e0;
6
7
  --itf-table-alt-bg: #f9f9f9;
7
8
  //--itf-table-border-color: #e1e1e1;
8
9
  //--itf-table-header-bg: #f9faf5;
@@ -35,6 +36,7 @@ body[data-theme="dark"] {
35
36
  --itf-table-border-color: #383b41;
36
37
  --itf-table-input-focus-border-color: #252525;
37
38
  --itf-table-selected-bg: #011534;
39
+ --itf-table-active-bg: #022e72;
38
40
  --itf-table-summary-text: #82909d80;
39
41
  }
40
42
  .itf-table2 {
@@ -233,6 +235,9 @@ body[data-theme="dark"] {
233
235
  &.selected, &:hover {
234
236
  --itf-table2-row-bg: var(--itf-table-selected-bg) !important;
235
237
  }
238
+ &.active {
239
+ --itf-table2-row-bg: var(--itf-table-active-bg) !important;
240
+ }
236
241
 
237
242
  .indicator {
238
243
  border-left: 1px solid var(--itf-table-border-color);