@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
@@ -1,87 +1,87 @@
1
1
  <template>
2
- <div class="c-div-botao">
2
+ <div class="c-div-button">
3
3
  <div class="dropdown">
4
4
  <button
5
- class="botao dropbtn"
5
+ class="button 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.eventName">
30
30
  <div
31
31
  v-if="visivel(item.condicaoVisibilidade)"
32
- :style="item.estilo"
32
+ :style="item.style"
33
33
  class="item"
34
- @click="executar(item.nomeEvento)"
34
+ @click="execute(item.eventName)"
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,
60
- dadosEvento: Object,
61
- itens: Array,
55
+ title: String,
56
+ type: String,
57
+ classIcon: String,
58
+ size: String,
59
+ disabled: Boolean,
60
+ eventData: Object,
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
- executar(nomeEvento) {
73
+ execute(eventName) {
74
74
  this.mostrarEsconder();
75
- this.insereEvento({
76
- nome: nomeEvento,
77
- dados: this.dadosEvento,
75
+ this.addEvent({
76
+ nome: eventName,
77
+ data: this.eventData,
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
- var verifica = `this.dadosEvento.${condicaoVisibilidade}`;
84
+ var verifica = `this.eventData.${condicaoVisibilidade}`;
85
85
  if (eval(verifica)) return true;
86
86
  },
87
87
  },
@@ -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
 
@@ -129,7 +129,7 @@ export default {
129
129
  background-color: #ddd;
130
130
  }
131
131
 
132
- .botao {
132
+ .button {
133
133
  padding: 8px 12px;
134
134
  cursor: pointer;
135
135
  border: none;
@@ -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
+ <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
+ <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 Tip from "../shared/Tip.vue";
26
+ import { VueEditor } from "vue2-editor";
27
+
28
+ import { mapState, mapMutations } from "vuex";
29
+
30
+ export default {
31
+ components: { Tip, 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>
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <div>
3
+ <div>
4
+ <div class="file" v-if="!value">
5
+ <button class="button small primary">
6
+ <span v-if="!loadingAdd">
7
+ <i class="fas fa-cloud-upload-alt"></i> {{ title }}</span
8
+ >
9
+ <vue-loading
10
+ v-if="loadingAdd"
11
+ type="bubbles"
12
+ color="#fff"
13
+ :size="{ width: '20px', height: '20px' }"
14
+ ></vue-loading>
15
+ </button>
16
+ <input
17
+ type="file"
18
+ name="myfile"
19
+ ref="file"
20
+ :accept="accepted"
21
+ v-on:change="upload()"
22
+ />
23
+ </div>
24
+ <div v-if="value">
25
+ <button class="button small success" @click="download()" v-if="!loadingAdd">
26
+ <i class="fas fa-cloud-download-alt"></i> Baixar
27
+ </button>
28
+ <button class="button small danger" v-if="!loadingAdd" @click="remove()">
29
+ <span v-if="!loadingRemove"></span>
30
+ <vue-loading
31
+ v-if="loadingRemove"
32
+ type="bubbles"
33
+ color="#fff"
34
+ :size="{ width: '20px', height: '20px' }"
35
+ ></vue-loading>
36
+ </button>
37
+ </div>
38
+ <div class="div-alert">
39
+ <Alert type="info" v-if="value">
40
+ <span>{{ message }}</span>
41
+ </Alert>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import Alert from "../layout/Alert.vue";
49
+
50
+ import { mapActions } from "vuex";
51
+
52
+ export default {
53
+ name: "FileUpload",
54
+ components: { Alert },
55
+ props: {
56
+ title: String,
57
+ name: String,
58
+ container: String,
59
+ accepted: String,
60
+ message: String,
61
+ urlPost: String,
62
+ urlRemove: String,
63
+ nameDataBase: String,
64
+ onLoad: Function,
65
+ value: String,
66
+ },
67
+ data() {
68
+ return {
69
+ file: "",
70
+ loadingAdd: false,
71
+ loadingRemove: false,
72
+ urlAzure: "https://espaco.blob.core.windows.net",
73
+ };
74
+ },
75
+ methods: {
76
+ ...mapActions("generic", ["postFileApi", "deleteFileApi"]),
77
+ upload() {
78
+ this.file = this.$refs.file.files[0];
79
+ let params = {
80
+ url: this.urlPost,
81
+ file: this.file,
82
+ container: this.container,
83
+ name: this.name,
84
+ accepted: this.accepted,
85
+ };
86
+ this.loadingAdd = true;
87
+ this.postFileApi(params).then((response) => {
88
+ if (response.success) {
89
+ if (this.onLoad) this.onLoad();
90
+ this.$emit("input", response.content);
91
+ } else {
92
+ this.clear();
93
+ }
94
+ this.loadingAdd = false;
95
+ });
96
+ },
97
+ remove() {
98
+ let props = {
99
+ url: this.urlRemove,
100
+ container: this.container,
101
+ name: this.nameDataBase,
102
+ };
103
+ this.loadingRemove = true;
104
+ let params = { url: this.urlRemove, obj: props };
105
+ this.deleteFileApi(params).then((response) => {
106
+ if (response.success) {
107
+ if (this.onLoad) this.onLoad();
108
+ this.clear();
109
+ this.$emit("input", "");
110
+ }
111
+ this.loadingRemove = false;
112
+ });
113
+ },
114
+ clear() {
115
+ this.file = "";
116
+ },
117
+ download() {
118
+ const url = `${this.urlAzure}/${this.container}/${this.nameDataBase}`;
119
+ window.location.href = url;
120
+ },
121
+ },
122
+ };
123
+ </script>
124
+
125
+ <style scoped>
126
+ .file {
127
+ position: relative;
128
+ overflow: hidden;
129
+ display: inline-block;
130
+ cursor: pointer;
131
+ }
132
+
133
+ .button {
134
+ padding: 8px 12px;
135
+ cursor: pointer;
136
+ border: none;
137
+ border-radius: 40px !important;
138
+ font-size: 14px;
139
+ font-weight: 400;
140
+ }
141
+
142
+ .primary {
143
+ background: #577696;
144
+ border-color: #577696;
145
+ color: #fff;
146
+ }
147
+
148
+ .primary:hover {
149
+ background: #355472;
150
+ }
151
+
152
+ .success {
153
+ color: #fff;
154
+ background: #94aa2a;
155
+ border-color: #94aa2a;
156
+ }
157
+
158
+ .success:hover {
159
+ background: #6d7e1c;
160
+ }
161
+
162
+ .danger {
163
+ color: #fff;
164
+ border-color: #f0134d;
165
+ background: #f0134d;
166
+ margin-left: 5px;
167
+ }
168
+
169
+ .danger:hover {
170
+ background: #c70f40;
171
+ }
172
+
173
+ .small {
174
+ padding: 5px 10px;
175
+ font-size: 13px;
176
+ }
177
+
178
+ .file input[type="file"] {
179
+ font-size: 100px;
180
+ position: absolute;
181
+ left: 0;
182
+ top: 0;
183
+ opacity: 0;
184
+ }
185
+
186
+ .div-alert {
187
+ margin-top: 15px;
188
+ }
189
+ </style>
@@ -0,0 +1,137 @@
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
+ <vue-numeric
14
+ class="form-control"
15
+ v-on:keyup.enter.native="pressedEnter"
16
+ :class="{ 'is-invalid': notifications.length > 0 && formDirty }"
17
+ :placeholder="placeholder"
18
+ :disabled="disabled"
19
+ currency="R$"
20
+ separator="."
21
+ v-bind:precision="2"
22
+ v-model="_value"
23
+ ></vue-numeric>
24
+ </div>
25
+
26
+ <div v-if="formDirty">
27
+ <div v-for="message in notifications" :key="message">
28
+ <span class="invalid">{{ message }}</span>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import Tip from "../shared/Tip.vue";
36
+ import VueNumeric from "vue-numeric";
37
+
38
+ import { mapState, mapMutations } from "vuex";
39
+
40
+ export default {
41
+ name: "InputDecimal",
42
+ mixins: [],
43
+ props: {
44
+ title: String,
45
+ field: String,
46
+ disabled: Boolean,
47
+ placeholder: String,
48
+ formName: String,
49
+ required: Boolean,
50
+ value: Number,
51
+ enter: Function,
52
+ },
53
+ components: {
54
+ VueNumeric,
55
+ Tip,
56
+ },
57
+ data() {
58
+ return {
59
+ notifications: [],
60
+ formDirty: false,
61
+ _value: 0,
62
+ };
63
+ },
64
+ created() {
65
+ // não carregar as validações iniciais para number
66
+ this._value = this.value;
67
+ },
68
+ methods: {
69
+ ...mapMutations("validation", [
70
+ "addValidation",
71
+ "removeValidation",
72
+ "updateFormDirty",
73
+ ]),
74
+ validate() {
75
+ this.notifications = [];
76
+ if (this.value == 0) return;
77
+ if (this.required && !this.value) {
78
+ var message = `${this.title} não pode ser vazio!`;
79
+ this.notifications.push(message);
80
+ }
81
+ },
82
+ pressedEnter() {
83
+ if (this.enter) this.enter();
84
+ },
85
+ },
86
+ computed: {
87
+ ...mapState("validation", ["resetForm"]),
88
+ },
89
+ watch: {
90
+ value() {
91
+ this._value = this.value;
92
+ },
93
+ _value() {
94
+ this.validate();
95
+ this.formDirty = true;
96
+ this.updateFormDirty(true);
97
+ this.$emit("input", this._value);
98
+ },
99
+ notifications() {
100
+ let self = this;
101
+ this.notifications.forEach(function (notification) {
102
+ let obj = {
103
+ key: self.field + "&" + self.formName,
104
+ formName: self.formName,
105
+ notification: notification,
106
+ };
107
+ self.addValidation(obj);
108
+ });
109
+
110
+ if (this.notifications.length == 0) {
111
+ let obj = {
112
+ key: self.field + "&" + self.formName,
113
+ formName: self.formName,
114
+ };
115
+ self.removeValidation(obj);
116
+ }
117
+ },
118
+ resetForm: {
119
+ handler(form) {
120
+ if (form.nome == this.formName) this.formDirty = false;
121
+ },
122
+ deep: true,
123
+ },
124
+ },
125
+ };
126
+ </script>
127
+
128
+ <style scoped>
129
+ .success {
130
+ color: #94aa2a;
131
+ font-size: 14px;
132
+ }
133
+ .invalid {
134
+ color: #f0134d;
135
+ font-size: 14px;
136
+ }
137
+ </style>