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,92 +1,75 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
<v-container class="pa-2 mb-2 puiFilterGroup" @mouseover.stop="showGroupBtns = true" @mouseout="showGroupBtns = false">
|
|
3
|
+
<!-- Operador lógico para el grupo -->
|
|
4
|
+
<v-col xs="12" class="pa-0 mb-n2 d-flex">
|
|
5
|
+
<span class="pa-0 pt-2 pr-3">{{ $t('labelGroup') }}</span>
|
|
6
|
+
<v-select
|
|
7
|
+
v-model="filterGroupModel.groupOp"
|
|
8
|
+
class="pr-2"
|
|
9
|
+
style="max-width: 100px !important"
|
|
10
|
+
:items="groupOperators"
|
|
11
|
+
:label="$t('or')"
|
|
12
|
+
append-icon="fa fa-angle-down"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
solo
|
|
15
|
+
flat
|
|
16
|
+
hide-details
|
|
17
|
+
></v-select>
|
|
18
|
+
</v-col>
|
|
19
|
+
|
|
20
|
+
<!-- Selects reglas -->
|
|
21
|
+
<v-col cols="12" v-if="filterGroupModel.rules && filterGroupModel.rules.length > 0">
|
|
22
|
+
<v-row v-for="(rule, index) in filterGroupModel.rules" :key="index">
|
|
23
|
+
<v-col xs12 class="pt-2 pa-0 pl-0 pr-2 d-flex">
|
|
24
|
+
<pui-filter-rule
|
|
25
|
+
:ref="`rule${index}`"
|
|
26
|
+
:ruleIndexProp="index"
|
|
27
|
+
:groupName="groupName"
|
|
28
|
+
:columnsProp="columnsProp"
|
|
29
|
+
:filterColumnValues="filterColumnValues"
|
|
30
|
+
:filterRuleProp="rule"
|
|
26
31
|
:disabled="disabled"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
:columns="columns"
|
|
39
|
-
:fieldProp="rule.field"
|
|
40
|
-
:opProp="rule.op"
|
|
41
|
-
:dataProp="rule.data"
|
|
42
|
-
:group="groupName"
|
|
43
|
-
:ruleOperators="groupOperators"
|
|
44
|
-
:disabled="disabled"
|
|
45
|
-
></pui-filter-rule>
|
|
46
|
-
</v-flex>
|
|
47
|
-
<v-flex xs1 v-if="disabled === false">
|
|
48
|
-
<v-list-item>
|
|
49
|
-
<v-icon class="pointer" small @click.native="removeRule(i)">fa fa-trash-alt</v-icon>
|
|
50
|
-
</v-list-item>
|
|
51
|
-
</v-flex>
|
|
52
|
-
</v-layout>
|
|
53
|
-
</v-flex>
|
|
54
|
-
</v-layout>
|
|
55
|
-
<v-layout wrap v-if="groups.length > 0" class="full-width">
|
|
32
|
+
@change="onFilterRuleChanges(index)"
|
|
33
|
+
></pui-filter-rule>
|
|
34
|
+
<v-icon v-if="disabled === false" class="mt-2 ml-2 mr-n1" small v-ripple="false" @click="removeRule(index)"
|
|
35
|
+
>fa fa-trash-alt</v-icon
|
|
36
|
+
>
|
|
37
|
+
</v-col>
|
|
38
|
+
</v-row>
|
|
39
|
+
</v-col>
|
|
40
|
+
|
|
41
|
+
<!-- Filter group -->
|
|
42
|
+
<v-col cols="12" v-if="filterGroupModel.groups.length > 0" class="pa-0 pt-4">
|
|
56
43
|
<pui-filter-group
|
|
57
|
-
v-for="(group,
|
|
58
|
-
:
|
|
59
|
-
:
|
|
60
|
-
:
|
|
61
|
-
:
|
|
62
|
-
:
|
|
63
|
-
:groupsProp="groupsProp ? groupsProp[i].groups : undefined"
|
|
64
|
-
:ref="`group${i}`"
|
|
65
|
-
:key="i"
|
|
66
|
-
:disabled="disabled"
|
|
44
|
+
v-for="(group, index) in filterGroupModel.groups"
|
|
45
|
+
:ref="`group${index}`"
|
|
46
|
+
:groupIndexProp="index"
|
|
47
|
+
:filterGroupProp="group"
|
|
48
|
+
:columnsProp="columnsProp"
|
|
49
|
+
:filterColumnValues="filterColumnValues"
|
|
67
50
|
:showSubgroupBtn="showSubgroupBtn"
|
|
51
|
+
:disabled="disabled"
|
|
52
|
+
:key="index"
|
|
53
|
+
@change="onFilterGroupChanges(index)"
|
|
68
54
|
></pui-filter-group>
|
|
69
|
-
</v-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</v-flex>
|
|
88
|
-
</v-layout>
|
|
89
|
-
</v-layout>
|
|
55
|
+
</v-col>
|
|
56
|
+
|
|
57
|
+
<!-- Buttons acciones -->
|
|
58
|
+
<v-col cols="12" class="elevation-0" :class="isRootGroup && filterGroupModel.groups.length > 0 ? 'pa-0 pt-0' : 'pa-0 pt-3'">
|
|
59
|
+
<v-btn v-if="disabled === false" class="btnGroup btnAddRule elevation-0" @click="addRule">
|
|
60
|
+
<v-icon small>far fa-plus</v-icon>
|
|
61
|
+
<span>{{ $t('addRule') }}</span>
|
|
62
|
+
</v-btn>
|
|
63
|
+
<v-btn v-if="showSubgroupBtn && disabled === false" class="btnGroup btnAddGroup elevation-0 ml-1" @click="addSubGroup">
|
|
64
|
+
<v-icon small>fa fa-layer-group</v-icon>
|
|
65
|
+
<span>{{ $t('addSubGroup') }}</span>
|
|
66
|
+
</v-btn>
|
|
67
|
+
<v-btn v-if="!isRootGroup && disabled === false" class="btnGroup btnRemGroup elevation-0 ml-1" @click="removeGroup">
|
|
68
|
+
<v-icon small>fa fa-trash-alt</v-icon>
|
|
69
|
+
<span>{{ $t('removeGroup') }}</span>
|
|
70
|
+
</v-btn>
|
|
71
|
+
</v-col>
|
|
72
|
+
</v-container>
|
|
90
73
|
</template>
|
|
91
74
|
|
|
92
75
|
<script>
|
|
@@ -98,21 +81,24 @@ export default {
|
|
|
98
81
|
PuiFilterRule
|
|
99
82
|
},
|
|
100
83
|
props: {
|
|
101
|
-
|
|
102
|
-
type:
|
|
103
|
-
|
|
84
|
+
isRootGroup: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false
|
|
104
87
|
},
|
|
105
|
-
|
|
106
|
-
type:
|
|
88
|
+
groupIndexProp: {
|
|
89
|
+
type: Number,
|
|
90
|
+
default: 0
|
|
107
91
|
},
|
|
108
|
-
|
|
109
|
-
|
|
92
|
+
filterGroupProp: {
|
|
93
|
+
required: true
|
|
110
94
|
},
|
|
111
|
-
|
|
112
|
-
type:
|
|
95
|
+
columnsProp: {
|
|
96
|
+
type: Array,
|
|
97
|
+
required: true
|
|
113
98
|
},
|
|
114
|
-
|
|
115
|
-
type:
|
|
99
|
+
filterColumnValues: {
|
|
100
|
+
type: Object,
|
|
101
|
+
required: false,
|
|
116
102
|
},
|
|
117
103
|
disabled: {
|
|
118
104
|
type: Boolean,
|
|
@@ -124,9 +110,7 @@ export default {
|
|
|
124
110
|
},
|
|
125
111
|
data() {
|
|
126
112
|
return {
|
|
127
|
-
|
|
128
|
-
groups: [],
|
|
129
|
-
groupOp: 'or',
|
|
113
|
+
filterGroupModel: this.getDefaultFilterGroupModel(),
|
|
130
114
|
showDeleteRule: null,
|
|
131
115
|
showGroupBtns: null,
|
|
132
116
|
groupOperators: [
|
|
@@ -142,93 +126,111 @@ export default {
|
|
|
142
126
|
};
|
|
143
127
|
},
|
|
144
128
|
computed: {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
129
|
+
groupName() {
|
|
130
|
+
return this.isRootGroup ? this.groupIndexProp.toString() : this.$parent.groupName + '-' + this.groupIndexProp;
|
|
131
|
+
},
|
|
132
|
+
parentGroupName() {
|
|
133
|
+
return this.isRootGroup ? null : this.$parent.groupName;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
watch: {
|
|
137
|
+
filterGroupProp() {
|
|
138
|
+
if (this.filterGroupProp) {
|
|
139
|
+
this.filterGroupModel = this.filterGroupProp;
|
|
140
|
+
this.filterGroupModel.groupOp ? '':this.filterGroupModel.groupOp = 'and';
|
|
141
|
+
this.filterGroupModel.groups ? '':this.filterGroupModel.groups = [];
|
|
142
|
+
this.filterGroupModel.rules ? '':this.filterGroupModel.rules = [];
|
|
148
143
|
}
|
|
149
|
-
return false;
|
|
150
144
|
},
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
filterGroupModel: {
|
|
146
|
+
deep: true,
|
|
147
|
+
handler() {
|
|
148
|
+
this.$emit('change', this.filterGroupModel);
|
|
149
|
+
}
|
|
153
150
|
}
|
|
154
151
|
},
|
|
155
152
|
created() {
|
|
156
153
|
this.translateGroupOperators();
|
|
157
|
-
if (this.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
if (this.filterGroupProp) {
|
|
155
|
+
this.filterGroupModel = this.filterGroupProp;
|
|
156
|
+
this.filterGroupModel.groupOp ? '':this.filterGroupModel.groupOp = 'and';
|
|
157
|
+
this.filterGroupModel.groups ? '':this.filterGroupModel.groups = [];
|
|
158
|
+
this.filterGroupModel.rules ? '':this.filterGroupModel.rules = [];
|
|
159
|
+
}
|
|
162
160
|
},
|
|
163
161
|
mounted() {
|
|
164
162
|
this.$puiEvents.$on('reset-filtering', this.reset);
|
|
165
163
|
this.$puiEvents.$on(`groupRemoved-${this.groupName}`, this.onGroupRemoved);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
this.$puiEvents.$on(`subGroupAdded-${this.groupName}`, this.onSubGroupAdded);
|
|
165
|
+
|
|
166
|
+
if (this.filterGroupModel.rules.length === 0 && this.filterGroupModel.groups.length === 0) {
|
|
169
167
|
this.addRule();
|
|
170
168
|
}
|
|
171
169
|
},
|
|
172
170
|
destroyed() {
|
|
173
|
-
this.$puiEvents.$off('reset-filtering'
|
|
171
|
+
this.$puiEvents.$off('reset-filtering');
|
|
174
172
|
this.$puiEvents.$off(`groupRemoved-${this.groupName}`);
|
|
173
|
+
this.$puiEvents.$off(`subGroupAdded-${this.groupName}`);
|
|
175
174
|
},
|
|
176
175
|
methods: {
|
|
176
|
+
getUniqueIndex() {
|
|
177
|
+
let numberSTR = Math.random().toString().replace('.', Math.random().toString().replace('.', '').substring(0, 10)).substring(0, 20);
|
|
178
|
+
let numberInt = parseInt(numberSTR).toFixed();
|
|
179
|
+
let integer = parseInt(numberInt);
|
|
180
|
+
return integer;
|
|
181
|
+
},
|
|
177
182
|
translateGroupOperators() {
|
|
178
183
|
for (let i = 0, length = this.groupOperators.length; i < length; i++) {
|
|
179
184
|
this.groupOperators[i].text = this.$t(this.groupOperators[i].text);
|
|
180
185
|
}
|
|
181
186
|
},
|
|
182
187
|
reset() {
|
|
183
|
-
this.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
delete this.$refs[ruleOrGroup];
|
|
188
|
+
if(this.isRootGroup) {
|
|
189
|
+
this.filterGroupModel = this.getDefaultFilterGroupModel();
|
|
190
|
+
this.addRule();
|
|
187
191
|
}
|
|
192
|
+
|
|
188
193
|
},
|
|
189
|
-
|
|
190
|
-
this.
|
|
194
|
+
onGroupRemoved(index) {
|
|
195
|
+
//alert('soy el grupo ' + this.groupName + ` recibo el evento en el grupo ${this.groupName} con el indice ${index}`);
|
|
196
|
+
this.filterGroupModel.groups.splice(index, 1);
|
|
191
197
|
},
|
|
192
|
-
|
|
193
|
-
this.groups
|
|
198
|
+
onFilterGroupChanges(index) {
|
|
199
|
+
this.filterGroupModel.groups[index] = this.$refs[`group${index}`][0].filterGroupModel;
|
|
194
200
|
},
|
|
195
|
-
|
|
196
|
-
this.rules.
|
|
197
|
-
delete this.$refs[`rule${i}`];
|
|
201
|
+
onFilterRuleChanges(index) {
|
|
202
|
+
this.filterGroupModel.rules[index] = this.$refs[`rule${index}`][0].filterRuleModel;
|
|
198
203
|
},
|
|
199
|
-
|
|
200
|
-
this.groups.
|
|
201
|
-
|
|
202
|
-
if (this.isGroup0 && this.groupsProp) {
|
|
203
|
-
this.groups = this.groupsProp;
|
|
204
|
-
}
|
|
204
|
+
addSubGroup() {
|
|
205
|
+
this.filterGroupModel.groups.push(this.getDefaultFilterGroupModel());
|
|
206
|
+
this.filterGroupModel.groups.at(-1).rules.push(PuiFilterRule.methods.getDefaultFilterRuleModel());
|
|
205
207
|
},
|
|
206
208
|
removeGroup() {
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
// alert('soy el grupo ' + this.groupName + ` mando el evento al grupo ${this.parentGroupName} con el indice ${this.groupIndexProp}`);
|
|
210
|
+
if (!this.isRootGroup) {
|
|
211
|
+
this.$puiEvents.$emit(`groupRemoved-${this.parentGroupName}`, this.groupIndexProp);
|
|
212
|
+
} else {
|
|
213
|
+
this.groupFilterModel.groups = [];
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
addRule() {
|
|
217
|
+
this.filterGroupModel.rules.push(PuiFilterRule.methods.getDefaultFilterRuleModel());
|
|
218
|
+
},
|
|
219
|
+
removeRule(index) {
|
|
220
|
+
this.filterGroupModel.rules.splice(index, 1);
|
|
221
|
+
},
|
|
222
|
+
getDefaultFilterGroupModel() {
|
|
223
|
+
return {
|
|
224
|
+
rules: [],
|
|
225
|
+
groups: [],
|
|
226
|
+
groupOp: 'and',
|
|
227
|
+
}
|
|
215
228
|
}
|
|
216
229
|
}
|
|
217
230
|
};
|
|
218
231
|
</script>
|
|
219
232
|
|
|
220
233
|
<style lang="postcss" scoped>
|
|
221
|
-
.dragger {
|
|
222
|
-
height: 24px !important;
|
|
223
|
-
width: 20px !important;
|
|
224
|
-
min-width: 20px !important;
|
|
225
|
-
padding-left: 3px !important;
|
|
226
|
-
padding-right: 3px !important;
|
|
227
|
-
color: var(--N-100) !important;
|
|
228
|
-
cursor: move !important;
|
|
229
|
-
&:hover {
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
234
|
.btnGroup {
|
|
233
235
|
height: 28px !important;
|
|
234
236
|
color: var(--N-500);
|
|
@@ -237,51 +239,49 @@ export default {
|
|
|
237
239
|
}
|
|
238
240
|
}
|
|
239
241
|
.puiFilterGroup {
|
|
240
|
-
background-color: var(--N-
|
|
242
|
+
background-color: var(--N-0);
|
|
243
|
+
border-color: var(--N-100);
|
|
244
|
+
border-style: solid;
|
|
241
245
|
border-radius: 5px;
|
|
246
|
+
border-width: 1px;
|
|
247
|
+
|
|
242
248
|
&__groupOperator {
|
|
243
249
|
height: 50px;
|
|
244
250
|
}
|
|
245
251
|
&__bottombar {
|
|
246
|
-
}
|
|
247
|
-
& .bottomtoolbar {
|
|
248
252
|
background-color: transparent !important;
|
|
249
253
|
}
|
|
250
254
|
& .puiFilterGroup {
|
|
251
|
-
background-color: var(--N-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
border-width: 1px;
|
|
255
|
-
border-style: solid;
|
|
256
|
-
border-color: var(--N-100);
|
|
257
|
-
& .v-toolbar,
|
|
258
|
-
.v-btn {
|
|
259
|
-
background-color: var(--N-0);
|
|
255
|
+
background-color: var(--N-10);
|
|
256
|
+
& .v-btn {
|
|
257
|
+
background-color: var(--N-10);
|
|
260
258
|
}
|
|
261
|
-
|
|
262
259
|
& .puiFilterGroup {
|
|
263
|
-
background-color: var(--N-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
& .v-toolbar,
|
|
267
|
-
.v-btn {
|
|
268
|
-
background-color: var(--N-10);
|
|
260
|
+
background-color: var(--N-0);
|
|
261
|
+
& .v-btn {
|
|
262
|
+
background-color: var(--N-0);
|
|
269
263
|
}
|
|
270
264
|
& .puiFilterGroup {
|
|
271
|
-
background-color: var(--N-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
& .v-toolbar,
|
|
275
|
-
.v-btn {
|
|
276
|
-
background-color: var(--N-0);
|
|
265
|
+
background-color: var(--N-10);
|
|
266
|
+
& .v-btn {
|
|
267
|
+
background-color: var(--N-10);
|
|
277
268
|
}
|
|
278
269
|
& .puiFilterGroup {
|
|
279
|
-
background-color: var(--N-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
.
|
|
270
|
+
background-color: var(--N-0);
|
|
271
|
+
& .v-btn {
|
|
272
|
+
background-color: var(--N-0);
|
|
273
|
+
}
|
|
274
|
+
& .puiFilterGroup {
|
|
284
275
|
background-color: var(--N-10);
|
|
276
|
+
& .v-btn {
|
|
277
|
+
background-color: var(--N-10);
|
|
278
|
+
}
|
|
279
|
+
& .puiFilterGroup {
|
|
280
|
+
background-color: var(--N-0);
|
|
281
|
+
& .v-btn {
|
|
282
|
+
background-color: var(--N-0);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|