pui9-components 1.17.3 → 2.0.7

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 (43) hide show
  1. package/dist/pui9-components.common.js +75007 -52512
  2. package/dist/pui9-components.css +9 -2
  3. package/package-lock.json +6651 -6827
  4. package/package.json +22 -26
  5. package/src/components/PuiCauDialog.vue +192 -0
  6. package/src/components/PuiCheckbox.vue +25 -4
  7. package/src/components/PuiCodeEditor.vue +2 -1
  8. package/src/components/PuiDateField.vue +653 -614
  9. package/src/components/PuiField.vue +1 -1
  10. package/src/components/PuiFileUpload.vue +275 -0
  11. package/src/components/PuiFileUploadGroup.vue +241 -0
  12. package/src/components/PuiFilter.vue +54 -52
  13. package/src/components/PuiFilterGroup.vue +179 -179
  14. package/src/components/PuiFilterRule.vue +481 -162
  15. package/src/components/PuiFormFooter.vue +5 -38
  16. package/src/components/PuiFormTooltip.vue +50 -0
  17. package/src/components/PuiMasterDetail.vue +18 -11
  18. package/src/components/PuiModalDialog.vue +4 -1
  19. package/src/components/PuiModalDialogForm.vue +5 -1
  20. package/src/components/PuiMultiSelect.vue +383 -280
  21. package/src/components/PuiNumberField.vue +216 -285
  22. package/src/components/PuiRichTextEditor.vue +43 -44
  23. package/src/components/PuiSelect.vue +382 -355
  24. package/src/components/PuiSelectDetailDialog.vue +10 -3
  25. package/src/components/PuiSelectorList.vue +169 -0
  26. package/src/components/PuiSort.vue +98 -0
  27. package/src/components/PuiSpinnerField.vue +101 -121
  28. package/src/components/PuiTextField.vue +374 -258
  29. package/src/index.js +8 -0
  30. package/src/main.js +1 -0
  31. package/src/mixins/PuiFormComponentMixin.js +2 -8
  32. package/src/mixins/PuiSortMixin.js +136 -0
  33. package/src/mixins/PuiUtilsNumberMixin.js +15 -5
  34. package/src/plugins/vuetify.js +2 -1
  35. package/src/utils.js +10 -0
  36. package/dist/demo.html +0 -10
  37. package/dist/pui9-components.common.js.map +0 -1
  38. package/dist/pui9-components.umd.js +0 -86432
  39. package/dist/pui9-components.umd.js.map +0 -1
  40. package/dist/pui9-components.umd.min.js +0 -308
  41. package/dist/pui9-components.umd.min.js.map +0 -1
  42. package/src/mixins/PuiFilterMixin.js +0 -157
  43. package/src/mixins/PuiMultiSelectMixin.js +0 -106
@@ -62,7 +62,7 @@ export default {
62
62
  } else {
63
63
  const form = self.getFormComponent(self.$refs.modalForm.$children[0]);
64
64
  if (form) {
65
- form.$parent.save(true);
65
+ form.save(true);
66
66
  this.$puiEvents.$on(`onPui-insertRow-dataTable-${self.modelName}`, (data) => {
67
67
  this.$puiEvents.$emit(`pui-modalDialog-${self.dialogName}-hide`, data);
68
68
  });
@@ -91,12 +91,19 @@ export default {
91
91
  if (!component) {
92
92
  return null;
93
93
  }
94
- if (component.validate && component.$options && component.$options._componentTag === 'v-form') {
94
+ if (
95
+ component.$options &&
96
+ (component.$options._componentTag === `${this.modelName}form` || component.$options._componentTag === `${this.modelName}-form`)
97
+ ) {
95
98
  return component;
96
99
  }
97
100
  for (let i = 0, childrenLength = component.$children.length; i < childrenLength; i++) {
98
101
  const child = this.getFormComponent(component.$children[i]);
99
- if (child && child.validate && child.$options && child.$options._componentTag === 'v-form') {
102
+ if (
103
+ child &&
104
+ child.$options &&
105
+ (child.$options._componentTag === `${this.modelName}form` || child.$options._componentTag === `${this.modelName}-form`)
106
+ ) {
100
107
  return child;
101
108
  }
102
109
  }
@@ -0,0 +1,169 @@
1
+ <template>
2
+ <div>
3
+ <v-row>
4
+ <v-col>
5
+ <div :style="{ 'max-height': '336px', 'overflow-y': 'auto' }">
6
+ <v-list v-if="hasCols">
7
+ <v-list-item-group v-model="columnId" color="primary" mandatory>
8
+ <!-- <v-list-item link v-for="(column, index) in confReactive.columns" :key="`gridColumn-${index}`" @click="columnId = index"> -->
9
+ <v-list-item
10
+ link
11
+ v-for="(column, index) in columns"
12
+ :key="`gridColumn-${index}`"
13
+ @click="
14
+ columnId = index;
15
+ columnValue = column;
16
+ handleClick();
17
+ "
18
+ >
19
+ <v-list-item-content>
20
+ <v-list-item-title v-if="dataType == 'Object'"> {{ column[nameProp] }} </v-list-item-title>
21
+ <v-list-item-title v-else> {{ column }} </v-list-item-title>
22
+ </v-list-item-content>
23
+ </v-list-item>
24
+ </v-list-item-group>
25
+ </v-list>
26
+ </div>
27
+ </v-col>
28
+ <v-col>
29
+ <v-row>
30
+ <v-col>
31
+ <v-btn depressed @click="addColumn()"><v-icon small>far fa-plus</v-icon></v-btn>
32
+ </v-col>
33
+ </v-row>
34
+ <v-row class="mb-2">
35
+ <v-col>
36
+ <v-btn depressed @click="removeColumn()"><v-icon small>far fa-minus</v-icon></v-btn>
37
+ </v-col>
38
+ </v-row>
39
+ <v-select toplabel clearable :items="currentItemsToSelect" v-model="selected"></v-select>
40
+ </v-col>
41
+ </v-row>
42
+ <slot name="below"></slot>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ export default {
48
+ name: 'PuiSelectorList',
49
+ data() {
50
+ return {
51
+ columnId: this.value,
52
+ columnValue: '',
53
+ selected: '',
54
+ currentItemsToSelect: []
55
+ };
56
+ },
57
+ props: {
58
+ confReactive: {
59
+ required: true
60
+ },
61
+
62
+ objName: {
63
+ type: String,
64
+ required: true
65
+ },
66
+ dataType: {
67
+ type: String,
68
+ default: 'Object'
69
+ },
70
+ nameProp: {
71
+ type: String,
72
+ default: 'name'
73
+ },
74
+ dataTemplate: {},
75
+ itemsToSelect: {
76
+ type: Array
77
+ },
78
+ colsNames: {
79
+ type: Array
80
+ }
81
+ },
82
+ methods: {
83
+ addColumn() {
84
+ if (this.selected != '') {
85
+ let data = '';
86
+
87
+ if (this.dataType == 'Object') {
88
+ data = { ...this.dataTemplate };
89
+ this.$set(data, this.nameProp, this.selected);
90
+ } else {
91
+ data = this.selected;
92
+ }
93
+ if (!(this.objName in this.confReactive)) {
94
+ //add = [add];
95
+ this.$set(this.confReactive, this.objName, [data]);
96
+ } else {
97
+ this.confReactive[this.objName].push(data);
98
+ }
99
+ this.currentItemsToSelect = this.currentItemsToSelect.filter((v) => v != this.selected);
100
+ this.selected = '';
101
+ }
102
+ },
103
+ removeColumn() {
104
+ if (this.confReactive[this.objName].length == 0) {
105
+ return;
106
+ }
107
+ let v = this.columnValue;
108
+ if (v == '') {
109
+ v = this.confReactive[this.objName][this.columnId];
110
+ }
111
+ if (this.dataType == 'Object') {
112
+ v = v[this.nameProp];
113
+ }
114
+ this.currentItemsToSelect.push(v);
115
+ this.columnValue = '';
116
+ let colDelete = this.columnId;
117
+ if (this.columnId > 0) {
118
+ this.columnId--;
119
+ }
120
+ this.handleClick(); // Update the value on the parent before removing the value from the array. It may give undefined errors without this line.
121
+ this.confReactive[this.objName].splice(colDelete, 1);
122
+ },
123
+ handleClick() {
124
+ this.$emit('input', this.columnId);
125
+ }
126
+ },
127
+ computed: {
128
+ hasCols() {
129
+ if (typeof this.confReactive === 'undefined') {
130
+ return false;
131
+ }
132
+
133
+ if (typeof this.confReactive != undefined) {
134
+ return Object.prototype.hasOwnProperty.call(this.confReactive, this.objName);
135
+ }
136
+ return false;
137
+ },
138
+ columns() {
139
+ if (typeof this.objName != undefined && Object.prototype.hasOwnProperty.call(this.confReactive, this.objName)) {
140
+ return this.confReactive[this.objName];
141
+ }
142
+ return this.confReactive;
143
+ }
144
+ },
145
+ created() {
146
+ if (this.itemsToSelect != undefined) {
147
+ if (this.itemsToSelect.length != 0) {
148
+ this.currentItemsToSelect = [...this.itemsToSelect];
149
+ }
150
+ }
151
+ if (this.hasCols && Array.isArray(this.confReactive[this.objName])) {
152
+ this.confReactive[this.objName] = this.confReactive[this.objName].map((v) => {
153
+ if (!(typeof v === 'object' && v !== null)) {
154
+ return { name: v };
155
+ }
156
+ return v;
157
+ });
158
+ for (let item of this.confReactive[this.objName]) {
159
+ if (this.dataType == 'Object') {
160
+ const value = item[this.nameProp];
161
+ this.currentItemsToSelect = this.currentItemsToSelect.filter((v) => v != value);
162
+ } else {
163
+ this.currentItemsToSelect = this.currentItemsToSelect.filter((v) => v != item);
164
+ }
165
+ }
166
+ }
167
+ }
168
+ };
169
+ </script>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <v-card-text class="pt-0 pr-2 pl-0 pb-0">
3
+ <!-- slot1, TODO MAKE SLOTS IN FILTER AND SORTING DIALOGS-->
4
+ <v-list-item>
5
+ <v-list-item-action-text class="pui-dialog__title">{{ $t('puidatatables.sort') }}</v-list-item-action-text>
6
+ </v-list-item>
7
+ <v-flex xs12 class="pui-dialog__ruleContainer mb-1" :style="{ height: heightPanel }">
8
+ <draggable :list="rules" v-bind="{ group: 'rules' }" @end="removeSelectsFocus">
9
+ <div v-for="(rule, index) in rules" class="pui-dialog__rule pui-dialog__rule--small ml-1" :key="index">
10
+ <v-layout wrap class="rule">
11
+ <v-flex xs1>
12
+ <v-list-item class="move draggable_point" v-show="(grouped === true && index === 0) === false">
13
+ <v-icon small>far fa-ellipsis-v</v-icon>
14
+ <v-icon small>far fa-ellipsis-v</v-icon>
15
+ </v-list-item>
16
+ </v-flex>
17
+ <v-flex xs6 class="pr-2">
18
+ <v-autocomplete
19
+ class="font-size-12"
20
+ label="column"
21
+ append-icon="fa fa-angle-down"
22
+ v-model="rule.column"
23
+ :ref="`${index}-column`"
24
+ :disabled="grouped === true && index === 0"
25
+ solo
26
+ flat
27
+ @change="setIndex(index), onRuleNameChanged($event, index)"
28
+ :items="getAvailableColumns(index)"
29
+ item-text="name"
30
+ item-value="name"
31
+ hide-selected
32
+ ></v-autocomplete>
33
+ </v-flex>
34
+ <v-flex xs4>
35
+ <v-select
36
+ append-icon="fa fa-angle-down"
37
+ class="font-size-12"
38
+ v-model="rule.direction"
39
+ :ref="`${index}-sortType`"
40
+ solo
41
+ flat
42
+ :items="sortingTypes"
43
+ :label="$t('puidatatables.ascendent')"
44
+ ></v-select>
45
+ </v-flex>
46
+ <v-flex xs1 class="pointer" @click="removeRule(index)" v-show="(grouped === true && index === 0) === false">
47
+ <v-list-item>
48
+ <v-icon small class="trashIcon" :title="getTitleRemove">fa fa-trash-alt</v-icon>
49
+ </v-list-item>
50
+ </v-flex>
51
+ </v-layout>
52
+ </div>
53
+ </draggable>
54
+ </v-flex>
55
+ <v-flex xs12 v-show="showAddBtn">
56
+ <v-btn class="btnAdd elevation-0 mt-0 mb-1" @click="addRule()">
57
+ <v-icon small>far fa-plus</v-icon>
58
+ <span>{{ $t('puidatatables.addRule') }}</span>
59
+ </v-btn>
60
+ </v-flex>
61
+ </v-card-text>
62
+ </template>
63
+ <script>
64
+ import PuiSortMixin from '../mixins/PuiSortMixin';
65
+
66
+ export default {
67
+ name: 'PuiSort',
68
+ mixins: [PuiSortMixin]
69
+ };
70
+ </script>
71
+
72
+ <style lang="postcss" scoped>
73
+ .trashIcon {
74
+ top: 10px;
75
+ position: absolute;
76
+ }
77
+ .btnAdd {
78
+ height: 28px !important;
79
+ color: var(--N-500);
80
+ &.v-btn {
81
+ background-color: var(--N-0) !important;
82
+ }
83
+ & span {
84
+ padding-left: 6px;
85
+ }
86
+ }
87
+
88
+ .draggable_point .v-icon {
89
+ margin-top: -12px;
90
+ color: var(--N-50);
91
+ }
92
+ .draggable_btn {
93
+ width: 20px !important;
94
+ & .v-icon {
95
+ margin-top: -12px;
96
+ }
97
+ }
98
+ </style>
@@ -6,20 +6,7 @@
6
6
  <v-flex xs12>
7
7
  <label v-if="getLabel === '$nbsp;'">&nbsp;</label>
8
8
  <label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
9
- <v-tooltip top v-if="showTooltip">
10
- <template v-slot:activator="{ on }">
11
- <v-icon class="info-tooltip" size="14" v-on="on">fas fa-info-circle info-tooltip</v-icon>
12
- </template>
13
- <span>
14
- <span v-if="this.description !== ''">
15
- {{ this.description }}
16
- <hr v-if="this.infoTooltipMessages.length > 0" />
17
- </span>
18
- <ul>
19
- <li v-for="(message, index) in this.infoTooltipMessages" :key="index">{{ message }}</li>
20
- </ul>
21
- </span>
22
- </v-tooltip>
9
+ <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
23
10
  </v-flex>
24
11
  </v-layout>
25
12
  <v-layout>
@@ -45,7 +32,7 @@
45
32
 
46
33
  <v-btn
47
34
  icon
48
- class="primary--text pui-spinner-btnCtrl pui-spinner-btnCtrl_minus ml-0 pl-0 pr-0 mt-0"
35
+ class="primary--text pui-spinner-btnCtrl pui-spinner-btnCtrl_minus ml-2 pl-0 pr-0 mt-0"
49
36
  :class="{ 'pui-spinner-btnCtrl_disabled': isBtnSubstractDisable }"
50
37
  :ripple="!isBtnSubstractDisable"
51
38
  @click="downValue"
@@ -68,20 +55,7 @@
68
55
  <v-layout>
69
56
  <v-flex :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
70
57
  <label :class="getLabelRequiredClass">{{ getLabel }}</label>
71
- <v-tooltip top v-if="showTooltip">
72
- <template v-slot:activator="{ on }">
73
- <v-icon class="info-tooltip" size="14" v-on="on">fas fa-info-circle info-tooltip</v-icon>
74
- </template>
75
- <span>
76
- <span v-if="this.description !== ''">
77
- {{ this.description }}
78
- <hr />
79
- </span>
80
- <ul>
81
- <li v-for="(message, index) in this.infoTooltipMessages" :key="index">{{ message }}</li>
82
- </ul>
83
- </span>
84
- </v-tooltip>
58
+ <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
85
59
  </v-flex>
86
60
  <v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
87
61
  <v-text-field
@@ -184,8 +158,7 @@ export default {
184
158
  disableBtnAdd: false,
185
159
  disableBtnSubstract: false,
186
160
  internalMessages: [],
187
- internalErrorMessages: [],
188
- infoTooltipMessages: []
161
+ internalErrorMessages: []
189
162
  }),
190
163
  props: {
191
164
  value: {
@@ -212,14 +185,17 @@ export default {
212
185
  required: false
213
186
  },
214
187
  tooltip: {
215
- type: [Boolean],
216
- default: false,
188
+ type: Boolean,
189
+ required: false,
190
+ default: false
191
+ },
192
+ tooltipDescription: {
193
+ type: String,
217
194
  required: false
218
195
  },
219
- description: {
220
- type: [String],
221
- default: '',
222
- required: false
196
+ tooltipIcon: {
197
+ type: String,
198
+ required: false,
223
199
  },
224
200
  noLazyModel: {
225
201
  type: [Boolean],
@@ -245,14 +221,99 @@ export default {
245
221
  required: false
246
222
  }
247
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
+ },
248
309
  methods: {
249
- getInfoTooltip() {
310
+ setTooltip() {
250
311
  if (this.max !== Number.MAX_SAFE_INTEGER) {
251
- this.infoTooltipMessages.push(this.$t('pui9.components.spinnerField.overmaxvalue') + ': ' + this.max);
312
+ this.$refs.tooltip.pushMessage(this.$t('pui9.components.spinnerField.overmaxvalue') + ': ' + this.max);
252
313
  }
253
314
 
254
315
  if (this.min !== Number.MIN_SAFE_INTEGER) {
255
- this.infoTooltipMessages.push(this.$t('pui9.components.spinnerField.overminvalue') + ': ' + this.min);
316
+ this.$refs.tooltip.pushMessage(this.$t('pui9.components.spinnerField.overminvalue') + ': ' + this.min);
256
317
  }
257
318
  },
258
319
  updateValueLazy() {
@@ -398,87 +459,6 @@ export default {
398
459
  this.firstLazyLoad = true;
399
460
  }
400
461
  }
401
- },
402
- computed: {
403
- getMobileClass() {
404
- return { 'v-text-field--edited': this.isEdited, 'v-text-field--required': this.required };
405
- },
406
- getLabelRequiredClass() {
407
- return { 'v-label--required': this.required };
408
- },
409
- getEditedClass() {
410
- return { 'v-text-field--edited': this.isEdited };
411
- },
412
- getCompStyle() {
413
- var inputWidth = this.width;
414
- if (this.value && !isNaN(parseInt(this.value))) {
415
- var numLength = this.value.toString().length;
416
- var newle = numLength * 13;
417
- const sufPref = this.allProps.suffix || this.allProps.prefix;
418
- if (sufPref) newle += sufPref.length * 13;
419
- if (newle > inputWidth) {
420
- inputWidth = newle;
421
- }
422
- }
423
- return { width: inputWidth + 'px' };
424
- },
425
- isBtnAddDisable() {
426
- return this.checkBtnAddDisable();
427
- },
428
- isBtnSubstractDisable() {
429
- return this.checkBtnSubstarctDisable();
430
- },
431
- showTooltip() {
432
- if (!this.tooltip || this.getLabel === '' || this.getLabel === null) {
433
- return false;
434
- }
435
- return (this.infoTooltipMessages.length > 0 || this.description !== '') && this.tooltip;
436
- }
437
- },
438
- created() {
439
- if (this.noLazyModel) {
440
- this.firstLazyLoad = true;
441
- }
442
- this.initializeModel(this.value);
443
-
444
- this.getInfoTooltip();
445
- },
446
- watch: {
447
- value(val) {
448
- if (!this.noLazyModel && !this.firstLazyLoad) {
449
- this.initializeModel(val);
450
- this.firstLazyLoad = true;
451
- } else {
452
- this.internalModel = val;
453
- }
454
- },
455
- min(newVal) {
456
- if (newVal !== null && newVal !== undefined) {
457
- const minVal = parseInt(newVal);
458
- if (!isNaN(minVal)) {
459
- if (minVal < this.maxValue) {
460
- this.minValue = minVal;
461
- }
462
- }
463
- } else {
464
- this.minValue = Number.MIN_SAFE_INTEGER;
465
- }
466
- },
467
- max(newVal) {
468
- if (newVal !== null && newVal !== undefined) {
469
- const maxVal = parseInt(newVal);
470
- if (!isNaN(maxVal)) {
471
- if (maxVal > this.minValue) {
472
- this.maxValue = maxVal;
473
- }
474
- }
475
- } else {
476
- this.maxValue = Number.MAX_SAFE_INTEGER;
477
- }
478
- }
479
- },
480
- destroyed() {
481
- // No hay que eliminar el evento de onPuiTreeMenuItemSelected
482
462
  }
483
463
  };
484
464
  </script>