pui9-components 2.0.8 → 3.0.1

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 +5050 -22036
  2. package/dist/pui9-components.css +3 -6
  3. package/package-lock.json +81 -221
  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
@@ -1,464 +0,0 @@
1
- <template>
2
- <!-- DESKTOP -->
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;'">&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
- @keyup="validateNumber"
17
- v-bind="allProps"
18
- :class="getEditedClass"
19
- :outline="!isMobile"
20
- @blur="updateValueLazy"
21
- :style="getCompStyle"
22
- solo
23
- outlined
24
- flat
25
- type="number"
26
- :messages="internalMessages"
27
- class="pui-spinner-inline"
28
- :placeholder="getPlaceholder"
29
- :error-messages="internalErrorMessages"
30
- :error="internalError"
31
- ></v-text-field>
32
-
33
- <v-btn
34
- icon
35
- class="primary--text pui-spinner-btnCtrl pui-spinner-btnCtrl_minus ml-2 pl-0 pr-0 mt-0"
36
- :class="{ 'pui-spinner-btnCtrl_disabled': isBtnSubstractDisable }"
37
- :ripple="!isBtnSubstractDisable"
38
- @click="downValue"
39
- >
40
- <v-icon>fal fa-minus</v-icon>
41
- </v-btn>
42
- <v-btn
43
- icon
44
- class="primary--text pui-spinner-btnCtrl pui-spinner-btnCtrl_plus mr-0 pl-0 pr-0 mt-0"
45
- :class="{ 'pui-spinner-btnCtrl_disabled': isBtnAddDisable }"
46
- :ripple="!isBtnAddDisable"
47
- @click="upValue"
48
- >
49
- <v-icon>fal fa-plus</v-icon>
50
- </v-btn>
51
- </v-flex>
52
- </v-layout>
53
- </div>
54
- <div v-else class="ml-1 mr-1">
55
- <v-layout>
56
- <v-flex :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
57
- <label :class="getLabelRequiredClass">{{ getLabel }}</label>
58
- <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
59
- </v-flex>
60
- <v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
61
- <v-text-field
62
- v-model="internalModel"
63
- @keyup="validateNumber"
64
- v-bind="allProps"
65
- :class="getEditedClass"
66
- :solo="!isMobile"
67
- :outline="!isMobile"
68
- @blur="updateValueLazy"
69
- :style="getCompStyle"
70
- flat
71
- single-line
72
- type="number"
73
- :messages="internalMessages"
74
- class="elevation-0 pui-spinner-inline"
75
- :placeholder="getPlaceholder"
76
- :error-messages="internalErrorMessages"
77
- :error="internalError"
78
- ></v-text-field>
79
- <v-btn
80
- depressed
81
- class="primary--text pui-spinner-inline white ml-0 pui-spinner-btnCtrl pui-spinner-btnCtrl_minus pl-0 pr-0 mt-0"
82
- :class="{ 'pui-spinner-btnCtrl_disabled': isBtnSubstractDisable }"
83
- :ripple="!isBtnSubstractDisable"
84
- @click="downValue"
85
- >
86
- <v-icon>fal fa-minus</v-icon>
87
- </v-btn>
88
- <v-btn
89
- depressed
90
- class="primary--text pui-spinner-inline white mr-0 pui-spinner-btnCtrl pui-spinner-btnCtrl_plus pl-0 pr-0 ml-1 mt-0"
91
- :class="{ 'pui-spinner-btnCtrl_disabled': isBtnAddDisable }"
92
- :ripple="!isBtnAddDisable"
93
- @click="upValue"
94
- >
95
- <v-icon>fal fa-plus</v-icon>
96
- </v-btn>
97
- </v-flex>
98
- </v-layout>
99
- </div>
100
- </div>
101
- <!-- MOBILE -->
102
- <div v-else>
103
- <v-flex xs12>
104
- <label :class="getLabelRequiredClass">{{ getLabel }}</label>
105
- </v-flex>
106
- <v-flex xs12>
107
- <v-text-field
108
- v-model="internalModel"
109
- @keyup="validateNumber"
110
- v-bind="allProps"
111
- :class="getEditedClass"
112
- :solo="!isMobile"
113
- :outline="!isMobile"
114
- @blur="updateValueLazy"
115
- flat
116
- single-line
117
- type="number"
118
- :messages="internalMessages"
119
- class="pui-spinner-hideBtns pui-spinner-inline v-text-field--mobile"
120
- :placeholder="getPlaceholder"
121
- :error-messages="internalErrorMessages"
122
- :error="internalError"
123
- ></v-text-field>
124
- <v-btn
125
- depressed
126
- class="primary--text pui-spinner-inline white ml-0 pui-spinner-btnCtrl pui-spinner-btnCtrl_minus pl-0 pr-0 mt-0"
127
- :class="{ 'pui-spinner-btnCtrl_disabled': isBtnSubstractDisable }"
128
- :ripple="!isBtnSubstractDisable"
129
- @click="downValue"
130
- >
131
- <v-icon>fal fa-minus</v-icon>
132
- </v-btn>
133
- <v-btn
134
- depressed
135
- class="primary--text pui-spinner-inline white mr-0 pui-spinner-btnCtrl pui-spinner-btnCtrl_plus pl-0 pr-0 ml-1 mt-0"
136
- :class="{ 'pui-spinner-btnCtrl_disabled': isBtnAddDisable }"
137
- :ripple="!isBtnAddDisable"
138
- @click="upValue"
139
- >
140
- <v-icon>fal fa-plus</v-icon>
141
- </v-btn>
142
- </v-flex>
143
- </div>
144
- </template>
145
-
146
- <script>
147
- import PuiUtilsNumberMixin from '../mixins/PuiUtilsNumberMixin';
148
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
149
-
150
- export default {
151
- name: 'PuiSpinnerField',
152
- mixins: [PuiUtilsNumberMixin, PuiFormComponentMixin],
153
- data: () => ({
154
- initialValue: 0,
155
- internalModel: 0,
156
- minValue: Number.MIN_SAFE_INTEGER,
157
- maxValue: Number.MAX_SAFE_INTEGER,
158
- disableBtnAdd: false,
159
- disableBtnSubstract: false,
160
- internalMessages: [],
161
- internalErrorMessages: []
162
- }),
163
- props: {
164
- value: {
165
- type: [Number],
166
- required: false
167
- },
168
- max: {
169
- type: [String, Number],
170
- default: () => {
171
- return Number.MAX_SAFE_INTEGER;
172
- },
173
- required: false
174
- },
175
- min: {
176
- type: [String, Number],
177
- default: () => {
178
- return Number.MIN_SAFE_INTEGER;
179
- },
180
- required: false
181
- },
182
- title: {
183
- type: [String],
184
- default: '',
185
- required: false
186
- },
187
- tooltip: {
188
- type: Boolean,
189
- required: false,
190
- default: false
191
- },
192
- tooltipDescription: {
193
- type: String,
194
- required: false
195
- },
196
- tooltipIcon: {
197
- type: String,
198
- required: false,
199
- },
200
- noLazyModel: {
201
- type: [Boolean],
202
- default: false,
203
- required: false
204
- },
205
- placeholder: {
206
- type: [String],
207
- default: ' ',
208
- required: false
209
- },
210
- width: {
211
- type: [String, Number],
212
- default: '90',
213
- required: false
214
- },
215
- labelColumnStyles: {
216
- type: [String],
217
- required: false
218
- },
219
- valueColumnStyles: {
220
- type: [String],
221
- required: false
222
- }
223
- },
224
-
225
- computed: {
226
- getMobileClass() {
227
- return { 'v-text-field--edited': this.isEdited, 'v-text-field--required': this.required };
228
- },
229
- getLabelRequiredClass() {
230
- return { 'v-label--required': this.required };
231
- },
232
- getEditedClass() {
233
- return { 'v-text-field--edited': this.isEdited };
234
- },
235
- getCompStyle() {
236
- var inputWidth = this.width;
237
- if (this.value && !isNaN(parseInt(this.value))) {
238
- var numLength = this.value.toString().length;
239
- var newle = numLength * 13;
240
- const sufPref = this.allProps.suffix || this.allProps.prefix;
241
- if (sufPref) newle += sufPref.length * 13;
242
- if (newle > inputWidth) {
243
- inputWidth = newle;
244
- }
245
- }
246
- return { width: inputWidth + 'px' };
247
- },
248
- isBtnAddDisable() {
249
- return this.checkBtnAddDisable();
250
- },
251
- isBtnSubstractDisable() {
252
- return this.checkBtnSubstarctDisable();
253
- },
254
- showTooltip() {
255
- if (this.getLabel === '' || this.getLabel === null) {
256
- return false;
257
- }
258
- return this.tooltipDescription || this.tooltip;
259
- }
260
- },
261
- watch: {
262
- value(val) {
263
- if (!this.noLazyModel && !this.firstLazyLoad) {
264
- this.initializeModel(val);
265
- this.firstLazyLoad = true;
266
- } else {
267
- this.internalModel = val;
268
- }
269
- },
270
- min(newVal) {
271
- if (newVal !== null && newVal !== undefined) {
272
- const minVal = parseInt(newVal);
273
- if (!isNaN(minVal)) {
274
- if (minVal < this.maxValue) {
275
- this.minValue = minVal;
276
- }
277
- }
278
- } else {
279
- this.minValue = Number.MIN_SAFE_INTEGER;
280
- }
281
- },
282
- max(newVal) {
283
- if (newVal !== null && newVal !== undefined) {
284
- const maxVal = parseInt(newVal);
285
- if (!isNaN(maxVal)) {
286
- if (maxVal > this.minValue) {
287
- this.maxValue = maxVal;
288
- }
289
- }
290
- } else {
291
- this.maxValue = Number.MAX_SAFE_INTEGER;
292
- }
293
- }
294
- },
295
- created() {
296
- if (this.noLazyModel) {
297
- this.firstLazyLoad = true;
298
- }
299
- this.initializeModel(this.value);
300
- },
301
- mounted() {
302
- if (this.tooltip && this.$refs.tooltip) {
303
- this.setTooltip();
304
- }
305
- },
306
- destroyed() {
307
- // No hay que eliminar el evento de onPuiTreeMenuItemSelected
308
- },
309
- methods: {
310
- setTooltip() {
311
- if (this.max !== Number.MAX_SAFE_INTEGER) {
312
- this.$refs.tooltip.pushMessage(this.$t('pui9.components.spinnerField.overmaxvalue') + ': ' + this.max);
313
- }
314
-
315
- if (this.min !== Number.MIN_SAFE_INTEGER) {
316
- this.$refs.tooltip.pushMessage(this.$t('pui9.components.spinnerField.overminvalue') + ': ' + this.min);
317
- }
318
- },
319
- updateValueLazy() {
320
- if (!this.internalError) {
321
- this.$emit('input', this.internalModel);
322
- }
323
- },
324
- validateNumber(evt) {
325
- var valNum = evt.target.valueAsNumber;
326
- var wrong = isNaN(valNum);
327
- if (!wrong) {
328
- this.clearErrorMessage();
329
- this.checkNumber(valNum);
330
- } else {
331
- this.showWrongNumberMessage();
332
- }
333
- },
334
- checkNumber(val) {
335
- var isInt = this.checkInteger(val);
336
- if (isInt) {
337
- var intVal = parseInt(val);
338
- const validated = this.validateMinMax(intVal);
339
- if (validated) {
340
- this.internalModel = intVal;
341
- }
342
- } else {
343
- var int = parseInt(val);
344
- if (!isNaN(int)) {
345
- const validated = this.validateMinMax(int);
346
- if (validated) {
347
- this.internalModel = int;
348
- }
349
- } else {
350
- this.showWrongNumberMessage();
351
- }
352
- }
353
- },
354
- validateMinMax(num) {
355
- var ok = true;
356
- if (num) {
357
- if (num > this.maxValue) {
358
- this.internalModel = this.maxValue;
359
- this.showErrorMessageOverMaxvalue();
360
- ok = false;
361
- } else {
362
- this.disableBtnAdd = false;
363
- }
364
- if (num < this.minValue) {
365
- this.internalModel = this.minValue;
366
- this.showErrorMessageOverMinvalue();
367
- ok = false;
368
- } else {
369
- this.disableBtnSubstract = false;
370
- }
371
- } else {
372
- this.resetBtns();
373
- }
374
- return ok;
375
- },
376
- upValue() {
377
- if (!this.disableBtnAdd) {
378
- this.internalModel++;
379
- this.clearErrorMessage();
380
- this.$emit('input', this.internalModel);
381
- }
382
- },
383
- downValue() {
384
- if (!this.disableBtnSubstract) {
385
- this.internalModel--;
386
- this.clearErrorMessage();
387
- this.$emit('input', this.internalModel);
388
- }
389
- },
390
- checkBtnAddDisable() {
391
- if (this.disabled || this.internalModel >= this.max) {
392
- this.disableBtnAdd = true;
393
- return true;
394
- }
395
- this.disableBtnAdd = false;
396
- return false;
397
- },
398
- checkBtnSubstarctDisable() {
399
- if (this.disabled || this.internalModel <= this.min) {
400
- this.disableBtnSubstract = true;
401
- return true;
402
- }
403
- this.disableBtnSubstract = false;
404
- return false;
405
- },
406
- showErrorMessageOverMaxvalue() {
407
- var message = this.$t('pui9.components.spinnerField.overmaxvalue') + ' ' + this.maxValue;
408
- this.internalMessages = [message];
409
- },
410
- showErrorMessageOverMinvalue() {
411
- var message = this.$t('pui9.components.spinnerField.overminvalue') + ' ' + this.minValue;
412
- this.internalMessages = [message];
413
- },
414
- showWrongNumberMessage() {
415
- var message = this.$t('pui9.components.spinnerField.wrongnumber');
416
- this.internalError = true;
417
- this.internalErrorMessages = [message];
418
- },
419
- clearErrorMessage() {
420
- this.internalMessages = [];
421
- this.internalErrorMessages = [];
422
- this.internalError = false;
423
- },
424
- resetBtns() {
425
- this.disableBtnAdd = false;
426
- this.disableBtnSubstract = false;
427
- this.clearErrorMessage();
428
- },
429
- initializeModel(value) {
430
- if (this.min !== null && this.min !== undefined) {
431
- const minVal = parseInt(this.min);
432
- if (!isNaN(minVal)) {
433
- if (minVal < this.maxValue) {
434
- this.minValue = minVal;
435
- }
436
- }
437
- }
438
- if (this.max !== null && this.max !== undefined) {
439
- const maxVal = parseInt(this.max);
440
- if (!isNaN(maxVal)) {
441
- if (maxVal > this.minValue) {
442
- this.maxValue = maxVal;
443
- }
444
- }
445
- }
446
-
447
- if (value === null) {
448
- this.initialValue = 0;
449
- this.internalModel = 0;
450
- } else {
451
- var noNullValue = value ? parseInt(value) : 0;
452
- this.initialValue = noNullValue;
453
- this.internalModel = noNullValue;
454
-
455
- if (this.internalModel < this.minValue) {
456
- this.internalModel = this.minValue;
457
- this.initialValue = this.minValue;
458
- }
459
- this.firstLazyLoad = true;
460
- }
461
- }
462
- }
463
- };
464
- </script>
@@ -1,104 +0,0 @@
1
- <template>
2
- <v-switch
3
- class="pui-switch"
4
- :class="isRequired"
5
- v-model="internalModel"
6
- v-bind="allProps"
7
- :rules="getRules"
8
- :label="getLabel"
9
- @change="updateValue"
10
- :ripple="false"
11
- :false-value="falseValue"
12
- :true-value="trueValue"
13
- :error="internalError"
14
- ></v-switch>
15
- </template>
16
-
17
- <script>
18
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
19
-
20
- export default {
21
- name: 'PuiSwitch',
22
- mixins: [PuiFormComponentMixin],
23
- props: {
24
- value: {
25
- required: false
26
- },
27
- rules: {
28
- type: Array,
29
- default: () => {
30
- return [];
31
- }
32
- },
33
- // falseValue en lugar de 'false-value' para que funcione. Lo mismo con el true
34
- falseValue: {
35
- type: [Boolean, String, Number],
36
- default: false,
37
- required: false
38
- },
39
- trueValue: {
40
- type: [Boolean, String, Number],
41
- default: true,
42
- required: false
43
- }
44
- },
45
- computed: {
46
- getRules() {
47
- const rules = [...this.rules];
48
- if (this.required) {
49
- var func = (value) => !!value || this.requiredMessage;
50
- var func2 = () => !this.internalError;
51
- var func3 = () => {
52
- if (this.internalModel === false) {
53
- return this.requiredMessage;
54
- }
55
- return true;
56
- };
57
- rules.push(func, func2, func3);
58
- }
59
- return rules;
60
- },
61
- isRequired() {
62
- return { 'v-input--checkbox--required': this.required };
63
- },
64
- requiredMessage() {
65
- return this.$t('pui9.error.field_selected');
66
- }
67
- },
68
- watch: {
69
- value(val) {
70
- this.internalModel = val;
71
- }
72
- },
73
- created() {
74
- this.initialValue = this.value; // no se usa
75
- this.internalModel = this.value;
76
-
77
- // Hay que pasar el value a string para que si llega del servidor '1' (por poner un ejemplo) el
78
- // switch lo detecte como activo
79
- if (this.value && typeof this.value !== 'boolean') {
80
- this.internalModel = this.value.toString();
81
- }
82
- },
83
- methods: {
84
- updateValue(value) {
85
- this.$emit('input', value);
86
- this.checkValue();
87
- },
88
- checkValue() {
89
- this.clearMessages();
90
- if (this.required) {
91
- if (this.internalModel === false) {
92
- this.showErrorMessage();
93
- }
94
- }
95
- },
96
- clearMessages() {
97
- this.internalError = false;
98
- },
99
- showErrorMessage() {
100
- this.internalError = true;
101
- }
102
- }
103
- };
104
- </script>