@itfin/components 1.3.21 → 1.3.23

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,61 @@
1
+ <template>
2
+
3
+
4
+ <span class="border rounded d-inline-flex ps-3 pe-1 gap-1 align-items-center">
5
+ Status
6
+
7
+
8
+ <select class="form-control input-sm filter-operation" v-model="operator">
9
+ <option v-for="option in operators" :value="option.id">
10
+ {{option.title}}
11
+ </option>
12
+ </select>
13
+
14
+ <div>
15
+ asda
16
+ </div>
17
+
18
+ <itf-button icon>
19
+ <itf-icon name="close" />
20
+ </itf-button>
21
+ </span>
22
+
23
+ </template>
24
+ <style>
25
+ .form-control.filter-operation {
26
+ background: transparent;
27
+ border: none;
28
+ box-shadow: none;
29
+ border-radius: 0;
30
+
31
+ &:focus, &:active {
32
+ box-shadow: none;
33
+ outline: none;
34
+ }
35
+ &:hover {
36
+ background-color: var(--bs-tertiary-bg);
37
+ }
38
+ }
39
+ </style>
40
+ <script>
41
+ import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
42
+ import {getOperatorsByType} from "./constants";
43
+ import itfButton from '../button/Button.vue';
44
+ import itfIcon from '../icon/Icon.vue';
45
+
46
+
47
+ export default @Component({
48
+ name: 'itfFilterBadge',
49
+ components: {
50
+ itfButton,
51
+ itfIcon
52
+ }
53
+ })
54
+ class itfFilterBadge extends Vue {
55
+ @Prop({ type: String, required: true }) type;
56
+
57
+ get operators() {
58
+ return getOperatorsByType(this.type);
59
+ }
60
+ }
61
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="form-group and-or-rule row">
2
+ <div class="form-group and-or-rule d-flex">
3
3
  <div class="col-3">
4
4
  <select class="form-control input-sm" v-model="key">
5
5
  <option v-for="option in options.keys" :value="option.id">
@@ -8,10 +8,10 @@
8
8
  </select>
9
9
  </div>
10
10
 
11
- <div class="col-3">
12
- <select class="form-control input-sm" v-model="operator">
13
- <option v-for="option in options.operators" :value="option.id">
14
- {{option.name}}
11
+ <div style="width: 150px" class="px-2">
12
+ <select class="form-control input-sm input-filter" v-model="operator">
13
+ <option v-for="option in operators" :value="option.id">
14
+ {{option.title}}
15
15
  </option>
16
16
  </select>
17
17
  </div>
@@ -27,6 +27,9 @@
27
27
  </div>
28
28
  </template>
29
29
  <style>
30
+ .input-filter {
31
+ background: var(--bs-primary-bg-subtle);
32
+ }
30
33
  .and-or-rule {
31
34
  position: relative;
32
35
  margin-left: 15px !important;
@@ -63,12 +66,27 @@ import { Component, Prop, Watch, Vue } from "vue-property-decorator";
63
66
  import itfButton from '../button/Button.vue';
64
67
  import itfIcon from '../icon/Icon.vue';
65
68
 
69
+ const operations = [
70
+ {
71
+ type: 'string',
72
+ operators: [
73
+ { id: 'eq', title: 'equal' },
74
+ { id: 'notEq', title: 'not equal' },
75
+ { id: 'contains', title: 'contains' },
76
+ { id: 'noContains', title: 'not contains' },
77
+ { id: 'startsWith', title: 'starts with' },
78
+ { id: 'endsWith', title: 'ends with' }
79
+ ]
80
+ }
81
+ ];
82
+
66
83
  export default @Component({
67
84
  name: 'itfRule',
68
85
  components: { itfButton, itfIcon }
69
86
  })
70
87
  class itfRule extends Vue {
71
88
  @Prop() options;
89
+ @Prop() type;
72
90
 
73
91
  key = -99;
74
92
 
@@ -76,6 +94,10 @@ class itfRule extends Vue {
76
94
 
77
95
  value = '';
78
96
 
97
+ get operators() {
98
+ return operations.find(op => op.type === this.type)?.operators || [];
99
+ }
100
+
79
101
  @Watch('options.keys.options')
80
102
  onOptionUpdated() {
81
103
  this.key = -99;
@@ -1,5 +1,14 @@
1
1
  <template>
2
- <div class="and-or-template col-12" :class="first ? 'and-or-first' : '' ">
2
+ <div>
3
+ <itf-dropdown>
4
+ <template #button>
5
+ <itf-icon name="filter" />
6
+ Filter
7
+ </template>
8
+
9
+ <div class="dropdown-item" @click="addGroup">Add group</div>
10
+ <div class="dropdown-item" @click="addRule">Add condition</div>
11
+ </itf-dropdown>
3
12
  <div class="form-group and-or-top col-12">
4
13
  <div class="col-5" style="padding: 0">
5
14
  <button class="btn btn-xs btn-purple-outline btn-radius"
@@ -16,14 +25,16 @@
16
25
  <itf-button v-if="!first" class="btn btn-xs btn-purple pull-right" @click.prevent="deleteSelf()">
17
26
  <i class="fa fa-fw fa-close"></i>
18
27
  </itf-button>
19
- <button class="btn btn-xs btn-purple pull-right" @click.prevent="addGroup"> + ( group ) </button>
20
- <button class="btn btn-xs btn-purple add-rule pull-right" @click.prevent="addRule"> + add </button>
21
28
  </div>
22
29
  </div>
23
30
 
24
31
  <rule
25
- v-for="(rule, index) in rules" ref="rules"
26
- :options="options" :key="rule" @delete-rule="deleteRule(index)">
32
+ v-for="(rule, index) in rules"
33
+ ref="rules"
34
+ :options="options"
35
+ :key="rule"
36
+ type="string"
37
+ @delete-rule="deleteRule(index)">
27
38
  </rule>
28
39
 
29
40
  <itf-rule-group
@@ -36,16 +47,8 @@
36
47
  </template>
37
48
  <style>
38
49
  .and-or-template {
39
- padding: 8px;
40
50
  position: relative;
41
- border-radius: 3px;
42
- border: 1px solid #6d77b8;
43
- border-top: 3px solid #d2d6de;
44
51
  margin-bottom: 20px;
45
- /* width: 100%; */
46
- box-shadow: 0 1px 1px rgba(0,0,0,0.1);
47
- border-top-color: #6d77b8;
48
- background-color: rgba(255, 255, 255, 0.9);
49
52
  }
50
53
 
51
54
  .and-or-template:before,
@@ -91,11 +94,18 @@
91
94
  <script>
92
95
  import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
93
96
  import itfButton from '../button/Button.vue';
97
+ import itfIcon from '../icon/Icon.vue';
98
+ import itfDropdown from '../dropdown/Dropdown.vue';
94
99
  import Rule from './Rule'
95
100
 
96
101
  export default @Component({
97
102
  name: 'itfRuleGroup',
98
- components: { itfButton, Rule }
103
+ components: {
104
+ itfIcon,
105
+ itfButton,
106
+ itfDropdown,
107
+ Rule
108
+ }
99
109
  })
100
110
  class itfRule extends Vue {
101
111
  @Prop({ type: Object, required: true }) options;
@@ -0,0 +1,19 @@
1
+
2
+
3
+ export function getOperatorsByType(type) {
4
+ const operations = [
5
+ {
6
+ type: 'string',
7
+ operators: [
8
+ { id: 'eq', title: 'equal' },
9
+ { id: 'notEq', title: 'not equal' },
10
+ { id: 'contains', title: 'contains' },
11
+ { id: 'noContains', title: 'not contains' },
12
+ { id: 'startsWith', title: 'starts with' },
13
+ { id: 'endsWith', title: 'ends with' }
14
+ ]
15
+ }
16
+ ];
17
+
18
+ return operations.find((operation) => operation.type === type).operators;
19
+ }
@@ -1,12 +1,14 @@
1
1
  import { storiesOf } from '@storybook/vue';
2
2
  import itfRule from './Rule.vue';
3
3
  import itfRuleGroup from './RuleGroup.vue';
4
+ import itfFilterBadge from './FilterBadge.vue';
4
5
 
5
6
  storiesOf('Common', module)
6
7
  .add('Filter', () => ({
7
8
  components: {
8
9
  itfRule,
9
- itfRuleGroup
10
+ itfRuleGroup,
11
+ itfFilterBadge
10
12
  },
11
13
  data() {
12
14
  return {
@@ -62,6 +64,10 @@ storiesOf('Common', module)
62
64
 
63
65
  </pre>
64
66
 
67
+
68
+ <itf-filter-badge type="string" />
69
+
70
+
65
71
  <h2>Example</h2>
66
72
 
67
73
  <itf-rule-group :options="options" first />
@@ -150,7 +150,7 @@
150
150
  display: flex;
151
151
  width: fit-content;
152
152
  //margin-top: 20px;
153
- margin-bottom: 20px ;
153
+ //margin-bottom: 20px ;
154
154
 
155
155
  .preline {
156
156
  display: flex;
@@ -298,7 +298,7 @@ class itfTableGroup extends Vue {
298
298
  get visibleColumns() {
299
299
  let list = this.columns;
300
300
  list = sortBy(list, (column) => column.pinned ? 0 : 1);
301
- let left = 47;
301
+ let left = 57; // sum of first 2 cells
302
302
  const pinned = list.filter((column) => column.pinned && column.visible !== false);
303
303
  list = list.map((column, index) => {
304
304
  const item = {...column};
@@ -36,39 +36,37 @@
36
36
  </span>
37
37
  </template>
38
38
 
39
- <ul class="dropdown-menu show ps-0" aria-labelledby="dropdownMenuOffset">
40
- <li v-if="column.sortable">
41
- <a class="dropdown-item d-flex align-items-center" href="javascript:;">
42
- <itf-icon name="arrow_up" :size="16" class="me-1" />
43
- Sort By Asc
44
- </a>
45
- </li>
46
- <li v-if="column.sortable">
47
- <a class="dropdown-item d-flex align-items-center" href="javascript:;">
48
- <itf-icon name="arrow_down" :size="16" class="me-1" />
49
- Sort By Desc
50
- </a>
51
- </li>
52
- <li v-if="column.groupable">
53
- <a class="dropdown-item d-flex align-items-center" href="javascript:;">
54
- <itf-icon name="episodes" :size="16" class="me-1" />
55
- Group By
56
- </a>
57
- </li>
58
- <li>
59
- <a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="togglePinned(n)">
60
- <itf-icon :name="column.pinned ? 'checkbox_checked' : 'checkbox_empty'" :size="16" class="me-1" />
61
- <span v-if="column.pinned">Unpin Column</span>
62
- <span v-else>Pin Column</span>
63
- </a>
64
- </li>
65
- <li>
66
- <a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="hideColumn(n)">
67
- <itf-icon name="eye_no" :size="16" class="me-1" />
68
- Hide
69
- </a>
70
- </li>
71
- </ul>
39
+ <div v-if="column.sortable">
40
+ <a class="dropdown-item d-flex align-items-center" href="javascript:;">
41
+ <itf-icon name="arrow_up" :size="16" class="me-1" />
42
+ Sort By Asc
43
+ </a>
44
+ </div>
45
+ <div v-if="column.sortable">
46
+ <a class="dropdown-item d-flex align-items-center" href="javascript:;">
47
+ <itf-icon name="arrow_down" :size="16" class="me-1" />
48
+ Sort By Desc
49
+ </a>
50
+ </div>
51
+ <div v-if="column.groupable">
52
+ <a class="dropdown-item d-flex align-items-center" href="javascript:;">
53
+ <itf-icon name="episodes" :size="16" class="me-1" />
54
+ Group By
55
+ </a>
56
+ </div>
57
+ <div>
58
+ <a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="togglePinned(n)">
59
+ <itf-icon :name="column.pinned ? 'checkbox_checked' : 'checkbox_empty'" :size="16" class="me-1" />
60
+ <span v-if="column.pinned">Unpin Column</span>
61
+ <span v-else>Pin Column</span>
62
+ </a>
63
+ </div>
64
+ <div>
65
+ <a class="dropdown-item d-flex align-items-center" href="javascript:;" @click="hideColumn(n)">
66
+ <itf-icon name="eye_no" :size="16" class="me-1" />
67
+ Hide
68
+ </a>
69
+ </div>
72
70
  </itf-dropdown>
73
71
  </div>
74
72
  <div v-if="n === sortedColumns.length - 1"