pui9-components 1.17.3 → 2.0.7
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/dist/pui9-components.common.js +75007 -52512
- package/dist/pui9-components.css +9 -2
- package/package-lock.json +6651 -6827
- package/package.json +22 -26
- package/src/components/PuiCauDialog.vue +192 -0
- package/src/components/PuiCheckbox.vue +25 -4
- package/src/components/PuiCodeEditor.vue +2 -1
- package/src/components/PuiDateField.vue +653 -614
- package/src/components/PuiField.vue +1 -1
- package/src/components/PuiFileUpload.vue +275 -0
- package/src/components/PuiFileUploadGroup.vue +241 -0
- package/src/components/PuiFilter.vue +54 -52
- package/src/components/PuiFilterGroup.vue +179 -179
- package/src/components/PuiFilterRule.vue +481 -162
- package/src/components/PuiFormFooter.vue +5 -38
- package/src/components/PuiFormTooltip.vue +50 -0
- package/src/components/PuiMasterDetail.vue +18 -11
- package/src/components/PuiModalDialog.vue +4 -1
- package/src/components/PuiModalDialogForm.vue +5 -1
- package/src/components/PuiMultiSelect.vue +383 -280
- package/src/components/PuiNumberField.vue +216 -285
- package/src/components/PuiRichTextEditor.vue +43 -44
- package/src/components/PuiSelect.vue +382 -355
- package/src/components/PuiSelectDetailDialog.vue +10 -3
- package/src/components/PuiSelectorList.vue +169 -0
- package/src/components/PuiSort.vue +98 -0
- package/src/components/PuiSpinnerField.vue +101 -121
- package/src/components/PuiTextField.vue +374 -258
- package/src/index.js +8 -0
- package/src/main.js +1 -0
- package/src/mixins/PuiFormComponentMixin.js +2 -8
- package/src/mixins/PuiSortMixin.js +136 -0
- package/src/mixins/PuiUtilsNumberMixin.js +15 -5
- package/src/plugins/vuetify.js +2 -1
- package/src/utils.js +10 -0
- package/dist/demo.html +0 -10
- package/dist/pui9-components.common.js.map +0 -1
- package/dist/pui9-components.umd.js +0 -86432
- package/dist/pui9-components.umd.js.map +0 -1
- package/dist/pui9-components.umd.min.js +0 -308
- package/dist/pui9-components.umd.min.js.map +0 -1
- package/src/mixins/PuiFilterMixin.js +0 -157
- package/src/mixins/PuiMultiSelectMixin.js +0 -106
|
@@ -1,49 +1,54 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-layout wrap class="PuiFilterRule pl-
|
|
2
|
+
<v-layout wrap class="PuiFilterRule pl-0 pt-0 pb-8">
|
|
3
|
+
<!-- Columna -->
|
|
3
4
|
<v-flex xs4>
|
|
4
5
|
<v-autocomplete
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
ref="columnSelector"
|
|
7
|
+
class="pr-1"
|
|
8
|
+
:placeholder="$t('form.puimodel.gridColumns.columnName')"
|
|
7
9
|
append-icon="fa fa-angle-down"
|
|
8
10
|
solo
|
|
9
11
|
flat
|
|
10
|
-
|
|
11
|
-
:rules="getRules()"
|
|
12
|
-
:items="columns"
|
|
12
|
+
:items="columnsProp"
|
|
13
13
|
item-text="title"
|
|
14
14
|
item-value="name"
|
|
15
15
|
return-object
|
|
16
16
|
v-model="column"
|
|
17
17
|
:disabled="disabled"
|
|
18
|
+
@input="
|
|
19
|
+
clearValues();
|
|
20
|
+
setDefaultOp();
|
|
21
|
+
"
|
|
18
22
|
></v-autocomplete>
|
|
19
23
|
</v-flex>
|
|
20
|
-
|
|
24
|
+
|
|
25
|
+
<!-- Operador -->
|
|
26
|
+
<v-flex xs3 class="operator">
|
|
21
27
|
<v-select
|
|
22
|
-
class="pr-
|
|
28
|
+
class="pr-1"
|
|
23
29
|
append-icon="fa fa-angle-down"
|
|
24
30
|
solo
|
|
25
31
|
flat
|
|
26
|
-
required
|
|
27
|
-
:rules="getRules()"
|
|
28
32
|
:items="operators"
|
|
29
|
-
:
|
|
30
|
-
v-model="op"
|
|
33
|
+
:placeholder="$t('equal')"
|
|
34
|
+
v-model="filterRuleModel.op"
|
|
31
35
|
:disabled="disabled"
|
|
36
|
+
@input="clearValues()"
|
|
32
37
|
></v-select>
|
|
33
38
|
</v-flex>
|
|
39
|
+
<!-- Data -->
|
|
34
40
|
<!-- Caso de que operador es between o not between, dos inputs, depende del tipo: fecha o numero-->
|
|
35
|
-
<v-flex
|
|
41
|
+
<v-flex xs5 v-if="filterRuleModel.op === 'bt' || filterRuleModel.op === 'nbt'">
|
|
36
42
|
<v-layout>
|
|
37
43
|
<v-flex xs6>
|
|
38
44
|
<v-text-field
|
|
39
45
|
v-if="column.type !== 'date'"
|
|
40
|
-
class="inputFilterText"
|
|
46
|
+
class="pr-1 inputFilterText"
|
|
41
47
|
type="number"
|
|
42
48
|
solo
|
|
43
49
|
flat
|
|
44
50
|
outlined
|
|
45
51
|
required
|
|
46
|
-
:rules="getRules()"
|
|
47
52
|
v-model="value1"
|
|
48
53
|
:disabled="disabled"
|
|
49
54
|
></v-text-field>
|
|
@@ -55,7 +60,6 @@
|
|
|
55
60
|
flat
|
|
56
61
|
outlined
|
|
57
62
|
required
|
|
58
|
-
:rules="getRules()"
|
|
59
63
|
v-model="value1"
|
|
60
64
|
:disabled="disabled"
|
|
61
65
|
></v-text-field>
|
|
@@ -69,7 +73,6 @@
|
|
|
69
73
|
flat
|
|
70
74
|
outlined
|
|
71
75
|
required
|
|
72
|
-
:rules="getRules()"
|
|
73
76
|
v-model="value2"
|
|
74
77
|
:disabled="disabled"
|
|
75
78
|
></v-text-field>
|
|
@@ -81,7 +84,6 @@
|
|
|
81
84
|
flat
|
|
82
85
|
outlined
|
|
83
86
|
required
|
|
84
|
-
:rules="getRules()"
|
|
85
87
|
v-model="value2"
|
|
86
88
|
:disabled="disabled"
|
|
87
89
|
></v-text-field>
|
|
@@ -89,93 +91,179 @@
|
|
|
89
91
|
</v-layout>
|
|
90
92
|
</v-flex>
|
|
91
93
|
<!-- Caso que sean fechas comparadas con HOY +- X dias, un solo input de tipo numero -->
|
|
92
|
-
<v-flex
|
|
94
|
+
<v-flex xs5 v-else-if="isTodayOperator(filterRuleModel.op)">
|
|
93
95
|
<v-layout>
|
|
94
|
-
<v-flex
|
|
96
|
+
<v-flex xs3>
|
|
95
97
|
<v-select
|
|
96
|
-
class="pr-
|
|
98
|
+
class="pr-1"
|
|
97
99
|
append-icon="fa fa-angle-down"
|
|
98
100
|
solo
|
|
99
101
|
flat
|
|
100
|
-
required
|
|
101
|
-
:rules="getRules()"
|
|
102
102
|
:items="todayOperators"
|
|
103
|
-
|
|
103
|
+
placeholder="+"
|
|
104
104
|
v-model="value1"
|
|
105
105
|
:disabled="disabled"
|
|
106
106
|
></v-select>
|
|
107
107
|
</v-flex>
|
|
108
|
-
<v-flex
|
|
109
|
-
<v-text-field
|
|
108
|
+
<v-flex xs4>
|
|
109
|
+
<v-text-field
|
|
110
|
+
class="pr-1 inputFilter"
|
|
111
|
+
type="number"
|
|
112
|
+
solo
|
|
113
|
+
flat
|
|
114
|
+
outlined
|
|
115
|
+
required
|
|
116
|
+
v-model="value2"
|
|
117
|
+
@keydown="onTodayOperatorValue2KeyDown"
|
|
118
|
+
>
|
|
119
|
+
<template slot="append">
|
|
120
|
+
<v-tooltip bottom>
|
|
121
|
+
<template v-slot:activator="{ on }">
|
|
122
|
+
<v-icon
|
|
123
|
+
@click.native="toggleTodaySelector()"
|
|
124
|
+
:color="todaySelector == 'TODAY' ? null : 'secondary'"
|
|
125
|
+
class="pointer"
|
|
126
|
+
small
|
|
127
|
+
v-on="on"
|
|
128
|
+
>fa fa-chess-clock</v-icon
|
|
129
|
+
>
|
|
130
|
+
</template>
|
|
131
|
+
<span>{{ todaySelectorTooltip() }}</span>
|
|
132
|
+
</v-tooltip>
|
|
133
|
+
</template>
|
|
134
|
+
</v-text-field>
|
|
135
|
+
</v-flex>
|
|
136
|
+
<v-flex xs5>
|
|
137
|
+
<v-select
|
|
138
|
+
append-icon="fa fa-angle-down"
|
|
139
|
+
solo
|
|
140
|
+
flat
|
|
141
|
+
:items="todayRange"
|
|
142
|
+
v-model="value3"
|
|
143
|
+
:placeholder="$t('form.puialertconfiguration.timeunit_days')"
|
|
144
|
+
:disabled="disabled"
|
|
145
|
+
></v-select>
|
|
110
146
|
</v-flex>
|
|
111
147
|
</v-layout>
|
|
112
148
|
</v-flex>
|
|
113
149
|
<!-- Caso que sea el operador 'in' o 'not in', solo input de tipo texto -->
|
|
114
|
-
<v-flex
|
|
115
|
-
<v-text-field class="inputFilter" type="text" solo flat outlined required :disabled="disabled" v-model="value1"></v-text-field>
|
|
116
|
-
</v-flex>
|
|
117
|
-
<!-- Caso que no sea between ni fechas comparadas con HOY +- X dias, entonces un solo imput, depende del tipo: fecha, numero o texto -->
|
|
118
|
-
<v-flex xs4 v-else>
|
|
150
|
+
<v-flex xs5 v-else-if="filterRuleModel.op === 'in' || filterRuleModel.op === 'ni'">
|
|
119
151
|
<v-text-field
|
|
120
|
-
v-if="
|
|
152
|
+
v-if="!columnHasFilterColumnValues"
|
|
121
153
|
class="inputFilter"
|
|
122
|
-
type="
|
|
154
|
+
type="text"
|
|
123
155
|
solo
|
|
124
156
|
flat
|
|
125
157
|
outlined
|
|
126
|
-
|
|
127
|
-
:
|
|
128
|
-
:disabled="disabledByOperator"
|
|
158
|
+
required
|
|
159
|
+
:disabled="disabled"
|
|
129
160
|
v-model="value1"
|
|
130
161
|
></v-text-field>
|
|
131
|
-
<v-
|
|
132
|
-
v-else
|
|
133
|
-
|
|
134
|
-
type="number"
|
|
162
|
+
<v-autocomplete
|
|
163
|
+
v-else
|
|
164
|
+
append-icon="fa fa-angle-down"
|
|
135
165
|
solo
|
|
136
166
|
flat
|
|
137
|
-
|
|
138
|
-
:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
required
|
|
168
|
+
:items="getFilterColumnItemsFromAllowedValues()"
|
|
169
|
+
v-model="vSelectMultipleValue"
|
|
170
|
+
multiple
|
|
171
|
+
:disabled="disabled"
|
|
172
|
+
>
|
|
173
|
+
</v-autocomplete>
|
|
174
|
+
</v-flex>
|
|
175
|
+
<!-- Caso que no sea between ni fechas comparadas con HOY +- X dias, entonces un solo imput, depende del tipo: fecha, numero o texto -->
|
|
176
|
+
<v-flex xs5 v-else>
|
|
177
|
+
<v-autocomplete
|
|
178
|
+
v-if="(columnHasFilterColumnValues && filterRuleModel.op === 'eq') || filterRuleModel.op === 'ne'"
|
|
179
|
+
append-icon="fa fa-angle-down"
|
|
147
180
|
solo
|
|
148
181
|
flat
|
|
149
|
-
|
|
150
|
-
:
|
|
151
|
-
:rules="getRulesByOperator()"
|
|
152
|
-
:disabled="disabledByOperator"
|
|
182
|
+
required
|
|
183
|
+
:items="getFilterColumnItemsFromAllowedValues()"
|
|
153
184
|
v-model="value1"
|
|
154
|
-
|
|
185
|
+
:disabled="disabled"
|
|
186
|
+
>
|
|
187
|
+
</v-autocomplete>
|
|
188
|
+
<template v-else>
|
|
189
|
+
<v-text-field
|
|
190
|
+
v-if="column.type === 'date' || column.type === 'datetime'"
|
|
191
|
+
v-show="!(filterRuleModel.op === 'nu' || filterRuleModel.op === 'nn')"
|
|
192
|
+
class="inputFilter"
|
|
193
|
+
type="date"
|
|
194
|
+
solo
|
|
195
|
+
flat
|
|
196
|
+
outlined
|
|
197
|
+
required
|
|
198
|
+
:disabled="filterRuleModel.op === 'nu' || filterRuleModel.op === 'nn' || disabled"
|
|
199
|
+
v-model="value1"
|
|
200
|
+
></v-text-field>
|
|
201
|
+
<v-text-field
|
|
202
|
+
v-else-if="column.type === 'numeric' || column.type === 'decimal'"
|
|
203
|
+
v-show="!(filterRuleModel.op === 'nu' || filterRuleModel.op === 'nn')"
|
|
204
|
+
class="inputFilter"
|
|
205
|
+
type="number"
|
|
206
|
+
solo
|
|
207
|
+
flat
|
|
208
|
+
outlined
|
|
209
|
+
required
|
|
210
|
+
:disabled="filterRuleModel.op === 'nu' || filterRuleModel.op === 'nn' || disabled"
|
|
211
|
+
v-model="value1"
|
|
212
|
+
></v-text-field>
|
|
213
|
+
<v-text-field
|
|
214
|
+
v-else
|
|
215
|
+
v-show="!(filterRuleModel.op === 'nu' || filterRuleModel.op === 'nn')"
|
|
216
|
+
class="inputFilter"
|
|
217
|
+
type="text"
|
|
218
|
+
solo
|
|
219
|
+
flat
|
|
220
|
+
outlined
|
|
221
|
+
required
|
|
222
|
+
:disabled="filterRuleModel.op === 'nu' || filterRuleModel.op === 'nn' || disabled"
|
|
223
|
+
v-model="value1"
|
|
224
|
+
>
|
|
225
|
+
<template slot="append">
|
|
226
|
+
<v-tooltip bottom>
|
|
227
|
+
<template v-slot:activator="{ on }">
|
|
228
|
+
<v-icon
|
|
229
|
+
@click.native="filterRuleModel.caseSensitiveAndAccents = !filterRuleModel.caseSensitiveAndAccents"
|
|
230
|
+
:color="filterRuleModel.caseSensitiveAndAccents ? 'secondary' : null"
|
|
231
|
+
class="pointer"
|
|
232
|
+
small
|
|
233
|
+
v-on="on"
|
|
234
|
+
>fa fa-font-case</v-icon
|
|
235
|
+
>
|
|
236
|
+
</template>
|
|
237
|
+
<span>{{ $t('puidatatables.caseSensitive') }}</span>
|
|
238
|
+
</v-tooltip>
|
|
239
|
+
</template>
|
|
240
|
+
</v-text-field>
|
|
241
|
+
</template>
|
|
155
242
|
</v-flex>
|
|
156
243
|
</v-layout>
|
|
157
244
|
</template>
|
|
158
245
|
|
|
159
246
|
<script>
|
|
160
|
-
import PuiFilterMixin from '../mixins/PuiFilterMixin';
|
|
161
|
-
|
|
162
247
|
export default {
|
|
163
248
|
name: 'PuiFilterRule',
|
|
164
|
-
mixins: [PuiFilterMixin],
|
|
165
249
|
props: {
|
|
166
|
-
|
|
250
|
+
groupName: {
|
|
167
251
|
type: String
|
|
168
252
|
},
|
|
169
|
-
|
|
253
|
+
ruleIndexProp: {
|
|
170
254
|
type: Number
|
|
171
255
|
},
|
|
172
|
-
|
|
173
|
-
type:
|
|
256
|
+
filterRuleProp: {
|
|
257
|
+
type: Object
|
|
174
258
|
},
|
|
175
|
-
|
|
176
|
-
type:
|
|
259
|
+
columnsProp: {
|
|
260
|
+
type: Array,
|
|
261
|
+
required: true
|
|
262
|
+
},
|
|
263
|
+
filterColumnValues: {
|
|
264
|
+
type: Object,
|
|
265
|
+
required: false
|
|
177
266
|
},
|
|
178
|
-
dataProp: {},
|
|
179
267
|
disabled: {
|
|
180
268
|
type: Boolean,
|
|
181
269
|
default: false
|
|
@@ -183,7 +271,7 @@ export default {
|
|
|
183
271
|
},
|
|
184
272
|
data() {
|
|
185
273
|
return {
|
|
186
|
-
|
|
274
|
+
filterRuleModel: this.getDefaultFilterRuleModel(),
|
|
187
275
|
column: {
|
|
188
276
|
type: '',
|
|
189
277
|
name: '',
|
|
@@ -191,17 +279,140 @@ export default {
|
|
|
191
279
|
},
|
|
192
280
|
value1: null,
|
|
193
281
|
value2: null,
|
|
194
|
-
|
|
195
|
-
|
|
282
|
+
value3: null,
|
|
283
|
+
vSelectMultipleValue: null,
|
|
284
|
+
todaySelector: 'TODAY', // [ TODAY | NOW ]
|
|
196
285
|
todayOperators: [
|
|
197
286
|
{ text: '+', value: '+' },
|
|
198
287
|
{ text: '-', value: '-' }
|
|
199
|
-
]
|
|
288
|
+
],
|
|
289
|
+
todayRange: [
|
|
290
|
+
{ text: this.$t('form.puialertconfiguration.timeunit_hours'), value: 'HOURS' },
|
|
291
|
+
{ text: this.$t('form.puialertconfiguration.timeunit_days'), value: 'DAYS' },
|
|
292
|
+
{ text: this.$t('form.puialertconfiguration.timeunit_weeks'), value: 'WEEKS' },
|
|
293
|
+
{ text: this.$t('form.puialertconfiguration.timeunit_months'), value: 'MONTHS' },
|
|
294
|
+
{ text: this.$t('form.puialertconfiguration.timeunit_years'), value: 'YEARS' }
|
|
295
|
+
],
|
|
296
|
+
defaultEQTModel: {
|
|
297
|
+
type: 'TODAY',
|
|
298
|
+
sign: '+',
|
|
299
|
+
unitValue: 0,
|
|
300
|
+
unitType: 'DAYS'
|
|
301
|
+
},
|
|
302
|
+
ruleEQTModel: this.defaultEQTModel,
|
|
303
|
+
filterOperators: {
|
|
304
|
+
common: [
|
|
305
|
+
{
|
|
306
|
+
text: 'equal',
|
|
307
|
+
value: 'eq'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
text: 'notEqual',
|
|
311
|
+
value: 'ne'
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
text: 'isNotNull',
|
|
315
|
+
value: 'nn'
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
text: 'isNull',
|
|
319
|
+
value: 'nu'
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
text: 'in',
|
|
323
|
+
value: 'in'
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
text: 'notIn',
|
|
327
|
+
value: 'ni'
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
numeric: [
|
|
331
|
+
{
|
|
332
|
+
text: 'lessThan',
|
|
333
|
+
value: 'lt'
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
text: 'greaterEqualThan',
|
|
337
|
+
value: 'ge'
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
text: 'lessEqualThan',
|
|
341
|
+
value: 'le'
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
text: 'greaterThan',
|
|
345
|
+
value: 'gt'
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
text: 'between',
|
|
349
|
+
value: 'bt'
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
text: 'notBetween',
|
|
353
|
+
value: 'nbt'
|
|
354
|
+
}
|
|
355
|
+
],
|
|
356
|
+
text: [
|
|
357
|
+
{
|
|
358
|
+
text: 'contains',
|
|
359
|
+
value: 'cn'
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
text: 'notContains',
|
|
363
|
+
value: 'nc'
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
text: 'endsWith',
|
|
367
|
+
value: 'ew'
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
text: 'notEndsWith',
|
|
371
|
+
value: 'en'
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
text: 'beginsWith',
|
|
375
|
+
value: 'bw'
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
text: 'notBeginsWith',
|
|
379
|
+
value: 'bn'
|
|
380
|
+
}
|
|
381
|
+
],
|
|
382
|
+
date: [], //son igual que los numericos, solo que tendran un datetime picker en el input,
|
|
383
|
+
datetime: [
|
|
384
|
+
{
|
|
385
|
+
text: 'equalToday',
|
|
386
|
+
value: 'eqt'
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
text: 'notEqualToday',
|
|
390
|
+
value: 'net'
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
text: 'lessThanToday',
|
|
394
|
+
value: 'ltt'
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
text: 'greaterThanToday',
|
|
398
|
+
value: 'gtt'
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
text: 'lessEqualThanToday',
|
|
402
|
+
value: 'let'
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
text: 'greaterEqualThanToday',
|
|
406
|
+
value: 'get'
|
|
407
|
+
}
|
|
408
|
+
], //idem
|
|
409
|
+
decimal: [] //idem
|
|
410
|
+
}
|
|
200
411
|
};
|
|
201
412
|
},
|
|
202
413
|
computed: {
|
|
203
414
|
isRule0() {
|
|
204
|
-
return this.
|
|
415
|
+
return this.ruleIndexProp === 0;
|
|
205
416
|
},
|
|
206
417
|
operators() {
|
|
207
418
|
let filterOperatorsSorted = this.filterOperators[this.column.type];
|
|
@@ -212,68 +423,148 @@ export default {
|
|
|
212
423
|
);
|
|
213
424
|
}
|
|
214
425
|
filterOperatorsSorted.sort((a, b) => (a.text > b.text ? 1 : b.text > a.text ? -1 : 0));
|
|
426
|
+
|
|
427
|
+
// A la lista de operadores ordenados, si el modelo tiene filterColumnValues (lista de valores permitidos prefijada)
|
|
428
|
+
// le eliminamos los siguientes operadores que sabemos que no son necesarios
|
|
429
|
+
if (this.columnHasFilterColumnValues) {
|
|
430
|
+
let filterOperatorsSortedAndTrimmedForSelectedValues = [];
|
|
431
|
+
filterOperatorsSorted.forEach((op) => {
|
|
432
|
+
if (op.value != 'cn' && op.value != 'nc' && op.value != 'ew' && op.value != 'en' && op.value != 'bw' && op.value != 'bn') {
|
|
433
|
+
filterOperatorsSortedAndTrimmedForSelectedValues.push(op);
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
return filterOperatorsSortedAndTrimmedForSelectedValues;
|
|
437
|
+
}
|
|
438
|
+
|
|
215
439
|
return filterOperatorsSorted;
|
|
216
440
|
}
|
|
217
441
|
return [];
|
|
218
442
|
},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return
|
|
443
|
+
columnHasFilterColumnValues() {
|
|
444
|
+
for (const colName in this.filterColumnValues) {
|
|
445
|
+
return colName == this.column.name;
|
|
446
|
+
}
|
|
447
|
+
return false;
|
|
224
448
|
}
|
|
225
449
|
},
|
|
226
450
|
watch: {
|
|
227
|
-
|
|
228
|
-
this.
|
|
451
|
+
filterRuleProp() {
|
|
452
|
+
this.filterRuleModel = this.filterRuleProp;
|
|
453
|
+
this.setValues();
|
|
229
454
|
},
|
|
230
|
-
'column.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
455
|
+
'column.name'(value) {
|
|
456
|
+
this.filterRuleModel.field = value;
|
|
457
|
+
this.getFilterOperatorsFromFilterRuleModelField();
|
|
234
458
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.
|
|
459
|
+
value1(value) {
|
|
460
|
+
//para el caso de between o not between
|
|
461
|
+
if (this.filterRuleModel.op === 'bt' || this.filterRuleModel.op === 'nbt') {
|
|
462
|
+
if (Array.isArray(this.filterRuleModel.data)) {
|
|
463
|
+
this.filterRuleModel.data[0] = value;
|
|
464
|
+
} else {
|
|
465
|
+
this.filterRuleModel.data = [];
|
|
466
|
+
this.filterRuleModel.data[0] = value;
|
|
467
|
+
}
|
|
468
|
+
} else if (this.isTodayOperator(this.filterRuleModel.op)) {
|
|
469
|
+
this.ruleEQTModel.sign = value;
|
|
470
|
+
this.filterRuleModel.data = this.ruleEQTModel;
|
|
471
|
+
} else {
|
|
472
|
+
this.filterRuleModel.data = value;
|
|
239
473
|
}
|
|
240
474
|
},
|
|
241
475
|
value2(value) {
|
|
242
|
-
if (Array.isArray(this.data)) {
|
|
243
|
-
this.data[1] = value;
|
|
244
|
-
} else if (this.isTodayOperator(this.op)) {
|
|
245
|
-
this.
|
|
476
|
+
if (Array.isArray(this.filterRuleModel.data)) {
|
|
477
|
+
this.filterRuleModel.data[1] = value;
|
|
478
|
+
} else if (this.isTodayOperator(this.filterRuleModel.op)) {
|
|
479
|
+
this.ruleEQTModel.unitValue = value;
|
|
480
|
+
this.filterRuleModel.data = this.ruleEQTModel;
|
|
246
481
|
} else {
|
|
247
|
-
this.data = [];
|
|
248
|
-
this.data[1] = value;
|
|
482
|
+
this.filterRuleModel.data = [];
|
|
483
|
+
this.filterRuleModel.data[1] = value;
|
|
249
484
|
}
|
|
250
485
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
486
|
+
value3(value) {
|
|
487
|
+
this.ruleEQTModel.unitType = value;
|
|
488
|
+
this.filterRuleModel.data = this.ruleEQTModel;
|
|
489
|
+
},
|
|
490
|
+
vSelectMultipleValue(value) {
|
|
491
|
+
if (value.length > 0) {
|
|
492
|
+
this.filterRuleModel.data = value[0];
|
|
493
|
+
if (value.length > 1) {
|
|
494
|
+
for (let i = 1, length = value.length; i < length; i++) {
|
|
495
|
+
this.filterRuleModel.data += ',';
|
|
496
|
+
this.filterRuleModel.data += value[i];
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
todaySelector(value) {
|
|
502
|
+
this.ruleEQTModel.type = value;
|
|
503
|
+
this.filterRuleModel.data = this.ruleEQTModel;
|
|
504
|
+
},
|
|
505
|
+
filterRuleModel: {
|
|
506
|
+
deep: true,
|
|
507
|
+
handler() {
|
|
508
|
+
this.$emit('change', this.filterRuleModel);
|
|
509
|
+
if (this.filterRuleModel.field == null) {
|
|
510
|
+
this.$refs.columnSelector.lazyValue = null;
|
|
259
511
|
}
|
|
260
|
-
} else if (this.isTodayOperator(this.op)) {
|
|
261
|
-
this.data = value + this.value2;
|
|
262
|
-
} else {
|
|
263
|
-
this.data = value;
|
|
264
512
|
}
|
|
265
513
|
}
|
|
266
514
|
},
|
|
267
515
|
created() {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
516
|
+
this.translateFilterOperators();
|
|
517
|
+
this.addCommonAndDecimalAndDateFilterOperators();
|
|
518
|
+
this.filterRuleModel = this.filterRuleProp;
|
|
519
|
+
this.setValues();
|
|
520
|
+
},
|
|
521
|
+
methods: {
|
|
522
|
+
setValues() {
|
|
523
|
+
if (this.filterRuleModel.field !== undefined && this.filterRuleModel.op !== undefined && this.filterRuleModel.data !== undefined) {
|
|
524
|
+
this.getFilterOperatorsFromFilterRuleModelField();
|
|
525
|
+
delete this.filterRuleModel.dataIsColumn; // innecesario - viene del back
|
|
526
|
+
if (this.filterRuleModel.op === 'in' || this.filterRuleModel.op === 'ni') {
|
|
527
|
+
if (!this.columnHasFilterColumnValues) {
|
|
528
|
+
this.value1 =
|
|
529
|
+
Array.isArray(this.filterRuleModel.data) === true ? this.filterRuleModel.data.join(',') : this.filterRuleModel.data;
|
|
530
|
+
} else {
|
|
531
|
+
this.vSelectMultipleValue = this.filterRuleModel.data;
|
|
532
|
+
}
|
|
533
|
+
} else if (Array.isArray(this.filterRuleModel.data)) {
|
|
534
|
+
this.value1 = this.filterRuleModel.data[0];
|
|
535
|
+
this.value2 = this.filterRuleModel.data[1];
|
|
536
|
+
} else if (this.isTodayOperator(this.filterRuleModel.op)) {
|
|
537
|
+
this.ruleEQTModel = this.filterRuleModel.data;
|
|
538
|
+
this.todaySelector = this.ruleEQTModel.type;
|
|
539
|
+
this.value1 = this.ruleEQTModel.sign;
|
|
540
|
+
this.value2 = this.ruleEQTModel.unitValue;
|
|
541
|
+
this.value3 = this.ruleEQTModel.unitType;
|
|
542
|
+
} else {
|
|
543
|
+
this.value1 = this.filterRuleModel.data;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
clearValues() {
|
|
548
|
+
this.filterRuleModel.data = null;
|
|
549
|
+
this.ruleEQTModel = this.defaultEQTModel;
|
|
550
|
+
this.todaySelector = this.ruleEQTModel.type;
|
|
551
|
+
this.value1 = null;
|
|
552
|
+
this.value2 = null;
|
|
553
|
+
this.value3 = null;
|
|
554
|
+
this.vSelectMultipleValue = [];
|
|
555
|
+
},
|
|
556
|
+
setDefaultOp() {
|
|
557
|
+
this.filterRuleModel.op = 'eq';
|
|
558
|
+
},
|
|
559
|
+
getFilterOperatorsFromFilterRuleModelField() {
|
|
560
|
+
this.columnsProp.forEach((column) => {
|
|
561
|
+
if (column.name === this.filterRuleModel.field) {
|
|
271
562
|
this.column.name = column.name;
|
|
272
563
|
this.column.type = column.type;
|
|
273
564
|
this.column.title = column.title;
|
|
274
565
|
this.filterOperators[column.type].forEach((operatorsForType) => {
|
|
275
|
-
if (operatorsForType.value === this.
|
|
276
|
-
this.op = operatorsForType.value;
|
|
566
|
+
if (operatorsForType.value === this.filterRuleModel.op) {
|
|
567
|
+
this.filterRuleModel.op = operatorsForType.value;
|
|
277
568
|
// eslint-disable-next-line no-useless-return
|
|
278
569
|
return;
|
|
279
570
|
}
|
|
@@ -282,45 +573,72 @@ export default {
|
|
|
282
573
|
return;
|
|
283
574
|
}
|
|
284
575
|
});
|
|
285
|
-
|
|
286
|
-
this.value1 = Array.isArray(this.dataProp) === true ? this.dataProp.join(',') : this.dataProp;
|
|
287
|
-
} else if (Array.isArray(this.dataProp) === true) {
|
|
288
|
-
this.value1 = this.dataProp[0];
|
|
289
|
-
this.value2 = this.dataProp[1];
|
|
290
|
-
} else if (this.isTodayOperator(this.opProp)) {
|
|
291
|
-
this.value1 = this.dataProp.length > 1 ? this.dataProp.substring(0, 1) : '+';
|
|
292
|
-
this.value2 = this.dataProp.length > 1 ? this.dataProp.substring(1) : 0;
|
|
293
|
-
} else {
|
|
294
|
-
this.value1 = this.dataProp;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
methods: {
|
|
576
|
+
},
|
|
299
577
|
isTodayOperator(operator) {
|
|
300
578
|
return operator === 'eqt' || operator === 'net' || operator === 'ltt' || operator === 'gtt' || operator === 'let' || operator === 'get';
|
|
301
579
|
},
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
580
|
+
translateFilterOperators() {
|
|
581
|
+
for (const colType in this.filterOperators) {
|
|
582
|
+
for (let i = 0, length = this.filterOperators[colType].length; i < length; i++) {
|
|
583
|
+
this.filterOperators[colType][i].text = this.$t(this.filterOperators[colType][i].text);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
addCommonAndDecimalAndDateFilterOperators() {
|
|
588
|
+
const commonKey = 'common';
|
|
589
|
+
for (const colType in this.filterOperators) {
|
|
590
|
+
if (colType === commonKey) {
|
|
591
|
+
continue;
|
|
592
|
+
} else if (colType === 'decimal') {
|
|
593
|
+
this.filterOperators[colType] = this.filterOperators.numeric;
|
|
594
|
+
} else if (colType === 'date' || colType === 'datetime') {
|
|
595
|
+
this.filterOperators[colType] = this.filterOperators[colType].concat(this.filterOperators.numeric);
|
|
596
|
+
}
|
|
597
|
+
this.filterOperators[colType] = this.filterOperators[colType].concat(this.filterOperators[commonKey]);
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
getFilterColumnItemsFromAllowedValues() {
|
|
601
|
+
let items = [];
|
|
602
|
+
|
|
603
|
+
for (const colName in this.filterColumnValues) {
|
|
604
|
+
if (colName == this.column.name) {
|
|
605
|
+
let entries = Object.entries(this.filterColumnValues[colName]);
|
|
606
|
+
for (const index in entries) {
|
|
607
|
+
items.push({
|
|
608
|
+
text: this.$store.getters.getTranslate(entries[index][0]),
|
|
609
|
+
value: entries[index][1]
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
return items;
|
|
616
|
+
},
|
|
617
|
+
getDefaultFilterRuleModel() {
|
|
618
|
+
return {
|
|
619
|
+
op: 'eq',
|
|
620
|
+
field: null,
|
|
621
|
+
data: null,
|
|
622
|
+
caseSensitiveAndAccents: false
|
|
623
|
+
};
|
|
624
|
+
},
|
|
625
|
+
toggleTodaySelector() {
|
|
626
|
+
this.todaySelector == 'TODAY' ? (this.todaySelector = 'NOW') : (this.todaySelector = 'TODAY');
|
|
627
|
+
},
|
|
628
|
+
todaySelectorTooltip() {
|
|
629
|
+
return this.todaySelector == 'TODAY' ? this.$t('puidatatables.todaySelector.today') : this.$t('puidatatables.todaySelector.now');
|
|
630
|
+
},
|
|
631
|
+
onTodayOperatorValue2KeyDown(e) {
|
|
632
|
+
// prevent -, +, e
|
|
633
|
+
if (['-', '+', 'e'].includes(e.key)) {
|
|
634
|
+
e.preventDefault();
|
|
305
635
|
}
|
|
306
|
-
return [(value) => !!value || 'Required'];
|
|
307
636
|
}
|
|
308
637
|
}
|
|
309
638
|
};
|
|
310
639
|
</script>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
height: 24px !important;
|
|
314
|
-
width: 20px !important;
|
|
315
|
-
min-width: 20px !important;
|
|
316
|
-
padding-left: 3px !important;
|
|
317
|
-
padding-right: 3px !important;
|
|
318
|
-
color: var(--N-100) !important;
|
|
319
|
-
cursor: move !important;
|
|
320
|
-
margin-left: 18px;
|
|
321
|
-
&:hover {
|
|
322
|
-
}
|
|
323
|
-
}
|
|
640
|
+
|
|
641
|
+
<style lang="postcss">
|
|
324
642
|
.PuiFilterRule {
|
|
325
643
|
height: 35px;
|
|
326
644
|
& .v-input__control {
|
|
@@ -329,36 +647,37 @@ export default {
|
|
|
329
647
|
& .v-input__slot {
|
|
330
648
|
min-height: 30px !important;
|
|
331
649
|
height: 30px !important;
|
|
650
|
+
|
|
651
|
+
& label {
|
|
652
|
+
position: relative !important;
|
|
653
|
+
}
|
|
332
654
|
}
|
|
655
|
+
|
|
333
656
|
& .v-text-field.v-text-field--solo .v-input__control {
|
|
334
657
|
min-height: 32px !important;
|
|
335
658
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
height: 36px !important;
|
|
659
|
+
|
|
660
|
+
& input::placeholder {
|
|
661
|
+
color: black !important;
|
|
662
|
+
opacity: 1;
|
|
341
663
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
664
|
+
|
|
665
|
+
.inputFilter,
|
|
666
|
+
.inputFilterText {
|
|
667
|
+
& .v-input__slot {
|
|
668
|
+
height: 39px !important;
|
|
669
|
+
|
|
670
|
+
& .v-text-field__slot {
|
|
671
|
+
top: -2px;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
345
674
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
675
|
+
.narrow-icon .v-input__icon {
|
|
676
|
+
width: 4px;
|
|
677
|
+
min-width: 4px;
|
|
349
678
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
height: 36px !important;
|
|
353
|
-
&.v-input.v-text-field.v-text-field--single-line.v-text-field--solo .v-input__slot {
|
|
354
|
-
height: 36px !important;
|
|
679
|
+
.operator {
|
|
680
|
+
min-width: 102px;
|
|
355
681
|
}
|
|
356
682
|
}
|
|
357
|
-
.narrow-icon .v-input__icon {
|
|
358
|
-
width: 4px;
|
|
359
|
-
min-width: 4px;
|
|
360
|
-
}
|
|
361
|
-
.operator {
|
|
362
|
-
min-width: 102px;
|
|
363
|
-
}
|
|
364
683
|
</style>
|