pui9-components 2.0.8 → 3.0.0
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 +5300 -22115
- package/dist/pui9-components.css +3 -6
- package/package-lock.json +1 -141
- package/package.json +1 -5
- package/src/App.vue +0 -117
- package/src/components/PuiAutocomplete.vue +0 -196
- package/src/components/PuiCauDialog.vue +0 -192
- package/src/components/PuiCheckbox.vue +0 -126
- package/src/components/PuiCodeEditor.vue +0 -124
- package/src/components/PuiDateField.vue +0 -1043
- package/src/components/PuiField.vue +0 -30
- package/src/components/PuiFieldSet.vue +0 -27
- package/src/components/PuiFileUpload.vue +0 -275
- package/src/components/PuiFileUploadGroup.vue +0 -241
- package/src/components/PuiFilter.vue +0 -104
- package/src/components/PuiFilterGroup.vue +0 -291
- package/src/components/PuiFilterRule.vue +0 -683
- package/src/components/PuiFormFooter.vue +0 -48
- package/src/components/PuiFormFooterBtns.vue +0 -118
- package/src/components/PuiFormHeader.vue +0 -25
- package/src/components/PuiFormLoading.vue +0 -14
- package/src/components/PuiFormMiniAudit.vue +0 -53
- package/src/components/PuiFormTooltip.vue +0 -50
- package/src/components/PuiMasterDetail.vue +0 -103
- package/src/components/PuiModalDialog.vue +0 -91
- package/src/components/PuiModalDialogForm.vue +0 -209
- package/src/components/PuiMultiSelect.vue +0 -636
- package/src/components/PuiNumberField.vue +0 -434
- package/src/components/PuiPasswordField.vue +0 -105
- package/src/components/PuiRadioGroup.vue +0 -105
- package/src/components/PuiRichTextEditor.vue +0 -116
- package/src/components/PuiSelect.vue +0 -1675
- package/src/components/PuiSelectDetailDialog.vue +0 -113
- package/src/components/PuiSelectTextService.vue +0 -61
- package/src/components/PuiSelectorList.vue +0 -169
- package/src/components/PuiSort.vue +0 -98
- package/src/components/PuiSpinnerField.vue +0 -464
- package/src/components/PuiSwitch.vue +0 -104
- package/src/components/PuiTextArea.vue +0 -204
- package/src/components/PuiTextField.vue +0 -389
- package/src/dateTimeUtils.js +0 -78
- package/src/index.js +0 -89
- package/src/main.js +0 -34
- package/src/mixins/PuiFormComponentMixin.js +0 -77
- package/src/mixins/PuiSortMixin.js +0 -136
- package/src/mixins/PuiUtilsNumberMixin.js +0 -29
- package/src/plugins/vuetify.js +0 -33
- package/src/tests/TestAutocomplete.vue +0 -138
- package/src/tests/TestCodeEditor.vue +0 -48
- package/src/tests/TestField.vue +0 -22
- package/src/tests/TestFieldSet.vue +0 -30
- package/src/tests/TestInputCheckbox.vue +0 -53
- package/src/tests/TestInputDate.vue +0 -146
- package/src/tests/TestInputNumber.vue +0 -77
- package/src/tests/TestInputRadioGroup.vue +0 -86
- package/src/tests/TestInputSpinner.vue +0 -77
- package/src/tests/TestInputSwitch.vue +0 -52
- package/src/tests/TestInputText.vue +0 -120
- package/src/tests/TestInputTextArea.vue +0 -73
- package/src/tests/TestMultiSelect.vue +0 -127
- package/src/tests/TestPuiForm.vue +0 -68
- package/src/tests/TestRichTextEditor.vue +0 -54
- package/src/tests/unit/PuiCheckbox.spec.js +0 -86
- package/src/tests/unit/PuiTextArea.spec.js +0 -62
- package/src/tests/unit/PuiTextField.spec.js +0 -119
- package/src/tests/unit/index.js +0 -5
- package/src/utils.js +0 -158
|
@@ -1,683 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-layout wrap class="PuiFilterRule pl-0 pt-0 pb-8">
|
|
3
|
-
<!-- Columna -->
|
|
4
|
-
<v-flex xs4>
|
|
5
|
-
<v-autocomplete
|
|
6
|
-
ref="columnSelector"
|
|
7
|
-
class="pr-1"
|
|
8
|
-
:placeholder="$t('form.puimodel.gridColumns.columnName')"
|
|
9
|
-
append-icon="fa fa-angle-down"
|
|
10
|
-
solo
|
|
11
|
-
flat
|
|
12
|
-
:items="columnsProp"
|
|
13
|
-
item-text="title"
|
|
14
|
-
item-value="name"
|
|
15
|
-
return-object
|
|
16
|
-
v-model="column"
|
|
17
|
-
:disabled="disabled"
|
|
18
|
-
@input="
|
|
19
|
-
clearValues();
|
|
20
|
-
setDefaultOp();
|
|
21
|
-
"
|
|
22
|
-
></v-autocomplete>
|
|
23
|
-
</v-flex>
|
|
24
|
-
|
|
25
|
-
<!-- Operador -->
|
|
26
|
-
<v-flex xs3 class="operator">
|
|
27
|
-
<v-select
|
|
28
|
-
class="pr-1"
|
|
29
|
-
append-icon="fa fa-angle-down"
|
|
30
|
-
solo
|
|
31
|
-
flat
|
|
32
|
-
:items="operators"
|
|
33
|
-
:placeholder="$t('equal')"
|
|
34
|
-
v-model="filterRuleModel.op"
|
|
35
|
-
:disabled="disabled"
|
|
36
|
-
@input="clearValues()"
|
|
37
|
-
></v-select>
|
|
38
|
-
</v-flex>
|
|
39
|
-
<!-- Data -->
|
|
40
|
-
<!-- Caso de que operador es between o not between, dos inputs, depende del tipo: fecha o numero-->
|
|
41
|
-
<v-flex xs5 v-if="filterRuleModel.op === 'bt' || filterRuleModel.op === 'nbt'">
|
|
42
|
-
<v-layout>
|
|
43
|
-
<v-flex xs6>
|
|
44
|
-
<v-text-field
|
|
45
|
-
v-if="column.type !== 'date'"
|
|
46
|
-
class="pr-1 inputFilterText"
|
|
47
|
-
type="number"
|
|
48
|
-
solo
|
|
49
|
-
flat
|
|
50
|
-
outlined
|
|
51
|
-
required
|
|
52
|
-
v-model="value1"
|
|
53
|
-
:disabled="disabled"
|
|
54
|
-
></v-text-field>
|
|
55
|
-
<v-text-field
|
|
56
|
-
v-else
|
|
57
|
-
class="inputFilterText"
|
|
58
|
-
type="date"
|
|
59
|
-
solo
|
|
60
|
-
flat
|
|
61
|
-
outlined
|
|
62
|
-
required
|
|
63
|
-
v-model="value1"
|
|
64
|
-
:disabled="disabled"
|
|
65
|
-
></v-text-field>
|
|
66
|
-
</v-flex>
|
|
67
|
-
<v-flex xs6>
|
|
68
|
-
<v-text-field
|
|
69
|
-
v-if="column.type !== 'date'"
|
|
70
|
-
class="inputFilterText"
|
|
71
|
-
type="number"
|
|
72
|
-
solo
|
|
73
|
-
flat
|
|
74
|
-
outlined
|
|
75
|
-
required
|
|
76
|
-
v-model="value2"
|
|
77
|
-
:disabled="disabled"
|
|
78
|
-
></v-text-field>
|
|
79
|
-
<v-text-field
|
|
80
|
-
v-else
|
|
81
|
-
class="inputFilterText"
|
|
82
|
-
type="date"
|
|
83
|
-
solo
|
|
84
|
-
flat
|
|
85
|
-
outlined
|
|
86
|
-
required
|
|
87
|
-
v-model="value2"
|
|
88
|
-
:disabled="disabled"
|
|
89
|
-
></v-text-field>
|
|
90
|
-
</v-flex>
|
|
91
|
-
</v-layout>
|
|
92
|
-
</v-flex>
|
|
93
|
-
<!-- Caso que sean fechas comparadas con HOY +- X dias, un solo input de tipo numero -->
|
|
94
|
-
<v-flex xs5 v-else-if="isTodayOperator(filterRuleModel.op)">
|
|
95
|
-
<v-layout>
|
|
96
|
-
<v-flex xs3>
|
|
97
|
-
<v-select
|
|
98
|
-
class="pr-1"
|
|
99
|
-
append-icon="fa fa-angle-down"
|
|
100
|
-
solo
|
|
101
|
-
flat
|
|
102
|
-
:items="todayOperators"
|
|
103
|
-
placeholder="+"
|
|
104
|
-
v-model="value1"
|
|
105
|
-
:disabled="disabled"
|
|
106
|
-
></v-select>
|
|
107
|
-
</v-flex>
|
|
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>
|
|
146
|
-
</v-flex>
|
|
147
|
-
</v-layout>
|
|
148
|
-
</v-flex>
|
|
149
|
-
<!-- Caso que sea el operador 'in' o 'not in', solo input de tipo texto -->
|
|
150
|
-
<v-flex xs5 v-else-if="filterRuleModel.op === 'in' || filterRuleModel.op === 'ni'">
|
|
151
|
-
<v-text-field
|
|
152
|
-
v-if="!columnHasFilterColumnValues"
|
|
153
|
-
class="inputFilter"
|
|
154
|
-
type="text"
|
|
155
|
-
solo
|
|
156
|
-
flat
|
|
157
|
-
outlined
|
|
158
|
-
required
|
|
159
|
-
:disabled="disabled"
|
|
160
|
-
v-model="value1"
|
|
161
|
-
></v-text-field>
|
|
162
|
-
<v-autocomplete
|
|
163
|
-
v-else
|
|
164
|
-
append-icon="fa fa-angle-down"
|
|
165
|
-
solo
|
|
166
|
-
flat
|
|
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"
|
|
180
|
-
solo
|
|
181
|
-
flat
|
|
182
|
-
required
|
|
183
|
-
:items="getFilterColumnItemsFromAllowedValues()"
|
|
184
|
-
v-model="value1"
|
|
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>
|
|
242
|
-
</v-flex>
|
|
243
|
-
</v-layout>
|
|
244
|
-
</template>
|
|
245
|
-
|
|
246
|
-
<script>
|
|
247
|
-
export default {
|
|
248
|
-
name: 'PuiFilterRule',
|
|
249
|
-
props: {
|
|
250
|
-
groupName: {
|
|
251
|
-
type: String
|
|
252
|
-
},
|
|
253
|
-
ruleIndexProp: {
|
|
254
|
-
type: Number
|
|
255
|
-
},
|
|
256
|
-
filterRuleProp: {
|
|
257
|
-
type: Object
|
|
258
|
-
},
|
|
259
|
-
columnsProp: {
|
|
260
|
-
type: Array,
|
|
261
|
-
required: true
|
|
262
|
-
},
|
|
263
|
-
filterColumnValues: {
|
|
264
|
-
type: Object,
|
|
265
|
-
required: false
|
|
266
|
-
},
|
|
267
|
-
disabled: {
|
|
268
|
-
type: Boolean,
|
|
269
|
-
default: false
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
data() {
|
|
273
|
-
return {
|
|
274
|
-
filterRuleModel: this.getDefaultFilterRuleModel(),
|
|
275
|
-
column: {
|
|
276
|
-
type: '',
|
|
277
|
-
name: '',
|
|
278
|
-
title: ''
|
|
279
|
-
},
|
|
280
|
-
value1: null,
|
|
281
|
-
value2: null,
|
|
282
|
-
value3: null,
|
|
283
|
-
vSelectMultipleValue: null,
|
|
284
|
-
todaySelector: 'TODAY', // [ TODAY | NOW ]
|
|
285
|
-
todayOperators: [
|
|
286
|
-
{ text: '+', value: '+' },
|
|
287
|
-
{ text: '-', value: '-' }
|
|
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
|
-
}
|
|
411
|
-
};
|
|
412
|
-
},
|
|
413
|
-
computed: {
|
|
414
|
-
isRule0() {
|
|
415
|
-
return this.ruleIndexProp === 0;
|
|
416
|
-
},
|
|
417
|
-
operators() {
|
|
418
|
-
let filterOperatorsSorted = this.filterOperators[this.column.type];
|
|
419
|
-
if (filterOperatorsSorted && Array.isArray(filterOperatorsSorted)) {
|
|
420
|
-
if (this.column.type === 'date' || this.column.type === 'datetime') {
|
|
421
|
-
filterOperatorsSorted = filterOperatorsSorted.filter(
|
|
422
|
-
(obj) => obj.value !== 'bt' && obj.value !== 'nbt' && obj.value !== 'in' && obj.value !== 'ni'
|
|
423
|
-
);
|
|
424
|
-
}
|
|
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
|
-
|
|
439
|
-
return filterOperatorsSorted;
|
|
440
|
-
}
|
|
441
|
-
return [];
|
|
442
|
-
},
|
|
443
|
-
columnHasFilterColumnValues() {
|
|
444
|
-
for (const colName in this.filterColumnValues) {
|
|
445
|
-
return colName == this.column.name;
|
|
446
|
-
}
|
|
447
|
-
return false;
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
watch: {
|
|
451
|
-
filterRuleProp() {
|
|
452
|
-
this.filterRuleModel = this.filterRuleProp;
|
|
453
|
-
this.setValues();
|
|
454
|
-
},
|
|
455
|
-
'column.name'(value) {
|
|
456
|
-
this.filterRuleModel.field = value;
|
|
457
|
-
this.getFilterOperatorsFromFilterRuleModelField();
|
|
458
|
-
},
|
|
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;
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
value2(value) {
|
|
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;
|
|
481
|
-
} else {
|
|
482
|
-
this.filterRuleModel.data = [];
|
|
483
|
-
this.filterRuleModel.data[1] = value;
|
|
484
|
-
}
|
|
485
|
-
},
|
|
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;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
},
|
|
515
|
-
created() {
|
|
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) {
|
|
562
|
-
this.column.name = column.name;
|
|
563
|
-
this.column.type = column.type;
|
|
564
|
-
this.column.title = column.title;
|
|
565
|
-
this.filterOperators[column.type].forEach((operatorsForType) => {
|
|
566
|
-
if (operatorsForType.value === this.filterRuleModel.op) {
|
|
567
|
-
this.filterRuleModel.op = operatorsForType.value;
|
|
568
|
-
// eslint-disable-next-line no-useless-return
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
// eslint-disable-next-line no-useless-return
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
},
|
|
577
|
-
isTodayOperator(operator) {
|
|
578
|
-
return operator === 'eqt' || operator === 'net' || operator === 'ltt' || operator === 'gtt' || operator === 'let' || operator === 'get';
|
|
579
|
-
},
|
|
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();
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
</script>
|
|
640
|
-
|
|
641
|
-
<style lang="postcss">
|
|
642
|
-
.PuiFilterRule {
|
|
643
|
-
height: 35px;
|
|
644
|
-
& .v-input__control {
|
|
645
|
-
min-height: 30px !important;
|
|
646
|
-
}
|
|
647
|
-
& .v-input__slot {
|
|
648
|
-
min-height: 30px !important;
|
|
649
|
-
height: 30px !important;
|
|
650
|
-
|
|
651
|
-
& label {
|
|
652
|
-
position: relative !important;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
& .v-text-field.v-text-field--solo .v-input__control {
|
|
657
|
-
min-height: 32px !important;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
& input::placeholder {
|
|
661
|
-
color: black !important;
|
|
662
|
-
opacity: 1;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
.inputFilter,
|
|
666
|
-
.inputFilterText {
|
|
667
|
-
& .v-input__slot {
|
|
668
|
-
height: 39px !important;
|
|
669
|
-
|
|
670
|
-
& .v-text-field__slot {
|
|
671
|
-
top: -2px;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
.narrow-icon .v-input__icon {
|
|
676
|
-
width: 4px;
|
|
677
|
-
min-width: 4px;
|
|
678
|
-
}
|
|
679
|
-
.operator {
|
|
680
|
-
min-width: 102px;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
</style>
|