pui9-datatables 1.16.4
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/README.md +24 -0
- package/dist/demo.html +10 -0
- package/dist/pui9-datatables.common.js +89206 -0
- package/dist/pui9-datatables.common.js.map +1 -0
- package/dist/pui9-datatables.css +5 -0
- package/dist/pui9-datatables.umd.js +89216 -0
- package/dist/pui9-datatables.umd.js.map +1 -0
- package/dist/pui9-datatables.umd.min.js +55 -0
- package/dist/pui9-datatables.umd.min.js.map +1 -0
- package/package-lock.json +15982 -0
- package/package.json +89 -0
- package/src/App.vue +37 -0
- package/src/components/desktop/PuiDatatable.vue +709 -0
- package/src/components/desktop/PuiQuickEditionDatatable.vue +548 -0
- package/src/components/desktop/PuiSimpleDatatable.vue +1498 -0
- package/src/components/desktop/datatables.net-plugins/pagination/input.js +213 -0
- package/src/components/desktop/footer/PuiDatatableFooter.vue +65 -0
- package/src/components/desktop/footer/PuiGridActionFooter.vue +132 -0
- package/src/components/desktop/quickedition/PuiQuickEditionExportBtn.vue +138 -0
- package/src/components/desktop/quickedition/PuiQuickEditionForm.vue +60 -0
- package/src/components/desktop/quickedition/PuiQuickEditionToolbar.vue +144 -0
- package/src/components/desktop/row/PuiGridRowActions.vue +112 -0
- package/src/components/desktop/subdialogs/PuiDatatableColumnMenu.vue +186 -0
- package/src/components/desktop/toolbar/PuiGridToolbar.vue +310 -0
- package/src/components/desktop/toolbar/actions/PuiGridActionListItem.vue +34 -0
- package/src/components/desktop/toolbar/actions/PuiGridActionsBtn.vue +56 -0
- package/src/components/desktop/toolbar/actions/PuiGridActionsDialog.vue +66 -0
- package/src/components/desktop/toolbar/actions/audit/PuiAuditDialog.vue +92 -0
- package/src/components/desktop/toolbar/actions/docgen/PuiDocgenTemplateMatchingsDialog.vue +139 -0
- package/src/components/desktop/toolbar/actions/docgen/PuiDocgenTemplateParametersDialog.vue +317 -0
- package/src/components/desktop/toolbar/actions/importexport/PuiGridExportDialog.vue +187 -0
- package/src/components/desktop/toolbar/actions/importexport/PuiGridImportDialog.vue +421 -0
- package/src/components/desktop/toolbar/export/PuiGridExportBtn.vue +175 -0
- package/src/components/desktop/toolbar/filtercombo/PuiGridFilterCombo.vue +237 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterBtns.vue +163 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterDialog.vue +434 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterGroup.vue +313 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterListBtn.vue +85 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterListDialog.vue +254 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterListItem.vue +192 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterRule.vue +517 -0
- package/src/components/desktop/toolbar/grid-configuration/PuiGridConfBtns.vue +99 -0
- package/src/components/desktop/toolbar/grid-configuration/PuiGridConfDialog.vue +640 -0
- package/src/components/desktop/toolbar/grid-configuration/PuiSaveConfigDialog.vue +154 -0
- package/src/components/desktop/toolbar/row/PuiGridCreateBtn.vue +39 -0
- package/src/components/desktop/toolbar/row/PuiGridDeleteBtn.vue +86 -0
- package/src/components/desktop/toolbar/row/PuiGridRefreshBtn.vue +39 -0
- package/src/components/desktop/toolbar/row/PuiGridUpdateBtn.vue +56 -0
- package/src/components/desktop/toolbar/searching/PuiGridSearcher.vue +67 -0
- package/src/components/desktop/toolbar/searching/PuiGridSearcherColumnsList.vue +43 -0
- package/src/components/desktop/toolbar/sorting/PuiGridSortBtn.vue +44 -0
- package/src/components/desktop/toolbar/sorting/PuiGridSortDialog.vue +113 -0
- package/src/components/mobile/PuiDatalist.vue +477 -0
- package/src/components/mobile/PuiSimpleDatalist.vue +313 -0
- package/src/components/mobile/actions/PuiListActionListItem.vue +34 -0
- package/src/components/mobile/actions/PuiListActionsBtn.vue +38 -0
- package/src/components/mobile/actions/PuiListActionsDialog.vue +66 -0
- package/src/components/mobile/footer/PuiListActionFooter.vue +56 -0
- package/src/components/mobile/toolbar/PuiListToolbar.vue +60 -0
- package/src/components/mobile/toolbar/searching/PuiListSearcher.vue +53 -0
- package/src/components/mobile/toolbar/searching/PuiListSearcherColumnsList.vue +43 -0
- package/src/components/mobile/toolbar/sorting/PuiListSortBtn.vue +46 -0
- package/src/components/mobile/toolbar/sorting/PuiListSortDialog.vue +140 -0
- package/src/components/puiaudit/PuiAuditForm.vue +107 -0
- package/src/generalActions.js +135 -0
- package/src/index.js +31 -0
- package/src/main.js +67 -0
- package/src/mixins/PuiActionsBtnMixin.js +287 -0
- package/src/mixins/PuiActionsDialogMixin.js +161 -0
- package/src/mixins/PuiActionsListItemMixin.js +62 -0
- package/src/mixins/PuiDatatablesKeepPage.js +15 -0
- package/src/mixins/PuiGridFormMethodsMixin.js +133 -0
- package/src/mixins/PuiModelConfigurationMixin.js +15 -0
- package/src/mixins/PuiSearcherColumnsListMixin.js +108 -0
- package/src/mixins/PuiSearcherMixin.js +192 -0
- package/src/mixins/PuiSortBtnMixin.js +54 -0
- package/src/mixins/PuiSortDialogMixin.js +256 -0
- package/src/mixins/PuiToolbarBtnMixin.js +66 -0
- package/src/mixins/PuiToolbarDialogMixin.js +12 -0
- package/src/router.js +18 -0
- package/src/tests/PuiContainer.vue +139 -0
- package/src/tests/PuiProfileTestSimpleDatatable.vue +66 -0
- package/src/tests/PuiUserTestCompleteDatatable.vue +126 -0
- package/src/tests/PuiVariableTestQuickEditionDatatable.vue +39 -0
- package/src/tests/PuiVariableTestQuickEditionForm.vue +18 -0
- package/src/tests/modelConfigurations.json +3516 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-layout wrap class="puiGridFilterListItem ma-1" ref="theItem" :class="compClass">
|
|
3
|
+
<v-flex xs2>
|
|
4
|
+
<span class="puiGridFilterListItem__titleicon">
|
|
5
|
+
<v-icon v-if="!model.isSystemFilter" class="puiGridFilterListItem__icon" @click="showMessageBeforeDeleteItem()">fa fa-trash</v-icon>
|
|
6
|
+
</span>
|
|
7
|
+
</v-flex>
|
|
8
|
+
<v-flex xs8 @click="selectItem()">
|
|
9
|
+
<span class="puiGridFilterListItem__title">{{ model.label }}</span>
|
|
10
|
+
</v-flex>
|
|
11
|
+
<v-flex xs2>
|
|
12
|
+
<span class="puiGridFilterListItem__check" v-show="checked === true">
|
|
13
|
+
<v-icon>fa fa-check</v-icon>
|
|
14
|
+
</span>
|
|
15
|
+
</v-flex>
|
|
16
|
+
<!-- delete item modal dialog -->
|
|
17
|
+
<pui-modal-dialog
|
|
18
|
+
v-if="showDeleteItemDialog"
|
|
19
|
+
:cancelText="$t('form.cancel')"
|
|
20
|
+
:okText="$t('pui9.accept')"
|
|
21
|
+
:titleText="$t('pui9.delete.title')"
|
|
22
|
+
:messageText="$t('pui9.delete.confirm')"
|
|
23
|
+
:dialogName="`deleteItem-${this.model.id}`"
|
|
24
|
+
></pui-modal-dialog>
|
|
25
|
+
</v-layout>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
const puiGridFilterListItemSettings = { selectedItemId: null };
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: 'PuiGridFilterListItem',
|
|
33
|
+
props: {
|
|
34
|
+
typeFilter: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'user'
|
|
37
|
+
},
|
|
38
|
+
model: {
|
|
39
|
+
type: Object,
|
|
40
|
+
required: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
checked: false,
|
|
46
|
+
showDeleteItemDialog: false,
|
|
47
|
+
filterModelName: 'puiusermodelfilter'
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
computed: {
|
|
51
|
+
compClass() {
|
|
52
|
+
return {
|
|
53
|
+
'puiGridFilterListItem--selected': this.checked
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
mounted() {
|
|
58
|
+
if (this.model.checked === true) {
|
|
59
|
+
this.checked = true;
|
|
60
|
+
this.$puiEvents.$emit(`onPui-apply-storedFilter-${this.model.model}`, [this.model, this.model.checked]);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
destroyed() {
|
|
64
|
+
this.$puiEvents.$off(`pui-modalDialog-deleteItem-${this.model.id}-ok`);
|
|
65
|
+
this.$puiEvents.$off(`pui-modalDialog-deleteItem-${this.model.id}-cancel`);
|
|
66
|
+
},
|
|
67
|
+
created() {
|
|
68
|
+
this.$puiEvents.$on(`onPui-apply-filtering-${this.model.model}`, (theFilter) => {
|
|
69
|
+
if (theFilter && puiGridFilterListItemSettings.selectedItemId && puiGridFilterListItemSettings.selectedItemId === this.model.id) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.toggle(false);
|
|
73
|
+
});
|
|
74
|
+
this.$puiEvents.$on(`onPui-toggle-filtering-${this.model.model}`, (params) => {
|
|
75
|
+
if (params && params.length > 1) {
|
|
76
|
+
const model = params[0];
|
|
77
|
+
const checked = params[1];
|
|
78
|
+
if (model !== null && model !== undefined && checked !== null && checked !== undefined) {
|
|
79
|
+
if (this.model.id === model.id) {
|
|
80
|
+
this.toggle(checked);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.toggle(false);
|
|
86
|
+
});
|
|
87
|
+
// delete registry modal
|
|
88
|
+
this.$puiEvents.$on(`pui-modalDialog-deleteItem-${this.model.id}-ok`, () => {
|
|
89
|
+
this.showDeleteItemDialog = false;
|
|
90
|
+
this.deleteItem();
|
|
91
|
+
});
|
|
92
|
+
this.$puiEvents.$on(`pui-modalDialog-deleteItem-${this.model.id}-cancel`, () => {
|
|
93
|
+
this.showDeleteItemDialog = false;
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
toggle(value) {
|
|
98
|
+
if (value === false) {
|
|
99
|
+
this.checked = false;
|
|
100
|
+
this.model.checked = false;
|
|
101
|
+
} else if (value === true) {
|
|
102
|
+
this.checked = true;
|
|
103
|
+
this.model.checked = true;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
selectItem() {
|
|
107
|
+
const filterObject = this.model.filter instanceof Object ? this.model.filter : JSON.parse(this.model.filter);
|
|
108
|
+
puiGridFilterListItemSettings.selectedItemId = this.model.id;
|
|
109
|
+
if (!this.model.checked) {
|
|
110
|
+
this.checked = true;
|
|
111
|
+
this.$puiEvents.$emit(`onPui-apply-storedFilter-${this.model.model}`, [this.model, this.checked]);
|
|
112
|
+
this.$puiEvents.$emit(`onPui-apply-filtering-${this.model.model}`, filterObject);
|
|
113
|
+
} else {
|
|
114
|
+
this.checked = false;
|
|
115
|
+
this.$puiEvents.$emit(`onPui-apply-storedFilter-${this.model.model}`, [null, this.checked]);
|
|
116
|
+
this.$puiEvents.$emit(`onPui-apply-filtering-${this.model.model}`, null);
|
|
117
|
+
this.$puiEvents.$emit(`onPui-disapply-storedFilter-${this.model.model}`);
|
|
118
|
+
}
|
|
119
|
+
puiGridFilterListItemSettings.selectedItemId = null;
|
|
120
|
+
},
|
|
121
|
+
//method to get called by a parent component, only removes the class selected on item an the icon
|
|
122
|
+
unselectItem() {
|
|
123
|
+
this.checked = false;
|
|
124
|
+
},
|
|
125
|
+
showMessageBeforeDeleteItem() {
|
|
126
|
+
this.showDeleteItemDialog = true;
|
|
127
|
+
},
|
|
128
|
+
deleteItem() {
|
|
129
|
+
this.$puiRequests.deleteRequest(
|
|
130
|
+
`/${this.filterModelName}/delete`,
|
|
131
|
+
null,
|
|
132
|
+
(response) => {
|
|
133
|
+
this.$puiEvents.$emit(`onPui-deleteRow-dataTable-${this.filterModelName}`, response.data);
|
|
134
|
+
this.$puiNotify.success(this.$t('pui9.delete.success'));
|
|
135
|
+
},
|
|
136
|
+
(error) => {
|
|
137
|
+
this.$store.dispatch('puiRequestShowServerError', { error });
|
|
138
|
+
},
|
|
139
|
+
{ id: this.model.id }
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style lang="postcss" scoped>
|
|
147
|
+
.puiGridFilterListItem {
|
|
148
|
+
color: var(--N-500) !important;
|
|
149
|
+
background-color: var(--N-0) !important;
|
|
150
|
+
min-height: 30px;
|
|
151
|
+
padding-top: 4px;
|
|
152
|
+
padding-bottom: 4px;
|
|
153
|
+
font-size: var(--font-base) !important;
|
|
154
|
+
text-indent: -0.5;
|
|
155
|
+
padding-left: 1em;
|
|
156
|
+
& span {
|
|
157
|
+
padding-left: 3px;
|
|
158
|
+
}
|
|
159
|
+
&:hover {
|
|
160
|
+
background-color: var(--N-10) !important;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
&__title {
|
|
164
|
+
}
|
|
165
|
+
&__titleicon {
|
|
166
|
+
padding-left: 2px !important;
|
|
167
|
+
padding-right: 0px !important;
|
|
168
|
+
margin-right: 2px !important;
|
|
169
|
+
}
|
|
170
|
+
&__icon {
|
|
171
|
+
font-size: 12px !important;
|
|
172
|
+
color: var(--N-200);
|
|
173
|
+
}
|
|
174
|
+
&--selected {
|
|
175
|
+
background-color: var(--primarycolor) !important;
|
|
176
|
+
color: var(--N-0) !important;
|
|
177
|
+
&:hover {
|
|
178
|
+
background-color: var(--primarycolor) !important;
|
|
179
|
+
color: var(--N-0) !important;
|
|
180
|
+
}
|
|
181
|
+
& .puiGridFilterListItem__icon {
|
|
182
|
+
color: var(--N-0) !important;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
&__check {
|
|
186
|
+
& .v-icon {
|
|
187
|
+
font-size: 12px !important;
|
|
188
|
+
color: var(--N-0);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
</style>
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-layout wrap class="PuiFilterRule pl-3">
|
|
3
|
+
<!-- <v-flex xs1>
|
|
4
|
+
<v-btn class="elevation-0 dragger2">
|
|
5
|
+
<v-icon small>far fa-ellipsis-v</v-icon>
|
|
6
|
+
<v-icon small>far fa-ellipsis-v</v-icon>
|
|
7
|
+
</v-btn>
|
|
8
|
+
</v-flex>-->
|
|
9
|
+
<v-flex xs4>
|
|
10
|
+
<v-autocomplete
|
|
11
|
+
class="pr-2"
|
|
12
|
+
label="column"
|
|
13
|
+
append-icon="fa fa-angle-down"
|
|
14
|
+
solo
|
|
15
|
+
flat
|
|
16
|
+
:items="columns"
|
|
17
|
+
item-text="title"
|
|
18
|
+
item-value="name"
|
|
19
|
+
return-object
|
|
20
|
+
v-model="column"
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
></v-autocomplete>
|
|
23
|
+
</v-flex>
|
|
24
|
+
<v-flex xs4 class="operator">
|
|
25
|
+
<v-select
|
|
26
|
+
class="pr-2"
|
|
27
|
+
append-icon="fa fa-angle-down"
|
|
28
|
+
solo
|
|
29
|
+
flat
|
|
30
|
+
:items="operators"
|
|
31
|
+
:label="$t('equal')"
|
|
32
|
+
v-model="op"
|
|
33
|
+
:disabled="disabled"
|
|
34
|
+
></v-select>
|
|
35
|
+
</v-flex>
|
|
36
|
+
<!-- Caso de que operador es between o not between, dos inputs, depende del tipo: fecha o numero-->
|
|
37
|
+
<v-flex xs4 v-if="op === 'bt' || op === 'nbt'">
|
|
38
|
+
<v-layout>
|
|
39
|
+
<v-flex xs6>
|
|
40
|
+
<v-text-field
|
|
41
|
+
v-if="column.type !== 'date'"
|
|
42
|
+
class="inputFilterText"
|
|
43
|
+
type="number"
|
|
44
|
+
solo
|
|
45
|
+
flat
|
|
46
|
+
outlined
|
|
47
|
+
required
|
|
48
|
+
v-model="value1"
|
|
49
|
+
:disabled="disabled"
|
|
50
|
+
></v-text-field>
|
|
51
|
+
<v-text-field
|
|
52
|
+
v-else
|
|
53
|
+
class="inputFilterText"
|
|
54
|
+
type="date"
|
|
55
|
+
solo
|
|
56
|
+
flat
|
|
57
|
+
outlined
|
|
58
|
+
required
|
|
59
|
+
v-model="value1"
|
|
60
|
+
:disabled="disabled"
|
|
61
|
+
></v-text-field>
|
|
62
|
+
</v-flex>
|
|
63
|
+
<v-flex xs6>
|
|
64
|
+
<v-text-field
|
|
65
|
+
v-if="column.type !== 'date'"
|
|
66
|
+
class="inputFilterText"
|
|
67
|
+
type="number"
|
|
68
|
+
solo
|
|
69
|
+
flat
|
|
70
|
+
outlined
|
|
71
|
+
required
|
|
72
|
+
v-model="value2"
|
|
73
|
+
:disabled="disabled"
|
|
74
|
+
></v-text-field>
|
|
75
|
+
<v-text-field
|
|
76
|
+
v-else
|
|
77
|
+
class="inputFilterText"
|
|
78
|
+
type="date"
|
|
79
|
+
solo
|
|
80
|
+
flat
|
|
81
|
+
outlined
|
|
82
|
+
required
|
|
83
|
+
v-model="value2"
|
|
84
|
+
:disabled="disabled"
|
|
85
|
+
></v-text-field>
|
|
86
|
+
</v-flex>
|
|
87
|
+
</v-layout>
|
|
88
|
+
</v-flex>
|
|
89
|
+
<!-- Caso que sean fechas comparadas con HOY +- X dias, un solo input de tipo numero -->
|
|
90
|
+
<v-flex xs4 v-else-if="isTodayOperator(op)">
|
|
91
|
+
<v-layout>
|
|
92
|
+
<v-flex xs5>
|
|
93
|
+
<v-select
|
|
94
|
+
class="pr-2"
|
|
95
|
+
append-icon="fa fa-angle-down"
|
|
96
|
+
solo
|
|
97
|
+
flat
|
|
98
|
+
:items="todayOperators"
|
|
99
|
+
:label="$t('equal')"
|
|
100
|
+
v-model="value1"
|
|
101
|
+
:disabled="disabled"
|
|
102
|
+
></v-select>
|
|
103
|
+
</v-flex>
|
|
104
|
+
<v-flex xs7>
|
|
105
|
+
<v-text-field
|
|
106
|
+
class="inputFilter"
|
|
107
|
+
type="number"
|
|
108
|
+
solo
|
|
109
|
+
flat
|
|
110
|
+
outlined
|
|
111
|
+
required
|
|
112
|
+
v-model="value2"
|
|
113
|
+
@keydown="onTodayOperatorValue2KeyDown"
|
|
114
|
+
></v-text-field>
|
|
115
|
+
</v-flex>
|
|
116
|
+
</v-layout>
|
|
117
|
+
</v-flex>
|
|
118
|
+
<!-- Caso que sea el operador 'in' o 'not in', solo input de tipo texto -->
|
|
119
|
+
<v-flex xs4 v-else-if="op === 'in' || op === 'ni'">
|
|
120
|
+
<v-text-field class="inputFilter" type="text" solo flat outlined required :disabled="disabled" v-model="value1"></v-text-field>
|
|
121
|
+
</v-flex>
|
|
122
|
+
<!-- Caso que no sea between ni fechas comparadas con HOY +- X dias, entonces un solo imput, depende del tipo: fecha, numero o texto -->
|
|
123
|
+
<v-flex xs4 v-else>
|
|
124
|
+
<v-text-field
|
|
125
|
+
v-if="column.type === 'date' || column.type === 'datetime'"
|
|
126
|
+
class="inputFilter"
|
|
127
|
+
type="date"
|
|
128
|
+
solo
|
|
129
|
+
flat
|
|
130
|
+
outlined
|
|
131
|
+
required
|
|
132
|
+
:disabled="op === 'nu' || op === 'nn' || disabled"
|
|
133
|
+
v-model="value1"
|
|
134
|
+
></v-text-field>
|
|
135
|
+
<v-text-field
|
|
136
|
+
v-else-if="column.type === 'numeric' || column.type === 'decimal'"
|
|
137
|
+
class="inputFilter"
|
|
138
|
+
type="number"
|
|
139
|
+
solo
|
|
140
|
+
flat
|
|
141
|
+
outlined
|
|
142
|
+
required
|
|
143
|
+
:disabled="op === 'nu' || op === 'nn' || disabled"
|
|
144
|
+
v-model="value1"
|
|
145
|
+
></v-text-field>
|
|
146
|
+
<v-text-field
|
|
147
|
+
v-else
|
|
148
|
+
class="inputFilter"
|
|
149
|
+
type="text"
|
|
150
|
+
solo
|
|
151
|
+
flat
|
|
152
|
+
outlined
|
|
153
|
+
required
|
|
154
|
+
:disabled="op === 'nu' || op === 'nn' || disabled"
|
|
155
|
+
v-model="value1"
|
|
156
|
+
>
|
|
157
|
+
<template slot="append">
|
|
158
|
+
<v-tooltip bottom>
|
|
159
|
+
<template v-slot:activator="{ on }">
|
|
160
|
+
<v-icon
|
|
161
|
+
@click.native="caseSensitive = !caseSensitive"
|
|
162
|
+
:color="caseSensitive ? 'secondary' : null"
|
|
163
|
+
class="pointer"
|
|
164
|
+
small
|
|
165
|
+
v-on="on"
|
|
166
|
+
>fa fa-font-case</v-icon
|
|
167
|
+
>
|
|
168
|
+
</template>
|
|
169
|
+
<span>{{ $t('puidatatables.caseSensitive') }}</span>
|
|
170
|
+
</v-tooltip>
|
|
171
|
+
</template>
|
|
172
|
+
</v-text-field>
|
|
173
|
+
</v-flex>
|
|
174
|
+
</v-layout>
|
|
175
|
+
</template>
|
|
176
|
+
|
|
177
|
+
<script>
|
|
178
|
+
export default {
|
|
179
|
+
name: 'PuiGridFilterRule',
|
|
180
|
+
props: {
|
|
181
|
+
columns: {
|
|
182
|
+
type: Array,
|
|
183
|
+
required: true
|
|
184
|
+
},
|
|
185
|
+
group: {
|
|
186
|
+
type: String
|
|
187
|
+
},
|
|
188
|
+
ruleIndex: {
|
|
189
|
+
type: Number
|
|
190
|
+
},
|
|
191
|
+
fieldProp: {
|
|
192
|
+
type: String
|
|
193
|
+
},
|
|
194
|
+
opProp: {
|
|
195
|
+
type: String
|
|
196
|
+
},
|
|
197
|
+
dataProp: {},
|
|
198
|
+
caseSensitiveProp: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: false
|
|
201
|
+
},
|
|
202
|
+
disabled: {
|
|
203
|
+
type: Boolean,
|
|
204
|
+
default: false
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
data() {
|
|
208
|
+
return {
|
|
209
|
+
op: 'eq',
|
|
210
|
+
column: {
|
|
211
|
+
type: '',
|
|
212
|
+
name: '',
|
|
213
|
+
title: ''
|
|
214
|
+
},
|
|
215
|
+
value1: null,
|
|
216
|
+
value2: null,
|
|
217
|
+
field: null,
|
|
218
|
+
data: null,
|
|
219
|
+
todayOperators: [
|
|
220
|
+
{ text: '+', value: '+' },
|
|
221
|
+
{ text: '-', value: '-' }
|
|
222
|
+
],
|
|
223
|
+
filterOperators: {
|
|
224
|
+
common: [
|
|
225
|
+
{
|
|
226
|
+
text: 'equal',
|
|
227
|
+
value: 'eq'
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
text: 'notEqual',
|
|
231
|
+
value: 'ne'
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
text: 'isNotNull',
|
|
235
|
+
value: 'nn'
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
text: 'isNull',
|
|
239
|
+
value: 'nu'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
text: 'in',
|
|
243
|
+
value: 'in'
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
text: 'notIn',
|
|
247
|
+
value: 'ni'
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
numeric: [
|
|
251
|
+
{
|
|
252
|
+
text: 'lessThan',
|
|
253
|
+
value: 'lt'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
text: 'greaterEqualThan',
|
|
257
|
+
value: 'ge'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
text: 'lessEqualThan',
|
|
261
|
+
value: 'le'
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
text: 'greaterThan',
|
|
265
|
+
value: 'gt'
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
text: 'between',
|
|
269
|
+
value: 'bt'
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
text: 'notBetween',
|
|
273
|
+
value: 'nbt'
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
text: [
|
|
277
|
+
{
|
|
278
|
+
text: 'contains',
|
|
279
|
+
value: 'cn'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
text: 'notContains',
|
|
283
|
+
value: 'nc'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
text: 'endsWith',
|
|
287
|
+
value: 'ew'
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
text: 'notEndsWith',
|
|
291
|
+
value: 'en'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
text: 'beginsWith',
|
|
295
|
+
value: 'bw'
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
text: 'notBeginsWith',
|
|
299
|
+
value: 'bn'
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
date: [], //son igual que los numericos, solo que tendran un datetime picker en el input,
|
|
303
|
+
datetime: [
|
|
304
|
+
{
|
|
305
|
+
text: 'equalToday',
|
|
306
|
+
value: 'eqt'
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
text: 'notEqualToday',
|
|
310
|
+
value: 'net'
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
text: 'lessThanToday',
|
|
314
|
+
value: 'ltt'
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
text: 'greaterThanToday',
|
|
318
|
+
value: 'gtt'
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
text: 'lessEqualThanToday',
|
|
322
|
+
value: 'let'
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
text: 'greaterEqualThanToday',
|
|
326
|
+
value: 'get'
|
|
327
|
+
}
|
|
328
|
+
], //idem
|
|
329
|
+
decimal: [] //idem
|
|
330
|
+
},
|
|
331
|
+
caseSensitive: this.caseSensitiveProp
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
computed: {
|
|
335
|
+
isRule0() {
|
|
336
|
+
return this.ruleIndex === 0;
|
|
337
|
+
},
|
|
338
|
+
operators() {
|
|
339
|
+
let filterOperatorsSorted = this.filterOperators[this.column.type];
|
|
340
|
+
if (filterOperatorsSorted && Array.isArray(filterOperatorsSorted)) {
|
|
341
|
+
if (this.column.type === 'date' || this.column.type === 'datetime') {
|
|
342
|
+
filterOperatorsSorted = filterOperatorsSorted.filter(
|
|
343
|
+
(obj) => obj.value !== 'bt' && obj.value !== 'nbt' && obj.value !== 'in' && obj.value !== 'ni'
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
filterOperatorsSorted.sort((a, b) => (a.text > b.text ? 1 : b.text > a.text ? -1 : 0));
|
|
347
|
+
return filterOperatorsSorted;
|
|
348
|
+
}
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
watch: {
|
|
353
|
+
'column.name'(value) {
|
|
354
|
+
this.field = value;
|
|
355
|
+
},
|
|
356
|
+
'column.type'(value) {
|
|
357
|
+
if (this.opProp === undefined) {
|
|
358
|
+
this.op = value === 'text' ? 'cn' : 'eq';
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
op(value) {
|
|
362
|
+
if (this.isTodayOperator(value)) {
|
|
363
|
+
if (this.value1 === null || (this.value1 !== '+' && this.value1 !== '-')) {
|
|
364
|
+
this.value1 = '+';
|
|
365
|
+
}
|
|
366
|
+
if (this.value2 === null || (!Number.isInteger(this.value2) && !Number.isInteger(parseInt(this.value2)))) {
|
|
367
|
+
this.value2 = 0;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
value2(value) {
|
|
372
|
+
if (Array.isArray(this.data)) {
|
|
373
|
+
this.data[1] = value;
|
|
374
|
+
} else if (this.isTodayOperator(this.op)) {
|
|
375
|
+
this.data = this.value1 + value;
|
|
376
|
+
} else {
|
|
377
|
+
this.data = [];
|
|
378
|
+
this.data[1] = value;
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
value1(value) {
|
|
382
|
+
//para el caso de between o not between
|
|
383
|
+
if (this.op === 'bt' || this.op === 'nbt') {
|
|
384
|
+
if (Array.isArray(this.data)) {
|
|
385
|
+
this.data[0] = value;
|
|
386
|
+
} else {
|
|
387
|
+
this.data = [];
|
|
388
|
+
this.data[0] = value;
|
|
389
|
+
}
|
|
390
|
+
} else if (this.isTodayOperator(this.op)) {
|
|
391
|
+
this.data = value + this.value2;
|
|
392
|
+
} else {
|
|
393
|
+
this.data = value;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
created() {
|
|
398
|
+
this.translateFilterOperators();
|
|
399
|
+
this.addCommonAndDecimalAndDateFilterOperators();
|
|
400
|
+
if (this.fieldProp !== undefined && this.opProp !== undefined && this.dataProp !== undefined) {
|
|
401
|
+
this.columns.forEach((column) => {
|
|
402
|
+
if (column.name === this.fieldProp) {
|
|
403
|
+
this.column.name = column.name;
|
|
404
|
+
this.column.type = column.type;
|
|
405
|
+
this.column.title = column.title;
|
|
406
|
+
this.filterOperators[column.type].forEach((operatorsForType) => {
|
|
407
|
+
if (operatorsForType.value === this.opProp) {
|
|
408
|
+
this.op = operatorsForType.value;
|
|
409
|
+
// eslint-disable-next-line no-useless-return
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
// eslint-disable-next-line no-useless-return
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
if (this.opProp === 'in' || this.opProp === 'ni') {
|
|
418
|
+
this.value1 = Array.isArray(this.dataProp) === true ? this.dataProp.join(',') : this.dataProp;
|
|
419
|
+
} else if (Array.isArray(this.dataProp) === true) {
|
|
420
|
+
this.value1 = this.dataProp[0];
|
|
421
|
+
this.value2 = this.dataProp[1];
|
|
422
|
+
} else if (this.isTodayOperator(this.opProp)) {
|
|
423
|
+
this.value1 = this.dataProp.length > 1 ? this.dataProp.substring(0, 1) : '+';
|
|
424
|
+
this.value2 = this.dataProp.length > 1 ? this.dataProp.substring(1) : 0;
|
|
425
|
+
} else {
|
|
426
|
+
this.value1 = this.dataProp;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
methods: {
|
|
431
|
+
isTodayOperator(operator) {
|
|
432
|
+
return operator === 'eqt' || operator === 'net' || operator === 'ltt' || operator === 'gtt' || operator === 'let' || operator === 'get';
|
|
433
|
+
},
|
|
434
|
+
translateFilterOperators() {
|
|
435
|
+
for (const colType in this.filterOperators) {
|
|
436
|
+
for (let i = 0, length = this.filterOperators[colType].length; i < length; i++) {
|
|
437
|
+
this.filterOperators[colType][i].text = this.$t(this.filterOperators[colType][i].text);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
addCommonAndDecimalAndDateFilterOperators() {
|
|
442
|
+
const commonKey = 'common';
|
|
443
|
+
for (const colType in this.filterOperators) {
|
|
444
|
+
if (colType === commonKey) {
|
|
445
|
+
continue;
|
|
446
|
+
} else if (colType === 'decimal') {
|
|
447
|
+
this.filterOperators[colType] = this.filterOperators.numeric;
|
|
448
|
+
} else if (colType === 'date' || colType === 'datetime') {
|
|
449
|
+
this.filterOperators[colType] = this.filterOperators[colType].concat(this.filterOperators.numeric);
|
|
450
|
+
}
|
|
451
|
+
this.filterOperators[colType] = this.filterOperators[colType].concat(this.filterOperators[commonKey]);
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
onTodayOperatorValue2KeyDown(e) {
|
|
455
|
+
// prevent -, +, e
|
|
456
|
+
if (['-', '+', 'e'].includes(e.key)) {
|
|
457
|
+
e.preventDefault();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
</script>
|
|
463
|
+
|
|
464
|
+
<style lang="postcss" scoped>
|
|
465
|
+
.dragger2 {
|
|
466
|
+
height: 24px !important;
|
|
467
|
+
width: 20px !important;
|
|
468
|
+
min-width: 20px !important;
|
|
469
|
+
padding-left: 3px !important;
|
|
470
|
+
padding-right: 3px !important;
|
|
471
|
+
color: var(--N-100) !important;
|
|
472
|
+
cursor: move !important;
|
|
473
|
+
margin-left: 18px;
|
|
474
|
+
&:hover {
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
.PuiFilterRule {
|
|
478
|
+
height: 35px;
|
|
479
|
+
& .v-input__control {
|
|
480
|
+
min-height: 30px !important;
|
|
481
|
+
}
|
|
482
|
+
& .v-input__slot {
|
|
483
|
+
min-height: 30px !important;
|
|
484
|
+
height: 30px !important;
|
|
485
|
+
}
|
|
486
|
+
& .v-text-field.v-text-field--solo .v-input__control {
|
|
487
|
+
min-height: 32px !important;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
.inputFilter {
|
|
491
|
+
height: 36px !important;
|
|
492
|
+
&.v-input.v-text-field.v-text-field--single-line.v-text-field--solo .v-input__slot {
|
|
493
|
+
height: 36px !important;
|
|
494
|
+
}
|
|
495
|
+
& .v-input__slot {
|
|
496
|
+
min-height: 36px !important;
|
|
497
|
+
height: 36px !important;
|
|
498
|
+
}
|
|
499
|
+
&.v-text-field.v-text-field--solo .v-input__control {
|
|
500
|
+
min-height: 36px !important;
|
|
501
|
+
background-color: red;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
.inputFilterText {
|
|
505
|
+
height: 36px !important;
|
|
506
|
+
&.v-input.v-text-field.v-text-field--single-line.v-text-field--solo .v-input__slot {
|
|
507
|
+
height: 36px !important;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
.narrow-icon .v-input__icon {
|
|
511
|
+
width: 4px;
|
|
512
|
+
min-width: 4px;
|
|
513
|
+
}
|
|
514
|
+
.operator {
|
|
515
|
+
min-width: 102px;
|
|
516
|
+
}
|
|
517
|
+
</style>
|