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
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pui9-docgen",
|
|
3
|
+
"description": "PUI9 Documents Generation Component",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Prodevelop S.L."
|
|
6
|
+
},
|
|
7
|
+
"version": "1.16.4",
|
|
8
|
+
"license": "Copyright",
|
|
9
|
+
"main": "dist/pui9-docgen.common.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"serve": "vue-cli-service serve",
|
|
12
|
+
"build-bundle": "vue-cli-service build --target lib --name pui9-docgen ./src/index.js",
|
|
13
|
+
"prepare": "npm run build-bundle",
|
|
14
|
+
"lint": "vue-cli-service lint"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@vue/cli-plugin-babel": "4.5.13",
|
|
18
|
+
"@vue/cli-plugin-eslint": "4.5.13",
|
|
19
|
+
"@vue/cli-service": "4.5.13",
|
|
20
|
+
"autoprefixer": "9.8.6",
|
|
21
|
+
"babel-eslint": "10.1.0",
|
|
22
|
+
"core-js": "3.17.2",
|
|
23
|
+
"css-loader": "0.28.11",
|
|
24
|
+
"eslint": "6.8.0",
|
|
25
|
+
"eslint-plugin-vue": "6.2.2",
|
|
26
|
+
"postcss-css-variables": "0.18.0",
|
|
27
|
+
"postcss-import": "12.0.1",
|
|
28
|
+
"postcss-loader": "4.1.0",
|
|
29
|
+
"postcss-nested": "4.2.3",
|
|
30
|
+
"postcss-url": "8.0.0",
|
|
31
|
+
"stylus": "0.54.8",
|
|
32
|
+
"stylus-loader": "3.0.2",
|
|
33
|
+
"vue": "2.6.14",
|
|
34
|
+
"vue-template-compiler": "2.6.14"
|
|
35
|
+
},
|
|
36
|
+
"eslintConfig": {
|
|
37
|
+
"root": true,
|
|
38
|
+
"env": {
|
|
39
|
+
"node": true
|
|
40
|
+
},
|
|
41
|
+
"extends": [
|
|
42
|
+
"plugin:vue/essential",
|
|
43
|
+
"eslint:recommended"
|
|
44
|
+
],
|
|
45
|
+
"parserOptions": {
|
|
46
|
+
"parser": "babel-eslint"
|
|
47
|
+
},
|
|
48
|
+
"rules": {}
|
|
49
|
+
},
|
|
50
|
+
"browserslist": [
|
|
51
|
+
"> 1%",
|
|
52
|
+
"last 2 versions"
|
|
53
|
+
],
|
|
54
|
+
"files": [
|
|
55
|
+
"dist/*",
|
|
56
|
+
"src/*",
|
|
57
|
+
"*.json"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
let selectedRegistry = null;
|
|
2
|
+
|
|
3
|
+
const generateAction = {
|
|
4
|
+
id: 'generateAction',
|
|
5
|
+
selectionType: 'single',
|
|
6
|
+
label: 'puiaction.docgen.generate',
|
|
7
|
+
functionality: 'GEN_PUI_DOCGEN',
|
|
8
|
+
checkAvailability: function () {
|
|
9
|
+
return true;
|
|
10
|
+
},
|
|
11
|
+
runAction: function (action, model, registries) {
|
|
12
|
+
selectedRegistry = registries[0];
|
|
13
|
+
|
|
14
|
+
const data = { isAction: true, model: model, registry: selectedRegistry };
|
|
15
|
+
this.$puiEvents.$emit(`pui-modalDialogForm-puiDocgenTemplateParameters-${model.name}-show`, data);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const downloadTemplateAction = {
|
|
20
|
+
id: 'downloadTemplateAction',
|
|
21
|
+
selectionType: 'single',
|
|
22
|
+
label: 'puiaction.docgen.downloadtemplate',
|
|
23
|
+
functionality: 'WRITE_PUI_DOCGEN',
|
|
24
|
+
checkAvailability: function () {
|
|
25
|
+
return true;
|
|
26
|
+
},
|
|
27
|
+
runAction: function (action, model, registries) {
|
|
28
|
+
selectedRegistry = registries[0];
|
|
29
|
+
const title = this.$puiI18n.t('puiaction.notifyTitle') + ' > ' + this.$puiI18n.t(action.label);
|
|
30
|
+
|
|
31
|
+
this.$puiRequests.downloadFileRequest(
|
|
32
|
+
'get',
|
|
33
|
+
model.url.downloadTemplate,
|
|
34
|
+
{ id: selectedRegistry.id },
|
|
35
|
+
(response) => {
|
|
36
|
+
const link = document.createElement('a');
|
|
37
|
+
link.href = window.URL.createObjectURL(new window.Blob([response.data]));
|
|
38
|
+
link.download = selectedRegistry.filename;
|
|
39
|
+
link.click();
|
|
40
|
+
|
|
41
|
+
this.$puiEvents.$emit(`onPui-action-running-ended-${model.name}`);
|
|
42
|
+
selectedRegistry = null;
|
|
43
|
+
},
|
|
44
|
+
() => {
|
|
45
|
+
this.$puiEvents.$emit(`onPui-action-running-ended-${model.name}`);
|
|
46
|
+
const message = this.$puiI18n.t('puiaction.notifyError');
|
|
47
|
+
this.$puiNotify.error(message, title);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const downloadSampleTemplateAction = {
|
|
54
|
+
id: 'downloadSampleTemplateAction',
|
|
55
|
+
selectionType: 'general',
|
|
56
|
+
label: 'puiaction.docgen.downloadsampletemplate',
|
|
57
|
+
functionality: 'WRITE_PUI_DOCGEN',
|
|
58
|
+
checkAvailability: function () {
|
|
59
|
+
return true;
|
|
60
|
+
},
|
|
61
|
+
runAction: function (action, model) {
|
|
62
|
+
const title = this.$puiI18n.t('puiaction.notifyTitle') + ' > ' + this.$puiI18n.t(action.label);
|
|
63
|
+
|
|
64
|
+
this.$puiRequests.downloadFileRequest(
|
|
65
|
+
'get',
|
|
66
|
+
model.url.downloadSampleTemplate,
|
|
67
|
+
null,
|
|
68
|
+
(response) => {
|
|
69
|
+
const link = document.createElement('a');
|
|
70
|
+
link.href = window.URL.createObjectURL(new window.Blob([response.data]));
|
|
71
|
+
link.download = this.$puiUtils.getFilenameFromHeaders(response.headers);
|
|
72
|
+
link.click();
|
|
73
|
+
|
|
74
|
+
this.$puiEvents.$emit(`onPui-action-running-ended-${model.name}`);
|
|
75
|
+
},
|
|
76
|
+
() => {
|
|
77
|
+
this.$puiEvents.$emit(`onPui-action-running-ended-${model.name}`);
|
|
78
|
+
const message = this.$puiI18n.t('puiaction.notifyError');
|
|
79
|
+
this.$puiNotify.error(message, title);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const uploadNewTemplateAction = {
|
|
86
|
+
id: 'uploadNewTemplateAction',
|
|
87
|
+
selectionType: 'single',
|
|
88
|
+
label: 'puiaction.docgen.uploadnewtemplate',
|
|
89
|
+
functionality: 'WRITE_PUI_DOCGEN',
|
|
90
|
+
checkAvailability: function () {
|
|
91
|
+
return true;
|
|
92
|
+
},
|
|
93
|
+
runAction: function (action, model, registries) {
|
|
94
|
+
selectedRegistry = registries[0];
|
|
95
|
+
selectedRegistry.isAction = true;
|
|
96
|
+
this.$puiEvents.$emit('pui-modalDialogForm-uploadNewTemplate-' + model.name + '-show', selectedRegistry);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
actions: [generateAction, downloadTemplateAction, downloadSampleTemplateAction, uploadNewTemplateAction]
|
|
102
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<pui-field-set :title="title">
|
|
3
|
+
<h4 class="puidocgentemplate-subtitle">{{ subtitle }}</h4>
|
|
4
|
+
<pui-docgen-template-filter-group
|
|
5
|
+
v-if="columns.length > 0"
|
|
6
|
+
:ref="'group0'"
|
|
7
|
+
:columns="columns"
|
|
8
|
+
:groupName="'0'"
|
|
9
|
+
:rulesProp="filter ? filter.rules : undefined"
|
|
10
|
+
:groupOpProp="filter ? filter.groupOp : undefined"
|
|
11
|
+
:groupsProp="filter ? filter.groups : undefined"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:showSubgroupBtn="showSubgroupBtn"
|
|
14
|
+
></pui-docgen-template-filter-group>
|
|
15
|
+
</pui-field-set>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import PuiDocgenTemplateFilterGroup from './PuiDocgenTemplateFilterGroup';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: 'PuiDocgenTemplateFilter',
|
|
23
|
+
components: {
|
|
24
|
+
PuiDocgenTemplateFilterGroup
|
|
25
|
+
},
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
showSubgroupBtn: true
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
title: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
subtitle: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
filter: {
|
|
41
|
+
type: Object,
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
columns: {
|
|
45
|
+
type: Array,
|
|
46
|
+
required: true
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
retrieveGroupsData() {
|
|
55
|
+
//
|
|
56
|
+
const isRule = function (name) {
|
|
57
|
+
return name.startsWith('rule');
|
|
58
|
+
};
|
|
59
|
+
let validFilter = true;
|
|
60
|
+
let almenosUnaRegla = false;
|
|
61
|
+
//funcion recursiva que recorre los subgrupos hasta el final mientras queden
|
|
62
|
+
const processGroup = (groupComponent, groupFilterObject) => {
|
|
63
|
+
for (var ruleOrGroup in groupComponent.$refs) {
|
|
64
|
+
if (isRule(ruleOrGroup) === true) {
|
|
65
|
+
almenosUnaRegla = true;
|
|
66
|
+
const ruleComponent = groupComponent.$refs[ruleOrGroup][0];
|
|
67
|
+
const rule = {
|
|
68
|
+
field: ruleComponent.field,
|
|
69
|
+
op: ruleComponent.op,
|
|
70
|
+
data: ruleComponent.data
|
|
71
|
+
};
|
|
72
|
+
if (!rule.field || !rule.op || (!rule.data && rule.op !== 'nn' && rule.op !== 'nu')) {
|
|
73
|
+
!this.destroying && this.$puiNotify.warning(this.$t('not-valid-rule-error'));
|
|
74
|
+
validFilter = false;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (rule.op === 'in' || rule.op === 'ni') {
|
|
78
|
+
rule.data = rule.data.split(',');
|
|
79
|
+
}
|
|
80
|
+
groupFilterObject.rules.push(rule);
|
|
81
|
+
} else {
|
|
82
|
+
//isGroup
|
|
83
|
+
const subgroupComponent = groupComponent.$refs[ruleOrGroup][0];
|
|
84
|
+
if (subgroupComponent instanceof Object) {
|
|
85
|
+
const group = {
|
|
86
|
+
groupOp: subgroupComponent.groupOp,
|
|
87
|
+
rules: [],
|
|
88
|
+
groups: []
|
|
89
|
+
};
|
|
90
|
+
groupFilterObject.groups.push(group);
|
|
91
|
+
processGroup(subgroupComponent, group);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const internalFilter = {
|
|
98
|
+
rules: [],
|
|
99
|
+
groups: [],
|
|
100
|
+
groupOp: this.$refs.group0.groupOp
|
|
101
|
+
};
|
|
102
|
+
//empezamos por el grupo 0
|
|
103
|
+
processGroup(this.$refs.group0, internalFilter);
|
|
104
|
+
if (almenosUnaRegla === false) {
|
|
105
|
+
return { groupOp: 'and', groups: [], rules: [] };
|
|
106
|
+
} else if (validFilter === true) {
|
|
107
|
+
return internalFilter;
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
</script>
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-layout wrap class="pb-1 pt-1 mb-1 puiDocgenTemplateFilterGroup" @mouseover.stop="showGroupBtns = true" @mouseout="showGroupBtns = false">
|
|
3
|
+
<v-flex xs12 v-if="isGroup0">
|
|
4
|
+
<v-toolbar height="48" class="elevation-0 bottomtoolbar pt-1 pb-1">
|
|
5
|
+
<v-btn v-if="disabled === false" class="btnAddGroup elevation-0" @click="addSubGroup()">
|
|
6
|
+
<v-icon small>fa fa-layer-group</v-icon>
|
|
7
|
+
<span>{{ $t('addGroup') }}</span>
|
|
8
|
+
</v-btn>
|
|
9
|
+
<v-spacer></v-spacer>
|
|
10
|
+
</v-toolbar>
|
|
11
|
+
</v-flex>
|
|
12
|
+
<v-flex xs12 v-if="(isGroup0 && groups.length > 1) || !isGroup0">
|
|
13
|
+
<v-layout wrap class="puiDocgenTemplateFilterGroup__groupOperator pt-1 pl-3">
|
|
14
|
+
<v-flex xs4 align-self-center>
|
|
15
|
+
<span>{{ $t('labelGroup') }}</span>
|
|
16
|
+
</v-flex>
|
|
17
|
+
<v-flex xs2>
|
|
18
|
+
<v-select
|
|
19
|
+
:label="$t('or')"
|
|
20
|
+
append-icon="fa fa-angle-down"
|
|
21
|
+
solo
|
|
22
|
+
flat
|
|
23
|
+
hide-details
|
|
24
|
+
:items="groupOperators"
|
|
25
|
+
v-model="groupOp"
|
|
26
|
+
:disabled="disabled"
|
|
27
|
+
></v-select>
|
|
28
|
+
</v-flex>
|
|
29
|
+
</v-layout>
|
|
30
|
+
</v-flex>
|
|
31
|
+
<v-layout v-if="!isGroup0" wrap>
|
|
32
|
+
<v-flex xs12>
|
|
33
|
+
<v-layout v-for="(rule, i) in rules" :key="i">
|
|
34
|
+
<v-flex xs11>
|
|
35
|
+
<pui-docgen-template-filter-rule
|
|
36
|
+
:ref="`rule${i}`"
|
|
37
|
+
:ruleIndex="i"
|
|
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-docgen-template-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">
|
|
56
|
+
<pui-docgen-template-filter-group
|
|
57
|
+
v-for="(group, i) in groups"
|
|
58
|
+
:groupOperators="groupOperators"
|
|
59
|
+
:columns="columns"
|
|
60
|
+
:groupName="groupName + '-' + i"
|
|
61
|
+
:rulesProp="groupsProp ? groupsProp[i].rules : undefined"
|
|
62
|
+
:groupOpProp="groupsProp ? groupsProp[i].groupOp : undefined"
|
|
63
|
+
:groupsProp="groupsProp ? groupsProp[i].groups : undefined"
|
|
64
|
+
:ref="`group${i}`"
|
|
65
|
+
:key="i"
|
|
66
|
+
:disabled="disabled"
|
|
67
|
+
:showSubgroupBtn="showSubgroupBtn"
|
|
68
|
+
></pui-docgen-template-filter-group>
|
|
69
|
+
</v-layout>
|
|
70
|
+
<v-layout v-if="!isGroup0" wrap>
|
|
71
|
+
<v-flex xs12>
|
|
72
|
+
<v-toolbar height="32" class="elevation-0 puiDocgenTemplateFilterGroup__bottombar">
|
|
73
|
+
<v-btn v-if="disabled === false" class="btnGroup btnAddRule elevation-0 ml-3" @click="addRule()">
|
|
74
|
+
<v-icon small>far fa-plus</v-icon>
|
|
75
|
+
<span>{{ $t('addRule') }}</span>
|
|
76
|
+
</v-btn>
|
|
77
|
+
<v-btn v-if="showSubgroupBtn && disabled === false" class="btnGroup btnAddGroup elevation-0" @click="addSubGroup()">
|
|
78
|
+
<v-icon small>fa fa-layer-group</v-icon>
|
|
79
|
+
<span>{{ $t('addSubGroup') }}</span>
|
|
80
|
+
</v-btn>
|
|
81
|
+
<v-btn v-if="!isFirstGroup && disabled === false" class="btnGroup btnRemGroup elevation-0" @click="removeGroup()">
|
|
82
|
+
<v-icon small>fa fa-trash-alt</v-icon>
|
|
83
|
+
<span>{{ $t('removeGroup') }}</span>
|
|
84
|
+
</v-btn>
|
|
85
|
+
<v-spacer></v-spacer>
|
|
86
|
+
</v-toolbar>
|
|
87
|
+
</v-flex>
|
|
88
|
+
</v-layout>
|
|
89
|
+
</v-layout>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
import PuiDocgenTemplateFilterRule from './PuiDocgenTemplateFilterRule';
|
|
94
|
+
|
|
95
|
+
export default {
|
|
96
|
+
name: 'PuiDocgenTemplateFilterGroup',
|
|
97
|
+
components: {
|
|
98
|
+
PuiDocgenTemplateFilterRule
|
|
99
|
+
},
|
|
100
|
+
props: {
|
|
101
|
+
columns: {
|
|
102
|
+
type: Array,
|
|
103
|
+
required: true
|
|
104
|
+
},
|
|
105
|
+
groupName: {
|
|
106
|
+
type: String
|
|
107
|
+
},
|
|
108
|
+
rulesProp: {
|
|
109
|
+
type: Array
|
|
110
|
+
},
|
|
111
|
+
groupOpProp: {
|
|
112
|
+
type: String
|
|
113
|
+
},
|
|
114
|
+
groupsProp: {
|
|
115
|
+
type: Array
|
|
116
|
+
},
|
|
117
|
+
disabled: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
showSubgroupBtn: {
|
|
122
|
+
type: Boolean
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
data() {
|
|
126
|
+
return {
|
|
127
|
+
rules: [],
|
|
128
|
+
groups: [],
|
|
129
|
+
groupOp: 'or',
|
|
130
|
+
showDeleteRule: null,
|
|
131
|
+
showGroupBtns: null,
|
|
132
|
+
groupOperators: [
|
|
133
|
+
{
|
|
134
|
+
text: 'and',
|
|
135
|
+
value: 'and'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
text: 'or',
|
|
139
|
+
value: 'or'
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
computed: {
|
|
145
|
+
isFirstGroup() {
|
|
146
|
+
if (this.groups.length === 1) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
},
|
|
151
|
+
isGroup0() {
|
|
152
|
+
return this.groupName === '0';
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
created() {
|
|
156
|
+
this.translateGroupOperators();
|
|
157
|
+
if (this.groupOpProp && this.groupsProp && this.rulesProp) {
|
|
158
|
+
this.groupOp = this.groupOpProp;
|
|
159
|
+
this.groups = this.groupsProp;
|
|
160
|
+
this.rules = this.rulesProp;
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
mounted() {
|
|
164
|
+
this.$puiEvents.$on('reset-filtering', this.reset);
|
|
165
|
+
this.$puiEvents.$on(`groupRemoved-${this.groupName}`, this.onGroupRemoved);
|
|
166
|
+
if (!this.groupsProp && this.isGroup0 === true && !this.groupComp) {
|
|
167
|
+
this.addSubGroup();
|
|
168
|
+
} else if (!this.groupsProp && this.groupName === '0-0' && this.rules.length === 0) {
|
|
169
|
+
this.addRule();
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
destroyed() {
|
|
173
|
+
this.$puiEvents.$off('reset-filtering', this.reset);
|
|
174
|
+
this.$puiEvents.$off(`groupRemoved-${this.groupName}`);
|
|
175
|
+
},
|
|
176
|
+
methods: {
|
|
177
|
+
translateGroupOperators() {
|
|
178
|
+
for (let i = 0, length = this.groupOperators.length; i < length; i++) {
|
|
179
|
+
this.groupOperators[i].text = this.$t(this.groupOperators[i].text);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
reset() {
|
|
183
|
+
this.rules = [];
|
|
184
|
+
this.groups = [];
|
|
185
|
+
for (var ruleOrGroup in this.$refs) {
|
|
186
|
+
delete this.$refs[ruleOrGroup];
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
addRule() {
|
|
190
|
+
this.rules.push({});
|
|
191
|
+
},
|
|
192
|
+
addSubGroup() {
|
|
193
|
+
this.groups.push({});
|
|
194
|
+
},
|
|
195
|
+
removeRule(i) {
|
|
196
|
+
this.rules.splice(i, 1);
|
|
197
|
+
delete this.$refs[`rule${i}`];
|
|
198
|
+
},
|
|
199
|
+
onGroupRemoved(i) {
|
|
200
|
+
this.groups.splice(i, 1);
|
|
201
|
+
delete this.$refs[`group${i}`];
|
|
202
|
+
if (this.isGroup0 && this.groupsProp) {
|
|
203
|
+
this.groups = this.groupsProp;
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
removeGroup() {
|
|
207
|
+
//Obtenemos el indice de grupo de sí mismo
|
|
208
|
+
const array = this.groupName.split('-');
|
|
209
|
+
//el indice de grupo es el numero más a la derecha del nombre (separados por -)
|
|
210
|
+
const index = array[array.length - 1];
|
|
211
|
+
//el nombre del padre es el groupName quitandole '-' + index
|
|
212
|
+
const parentGroupName = array.slice(0, -1).join('-') || array[0];
|
|
213
|
+
//publicamos el evento y el grupo padre se encargará de borrar este grupo
|
|
214
|
+
this.$puiEvents.$emit(`groupRemoved-${parentGroupName}`, index);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<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
|
+
.btnGroup {
|
|
233
|
+
height: 28px !important;
|
|
234
|
+
color: var(--N-500);
|
|
235
|
+
& span {
|
|
236
|
+
padding-left: 6px;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
.puiDocgenTemplateFilterGroup {
|
|
240
|
+
background-color: var(--N-10);
|
|
241
|
+
border-radius: 5px;
|
|
242
|
+
&__groupOperator {
|
|
243
|
+
height: 50px;
|
|
244
|
+
}
|
|
245
|
+
&__bottombar {
|
|
246
|
+
}
|
|
247
|
+
& .bottomtoolbar {
|
|
248
|
+
background-color: transparent !important;
|
|
249
|
+
}
|
|
250
|
+
& .puiDocgenTemplateFilterGroup {
|
|
251
|
+
background-color: var(--N-0);
|
|
252
|
+
margin-left: 11px;
|
|
253
|
+
margin-right: 5px;
|
|
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);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
& .puiDocgenTemplateFilterGroup {
|
|
263
|
+
background-color: var(--N-10);
|
|
264
|
+
margin-left: 11px;
|
|
265
|
+
margin-right: 5px;
|
|
266
|
+
& .v-toolbar,
|
|
267
|
+
.v-btn {
|
|
268
|
+
background-color: var(--N-10);
|
|
269
|
+
}
|
|
270
|
+
& .puiDocgenTemplateFilterGroup {
|
|
271
|
+
background-color: var(--N-0);
|
|
272
|
+
margin-left: 11px;
|
|
273
|
+
margin-right: 5px;
|
|
274
|
+
& .v-toolbar,
|
|
275
|
+
.v-btn {
|
|
276
|
+
background-color: var(--N-0);
|
|
277
|
+
}
|
|
278
|
+
& .puiDocgenTemplateFilterGroup {
|
|
279
|
+
background-color: var(--N-10);
|
|
280
|
+
margin-left: 11px;
|
|
281
|
+
margin-right: 5px;
|
|
282
|
+
& .v-toolbar,
|
|
283
|
+
.v-btn {
|
|
284
|
+
background-color: var(--N-10);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
</style>
|