@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,8 +1,8 @@
1
1
  <template>
2
2
  <div class="form-group">
3
3
  <div>
4
- <span class="titulo">{{ titulo }} </span>
5
- <compact-picker v-model.trim="cor.hex" />
4
+ <span class="title">{{ title }} </span>
5
+ <compact-picker v-model.trim="color.hex" />
6
6
  </div>
7
7
  </div>
8
8
  </template>
@@ -11,26 +11,26 @@
11
11
  import { Chrome } from "vue-color";
12
12
 
13
13
  export default {
14
- name: "Cor",
14
+ name: "Color",
15
15
  components: {
16
16
  "compact-picker": Chrome,
17
17
  },
18
18
  props: {
19
- titulo: String,
20
- campo: String,
21
- formNome: String,
19
+ title: String,
20
+ field: String,
21
+ formName: String,
22
22
  value: String,
23
23
  },
24
24
  data() {
25
25
  return {
26
- cor: { hex: "#40BF84" },
26
+ color: { hex: "#40BF84" },
27
27
  };
28
28
  },
29
29
  watch: {
30
30
  value() {
31
- this.cor.hex = this.value;
31
+ this.color.hex = this.value;
32
32
  },
33
- "cor.hex": function (value) {
33
+ "color.hex": function (value) {
34
34
  if (value.hex) this.$emit("input", value.hex);
35
35
  },
36
36
  },
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <div class="form-group">
3
3
  <label>
4
- <span class="titulo">{{ titulo }} </span>
5
- <span class="requerido" v-if="requerido">*</span>
6
- <Dica :campo="campo" :formNome="formNome" />
4
+ <span class="title">{{ title }} </span>
5
+ <span class="required" v-if="required">*</span>
6
+ <Dica :field="field" :formName="formName" />
7
7
  </label>
8
8
  <div class="inner-addon right-addon">
9
9
  <i
10
- v-if="notificacoes.length > 0 && formSujo"
11
- class="requerido glyphicon fas fa-exclamation-triangle"
10
+ v-if="notifications.length > 0 && formDirty"
11
+ class="required glyphicon fas fa-exclamation-triangle"
12
12
  ></i>
13
13
  <date-picker
14
14
  lang="pt-br"
@@ -30,13 +30,13 @@
30
30
  :placeholder="placeholder"
31
31
  :type="type"
32
32
  v-model="valor"
33
- :class="{ 'is-invalid': notificacoes.length > 0 && formSujo }"
33
+ :class="{ 'is-invalid': notifications.length > 0 && formDirty }"
34
34
  ></date-picker>
35
35
  </div>
36
36
 
37
- <div v-if="formSujo">
38
- <div v-for="mensagem in notificacoes" :key="mensagem">
39
- <span class="invalido">{{ mensagem }}</span>
37
+ <div v-if="formDirty">
38
+ <div v-for="message in notifications" :key="message">
39
+ <span class="invalid">{{ message }}</span>
40
40
  </div>
41
41
  </div>
42
42
  </div>
@@ -53,12 +53,12 @@ export default {
53
53
  name: "Data",
54
54
  mixins: [],
55
55
  props: [
56
- "titulo",
57
- "campo",
58
- "campoAlvo",
56
+ "title",
57
+ "field",
58
+ "fieldTarget",
59
59
  "placeholder",
60
- "formNome",
61
- "requerido",
60
+ "formName",
61
+ "required",
62
62
  "format",
63
63
  "type",
64
64
  "value",
@@ -67,12 +67,12 @@ export default {
67
67
  "confirmText",
68
68
  ],
69
69
  /* props: {
70
- titulo: String,
71
- campo: String,
72
- campoAlvo: String,
70
+ title: String,
71
+ field: String,
72
+ fieldTarget: String,
73
73
  placeholder: String,
74
- formNome: String,
75
- requerido: Boolean,
74
+ formName: String,
75
+ required: Boolean,
76
76
  format: String,
77
77
  type: String,
78
78
  value: String,
@@ -82,82 +82,82 @@ export default {
82
82
  },*/
83
83
  data() {
84
84
  return {
85
- notificacoes: [],
86
- formSujo: false,
85
+ notifications: [],
86
+ formDirty: false,
87
87
  valor: "",
88
88
  };
89
89
  },
90
90
  created() {
91
- this.valida();
91
+ this.validate();
92
92
  this.valor = this.value;
93
93
  },
94
94
  methods: {
95
95
  ...mapMutations("validation", [
96
- "insereValidacao",
97
- "removeValidacao",
98
- "insereFormSujo",
96
+ "addValidation",
97
+ "removeValidation",
98
+ "addFormDirty",
99
99
  ]),
100
- ...mapMutations("generic", ["insereFiltro"]),
101
- valida() {
102
- this.notificacoes = [];
100
+ ...mapMutations("generic", ["addFilter"]),
101
+ validate() {
102
+ this.notifications = [];
103
103
 
104
- if (this.requerido && this.valor.length == 0) {
105
- var mensagem = `${this.titulo} não pode ser vazio!`;
106
- this.notificacoes.push(mensagem);
104
+ if (this.required && this.valor.length == 0) {
105
+ var message = `${this.title} não pode ser vazio!`;
106
+ this.notifications.push(message);
107
107
  }
108
108
  },
109
109
  confirma() {
110
110
  if (this.range) {
111
111
  let obj = {
112
- campoAlvo: this.campoAlvo,
112
+ fieldTarget: this.fieldTarget,
113
113
  valor: { inicio: this.valor[0], fim: this.valor[1] },
114
114
  };
115
- this.insereFiltro(obj);
115
+ this.addFilter(obj);
116
116
  }
117
117
  },
118
118
  fechar() {
119
119
  let obj = {
120
- campoAlvo: this.campoAlvo,
120
+ fieldTarget: this.fieldTarget,
121
121
  valor: { inicio: "", fim: "" },
122
122
  };
123
- this.insereFiltro(obj);
123
+ this.addFilter(obj);
124
124
  },
125
125
  },
126
126
  computed: {
127
- ...mapState("validation", ["reiniciaForm", "validacao"]),
127
+ ...mapState("validation", ["resetForm", "validations"]),
128
128
  },
129
129
  watch: {
130
130
  valor() {
131
- this.valida();
132
- this.formSujo = true;
133
- this.insereFormSujo(true);
131
+ this.validate();
132
+ this.formDirty = true;
133
+ this.addFormDirty(true);
134
134
  this.$emit("input", this.valor);
135
135
  },
136
136
  value() {
137
137
  this.valor = this.value;
138
138
  },
139
- notificacoes() {
139
+ notifications() {
140
140
  let self = this;
141
- this.notificacoes.forEach(function (notificacao) {
141
+ this.notifications.forEach(function (notification) {
142
142
  let obj = {
143
- chave: self.campo + "&" + self.formNome,
144
- formNome: self.formNome,
145
- notificacao: notificacao,
143
+ key: self.field + "&" + self.formName,
144
+ formName: self.formName,
145
+ notification: notification,
146
146
  };
147
- self.insereValidacao(obj);
147
+ self.addValidation(obj);
148
148
  });
149
149
 
150
- if (this.notificacoes.length == 0) {
150
+ if (this.notifications.length == 0) {
151
151
  let obj = {
152
- chave: self.campo + "&" + self.formNome,
153
- formNome: self.formNome,
152
+ key: self.field + "&" + self.formName,
153
+ formName: self.formName,
154
154
  };
155
- self.removeValidacao(obj);
155
+ self.removeValidation(obj);
156
156
  }
157
157
  },
158
- reiniciaForm: {
158
+ resetForm: {
159
159
  handler(form) {
160
- if (form.nome == this.formNome) this.formSujo = false;
160
+ if (form.nome == this.formName) this.formDirty = false;
161
161
  },
162
162
  deep: true,
163
163
  },
@@ -166,11 +166,11 @@ export default {
166
166
  </script>
167
167
 
168
168
  <style scoped>
169
- .sucesso {
169
+ .success {
170
170
  color: #94aa2a;
171
171
  font-size: 14px;
172
172
  }
173
- .invalido {
173
+ .invalid {
174
174
  color: #f0134d;
175
175
  font-size: 14px;
176
176
  }
@@ -4,81 +4,81 @@
4
4
  <button
5
5
  class="botao dropbtn"
6
6
  :class="{
7
- pequeno: tamanho === 'pequeno',
8
- medio: tamanho === 'medio',
9
- grande: tamanho === 'grande',
10
- primario: tipo === 'primario',
11
- sucesso: tipo === 'sucesso',
12
- alerta: tipo === 'alerta',
13
- info: tipo === 'info',
14
- editar: tipo === 'editar',
15
- perigo: tipo === 'perigo',
16
- desabilitado: desabilitado,
7
+ small: size === 'small',
8
+ medium: size === 'medium',
9
+ large: size === 'large',
10
+ primary: type === 'primary',
11
+ success: type === 'success',
12
+ warning: type === 'warning',
13
+ info: type === 'info',
14
+ edit: type === 'edit',
15
+ danger: type === 'danger',
16
+ disabled: disabled,
17
17
  }"
18
- :disabled="desabilitado"
18
+ :disabled="disabled"
19
19
  @click="mostrarEsconder()"
20
20
  >
21
- {{ titulo }} <i :class="classeIcone"></i>
21
+ {{ title }} <i :class="classIcon"></i>
22
22
  </button>
23
23
  <div
24
- v-show="mostrar"
24
+ v-show="show"
25
25
  class="text-left dropdown-content"
26
- @mouseleave="mostrar = false"
26
+ @mouseleave="show = false"
27
27
  >
28
- <Moldura>
29
- <div v-for="item in itens" :key="item.nomeEvento">
28
+ <Molded>
29
+ <div v-for="item in items" :key="item.nomeEvento">
30
30
  <div
31
31
  v-if="visivel(item.condicaoVisibilidade)"
32
- :style="item.estilo"
32
+ :style="item.style"
33
33
  class="item"
34
34
  @click="executar(item.nomeEvento)"
35
35
  >
36
- <i :class="item.classeIcone"></i>
37
- <span class="titulo"> {{ item.titulo }}</span>
36
+ <i :class="item.classIcon"></i>
37
+ <span class="title"> {{ item.title }}</span>
38
38
  </div>
39
39
  </div>
40
- </Moldura>
40
+ </Molded>
41
41
  </div>
42
42
  </div>
43
43
  </div>
44
44
  </template>
45
45
 
46
46
  <script>
47
- import Moldura from "../layout/Moldura.vue";
47
+ import Molded from "../layout/Molded.vue";
48
48
 
49
49
  import { mapMutations } from "vuex";
50
50
 
51
51
  export default {
52
- components: { Moldura },
53
- name: "Botao",
52
+ components: { Molded },
53
+ name: "Button",
54
54
  props: {
55
- titulo: String,
56
- tipo: String,
57
- classeIcone: String,
58
- tamanho: String,
59
- desabilitado: Boolean,
55
+ title: String,
56
+ type: String,
57
+ classIcon: String,
58
+ size: String,
59
+ disabled: Boolean,
60
60
  dadosEvento: Object,
61
- itens: Array,
61
+ items: Array,
62
62
  },
63
63
  data() {
64
64
  return {
65
- mostrar: false,
65
+ show: false,
66
66
  };
67
67
  },
68
68
  methods: {
69
- ...mapMutations("generic", ["insereEvento"]),
69
+ ...mapMutations("generic", ["addEvent"]),
70
70
  mostrarEsconder() {
71
- this.mostrar = this.mostrar ? false : true;
71
+ this.show = this.show ? false : true;
72
72
  },
73
73
  executar(nomeEvento) {
74
74
  this.mostrarEsconder();
75
- this.insereEvento({
75
+ this.addEvent({
76
76
  nome: nomeEvento,
77
- dados: this.dadosEvento,
77
+ data: this.dadosEvento,
78
78
  });
79
79
  },
80
80
  visivel(condicaoVisibilidade) {
81
- // se for undefined, quer dizer que não tem condicional, então pode mostrar
81
+ // se for undefined, quer dizer que não tem condicional, então pode show
82
82
  if (condicaoVisibilidade == undefined) return true;
83
83
 
84
84
  var verifica = `this.dadosEvento.${condicaoVisibilidade}`;
@@ -98,7 +98,7 @@ export default {
98
98
  background-color: #fafafc;
99
99
  }
100
100
 
101
- .titulo {
101
+ .title {
102
102
  padding-left: 5px;
103
103
  }
104
104
 
@@ -141,44 +141,44 @@ export default {
141
141
  box-shadow: 0px 10px 20px -6px rgb(0 0 0 / 12%);
142
142
  }
143
143
 
144
- .pequeno {
144
+ .small {
145
145
  padding: 5px 10px;
146
146
  font-size: 13px;
147
147
  }
148
148
 
149
- .medio {
149
+ .medium {
150
150
  padding: 7px 12px;
151
151
  font-size: 13px;
152
152
  }
153
153
 
154
- .grande {
154
+ .large {
155
155
  padding: 10px 15px;
156
156
  font-size: 14px;
157
157
  }
158
158
 
159
- .desabilitado {
159
+ .disabled {
160
160
  background: #bbbbbb !important;
161
161
  border-color: #bbbbbb !important;
162
162
  color: #fff;
163
163
  }
164
164
 
165
- .primario {
165
+ .primary {
166
166
  background: #577696;
167
167
  border-color: #577696;
168
168
  color: #fff;
169
169
  }
170
170
 
171
- .primario:hover {
171
+ .primary:hover {
172
172
  background: #355472;
173
173
  }
174
174
 
175
- .sucesso {
175
+ .success {
176
176
  color: #fff;
177
177
  background: #94aa2a;
178
178
  border-color: #94aa2a;
179
179
  }
180
180
 
181
- .sucesso:hover {
181
+ .success:hover {
182
182
  background: #6d7e1c;
183
183
  }
184
184
 
@@ -192,33 +192,33 @@ export default {
192
192
  background: #3e90b3;
193
193
  }
194
194
 
195
- .editar {
195
+ .edit {
196
196
  color: #fff;
197
197
  border-color: #7b7f83;
198
198
  background: #7b7f83;
199
199
  }
200
200
 
201
- .editar:hover {
201
+ .edit:hover {
202
202
  background: #595c5f;
203
203
  }
204
204
 
205
- .alerta {
205
+ .warning {
206
206
  color: #fff;
207
207
  border-color: #f1bc31;
208
208
  background: #f1bc31;
209
209
  }
210
210
 
211
- .alerta:hover {
211
+ .warning:hover {
212
212
  background: #a37d1b;
213
213
  }
214
214
 
215
- .perigo {
215
+ .danger {
216
216
  color: #fff;
217
217
  border-color: #f0134d;
218
218
  background: #f0134d;
219
219
  }
220
220
 
221
- .perigo:hover {
221
+ .danger:hover {
222
222
  background: #c70f40;
223
223
  }
224
224
  </style>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <div>
3
+ <label>
4
+ <span class="title">{{ title }}</span>
5
+ <span class="required" v-if="required">*</span>
6
+ <Dica :field="field" :formName="formName" />
7
+ </label>
8
+ <div class="inner-addon right-addon">
9
+ <i
10
+ v-if="notifications.length > 0 && formDirty"
11
+ class="required 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="formDirty">
17
+ <div v-for="message in notifications" :key="message">
18
+ <span class="invalid">{{ message }}</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: "EditorHtml",
33
+ mixins: [],
34
+ props: {
35
+ title: String,
36
+ field: String,
37
+ formName: String,
38
+ required: Boolean,
39
+ maxLength: Number,
40
+ value: String,
41
+ },
42
+ data() {
43
+ return {
44
+ notifications: [],
45
+ formDirty: 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.validate();
57
+ },
58
+ methods: {
59
+ ...mapMutations("validation", ["addValidation", "removeValidation"]),
60
+ validate() {
61
+ this.notifications = [];
62
+
63
+ if (this.required && this.value.length == 0) {
64
+ var message = `${this.title} não pode ser vazio!`;
65
+ this.notifications.push(message);
66
+ }
67
+
68
+ if (this.maxLength > 0) {
69
+ if (this.value.length > this.maxLength) {
70
+ var message = `Máximo de ${this.maxLength} caracteres!`;
71
+ this.notifications.push(message);
72
+ }
73
+ }
74
+ },
75
+ },
76
+ computed: {
77
+ ...mapState("validation", ["resetForm", "validations"]),
78
+ },
79
+ watch: {
80
+ value() {
81
+ this.validate();
82
+ this.formDirty = true;
83
+ this.$emit("input", this.value);
84
+ },
85
+ notifications() {
86
+ let self = this;
87
+ this.notifications.forEach(function (notification) {
88
+ let obj = {
89
+ key: self.field + "&" + self.formName,
90
+ formName: self.formName,
91
+ notification: notification,
92
+ };
93
+ self.addValidation(obj);
94
+ });
95
+
96
+ if (this.notifications.length == 0) {
97
+ let obj = {
98
+ key: self.field + "&" + self.formName,
99
+ formName: self.formName,
100
+ };
101
+ self.removeValidation(obj);
102
+ }
103
+ },
104
+ resetForm: {
105
+ handler(form) {
106
+ if (form.nome == this.formName) this.formDirty = false;
107
+ },
108
+ deep: true,
109
+ },
110
+ },
111
+ };
112
+ </script>
113
+
114
+ <style scoped>
115
+ .success {
116
+ color: #94aa2a;
117
+ font-size: 14px;
118
+ }
119
+ .invalid {
120
+ color: #f0134d;
121
+ font-size: 14px;
122
+ }
123
+ </style>