@nixweb/nixloc-ui 0.0.121 → 0.0.124

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 (135) hide show
  1. package/docs/src/component/template/ModeloRelatorioView.drawio +2 -2
  2. package/docs/src/store/modulos/relatorio.drawio +2 -2
  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} +8 -8
  8. package/src/component/forms/{Cor.vue → Color.vue} +9 -9
  9. package/src/component/forms/DateTime.vue +55 -55
  10. package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +58 -58
  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/{Topo.vue → Header.vue} +5 -5
  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 +15 -15
  35. package/src/component/layout/Wizard.vue +3 -3
  36. package/src/component/shared/{CodigoEditor.vue → CodeEditor.vue} +25 -25
  37. package/src/component/shared/Collapse.vue +131 -0
  38. package/src/component/shared/Confirmation.vue +80 -0
  39. package/src/component/shared/{DocumentoEditor.vue → DocumentEditor.vue} +10 -16
  40. package/src/component/shared/{DocumentoPreview.vue → DocumentPreview.vue} +2 -2
  41. package/src/component/shared/ExportExcel.vue +67 -0
  42. package/src/component/shared/{ExportarPDF.vue → ExportPDF.vue} +18 -18
  43. package/src/component/shared/HeaderPrint.vue +36 -0
  44. package/src/component/shared/HorizontalFilter.vue +59 -0
  45. package/src/component/shared/LegendaParametro.vue +22 -22
  46. package/src/component/shared/{Carregando.vue → Loading.vue} +16 -16
  47. package/src/component/shared/LoadingMoreButton.vue +23 -0
  48. package/src/component/shared/Messages.vue +83 -0
  49. package/src/component/shared/{Paginacao.vue → Pagination.vue} +12 -12
  50. package/src/component/shared/ProgressBar.vue +21 -0
  51. package/src/component/shared/{BotaoConsulta.vue → QueryButton.vue} +16 -16
  52. package/src/component/shared/SaveCancel.vue +56 -0
  53. package/src/component/shared/{Pesquisa.vue → Search.vue} +46 -46
  54. package/src/component/shared/Table.vue +243 -0
  55. package/src/component/shared/TableButton.vue +36 -0
  56. package/src/component/shared/{Registro.vue → TableTotalRecords.vue} +7 -7
  57. package/src/component/shared/{ResumoTabela.vue → TableTotalization.vue} +12 -8
  58. package/src/component/shared/Tip.vue +42 -0
  59. package/src/component/shared/Toast.vue +7 -7
  60. package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +24 -24
  61. package/src/component/shared/query-builder/AddRule.vue +187 -0
  62. package/src/component/shared/query-builder/ConvertToOdata.js +80 -0
  63. package/src/component/shared/query-builder/DynamicComponent.vue +107 -0
  64. package/src/component/shared/query-builder/Fields.vue +127 -0
  65. package/src/component/shared/query-builder/ListDynamicComponent.vue +42 -0
  66. package/src/component/shared/query-builder/QueryBuilder.vue +25 -120
  67. package/src/component/shared/query-builder/{Filtro.vue → Rules.vue} +13 -18
  68. package/src/component/shared/query-builder/SelectRule.vue +96 -0
  69. package/src/component/shared/query-builder/Tags.vue +14 -14
  70. package/src/component/shared/query-builder/{Rodape.vue → Totalization.vue} +10 -10
  71. package/src/component/template/AddEditReport.vue +106 -0
  72. package/src/component/template/ListViewWithHandlerData.vue +231 -0
  73. package/src/component/template/ViewTemplateConfiguration.vue +69 -0
  74. package/src/component/template/ViewTemplateDocumentView.vue +227 -0
  75. package/src/component/template/ViewTemplateReportList.vue +230 -0
  76. package/src/component/template/ViewTemplateReportPreview.vue +500 -0
  77. package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -0
  78. package/src/component/template/ViewTemplateWithTable.vue +49 -0
  79. package/src/component/template/model/Report.js +6 -0
  80. package/src/component/value-objects/DadosContato.vue +34 -35
  81. package/src/component/value-objects/DadosPessoa.vue +58 -58
  82. package/src/component/value-objects/Endereco.vue +96 -97
  83. package/src/config/dicas.js +1 -1
  84. package/src/config/token.js +2 -2
  85. package/src/store/modules/generic.js +489 -0
  86. package/src/store/modules/report.js +246 -0
  87. package/src/store/modules/user.js +38 -0
  88. package/src/store/modules/validation.js +39 -0
  89. package/src/store/store.js +4 -4
  90. package/src/component/forms/ArquivoUpload.vue +0 -199
  91. package/src/component/forms/CheckboxMultiplo.vue +0 -63
  92. package/src/component/forms/Decimal.vue +0 -137
  93. package/src/component/forms/Escolher.vue +0 -335
  94. package/src/component/forms/EscolherEstatico.vue +0 -139
  95. package/src/component/forms/Numero.vue +0 -153
  96. package/src/component/forms/Opcoes.vue +0 -51
  97. package/src/component/forms/Senha.vue +0 -139
  98. package/src/component/forms/Texto.vue +0 -161
  99. package/src/component/forms/TextoArea.vue +0 -126
  100. package/src/component/forms/TextoEditor.vue +0 -123
  101. package/src/component/layout/Painel.vue +0 -142
  102. package/src/component/shared/BotaoCarregarMais.vue +0 -23
  103. package/src/component/shared/CabecalhoImpressao.vue +0 -36
  104. package/src/component/shared/Confirmacao.vue +0 -80
  105. package/src/component/shared/Dica.vue +0 -42
  106. package/src/component/shared/EsconderMostrar.vue +0 -131
  107. package/src/component/shared/ExportarExcel.vue +0 -67
  108. package/src/component/shared/FiltroHorizontal.vue +0 -59
  109. package/src/component/shared/Mensagem.vue +0 -86
  110. package/src/component/shared/Progresso.vue +0 -21
  111. package/src/component/shared/SalvarCancelar.vue +0 -56
  112. package/src/component/shared/Tabela.vue +0 -275
  113. package/src/component/shared/TabelaBotao.vue +0 -36
  114. package/src/component/shared/query-builder/Campo.vue +0 -116
  115. package/src/component/shared/query-builder/ConverteParaOdata.js +0 -77
  116. package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
  117. package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
  118. package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
  119. package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
  120. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
  121. package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -187
  122. package/src/component/shared/query-builder/main.js +0 -81
  123. package/src/component/template/ModeloAdicionarModificarView.vue +0 -32
  124. package/src/component/template/ModeloDocumentoView.vue +0 -227
  125. package/src/component/template/ModeloLista.vue +0 -231
  126. package/src/component/template/ModeloRelatorioListaView.vue +0 -227
  127. package/src/component/template/ModeloRelatorioView.vue +0 -489
  128. package/src/component/template/ModeloSubView.vue +0 -69
  129. package/src/component/template/ModeloView.vue +0 -49
  130. package/src/component/template/Relatorio.js +0 -10
  131. package/src/component/template/RelatorioAdicionarModificar.vue +0 -106
  132. package/src/store/modulos/generic.js +0 -494
  133. package/src/store/modulos/relatorio.js +0 -204
  134. package/src/store/modulos/usuario.js +0 -38
  135. package/src/store/modulos/validation.js +0 -39
@@ -0,0 +1,337 @@
1
+ <template>
2
+ <div>
3
+ <label>
4
+ <span class="title">{{ title }}</span>
5
+ <span class="required" v-if="required">*</span>
6
+ <Tip :field="field" :formName="formName" />
7
+ </label>
8
+ <div
9
+ class="select"
10
+ :class="{
11
+ 'select-invalid': notifications.length > 0 && formDirty,
12
+ border: showBorder,
13
+ }"
14
+ >
15
+ <multiselect
16
+ @open="onOpen"
17
+ @select="onSelected"
18
+ @search-change="onSearch"
19
+ :options="data"
20
+ v-model.trim="currentValue"
21
+ :custom-label="label"
22
+ placeholder
23
+ :disabled="disabled"
24
+ :showLabels="true"
25
+ :noResult="false"
26
+ :maxHeight="250"
27
+ ref="multiselect"
28
+ selectLabel
29
+ deselectLabel
30
+ selectedLabel
31
+ >
32
+ <div slot="beforeList">
33
+ <vue-loading
34
+ v-if="loading"
35
+ type="bubbles"
36
+ color="#577696"
37
+ :size="{ width: '40px', height: '40px' }"
38
+ ></vue-loading>
39
+ <div class="before-list" v-if="!loading">
40
+ <Button
41
+ v-if="nameNewRegister"
42
+ key="addNewRegister"
43
+ type="primary"
44
+ title="Novo"
45
+ size="small"
46
+ :clicked="addNewRegister"
47
+ />
48
+ <Button
49
+ key="cleanSelect"
50
+ type="warning"
51
+ classIcon="fas fa-broom"
52
+ size="small"
53
+ :clicked="cleanSelect"
54
+ />
55
+ </div>
56
+ </div>
57
+ <div slot="afterList" v-if="totalRecords > 20 && data.length < totalRecords">
58
+ <div class="after-list text-center">
59
+ <Button
60
+ key="loadingMore"
61
+ type="info"
62
+ title="Carregar mais..."
63
+ classIcon="fas fa-redo-alt"
64
+ size="small"
65
+ :clicked="loadingMore"
66
+ />
67
+ </div>
68
+ </div>
69
+ <div slot="noOptions">Lista está vazia</div>
70
+ <div slot="noResult">Nenhum registro encontrado</div>
71
+ </multiselect>
72
+ <div v-if="formDirty">
73
+ <div v-for="message in notifications" :key="message">
74
+ <span class="invalid">{{ message }}</span>
75
+ </div>
76
+ </div>
77
+ </div>
78
+
79
+ <vodal
80
+ v-if="nameNewRegister"
81
+ :show="showVodal(nameNewRegister)"
82
+ @hide="hideVodal()"
83
+ :width="widthNewRegister"
84
+ :height="heightNewRegister"
85
+ :closeOnEsc="true"
86
+ :closeButton="true"
87
+ >
88
+ <Messages v-if="vodal.open" />
89
+ <div class="title-new-form">{{ titleNewRegister }}</div>
90
+ <hr />
91
+ <slot></slot>
92
+ </vodal>
93
+ </div>
94
+ </template>
95
+ <script>
96
+ import Tip from "../shared/Tip.vue";
97
+ import Messages from "../shared/Messages.vue";
98
+ import Multiselect from "vue-multiselect";
99
+
100
+ import Button from "./Button.vue";
101
+ import Vodal from "vodal";
102
+
103
+ import { mapState, mapActions, mapMutations, mapGetters } from "vuex";
104
+
105
+ export default {
106
+ name: "Select",
107
+ props: {
108
+ title: String,
109
+ field: String,
110
+ formName: String,
111
+ required: Boolean,
112
+ url: String,
113
+ disabled: Boolean,
114
+ fieldTarget: String,
115
+ propsParams: Object,
116
+ value: Object,
117
+ changed: Function,
118
+ nameNewRegister: String,
119
+ titleNewRegister: String,
120
+ widthNewRegister: Number,
121
+ heightNewRegister: Number,
122
+ markFormDirty: {
123
+ type: Boolean,
124
+ default: true,
125
+ },
126
+ showBorder: {
127
+ type: Boolean,
128
+ default: true,
129
+ },
130
+ },
131
+ components: {
132
+ Multiselect,
133
+ Button,
134
+ Vodal,
135
+ Messages,
136
+ Tip,
137
+ },
138
+ data() {
139
+ return {
140
+ currentValue: {},
141
+ data: [],
142
+ totalRecords: 0,
143
+ baseParams: {
144
+ search: "",
145
+ currentPage: 1,
146
+ totalPerPage: 20,
147
+ },
148
+
149
+ registerNew: false,
150
+ loading: true,
151
+ notifications: [],
152
+ formDirty: false,
153
+ };
154
+ },
155
+ created() {
156
+ this.validate();
157
+ if (this.value)
158
+ this.currentValue = { id: this.value.id, conteudo: this.value.content };
159
+ },
160
+ mounted() {
161
+ let el = this.$el.getElementsByClassName("multiselect")[0];
162
+ if (el) {
163
+ el.tabIndex = 0;
164
+ }
165
+ },
166
+ computed: {
167
+ ...mapState("validation", ["resetForm", "vodal"]),
168
+ ...mapState("generic", ["vodal"]),
169
+ ...mapGetters("generic", ["showVodal"]),
170
+ },
171
+ methods: {
172
+ ...mapActions("generic", ["getApi"]),
173
+ ...mapMutations("generic", [
174
+ "removeLoading",
175
+ "showVodal",
176
+ "hideVodal",
177
+ "removeNotificarions",
178
+ "addFilter",
179
+ ]),
180
+ ...mapMutations("validation", [
181
+ "addValidation",
182
+ "removeValidation",
183
+ "resetValidation",
184
+ "updateFormDirty",
185
+ ]),
186
+ onOpen() {
187
+ this.getAll();
188
+ },
189
+ onSelected(value) {
190
+ this.$emit("input", value);
191
+ if (this.changed) this.changed();
192
+ if (this.fieldTarget) {
193
+ let obj = { fieldTarget: this.fieldTarget, value: value.id };
194
+ this.addFilter(obj);
195
+ }
196
+ },
197
+ onSearch(value) {
198
+ this.baseParams.search = value;
199
+ this.getAll();
200
+ },
201
+ label(value) {
202
+ if (value.conteudo) return `${value.conteudo}`;
203
+ },
204
+ getAll() {
205
+ let obj = { ...this.baseParams, ...this.propsParams };
206
+ let params = { url: this.url, obj: obj };
207
+ this.loading = true;
208
+ this.getApi(params).then((response) => {
209
+ this.totalRecords = response.content.totalRecords;
210
+ let self = this;
211
+ if (this.baseParams.currentPage == 1) {
212
+ this.data = [];
213
+ }
214
+ response.conteudo.data.map(function (value, key) {
215
+ self.data.push(value);
216
+ });
217
+ this.loading = false;
218
+ this.removeLoading(["loadingMore"]);
219
+ });
220
+ },
221
+ addNewRegister() {
222
+ this.showVodal(this.nameNewRegister);
223
+ this.resetValidation(this.nameNewRegister);
224
+ this.removeNotificarions();
225
+ this.$refs.multiselect.deactivate();
226
+ this.removeLoading(["addNewRegister"]);
227
+ },
228
+ hideVodal() {
229
+ this.hideVodal();
230
+ },
231
+ cleanSelect() {
232
+ let obj = { id: "", conteudo: "" };
233
+ this.currentValue = obj;
234
+ this.$emit("input", obj);
235
+ this.$refs.multiselect.deactivate();
236
+ this.removeLoading(["cleanSelect"]);
237
+
238
+ if (this.fieldTarget) {
239
+ let obj = { fieldTarget: this.fieldTarget, value: "" };
240
+ this.addFilter(obj);
241
+ }
242
+ },
243
+ loadingMore() {
244
+ this.baseParams.currentPage++;
245
+ this.getAll();
246
+ },
247
+ validate() {
248
+ this.notifications = [];
249
+ if (this.required && !this.value.id) {
250
+ var message = `${this.title} não pode ser vazio!`;
251
+ this.notifications.push(message);
252
+ }
253
+ },
254
+ },
255
+ watch: {
256
+ "value.id": function () {
257
+ this.validate();
258
+ this.formDirty = true;
259
+ if (this.markFormDirty) this.updateFormDirty(true);
260
+ this.currentValue = { id: this.value.id, conteudo: this.value.conteudo };
261
+ },
262
+ notifications() {
263
+ let self = this;
264
+ this.notifications.forEach(function (notification) {
265
+ let obj = {
266
+ key: self.field + "&" + self.formName,
267
+ formName: self.formName,
268
+ notification: notification,
269
+ };
270
+ self.addValidation(obj);
271
+ });
272
+
273
+ if (this.notifications.length == 0) {
274
+ let obj = {
275
+ key: self.field + "&" + self.formName,
276
+ formName: self.formName,
277
+ };
278
+ self.removeValidation(obj);
279
+ }
280
+ },
281
+ resetForm: {
282
+ handler(form) {
283
+ if (form.nome == this.formName) {
284
+ let obj = { id: "", conteudo: "" };
285
+ this.currentValue = obj;
286
+ this.$emit("input", obj);
287
+ this.formDirty = false;
288
+ }
289
+ },
290
+ deep: true,
291
+ },
292
+ "vodal.open": function (value) {
293
+ if (!value) this.registerNew = false;
294
+ },
295
+ },
296
+ };
297
+ </script>
298
+
299
+ <style scoped>
300
+ div.before-list {
301
+ padding: 8px;
302
+ }
303
+
304
+ div.after-list {
305
+ padding: 8px;
306
+ }
307
+
308
+ .invalid {
309
+ color: #f0134d;
310
+ font-size: 14px;
311
+ }
312
+
313
+ .select {
314
+ height: 36px;
315
+ border-bottom: 1px solid #d6dadf;
316
+ border-radius: 0px !important;
317
+ }
318
+
319
+ .select-invalid {
320
+ border-bottom: 1px solid #ff5454;
321
+ }
322
+
323
+ .select-valid {
324
+ border-bottom: 1px solid #94aa2a;
325
+ }
326
+
327
+ .title-new-form {
328
+ font-size: 18px;
329
+ margin-bottom: 5px;
330
+ }
331
+
332
+ .border {
333
+ border: 1px solid #dbdee0 !important;
334
+ border-radius: 5px !important;
335
+ height: 38px !important;
336
+ }
337
+ </style>
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <div>
3
+ <label>
4
+ <span class="title">{{ title }}</span>
5
+ </label>
6
+ <div class="select" :class="{ border: showBorder }">
7
+ <multiselect
8
+ @open="onOpen"
9
+ @select="onSelected"
10
+ @search-change="onSearch"
11
+ :options="data"
12
+ v-model.trim="currentValue"
13
+ :custom-label="label"
14
+ :disabled="disabled"
15
+ placeholder
16
+ :showLabels="true"
17
+ :noResult="false"
18
+ ref="multiselect"
19
+ selectLabel
20
+ deselectLabel
21
+ selectedLabel
22
+ >
23
+ </multiselect>
24
+ </div>
25
+ </div>
26
+ </template>
27
+ <script>
28
+ import Multiselect from "vue-multiselect";
29
+ import Button from "./Button";
30
+
31
+ import { mapMutations } from "vuex";
32
+
33
+ export default {
34
+ name: "SelectStatic",
35
+ props: {
36
+ title: String,
37
+ formName: String,
38
+ fieldTarget: String,
39
+ initialValue: Object,
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+ onlyQuery: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ showBorder: {
49
+ type: Boolean,
50
+ default: true,
51
+ },
52
+ data: Array,
53
+ value: Object,
54
+ },
55
+ components: {
56
+ Multiselect,
57
+ Button,
58
+ },
59
+ data() {
60
+ return {
61
+ currentValue: this.initialValue,
62
+ };
63
+ },
64
+ mounted() {
65
+ let el = this.$el.getElementsByClassName("multiselect")[0];
66
+ if (el) {
67
+ el.tabIndex = 0;
68
+ }
69
+ },
70
+ methods: {
71
+ ...mapMutations("generic", ["addFilter", "removeLoading"]),
72
+ onOpen() {},
73
+ onSelected(value) {
74
+ this.$emit("input", value);
75
+ let obj = { fieldTarget: this.fieldTarget, valor: value.id };
76
+ if (!this.onlyQuery) this.addFilter(obj);
77
+ },
78
+ onSearch(value) {},
79
+ label(value) {
80
+ return `${value.content}`;
81
+ },
82
+ cleanSelectStatic() {
83
+ let obj = { content: "", id: "" };
84
+ this.currentValue = obj;
85
+ this.$emit("input", obj);
86
+ this.$refs.multiselect.deactivate();
87
+ this.removeLoading(["cleanSelectStatic"]);
88
+
89
+ if (this.fieldTarget) {
90
+ let obj = { fieldTarget: this.fieldTarget, valor: "" };
91
+ this.addFilter(obj);
92
+ }
93
+ },
94
+ },
95
+ watch: {
96
+ "value.id": function () {
97
+ this.currentValue = { id: this.value.id, content: this.value.content };
98
+ },
99
+ "initialValue.id": function () {
100
+ this.currentValue = { id: this.value.id, content: this.value.content };
101
+ },
102
+ },
103
+ };
104
+ </script>
105
+
106
+ <style scoped>
107
+ div.before-list {
108
+ padding: 8px;
109
+ }
110
+
111
+ .select {
112
+ height: 38px;
113
+ border-radius: 5px !important;
114
+ margin-bottom: 20px;
115
+ }
116
+
117
+ .border {
118
+ border: 1px solid #dbdee0 !important;
119
+ }
120
+ </style>
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="form-group">
3
+ <label>
4
+ <span class="title">{{ title }}</span>
5
+ <span class="required" v-if="required">*</span>
6
+ <Tip :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
+
14
+ <textarea
15
+ type="text"
16
+ :placeholder="placeholder"
17
+ v-bind:value="value"
18
+ v-on:input="$emit('input', $event.target.value)"
19
+ class="form-control"
20
+ :class="{ 'is-invalid': notifications.length > 0 && formDirty }"
21
+ ></textarea>
22
+ </div>
23
+
24
+ <div v-if="formDirty">
25
+ <div v-for="message in notifications" :key="message">
26
+ <span class="invalid">{{ message }}</span>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import Tip from "../shared/Tip.vue";
34
+ import { mapState, mapMutations } from "vuex";
35
+
36
+ export default {
37
+ components: { Tip },
38
+ name: "TextArea",
39
+ props: {
40
+ title: String,
41
+ field: String,
42
+ placeholder: String,
43
+ formName: String,
44
+ required: Boolean,
45
+ maxLength: Number,
46
+ value: String,
47
+ },
48
+ data() {
49
+ return {
50
+ notifications: [],
51
+ formDirty: false,
52
+ };
53
+ },
54
+ created() {
55
+ this.validate();
56
+ },
57
+ methods: {
58
+ ...mapMutations("validation", [
59
+ "addValidation",
60
+ "removeValidation",
61
+ "updateFormDirty",
62
+ ]),
63
+ validate() {
64
+ this.notifications = [];
65
+
66
+ if (this.required && this.value.length == 0) {
67
+ var message = `${this.title} não pode ser vazio!`;
68
+ this.notifications.push(message);
69
+ }
70
+
71
+ if (this.maxLength > 0) {
72
+ if (this.value.length > this.maxLength) {
73
+ var message = `Máximo de ${this.maxLength} caracteres!`;
74
+ this.notifications.push(message);
75
+ }
76
+ }
77
+ },
78
+ },
79
+ computed: {
80
+ ...mapState("validation", ["resetForm", "validations"]),
81
+ },
82
+ watch: {
83
+ value() {
84
+ this.validate();
85
+ this.formDirty = true;
86
+ this.updateFormDirty(true);
87
+ },
88
+ notifications() {
89
+ let self = this;
90
+ this.notifications.forEach(function (notification) {
91
+ let obj = {
92
+ key: self.field + "&" + self.formName,
93
+ formName: self.formName,
94
+ notification: notification,
95
+ };
96
+ self.addValidation(obj);
97
+ });
98
+
99
+ if (this.notifications.length == 0) {
100
+ let obj = {
101
+ key: self.field + "&" + self.formName,
102
+ formName: self.formName,
103
+ };
104
+ self.removeValidation(obj);
105
+ }
106
+ },
107
+ resetForm: {
108
+ handler(form) {
109
+ if (form.nome == this.formName) this.formDirty = false;
110
+ },
111
+ deep: true,
112
+ },
113
+ },
114
+ };
115
+ </script>
116
+
117
+ <style scoped>
118
+ .success {
119
+ color: #94aa2a;
120
+ font-size: 14px;
121
+ }
122
+ .invalid {
123
+ color: #f0134d;
124
+ font-size: 14px;
125
+ }
126
+ </style>
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <div class="principal">
2
+ <div class="main">
3
3
  <b-row>
4
4
  <b-col xs="6" sm="6" md="6" lg="6" xl="6">
5
- <div class="lado-a-lado titulo">{{ titulo }}</div>
5
+ <div class="side-by-side title">{{ title }}</div>
6
6
  </b-col>
7
7
  <b-col xs="6" sm="6" md="6" lg="4" xl="4">
8
8
  <VueToggles
@@ -10,11 +10,11 @@
10
10
  width="60"
11
11
  checkedText="Sim"
12
12
  uncheckedText="Não"
13
- :checkedBg="cor"
13
+ :checkedBg="color"
14
14
  uncheckedBg="lightgrey"
15
- :disabled="desabilitado"
15
+ :disabled="disabled"
16
16
  :value="valor"
17
- @click="clique"
17
+ @click="clicked"
18
18
  />
19
19
  </b-col>
20
20
  </b-row>
@@ -30,14 +30,14 @@ export default {
30
30
  VueToggles,
31
31
  },
32
32
  props: {
33
- titulo: String,
34
- cor: String,
35
- desabilitado: {
33
+ title: String,
34
+ color: String,
35
+ disabled: {
36
36
  type: Boolean,
37
37
  default: false,
38
38
  },
39
39
  params: Object,
40
- alterou: Function,
40
+ changed: Function,
41
41
  value: Boolean,
42
42
  },
43
43
  data() {
@@ -49,21 +49,21 @@ export default {
49
49
  this.valor = this.value;
50
50
  },
51
51
  methods: {
52
- clique() {
52
+ clicked() {
53
53
  this.valor = !this.valor;
54
54
  this.$emit("input", this.valor);
55
- if (this.alterou) this.alterou(this.params);
55
+ if (this.changed) this.changed(this.params);
56
56
  },
57
57
  },
58
58
  };
59
59
  </script>
60
60
 
61
61
  <style scoped>
62
- .principal {
62
+ .main {
63
63
  padding: 5px;
64
64
  }
65
65
 
66
- .titulo {
66
+ .title {
67
67
  padding-right: 35px;
68
68
  }
69
69
  </style>