@itfin/components 1.2.115 → 1.2.117

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.2.115",
3
+ "version": "1.2.117",
4
4
  "author": "Vitalii Savchuk <esvit666@gmail.com>",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -34,13 +34,13 @@
34
34
  "luxon": "^3.3.0",
35
35
  "pdfjs-dist": "^2.10.377",
36
36
  "tippy.js": "^6.3.2",
37
- "vue": "^2.6.12",
38
37
  "vue-imask": "^6.6.3",
39
38
  "vue-property-decorator": "^9.1.2",
40
39
  "vue-swatches": "^2.1.1",
41
40
  "vue-virtual-scroller": "^1.1.2"
42
41
  },
43
42
  "devDependencies": {
43
+ "vue": "^2.6.12",
44
44
  "@babel/eslint-parser": "^7.19.1",
45
45
  "@babel/plugin-proposal-numeric-separator": "^7.18.6",
46
46
  "@babel/plugin-syntax-numeric-separator": "^7.10.4",
@@ -61,6 +61,24 @@
61
61
  cursor: pointer;
62
62
  transition: background-color 0.16s linear 0s;
63
63
 
64
+ &:focus {
65
+ -webkit-mask-image: none!important;
66
+ }
67
+ &:focus:after {
68
+ -webkit-mask-image: paint(squircle);
69
+ --squircle-smooth: 0.6;
70
+ --squircle-radius: 10px;
71
+ --squircle-outline: 3px;
72
+ --squircle-corners: top-left top-right bottom-left bottom-right;
73
+ content: '';
74
+ background: rgb(103, 146, 244);
75
+ position: absolute;
76
+ top: -3px;
77
+ left: -3px;
78
+ right: -3px;
79
+ bottom: -3px;
80
+ outline: none;
81
+ }
64
82
  &.itf-button__block {
65
83
  display: block;
66
84
  width: 100%;
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <div class="itf-radio form-check" :class="{ 'itf-radio__large': large, 'itf-radio__medium': medium }">
3
3
  <input class="form-check-input" :id="id" type="radio" :name="radioName" v-model="isChecked" :value="true" :disabled="disabled" />
4
- <label :for="id" slot="label" class="form-check-label">
5
- {{label}}
6
- <slot name="icon"></slot>
4
+ <label :for="id" class="form-check-label">
5
+ <slot name="label">
6
+ {{label}}
7
+ <slot name="icon"></slot>
8
+ </slot>
7
9
  </label>
8
10
  </div>
9
11
  </template>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div class="form-group and-or-rule row">
3
+ <div class="col-3">
4
+ <select class="form-control input-sm" v-model="key">
5
+ <option v-for="option in options.keys" :value="option.id">
6
+ {{option.name}}
7
+ </option>
8
+ </select>
9
+ </div>
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}}
15
+ </option>
16
+ </select>
17
+ </div>
18
+
19
+ <div class="col-3">
20
+ <input type="text" class="form-control input-sm" v-model="value" placeholder="">
21
+ </div>
22
+ <div class="col-3">
23
+ <itf-button small @click.prevent="deleteSelf()">
24
+ <itf-icon name="close" />
25
+ </itf-button>
26
+ </div>
27
+ </div>
28
+ </template>
29
+ <style>
30
+ .and-or-rule {
31
+ position: relative;
32
+ margin-left: 15px !important;
33
+ padding-left: 0;
34
+ }
35
+
36
+ .and-or-rule:before,
37
+ .and-or-rule:after {
38
+ content: '';
39
+ position: absolute;
40
+ left: -1px;
41
+ width: 16px;
42
+ height: calc(50% + 15px);
43
+ border-color: #c0c5e2;
44
+ border-style: solid;
45
+ }
46
+
47
+ .and-or-rule:before {
48
+ top: -15px;
49
+ border-width: 0 0 2px 2px;
50
+ }
51
+
52
+ .and-or-rule:after {
53
+ top: 50%;
54
+ border-width: 0 0 0 2px;
55
+ }
56
+
57
+ .and-or-rule:last-child:after {
58
+ border: none;
59
+ }
60
+ </style>
61
+ <script>
62
+ import { Component, Prop, Watch, Vue } from "vue-property-decorator";
63
+ import itfButton from '../button/Button.vue';
64
+ import itfIcon from '../icon/Icon.vue';
65
+
66
+ export default @Component({
67
+ name: 'itfRule',
68
+ components: { itfButton, itfIcon }
69
+ })
70
+ class itfRule extends Vue {
71
+ @Prop() options;
72
+
73
+ key = -99;
74
+
75
+ operator = -99;
76
+
77
+ value = '';
78
+
79
+ @Watch('options.keys.options')
80
+ onOptionUpdated() {
81
+ this.key = -99;
82
+ }
83
+
84
+ @Watch('options.conditions.options')
85
+ onOption2Updated() {
86
+ this.condition = -99;
87
+ }
88
+
89
+ deleteSelf () {
90
+ this.$emit('delete-rule');
91
+ }
92
+
93
+ queryFormStatus () {
94
+ return {
95
+ 'key': this.key,
96
+ 'operator': this.operator,
97
+ 'value': this.value
98
+ }
99
+ }
100
+
101
+ fillRuleStatus (data) {
102
+ this.key = data.key;
103
+ this.operator = data.operator;
104
+ this.value = data.value;
105
+ }
106
+ }
107
+ </script>
@@ -0,0 +1,195 @@
1
+ <template>
2
+ <div class="and-or-template col-12" :class="first ? 'and-or-first' : '' ">
3
+ <div class="form-group and-or-top col-12">
4
+ <div class="col-5" style="padding: 0">
5
+ <button class="btn btn-xs btn-purple-outline btn-radius"
6
+ :class=" isAnd ? 'btn-purple-outline-focus' : '' " @click.prevent="clickAnd">
7
+ &nbsp;And&nbsp;
8
+ </button>
9
+ <button class="btn btn-xs btn-purple-outline btn-radius"
10
+ :class=" !isAnd ? 'btn-purple-outline-focus' : '' " @click.prevent="clickOr">
11
+ &nbsp;Or&nbsp;
12
+ </button>
13
+ </div>
14
+
15
+ <div class="col-7 btn-and-or">
16
+ <itf-button v-if="!first" class="btn btn-xs btn-purple pull-right" @click.prevent="deleteSelf()">
17
+ <i class="fa fa-fw fa-close"></i>
18
+ </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
+ </div>
22
+ </div>
23
+
24
+ <rule
25
+ v-for="(rule, index) in rules" ref="rules"
26
+ :options="options" :key="rule" @delete-rule="deleteRule(index)">
27
+ </rule>
28
+
29
+ <itf-rule-group
30
+ class="and-or-offset col-11"
31
+ v-for="(group, index) in groups" ref="groups"
32
+ :options="options" :key="group" @delete-group="deleteGroup(index)">
33
+ </itf-rule-group>
34
+
35
+ </div>
36
+ </template>
37
+ <style>
38
+ .and-or-template {
39
+ padding: 8px;
40
+ position: relative;
41
+ border-radius: 3px;
42
+ border: 1px solid #6d77b8;
43
+ border-top: 3px solid #d2d6de;
44
+ 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
+ }
50
+
51
+ .and-or-template:before,
52
+ .and-or-template:after {
53
+ content: '';
54
+ position: absolute;
55
+ left: -17px;
56
+ width: 16px;
57
+ height: calc(50% + 18px);
58
+ border-color: #c0c5e2;
59
+ border-style: solid;
60
+ }
61
+
62
+ .and-or-template:before {
63
+ top: -18px;
64
+ border-width: 0 0 2px 2px;
65
+ }
66
+
67
+ .and-or-template:after {
68
+ top: 50%;
69
+ border-width: 0 0 0 2px;
70
+ }
71
+
72
+ .and-or-first:before,
73
+ .and-or-first:after,
74
+ .and-or-template:last-child:after {
75
+ border: none;
76
+ }
77
+
78
+ .and-or-top,
79
+ .btn-and-or {
80
+ padding: 0;
81
+ }
82
+
83
+ .btn-and-or button {
84
+ margin-left: 4px;
85
+ }
86
+
87
+ .and-or-offset {
88
+ margin-left: 30px;
89
+ }
90
+ </style>
91
+ <script>
92
+ import { Component, Prop, Watch, Vue } from 'vue-property-decorator';
93
+ import itfButton from '../button/Button.vue';
94
+ import Rule from './Rule'
95
+
96
+ export default @Component({
97
+ name: 'itfRuleGroup',
98
+ components: { itfButton, Rule }
99
+ })
100
+ class itfRule extends Vue {
101
+ @Prop({ type: Object, required: true }) options;
102
+ @Prop({ type: Boolean, default: false }) first;
103
+
104
+ isAnd = true;
105
+ groups = [];
106
+ rules = [];
107
+
108
+ created () {
109
+ this.addRule();
110
+ }
111
+
112
+ clickAnd () {
113
+ this.isAnd = true;
114
+ }
115
+
116
+ clickOr () {
117
+ this.isAnd = false;
118
+ }
119
+
120
+ addRule () {
121
+ var id = this.generateId();
122
+ this.rules.push(id);
123
+ }
124
+
125
+ addGroup () {
126
+ var id = this.generateId();
127
+ this.groups.push(id);
128
+ }
129
+
130
+ deleteSelf () {
131
+ this.$emit('delete-group');
132
+ }
133
+
134
+ deleteRule (index) {
135
+ this.rules.splice(index, 1);
136
+ }
137
+
138
+ deleteGroup (index) {
139
+ this.groups.splice(index, 1);
140
+ }
141
+
142
+ queryFormStatus () {
143
+ var query = {};
144
+ var rules = this.$refs.rules || {};
145
+ var groups = this.$refs.groups || {};
146
+ var i, j;
147
+
148
+ query['condition'] = this.isAnd ? 'AND' : 'OR';
149
+ query['rules'] = [];
150
+ for(i = 0; i < rules.length; i++){
151
+ query.rules.push(rules[i].queryFormStatus ());
152
+ }
153
+ for(j = 0; j < groups.length; j++){
154
+ query.rules[query.rules.length] = groups[j].queryFormStatus();
155
+ }
156
+ return query;
157
+ }
158
+
159
+ fillFormStatus (data) {
160
+ var i, len;
161
+ var group = this;
162
+ group.rules = [];
163
+ group.groups = [];
164
+ if(data){
165
+ group.isAnd = /and/i.test(data.condition);
166
+ len = data.rules.length;
167
+ for(i = 0; i < len; i++){
168
+ if(data.rules[i].condition){
169
+ group.groups.push(group.generateId());
170
+ (function (i, index) {
171
+ group.$nextTick(function () {
172
+ group.$refs.groups[index].fillFormStatus(data.rules[i]);
173
+ });
174
+ })(i, group.groups.length - 1);
175
+ }
176
+ else {
177
+ group.rules.push(group.generateId());
178
+ (function (i, index) {
179
+ group.$nextTick(function () {
180
+ group.$refs.rules[index].fillRuleStatus(data.rules[i]);
181
+ });
182
+ })(i, group.rules.length - 1);
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ generateId () {
189
+ return 'xxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
190
+ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
191
+ return v.toString(16);
192
+ });
193
+ }
194
+ }
195
+ </script>
@@ -0,0 +1,69 @@
1
+ import { storiesOf } from '@storybook/vue';
2
+ import itfRule from './Rule.vue';
3
+ import itfRuleGroup from './RuleGroup.vue';
4
+
5
+ storiesOf('Common', module)
6
+ .add('Filter', () => ({
7
+ components: {
8
+ itfRule,
9
+ itfRuleGroup
10
+ },
11
+ data() {
12
+ return {
13
+ options: {
14
+ keys: [{
15
+ name: 'Choose Key',
16
+ id: -99
17
+ },{
18
+ name: 'Crash Number',
19
+ id: 134
20
+ },{
21
+ name: 'Daily Startup',
22
+ id: 256
23
+ }],
24
+ operators: [{
25
+ name: 'Choose Operator',
26
+ id: -99
27
+ },{
28
+ name: 'equal to',
29
+ id: '>'
30
+ },{
31
+ name: 'not equal to',
32
+ id: '='
33
+ },{
34
+ name: 'less',
35
+ id: '<'
36
+ }]
37
+ },
38
+ isVisible: false,
39
+ isItemEdit: false,
40
+ from: '2021-01-16',
41
+ to: null,
42
+ dates: [],
43
+ customDays: {
44
+ '2021-10-21': { text: '🎉', class: 'test' }
45
+ }
46
+ }
47
+ },
48
+ methods: {
49
+ submit() {
50
+ console.info('saved');
51
+ },
52
+ reset() {
53
+ this.$refs.form.resetValidation();
54
+ }
55
+ },
56
+ template: `<div>
57
+ <p>You need wrap whole application with this tag</p>
58
+
59
+ <h2>Usage</h2>
60
+
61
+ <pre>
62
+
63
+ </pre>
64
+
65
+ <h2>Example</h2>
66
+
67
+ <itf-rule-group :options="options" first />
68
+ </div>`,
69
+ }));
@@ -20,7 +20,7 @@
20
20
  <slot name="empty"></slot>
21
21
  </template>
22
22
  <template v-else>
23
- <div v-for="(item, index) of items" :key="index" :data-card="index">
23
+ <div v-for="(item, index) of items" :key="index" :data-card="index" :class="item.hidden ? 'd-none' : ''">
24
24
  <div accept-group="board-cards"
25
25
  class="itf-board-card-space"
26
26
  @enter="cardHighlight(index, 'enter', 'drop')"
@@ -247,11 +247,22 @@
247
247
  }
248
248
 
249
249
  .itf-board-cards-wrapper {
250
+ display: flex;
251
+ flex-direction: column;
250
252
  overflow: auto;
251
253
  flex-grow: 1;
252
254
  padding-right: .25rem;
253
255
  padding-top: .5rem;
254
256
 
257
+ > div:first-child > .itf-board-card-space > .itf-board-header-dropzone {
258
+ top: -30px;
259
+ z-index: 100;
260
+ }
261
+
262
+ > .itf-board-card-space:last-child {
263
+ flex: 1;
264
+ }
265
+
255
266
  .draggable-source--is-dragging {
256
267
  position: relative !important;
257
268
  .itf-board-card {