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.
Files changed (67) hide show
  1. package/dist/pui9-components.common.js +5300 -22115
  2. package/dist/pui9-components.css +3 -6
  3. package/package-lock.json +1 -141
  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,434 +0,0 @@
1
- <template>
2
- <!-- DESKTOP - TABLE -->
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-show="!showVisibleModel"
16
- v-model="internalModel"
17
- v-bind="allProps"
18
- :class="getEditedClass"
19
- :rules="getRules"
20
- @blur="onBlurText"
21
- :placeholder="getPlaceholder"
22
- :messages="internalMessages"
23
- :error-messages="internalErrorMessages"
24
- :error="internalError"
25
- ref="puiNumberField"
26
- solo
27
- outlined
28
- flat
29
- ></v-text-field>
30
- <v-text-field
31
- :id="`${allProps.id}_internal`"
32
- v-show="showVisibleModel"
33
- v-model="visibleModel"
34
- v-bind="allProps"
35
- :class="getEditedClass"
36
- :rules="getRules"
37
- @focus="onFocusText"
38
- :messages="internalMessages"
39
- :error-messages="internalErrorMessages"
40
- :error="internalError"
41
- solo
42
- outlined
43
- flat
44
- ></v-text-field>
45
- </v-flex>
46
- </v-layout>
47
- </div>
48
- <div v-else class="ml-1 mr-1">
49
- <v-layout>
50
- <v-flex :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
51
- <label :class="getLabelRequiredClass">{{ getLabel }}</label>
52
- <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
53
- </v-flex>
54
- <v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
55
- <v-text-field
56
- v-show="!showVisibleModel"
57
- v-model="internalModel"
58
- v-bind="allProps"
59
- :class="getEditedClass"
60
- :rules="getRules"
61
- @blur="onBlurText"
62
- :placeholder="getPlaceholder"
63
- :messages="internalMessages"
64
- :error-messages="internalErrorMessages"
65
- :error="internalError"
66
- ref="puiNumberField"
67
- solo
68
- outlined
69
- flat
70
- ></v-text-field>
71
- <v-text-field
72
- :id="`${allProps.id}_internal`"
73
- v-show="showVisibleModel"
74
- v-model="visibleModel"
75
- v-bind="allProps"
76
- :class="getEditedClass"
77
- :rules="getRules"
78
- @focus="onFocusText"
79
- :messages="internalMessages"
80
- :error-messages="internalErrorMessages"
81
- :error="internalError"
82
- solo
83
- outlined
84
- flat
85
- ></v-text-field>
86
- </v-flex>
87
- </v-layout>
88
- </div>
89
- </div>
90
- <!-- MOBILE -->
91
- <div v-else>
92
- <v-layout>
93
- <v-flex xs12>
94
- <v-text-field
95
- v-show="!showVisibleModel"
96
- v-model="internalModel"
97
- v-bind="allProps"
98
- :class="getMobileClass"
99
- class="v-text-field--mobile"
100
- :label="getLabel"
101
- @blur="onBlurText"
102
- :rules="getRules"
103
- :placeholder="getPlaceholder"
104
- :messages="internalMessages"
105
- :error-messages="internalErrorMessages"
106
- :error="internalError"
107
- ref="puiNumberField"
108
- flat
109
- ></v-text-field>
110
- <v-text-field
111
- :id="`${allProps.id}_internal`"
112
- v-show="showVisibleModel"
113
- v-model="visibleModel"
114
- v-bind="allProps"
115
- :class="getMobileClass"
116
- class="v-text-field--mobile"
117
- :rules="getRules"
118
- :label="getLabel"
119
- @focus="onFocusText"
120
- :messages="internalMessages"
121
- :error-messages="internalErrorMessages"
122
- :error="internalError"
123
- flat
124
- ></v-text-field>
125
- </v-flex>
126
- </v-layout>
127
- </div>
128
- </template>
129
-
130
- <script>
131
- import PuiUtilsNumberMixin from '../mixins/PuiUtilsNumberMixin';
132
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
133
-
134
- export default {
135
- name: 'PuiNumberField',
136
- mixins: [PuiUtilsNumberMixin, PuiFormComponentMixin],
137
- inject: {
138
- form: {
139
- default: null
140
- }
141
- },
142
- data: () => ({
143
- internalMessages: [],
144
- internalErrorMessages: [],
145
- internalDecimals: 999,
146
- showVisibleModel: true,
147
- firstLoad: true,
148
- valid: true
149
- }),
150
- props: {
151
- value: {
152
- type: [String, Number],
153
- required: false
154
- },
155
- decimals: {
156
- type: [String, Number],
157
- default: 8,
158
- required: false
159
- },
160
- min: {
161
- type: [String, Number],
162
- required: false
163
- },
164
- max: {
165
- type: [String, Number],
166
- required: false
167
- },
168
- tooltip: {
169
- type: Boolean,
170
- required: false,
171
- default: false
172
- },
173
- tooltipDescription: {
174
- type: String,
175
- required: false
176
- },
177
- tooltipIcon: {
178
- type: String,
179
- required: false
180
- },
181
- integer: {
182
- type: Boolean,
183
- default: false,
184
- required: false
185
- },
186
- rules: {
187
- type: Array,
188
- default: () => {
189
- return [];
190
- }
191
- },
192
- placeholder: {
193
- type: [String],
194
- default: ' ',
195
- required: false
196
- },
197
- noLazyModel: {
198
- type: [Boolean],
199
- default: false,
200
- required: false
201
- },
202
- labelColumnStyles: {
203
- type: [String],
204
- required: false
205
- },
206
- valueColumnStyles: {
207
- type: [String],
208
- required: false
209
- }
210
- },
211
- computed: {
212
- getMobileClass() {
213
- return { 'v-text-field--edited': this.isEdited, 'v-text-field--required': this.required };
214
- },
215
- getLabelRequiredClass() {
216
- return { 'v-label--required': this.required };
217
- },
218
- getEditedClass() {
219
- return { 'v-text-field--edited': this.isEdited };
220
- },
221
- getRules() {
222
- const rules = [...this.rules];
223
-
224
- let noErrorsRule = () => !this.internalError;
225
- rules.push(noErrorsRule);
226
-
227
- return rules;
228
- },
229
- compPlaceholder() {
230
- if (this.placeholder && this.placeholder.length > 0) {
231
- return this.placeholder;
232
- }
233
- return ' ';
234
- },
235
- thousandSeparator() {
236
- return this.$store.getters.thousandSeparator;
237
- },
238
- decimalSeparator() {
239
- return this.$store.getters.decimalSeparator;
240
- },
241
- visibleModel() {
242
- if (this.internalModel === null || this.internalModel === undefined || isNaN(this.internalModel)) return ' ';
243
- const value = this.internalModel.toString();
244
-
245
- if (value.includes('.')) {
246
- const parts = value.split('.');
247
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandSeparator);
248
- return parts.join(this.decimalSeparator);
249
- }
250
-
251
- return value.replace(/(\d)(?=(\d{3})+(?!\d))/g, `$1${this.thousandSeparator}`);
252
- },
253
- showTooltip() {
254
- if (this.getLabel === '' || this.getLabel === null) {
255
- return false;
256
- }
257
- return this.tooltipDescription || this.tooltip;
258
- },
259
- internalMin() {
260
- const min = parseFloat(this.min);
261
- return !isNaN(min) ? min : Number.MIN_SAFE_INTEGER;
262
- },
263
- internalMax() {
264
- const max = parseFloat(this.max);
265
- return !isNaN(max) ? max : Number.MAX_SAFE_INTEGER;
266
- }
267
- },
268
- watch: {
269
- value(v) {
270
- this.setInternalModel(v);
271
- },
272
- internalModel(v) {
273
- this.$emit('input', v);
274
- },
275
- internalError() {
276
- this.valid = !this.internalError;
277
- },
278
- min() {
279
- this.checkValidations(this.internalModel);
280
- },
281
- max() {
282
- this.checkValidations(this.internalModel);
283
- }
284
- },
285
- created() {
286
- // v-form injected
287
- this.form && this.form.register(this);
288
-
289
- this.initialValue = this.value;
290
- this.internalDecimals = parseInt(this.decimals);
291
- this.setInternalModel(this.value);
292
- },
293
- mounted() {
294
- if (this.tooltip && this.$refs.tooltip) {
295
- this.setTooltip();
296
- }
297
- },
298
- methods: {
299
- validate() {
300
- this.checkValidations(this.internalModel);
301
- return this.valid;
302
- },
303
- setTooltip() {
304
- if (this.max < Number.MAX_SAFE_INTEGER) {
305
- this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.maxvaluemessage') + ': ' + this.max);
306
- }
307
-
308
- if (this.min > Number.MIN_SAFE_INTEGER) {
309
- this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.minvaluemessage') + ': ' + this.min);
310
- }
311
-
312
- if (this.integer) {
313
- this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.integermessage'));
314
- }
315
-
316
- if (this.decimals !== 999) {
317
- this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.maxdecimalsmessage') + ': ' + this.decimals);
318
- }
319
- },
320
- onBlurText() {
321
- this.showVisibleModel = true;
322
- },
323
- onFocusText() {
324
- this.showVisibleModel = false;
325
-
326
- setTimeout(() => {
327
- this.$refs.puiNumberField.focus();
328
- }, 5);
329
- },
330
- setInternalModel(value) {
331
- if (typeof value == typeof String) {
332
- value = value.replace(this.decimalSeparator, '.');
333
- }
334
-
335
- this.checkValidations(value);
336
-
337
- if (isNaN(value)) {
338
- this.internalModel = value;
339
- } else if (value === null || value === '') {
340
- this.internalModel = null;
341
- } else if (this.integer) {
342
- this.setInteger(value);
343
- } else {
344
- this.setFloat(value);
345
- }
346
- },
347
- setInteger(value) {
348
- this.internalModel = parseInt(value);
349
- },
350
- setFloat(value) {
351
- if (this.internalDecimals) {
352
- this.internalModel = this.truncateDecimal(parseFloat(value), this.internalDecimals);
353
- } else {
354
- this.internalModel = parseFloat(value);
355
- }
356
- },
357
- checkValidations(value) {
358
- this.clearMessages();
359
-
360
- if (this.firstLoad) {
361
- this.firstLoad = false;
362
- return;
363
- }
364
-
365
- value && this.numberTypeValidation(value);
366
- value && this.minMaxValidation(value);
367
- value && this.wrongNumberValidation(value);
368
- this.requiredFieldValidation(value);
369
- },
370
- clearMessages() {
371
- this.internalError = false;
372
- this.internalMessages = [];
373
- this.internalErrorMessages = [];
374
- },
375
- requiredFieldValidation(value) {
376
- if (this.required && (value === '' || value === null || value === undefined)) {
377
- this.showRequiredMessage();
378
- }
379
- },
380
- wrongNumberValidation(value) {
381
- if (isNaN(value) && value !== '') {
382
- this.showWrongNumberMessage();
383
- }
384
- },
385
- numberTypeValidation(value) {
386
- if (this.integer) {
387
- let isInteger = this.checkInteger(value);
388
- let parsedValue = parseInt(value);
389
-
390
- if (!isInteger || isNaN(parsedValue)) {
391
- this.showWrongNumberMessage();
392
- }
393
- } else {
394
- let isFloat = this.checkFloat(value);
395
- let parsedValue = parseInt(value);
396
-
397
- if (!isFloat || isNaN(parsedValue)) {
398
- this.showWrongNumberMessage();
399
- }
400
- }
401
- },
402
- decimalsValidation(value) {
403
- if (value && value.length > 0 && value.indexOf('.') !== -1) {
404
- let parts = value.split('.');
405
- let decimalPart = parts[1];
406
-
407
- if (decimalPart && decimalPart.length > this.internalDecimals) {
408
- this.internalError = true;
409
- this.internalMessages.push(this.$t('pui9.components.numberField.maxdecimalsmessage') + ' ' + this.internalDecimals);
410
- }
411
- }
412
- },
413
- minMaxValidation(value) {
414
- if (value < this.internalMin) {
415
- this.internalError = true;
416
- this.internalErrorMessages.push(this.$t('pui9.components.numberField.minvaluemessage') + ' ' + this.internalMin);
417
- }
418
-
419
- if (value > this.internalMax) {
420
- this.internalError = true;
421
- this.internalErrorMessages.push(this.$t('pui9.components.numberField.maxvaluemessage') + ' ' + this.internalMax);
422
- }
423
- },
424
- showWrongNumberMessage() {
425
- this.internalError = true;
426
- this.internalErrorMessages = [this.$t('pui9.components.numberField.wrongnumber')];
427
- },
428
- showRequiredMessage() {
429
- this.internalError = true;
430
- this.internalErrorMessages = [this.$t('pui9.error.field_required')];
431
- }
432
- }
433
- };
434
- </script>
@@ -1,105 +0,0 @@
1
- <template>
2
- <!-- DESKTOP -->
3
- <div v-if="!isMobile">
4
- <div class="ml-1 mr-1">
5
- <v-layout>
6
- <v-flex xs12 sm6 md4 xl3>
7
- <label v-if="getLabel === '$nbsp;'">&nbsp;</label>
8
- <label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
9
- </v-flex>
10
- <v-flex xs12 sm6 md8 xl9>
11
- <v-text-field
12
- :append-icon="show ? 'far fa-eye-slash' : 'far fa-eye'"
13
- :type="show ? 'text' : 'password'"
14
- v-bind="allProps"
15
- v-model="internalModel"
16
- class="input-group--focused"
17
- @click:append="show = !show"
18
- :rules="getRules"
19
- :placeholder="getPlaceholder"
20
- solo
21
- flat
22
- outlined
23
- single-line
24
- @input="updateValue"
25
- v-if="!isMobile"
26
- ></v-text-field>
27
- </v-flex>
28
- </v-layout>
29
- </div>
30
- </div>
31
-
32
- <!-- MOBILE -->
33
- <div v-else>
34
- <v-layout>
35
- <v-flex xs12>
36
- <v-text-field
37
- :append-icon="show ? 'far fa-eye-slash' : 'far fa-eye'"
38
- :type="show ? 'text' : 'password'"
39
- v-bind="allProps"
40
- v-model="internalModel"
41
- class="input-group--focused v-text-field--mobile"
42
- @click:append="show = !show"
43
- :rules="getRules"
44
- :placeholder="getPlaceholder"
45
- flat
46
- @input="updateValue"
47
- ></v-text-field>
48
- </v-flex>
49
- </v-layout>
50
- </div>
51
- </template>
52
-
53
- <script>
54
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
55
-
56
- export default {
57
- name: 'PuiPasswordField',
58
- mixins: [PuiFormComponentMixin],
59
- data() {
60
- return {
61
- required: true,
62
- isMobile: false,
63
- show: false
64
- };
65
- },
66
- props: {
67
- rules: {
68
- type: Array,
69
- default: () => {
70
- return [];
71
- }
72
- }
73
- },
74
- methods: {
75
- updateValue(value) {
76
- this.$emit('input', value);
77
- }
78
- },
79
- computed: {
80
- getLabelRequiredClass() {
81
- return { 'v-label--required': this.required };
82
- },
83
- getRules() {
84
- const rules = [...this.rules];
85
- if (this.required) {
86
- var func = (value) => !!value || this.$t('pui9.error.field_required');
87
- rules.push(func);
88
- }
89
- return rules;
90
- },
91
- getPlaceholder() {
92
- return this.$t('pui9.password');
93
- }
94
- },
95
- created() {
96
- this.isMobile = this.$store.getters.isMobile;
97
- this.internalModel = this.value;
98
- },
99
- watch: {
100
- value(val) {
101
- this.internalModel = val;
102
- }
103
- }
104
- };
105
- </script>
@@ -1,105 +0,0 @@
1
- <template>
2
- <div v-if="!isMobile">
3
- <div v-if="toplabel">
4
- <v-layout>
5
- <v-flex xs12>
6
- <label v-if="getLabel === '$nbsp;'">&nbsp;</label>
7
- <label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
8
- </v-flex>
9
- </v-layout>
10
- <v-layout>
11
- <v-flex xs12>
12
- <v-radio-group v-model="internalModel" v-bind="allProps" @change="updateValue">
13
- <v-radio v-for="radio in this.radios" :key="radio.id" :label="radio.label" :value="radio.id"></v-radio>
14
- </v-radio-group>
15
- </v-flex>
16
- </v-layout>
17
- </div>
18
- <div v-else>
19
- <v-layout>
20
- <v-flex v-if="label" :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
21
- <label :class="getLabelRequiredClass">{{ getLabel }}</label>
22
- </v-flex>
23
- <v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
24
- <v-radio-group v-model="internalModel" v-bind="allProps" @change="updateValue">
25
- <v-radio v-for="radio in this.radios" :key="radio.id" :label="radio.label" :value="radio.id"></v-radio>
26
- </v-radio-group>
27
- </v-flex>
28
- </v-layout>
29
- </div>
30
- </div>
31
- <!-- MOBILE -->
32
- <div v-else>
33
- <label v-if="label" class="mr-3">{{ getLabel }}</label>
34
- <v-radio-group v-model="internalModel" v-bind="allProps" @change="updateValue">
35
- <v-radio v-for="radio in this.radios" :key="radio.id" :label="radio.label" :value="radio.id" :ripple="false"></v-radio>
36
- </v-radio-group>
37
- </div>
38
- </template>
39
-
40
- <script>
41
- import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
42
-
43
- export default {
44
- name: 'PuiRadioGroup',
45
- mixins: [PuiFormComponentMixin],
46
- data: () => ({
47
- initialValue: 1,
48
- internalModel: 1
49
- }),
50
- props: {
51
- radios: {
52
- type: [Array],
53
- required: true
54
- },
55
- value: {
56
- type: [Number, String],
57
- required: false
58
- },
59
- rules: {
60
- type: Array,
61
- default: () => {
62
- return [];
63
- }
64
- },
65
- labelColumnStyles: {
66
- type: [String],
67
- required: false
68
- },
69
- valueColumnStyles: {
70
- type: [String],
71
- required: false
72
- }
73
- },
74
- methods: {
75
- updateValue(value) {
76
- this.$emit('input', value);
77
- }
78
- },
79
- computed: {
80
- getLabelRequiredClass() {
81
- return { 'v-label--required': this.required };
82
- },
83
- getRules() {
84
- const rules = [...this.rules];
85
- if (this.required) {
86
- var func = (value) => !!value || this.$t('pui9.error.field_selected');
87
- rules.push(func);
88
- }
89
- return rules;
90
- },
91
- isRequired() {
92
- return { 'v-input--checkbox--required': this.required };
93
- }
94
- },
95
- created() {
96
- this.initialValue = this.value;
97
- this.internalModel = this.value;
98
- },
99
- watch: {
100
- value(val) {
101
- this.internalModel = val;
102
- }
103
- }
104
- };
105
- </script>