@enso-ui/filters 3.0.5 → 3.0.9

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": "@enso-ui/filters",
3
- "version": "3.0.5",
3
+ "version": "3.0.9",
4
4
  "description": "Renderless Vue Filter Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "autoprefixer": "^9.6.1",
46
46
  "babel-eslint": "^10.0.1",
47
47
  "cross-env": "^6.0.0",
48
- "eslint": "^8.0.0",
48
+ "eslint": "^7.0.0",
49
49
  "eslint-import-resolver-alias": "^1.1.2",
50
50
  "eslint-plugin-vue": "^8.0.0"
51
51
  }
@@ -12,7 +12,7 @@
12
12
  import { VTooltip } from 'v-tooltip';
13
13
 
14
14
  export default {
15
- name: 'CoreSelectFilter',
15
+ name: 'BaseSelectFilter',
16
16
 
17
17
  directives: { tooltip: VTooltip },
18
18
 
@@ -29,10 +29,6 @@ export default {
29
29
  type: String,
30
30
  default: null,
31
31
  },
32
- value: {
33
- type: null,
34
- default: null,
35
- },
36
32
  },
37
33
  };
38
34
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <core-select-filter :compact="compact"
2
+ <base-select-filter :compact="compact"
3
3
  :i18n="i18n"
4
4
  :name="name">
5
5
  <enso-select v-tooltip="compact ? i18n(name) : null"
@@ -7,20 +7,20 @@
7
7
  :class="{'has-background-light': compact}"
8
8
  v-bind="$attrs"
9
9
  ref="select"/>
10
- </core-select-filter>
10
+ </base-select-filter>
11
11
  </template>
12
12
 
13
13
  <script>
14
14
  import { VTooltip } from 'v-tooltip';
15
15
  import { EnsoSelect } from '@enso-ui/select/bulma';
16
- import CoreSelectFilter from './CoreSelectFilter.vue';
16
+ import BaseSelectFilter from './BaseSelectFilter.vue';
17
17
 
18
18
  export default {
19
19
  name: 'EnsoSelectFilter',
20
20
 
21
21
  directives: { tooltip: VTooltip },
22
22
 
23
- components: { CoreSelectFilter, EnsoSelect },
23
+ components: { BaseSelectFilter, EnsoSelect },
24
24
 
25
25
  inject: ['i18n'],
26
26
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <core-select-filter :compact="compact"
2
+ <base-select-filter :compact="compact"
3
3
  :i18n="i18n"
4
4
  :name="name">
5
5
  <vue-select v-tooltip="compact ? i18n(name) : null"
@@ -8,20 +8,20 @@
8
8
  v-bind="$attrs"
9
9
  :i18n="i18n"
10
10
  ref="select"/>
11
- </core-select-filter>
11
+ </base-select-filter>
12
12
  </template>
13
13
 
14
14
  <script>
15
15
  import { VTooltip } from 'v-tooltip';
16
16
  import { VueSelect } from '@enso-ui/select/bulma';
17
- import CoreSelectFilter from './CoreSelectFilter.vue';
17
+ import BaseSelectFilter from './BaseSelectFilter.vue';
18
18
 
19
19
  export default {
20
20
  name: 'SelectFilter',
21
21
 
22
22
  directives: { tooltip: VTooltip },
23
23
 
24
- components: { CoreSelectFilter, VueSelect },
24
+ components: { BaseSelectFilter, VueSelect },
25
25
 
26
26
  props: {
27
27
  compact: {
@@ -14,7 +14,7 @@
14
14
  :class="{ 'has-background-light': compact }">
15
15
  <div class="tabs is-toggle is-fullwidth filter-tabs">
16
16
  <ul>
17
- <li :class="{ 'is-active': value }">
17
+ <li :class="{ 'is-active': modelValue }">
18
18
  <a @click="update">
19
19
  <span class="filter-label">
20
20
  <template v-if="translatable">
@@ -68,16 +68,18 @@ export default {
68
68
  type: String,
69
69
  default: null,
70
70
  },
71
- value: {
71
+ modelValue: {
72
72
  type: Boolean,
73
73
  required: true,
74
74
  },
75
75
  },
76
76
 
77
+ emits: ['change', 'update:modelValue'],
78
+
77
79
  methods: {
78
80
  update() {
79
81
  if (!this.readonly) {
80
- this.$emit('input', !this.value);
82
+ this.$emit('update:modelValue', !this.modelValue);
81
83
  }
82
84
  },
83
85
  },
@@ -16,7 +16,7 @@
16
16
  <ul>
17
17
  <li v-for="(option, index) in options"
18
18
  :key="index"
19
- :class="{ 'is-active': option.value === value }">
19
+ :class="{ 'is-active': option.value === modelValue }">
20
20
  <a @click="update(option.value)">
21
21
  <span v-if="icons"
22
22
  :class="['icon', option.class]">
@@ -35,10 +35,12 @@
35
35
  </a>
36
36
  </li>
37
37
  <li v-if="!hideOff"
38
- :class="{ 'is-active': value === null }">
38
+ :class="{ 'is-active': modelValue === null }">
39
39
  <a @click="update()">
40
40
  <span class="icon"
41
- :class="value === null ? 'has-text-danger' : 'has-text-success'">
41
+ :class="modelValue === null
42
+ ? 'has-text-danger'
43
+ : 'has-text-success'">
42
44
  <fa icon="power-off"/>
43
45
  </span>
44
46
  <span v-if="!icons && offLabel"
@@ -107,16 +109,18 @@ export default {
107
109
  type: String,
108
110
  default: null,
109
111
  },
110
- value: {
112
+ modelValue: {
111
113
  type: null,
112
114
  default: null,
113
115
  },
114
116
  },
115
117
 
118
+ emits: ['update:modelValue'],
119
+
116
120
  methods: {
117
121
  update(value = null) {
118
122
  if (!this.readonly) {
119
- this.$emit('input', value);
123
+ this.$emit('update:modelValue', value);
120
124
  }
121
125
  },
122
126
  },
@@ -35,7 +35,7 @@ export default {
35
35
  type: Boolean,
36
36
  default: false,
37
37
  },
38
- value: {
38
+ modelValue: {
39
39
  type: String,
40
40
  default: null,
41
41
  validator: v => Base.concat(Past)
@@ -48,8 +48,10 @@ export default {
48
48
  },
49
49
  },
50
50
 
51
+ emits: ['update', 'update:modelValue'],
52
+
51
53
  data: v => ({
52
- filter: v.value || v.default,
54
+ filter: v.modelValue || v.default,
53
55
  isFuture: false,
54
56
  }),
55
57
 
@@ -74,7 +76,7 @@ export default {
74
76
  },
75
77
 
76
78
  watch: {
77
- value(value) {
79
+ modelValue(value) {
78
80
  this.filter = value;
79
81
  this.update();
80
82
  },
@@ -91,7 +93,7 @@ export default {
91
93
  methods: {
92
94
  set(filter) {
93
95
  this.filter = filter;
94
- this.$emit('input', filter);
96
+ this.$emit('update:modelValue', filter);
95
97
  this.update();
96
98
  },
97
99
  update() {
@@ -172,10 +174,10 @@ export default {
172
174
  custom: this.custom,
173
175
  direction: this.direction,
174
176
  directionBindings: {
175
- value: this.isFuture,
177
+ modelValue: this.isFuture,
176
178
  },
177
179
  directionEvents: {
178
- input: (e) => {
180
+ input: e => {
179
181
  this.isFuture = e;
180
182
  this.filter = 'today';
181
183
  },
@@ -191,7 +193,7 @@ export default {
191
193
  click: () => this.set(type),
192
194
  }),
193
195
  minBindings: {
194
- value: this.interval.min,
196
+ modelValue: this.interval.min,
195
197
  format: this.format,
196
198
  isWarning: this.equals,
197
199
  locale: this.locale,
@@ -199,13 +201,13 @@ export default {
199
201
  max: this.interval.max,
200
202
  },
201
203
  minEvents: {
202
- input: (e) => {
204
+ input: e => {
203
205
  this.interval.min = e;
204
206
  this.update();
205
207
  },
206
208
  },
207
209
  maxBindings: {
208
- value: this.interval.max,
210
+ modelValue: this.interval.max,
209
211
  format: this.format,
210
212
  isWarning: this.equals,
211
213
  locale: this.locale,
@@ -213,7 +215,7 @@ export default {
213
215
  min: this.interval.min,
214
216
  },
215
217
  maxEvents: {
216
- input: (e) => {
218
+ input: e => {
217
219
  this.interval.max = e;
218
220
  this.update();
219
221
  },
@@ -6,6 +6,8 @@ export default {
6
6
 
7
7
  mixins: [dateIntervals],
8
8
 
9
+ emits: ['update'],
10
+
9
11
  methods: {
10
12
  update() {
11
13
  this.$emit('update', this.sanitizedInterval);
@@ -15,27 +17,27 @@ export default {
15
17
  render() {
16
18
  return this.$slots.default({
17
19
  minBindings: {
18
- value: this.interval.min,
20
+ modelValue: this.interval.min,
19
21
  format: this.format,
20
22
  isWarning: this.equals,
21
23
  locale: this.locale,
22
24
  max: this.interval.max,
23
25
  },
24
26
  minEvents: {
25
- input: (e) => {
27
+ 'update:modelValue': e => {
26
28
  this.interval.min = e;
27
29
  this.update();
28
30
  },
29
31
  },
30
32
  maxBindings: {
31
- value: this.interval.max,
33
+ modelValue: this.interval.max,
32
34
  format: this.format,
33
35
  isWarning: this.equals,
34
36
  locale: this.locale,
35
37
  min: this.interval.min,
36
38
  },
37
39
  maxEvents: {
38
- input: (e) => {
40
+ 'update:modelValue': e => {
39
41
  this.interval.max = e;
40
42
  this.update();
41
43
  },
@@ -3,7 +3,7 @@ export default {
3
3
  name: 'CoreInputFilter',
4
4
 
5
5
  props: {
6
- value: {
6
+ modelValue: {
7
7
  type: String,
8
8
  default: 'text',
9
9
  },
@@ -13,21 +13,23 @@ export default {
13
13
  },
14
14
  },
15
15
 
16
+ emits: ['update:modelValue'],
17
+
16
18
  render() {
17
19
  return this.$slots.default({
18
- value: this.value,
20
+ modelValue: this.modelValue,
19
21
  bindings: {
20
- value: this.value,
22
+ modelValue: this.modelValue,
21
23
  type: this.type,
22
24
  },
23
25
  events: {
24
- input: (e) => {
25
- this.$emit('input', e.target.value);
26
+ input: e => {
27
+ this.$emit('update:modelValue', e.target.value);
26
28
  },
27
29
  },
28
30
  clearEvents: {
29
31
  click: () => {
30
- this.$emit('input', null);
32
+ this.$emit('update:modelValue', null);
31
33
  },
32
34
  },
33
35
  });
@@ -3,7 +3,7 @@ export default {
3
3
  name: 'CoreIntervalFilter',
4
4
 
5
5
  props: {
6
- value: {
6
+ modelValue: {
7
7
  type: Object,
8
8
  default: () => ({
9
9
  min: null,
@@ -18,55 +18,57 @@ export default {
18
18
  },
19
19
  },
20
20
 
21
+ emits: ['change', 'update:modelValue'],
22
+
21
23
  computed: {
22
24
  invalid() {
23
- return ![null, ''].includes(this.value.min)
24
- && ![null, ''].includes(this.value.max)
25
+ return ![null, ''].includes(this.modelValue.min)
26
+ && ![null, ''].includes(this.modelValue.max)
25
27
  && (this.type === 'number'
26
- ? Number.parseFloat(this.value.min) > Number.parseFloat(this.value.max)
27
- : this.value.min > this.value.max);
28
+ ? Number.parseFloat(this.modelValue.min) > Number.parseFloat(this.modelValue.max)
29
+ : this.modelValue.min > this.modelValue.max);
28
30
  },
29
31
  },
30
32
 
31
33
  methods: {
32
34
  update() {
33
- this.$emit('input', this.value);
35
+ this.$emit('update:modelValue', this.modelValue);
34
36
  },
35
37
  },
36
38
 
37
39
  render() {
38
40
  return this.$slots.default({
39
41
  invalid: this.invalid,
40
- value: this.value,
42
+ modelValue: this.modelValue,
41
43
  minBindings: {
42
- value: this.value.min,
44
+ modelValue: this.modelValue.min,
43
45
  type: this.type,
44
46
  },
45
47
  minEvents: {
46
- input: (e) => {
47
- this.value.min = e.target.value;
48
+ 'update:modelValue': e => {
49
+ this.modelValue.min = e.target.value;
48
50
  this.update();
49
51
  },
50
52
  },
51
53
  maxBindings: {
52
- value: this.value.max,
54
+ modelValue: this.modelValue.max,
53
55
  type: this.type,
54
56
  },
55
57
  maxEvents: {
56
- input: (e) => {
57
- this.value.max = e.target.value;
58
+ 'update:modelValue': e => {
59
+ this.modelValue.max = e.target.value;
58
60
  this.update();
59
61
  },
60
62
  },
61
63
  minClearEvents: {
62
64
  click: () => {
63
- this.value.min = null;
65
+ this.modelValue.min = null;
64
66
  this.update();
65
67
  },
66
68
  },
67
69
  maxClearEvents: {
68
70
  click: () => {
69
- this.value.max = null;
71
+ this.modelValue.max = null;
70
72
  this.update();
71
73
  },
72
74
  },