pui9-docgen 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 +20 -0
- package/dist/demo.html +10 -0
- package/dist/pui9-docgen.common.js +9533 -0
- package/dist/pui9-docgen.common.js.map +1 -0
- package/dist/pui9-docgen.css +1 -0
- package/dist/pui9-docgen.umd.js +9543 -0
- package/dist/pui9-docgen.umd.js.map +1 -0
- package/dist/pui9-docgen.umd.min.js +2 -0
- package/dist/pui9-docgen.umd.min.js.map +1 -0
- package/package-lock.json +15631 -0
- package/package.json +59 -0
- package/src/components/puidocgen/PuiDocgenTemplateActions.js +102 -0
- package/src/components/puidocgen/PuiDocgenTemplateFilter.vue +113 -0
- package/src/components/puidocgen/PuiDocgenTemplateFilterGroup.vue +291 -0
- package/src/components/puidocgen/PuiDocgenTemplateFilterRule.vue +352 -0
- package/src/components/puidocgen/PuiDocgenTemplateForm.vue +517 -0
- package/src/components/puidocgen/PuiDocgenTemplateGrid.vue +23 -0
- package/src/components/puidocgen/PuiDocgenTemplateMapping.vue +235 -0
- package/src/components/puidocgen/PuiDocgenTemplateMixin.vue +159 -0
- package/src/components/puidocgen/PuiDocgenTemplateModals.vue +112 -0
- package/src/components/puidocgen/PuiDocgenTemplateParameter.vue +104 -0
- package/src/index.js +15 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-layout wrap class="PuiDocgenTemplateFilterRule pl-3">
|
|
3
|
+
<v-flex xs4>
|
|
4
|
+
<v-autocomplete
|
|
5
|
+
class="pr-2"
|
|
6
|
+
label="column"
|
|
7
|
+
append-icon="fa fa-angle-down"
|
|
8
|
+
solo
|
|
9
|
+
flat
|
|
10
|
+
required
|
|
11
|
+
:rules="getRules()"
|
|
12
|
+
:items="columns"
|
|
13
|
+
item-text="title"
|
|
14
|
+
item-value="name"
|
|
15
|
+
return-object
|
|
16
|
+
v-model="column"
|
|
17
|
+
:disabled="disabled"
|
|
18
|
+
></v-autocomplete>
|
|
19
|
+
</v-flex>
|
|
20
|
+
<v-flex xs4 class="operator">
|
|
21
|
+
<v-select
|
|
22
|
+
class="pr-2"
|
|
23
|
+
append-icon="fa fa-angle-down"
|
|
24
|
+
solo
|
|
25
|
+
flat
|
|
26
|
+
required
|
|
27
|
+
:rules="getRules()"
|
|
28
|
+
:items="operators"
|
|
29
|
+
:label="$t('equal')"
|
|
30
|
+
v-model="op"
|
|
31
|
+
:disabled="disabled"
|
|
32
|
+
></v-select>
|
|
33
|
+
</v-flex>
|
|
34
|
+
<!-- Caso de que operador es between o not between, dos inputs, depende del tipo: fecha o numero-->
|
|
35
|
+
<v-flex xs4 v-if="op === 'bt' || op === 'nbt'">
|
|
36
|
+
<v-layout>
|
|
37
|
+
<v-flex xs6>
|
|
38
|
+
<v-text-field
|
|
39
|
+
v-if="column.type !== 'date'"
|
|
40
|
+
class="inputFilterText"
|
|
41
|
+
type="number"
|
|
42
|
+
solo
|
|
43
|
+
flat
|
|
44
|
+
outlined
|
|
45
|
+
required
|
|
46
|
+
:rules="getRules()"
|
|
47
|
+
v-model="value1"
|
|
48
|
+
:disabled="disabled"
|
|
49
|
+
></v-text-field>
|
|
50
|
+
<v-text-field
|
|
51
|
+
v-else
|
|
52
|
+
class="inputFilterText"
|
|
53
|
+
type="date"
|
|
54
|
+
solo
|
|
55
|
+
flat
|
|
56
|
+
outlined
|
|
57
|
+
required
|
|
58
|
+
:rules="getRules()"
|
|
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
|
+
:rules="getRules()"
|
|
73
|
+
v-model="value2"
|
|
74
|
+
:disabled="disabled"
|
|
75
|
+
></v-text-field>
|
|
76
|
+
<v-text-field
|
|
77
|
+
v-else
|
|
78
|
+
class="inputFilterText"
|
|
79
|
+
type="date"
|
|
80
|
+
solo
|
|
81
|
+
flat
|
|
82
|
+
outlined
|
|
83
|
+
required
|
|
84
|
+
:rules="getRules()"
|
|
85
|
+
v-model="value2"
|
|
86
|
+
:disabled="disabled"
|
|
87
|
+
></v-text-field>
|
|
88
|
+
</v-flex>
|
|
89
|
+
</v-layout>
|
|
90
|
+
</v-flex>
|
|
91
|
+
<!-- Caso que sean fechas comparadas con HOY +- X dias, un solo input de tipo numero -->
|
|
92
|
+
<v-flex xs4 v-else-if="isTodayOperator(op)">
|
|
93
|
+
<v-layout>
|
|
94
|
+
<v-flex xs5>
|
|
95
|
+
<v-select
|
|
96
|
+
class="pr-2"
|
|
97
|
+
append-icon="fa fa-angle-down"
|
|
98
|
+
solo
|
|
99
|
+
flat
|
|
100
|
+
required
|
|
101
|
+
:rules="getRules()"
|
|
102
|
+
:items="todayOperators"
|
|
103
|
+
:label="$t('equal')"
|
|
104
|
+
v-model="value1"
|
|
105
|
+
:disabled="disabled"
|
|
106
|
+
></v-select>
|
|
107
|
+
</v-flex>
|
|
108
|
+
<v-flex xs7>
|
|
109
|
+
<v-text-field class="inputFilter" type="number" solo flat outlined required v-model="value2"></v-text-field>
|
|
110
|
+
</v-flex>
|
|
111
|
+
</v-layout>
|
|
112
|
+
</v-flex>
|
|
113
|
+
<!-- Caso que sea el operador 'in' o 'not in', solo input de tipo texto -->
|
|
114
|
+
<v-flex xs4 v-else-if="op === 'in' || op === 'ni'">
|
|
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>
|
|
119
|
+
<v-text-field
|
|
120
|
+
v-if="column.type === 'date' || column.type === 'datetime'"
|
|
121
|
+
class="inputFilter"
|
|
122
|
+
type="date"
|
|
123
|
+
solo
|
|
124
|
+
flat
|
|
125
|
+
outlined
|
|
126
|
+
required
|
|
127
|
+
:rules="getRules()"
|
|
128
|
+
:disabled="op === 'nu' || op === 'nn' || disabled"
|
|
129
|
+
v-model="value1"
|
|
130
|
+
></v-text-field>
|
|
131
|
+
<v-text-field
|
|
132
|
+
v-else-if="column.type === 'numeric' || column.type === 'decimal'"
|
|
133
|
+
class="inputFilter"
|
|
134
|
+
type="number"
|
|
135
|
+
solo
|
|
136
|
+
flat
|
|
137
|
+
outlined
|
|
138
|
+
required
|
|
139
|
+
:rules="getRules()"
|
|
140
|
+
:disabled="op === 'nu' || op === 'nn' || disabled"
|
|
141
|
+
v-model="value1"
|
|
142
|
+
></v-text-field>
|
|
143
|
+
<v-text-field
|
|
144
|
+
v-else
|
|
145
|
+
class="inputFilter"
|
|
146
|
+
type="text"
|
|
147
|
+
solo
|
|
148
|
+
flat
|
|
149
|
+
outlined
|
|
150
|
+
required
|
|
151
|
+
:rules="getRules()"
|
|
152
|
+
:disabled="op === 'nu' || op === 'nn' || disabled"
|
|
153
|
+
v-model="value1"
|
|
154
|
+
></v-text-field>
|
|
155
|
+
</v-flex>
|
|
156
|
+
</v-layout>
|
|
157
|
+
</template>
|
|
158
|
+
|
|
159
|
+
<script>
|
|
160
|
+
import PuiDocgenTemplateMixin from './PuiDocgenTemplateMixin';
|
|
161
|
+
|
|
162
|
+
export default {
|
|
163
|
+
name: 'PuiDocgenTemplateFilterRule',
|
|
164
|
+
mixins: [PuiDocgenTemplateMixin],
|
|
165
|
+
props: {
|
|
166
|
+
group: {
|
|
167
|
+
type: String
|
|
168
|
+
},
|
|
169
|
+
ruleIndex: {
|
|
170
|
+
type: Number
|
|
171
|
+
},
|
|
172
|
+
fieldProp: {
|
|
173
|
+
type: String
|
|
174
|
+
},
|
|
175
|
+
opProp: {
|
|
176
|
+
type: String
|
|
177
|
+
},
|
|
178
|
+
dataProp: {},
|
|
179
|
+
disabled: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: false
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
data() {
|
|
185
|
+
return {
|
|
186
|
+
op: 'eq',
|
|
187
|
+
column: {
|
|
188
|
+
type: '',
|
|
189
|
+
name: '',
|
|
190
|
+
title: ''
|
|
191
|
+
},
|
|
192
|
+
value1: null,
|
|
193
|
+
value2: null,
|
|
194
|
+
field: null,
|
|
195
|
+
data: null,
|
|
196
|
+
todayOperators: [
|
|
197
|
+
{ text: '+', value: '+' },
|
|
198
|
+
{ text: '-', value: '-' }
|
|
199
|
+
]
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
computed: {
|
|
203
|
+
isRule0() {
|
|
204
|
+
return this.ruleIndex === 0;
|
|
205
|
+
},
|
|
206
|
+
operators() {
|
|
207
|
+
let filterOperatorsSorted = this.filterOperators[this.column.type];
|
|
208
|
+
if (filterOperatorsSorted && Array.isArray(filterOperatorsSorted)) {
|
|
209
|
+
if (this.column.type === 'date' || this.column.type === 'datetime') {
|
|
210
|
+
filterOperatorsSorted = filterOperatorsSorted.filter(
|
|
211
|
+
(obj) => obj.value !== 'bt' && obj.value !== 'nbt' && obj.value !== 'in' && obj.value !== 'ni'
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
filterOperatorsSorted.sort((a, b) => (a.text > b.text ? 1 : b.text > a.text ? -1 : 0));
|
|
215
|
+
return filterOperatorsSorted;
|
|
216
|
+
}
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
watch: {
|
|
221
|
+
'column.name'(value) {
|
|
222
|
+
this.field = value;
|
|
223
|
+
},
|
|
224
|
+
'column.type'(value) {
|
|
225
|
+
if (this.opProp === undefined) {
|
|
226
|
+
this.op = value === 'text' ? 'cn' : 'eq';
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
op(value) {
|
|
230
|
+
if (this.isTodayOperator(value) && this.value1 === null && this.value2 === null) {
|
|
231
|
+
this.value1 = '+';
|
|
232
|
+
this.value2 = 0;
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
value2(value) {
|
|
236
|
+
if (Array.isArray(this.data)) {
|
|
237
|
+
this.data[1] = value;
|
|
238
|
+
} else if (this.isTodayOperator(this.op)) {
|
|
239
|
+
this.data = this.value1 + value;
|
|
240
|
+
} else {
|
|
241
|
+
this.data = [];
|
|
242
|
+
this.data[1] = value;
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
value1(value) {
|
|
246
|
+
//para el caso de between o not between
|
|
247
|
+
if (this.op === 'bt' || this.op === 'nbt') {
|
|
248
|
+
if (Array.isArray(this.data)) {
|
|
249
|
+
this.data[0] = value;
|
|
250
|
+
} else {
|
|
251
|
+
this.data = [];
|
|
252
|
+
this.data[0] = value;
|
|
253
|
+
}
|
|
254
|
+
} else if (this.isTodayOperator(this.op)) {
|
|
255
|
+
this.data = value + this.value2;
|
|
256
|
+
} else {
|
|
257
|
+
this.data = value;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
created() {
|
|
262
|
+
if (this.fieldProp !== undefined && this.opProp !== undefined && this.dataProp !== undefined) {
|
|
263
|
+
this.columns.forEach((column) => {
|
|
264
|
+
if (column.name === this.fieldProp) {
|
|
265
|
+
this.column.name = column.name;
|
|
266
|
+
this.column.type = column.type;
|
|
267
|
+
this.column.title = column.title;
|
|
268
|
+
this.filterOperators[column.type].forEach((operatorsForType) => {
|
|
269
|
+
if (operatorsForType.value === this.opProp) {
|
|
270
|
+
this.op = operatorsForType.value;
|
|
271
|
+
// eslint-disable-next-line no-useless-return
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
// eslint-disable-next-line no-useless-return
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
if (this.opProp === 'in' || this.opProp === 'ni') {
|
|
280
|
+
this.value1 = Array.isArray(this.dataProp) === true ? this.dataProp.join(',') : this.dataProp;
|
|
281
|
+
} else if (Array.isArray(this.dataProp) === true) {
|
|
282
|
+
this.value1 = this.dataProp[0];
|
|
283
|
+
this.value2 = this.dataProp[1];
|
|
284
|
+
} else if (this.isTodayOperator(this.opProp)) {
|
|
285
|
+
this.value1 = this.dataProp.length > 1 ? this.dataProp.substring(0, 1) : '+';
|
|
286
|
+
this.value2 = this.dataProp.length > 1 ? this.dataProp.substring(1) : 0;
|
|
287
|
+
} else {
|
|
288
|
+
this.value1 = this.dataProp;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
methods: {
|
|
293
|
+
isTodayOperator(operator) {
|
|
294
|
+
return operator === 'eqt' || operator === 'net' || operator === 'ltt' || operator === 'gtt' || operator === 'let' || operator === 'get';
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
</script>
|
|
299
|
+
<style lang="postcss" scoped>
|
|
300
|
+
.dragger2 {
|
|
301
|
+
height: 24px !important;
|
|
302
|
+
width: 20px !important;
|
|
303
|
+
min-width: 20px !important;
|
|
304
|
+
padding-left: 3px !important;
|
|
305
|
+
padding-right: 3px !important;
|
|
306
|
+
color: var(--N-100) !important;
|
|
307
|
+
cursor: move !important;
|
|
308
|
+
margin-left: 18px;
|
|
309
|
+
&:hover {
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
.PuiDocgenTemplateFilterRule {
|
|
313
|
+
height: 35px;
|
|
314
|
+
& .v-input__control {
|
|
315
|
+
min-height: 30px !important;
|
|
316
|
+
}
|
|
317
|
+
& .v-input__slot {
|
|
318
|
+
min-height: 30px !important;
|
|
319
|
+
height: 30px !important;
|
|
320
|
+
}
|
|
321
|
+
& .v-text-field.v-text-field--solo .v-input__control {
|
|
322
|
+
min-height: 32px !important;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
.inputFilter {
|
|
326
|
+
height: 36px !important;
|
|
327
|
+
&.v-input.v-text-field.v-text-field--single-line.v-text-field--solo .v-input__slot {
|
|
328
|
+
height: 36px !important;
|
|
329
|
+
}
|
|
330
|
+
& .v-input__slot {
|
|
331
|
+
min-height: 36px !important;
|
|
332
|
+
height: 36px !important;
|
|
333
|
+
}
|
|
334
|
+
&.v-text-field.v-text-field--solo .v-input__control {
|
|
335
|
+
min-height: 36px !important;
|
|
336
|
+
background-color: red;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
.inputFilterText {
|
|
340
|
+
height: 36px !important;
|
|
341
|
+
&.v-input.v-text-field.v-text-field--single-line.v-text-field--solo .v-input__slot {
|
|
342
|
+
height: 36px !important;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
.narrow-icon .v-input__icon {
|
|
346
|
+
width: 4px;
|
|
347
|
+
min-width: 4px;
|
|
348
|
+
}
|
|
349
|
+
.operator {
|
|
350
|
+
min-width: 102px;
|
|
351
|
+
}
|
|
352
|
+
</style>
|