@nixweb/nixloc-ui 0.0.121 → 0.0.122

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 (119) hide show
  1. package/docs/src/component/template/ModeloRelatorioView.drawio +2 -2
  2. package/docs/src/store/modulos/relatorio.drawio +1 -1
  3. package/package.json +77 -77
  4. package/public/styles/app.css +1 -1
  5. package/src/component/forms/{Botao.vue → Button.vue} +53 -57
  6. package/src/component/forms/CheckboxGroup.vue +63 -0
  7. package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +6 -6
  8. package/src/component/forms/{Cor.vue → Color.vue} +9 -9
  9. package/src/component/forms/DateTime.vue +53 -53
  10. package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
  11. package/src/component/forms/EditorHtml.vue +123 -0
  12. package/src/component/forms/FileUpload.vue +189 -0
  13. package/src/component/forms/InputDecimal.vue +137 -0
  14. package/src/component/forms/InputNumber.vue +149 -0
  15. package/src/component/forms/InputPassword.vue +135 -0
  16. package/src/component/forms/InputText.vue +157 -0
  17. package/src/component/forms/Modal.vue +15 -15
  18. package/src/component/forms/RadioGroup.vue +50 -0
  19. package/src/component/forms/Select.vue +337 -0
  20. package/src/component/forms/SelectStatic.vue +120 -0
  21. package/src/component/forms/TextArea.vue +126 -0
  22. package/src/component/forms/Toggle.vue +13 -13
  23. package/src/component/layout/{Conta.vue → Account.vue} +28 -28
  24. package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
  25. package/src/component/layout/Badge.vue +23 -23
  26. package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
  27. package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
  28. package/src/component/layout/Menu.vue +66 -66
  29. package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
  30. package/src/component/layout/Panel.vue +142 -0
  31. package/src/component/layout/Popover.vue +1 -1
  32. package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
  33. package/src/component/layout/Tag.vue +9 -9
  34. package/src/component/layout/Topo.vue +1 -1
  35. package/src/component/layout/Wizard.vue +3 -3
  36. package/src/component/shared/BotaoCarregarMais.vue +9 -9
  37. package/src/component/shared/BotaoConsulta.vue +9 -9
  38. package/src/component/shared/CabecalhoImpressao.vue +6 -6
  39. package/src/component/shared/CodigoEditor.vue +16 -16
  40. package/src/component/shared/Confirmacao.vue +28 -28
  41. package/src/component/shared/Dica.vue +10 -10
  42. package/src/component/shared/DocumentoEditor.vue +3 -3
  43. package/src/component/shared/DocumentoPreview.vue +2 -2
  44. package/src/component/shared/EsconderMostrar.vue +26 -26
  45. package/src/component/shared/ExportarExcel.vue +14 -14
  46. package/src/component/shared/ExportarPDF.vue +10 -10
  47. package/src/component/shared/FiltroHorizontal.vue +19 -19
  48. package/src/component/shared/LegendaParametro.vue +17 -17
  49. package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
  50. package/src/component/shared/Messages.vue +83 -0
  51. package/src/component/shared/Paginacao.vue +10 -10
  52. package/src/component/shared/Progresso.vue +2 -2
  53. package/src/component/shared/Registro.vue +2 -2
  54. package/src/component/shared/ResumoTabela.vue +6 -6
  55. package/src/component/shared/SalvarCancelar.vue +26 -26
  56. package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
  57. package/src/component/shared/Tabela.vue +49 -49
  58. package/src/component/shared/TabelaBotao.vue +13 -13
  59. package/src/component/shared/Toast.vue +7 -7
  60. package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
  61. package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
  62. package/src/component/shared/construtor-consulta/Campo.vue +127 -0
  63. package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
  64. package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
  65. package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
  66. package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
  67. package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
  68. package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
  69. package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
  70. package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
  71. package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
  72. package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
  73. package/src/component/template/ModeloDocumentoView.vue +79 -79
  74. package/src/component/template/ModeloLista.vue +66 -66
  75. package/src/component/template/ModeloRelatorioListaView.vue +71 -68
  76. package/src/component/template/ModeloRelatorioView.vue +201 -190
  77. package/src/component/template/ModeloSubView.vue +13 -13
  78. package/src/component/template/ModeloView.vue +17 -17
  79. package/src/component/template/Relatorio.js +1 -5
  80. package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
  81. package/src/component/value-objects/DadosContato.vue +27 -27
  82. package/src/component/value-objects/DadosPessoa.js +1 -1
  83. package/src/component/value-objects/DadosPessoa.vue +52 -52
  84. package/src/component/value-objects/Endereco.js +1 -1
  85. package/src/component/value-objects/Endereco.vue +83 -83
  86. package/src/config/dicas.js +1 -1
  87. package/src/config/token.js +2 -2
  88. package/src/store/modules/generic.js +489 -0
  89. package/src/store/modules/report.js +246 -0
  90. package/src/store/modules/user.js +38 -0
  91. package/src/store/modules/validation.js +39 -0
  92. package/src/store/store.js +4 -4
  93. package/src/component/forms/ArquivoUpload.vue +0 -199
  94. package/src/component/forms/CheckboxMultiplo.vue +0 -63
  95. package/src/component/forms/Decimal.vue +0 -137
  96. package/src/component/forms/Escolher.vue +0 -335
  97. package/src/component/forms/EscolherEstatico.vue +0 -139
  98. package/src/component/forms/Numero.vue +0 -153
  99. package/src/component/forms/Opcoes.vue +0 -51
  100. package/src/component/forms/Senha.vue +0 -139
  101. package/src/component/forms/Texto.vue +0 -161
  102. package/src/component/forms/TextoArea.vue +0 -126
  103. package/src/component/forms/TextoEditor.vue +0 -123
  104. package/src/component/layout/Painel.vue +0 -142
  105. package/src/component/shared/Mensagem.vue +0 -86
  106. package/src/component/shared/query-builder/Campo.vue +0 -116
  107. package/src/component/shared/query-builder/ConverteParaOdata.js +0 -77
  108. package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
  109. package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
  110. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
  111. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
  112. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
  113. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
  114. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -187
  115. package/src/component/shared/query-builder/main.js +0 -81
  116. package/src/store/modulos/generic.js +0 -494
  117. package/src/store/modulos/relatorio.js +0 -204
  118. package/src/store/modulos/usuario.js +0 -38
  119. package/src/store/modulos/validation.js +0 -39
@@ -1,123 +0,0 @@
1
- <template>
2
- <div>
3
- <label>
4
- <span class="titulo">{{ titulo }}</span>
5
- <span class="requerido" v-if="requerido">*</span>
6
- <Dica :campo="campo" :formNome="formNome" />
7
- </label>
8
- <div class="inner-addon right-addon">
9
- <i
10
- v-if="notificacoes.length > 0 && formSujo"
11
- class="requerido glyphicon fas fa-exclamation-triangle"
12
- ></i>
13
- <vue-editor v-model.trim="value" :editorToolbar="customToolbar"></vue-editor>
14
- </div>
15
-
16
- <div v-if="formSujo">
17
- <div v-for="mensagem in notificacoes" :key="mensagem">
18
- <span class="invalido">{{ mensagem }}</span>
19
- </div>
20
- </div>
21
- </div>
22
- </template>
23
-
24
- <script>
25
- import Dica from "../shared/Dica.vue";
26
- import { VueEditor } from "vue2-editor";
27
-
28
- import { mapState, mapMutations } from "vuex";
29
-
30
- export default {
31
- components: { Dica, VueEditor },
32
- name: "TextoEditor",
33
- mixins: [],
34
- props: {
35
- titulo: String,
36
- campo: String,
37
- formNome: String,
38
- requerido: Boolean,
39
- tamanhoMaximo: Number,
40
- value: String,
41
- },
42
- data() {
43
- return {
44
- notificacoes: [],
45
- formSujo: false,
46
- textoEditor: "",
47
- customToolbar: [
48
- ["bold", "italic", "underline"],
49
- [{ list: "ordered" }, { list: "bullet" }],
50
- [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
51
- [{ header: [false] }],
52
- ],
53
- };
54
- },
55
- created() {
56
- this.valida();
57
- },
58
- methods: {
59
- ...mapMutations("validation", ["insereValidacao", "removeValidacao"]),
60
- valida() {
61
- this.notificacoes = [];
62
-
63
- if (this.requerido && this.value.length == 0) {
64
- var mensagem = `${this.titulo} não pode ser vazio!`;
65
- this.notificacoes.push(mensagem);
66
- }
67
-
68
- if (this.tamanhoMaximo > 0) {
69
- if (this.value.length > this.tamanhoMaximo) {
70
- var mensagem = `Máximo de ${this.tamanhoMaximo} caracteres!`;
71
- this.notificacoes.push(mensagem);
72
- }
73
- }
74
- },
75
- },
76
- computed: {
77
- ...mapState("validation", ["reiniciaForm", "validacao"]),
78
- },
79
- watch: {
80
- value() {
81
- this.valida();
82
- this.formSujo = true;
83
- this.$emit("input", this.value);
84
- },
85
- notificacoes() {
86
- let self = this;
87
- this.notificacoes.forEach(function (notificacao) {
88
- let obj = {
89
- chave: self.campo + "&" + self.formNome,
90
- formNome: self.formNome,
91
- notificacao: notificacao,
92
- };
93
- self.insereValidacao(obj);
94
- });
95
-
96
- if (this.notificacoes.length == 0) {
97
- let obj = {
98
- chave: self.campo + "&" + self.formNome,
99
- formNome: self.formNome,
100
- };
101
- self.removeValidacao(obj);
102
- }
103
- },
104
- reiniciaForm: {
105
- handler(form) {
106
- if (form.nome == this.formNome) this.formSujo = false;
107
- },
108
- deep: true,
109
- },
110
- },
111
- };
112
- </script>
113
-
114
- <style scoped>
115
- .sucesso {
116
- color: #94aa2a;
117
- font-size: 14px;
118
- }
119
- .invalido {
120
- color: #f0134d;
121
- font-size: 14px;
122
- }
123
- </style>
@@ -1,142 +0,0 @@
1
- <template>
2
- <div class="painel">
3
- <Toast />
4
- <Carregando v-show="carregando('painel')" />
5
- <div v-show="!carregando('painel')">
6
- <div v-show="mostrarFiltroVertical">
7
- <FiltroVertical>
8
- <slot name="conteudo-filtro"></slot>
9
- </FiltroVertical>
10
- </div>
11
- <div class="c-container">
12
- <Mensagem v-if="!modal.abrir" />
13
- <div class="row">
14
- <div class="col-10">
15
- <div class="div-titulo">
16
- <span class="modulo">
17
- <span class="icone"><i class="fas fa-compass"></i></span> {{ modulo }} |</span
18
- >
19
- <span class="titulo"> {{ titulo }}</span>
20
- </div>
21
- </div>
22
- <div class="col-2 text-right" v-show="rotaAtual != 'Dashboard'">
23
- <div class="c-voltar" @click="voltar()">
24
- <span class="g-espaco-esquerda">Voltar</span>
25
- </div>
26
- </div>
27
- </div>
28
- <br v-show="mostrarBotoes" />
29
- <div class="row" v-show="mostrarBotoes">
30
- <div class="col-12" v-show="mostrarBotoes">
31
- <slot name="conteudo-botoes"></slot>
32
- </div>
33
- </div>
34
- <br v-show="mostrarBotoes || mostrarPesquisa" />
35
- <div v-show="mostrarBotoes || mostrarPesquisa">
36
- <div>
37
- <div v-show="mostrarPesquisa"><Pesquisa /></div>
38
- </div>
39
- </div>
40
- <br v-show="mostrarPesquisa" />
41
- <div>
42
- <slot name="conteudo-principal"></slot>
43
- </div>
44
- </div>
45
- </div>
46
- <br /><br /><br />
47
- </div>
48
- </template>
49
-
50
- <script>
51
- import Toast from "../shared/Toast.vue";
52
- import Mensagem from "../shared/Mensagem.vue";
53
- import Pesquisa from "../shared/Pesquisa.vue";
54
- import Carregando from "../shared/Carregando.vue";
55
- import FiltroVertical from "../shared/FiltroVertical";
56
-
57
- import { mapState, mapGetters, mapMutations } from "vuex";
58
-
59
- export default {
60
- name: "Painel",
61
- components: {
62
- Carregando,
63
- FiltroVertical,
64
- Pesquisa,
65
- Mensagem,
66
- Toast,
67
- },
68
- props: {
69
- modulo: String,
70
- titulo: String,
71
- mostrarFiltroVertical: Boolean,
72
- mostrarPesquisa: Boolean,
73
- mostrarBotoes: Boolean,
74
- },
75
- data() {
76
- return {
77
- rotaAtual: this.$route.name,
78
- };
79
- },
80
- created() {
81
- this.insereCarregando("painel");
82
- },
83
- updated() {
84
- this.rotaAtual = this.$route.name;
85
- },
86
- computed: {
87
- ...mapGetters("generic", ["carregando"]),
88
- ...mapState("generic", ["modal"]),
89
- },
90
- methods: {
91
- ...mapMutations("generic", ["insereCarregando"]),
92
- voltar() {
93
- window.history.back();
94
- },
95
- },
96
- };
97
- </script>
98
- <style scoped>
99
- .c-container {
100
- margin: auto;
101
- padding-left: 110px;
102
- max-width: 1400px;
103
- }
104
-
105
- .div-titulo {
106
- margin-top: 15px;
107
- }
108
-
109
- .modulo {
110
- font-size: 16px;
111
- font-weight: 400;
112
- }
113
-
114
- .titulo {
115
- font-size: 18px;
116
- font-weight: 400;
117
- line-height: 34px;
118
- color: #577696;
119
- }
120
-
121
- .icone{
122
- opacity: 0.8;
123
- font-size: 20px;
124
- }
125
-
126
-
127
- .c-voltar {
128
- margin-top: 20px;
129
- margin-right: 12px;
130
- font-size: 16px;
131
- cursor: pointer;
132
- color: #8ca1b7;
133
- }
134
-
135
- .c-voltar:hover {
136
- color: #8ca1b7;
137
- }
138
-
139
- .painel {
140
- padding: 25px;
141
- }
142
- </style>
@@ -1,86 +0,0 @@
1
- <template>
2
- <div>
3
- <div
4
- :class="{ 'div-mensagem': !modal.abrir }"
5
- v-if="notificacaoArmazenada.length > 0"
6
- >
7
- <div>
8
- <Alerta tipo="perigo">
9
- <div v-for="notificacao in notificacaoArmazenada">
10
- {{ notificacao.mensagem }}
11
- </div>
12
- </Alerta>
13
- </div>
14
- <b-alert
15
- v-show="false"
16
- :show="contagemRegressiva"
17
- dismissible
18
- variant="danger"
19
- @dismissed="contagemRegressiva = 0"
20
- @dismiss-count-down="contagemRegressivaAlterada"
21
- >
22
- </b-alert>
23
- </div>
24
- </div>
25
- </template>
26
-
27
- <script>
28
- import Alerta from "../layout/Alerta.vue";
29
- import { mapState, mapMutations } from "vuex";
30
-
31
- export default {
32
- components: { Alerta },
33
- name: "Mensagem",
34
- data() {
35
- return {
36
- maximoSegundos: 10,
37
- contagemRegressiva: 10,
38
- notificacaoArmazenada: [],
39
- };
40
- },
41
- computed: {
42
- ...mapState("generic", ["notificacoes", "modal"]),
43
- },
44
- watch: {
45
- notificacoes() {
46
- if (this.notificacoes.length > 0) {
47
- this.notificacaoArmazenada = this.notificacoes;
48
- this.contagemRegressiva = 5;
49
- }
50
- },
51
- contagemRegressiva() {
52
- if (this.contagemRegressiva === 0) {
53
- this.notificacaoArmazenada = [];
54
- this.removeNotificacao();
55
- }
56
- },
57
- },
58
- methods: {
59
- ...mapMutations("generic", ["removeNotificacao"]),
60
- contagemRegressivaAlterada(contagemRegressiva) {
61
- this.contagemRegressiva = contagemRegressiva;
62
- },
63
- mensagens(notificacoes) {
64
- var mensagem = "";
65
- notificacoes.forEach(function (notificacao) {
66
- mensagem += notificacao.mensagem + " ";
67
- });
68
-
69
- return mensagem;
70
- },
71
- },
72
- };
73
- </script>
74
- <style scoped>
75
- .div-mensagem {
76
- margin-top: 15px;
77
- }
78
-
79
- .div-mensagem-modal {
80
- margin-bottom: 5px;
81
- }
82
-
83
- .invalido {
84
- color: #f0134d;
85
- }
86
- </style>
@@ -1,116 +0,0 @@
1
- <template>
2
- <div>
3
- <b-row>
4
- <b-col sm="6">
5
- <BarraRolagem :alturaMinima="200" :alturaMaxima="250">
6
- <div class="div-opcoes">
7
- <CheckboxMultiplo
8
- :empilhado="true"
9
- :valorInicial="opcoes.valorInicial"
10
- :opcoes="opcoes.opcoes"
11
- v-model="campoSelecionado"
12
- />
13
- </div>
14
- </BarraRolagem>
15
- </b-col>
16
- <b-col sm="6">
17
- <Opcoes
18
- :opcoes="[
19
- { text: 'Crescente', value: 'asc' },
20
- { text: 'Decrescente', value: 'desc' },
21
- ]"
22
- v-model="ordenar"
23
- />
24
- <EscolherEstatico
25
- titulo="Ordenar"
26
- campoAlvo="ordenar"
27
- :valorInicial="valorInicial"
28
- :dados="ordenacao"
29
- v-model="campoOrdenado"
30
- />
31
- </b-col>
32
- </b-row>
33
- </div>
34
- </template>
35
- <script>
36
- import EscolherEstatico from "@nixweb/nixloc-ui/src/component/forms/EscolherEstatico";
37
- import Opcoes from "@nixweb/nixloc-ui/src/component/forms/Opcoes";
38
- import CheckboxMultiplo from "@nixweb/nixloc-ui/src/component/forms/CheckboxMultiplo";
39
- import BarraRolagem from "@nixweb/nixloc-ui/src/component/layout/BarraRolagem.vue";
40
-
41
- import { mapMutations, mapGetters } from "vuex";
42
-
43
- export default {
44
- name: "CampoRelatorio",
45
- components: {
46
- CheckboxMultiplo,
47
- EscolherEstatico,
48
- BarraRolagem,
49
- Opcoes,
50
- },
51
- data() {
52
- return {
53
- ordenar: "asc",
54
- valorInicial: {},
55
- };
56
- },
57
- created() {
58
- this.valorInicial = this.ordenacao[0];
59
- let obj = {
60
- conteudo: this.valorInicial.conteudo,
61
- id: this.valorInicial.id,
62
- ordenar: this.ordenar,
63
- };
64
- this.atualizaCampoOrdenado(obj);
65
- },
66
- computed: {
67
- ...mapGetters("relatorio", ["opcoes"]),
68
- campoSelecionado: {
69
- get() {
70
- return this.$store.state.relatorio.campoSelecionado;
71
- },
72
- set(value) {
73
- this.atualizaCampoSelecionado(value);
74
- },
75
- },
76
- campoOrdenado: {
77
- get() {
78
- return this.$store.state.relatorio.campoOrdenado;
79
- },
80
- set(value) {
81
- let obj = { conteudo: value.conteudo, id: value.id, ordenar: this.ordenar };
82
- this.atualizaCampoOrdenado(obj);
83
- },
84
- },
85
- ordenacao() {
86
- let ordenacao = [];
87
- this.opcoes.opcoes.forEach((opcao) => {
88
- let obj = { conteudo: opcao.text, id: opcao.value };
89
- ordenacao.push(obj);
90
- });
91
- return ordenacao;
92
- },
93
- },
94
- methods: {
95
- ...mapMutations("relatorio", ["atualizaCampoSelecionado", "atualizaCampoOrdenado"]),
96
- },
97
- watch: {
98
- ordenar: {
99
- handler(value) {
100
- let obj = {
101
- conteudo: this.campoOrdenado.conteudo,
102
- id: this.campoOrdenado.id,
103
- ordenar: this.ordenar,
104
- };
105
- this.atualizaCampoOrdenado(obj);
106
- },
107
- deep: true,
108
- },
109
- },
110
- };
111
- </script>
112
- <style scoped>
113
- .div-opcoes {
114
- margin-left: 10px;
115
- }
116
- </style>
@@ -1,77 +0,0 @@
1
- export default class ConverteParaOdata {
2
- converteFiltro(query) {
3
- let campo = query.rule;
4
- let valor = query.value;
5
- let tipo = query.tipo;
6
- let label = query.label;
7
-
8
- if (query.operator === "igual") return `${campo} eq '${valor}'`;
9
- if (query.operator === "diferente") return `${campo} ne '${valor}'`;
10
- if (query.operator === "contem") return `contains(${campo},'${valor}')`;
11
- if (query.operator === "periodo") return this.convertePeriodo(valor);
12
- if (query.operator === "escolher") return this.converteEscolher(campo, valor);
13
- if (query.operator === "checkbox") return this.converteCheckbox(campo, valor, tipo, label);
14
- if (query.operator === "=") return `${campo} eq ${valor}`;
15
- if (query.operator === "!=") return `${campo} ne ${valor}`;
16
- if (query.operator === "<") return `${campo} lt ${valor}`;
17
- if (query.operator === "<=") return `${campo} le ${valor}`;
18
- if (query.operator === ">") return `${campo} gt ${valor}`;
19
- if (query.operator === ">=") return `${campo} ge ${valor}`;
20
- }
21
- convertePeriodo(valor) {
22
- let inicio = this.converteData(valor[0]);
23
- let fim = this.converteData(valor[1]);
24
- return `data ge ${inicio} and data le ${fim}`;
25
- }
26
- converteEscolher(campo, valor) {
27
- return `${campo} eq '${valor.id}'`;
28
- }
29
- converteCheckbox(campo, valor, tipo, label) {
30
- let consulta = "";
31
- let sequencia = 0;
32
- var tamanho = valor.length;
33
- let self = this;
34
- valor.forEach(function (value) {
35
- if (tipo == "campo") {
36
- consulta += `${campo} eq ${value}`;
37
- if (sequencia + 1 != tamanho) consulta += ` or `;
38
- }
39
- if (tipo == "resumo") {
40
- let nome = self.converteNome(value);
41
- consulta += `${campo} with ${value} as ${nome}${label}`;
42
- if (sequencia + 1 != tamanho) consulta += `,`;
43
- }
44
- sequencia++;
45
- });
46
-
47
- if (tamanho > 1 && tipo == "campo") return `(${consulta})`;
48
- return `${consulta}`;
49
- }
50
- converteData(data) {
51
- let str = data.replace("/", "").replace("/", "");
52
-
53
- let date = {
54
- dia: str.substr(0, 2),
55
- mes: str.substr(2, 2),
56
- ano: str.substr(4, 4),
57
- };
58
-
59
- var iso = date.ano + "-" + date.mes + "-" + date.dia;
60
-
61
- /*
62
- iso += date.dia + "T";
63
- iso += "00:00:00.000Z";
64
- iso += d.getHours().toString().padStart(2, "0") + ":";
65
- iso += d.getMinutes().toString().padStart(2, "0") + ":";
66
- iso += d.getSeconds().toString().padStart(2, "0");
67
- */
68
-
69
- return iso;
70
- }
71
- converteNome(value) {
72
- if (value === "sum") return "soma";
73
- if (value === "average") return "media";
74
- if (value === "max") return "maximo";
75
- if (value === "minimo") return "minimo";
76
- }
77
- }
@@ -1,164 +0,0 @@
1
- <template>
2
- <div class="vue-query-builder">
3
- <slot v-bind="vqbProps">
4
- <query-builder-group v-bind="vqbProps" :query.sync="query" />
5
- </slot>
6
- </div>
7
- </template>
8
-
9
- <script>
10
- /* eslint-disable vue/require-default-prop */
11
- import QueryBuilderGroup from "./layouts/Bootstrap/BootstrapGroup.vue";
12
- import deepClone from "./utilities.js";
13
-
14
- var defaultLabels = {
15
- matchType: "Construtor de Consulta",
16
- matchTypes: [
17
- { id: "all", label: "All" },
18
- { id: "any", label: "Any" },
19
- ],
20
- addRule: "+ Adicionar",
21
- removeRule: "&times;",
22
- addGroup: "+ Adicionar",
23
- removeGroup: "&times;",
24
- textInputPlaceholder: "Valor",
25
- };
26
-
27
- export default {
28
- name: "VueQueryBuilder",
29
-
30
- components: {
31
- QueryBuilderGroup,
32
- },
33
-
34
- props: {
35
- rules: Array,
36
- labels: {
37
- type: Object,
38
- default() {
39
- return defaultLabels;
40
- },
41
- },
42
- maxDepth: {
43
- type: Number,
44
- default: 3,
45
- validator: function (value) {
46
- return value >= 1;
47
- },
48
- },
49
- value: Object,
50
- },
51
-
52
- data() {
53
- return {
54
- query: {
55
- logicalOperator: this.labels.matchTypes[0].id,
56
- children: [],
57
- },
58
- ruleTypes: {
59
- text: {
60
- operators: ["igual", "diferente", "contem"],
61
- inputType: "text",
62
- id: "text-field",
63
- },
64
- numeric: {
65
- operators: ["=", "!=", "<", "<=", ">", ">="],
66
- inputType: "number",
67
- id: "number-field",
68
- },
69
- custom: {
70
- operators: [],
71
- inputType: "text",
72
- id: "custom-field",
73
- },
74
- radio: {
75
- operators: [],
76
- choices: [],
77
- inputType: "radio",
78
- id: "radio-field",
79
- },
80
- checkbox: {
81
- operators: ["checkbox"],
82
- choices: [],
83
- inputType: "checkbox",
84
- id: "checkbox-field",
85
- },
86
- select: {
87
- operators: [],
88
- choices: [],
89
- inputType: "select",
90
- id: "select-field",
91
- },
92
- "multi-select": {
93
- operators: ["="],
94
- choices: [],
95
- inputType: "select",
96
- id: "multi-select-field",
97
- },
98
- },
99
- };
100
- },
101
-
102
- computed: {
103
- mergedLabels() {
104
- return Object.assign({}, defaultLabels, this.labels);
105
- },
106
-
107
- mergedRules() {
108
- var mergedRules = [];
109
- var vm = this;
110
-
111
- vm.rules.forEach(function (rule) {
112
- if (typeof vm.ruleTypes[rule.type] !== "undefined") {
113
- mergedRules.push(Object.assign({}, vm.ruleTypes[rule.type], rule));
114
- } else {
115
- mergedRules.push(rule);
116
- }
117
- });
118
-
119
- return mergedRules;
120
- },
121
-
122
- vqbProps() {
123
- return {
124
- index: 0,
125
- depth: 1,
126
- maxDepth: this.maxDepth,
127
- ruleTypes: this.ruleTypes,
128
- rules: this.mergedRules,
129
- labels: this.mergedLabels,
130
- };
131
- },
132
- },
133
-
134
- mounted() {
135
- this.$watch(
136
- "query",
137
- (newQuery) => {
138
- if (JSON.stringify(newQuery) !== JSON.stringify(this.value)) {
139
- this.$emit("input", deepClone(newQuery));
140
- }
141
- },
142
- {
143
- deep: true,
144
- }
145
- );
146
-
147
- this.$watch(
148
- "value",
149
- (newValue) => {
150
- if (JSON.stringify(newValue) !== JSON.stringify(this.query)) {
151
- this.query = deepClone(newValue);
152
- }
153
- },
154
- {
155
- deep: true,
156
- }
157
- );
158
-
159
- if (typeof this.$options.propsData.value !== "undefined") {
160
- this.query = Object.assign(this.query, this.$options.propsData.value);
161
- }
162
- },
163
- };
164
- </script>