@nixweb/nixloc-ui 0.0.125 → 0.0.128
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/ViewTemplateReportPreview.drawio +210 -0
- package/package.json +79 -77
- package/src/App.vue +13 -13
- package/src/component/forms/Button.vue +170 -169
- package/src/component/forms/CheckboxGroup.vue +72 -63
- package/src/component/forms/CheckboxSimple.vue +46 -27
- package/src/component/forms/Color.vue +38 -38
- package/src/component/forms/DateTime.vue +167 -177
- package/src/component/forms/Dropdown.vue +218 -224
- package/src/component/forms/EditorHtml.vue +126 -123
- package/src/component/forms/FileUpload.vue +185 -189
- package/src/component/forms/ImageUpload.vue +230 -0
- package/src/component/forms/IncrementDecrement.vue +101 -0
- package/src/component/forms/InputDecimal.vue +142 -137
- package/src/component/forms/InputNumber.vue +154 -149
- package/src/component/forms/InputPassword.vue +135 -135
- package/src/component/forms/InputText.vue +162 -157
- package/src/component/forms/Modal.vue +65 -60
- package/src/component/forms/RadioGroup.vue +50 -50
- package/src/component/forms/Select.vue +349 -337
- package/src/component/forms/SelectStatic.vue +127 -120
- package/src/component/forms/Slider.vue +18 -18
- package/src/component/forms/TextArea.vue +126 -126
- package/src/component/layout/Alert.vue +92 -92
- package/src/component/layout/Badge.vue +103 -103
- package/src/component/layout/FixedBar.vue +100 -68
- package/src/component/layout/Header.vue +38 -35
- package/src/component/layout/LoadingFullPage.vue +27 -27
- package/src/component/layout/Menu.vue +210 -214
- package/src/component/layout/Molded.vue +28 -27
- package/src/component/layout/Panel.vue +140 -142
- package/src/component/layout/Popover.vue +126 -126
- package/src/component/layout/ScrollBar.vue +42 -43
- package/src/component/layout/Tab.vue +135 -0
- package/src/component/layout/Tag.vue +3 -3
- package/src/component/layout/Wizard.vue +211 -213
- package/src/component/rental/DisplayPeriodRent.vue +81 -0
- package/src/component/rental/DisplayTotalization.vue +47 -0
- package/src/component/shared/Collapse.vue +131 -131
- package/src/component/shared/Confirmation.vue +2 -2
- package/src/component/shared/DocumentEditor.vue +1 -1
- package/src/component/shared/DocumentPreview.vue +1 -1
- package/src/component/shared/DocumentPublic.vue +34 -0
- package/src/component/shared/ExportExcel.vue +1 -8
- package/src/component/shared/ExportPDF.vue +116 -116
- package/src/component/shared/{HeaderPrint.vue → HeaderReport.vue} +4 -4
- package/src/component/shared/HorizontalFilter.vue +59 -59
- package/src/component/shared/Loading.vue +107 -107
- package/src/component/shared/LoadingMoreButton.vue +23 -23
- package/src/component/shared/Messages.vue +81 -83
- package/src/component/shared/PDFViewer.vue +22 -22
- package/src/component/shared/Pagination.vue +52 -53
- package/src/component/shared/{LegendaParametro.vue → ParameterLegend.vue} +22 -26
- package/src/component/shared/ProgressBar.vue +22 -21
- package/src/component/shared/QueryButton.vue +66 -66
- package/src/component/shared/Report.vue +187 -0
- package/src/component/shared/SaveCancel.vue +26 -5
- package/src/component/shared/Search.vue +154 -154
- package/src/component/shared/SelectOption.vue +146 -0
- package/src/component/shared/Table.vue +163 -243
- package/src/component/shared/TableButton.vue +36 -36
- package/src/component/shared/TableDraggable.vue +127 -0
- package/src/component/shared/TableItem.vue +177 -0
- package/src/component/shared/TableTotalRecords.vue +9 -10
- package/src/component/shared/TableTotalization.vue +47 -47
- package/src/component/shared/Tip.vue +42 -42
- package/src/component/shared/Toast.vue +54 -54
- package/src/component/shared/TotalizationReport.vue +59 -0
- package/src/component/shared/VerticalFilter.vue +97 -145
- package/src/component/shared/query-builder/AddRule.vue +181 -187
- package/src/component/shared/query-builder/ConvertToOdata.js +34 -43
- package/src/component/shared/query-builder/DynamicComponent.vue +21 -16
- package/src/component/shared/query-builder/DynamicComponentList.vue +73 -0
- package/src/component/shared/query-builder/Fields.vue +29 -63
- package/src/component/shared/query-builder/QueryBuilder.vue +69 -69
- package/src/component/shared/query-builder/Rules.vue +2 -14
- package/src/component/shared/query-builder/SelectRule.vue +15 -15
- package/src/component/shared/query-builder/Tags.vue +24 -8
- package/src/component/shared/query-builder/utilities.js +21 -21
- package/src/component/template/{ListViewWithHandlerData.vue → ListViewWithDataHandler.vue} +260 -231
- package/src/component/template/{AddEditReport.vue → ReportCreateUpdate.vue} +40 -22
- package/src/component/template/ViewTemplateConfiguration.vue +64 -69
- package/src/component/template/ViewTemplateDocumentView.vue +22 -25
- package/src/component/template/ViewTemplateReportList.vue +39 -57
- package/src/component/template/ViewTemplateReportPreview.vue +270 -341
- package/src/component/template/ViewTemplateReportPreviewCOPIASEGURANCA.vue +497 -0
- package/src/component/template/ViewTemplateSelectOption.vue +60 -0
- package/src/component/template/ViewTemplateWithSalveCancel.vue +32 -32
- package/src/component/template/ViewTemplateWithTable.vue +56 -49
- package/src/component/template/model/Report.js +2 -2
- package/src/component/value-objects/Address.js +11 -0
- package/src/component/value-objects/{Endereco.vue → Address.vue} +39 -40
- package/src/component/value-objects/{DadosContato.js → Contact.js} +2 -2
- package/src/component/value-objects/{DadosContato.vue → Contact.vue} +24 -17
- package/src/component/value-objects/Person.js +10 -0
- package/src/component/value-objects/{DadosPessoa.vue → Person.vue} +50 -35
- package/src/config/axios.js +9 -9
- package/src/config/dicas.js +14 -14
- package/src/config/router.js +13 -13
- package/src/config/token.js +14 -14
- package/src/main.js +23 -23
- package/src/store/modules/generic.js +512 -488
- package/src/store/modules/report.js +156 -127
- package/src/store/modules/user.js +6 -0
- package/src/store/modules/validation.js +38 -38
- package/src/store/store.js +13 -13
- package/docs/src/component/template/ModeloRelatorioView.drawio +0 -160
- package/src/component/shared/query-builder/ListDynamicComponent.vue +0 -42
- package/src/component/shared/query-builder/Totalization.vue +0 -38
- package/src/component/value-objects/DadosPessoa.js +0 -10
- package/src/component/value-objects/Endereco.js +0 -11
|
@@ -1,149 +1,154 @@
|
|
|
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
|
-
<slot v-else></slot>
|
|
14
|
-
<input
|
|
15
|
-
class="form-control"
|
|
16
|
-
type="number"
|
|
17
|
-
v-model="
|
|
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 Tip from "../shared/Tip.vue";
|
|
32
|
-
|
|
33
|
-
import { mapState, mapMutations } from "vuex";
|
|
34
|
-
|
|
35
|
-
export default {
|
|
36
|
-
name: "InputNumber",
|
|
37
|
-
components: { Tip },
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (this.
|
|
82
|
-
var message =
|
|
83
|
-
this.notifications.push(message);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (this.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-group">
|
|
3
|
+
<label v-if="title">
|
|
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
|
+
<slot v-else></slot>
|
|
14
|
+
<input
|
|
15
|
+
class="form-control"
|
|
16
|
+
type="number"
|
|
17
|
+
v-model="valueLocal"
|
|
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 Tip from "../shared/Tip.vue";
|
|
32
|
+
|
|
33
|
+
import { mapState, mapMutations } from "vuex";
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: "InputNumber",
|
|
37
|
+
components: { Tip },
|
|
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
|
+
params: Object,
|
|
55
|
+
value: Number,
|
|
56
|
+
changed: Function,
|
|
57
|
+
enter: Function,
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
notifications: [],
|
|
62
|
+
formDirty: false,
|
|
63
|
+
valueLocal: 0,
|
|
64
|
+
precision: 1,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
created() {
|
|
68
|
+
// não carregar as validações iniciais para number
|
|
69
|
+
this.valueLocal = this.value;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
methods: {
|
|
73
|
+
...mapMutations("validation", [
|
|
74
|
+
"addValidation",
|
|
75
|
+
"removeValidation",
|
|
76
|
+
"updateFormDirty",
|
|
77
|
+
]),
|
|
78
|
+
validate() {
|
|
79
|
+
this.notifications = [];
|
|
80
|
+
if (this.value == 0) return;
|
|
81
|
+
if (this.required && !this.value) {
|
|
82
|
+
var message = `${this.title} não pode ser vazio!`;
|
|
83
|
+
this.notifications.push(message);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (this.valueLocal.toString().length > this.maxLength) {
|
|
87
|
+
var message = `Valor inválido!`;
|
|
88
|
+
this.notifications.push(message);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
pressedEnter() {
|
|
92
|
+
if (this.enter) this.enter(this.params);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
computed: {
|
|
96
|
+
...mapState("validation", ["resetForm"]),
|
|
97
|
+
},
|
|
98
|
+
watch: {
|
|
99
|
+
value() {
|
|
100
|
+
this.valueLocal = this.value;
|
|
101
|
+
if (this.changed) this.changed();
|
|
102
|
+
},
|
|
103
|
+
valueLocal() {
|
|
104
|
+
this.validate();
|
|
105
|
+
|
|
106
|
+
let valueLocal;
|
|
107
|
+
if (this.type === "int") valueLocal = parseInt(this.valueLocal);
|
|
108
|
+
if (this.type === "float") valueLocal = parseFloat(this.valueLocal);
|
|
109
|
+
|
|
110
|
+
this.$emit("input", valueLocal);
|
|
111
|
+
this.formDirty = true;
|
|
112
|
+
if (this.markFormDirty) this.updateFormDirty(true);
|
|
113
|
+
|
|
114
|
+
this.valueLocal = valueLocal;
|
|
115
|
+
},
|
|
116
|
+
notifications() {
|
|
117
|
+
let self = this;
|
|
118
|
+
this.notifications.forEach(function (notification) {
|
|
119
|
+
let obj = {
|
|
120
|
+
key: self.field + "&" + self.formName,
|
|
121
|
+
formName: self.formName,
|
|
122
|
+
notification: notification,
|
|
123
|
+
};
|
|
124
|
+
self.addValidation(obj);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
if (this.notifications.length == 0) {
|
|
128
|
+
let obj = {
|
|
129
|
+
key: self.field + "&" + self.formName,
|
|
130
|
+
formName: self.formName,
|
|
131
|
+
};
|
|
132
|
+
self.removeValidation(obj);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
resetForm: {
|
|
136
|
+
handler(form) {
|
|
137
|
+
if (form.name == this.formName) this.formDirty = false;
|
|
138
|
+
},
|
|
139
|
+
deep: true,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<style scoped>
|
|
146
|
+
.success {
|
|
147
|
+
color: #94aa2a;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
}
|
|
150
|
+
.invalid {
|
|
151
|
+
color: #f0134d;
|
|
152
|
+
font-size: 14px;
|
|
153
|
+
}
|
|
154
|
+
</style>
|
|
@@ -1,135 +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
|
-
<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
|
-
<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 Tip from "../shared/Tip.vue";
|
|
34
|
-
import { mapState, mapMutations } from "vuex";
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
components: { Tip },
|
|
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", "updateFormDirty"]),
|
|
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.updateFormDirty(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.
|
|
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>
|
|
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
|
+
<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
|
+
<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 Tip from "../shared/Tip.vue";
|
|
34
|
+
import { mapState, mapMutations } from "vuex";
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
components: { Tip },
|
|
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", "updateFormDirty"]),
|
|
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.updateFormDirty(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.name == 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>
|