@itfin/components 1.4.3 → 1.4.5

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.4.3",
3
+ "version": "1.4.5",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -129,7 +129,7 @@ class itfDateGranularityPicker extends Vue {
129
129
  @Prop({ type: [String, Date], default: ''}) maxDate;
130
130
  @Prop(Boolean) disabled;
131
131
 
132
- granularity = 'yearly';
132
+ granularity = 'monthly';
133
133
 
134
134
  get granularities() {
135
135
  return [
@@ -137,6 +137,7 @@ class itfDateGranularityPicker extends Vue {
137
137
  { title: 'Quarterly', value: 'quarterly' },
138
138
  { title: 'Monthly', value: 'monthly' },
139
139
  { title: 'Weekly', value: 'weekly' },
140
+ { title: 'Daily', value: 'daily' },
140
141
  { title: 'Custom', value: 'manual' },
141
142
  ];
142
143
  }
@@ -45,7 +45,7 @@
45
45
  v-if="!readonly"
46
46
  data-test="item-editor-cancel"
47
47
  :disabled="loading"
48
- default
48
+ secondary
49
49
  class="me-2"
50
50
  @click="$emit('input', false)"
51
51
  >
@@ -3,8 +3,8 @@
3
3
  <div v-loading="loading || loadingData" class="flex-grow-1 w-100 d-flex flex-column">
4
4
  <itf-filter-panel
5
5
  :search-placeholder="searchPlaceholder"
6
- :search="activeTab !== 'list'"
7
- :show-filter="activeTab !== 'list'"
6
+ :search="currentTab !== 'list'"
7
+ :show-filter="currentTab !== 'list'"
8
8
  class="py-2 px-3"
9
9
  :endpoint="filtersEndpoint"
10
10
  :panel="panel"
@@ -41,7 +41,8 @@
41
41
  </itf-dropdown>
42
42
 
43
43
  <itf-segmented-control
44
- v-model="activeTab"
44
+ class="small"
45
+ v-model="currentTab"
45
46
  item-key="value"
46
47
  :items="tabs"
47
48
  >
@@ -55,10 +56,10 @@
55
56
  </template>
56
57
  </itf-filter-panel>
57
58
 
58
- <template v-if="activeTab === 'list'">
59
- <slot name="listView"></slot>
60
- </template>
61
- <slot v-else name="tableView">
59
+ <slot v-if="currentTab === 'list'" name="list-view"></slot>
60
+ <slot v-else-if="currentTab === 'board'" name="kanban-view"></slot>
61
+ <slot v-else-if="currentTab === 'calendar'" name="calendar-view"></slot>
62
+ <slot v-else name="table-view">
62
63
  <div class="flex-grow-1 px-3 d-flex flex-column">
63
64
  <div class="position-relative flex-grow-1">
64
65
  <itf-table
@@ -95,6 +96,7 @@
95
96
 
96
97
  <itf-pagination
97
98
  class="my-2 px-3"
99
+ v-if="showPagination"
98
100
  show-size
99
101
  :size="size"
100
102
  :items="items"
@@ -151,9 +153,15 @@ class itfView extends Vue {
151
153
  @Prop(String) itemsKey;
152
154
  @Prop(String) panelKey;
153
155
  @Prop(String) stateName;
156
+ @Prop({ type: String, default: 'table' }) tab;
154
157
  @Prop({ type: String, default () { return this.$t('components.table.search'); } }) searchPlaceholder;
155
158
  @Prop() panel;
156
159
  @Prop(Boolean) showActions;
160
+ @Prop({ type: Boolean, default: true }) showPagination;
161
+ @Prop(Boolean) listViewEnabled;
162
+ @Prop(Boolean) kanbanViewEnabled;
163
+ @Prop(Boolean) calendarViewEnabled;
164
+ @Prop(Boolean) tableViewEnabled;
157
165
 
158
166
  page = 1;
159
167
  total = 0;
@@ -164,18 +172,34 @@ class itfView extends Vue {
164
172
  loadingData = false;
165
173
  activeIds = [];
166
174
  tableColumns = [];
175
+ _currentTab = null;
167
176
 
168
- activeTab= 'list';
177
+ get currentTab() {
178
+ return this.tab;
179
+ }
180
+
181
+ set currentTab(val) {
182
+ this.$emit('update:tab', val);
183
+ }
169
184
 
170
185
  get tabs() {
171
- return [
172
- { value: 'list', text: this.$t('list'), icon: 'list-view' },
173
- { value: 'table', text: this.$t('table'), icon: 'table-view' },
174
- ];
186
+ const views = [];
187
+ if (this.listViewEnabled) {
188
+ views.push({ value: 'list', text: this.$t('list'), icon: 'list-view' });
189
+ }
190
+ if (this.kanbanViewEnabled) {
191
+ views.push({ value: 'board', text: this.$t('board'), icon: 'kanban-view' });
192
+ }
193
+ if (this.calendarViewEnabled) {
194
+ views.push({ value: 'calendar', text: this.$t('calendar'), icon: 'calendar-view' });
195
+ }
196
+ if (this.tableViewEnabled) {
197
+ views.push({ value: 'table', text: this.$t('table'), icon: 'table-view' });
198
+ }
199
+ return views;
175
200
  }
176
201
 
177
202
  get tableSchema() {
178
- console.log(123, this.tableColumns, this.schema)
179
203
  // return this.tableColumns || this.schema;
180
204
  if (this.tableColumns) {
181
205
  return {