@nixweb/nixloc-ui 0.0.119 → 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 (122) hide show
  1. package/docs/src/component/template/ModeloRelatorioView.drawio +160 -0
  2. package/docs/src/store/modulos/relatorio.drawio +37 -0
  3. package/package.json +77 -75
  4. package/public/index.html +2 -4
  5. package/public/styles/app.css +1 -2
  6. package/src/component/forms/{Botao.vue → Button.vue} +53 -57
  7. package/src/component/forms/CheckboxGroup.vue +63 -0
  8. package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +6 -6
  9. package/src/component/forms/{Cor.vue → Color.vue} +9 -9
  10. package/src/component/forms/DateTime.vue +53 -53
  11. package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
  12. package/src/component/forms/EditorHtml.vue +123 -0
  13. package/src/component/forms/FileUpload.vue +189 -0
  14. package/src/component/forms/InputDecimal.vue +137 -0
  15. package/src/component/forms/InputNumber.vue +149 -0
  16. package/src/component/forms/InputPassword.vue +135 -0
  17. package/src/component/forms/InputText.vue +157 -0
  18. package/src/component/forms/Modal.vue +15 -15
  19. package/src/component/forms/RadioGroup.vue +50 -0
  20. package/src/component/forms/Select.vue +337 -0
  21. package/src/component/forms/SelectStatic.vue +120 -0
  22. package/src/component/forms/TextArea.vue +126 -0
  23. package/src/component/forms/Toggle.vue +13 -13
  24. package/src/component/layout/{Conta.vue → Account.vue} +28 -28
  25. package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
  26. package/src/component/layout/Badge.vue +23 -23
  27. package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
  28. package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
  29. package/src/component/layout/Menu.vue +66 -66
  30. package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
  31. package/src/component/layout/Panel.vue +142 -0
  32. package/src/component/layout/Popover.vue +1 -1
  33. package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
  34. package/src/component/layout/Tag.vue +9 -9
  35. package/src/component/layout/Topo.vue +1 -1
  36. package/src/component/layout/Wizard.vue +3 -3
  37. package/src/component/shared/BotaoCarregarMais.vue +9 -9
  38. package/src/component/shared/BotaoConsulta.vue +9 -9
  39. package/src/component/shared/CabecalhoImpressao.vue +6 -6
  40. package/src/component/shared/CodigoEditor.vue +16 -16
  41. package/src/component/shared/Confirmacao.vue +28 -28
  42. package/src/component/shared/Dica.vue +10 -10
  43. package/src/component/shared/DocumentoEditor.vue +3 -3
  44. package/src/component/shared/DocumentoPreview.vue +2 -2
  45. package/src/component/shared/EsconderMostrar.vue +26 -26
  46. package/src/component/shared/ExportarExcel.vue +14 -14
  47. package/src/component/shared/ExportarPDF.vue +10 -10
  48. package/src/component/shared/FiltroHorizontal.vue +19 -19
  49. package/src/component/shared/LegendaParametro.vue +17 -17
  50. package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
  51. package/src/component/shared/Messages.vue +83 -0
  52. package/src/component/shared/Paginacao.vue +10 -10
  53. package/src/component/shared/Progresso.vue +2 -2
  54. package/src/component/shared/Registro.vue +2 -2
  55. package/src/component/shared/ResumoTabela.vue +6 -6
  56. package/src/component/shared/SalvarCancelar.vue +26 -26
  57. package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
  58. package/src/component/shared/Tabela.vue +49 -49
  59. package/src/component/shared/TabelaBotao.vue +13 -13
  60. package/src/component/shared/Toast.vue +7 -7
  61. package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
  62. package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
  63. package/src/component/shared/construtor-consulta/Campo.vue +127 -0
  64. package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
  65. package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
  66. package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
  67. package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
  68. package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
  69. package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
  70. package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
  71. package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
  72. package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
  73. package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
  74. package/src/component/template/ModeloDocumentoView.vue +79 -79
  75. package/src/component/template/ModeloLista.vue +66 -66
  76. package/src/component/template/ModeloRelatorioListaView.vue +71 -68
  77. package/src/component/template/ModeloRelatorioView.vue +218 -200
  78. package/src/component/template/ModeloSubView.vue +13 -13
  79. package/src/component/template/ModeloView.vue +17 -17
  80. package/src/component/template/Relatorio.js +1 -5
  81. package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
  82. package/src/component/value-objects/DadosContato.vue +27 -27
  83. package/src/component/value-objects/DadosPessoa.js +1 -1
  84. package/src/component/value-objects/DadosPessoa.vue +52 -52
  85. package/src/component/value-objects/Endereco.js +1 -1
  86. package/src/component/value-objects/Endereco.vue +83 -83
  87. package/src/config/dicas.js +1 -1
  88. package/src/config/token.js +2 -2
  89. package/src/store/modules/generic.js +489 -0
  90. package/src/store/modules/report.js +246 -0
  91. package/src/store/modules/user.js +38 -0
  92. package/src/store/modules/validation.js +39 -0
  93. package/src/store/store.js +4 -4
  94. package/public/js/menu.js +0 -11
  95. package/public/styles/menu.css +0 -1399
  96. package/src/component/forms/ArquivoUpload.vue +0 -199
  97. package/src/component/forms/CheckboxMultiplo.vue +0 -63
  98. package/src/component/forms/Decimal.vue +0 -137
  99. package/src/component/forms/Escolher.vue +0 -324
  100. package/src/component/forms/EscolherEstatico.vue +0 -139
  101. package/src/component/forms/Numero.vue +0 -153
  102. package/src/component/forms/Opcoes.vue +0 -51
  103. package/src/component/forms/Senha.vue +0 -139
  104. package/src/component/forms/Texto.vue +0 -161
  105. package/src/component/forms/TextoArea.vue +0 -126
  106. package/src/component/forms/TextoEditor.vue +0 -123
  107. package/src/component/layout/Painel.vue +0 -142
  108. package/src/component/shared/Mensagem.vue +0 -86
  109. package/src/component/shared/query-builder/Campo.vue +0 -116
  110. package/src/component/shared/query-builder/ConverteParaOdata.js +0 -73
  111. package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
  112. package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
  113. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
  114. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
  115. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
  116. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
  117. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -171
  118. package/src/component/shared/query-builder/main.js +0 -81
  119. package/src/store/modulos/generic.js +0 -494
  120. package/src/store/modulos/relatorio.js +0 -201
  121. package/src/store/modulos/usuario.js +0 -38
  122. package/src/store/modulos/validation.js +0 -39
@@ -1,139 +0,0 @@
1
- <template>
2
- <div>
3
- <label>
4
- <span class="titulo">{{ titulo }}</span>
5
- </label>
6
- <div class="selecione" :class="{ borda: mostrarBorda }">
7
- <multiselect
8
- @open="aoAbrir"
9
- @select="aoSelecionar"
10
- @search-change="aoPesquisar"
11
- :options="dados"
12
- v-model.trim="valorAtual"
13
- :custom-label="rotulo"
14
- :disabled="desabilitado"
15
- placeholder
16
- :showLabels="true"
17
- :noResult="false"
18
- ref="multiselect"
19
- selectLabel
20
- deselectLabel
21
- selectedLabel
22
- >
23
- <div slot="beforeList">
24
- <div class="antes-lista">
25
- <!-- <b-button
26
- size="sm"
27
- variant="outline-danger"
28
- @click="limpaEscolherEstatico"
29
- v-tooltip.top-center="'Limpar'"
30
- >
31
- <font-awesome-icon icon="broom" />
32
- </b-button> -->
33
- <!-- <Botao
34
- chave="limpaEscolherEstatico"
35
- tipo="alerta"
36
- classeIcone="fas fa-broom"
37
- tamanho="pequeno"
38
- :clique="limpaEscolherEstatico"
39
- />-->
40
- </div>
41
- </div>
42
- </multiselect>
43
- </div>
44
- </div>
45
- </template>
46
- <script>
47
- import Multiselect from "vue-multiselect";
48
- import Botao from "./Botao";
49
-
50
- import { mapMutations } from "vuex";
51
-
52
- export default {
53
- name: "EscolherEstatico",
54
- props: {
55
- titulo: String,
56
- formNome: String,
57
- campoAlvo: String,
58
- valorInicial: Object,
59
- desabilitado: {
60
- type: Boolean,
61
- default: false,
62
- },
63
- somenteConsulta: {
64
- type: Boolean,
65
- default: false,
66
- },
67
- mostrarBorda: {
68
- type: Boolean,
69
- default: true,
70
- },
71
- dados: Array,
72
- value: Object,
73
- },
74
- components: {
75
- Multiselect,
76
- Botao,
77
- },
78
- data() {
79
- return {
80
- valorAtual: this.valorInicial,
81
- };
82
- },
83
- mounted() {
84
- let el = this.$el.getElementsByClassName("multiselect")[0];
85
- if (el) {
86
- el.tabIndex = 0;
87
- }
88
- },
89
- methods: {
90
- ...mapMutations("generic", ["insereFiltro", "removeCarregando"]),
91
- aoAbrir() {},
92
- aoSelecionar(value) {
93
- this.$emit("input", value);
94
- let obj = { campoAlvo: this.campoAlvo, valor: value.id };
95
- if (!this.somenteConsulta) this.insereFiltro(obj);
96
- },
97
- aoPesquisar(value) {},
98
- rotulo(value) {
99
- return `${value.conteudo}`;
100
- },
101
- limpaEscolherEstatico() {
102
- let objLimpo = { conteudo: "", id: "" };
103
- this.valorAtual = objLimpo;
104
- this.$emit("input", objLimpo);
105
- this.$refs.multiselect.deactivate();
106
- this.removeCarregando(["limpaEscolherEstatico"]);
107
-
108
- if (this.campoAlvo) {
109
- let obj = { campoAlvo: this.campoAlvo, valor: "" };
110
- this.insereFiltro(obj);
111
- }
112
- },
113
- },
114
- watch: {
115
- "value.id": function () {
116
- this.valorAtual = { id: this.value.id, conteudo: this.value.conteudo };
117
- },
118
- "valorInicial.id": function () {
119
- this.valorAtual = { id: this.value.id, conteudo: this.value.conteudo };
120
- },
121
- },
122
- };
123
- </script>
124
-
125
- <style scoped>
126
- div.antes-lista {
127
- padding: 8px;
128
- }
129
-
130
- .selecione {
131
- height: 38px;
132
- border-radius: 5px !important;
133
- margin-bottom: 20px;
134
- }
135
-
136
- .borda {
137
- border: 1px solid #dbdee0 !important;
138
- }
139
- </style>
@@ -1,153 +0,0 @@
1
- <template>
2
- <div class="form-group">
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
- <slot v-else></slot>
14
- <input
15
- class="form-control"
16
- type="number"
17
- v-model="valor"
18
- @keyup.enter.prevent="apertouEnter"
19
- />
20
- </div>
21
-
22
- <div v-if="formSujo">
23
- <div v-for="mensagem in notificacoes" :key="mensagem">
24
- <span class="invalido">{{ mensagem }}</span>
25
- </div>
26
- </div>
27
- </div>
28
- </template>
29
-
30
- <script>
31
- import Dica from "../shared/Dica.vue";
32
-
33
- import { mapState, mapMutations } from "vuex";
34
-
35
- export default {
36
- name: "Numero",
37
- components: { Dica },
38
- props: {
39
- titulo: String,
40
- campo: String,
41
- placeholder: String,
42
- desabilitado: Boolean,
43
- formNome: String,
44
- requerido: Boolean,
45
- tamanhoMaximo: Number,
46
- tipo: {
47
- type: String,
48
- default: "float",
49
- },
50
- marcarFormSujo: {
51
- type: Boolean,
52
- default: true,
53
- },
54
- value: Number,
55
- alterou: Function,
56
- enter: Function,
57
- },
58
- data() {
59
- return {
60
- notificacoes: [],
61
- formSujo: false,
62
- valor: 0,
63
- precision: 1,
64
- };
65
- },
66
- created() {
67
- // não carregar as validações iniciais para number
68
- this.valor = this.value;
69
- },
70
-
71
- methods: {
72
- ...mapMutations("validation", [
73
- "insereValidacao",
74
- "removeValidacao",
75
- "insereFormSujo",
76
- ]),
77
- valida() {
78
- this.notificacoes = [];
79
- if (this.value == 0) return;
80
- if (this.requerido && !this.value) {
81
- var mensagem = `${this.titulo} não pode ser vazio!`;
82
- this.notificacoes.push(mensagem);
83
- }
84
-
85
- if (this.valor.toString().length > this.tamanhoMaximo) {
86
- var mensagem = `Valor inválido!`;
87
- this.notificacoes.push(mensagem);
88
- }
89
- },
90
- apertouEnter() {
91
- if (this.enter) this.enter();
92
- },
93
- },
94
- computed: {
95
- ...mapState("validation", ["reiniciaForm"]),
96
- },
97
- watch: {
98
- value() {
99
- this.valor = this.value;
100
- if (this.alterou) this.alterou();
101
- },
102
- valor() {
103
- this.valida();
104
-
105
- let valor;
106
- if (this.tipo === "int") valor = parseInt(this.valor);
107
- if (this.tipo === "float") valor = parseFloat(this.valor);
108
-
109
- this.$emit("input", valor);
110
- this.formSujo = true;
111
- if (this.marcarFormSujo) this.insereFormSujo(true);
112
-
113
- this.valor = valor;
114
- },
115
- notificacoes() {
116
- let self = this;
117
- this.notificacoes.forEach(function (notificacao) {
118
- let obj = {
119
- chave: self.campo + "&" + self.formNome,
120
- formNome: self.formNome,
121
- notificacao: notificacao,
122
- };
123
- self.insereValidacao(obj);
124
- });
125
-
126
- if (this.notificacoes.length == 0) {
127
- let obj = {
128
- chave: self.campo + "&" + self.formNome,
129
- formNome: self.formNome,
130
- };
131
- self.removeValidacao(obj);
132
- }
133
- },
134
- reiniciaForm: {
135
- handler(form) {
136
- if (form.nome == this.formNome) this.formSujo = false;
137
- },
138
- deep: true,
139
- },
140
- },
141
- };
142
- </script>
143
-
144
- <style scoped>
145
- .sucesso {
146
- color: #94aa2a;
147
- font-size: 14px;
148
- }
149
- .invalido {
150
- color: #f0134d;
151
- font-size: 14px;
152
- }
153
- </style>
@@ -1,51 +0,0 @@
1
- <template>
2
- <div>
3
- <span class="titulo">{{ titulo }}</span>
4
- <Dica :campo="campo" :formNome="formNome" />
5
- <div class="opcoes">
6
- <b-form-group>
7
- <b-form-radio-group
8
- v-model="selecionado"
9
- :options="opcoes"
10
- :disabled="desabilitado"
11
- ></b-form-radio-group>
12
- </b-form-group>
13
- </div>
14
- </div>
15
- </template>
16
-
17
- <script>
18
- import Dica from "../shared/Dica.vue";
19
-
20
- import { mapState, mapMutations } from "vuex";
21
-
22
- export default {
23
- components: { Dica },
24
- name: "Opcoes",
25
- props: ["titulo", "opcoes", "value", "alterou", "campo", "formNome", "desabilitado"],
26
- data() {
27
- return {
28
- selecionado: this.value,
29
- };
30
- },
31
- methods: {
32
- ...mapMutations("validation", ["insereFormSujo"]),
33
- },
34
- watch: {
35
- value() {
36
- this.selecionado = this.value;
37
- },
38
- selecionado() {
39
- this.$emit("input", this.selecionado);
40
- this.insereFormSujo(true);
41
- if (this.alterou) this.alterou();
42
- },
43
- },
44
- };
45
- </script>
46
- <style scoped>
47
- .opcoes {
48
- margin-top: 5px;
49
- }
50
-
51
- </style>
@@ -1,139 +0,0 @@
1
- <template>
2
- <div class="form-group">
3
- <label>
4
- <span class="titulo" :style="'color: ' + corTitulo">{{ 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
- <slot v-else></slot>
14
- <input
15
- type="password"
16
- :placeholder="placeholder"
17
- v-mask="mascara || semMascara"
18
- v-bind:value="value"
19
- v-on:input="$emit('input', $event.target.value)"
20
- class="form-control"
21
- :class="{ requerido: notificacoes.length > 0 && formSujo }"
22
- />
23
- </div>
24
- <div v-if="formSujo">
25
- <div v-for="mensagem in notificacoes" :key="mensagem">
26
- <span class="invalido">{{ mensagem }}</span>
27
- </div>
28
- </div>
29
- </div>
30
- </template>
31
-
32
- <script>
33
- import Dica from "../shared/Dica.vue";
34
- import { mapState, mapMutations } from "vuex";
35
-
36
- export default {
37
- components: { Dica },
38
- name: "Senha",
39
- mixins: [],
40
- props: [
41
- "titulo",
42
- "campo",
43
- "corTitulo",
44
- "placeholder",
45
- "mascara",
46
- "formNome",
47
- "requerido",
48
- "tamanhoMaximo",
49
- "value",
50
- ],
51
- data() {
52
- return {
53
- notificacoes: [],
54
- formSujo: false,
55
- semMascara: {
56
- mask: "*".repeat(255),
57
- tokens: {
58
- "*": { pattern: /./ },
59
- },
60
- },
61
- };
62
- },
63
- created() {
64
- this.valida();
65
- },
66
- methods: {
67
- ...mapMutations("validation", [
68
- "insereValidacao",
69
- "removeValidacao",
70
- "insereFormSujo",
71
- ]),
72
- valida() {
73
- this.notificacoes = [];
74
-
75
- if (this.requerido && this.value.length == 0) {
76
- var mensagem = `${this.titulo} não pode ser vazio!`;
77
- this.notificacoes.push(mensagem);
78
- }
79
-
80
- if (this.tamanhoMaximo > 0) {
81
- if (this.value.length > this.tamanhoMaximo) {
82
- var mensagem = `Máximo de ${this.tamanhoMaximo} caracteres!`;
83
- this.notificacoes.push(mensagem);
84
- }
85
- }
86
- },
87
- },
88
- computed: {
89
- ...mapState("validation", ["reiniciaForm", "validacao"]),
90
- },
91
- watch: {
92
- value() {
93
- this.valida();
94
- this.formSujo = true;
95
- this.insereFormSujo(true);
96
- },
97
- notificacoes() {
98
- let self = this;
99
- this.notificacoes.forEach(function (notificacao) {
100
- let obj = {
101
- chave: self.campo + "&" + self.formNome,
102
- formNome: self.formNome,
103
- notificacao: notificacao,
104
- };
105
- self.insereValidacao(obj);
106
- });
107
-
108
- if (this.notificacoes.length == 0) {
109
- let obj = {
110
- chave: self.campo + "&" + self.formNome,
111
- formNome: self.formNome,
112
- };
113
- self.removeValidacao(obj);
114
- }
115
- },
116
- reiniciaForm: {
117
- handler(form) {
118
- if (form.nome == this.formNome) this.formSujo = false;
119
- },
120
- deep: true,
121
- },
122
- },
123
- };
124
- </script>
125
-
126
- <style scoped>
127
- .sucesso {
128
- color: #94aa2a;
129
- font-size: 14px;
130
- }
131
- .invalido {
132
- color: #f0134d;
133
- font-size: 14px;
134
- }
135
-
136
- .margem-botao {
137
- margin-top: -10px;
138
- }
139
- </style>
@@ -1,161 +0,0 @@
1
- <template>
2
- <div class="form-group">
3
- <label>
4
- <span class="titulo" :style="'color: ' + corTitulo">{{ 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
- <div class="requerido glyphicon" v-if="notificacoes.length > 0 && formSujo">
10
- <i class="fas fa-exclamation-triangle"></i>
11
- </div>
12
- <slot v-else></slot>
13
- <input
14
- type="text"
15
- :style="estilo"
16
- :placeholder="placeholder"
17
- :disabled="desabilitado"
18
- @keyup.enter.prevent="apertouEnter"
19
- @keyup="limpouCampo"
20
- @blur="saiuCampo"
21
- v-mask="mascara || semMascara"
22
- v-bind:value="value"
23
- v-on:input="$emit('input', $event.target.value)"
24
- class="form-control"
25
- :class="{ requerido: notificacoes.length > 0 && formSujo }"
26
- />
27
- </div>
28
- <div v-if="formSujo">
29
- <div v-for="mensagem in notificacoes" :key="mensagem">
30
- <span class="invalido">{{ mensagem }}</span>
31
- </div>
32
- </div>
33
- </div>
34
- </template>
35
-
36
- <script>
37
- import Dica from "../shared/Dica.vue";
38
- import { mapState, mapMutations } from "vuex";
39
-
40
- export default {
41
- components: { Dica },
42
- name: "Texto",
43
- props: [
44
- "titulo",
45
- "campo",
46
- "placeholder",
47
- "desabilitado",
48
- "corTitulo",
49
- "mascara",
50
- "estilo",
51
- "formNome",
52
- "requerido",
53
- "tamanhoMaximo",
54
- "value",
55
- "enter",
56
- "limpou",
57
- "saiu",
58
- "marcarFormSujo",
59
- ],
60
- data() {
61
- return {
62
- notificacoes: [],
63
- formSujo: false,
64
- semMascara: {
65
- mask: "*".repeat(255),
66
- tokens: {
67
- "*": { pattern: /./ },
68
- },
69
- },
70
- };
71
- },
72
- created() {
73
- this.valida();
74
- },
75
- methods: {
76
- ...mapMutations("validation", [
77
- "insereValidacao",
78
- "removeValidacao",
79
- "insereFormSujo",
80
- ]),
81
- valida() {
82
- this.notificacoes = [];
83
-
84
- if (this.requerido && this.value.length == 0) {
85
- var mensagem = `${this.titulo} não pode ser vazio!`;
86
- this.notificacoes.push(mensagem);
87
- }
88
-
89
- if (this.tamanhoMaximo > 0) {
90
- if (this.value.length > this.tamanhoMaximo) {
91
- var mensagem = `Máximo de ${this.tamanhoMaximo} caracteres!`;
92
- this.notificacoes.push(mensagem);
93
- }
94
- }
95
- },
96
- apertouEnter() {
97
- if (this.enter) this.enter();
98
- },
99
- saiuCampo() {
100
- if (this.saiu) this.saiu();
101
- },
102
- limpouCampo() {
103
- if (this.value.length == 0) {
104
- if (this.limpou) this.limpou();
105
- }
106
- },
107
- },
108
- computed: {
109
- ...mapState("validation", ["reiniciaForm", "validacao"]),
110
- },
111
- watch: {
112
- value() {
113
- this.valida();
114
- this.formSujo = true;
115
- // inverti a validação devido não colocar o default como true no props
116
- var valor = this.marcarFormSujo == undefined ? true : this.marcarFormSujo;
117
- if (valor) this.insereFormSujo(true);
118
- },
119
- notificacoes() {
120
- let self = this;
121
- this.notificacoes.forEach(function (notificacao) {
122
- let obj = {
123
- chave: self.campo + "&" + self.formNome,
124
- formNome: self.formNome,
125
- notificacao: notificacao,
126
- };
127
- self.insereValidacao(obj);
128
- });
129
-
130
- if (this.notificacoes.length == 0) {
131
- let obj = {
132
- chave: self.campo + "&" + self.formNome,
133
- formNome: self.formNome,
134
- };
135
- self.removeValidacao(obj);
136
- }
137
- },
138
- reiniciaForm: {
139
- handler(form) {
140
- if (form.nome == this.formNome) this.formSujo = false;
141
- },
142
- deep: true,
143
- },
144
- },
145
- };
146
- </script>
147
-
148
- <style scoped>
149
- .sucesso {
150
- color: #94aa2a;
151
- font-size: 14px;
152
- }
153
- .invalido {
154
- color: #f0134d;
155
- font-size: 14px;
156
- }
157
-
158
- .margem-botao {
159
- margin-top: -3px;
160
- }
161
- </style>