pui9-components 2.0.7 → 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.
Files changed (67) hide show
  1. package/dist/pui9-components.common.js +5403 -22189
  2. package/dist/pui9-components.css +3 -6
  3. package/package-lock.json +635 -774
  4. package/package.json +1 -5
  5. package/src/App.vue +0 -117
  6. package/src/components/PuiAutocomplete.vue +0 -196
  7. package/src/components/PuiCauDialog.vue +0 -192
  8. package/src/components/PuiCheckbox.vue +0 -126
  9. package/src/components/PuiCodeEditor.vue +0 -124
  10. package/src/components/PuiDateField.vue +0 -1043
  11. package/src/components/PuiField.vue +0 -30
  12. package/src/components/PuiFieldSet.vue +0 -27
  13. package/src/components/PuiFileUpload.vue +0 -275
  14. package/src/components/PuiFileUploadGroup.vue +0 -241
  15. package/src/components/PuiFilter.vue +0 -104
  16. package/src/components/PuiFilterGroup.vue +0 -291
  17. package/src/components/PuiFilterRule.vue +0 -683
  18. package/src/components/PuiFormFooter.vue +0 -48
  19. package/src/components/PuiFormFooterBtns.vue +0 -118
  20. package/src/components/PuiFormHeader.vue +0 -25
  21. package/src/components/PuiFormLoading.vue +0 -14
  22. package/src/components/PuiFormMiniAudit.vue +0 -53
  23. package/src/components/PuiFormTooltip.vue +0 -50
  24. package/src/components/PuiMasterDetail.vue +0 -103
  25. package/src/components/PuiModalDialog.vue +0 -91
  26. package/src/components/PuiModalDialogForm.vue +0 -209
  27. package/src/components/PuiMultiSelect.vue +0 -636
  28. package/src/components/PuiNumberField.vue +0 -434
  29. package/src/components/PuiPasswordField.vue +0 -105
  30. package/src/components/PuiRadioGroup.vue +0 -105
  31. package/src/components/PuiRichTextEditor.vue +0 -116
  32. package/src/components/PuiSelect.vue +0 -1675
  33. package/src/components/PuiSelectDetailDialog.vue +0 -113
  34. package/src/components/PuiSelectTextService.vue +0 -61
  35. package/src/components/PuiSelectorList.vue +0 -169
  36. package/src/components/PuiSort.vue +0 -98
  37. package/src/components/PuiSpinnerField.vue +0 -464
  38. package/src/components/PuiSwitch.vue +0 -104
  39. package/src/components/PuiTextArea.vue +0 -204
  40. package/src/components/PuiTextField.vue +0 -389
  41. package/src/dateTimeUtils.js +0 -78
  42. package/src/index.js +0 -89
  43. package/src/main.js +0 -34
  44. package/src/mixins/PuiFormComponentMixin.js +0 -77
  45. package/src/mixins/PuiSortMixin.js +0 -136
  46. package/src/mixins/PuiUtilsNumberMixin.js +0 -29
  47. package/src/plugins/vuetify.js +0 -33
  48. package/src/tests/TestAutocomplete.vue +0 -138
  49. package/src/tests/TestCodeEditor.vue +0 -48
  50. package/src/tests/TestField.vue +0 -22
  51. package/src/tests/TestFieldSet.vue +0 -30
  52. package/src/tests/TestInputCheckbox.vue +0 -53
  53. package/src/tests/TestInputDate.vue +0 -146
  54. package/src/tests/TestInputNumber.vue +0 -77
  55. package/src/tests/TestInputRadioGroup.vue +0 -86
  56. package/src/tests/TestInputSpinner.vue +0 -77
  57. package/src/tests/TestInputSwitch.vue +0 -52
  58. package/src/tests/TestInputText.vue +0 -120
  59. package/src/tests/TestInputTextArea.vue +0 -73
  60. package/src/tests/TestMultiSelect.vue +0 -127
  61. package/src/tests/TestPuiForm.vue +0 -68
  62. package/src/tests/TestRichTextEditor.vue +0 -54
  63. package/src/tests/unit/PuiCheckbox.spec.js +0 -86
  64. package/src/tests/unit/PuiTextArea.spec.js +0 -62
  65. package/src/tests/unit/PuiTextField.spec.js +0 -119
  66. package/src/tests/unit/index.js +0 -5
  67. package/src/utils.js +0 -158
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": {
5
5
  "name": "Prodevelop S.L."
6
6
  },
7
- "version": "2.0.7",
7
+ "version": "3.0.0",
8
8
  "license": "Copyright",
9
9
  "main": "dist/pui9-components.common.js",
10
10
  "scripts": {
@@ -47,10 +47,7 @@
47
47
  "sass-loader": "10.0.2",
48
48
  "vue": "2.7.14",
49
49
  "vue-i18n": "8.28.2",
50
- "vue-cli-plugin-vuetify": "2.5.8",
51
50
  "vue-template-compiler": "2.7.14",
52
- "vuetify-loader": "1.9.2",
53
- "vuetify": "2.6.12",
54
51
  "vuex": "3.6.2"
55
52
  },
56
53
  "eslintConfig": {
@@ -73,7 +70,6 @@
73
70
  ],
74
71
  "files": [
75
72
  "dist/*",
76
- "src/*",
77
73
  "*.json"
78
74
  ],
79
75
  "jest": {
package/src/App.vue DELETED
@@ -1,117 +0,0 @@
1
- <template>
2
- <v-app>
3
- <v-app-bar app color="primary" dark>
4
- <div class="d-flex align-center">
5
- <h2>PUI9 Basic Components Library</h2>
6
- </div>
7
-
8
- <v-spacer></v-spacer>
9
-
10
- <v-btn href="https://confluence.prodevelop.es/pages/viewpage.action?pageId=163217879" target="_blank" text>
11
- <span class="mr-2">Documentation</span>
12
- <v-icon>mdi-open-in-new</v-icon>
13
- </v-btn>
14
- </v-app-bar>
15
-
16
- <v-content style="height: 100vh; overflow-y: auto;">
17
- <v-container>
18
- <v-tabs show-arrows>
19
- <v-tab ripple>PuiFieldSet</v-tab>
20
- <v-tab ripple>PuiField</v-tab>
21
- <v-tab ripple>PuiTextArea</v-tab>
22
- <v-tab ripple>PuiTextField</v-tab>
23
- <v-tab ripple>PuiNumberField</v-tab>
24
- <v-tab ripple>PuiSpinnerField</v-tab>
25
- <v-tab ripple>PuiDateField</v-tab>
26
- <v-tab ripple>PuiRadioGroup</v-tab>
27
- <v-tab ripple>PuiCheckbox</v-tab>
28
- <v-tab ripple>PuiSwitch</v-tab>
29
- <v-tab ripple>PuiMultiSelect</v-tab>
30
- <v-tab ripple>PuiCodeEditor</v-tab>
31
- <v-tab ripple>PuiRichTextEditor</v-tab>
32
- <v-tab ripple>PuiForm</v-tab>
33
-
34
- <v-tab-item lazy>
35
- <test-field-set></test-field-set>
36
- </v-tab-item>
37
- <v-tab-item lazy>
38
- <test-field></test-field>
39
- </v-tab-item>
40
- <v-tab-item lazy>
41
- <test-input-text-area></test-input-text-area>
42
- </v-tab-item>
43
- <v-tab-item lazy>
44
- <test-input-text></test-input-text>
45
- </v-tab-item>
46
- <v-tab-item lazy>
47
- <test-input-number></test-input-number>
48
- </v-tab-item>
49
- <v-tab-item lazy>
50
- <test-input-spinner></test-input-spinner>
51
- </v-tab-item>
52
- <v-tab-item lazy>
53
- <test-input-date></test-input-date>
54
- </v-tab-item>
55
- <v-tab-item lazy>
56
- <test-input-radio-group></test-input-radio-group>
57
- </v-tab-item>
58
- <v-tab-item lazy>
59
- <test-input-checkbox></test-input-checkbox>
60
- </v-tab-item>
61
- <v-tab-item lazy>
62
- <test-input-switch></test-input-switch>
63
- </v-tab-item>
64
- <v-tab-item lazy>
65
- <test-multi-select></test-multi-select>
66
- </v-tab-item>
67
- <v-tab-item lazy>
68
- <test-code-editor></test-code-editor>
69
- </v-tab-item>
70
- <v-tab-item lazy>
71
- <test-rich-text-editor></test-rich-text-editor>
72
- </v-tab-item>
73
- <v-tab-item lazy>
74
- <test-pui-form></test-pui-form>
75
- </v-tab-item>
76
- </v-tabs>
77
- </v-container>
78
- </v-content>
79
- </v-app>
80
- </template>
81
-
82
- <script>
83
- import TestFieldSet from '@/tests/TestFieldSet';
84
- import TestField from '@/tests/TestField';
85
- import TestInputTextArea from '@/tests/TestInputTextArea';
86
- import TestInputText from '@/tests/TestInputText';
87
- import TestInputNumber from '@/tests/TestInputNumber';
88
- import TestInputSpinner from '@/tests/TestInputSpinner';
89
- import TestInputDate from '@/tests/TestInputDate';
90
- import TestInputRadioGroup from '@/tests/TestInputRadioGroup';
91
- import TestInputCheckbox from '@/tests/TestInputCheckbox';
92
- import TestInputSwitch from '@/tests/TestInputSwitch';
93
- import TestMultiSelect from '@/tests/TestMultiSelect';
94
- import TestCodeEditor from '@/tests/TestCodeEditor';
95
- import TestRichTextEditor from '@/tests/TestRichTextEditor';
96
- import TestPuiForm from '@/tests/TestPuiForm';
97
-
98
- export default {
99
- name: 'App',
100
- components: {
101
- TestFieldSet,
102
- TestField,
103
- TestInputTextArea,
104
- TestInputText,
105
- TestInputNumber,
106
- TestInputSpinner,
107
- TestInputDate,
108
- TestInputRadioGroup,
109
- TestInputCheckbox,
110
- TestInputSwitch,
111
- TestMultiSelect,
112
- TestCodeEditor,
113
- TestRichTextEditor,
114
- TestPuiForm
115
- }
116
- };
117
- </script>
@@ -1,196 +0,0 @@
1
- <template>
2
- <div class="ml-1 mr-1">
3
- <v-layout wrap>
4
- <v-flex v-if="!isMobile" :class="toplabel ? 'xs12' : labelColumnStyles || 'xs12 sm6 md4 xl3'">
5
- <label v-if="getLabel === '$nbsp;'">&nbsp;</label>
6
- <label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
7
- </v-flex>
8
- <v-flex :class="isMobile || toplabel ? 'xs12' : valueColumnStyles || 'xs12 sm6 md8 xl9'">
9
- <v-autocomplete
10
- class="pui-select"
11
- :class="getEditedClass"
12
- v-model="internalModel"
13
- :items="items"
14
- :item-text="itemText"
15
- solo
16
- flat
17
- :clearable="clearable"
18
- :rules="getRules"
19
- :placeholder="getPlaceholder"
20
- :error="internalError"
21
- v-bind="allProps"
22
- @input="emitChangeValue"
23
- >
24
- <!-- pass through scoped slots -->
25
- <template v-for="(_, scopedSlotName) in $scopedSlots" v-slot:[scopedSlotName]="slotData">
26
- <slot :name="scopedSlotName" v-bind="slotData" />
27
- </template>
28
- <!-- pass through normal slots -->
29
- <template v-for="(_, slotName) in $slots" v-slot:[slotName]>
30
- <slot :name="slotName" />
31
- </template>
32
- <template v-if="!$slots.item" v-slot:item="{ item, attrs, on }">
33
- <template>
34
- <v-list-item v-bind="attrs" v-on="on" class="pui-select__item">
35
- <v-list-item-content class="pl-3">
36
- <pui-select-text-service :item="item" :itemText="itemText" />
37
- </v-list-item-content>
38
- <v-list-item-action class="pr-3" v-if="attrs['aria-selected'] === 'true'">
39
- <v-icon small class="pui-select__item-icon">fa fa-check</v-icon>
40
- </v-list-item-action>
41
- </v-list-item>
42
- </template>
43
- </template>
44
- </v-autocomplete>
45
- </v-flex>
46
- </v-layout>
47
- </div>
48
- </template>
49
-
50
- <script>
51
- import PuiSelectTextService from './PuiSelectTextService';
52
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
53
-
54
- export default {
55
- name: 'PuiAutocomplete',
56
- components: { PuiSelectTextService },
57
- mixins: [PuiFormComponentMixin],
58
- props: {
59
- value: {
60
- type: [String, Number, Object, Array],
61
- required: false
62
- },
63
- rules: {
64
- type: Array,
65
- default: () => {
66
- return [];
67
- }
68
- },
69
- /* Native by the v-select. If true adds a close icon to the selection */
70
- clearable: {
71
- type: [Boolean],
72
- default: true,
73
- required: false
74
- },
75
- /* If value is Object, this property has to be defined with key:value atributes */
76
- modelFormMapping: {
77
- type: Object,
78
- default: null,
79
- required: false
80
- },
81
- /* Native by the v-select. The items in the list */
82
- items: {
83
- type: [Array],
84
- required: true
85
- },
86
- /* The items text property name. Same to item-text in v-select. */
87
- itemText: {
88
- type: [String, Array, Function],
89
- default: 'text',
90
- required: false
91
- },
92
- /* The items value property name. Same to item-value in v-select. */
93
- itemValue: {
94
- type: [String, Array, Function],
95
- default: 'value',
96
- required: false
97
- },
98
- labelColumnStyles: {
99
- type: [String],
100
- required: false
101
- },
102
- valueColumnStyles: {
103
- type: [String],
104
- required: false
105
- }
106
- },
107
- computed: {
108
- isDisabled() {
109
- return this.disabled;
110
- },
111
- isEdited() {
112
- if (this.noeditable || this.disabled || this.readonly) {
113
- return false;
114
- } else {
115
- return JSON.stringify(this.initialValue) != JSON.stringify(this.internalModel);
116
- }
117
- },
118
- getLabelRequiredClass() {
119
- return { 'v-label--required': this.required };
120
- },
121
- getEditedClass() {
122
- const editedClass = { 'v-text-field--edited': this.isEdited };
123
- if (this.attach) {
124
- editedClass['puiautocomplete-' + this.attach] = true;
125
- }
126
- return editedClass;
127
- },
128
- getRules() {
129
- const rules = [...this.rules];
130
- if (this.required) {
131
- var func = (value) => !!value || this.requiredMessage;
132
- var func2 = () => !this.internalError;
133
- var func3 = (value) => {
134
- if (Array.isArray(value) && value.length === 0) {
135
- return this.requiredMessage;
136
- }
137
- return true;
138
- };
139
- rules.push(func, func2, func3);
140
- }
141
- return rules;
142
- },
143
- watchVModelValue() {
144
- return JSON.stringify(this.value) + this.items.length;
145
- }
146
- },
147
- watch: {
148
- watchVModelValue() {
149
- this.internalModel = this.formatInternalValue();
150
- }
151
- },
152
- created() {
153
- const internalValueFormated = this.formatInternalValue();
154
- this.initialValue = internalValueFormated;
155
- this.internalModel = internalValueFormated;
156
- },
157
- methods: {
158
- emitChangeValue() {
159
- if (typeof this.value === 'object' && this.modelFormMapping) {
160
- if (this.internalModel) {
161
- // set model values
162
- for (const [key, value] of Object.entries(this.modelFormMapping)) {
163
- this.$set(this.value, key, this.internalModel[value]);
164
- }
165
- } else if (this.itemValue) {
166
- // reset model values
167
- if (typeof this.itemValue === 'string') {
168
- this.$set(this.value, this.itemValue, null);
169
- } else if (Array.isArray(this.itemValue)) {
170
- this.itemValue.forEach((key) => {
171
- this.$set(this.value, key, null);
172
- });
173
- }
174
- }
175
- } else {
176
- this.$emit('input', this.internalModel);
177
- }
178
- },
179
- formatInternalValue() {
180
- let newValue = this.value;
181
- if (typeof this.value === 'object' && this.modelFormMapping) {
182
- // select the item from value and items properties
183
- newValue = this.items.find((item) => {
184
- for (const [key, value] of Object.entries(this.modelFormMapping)) {
185
- if (item[value] !== this.value[key]) {
186
- return false;
187
- }
188
- }
189
- return true;
190
- });
191
- }
192
- return newValue;
193
- }
194
- }
195
- };
196
- </script>
@@ -1,192 +0,0 @@
1
- <template>
2
- <v-container class="puiCau">
3
- <v-dialog v-model="dialogModel" width="700" @click:outside="closeDialog()">
4
- <v-card>
5
- <v-toolbar elevation="3" height="50" color="light-blue darken-3">
6
- <v-spacer></v-spacer>
7
- <v-toolbar-title style="color: white">{{ getBtnTitle }}</v-toolbar-title>
8
- <v-spacer></v-spacer>
9
- <v-icon color="white" @click="closeDialog()">fas fa-window-close</v-icon>
10
- </v-toolbar>
11
-
12
- <v-card-text>
13
- <v-form ref="form">
14
- <v-container class="pa-0 pt-4">
15
- <pui-text-field v-model="model.subject" :label="$t('puicau.subject')" toplabel required></pui-text-field>
16
- <pui-text-area v-model="model.content" :label="$t('puicau.content')" toplabel required></pui-text-area>
17
- <pui-select
18
- v-if="dialogModel"
19
- :label="$t('puicau.urgency')"
20
- v-model="model"
21
- :items="urgencyValues"
22
- :modelFormMapping="{ urgency: 'urgency' }"
23
- :itemsToSelect="itemsToSelect"
24
- :itemValue="['urgency']"
25
- itemText="text"
26
- toplabel
27
- required
28
- ></pui-select>
29
-
30
- <!-- adjuntos -->
31
- <pui-field-set v-if="isLogged" :title="$t('form.puidocument.title')" class="mt-0 mb-8">
32
- <pui-file-upload-group v-model="model.files" ref="fileUploadGroup" :minDocuments="0"></pui-file-upload-group>
33
- </pui-field-set>
34
-
35
- <pui-field-set :title="$t('puicau.contact')" class="pa-4 pb-0">
36
- <pui-text-field
37
- v-model="model.name"
38
- :label="$t('puicau.name')"
39
- toplabel
40
- required
41
- :readonly="getUser != null"
42
- ></pui-text-field>
43
- <pui-text-field
44
- v-model="model.email"
45
- :label="$t('puicau.email')"
46
- toplabel
47
- emailMask
48
- required
49
- :readonly="getEmail != null"
50
- ></pui-text-field>
51
- <pui-text-field v-model="model.phone" :label="$t('puicau.phone')" toplabel required></pui-text-field>
52
- </pui-field-set>
53
- </v-container>
54
- </v-form>
55
- </v-card-text>
56
-
57
- <v-divider></v-divider>
58
-
59
- <v-card-actions>
60
- <v-btn color="primary" text @click="closeDialog()">Cancelar</v-btn>
61
- <v-spacer></v-spacer>
62
- <v-btn color="secondary" text @click="send(model)">Enviar</v-btn>
63
- </v-card-actions>
64
- </v-card>
65
- </v-dialog>
66
- </v-container>
67
- </template>
68
-
69
- <script>
70
- export default {
71
- name: 'PuiCauDialog',
72
- props: {
73
- dialogModel: {
74
- required: true
75
- }
76
- },
77
- data() {
78
- return {
79
- model: null,
80
- urgencyValues: [
81
- {
82
- text: this.$t('puicau.urgencyValues.maximum'),
83
- urgency: 'MAXIMUM'
84
- },
85
- {
86
- text: this.$t('puicau.urgencyValues.high'),
87
- urgency: 'HIGH'
88
- },
89
- {
90
- text: this.$t('puicau.urgencyValues.medium'),
91
- urgency: 'MEDIUM'
92
- },
93
- {
94
- text: this.$t('puicau.urgencyValues.low'),
95
- urgency: 'LOW'
96
- }
97
- ]
98
- };
99
- },
100
- computed: {
101
- isIssueTicketActive() {
102
- return this.$store.getters.isIssueTicketActive;
103
- },
104
- getUser() {
105
- return this.$store.getters.getSession.name;
106
- },
107
- getEmail() {
108
- return this.$store.getters.getSession.email;
109
- },
110
- isLogged() {
111
- return this.getUser != null;
112
- },
113
- getBtnTitle() {
114
- return this.isLogged ? this.$t('puicau.menu_entry') : this.$t('puicau.title');
115
- },
116
- itemsToSelect() {
117
- return [{urgency: this.model.urgency}]
118
- }
119
- },
120
- created() {
121
- this.setInitialValues();
122
- },
123
- methods: {
124
- setInitialValues() {
125
- this.model = this.getEmptyModel();
126
- this.model.name = this.getUser;
127
- this.model.email = this.getEmail;
128
- },
129
- getEmptyModel() {
130
- return {
131
- subject: null,
132
- content: null,
133
- urgency: null,
134
- name: null,
135
- email: null,
136
- phone: null,
137
- files: []
138
- };
139
- },
140
- send(formData) {
141
- if (this.$refs.form.validate() && this.validateFileUploads()) {
142
- let fileData = new window.FormData();
143
- if (this.isLogged && this.model && this.model.files && this.model.files.length > 0) {
144
- this.model.files.forEach((file) =>
145
- fileData.append('files', file.selectedFile, file.selectedFile.name)
146
- );
147
- } /*else {
148
- fileData.append('files', new Blob(), ''); // EMPTY BLOB
149
- }*/
150
-
151
- delete formData.files;
152
-
153
- this.$puiRequests.uploadFileRequest(
154
- '/issueTicket',
155
- fileData,
156
- () => {
157
- this.closeDialog();
158
- },
159
- (error) => {
160
- console.log(error)
161
- this.$puiNotify.error(error.message);
162
- this.dialog = false;
163
- },
164
- formData // as parameters
165
- );
166
- }
167
- },
168
- validateFileUploads() {
169
- if (!this.isLogged) {
170
- return true;
171
- }
172
-
173
- return this.$refs.fileUploadGroup.validateFileUploads();
174
- },
175
- closeDialog() {
176
- this.setInitialValues();
177
- this.$puiEvents.$emit('pui-modalDialogForm-cau-close');
178
- }
179
- }
180
- };
181
- </script>
182
-
183
- <style lang="postcss">
184
- .puiCau {
185
- position: absolute;
186
- bottom: 0;
187
- }
188
-
189
- .v-btn--plain .v-btn__content {
190
- opacity: 1 !important;
191
- }
192
- </style>
@@ -1,126 +0,0 @@
1
- <template>
2
- <v-checkbox
3
- :class="isRequired"
4
- class="d-flex ml-2 mr-2"
5
- :label="getLabel"
6
- :rules="getRules"
7
- v-model="internalModel"
8
- @change="updateValue"
9
- v-bind="allProps"
10
- :ripple="false"
11
- :false-value="falseValue"
12
- :true-value="trueValue"
13
- color="primary"
14
- :error="internalError"
15
- >
16
- <template v-slot:label>
17
- <v-container class="d-flex pa-0 align-center">
18
- <span>{{ label }}</span>
19
- <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
20
- </v-container>
21
- </template>
22
- </v-checkbox>
23
- </template>
24
-
25
- <script>
26
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
27
-
28
- export default {
29
- name: 'PuiCheckbox',
30
- mixins: [PuiFormComponentMixin],
31
- props: {
32
- value: {
33
- required: false
34
- },
35
- rules: {
36
- type: Array,
37
- default: () => {
38
- return [];
39
- }
40
- },
41
- // falseValue en lugar de 'false-value' para que funcione. Lo mismo con el true
42
- falseValue: {
43
- type: [Boolean, String, Number],
44
- default: false,
45
- required: false
46
- },
47
- trueValue: {
48
- type: [Boolean, String, Number],
49
- default: true,
50
- required: false
51
- },
52
- tooltipDescription: {
53
- type: String,
54
- required: false
55
- },
56
- tooltipIcon: {
57
- type: String,
58
- required: false,
59
- },
60
- },
61
- computed: {
62
- getRules() {
63
- const rules = [...this.rules];
64
- if (this.required) {
65
- var func = (value) => !!value || this.requiredMessage;
66
- var func2 = () => !this.internalError;
67
- var func3 = () => {
68
- if (this.internalModel === false) {
69
- return this.requiredMessage;
70
- }
71
- return true;
72
- };
73
- rules.push(func, func2, func3);
74
- }
75
- return rules;
76
- },
77
- isRequired() {
78
- return { 'v-input--checkbox--required': this.required };
79
- },
80
- requiredMessage() {
81
- return this.$t('pui9.error.field_selected');
82
- },
83
- showTooltip() {
84
- if (this.getLabel === '' || this.getLabel === null) {
85
- return false;
86
- }
87
- return this.tooltipDescription || this.tooltip;
88
- }
89
- },
90
- watch: {
91
- value(val) {
92
- this.internalModel = val;
93
- }
94
- },
95
- created() {
96
- this.initialValue = this.value;
97
- this.internalModel = this.value;
98
-
99
- // Hay que pasar el value a string para que si llega del servidor '1' (por poner un ejemplo) el
100
- // checkbox lo detecte como activo
101
- if (this.value && typeof this.value !== 'boolean') {
102
- this.internalModel = this.value.toString();
103
- }
104
- },
105
- methods: {
106
- updateValue(value) {
107
- this.$emit('input', value);
108
- this.checkValue();
109
- },
110
- checkValue() {
111
- this.clearMessages();
112
- if (this.required) {
113
- if (this.internalModel === false) {
114
- this.showErrorMessage();
115
- }
116
- }
117
- },
118
- clearMessages() {
119
- this.internalError = false;
120
- },
121
- showErrorMessage() {
122
- this.internalError = true;
123
- }
124
- }
125
- };
126
- </script>