@nixweb/nixloc-ui 0.0.93 → 0.0.94

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.
Files changed (25) hide show
  1. package/package.json +4 -2
  2. package/src/component/forms/EscolherEstatico.vue +0 -3
  3. package/src/component/layout/BarraRolagem.vue +9 -2
  4. package/src/component/layout/Menu.vue +16 -9
  5. package/src/component/layout/Tag.vue +66 -0
  6. package/src/component/shared/FiltroHorizontal.vue +8 -2
  7. package/src/component/shared/Progresso.vue +14 -1
  8. package/src/component/shared/Tabela.vue +2 -12
  9. package/src/component/shared/query-builder/Campo.vue +116 -0
  10. package/src/component/shared/query-builder/ConverteParaOdata.js +73 -0
  11. package/src/component/shared/query-builder/Filtro.vue +85 -0
  12. package/src/component/shared/query-builder/QueryBuilder.vue +164 -0
  13. package/src/component/shared/query-builder/Rodape.vue +38 -0
  14. package/src/component/shared/query-builder/Tags.vue +84 -0
  15. package/src/component/shared/query-builder/components/CustomSelect.vue +115 -0
  16. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +46 -0
  17. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +151 -0
  18. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +81 -0
  19. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +120 -0
  20. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +171 -0
  21. package/src/component/shared/query-builder/main.js +81 -0
  22. package/src/component/shared/query-builder/utilities.js +22 -0
  23. package/src/component/template/ModeloRelatorioView.vue +455 -0
  24. package/src/store/modulos/generic.js +11 -0
  25. package/src/store/modulos/relatorio.js +149 -0
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div>
3
+ <Moldura>
4
+ <div v-for="item in dados" :key="item.titulo">
5
+ <div :class="item.classeCss">
6
+ <b-row>
7
+ <b-col class="text-right" sm="10">
8
+ <span class="titulo">{{ item.titulo }}</span>
9
+ </b-col>
10
+ <b-col class="text-right" sm="2">
11
+ <span class="titulo">{{ item.valor }}</span>
12
+ </b-col>
13
+ </b-row>
14
+ </div>
15
+ </div>
16
+ </Moldura>
17
+ </div>
18
+ </template>
19
+ <script>
20
+ import Moldura from "@nixweb/nixloc-ui/src/component/layout/Moldura";
21
+
22
+ export default {
23
+ name: "RodapeRelatorio",
24
+ components: {
25
+ Moldura,
26
+ },
27
+ props: {
28
+ dados: Array,
29
+ },
30
+ };
31
+ </script>
32
+
33
+ <style scoped>
34
+ .titulo {
35
+ font-size: 15px;
36
+ font-weight: 400;
37
+ }
38
+ </style>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div>
3
+ <div class="lado-a-lado div-tag" v-for="tag in tags" :key="tag.id">
4
+ <Tag
5
+ :nomeEvento="nomeEvento"
6
+ :dadosEvento="tag"
7
+ :titulo="tag.titulo"
8
+ :valor="tag.valor"
9
+ />
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import Tag from "@nixweb/nixloc-ui/src/component/layout/Tag";
16
+
17
+ import { mapGetters, mapMutations } from "vuex";
18
+
19
+ export default {
20
+ name: "Tags",
21
+ components: { Tag },
22
+ props: {
23
+ nomeEvento: String,
24
+ },
25
+ data() {
26
+ return {
27
+ tags: [],
28
+ };
29
+ },
30
+ computed: {
31
+ ...mapGetters("relatorio", ["filtroSelecionado"]),
32
+ ...mapGetters("generic", ["mostrarModal", "evento"]),
33
+ },
34
+ methods: {
35
+ ...mapMutations("relatorio", ["removeFiltroSelecionado"]),
36
+ },
37
+ watch: {
38
+ filtroSelecionado: {
39
+ handler(filtro) {
40
+ let self = this;
41
+ this.tags = [];
42
+ filtro.children.forEach(function (value) {
43
+ let valor = "";
44
+ let type = value.query.type;
45
+
46
+ if (type == "custom-component" && value.query.label == "Período") {
47
+ valor = `${value.query.value[0]} - ${value.query.value[1]}`;
48
+ }
49
+
50
+ if (type == "text" || type == "numeric") {
51
+ valor = `${value.query.operator} "${value.query.value}"`;
52
+ }
53
+
54
+ if (type == "checkbox") {
55
+ value.query.choices.forEach(function (opcoes) {
56
+ value.query.value.forEach(function (value) {
57
+ if (opcoes.value == value) {
58
+ valor += `${opcoes.label},`;
59
+ }
60
+ });
61
+ });
62
+ }
63
+
64
+ let tag = { id: value.query.id, titulo: value.query.label, valor: valor };
65
+ if (value.query.value != null) self.tags.push(tag);
66
+ });
67
+ },
68
+ deep: true,
69
+ },
70
+ evento: {
71
+ handler(evento) {
72
+ if (evento.nome == "tagRemovida") {
73
+ var tags = this.tags.filter((x) => {
74
+ return x.id != evento.dados.id;
75
+ });
76
+ this.tags = tags;
77
+ this.removeFiltroSelecionado(evento.dados.id);
78
+ }
79
+ },
80
+ deep: true,
81
+ },
82
+ },
83
+ };
84
+ </script>
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <div class="custom-escolher" :tabindex="tabindex" @blur="open = false">
3
+ <div class="selected" :class="{ open: open }" @click="open = !open">
4
+ {{ selected }}
5
+ </div>
6
+ <div class="items" :class="{ selectHide: !open }">
7
+ <div v-for="(option, i) of options" :key="i">
8
+ <div @click="selecionar(option)">
9
+ <span :class="option.classeCss">
10
+ <i :class="option.icone"></i>
11
+ <span> {{ option.label }}</span>
12
+ </span>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ export default {
21
+ props: [
22
+ "options",
23
+ "tabindex",
24
+ "value",
25
+ ] /* {
26
+ options: {
27
+ type: Array,
28
+ required: true,
29
+ },
30
+ default: {
31
+ type: String,
32
+ required: false,
33
+ default: null,
34
+ },
35
+ tabindex: {
36
+ type: Number,
37
+ required: false,
38
+ default: 0,
39
+ },
40
+ value: Object,
41
+ },*/,
42
+ data() {
43
+ return {
44
+ selected: "Selecione os filtros",
45
+ open: false,
46
+ };
47
+ },
48
+ mounted() {
49
+ this.$emit("input", this.selected);
50
+ },
51
+ methods: {
52
+ selecionar(option) {
53
+ this.$emit("input", option);
54
+ this.selected = option.label;
55
+ this.open = false;
56
+ },
57
+ },
58
+ };
59
+ </script>
60
+
61
+ <style scoped>
62
+ .custom-escolher {
63
+ position: relative;
64
+ width: 100%;
65
+ text-align: left;
66
+ outline: none;
67
+ height: 40px;
68
+ line-height: 40px;
69
+ }
70
+
71
+ .custom-escolher .selected {
72
+ background-color: white;
73
+ border-bottom: 1px solid #dbdee0;
74
+ color: black;
75
+ padding-left: 1em;
76
+ cursor: pointer;
77
+ user-select: none;
78
+ }
79
+
80
+ .custom-escolher .selected:after {
81
+ position: absolute;
82
+ content: "";
83
+ top: 22px;
84
+ right: 1em;
85
+ width: 0;
86
+ height: 0;
87
+ border: 5px solid transparent;
88
+ border-color: black transparent transparent transparent;
89
+ }
90
+
91
+ .custom-escolher .items {
92
+ color: black;
93
+ border-radius: 0px 0px 6px 6px;
94
+ overflow: hidden;
95
+ position: absolute;
96
+ background-color: #fafafc;
97
+ left: 0;
98
+ right: 0;
99
+ z-index: 1;
100
+ height: 200px;
101
+ overflow-y: visible;
102
+ overflow-x: hidden;
103
+ }
104
+
105
+ .custom-escolher .items div {
106
+ color: black;
107
+ padding-left: 1em;
108
+ cursor: pointer;
109
+ user-select: none;
110
+ }
111
+
112
+ .selectHide {
113
+ display: none;
114
+ }
115
+ </style>
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div class="vqb-children">
3
+ <component
4
+ :is="getComponent(child.type)"
5
+ v-for="(child, index) in query.children"
6
+ :key="index"
7
+ :type="child.type"
8
+ :query.sync="child.query"
9
+ :rule-types="ruleTypes"
10
+ :rules="rules"
11
+ :rule="$parent.ruleById(child.query.rule)"
12
+ :index="index"
13
+ :max-depth="maxDepth"
14
+ :depth="depth + 1"
15
+ :labels="labels"
16
+ @child-deletion-requested="$parent.removeChild"
17
+ />
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ // eslint-disable-next-line vue/require-prop-types
24
+ props: ['query', 'ruleTypes', 'rules', 'maxDepth', 'labels', 'depth'],
25
+
26
+ data() {
27
+ return {
28
+ groupComponent: null,
29
+ ruleComponent: null
30
+ }
31
+ },
32
+
33
+ mounted() {
34
+ this.groupComponent = this.$parent.$options.components['QueryBuilderGroup'];
35
+ this.ruleComponent = this.$parent.$options.components['QueryBuilderRule'];
36
+ },
37
+
38
+ methods: {
39
+ getComponent(type) {
40
+ return type === 'query-builder-group'
41
+ ? this.groupComponent
42
+ : this.ruleComponent;
43
+ }
44
+ }
45
+ }
46
+ </script>
@@ -0,0 +1,151 @@
1
+ <template>
2
+ <div></div>
3
+ </template>
4
+
5
+ <script>
6
+ /* eslint-disable vue/require-default-prop */
7
+ import deepClone from "../utilities.js";
8
+ import QueryBuilderChildren from "./QueryBuilderChildren.vue";
9
+
10
+ import { mapMutations, mapGetters } from "vuex";
11
+
12
+ export default {
13
+ components: {
14
+ // eslint-disable-next-line vue/no-unused-components
15
+ QueryBuilderChildren,
16
+ },
17
+
18
+ props: {
19
+ ruleTypes: Object,
20
+ type: {
21
+ type: String,
22
+ default: "query-builder-group",
23
+ },
24
+ query: Object,
25
+ rules: Array,
26
+ index: Number,
27
+ maxDepth: Number,
28
+ depth: Number,
29
+ labels: Object,
30
+ },
31
+
32
+ data() {
33
+ return {
34
+ selectedRule: this.rules[0],
35
+ valida: [],
36
+ };
37
+ },
38
+ computed: {
39
+ ...mapGetters("generic", ["evento"]),
40
+ },
41
+ methods: {
42
+ ...mapMutations("generic", ["insereNotificacao"]),
43
+
44
+ ruleById(ruleId) {
45
+ var rule = null;
46
+
47
+ this.rules.forEach(function (value) {
48
+ if (value.id === ruleId) {
49
+ rule = value;
50
+ return false;
51
+ }
52
+ });
53
+
54
+ return rule;
55
+ },
56
+
57
+ addRule() {
58
+ let updated_query = deepClone(this.query);
59
+ let child = {
60
+ type: "query-builder-rule",
61
+ query: {
62
+ id: Math.random()
63
+ .toString(36)
64
+ .replace(/[^a-z]+/g, "")
65
+ .substr(0, 5),
66
+ obrigatorio: this.selectedRule.obrigatorio,
67
+ type: this.selectedRule.type,
68
+ choices: this.selectedRule.choices,
69
+ classeCss: this.selectedRule.classeCss,
70
+ valida: this.selectedRule.valida,
71
+ tipo: this.selectedRule.tipo,
72
+ label: this.selectedRule.label,
73
+ rule: this.selectedRule.id,
74
+ operator: this.selectedRule.operators[0],
75
+ operand:
76
+ typeof this.selectedRule.operands === "undefined"
77
+ ? this.selectedRule.label
78
+ : this.selectedRule.operands[0],
79
+ value: null,
80
+ },
81
+ };
82
+ // A bit hacky, but `v-model` on `select` requires an array.
83
+ if (this.ruleById(child.query.rule).type === "multi-select") {
84
+ child.query.value = [];
85
+ }
86
+
87
+ if (!this.jaExiste(child.query.rule)) {
88
+ updated_query.children.push(child);
89
+ if (child.query.valida) this.valida.push(child);
90
+ } else {
91
+ var erro = {
92
+ property: "ERRO QUERY BUILDER",
93
+ mensagem: `Não é possível adicionar o filtro ${child.query.label} 2 vezes!`,
94
+ };
95
+ this.insereNotificacao([erro]);
96
+ }
97
+
98
+ this.$emit("update:query", updated_query);
99
+ },
100
+
101
+ addGroup() {
102
+ let updated_query = deepClone(this.query);
103
+ if (this.depth < this.maxDepth) {
104
+ updated_query.children.push({
105
+ type: "query-builder-group",
106
+ query: {
107
+ logicalOperator: this.labels.matchTypes[0].id,
108
+ children: [],
109
+ },
110
+ });
111
+ this.$emit("update:query", updated_query);
112
+ }
113
+ },
114
+
115
+ remove() {
116
+ this.$emit("child-deletion-requested", this.index);
117
+ },
118
+
119
+ removeChild(index) {
120
+ this.valida.splice(this.valida.indexOf(index, 1));
121
+
122
+ let updated_query = deepClone(this.query);
123
+
124
+ updated_query.children.splice(index, 1);
125
+
126
+ this.$emit("update:query", updated_query);
127
+ },
128
+
129
+ jaExiste(chave) {
130
+ var existe = this.valida.find((value) => {
131
+ return value.query.rule === chave;
132
+ });
133
+ if (existe) return true;
134
+ return false;
135
+ },
136
+ },
137
+ watch: {
138
+ evento: {
139
+ handler(evento) {
140
+ if (evento.nome == "tagRemovida") {
141
+ var valida = this.valida.filter((x) => {
142
+ return x.query.id != evento.dados.id;
143
+ });
144
+ this.valida = valida;
145
+ }
146
+ },
147
+ deep: true,
148
+ },
149
+ },
150
+ };
151
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div></div>
3
+ </template>
4
+
5
+ <script>
6
+ import deepClone from "../utilities.js";
7
+
8
+ export default {
9
+ // eslint-disable-next-line vue/require-prop-types
10
+ props: ["query", "index", "rule", "labels", "depth"],
11
+
12
+ computed: {
13
+ isCustomComponent() {
14
+ return this.rule.type === "custom-component";
15
+ },
16
+
17
+ selectOptions() {
18
+ if (typeof this.rule.choices === "undefined") {
19
+ return {};
20
+ }
21
+
22
+ // Nest items to support <optgroup> if the rule's choices have
23
+ // defined groups. Otherwise just return a single-level array
24
+ return this.rule.choices.reduce(function (groups, item, index) {
25
+ let key = item["group"];
26
+ if (typeof key !== "undefined") {
27
+ groups[key] = groups[key] || [];
28
+ groups[key].push(item);
29
+ } else {
30
+ groups[index] = item;
31
+ }
32
+
33
+ return groups;
34
+ }, {});
35
+ },
36
+
37
+ hasOptionGroups() {
38
+ return this.selectOptions.length && Array.isArray(this.selectOptions[0]);
39
+ },
40
+ },
41
+
42
+ beforeMount() {
43
+ if (this.rule.type === "custom-component") {
44
+ this.$options.components[this.id] = this.rule.component;
45
+ }
46
+ },
47
+
48
+ mounted() {
49
+ let updated_query = deepClone(this.query);
50
+
51
+ // Set a default value for these types if one isn't provided already
52
+ if (this.query.value === null) {
53
+ if (this.rule.inputType === "checkbox") {
54
+ updated_query.value = [];
55
+ }
56
+ if (this.rule.type === "select") {
57
+ updated_query.value = this.rule.choices[0].value;
58
+ }
59
+ if (this.rule.type === "custom-component") {
60
+ updated_query.value = null;
61
+ if (typeof this.rule.default !== "undefined") {
62
+ updated_query.value = deepClone(this.rule.default);
63
+ }
64
+ }
65
+
66
+ this.$emit("update:query", updated_query);
67
+ }
68
+ },
69
+
70
+ methods: {
71
+ remove: function () {
72
+ this.$emit("child-deletion-requested", this.index);
73
+ },
74
+ updateQuery(value) {
75
+ let updated_query = deepClone(this.query);
76
+ updated_query.value = value;
77
+ this.$emit("update:query", updated_query);
78
+ },
79
+ },
80
+ };
81
+ </script>
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <!-- eslint-disable vue/no-v-html -->
3
+ <div class="vqb-group card" :class="'depth-' + depth.toString()">
4
+ <div class="vqb-group-heading card-header" v-if="false">
5
+ <div class="match-type-container form-inline">
6
+ <label class="mr-2" for="vqb-match-type">
7
+ {{ labels.matchType }}
8
+ </label>
9
+
10
+ <select id="vqb-match-type" v-model="query.logicalOperator" class="form-control">
11
+ <option v-for="label in labels.matchTypes" :key="label.id" :value="label.id">
12
+ {{ label.label }}
13
+ </option>
14
+ </select>
15
+
16
+ <button
17
+ v-if="depth > 1"
18
+ type="button"
19
+ class="close ml-auto"
20
+ @click="remove"
21
+ v-html="labels.removeGroup"
22
+ ></button>
23
+ </div>
24
+ </div>
25
+
26
+ <div class="vqb-group-body card-body">
27
+ <div class="rule-actions form-inline">
28
+ <div class="div-custom">
29
+ <b-row>
30
+ <b-col sm="6">
31
+ <CustomSelect :options="rules" class="select" v-model="selectedRule" />
32
+ </b-col>
33
+ <b-col sm="4">
34
+ <button type="button" class="btn btn-secondary mr-2" @click="addRule">
35
+ {{ labels.addRule }}
36
+ </button>
37
+ </b-col>
38
+ </b-row>
39
+
40
+ <!-- <button
41
+ v-if="depth < maxDepth"
42
+ type="button"
43
+ class="btn btn-secondary"
44
+ @click="addGroup"
45
+ >
46
+ {{ labels.addGroup }}
47
+ </button> -->
48
+ </div>
49
+ </div>
50
+
51
+ <query-builder-children v-bind="$props" />
52
+ </div>
53
+ </div>
54
+ </template>
55
+
56
+ <script>
57
+ import CustomSelect from "../../components/CustomSelect.vue";
58
+ import QueryBuilderGroup from "../../components/QueryBuilderGroup";
59
+ import QueryBuilderRule from "./BootstrapRule.vue";
60
+
61
+ export default {
62
+ name: "QueryBuilderGroup",
63
+
64
+ components: {
65
+ // eslint-disable-next-line vue/no-unused-components
66
+ QueryBuilderRule: QueryBuilderRule,
67
+ CustomSelect,
68
+ },
69
+
70
+ extends: QueryBuilderGroup,
71
+ };
72
+ </script>
73
+
74
+ <style>
75
+ .titulo-option {
76
+ padding: 10px;
77
+ }
78
+
79
+ .div-custom {
80
+ width: 100%;
81
+ }
82
+
83
+ .vue-query-builder .vqb-group .rule-actions {
84
+ margin-bottom: 20px;
85
+ }
86
+
87
+ .vue-query-builder .vqb-rule {
88
+ margin-top: 15px;
89
+ margin-bottom: 15px;
90
+ background-color: #f5f5f5;
91
+ border-color: #ddd;
92
+ padding: 15px;
93
+ }
94
+
95
+ .vue-query-builder .vqb-group.depth-1 .vqb-rule,
96
+ .vue-query-builder .vqb-group.depth-2 {
97
+ border-left: 2px solid #8bc34a;
98
+ }
99
+
100
+ .vue-query-builder .vqb-group.depth-2 .vqb-rule,
101
+ .vue-query-builder .vqb-group.depth-3 {
102
+ border-left: 2px solid #00bcd4;
103
+ }
104
+
105
+ .vue-query-builder .vqb-group.depth-3 .vqb-rule,
106
+ .vue-query-builder .vqb-group.depth-4 {
107
+ border-left: 2px solid #ff5722;
108
+ }
109
+
110
+ .vue-query-builder .close {
111
+ opacity: 1;
112
+ color: rgb(150, 150, 150);
113
+ }
114
+
115
+ @media (min-width: 768px) {
116
+ .vue-query-builder .vqb-rule.form-inline .form-group {
117
+ display: block;
118
+ }
119
+ }
120
+ </style>