@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.
- package/docs/src/component/template/ModeloRelatorioView.drawio +160 -0
- package/docs/src/store/modulos/relatorio.drawio +37 -0
- package/package.json +77 -75
- package/public/index.html +2 -4
- package/public/styles/app.css +1 -2
- package/src/component/forms/{Botao.vue → Button.vue} +53 -57
- package/src/component/forms/CheckboxGroup.vue +63 -0
- package/src/component/forms/{CheckboxUnico.vue → CheckboxSimple.vue} +6 -6
- package/src/component/forms/{Cor.vue → Color.vue} +9 -9
- package/src/component/forms/DateTime.vue +53 -53
- package/src/component/forms/{BotaoDropdown.vue → Dropdown.vue} +50 -50
- package/src/component/forms/EditorHtml.vue +123 -0
- package/src/component/forms/FileUpload.vue +189 -0
- package/src/component/forms/InputDecimal.vue +137 -0
- package/src/component/forms/InputNumber.vue +149 -0
- package/src/component/forms/InputPassword.vue +135 -0
- package/src/component/forms/InputText.vue +157 -0
- package/src/component/forms/Modal.vue +15 -15
- package/src/component/forms/RadioGroup.vue +50 -0
- package/src/component/forms/Select.vue +337 -0
- package/src/component/forms/SelectStatic.vue +120 -0
- package/src/component/forms/TextArea.vue +126 -0
- package/src/component/forms/Toggle.vue +13 -13
- package/src/component/layout/{Conta.vue → Account.vue} +28 -28
- package/src/component/layout/{Alerta.vue → Alert.vue} +22 -22
- package/src/component/layout/Badge.vue +23 -23
- package/src/component/layout/{BarraFixa.vue → FixedBar.vue} +16 -16
- package/src/component/layout/{CarregandoTelaInteira.vue → LoadingFullPage.vue} +3 -3
- package/src/component/layout/Menu.vue +66 -66
- package/src/component/layout/{Moldura.vue → Molded.vue} +4 -4
- package/src/component/layout/Panel.vue +142 -0
- package/src/component/layout/Popover.vue +1 -1
- package/src/component/layout/{BarraRolagem.vue → Scrollbar.vue} +9 -11
- package/src/component/layout/Tag.vue +9 -9
- package/src/component/layout/Topo.vue +1 -1
- package/src/component/layout/Wizard.vue +3 -3
- package/src/component/shared/BotaoCarregarMais.vue +9 -9
- package/src/component/shared/BotaoConsulta.vue +9 -9
- package/src/component/shared/CabecalhoImpressao.vue +6 -6
- package/src/component/shared/CodigoEditor.vue +16 -16
- package/src/component/shared/Confirmacao.vue +28 -28
- package/src/component/shared/Dica.vue +10 -10
- package/src/component/shared/DocumentoEditor.vue +3 -3
- package/src/component/shared/DocumentoPreview.vue +2 -2
- package/src/component/shared/EsconderMostrar.vue +26 -26
- package/src/component/shared/ExportarExcel.vue +14 -14
- package/src/component/shared/ExportarPDF.vue +10 -10
- package/src/component/shared/FiltroHorizontal.vue +19 -19
- package/src/component/shared/LegendaParametro.vue +17 -17
- package/src/component/shared/{Carregando.vue → Loading.vue} +11 -11
- package/src/component/shared/Messages.vue +83 -0
- package/src/component/shared/Paginacao.vue +10 -10
- package/src/component/shared/Progresso.vue +2 -2
- package/src/component/shared/Registro.vue +2 -2
- package/src/component/shared/ResumoTabela.vue +6 -6
- package/src/component/shared/SalvarCancelar.vue +26 -26
- package/src/component/shared/{Pesquisa.vue → Search.vue} +36 -36
- package/src/component/shared/Tabela.vue +49 -49
- package/src/component/shared/TabelaBotao.vue +13 -13
- package/src/component/shared/Toast.vue +7 -7
- package/src/component/shared/{FiltroVertical.vue → VerticalFilter.vue} +14 -14
- package/src/component/shared/construtor-consulta/AdicionaFiltro.vue +191 -0
- package/src/component/shared/construtor-consulta/Campo.vue +127 -0
- package/src/component/shared/construtor-consulta/ComponenteDinamico.vue +109 -0
- package/src/component/shared/construtor-consulta/ConstrutorConsulta.vue +70 -0
- package/src/component/shared/construtor-consulta/ConverteParaOdata.js +80 -0
- package/src/component/shared/construtor-consulta/EscolherFiltro.vue +96 -0
- package/src/component/shared/{query-builder → construtor-consulta}/Filtro.vue +11 -16
- package/src/component/shared/construtor-consulta/ListaComponenteDinamico.vue +41 -0
- package/src/component/shared/{query-builder → construtor-consulta}/Rodape.vue +9 -9
- package/src/component/shared/{query-builder → construtor-consulta}/Tags.vue +7 -7
- package/src/component/shared/{query-builder → construtor-consulta}/utilities.js +0 -0
- package/src/component/template/ModeloAdicionarModificarView.vue +11 -11
- package/src/component/template/ModeloDocumentoView.vue +79 -79
- package/src/component/template/ModeloLista.vue +66 -66
- package/src/component/template/ModeloRelatorioListaView.vue +71 -68
- package/src/component/template/ModeloRelatorioView.vue +218 -200
- package/src/component/template/ModeloSubView.vue +13 -13
- package/src/component/template/ModeloView.vue +17 -17
- package/src/component/template/Relatorio.js +1 -5
- package/src/component/template/RelatorioAdicionarModificar.vue +44 -44
- package/src/component/value-objects/DadosContato.vue +27 -27
- package/src/component/value-objects/DadosPessoa.js +1 -1
- package/src/component/value-objects/DadosPessoa.vue +52 -52
- package/src/component/value-objects/Endereco.js +1 -1
- package/src/component/value-objects/Endereco.vue +83 -83
- package/src/config/dicas.js +1 -1
- package/src/config/token.js +2 -2
- package/src/store/modules/generic.js +489 -0
- package/src/store/modules/report.js +246 -0
- package/src/store/modules/user.js +38 -0
- package/src/store/modules/validation.js +39 -0
- package/src/store/store.js +4 -4
- package/public/js/menu.js +0 -11
- package/public/styles/menu.css +0 -1399
- package/src/component/forms/ArquivoUpload.vue +0 -199
- package/src/component/forms/CheckboxMultiplo.vue +0 -63
- package/src/component/forms/Decimal.vue +0 -137
- package/src/component/forms/Escolher.vue +0 -324
- package/src/component/forms/EscolherEstatico.vue +0 -139
- package/src/component/forms/Numero.vue +0 -153
- package/src/component/forms/Opcoes.vue +0 -51
- package/src/component/forms/Senha.vue +0 -139
- package/src/component/forms/Texto.vue +0 -161
- package/src/component/forms/TextoArea.vue +0 -126
- package/src/component/forms/TextoEditor.vue +0 -123
- package/src/component/layout/Painel.vue +0 -142
- package/src/component/shared/Mensagem.vue +0 -86
- package/src/component/shared/query-builder/Campo.vue +0 -116
- package/src/component/shared/query-builder/ConverteParaOdata.js +0 -73
- package/src/component/shared/query-builder/QueryBuilder.vue +0 -164
- package/src/component/shared/query-builder/components/CustomSelect.vue +0 -115
- package/src/component/shared/query-builder/components/QueryBuilderChildren.vue +0 -46
- package/src/component/shared/query-builder/components/QueryBuilderGroup.vue +0 -151
- package/src/component/shared/query-builder/components/QueryBuilderRule.vue +0 -81
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapGroup.vue +0 -120
- package/src/component/shared/query-builder/layouts/Bootstrap/BootstrapRule.vue +0 -171
- package/src/component/shared/query-builder/main.js +0 -81
- package/src/store/modulos/generic.js +0 -494
- package/src/store/modulos/relatorio.js +0 -201
- package/src/store/modulos/usuario.js +0 -38
- package/src/store/modulos/validation.js +0 -39
|
@@ -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
|
+
<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-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 Dica from "../shared/Dica.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
|
+
Dica,
|
|
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
|
+
"addFormDirty",
|
|
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.addFormDirty(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>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
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
|
+
<slot v-else></slot>
|
|
14
|
+
<input
|
|
15
|
+
class="form-control"
|
|
16
|
+
type="number"
|
|
17
|
+
v-model="_value"
|
|
18
|
+
@keyup.enter.prevent="pressedEnter"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div v-if="formDirty">
|
|
23
|
+
<div v-for="message in notifications" :key="message">
|
|
24
|
+
<span class="invalid">{{ message }}</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: "InputNumber",
|
|
37
|
+
components: { Dica },
|
|
38
|
+
props: {
|
|
39
|
+
title: String,
|
|
40
|
+
field: String,
|
|
41
|
+
placeholder: String,
|
|
42
|
+
disabled: Boolean,
|
|
43
|
+
formName: String,
|
|
44
|
+
required: Boolean,
|
|
45
|
+
maxLength: Number,
|
|
46
|
+
type: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "float",
|
|
49
|
+
},
|
|
50
|
+
markFormDirty: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
value: Number,
|
|
55
|
+
changed: Function,
|
|
56
|
+
enter: Function,
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
notifications: [],
|
|
61
|
+
formDirty: false,
|
|
62
|
+
_value: 0,
|
|
63
|
+
precision: 1,
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
created() {
|
|
67
|
+
// não carregar as validações iniciais para number
|
|
68
|
+
this._value = this.value;
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
methods: {
|
|
72
|
+
...mapMutations("validation", ["addValidation", "removeValidation", "addFormDirty"]),
|
|
73
|
+
validate() {
|
|
74
|
+
this.notifications = [];
|
|
75
|
+
if (this.value == 0) return;
|
|
76
|
+
if (this.required && !this.value) {
|
|
77
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
78
|
+
this.notifications.push(message);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this._value.toString().length > this.maxLength) {
|
|
82
|
+
var message = `Valor inválido!`;
|
|
83
|
+
this.notifications.push(message);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
pressedEnter() {
|
|
87
|
+
if (this.enter) this.enter();
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
computed: {
|
|
91
|
+
...mapState("validation", ["resetForm"]),
|
|
92
|
+
},
|
|
93
|
+
watch: {
|
|
94
|
+
value() {
|
|
95
|
+
this._value = this.value;
|
|
96
|
+
if (this.changed) this.changed();
|
|
97
|
+
},
|
|
98
|
+
_value() {
|
|
99
|
+
this.validate();
|
|
100
|
+
|
|
101
|
+
let _value;
|
|
102
|
+
if (this.type === "int") _value = parseInt(this._value);
|
|
103
|
+
if (this.type === "float") _value = parseFloat(this._value);
|
|
104
|
+
|
|
105
|
+
this.$emit("input", _value);
|
|
106
|
+
this.formDirty = true;
|
|
107
|
+
if (this.markFormDirty) this.addFormDirty(true);
|
|
108
|
+
|
|
109
|
+
this._value = _value;
|
|
110
|
+
},
|
|
111
|
+
notifications() {
|
|
112
|
+
let self = this;
|
|
113
|
+
this.notifications.forEach(function (notification) {
|
|
114
|
+
let obj = {
|
|
115
|
+
key: self.field + "&" + self.formName,
|
|
116
|
+
formName: self.formName,
|
|
117
|
+
notification: notification,
|
|
118
|
+
};
|
|
119
|
+
self.addValidation(obj);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
if (this.notifications.length == 0) {
|
|
123
|
+
let obj = {
|
|
124
|
+
key: self.field + "&" + self.formName,
|
|
125
|
+
formName: self.formName,
|
|
126
|
+
};
|
|
127
|
+
self.removeValidation(obj);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
resetForm: {
|
|
131
|
+
handler(form) {
|
|
132
|
+
if (form.nome == this.formName) this.formDirty = false;
|
|
133
|
+
},
|
|
134
|
+
deep: true,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<style scoped>
|
|
141
|
+
.success {
|
|
142
|
+
color: #94aa2a;
|
|
143
|
+
font-size: 14px;
|
|
144
|
+
}
|
|
145
|
+
.invalid {
|
|
146
|
+
color: #f0134d;
|
|
147
|
+
font-size: 14px;
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<label>
|
|
4
|
+
<span class="title" :style="'color: ' + titleColor">{{ 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
|
+
<slot v-else></slot>
|
|
14
|
+
<input
|
|
15
|
+
type="password"
|
|
16
|
+
:placeholder="placeholder"
|
|
17
|
+
v-mask="mask || withoutMask"
|
|
18
|
+
v-bind:value="value"
|
|
19
|
+
v-on:input="$emit('input', $event.target.value)"
|
|
20
|
+
class="form-control"
|
|
21
|
+
:class="{ required: notifications.length > 0 && formDirty }"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
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 Dica from "../shared/Dica.vue";
|
|
34
|
+
import { mapState, mapMutations } from "vuex";
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
components: { Dica },
|
|
38
|
+
name: "InputPassword",
|
|
39
|
+
mixins: [],
|
|
40
|
+
props: [
|
|
41
|
+
"title",
|
|
42
|
+
"field",
|
|
43
|
+
"titleColor",
|
|
44
|
+
"placeholder",
|
|
45
|
+
"mask",
|
|
46
|
+
"formName",
|
|
47
|
+
"required",
|
|
48
|
+
"maxLength",
|
|
49
|
+
"value",
|
|
50
|
+
],
|
|
51
|
+
data() {
|
|
52
|
+
return {
|
|
53
|
+
notifications: [],
|
|
54
|
+
formDirty: false,
|
|
55
|
+
withoutMask: {
|
|
56
|
+
mask: "*".repeat(255),
|
|
57
|
+
tokens: {
|
|
58
|
+
"*": { pattern: /./ },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
created() {
|
|
64
|
+
this.validate();
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
...mapMutations("validation", ["addValidation", "removeValidation", "addFormDirty"]),
|
|
68
|
+
validate() {
|
|
69
|
+
this.notifications = [];
|
|
70
|
+
|
|
71
|
+
if (this.required && this.value.length == 0) {
|
|
72
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
73
|
+
this.notifications.push(message);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (this.maxLength > 0) {
|
|
77
|
+
if (this.value.length > this.maxLength) {
|
|
78
|
+
var message = `Máximo de ${this.maxLength} caracteres!`;
|
|
79
|
+
this.notifications.push(message);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
computed: {
|
|
85
|
+
...mapState("validation", ["resetForm", "validations"]),
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
value() {
|
|
89
|
+
this.validate();
|
|
90
|
+
this.formDirty = true;
|
|
91
|
+
this.addFormDirty(true);
|
|
92
|
+
},
|
|
93
|
+
notifications() {
|
|
94
|
+
let self = this;
|
|
95
|
+
this.notifications.forEach(function (notification) {
|
|
96
|
+
let obj = {
|
|
97
|
+
key: self.field + "&" + self.formName,
|
|
98
|
+
formName: self.formName,
|
|
99
|
+
notification: notification,
|
|
100
|
+
};
|
|
101
|
+
self.addValidation(obj);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (this.notifications.length == 0) {
|
|
105
|
+
let obj = {
|
|
106
|
+
key: self.field + "&" + self.formName,
|
|
107
|
+
formName: self.formName,
|
|
108
|
+
};
|
|
109
|
+
self.removeValidation(obj);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
resetForm: {
|
|
113
|
+
handler(form) {
|
|
114
|
+
if (form.nome == this.formName) this.formDirty = false;
|
|
115
|
+
},
|
|
116
|
+
deep: true,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<style scoped>
|
|
123
|
+
.success {
|
|
124
|
+
color: #94aa2a;
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
}
|
|
127
|
+
.invalid {
|
|
128
|
+
color: #f0134d;
|
|
129
|
+
font-size: 14px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.margin-button {
|
|
133
|
+
margin-top: -10px;
|
|
134
|
+
}
|
|
135
|
+
</style>
|