pui9-components 2.0.8 → 3.0.0
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/dist/pui9-components.common.js +5300 -22115
- package/dist/pui9-components.css +3 -6
- package/package-lock.json +1 -141
- package/package.json +1 -5
- package/src/App.vue +0 -117
- package/src/components/PuiAutocomplete.vue +0 -196
- package/src/components/PuiCauDialog.vue +0 -192
- package/src/components/PuiCheckbox.vue +0 -126
- package/src/components/PuiCodeEditor.vue +0 -124
- package/src/components/PuiDateField.vue +0 -1043
- package/src/components/PuiField.vue +0 -30
- package/src/components/PuiFieldSet.vue +0 -27
- package/src/components/PuiFileUpload.vue +0 -275
- package/src/components/PuiFileUploadGroup.vue +0 -241
- package/src/components/PuiFilter.vue +0 -104
- package/src/components/PuiFilterGroup.vue +0 -291
- package/src/components/PuiFilterRule.vue +0 -683
- package/src/components/PuiFormFooter.vue +0 -48
- package/src/components/PuiFormFooterBtns.vue +0 -118
- package/src/components/PuiFormHeader.vue +0 -25
- package/src/components/PuiFormLoading.vue +0 -14
- package/src/components/PuiFormMiniAudit.vue +0 -53
- package/src/components/PuiFormTooltip.vue +0 -50
- package/src/components/PuiMasterDetail.vue +0 -103
- package/src/components/PuiModalDialog.vue +0 -91
- package/src/components/PuiModalDialogForm.vue +0 -209
- package/src/components/PuiMultiSelect.vue +0 -636
- package/src/components/PuiNumberField.vue +0 -434
- package/src/components/PuiPasswordField.vue +0 -105
- package/src/components/PuiRadioGroup.vue +0 -105
- package/src/components/PuiRichTextEditor.vue +0 -116
- package/src/components/PuiSelect.vue +0 -1675
- package/src/components/PuiSelectDetailDialog.vue +0 -113
- package/src/components/PuiSelectTextService.vue +0 -61
- package/src/components/PuiSelectorList.vue +0 -169
- package/src/components/PuiSort.vue +0 -98
- package/src/components/PuiSpinnerField.vue +0 -464
- package/src/components/PuiSwitch.vue +0 -104
- package/src/components/PuiTextArea.vue +0 -204
- package/src/components/PuiTextField.vue +0 -389
- package/src/dateTimeUtils.js +0 -78
- package/src/index.js +0 -89
- package/src/main.js +0 -34
- package/src/mixins/PuiFormComponentMixin.js +0 -77
- package/src/mixins/PuiSortMixin.js +0 -136
- package/src/mixins/PuiUtilsNumberMixin.js +0 -29
- package/src/plugins/vuetify.js +0 -33
- package/src/tests/TestAutocomplete.vue +0 -138
- package/src/tests/TestCodeEditor.vue +0 -48
- package/src/tests/TestField.vue +0 -22
- package/src/tests/TestFieldSet.vue +0 -30
- package/src/tests/TestInputCheckbox.vue +0 -53
- package/src/tests/TestInputDate.vue +0 -146
- package/src/tests/TestInputNumber.vue +0 -77
- package/src/tests/TestInputRadioGroup.vue +0 -86
- package/src/tests/TestInputSpinner.vue +0 -77
- package/src/tests/TestInputSwitch.vue +0 -52
- package/src/tests/TestInputText.vue +0 -120
- package/src/tests/TestInputTextArea.vue +0 -73
- package/src/tests/TestMultiSelect.vue +0 -127
- package/src/tests/TestPuiForm.vue +0 -68
- package/src/tests/TestRichTextEditor.vue +0 -54
- package/src/tests/unit/PuiCheckbox.spec.js +0 -86
- package/src/tests/unit/PuiTextArea.spec.js +0 -62
- package/src/tests/unit/PuiTextField.spec.js +0 -119
- package/src/tests/unit/index.js +0 -5
- package/src/utils.js +0 -158
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- DESKTOP - TABLET -->
|
|
3
|
-
<div v-if="!isMobile">
|
|
4
|
-
<div v-if="toplabel" class="ml-1 mr-1">
|
|
5
|
-
<v-layout>
|
|
6
|
-
<v-flex xs12>
|
|
7
|
-
<label v-if="getLabel === '$nbsp;'"> </label>
|
|
8
|
-
<label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
|
|
9
|
-
</v-flex>
|
|
10
|
-
</v-layout>
|
|
11
|
-
<v-layout>
|
|
12
|
-
<v-flex xs12>
|
|
13
|
-
<v-textarea
|
|
14
|
-
v-model="internalModel"
|
|
15
|
-
v-bind="allProps"
|
|
16
|
-
:class="getEditedClass"
|
|
17
|
-
:rules="getRules"
|
|
18
|
-
solo
|
|
19
|
-
outlined
|
|
20
|
-
flat
|
|
21
|
-
single-line
|
|
22
|
-
auto-grow
|
|
23
|
-
@blur="updateValueLazy"
|
|
24
|
-
@input="updateValueRealtime"
|
|
25
|
-
:placeholder="getPlaceholder"
|
|
26
|
-
:error="internalError"
|
|
27
|
-
></v-textarea>
|
|
28
|
-
</v-flex>
|
|
29
|
-
</v-layout>
|
|
30
|
-
</div>
|
|
31
|
-
<div v-else class="ml-1 mr-1">
|
|
32
|
-
<v-layout>
|
|
33
|
-
<v-flex :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
|
|
34
|
-
<label :class="getLabelRequiredClass">{{ getLabel }}</label>
|
|
35
|
-
</v-flex>
|
|
36
|
-
<v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
|
|
37
|
-
<v-textarea
|
|
38
|
-
v-model="internalModel"
|
|
39
|
-
v-bind="allProps"
|
|
40
|
-
:class="getEditedClass"
|
|
41
|
-
:rules="getRules"
|
|
42
|
-
solo
|
|
43
|
-
outlined
|
|
44
|
-
flat
|
|
45
|
-
single-line
|
|
46
|
-
auto-grow
|
|
47
|
-
@blur="updateValueLazy"
|
|
48
|
-
@input="updateValueRealtime"
|
|
49
|
-
:placeholder="getPlaceholder"
|
|
50
|
-
:error="internalError"
|
|
51
|
-
></v-textarea>
|
|
52
|
-
</v-flex>
|
|
53
|
-
</v-layout>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<!-- MOBILE -->
|
|
57
|
-
<div v-else>
|
|
58
|
-
<v-layout>
|
|
59
|
-
<v-flex xs12>
|
|
60
|
-
<v-textarea
|
|
61
|
-
v-model="internalModel"
|
|
62
|
-
v-bind="allProps"
|
|
63
|
-
:class="getMobileClass"
|
|
64
|
-
:rules="getRules"
|
|
65
|
-
class="v-text-field--mobile"
|
|
66
|
-
:label="getLabel"
|
|
67
|
-
flat
|
|
68
|
-
auto-grow
|
|
69
|
-
@blur="updateValueLazy"
|
|
70
|
-
@input="updateValueRealtime"
|
|
71
|
-
:placeholder="getPlaceholder"
|
|
72
|
-
:error="internalError"
|
|
73
|
-
></v-textarea>
|
|
74
|
-
</v-flex>
|
|
75
|
-
</v-layout>
|
|
76
|
-
</div>
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<script>
|
|
80
|
-
import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
|
|
81
|
-
|
|
82
|
-
export default {
|
|
83
|
-
name: 'PuiTextArea',
|
|
84
|
-
mixins: [PuiFormComponentMixin],
|
|
85
|
-
props: {
|
|
86
|
-
value: {
|
|
87
|
-
type: [String, Number],
|
|
88
|
-
required: false
|
|
89
|
-
},
|
|
90
|
-
realtime: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
required: false,
|
|
93
|
-
default: false
|
|
94
|
-
},
|
|
95
|
-
placeholder: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: ' ',
|
|
98
|
-
required: false
|
|
99
|
-
},
|
|
100
|
-
noLazyModel: {
|
|
101
|
-
type: Boolean,
|
|
102
|
-
required: false,
|
|
103
|
-
default: false
|
|
104
|
-
},
|
|
105
|
-
labelColumnStyles: {
|
|
106
|
-
type: String,
|
|
107
|
-
required: false
|
|
108
|
-
},
|
|
109
|
-
valueColumnStyles: {
|
|
110
|
-
type: String,
|
|
111
|
-
required: false
|
|
112
|
-
},
|
|
113
|
-
rules: {
|
|
114
|
-
type: Array,
|
|
115
|
-
required: false
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
computed: {
|
|
119
|
-
getLabelRequiredClass() {
|
|
120
|
-
return { 'v-label--required': this.required };
|
|
121
|
-
},
|
|
122
|
-
getEditedClass() {
|
|
123
|
-
return { 'v-text-field--edited': this.isEdited };
|
|
124
|
-
},
|
|
125
|
-
getMobileClass() {
|
|
126
|
-
return { 'v-text-field--edited': this.isEdited, 'v-text-field--required': this.required };
|
|
127
|
-
},
|
|
128
|
-
getRules() {
|
|
129
|
-
const rules = this.rules ? [...this.rules] : [];
|
|
130
|
-
if (this.required) {
|
|
131
|
-
var func = (value) => !!value || this.requiredMessage;
|
|
132
|
-
var func2 = () => !this.internalError;
|
|
133
|
-
var func3 = () => {
|
|
134
|
-
if (this.internalModel === '' || this.internalModel === null) {
|
|
135
|
-
return this.requiredMessage;
|
|
136
|
-
}
|
|
137
|
-
return true;
|
|
138
|
-
};
|
|
139
|
-
rules.push(func, func2, func3);
|
|
140
|
-
}
|
|
141
|
-
return rules;
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
watch: {
|
|
145
|
-
value(val) {
|
|
146
|
-
if (!this.noLazyModel && !this.firstLazyLoad) {
|
|
147
|
-
this.initializeModel(val);
|
|
148
|
-
this.firstLazyLoad = true;
|
|
149
|
-
} else {
|
|
150
|
-
this.internalModel = val;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
created() {
|
|
155
|
-
if (this.noLazyModel) {
|
|
156
|
-
this.firstLazyLoad = true;
|
|
157
|
-
}
|
|
158
|
-
this.initialValue = this.value;
|
|
159
|
-
this.initializeModel(this.value);
|
|
160
|
-
},
|
|
161
|
-
methods: {
|
|
162
|
-
updateValueLazy() {
|
|
163
|
-
this.checkValue();
|
|
164
|
-
if (!this.realtime) {
|
|
165
|
-
this.internalModel = this.sanitizePuiFormHtmlText(this.internalModel);
|
|
166
|
-
if (this.internalModel === '' || this.internalModel === 'null' || this.internalModel === 'undefined') {
|
|
167
|
-
this.internalModel = undefined;
|
|
168
|
-
}
|
|
169
|
-
this.$emit('input', this.internalModel);
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
updateValueRealtime() {
|
|
173
|
-
this.checkValue();
|
|
174
|
-
if (this.realtime) {
|
|
175
|
-
this.internalModel = this.sanitizePuiFormHtmlText(this.internalModel);
|
|
176
|
-
if (this.internalModel === '' || this.internalModel === 'null' || this.internalModel === 'undefined') {
|
|
177
|
-
this.internalModel = undefined;
|
|
178
|
-
}
|
|
179
|
-
this.$emit('input', this.internalModel);
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
initializeModel(value) {
|
|
183
|
-
this.internalModel = value;
|
|
184
|
-
if (value !== null && !this.firstLazyLoad) {
|
|
185
|
-
this.firstLazyLoad = true;
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
checkValue() {
|
|
189
|
-
this.clearMessages();
|
|
190
|
-
if (this.required) {
|
|
191
|
-
if (this.internalModel === '' || this.internalModel === null) {
|
|
192
|
-
this.showErrorMessage();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
clearMessages() {
|
|
197
|
-
this.internalError = false;
|
|
198
|
-
},
|
|
199
|
-
showErrorMessage() {
|
|
200
|
-
this.internalError = true;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
</script>
|
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- DESKTOP - TABLET -->
|
|
3
|
-
<div v-if="!isMobile">
|
|
4
|
-
<div v-if="toplabel || !hasLabel" class="ml-1 mr-1">
|
|
5
|
-
<v-layout v-if="hasLabel">
|
|
6
|
-
<v-flex xs12>
|
|
7
|
-
<label v-if="getLabel === '$nbsp;'"> </label>
|
|
8
|
-
<label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
|
|
9
|
-
<pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
|
|
10
|
-
</v-flex>
|
|
11
|
-
</v-layout>
|
|
12
|
-
<v-layout>
|
|
13
|
-
<v-flex xs12>
|
|
14
|
-
<v-text-field
|
|
15
|
-
v-model="internalModel"
|
|
16
|
-
v-bind="allProps"
|
|
17
|
-
:class="getEditedClass"
|
|
18
|
-
:rules="getRules"
|
|
19
|
-
solo
|
|
20
|
-
outlined
|
|
21
|
-
flat
|
|
22
|
-
@blur="updateValueLazy"
|
|
23
|
-
@input="updateValueRealtime"
|
|
24
|
-
:placeholder="getPlaceholder"
|
|
25
|
-
:error="internalError"
|
|
26
|
-
v-on="$listeners"
|
|
27
|
-
></v-text-field>
|
|
28
|
-
</v-flex>
|
|
29
|
-
</v-layout>
|
|
30
|
-
</div>
|
|
31
|
-
<div v-else class="ml-1 mr-1">
|
|
32
|
-
<v-layout>
|
|
33
|
-
<v-flex :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
|
|
34
|
-
<label :class="getLabelRequiredClass">{{ getLabel }}</label>
|
|
35
|
-
<pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
|
|
36
|
-
</v-flex>
|
|
37
|
-
<v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
|
|
38
|
-
<v-text-field
|
|
39
|
-
v-model="internalModel"
|
|
40
|
-
v-bind="allProps"
|
|
41
|
-
:class="getEditedClass"
|
|
42
|
-
:rules="getRules"
|
|
43
|
-
solo
|
|
44
|
-
outlined
|
|
45
|
-
flat
|
|
46
|
-
@blur="updateValueLazy"
|
|
47
|
-
@input="updateValueRealtime"
|
|
48
|
-
:placeholder="getPlaceholder"
|
|
49
|
-
:error="internalError"
|
|
50
|
-
v-on="$listeners"
|
|
51
|
-
></v-text-field>
|
|
52
|
-
</v-flex>
|
|
53
|
-
</v-layout>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
<!-- MOBILE -->
|
|
57
|
-
<div v-else>
|
|
58
|
-
<v-layout>
|
|
59
|
-
<v-flex xs12>
|
|
60
|
-
<v-text-field
|
|
61
|
-
v-model="internalModel"
|
|
62
|
-
v-bind="allProps"
|
|
63
|
-
:label="getLabel"
|
|
64
|
-
:class="getMobileClass"
|
|
65
|
-
:rules="getRules"
|
|
66
|
-
class="v-text-field--mobile"
|
|
67
|
-
flat
|
|
68
|
-
@blur="updateValueLazy"
|
|
69
|
-
@input="updateValueRealtime"
|
|
70
|
-
:placeholder="getPlaceholder"
|
|
71
|
-
:error="internalError"
|
|
72
|
-
v-on="$listeners"
|
|
73
|
-
></v-text-field>
|
|
74
|
-
</v-flex>
|
|
75
|
-
</v-layout>
|
|
76
|
-
</div>
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<script>
|
|
80
|
-
import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
|
|
81
|
-
|
|
82
|
-
export default {
|
|
83
|
-
name: 'PuiTextField',
|
|
84
|
-
mixins: [PuiFormComponentMixin],
|
|
85
|
-
props: {
|
|
86
|
-
value: {
|
|
87
|
-
type: [String, Number],
|
|
88
|
-
required: false
|
|
89
|
-
},
|
|
90
|
-
tooltip: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
required: false,
|
|
93
|
-
default: false
|
|
94
|
-
},
|
|
95
|
-
tooltipDescription: {
|
|
96
|
-
type: String,
|
|
97
|
-
required: false
|
|
98
|
-
},
|
|
99
|
-
tooltipIcon: {
|
|
100
|
-
type: String,
|
|
101
|
-
required: false,
|
|
102
|
-
},
|
|
103
|
-
realtime: {
|
|
104
|
-
type: Boolean,
|
|
105
|
-
required: false,
|
|
106
|
-
default: false
|
|
107
|
-
},
|
|
108
|
-
placeholder: {
|
|
109
|
-
type: String,
|
|
110
|
-
required: false,
|
|
111
|
-
default: ' '
|
|
112
|
-
},
|
|
113
|
-
noLazyModel: {
|
|
114
|
-
type: Boolean,
|
|
115
|
-
required: false,
|
|
116
|
-
default: false
|
|
117
|
-
},
|
|
118
|
-
readonly: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
required: false,
|
|
121
|
-
default: false
|
|
122
|
-
},
|
|
123
|
-
rules: {
|
|
124
|
-
type: Array,
|
|
125
|
-
default: () => {
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
emailMask: {
|
|
130
|
-
type: Boolean,
|
|
131
|
-
required: false,
|
|
132
|
-
default: false
|
|
133
|
-
},
|
|
134
|
-
nifMask: {
|
|
135
|
-
type: Boolean,
|
|
136
|
-
required: false,
|
|
137
|
-
default: false
|
|
138
|
-
},
|
|
139
|
-
nieMask: {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
required: false,
|
|
142
|
-
default: false
|
|
143
|
-
},
|
|
144
|
-
cifMask: {
|
|
145
|
-
type: Boolean,
|
|
146
|
-
required: false,
|
|
147
|
-
default: false
|
|
148
|
-
},
|
|
149
|
-
passportMask: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
required: false,
|
|
152
|
-
default: false
|
|
153
|
-
},
|
|
154
|
-
maxlength: {
|
|
155
|
-
type: [Number, String],
|
|
156
|
-
required: false
|
|
157
|
-
},
|
|
158
|
-
labelColumnStyles: {
|
|
159
|
-
type: String,
|
|
160
|
-
required: false
|
|
161
|
-
},
|
|
162
|
-
valueColumnStyles: {
|
|
163
|
-
type: String,
|
|
164
|
-
required: false
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
computed: {
|
|
168
|
-
getMobileClass() {
|
|
169
|
-
return { 'v-text-field--edited': this.isEdited, 'v-text-field--required': this.required };
|
|
170
|
-
},
|
|
171
|
-
getLabelRequiredClass() {
|
|
172
|
-
return { 'v-label--required': this.required };
|
|
173
|
-
},
|
|
174
|
-
getEditedClass() {
|
|
175
|
-
return { 'v-text-field--edited': this.isEdited };
|
|
176
|
-
},
|
|
177
|
-
getRules() {
|
|
178
|
-
const rules = [...this.rules];
|
|
179
|
-
if (this.required) {
|
|
180
|
-
var func = (value) => !!value || this.requiredMessage;
|
|
181
|
-
var func2 = () => !this.internalError;
|
|
182
|
-
var func3 = () => {
|
|
183
|
-
if (this.internalModel === '' || this.internalModel === null) {
|
|
184
|
-
return this.requiredMessage;
|
|
185
|
-
}
|
|
186
|
-
return true;
|
|
187
|
-
};
|
|
188
|
-
rules.push(func, func2, func3);
|
|
189
|
-
}
|
|
190
|
-
if (this.emailMask) {
|
|
191
|
-
var checkEmail = (value) => {
|
|
192
|
-
if (!value) {
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
if (value.length > 0) {
|
|
196
|
-
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
197
|
-
return pattern.test(value) || this.$t('form.puialertconfiguration.emails_invalid');
|
|
198
|
-
}
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
rules.push(checkEmail);
|
|
202
|
-
}
|
|
203
|
-
if (this.nifMask) {
|
|
204
|
-
var checkNif = (value) => {
|
|
205
|
-
if (!value) {
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
value = value.toUpperCase();
|
|
209
|
-
if (value.length > 0) {
|
|
210
|
-
const pattern = /^(\d{8})([A-Z]{1})$/;
|
|
211
|
-
var letters = "TRWAGMYFPDXBNJZSQVHLCKE";
|
|
212
|
-
if (pattern.test(value)) {
|
|
213
|
-
console.log("letters.charAt(value.substring(0, 8) % 23)",letters.charAt(value.substring(0, 8) % 23));
|
|
214
|
-
console.log("value.charAt(8)",value.charAt(8));
|
|
215
|
-
if (letters.charAt(value.substring(0, 8) % 23) === value.charAt(8)){
|
|
216
|
-
return true;
|
|
217
|
-
} else{
|
|
218
|
-
return this.$t('form.puialertconfiguration.nifs_invalid');
|
|
219
|
-
}
|
|
220
|
-
} else {
|
|
221
|
-
return this.$t('form.puialertconfiguration.nifs_invalid');
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
rules.push(checkNif);
|
|
227
|
-
}
|
|
228
|
-
if (this.nieMask) {
|
|
229
|
-
var checkNie = (value) => {
|
|
230
|
-
if (!value) {
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
value = value.toUpperCase();
|
|
234
|
-
if (value.length > 0) {
|
|
235
|
-
const pattern = /^([XYZ]{1})(\d{7})([A-Z]{1})$/;
|
|
236
|
-
var letters = "TRWAGMYFPDXBNJZSQVHLCKE";
|
|
237
|
-
if (pattern.test(value)) {
|
|
238
|
-
if (value.startsWith('X')) {
|
|
239
|
-
value = value.replace('X', '0');
|
|
240
|
-
} else if (value.startsWith('Y')) {
|
|
241
|
-
value = value.replace('Y', '1');
|
|
242
|
-
} else if (value.startsWith('Z')) {
|
|
243
|
-
value = value.replace('Z', '2');
|
|
244
|
-
}
|
|
245
|
-
if (letters.charAt(value.substring(0, 8) % 23) == value.charAt(8)){
|
|
246
|
-
return true;
|
|
247
|
-
} else{
|
|
248
|
-
return this.$t('form.puialertconfiguration.nies_invalid');
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
return this.$t('form.puialertconfiguration.nies_invalid');
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return false;
|
|
255
|
-
}
|
|
256
|
-
rules.push(checkNie);
|
|
257
|
-
}
|
|
258
|
-
if (this.cifMask) {
|
|
259
|
-
var checkCif = (value) => {
|
|
260
|
-
if (!value) {
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
value = value.toUpperCase();
|
|
264
|
-
if (value.length > 0) {
|
|
265
|
-
const pattern = /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/;
|
|
266
|
-
return pattern.test(value) || this.$t('form.puialertconfiguration.cifs_invalid');
|
|
267
|
-
}
|
|
268
|
-
var v1 = new Array(0, 2, 4, 6, 8, 1, 3, 5, 7, 9);
|
|
269
|
-
var temp = 0;
|
|
270
|
-
var dc;
|
|
271
|
-
var i;
|
|
272
|
-
for (i = 2; i <= 6; i += 2) {
|
|
273
|
-
temp = temp + v1[parseInt(value.substr(i - 1, 1))];
|
|
274
|
-
temp = temp + parseInt(value.substr(i, 1));
|
|
275
|
-
}
|
|
276
|
-
temp = temp + v1[parseInt(value.substr(7, 1))];
|
|
277
|
-
temp = (10 - (temp % 10));
|
|
278
|
-
if (temp == 10) {
|
|
279
|
-
temp = 0;
|
|
280
|
-
}
|
|
281
|
-
dc = value.toUpperCase().charAt(8);
|
|
282
|
-
if ((dc == temp) || (temp == 1 && dc == 'A') || (temp == 2 && dc == 'B') || (temp == 3 && dc == 'C') || (temp == 4 && dc == 'D') || (temp == 5 && dc == 'E') || (temp == 6 && dc == 'F') || (temp == 7 && dc == 'G') || (temp == 8 && dc == 'H') || (temp == 9 && dc == 'I') || (temp == 0 && dc == 'J')){
|
|
283
|
-
return true;
|
|
284
|
-
} else {
|
|
285
|
-
return this.$t('form.puialertconfiguration.cifs_invalid');
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
rules.push(checkCif);
|
|
289
|
-
}
|
|
290
|
-
if (this.passportMask) {
|
|
291
|
-
var checkPassport = (value) => {
|
|
292
|
-
if (!value) {
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
value = value.toUpperCase();
|
|
296
|
-
if (value.length > 0) {
|
|
297
|
-
const pattern = /[A-Z]{3}[0-9]{6}/;
|
|
298
|
-
return pattern.test(value) || this.$t('form.puialertconfiguration.passports_invalid');
|
|
299
|
-
}
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
rules.push(checkPassport);
|
|
303
|
-
}
|
|
304
|
-
return rules;
|
|
305
|
-
},
|
|
306
|
-
compPlaceholder() {
|
|
307
|
-
if (this.placeholder && this.placeholder.length > 0) {
|
|
308
|
-
return this.placeholder;
|
|
309
|
-
}
|
|
310
|
-
return ' ';
|
|
311
|
-
},
|
|
312
|
-
showTooltip() {
|
|
313
|
-
if (this.getLabel === '' || this.getLabel === null) {
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
return this.tooltipDescription || this.tooltip;
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
watch: {
|
|
320
|
-
value(val) {
|
|
321
|
-
if (!this.noLazyModel && !this.firstLazyLoad) {
|
|
322
|
-
this.initializeModel(val);
|
|
323
|
-
this.firstLazyLoad = true;
|
|
324
|
-
} else {
|
|
325
|
-
this.internalModel = val;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
created() {
|
|
330
|
-
if (this.noLazyModel) {
|
|
331
|
-
this.firstLazyLoad = true;
|
|
332
|
-
}
|
|
333
|
-
this.initialValue = this.value;
|
|
334
|
-
this.initializeModel(this.value);
|
|
335
|
-
},
|
|
336
|
-
mounted() {
|
|
337
|
-
if (this.tooltip && this.$refs.tooltip) {
|
|
338
|
-
this.setTooltip();
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
methods: {
|
|
342
|
-
setTooltip() {
|
|
343
|
-
if (this.maxlength) {
|
|
344
|
-
this.$refs.tooltip.pushMessage(`${this.$t('pui9.error.field_maxlength')} ${this.maxlength}`);
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
updateValueLazy() {
|
|
348
|
-
this.checkValue();
|
|
349
|
-
if (!this.realtime) {
|
|
350
|
-
this.internalModel = this.sanitizePuiFormHtmlText(this.internalModel);
|
|
351
|
-
if (this.internalModel === '' || this.internalModel === 'null' || this.internalModel === 'undefined') {
|
|
352
|
-
this.internalModel = undefined;
|
|
353
|
-
}
|
|
354
|
-
this.$emit('input', this.internalModel);
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
updateValueRealtime() {
|
|
358
|
-
this.checkValue();
|
|
359
|
-
if (this.realtime) {
|
|
360
|
-
this.internalModel = this.sanitizePuiFormHtmlText(this.internalModel);
|
|
361
|
-
if (this.internalModel === '' || this.internalModel === 'null' || this.internalModel === 'undefined') {
|
|
362
|
-
this.internalModel = undefined;
|
|
363
|
-
}
|
|
364
|
-
this.$emit('input', this.internalModel);
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
|
-
initializeModel(value) {
|
|
368
|
-
this.internalModel = value;
|
|
369
|
-
if (value !== null && !this.firstLazyLoad) {
|
|
370
|
-
this.firstLazyLoad = true;
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
checkValue() {
|
|
374
|
-
this.clearMessages();
|
|
375
|
-
if (this.required) {
|
|
376
|
-
if (this.internalModel === '' || this.internalModel === null) {
|
|
377
|
-
this.showErrorMessage();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
},
|
|
381
|
-
clearMessages() {
|
|
382
|
-
this.internalError = false;
|
|
383
|
-
},
|
|
384
|
-
showErrorMessage() {
|
|
385
|
-
this.internalError = true;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
</script>
|
package/src/dateTimeUtils.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
|
|
3
|
-
/// //////////////// MOMENTJS TIME SUPPORT
|
|
4
|
-
export default {
|
|
5
|
-
getLocalDateNowMillis: () => {
|
|
6
|
-
return moment();
|
|
7
|
-
},
|
|
8
|
-
getLocalDateNow: (format) => {
|
|
9
|
-
var f = 'YYYY-MM-DD';
|
|
10
|
-
if (format) {
|
|
11
|
-
f = format;
|
|
12
|
-
}
|
|
13
|
-
return moment().format(f);
|
|
14
|
-
},
|
|
15
|
-
formatDate: (date, format) => {
|
|
16
|
-
return moment(date).format(format);
|
|
17
|
-
},
|
|
18
|
-
getLocalTimeNow: (format) => {
|
|
19
|
-
var f = 'HH:mm:ss';
|
|
20
|
-
if (format) {
|
|
21
|
-
f = format;
|
|
22
|
-
}
|
|
23
|
-
return moment().format(f);
|
|
24
|
-
},
|
|
25
|
-
getLocalDate: (date) => {
|
|
26
|
-
if (date) {
|
|
27
|
-
return moment(date).format();
|
|
28
|
-
}
|
|
29
|
-
return date;
|
|
30
|
-
},
|
|
31
|
-
getLocalFormattedDateFromMillis: (millis, isoFormat) => {
|
|
32
|
-
return moment(millis).format(isoFormat);
|
|
33
|
-
},
|
|
34
|
-
getLocalFormattedDate: (date, isoFormat) => {
|
|
35
|
-
if (date) {
|
|
36
|
-
return moment(date).format(isoFormat);
|
|
37
|
-
}
|
|
38
|
-
return date;
|
|
39
|
-
},
|
|
40
|
-
isLocalDateValid: (date) => {
|
|
41
|
-
return moment(date).isValid();
|
|
42
|
-
},
|
|
43
|
-
isLocalDateBefore: (date, date2) => {
|
|
44
|
-
var d2 = moment(date2);
|
|
45
|
-
return moment(date).isBefore(d2);
|
|
46
|
-
},
|
|
47
|
-
isLocalDateSameOrBefore: (date, date2) => {
|
|
48
|
-
var d2 = moment(date2);
|
|
49
|
-
return moment(date).isSameOrBefore(d2);
|
|
50
|
-
},
|
|
51
|
-
isLocalDateAfter: (date, date2) => {
|
|
52
|
-
var d2 = moment(date2);
|
|
53
|
-
return moment(date).isAfter(d2);
|
|
54
|
-
},
|
|
55
|
-
isLocalDateSameOrAfter: (date, date2) => {
|
|
56
|
-
var d2 = moment(date2);
|
|
57
|
-
return moment(date).isSameOrAfter(d2);
|
|
58
|
-
},
|
|
59
|
-
isLocalDateEqual: (date, date2) => {
|
|
60
|
-
var d2 = moment(date2);
|
|
61
|
-
return moment(date).isSame(d2);
|
|
62
|
-
},
|
|
63
|
-
getUTCDate: (date) => {
|
|
64
|
-
return moment.utc(date).format();
|
|
65
|
-
},
|
|
66
|
-
getUTCOffset: () => {
|
|
67
|
-
return moment().utcOffset();
|
|
68
|
-
},
|
|
69
|
-
getUTCDateNow: () => {
|
|
70
|
-
return moment.utc().format();
|
|
71
|
-
},
|
|
72
|
-
addDaysToLocalDate(date, numberOfDays) {
|
|
73
|
-
return moment(date).add(numberOfDays, 'days').utc().format();
|
|
74
|
-
},
|
|
75
|
-
getMomentFromDate(date) {
|
|
76
|
-
return moment(date);
|
|
77
|
-
}
|
|
78
|
-
};
|