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
@@ -39,15 +39,9 @@ export default {
39
39
  return false;
40
40
  } else {
41
41
  try {
42
- if (this.initialValue.toString() !== this.internalModel.toString()) {
43
- return true;
44
- }
45
- return false;
42
+ return this.initialValue.toString() !== this.internalModel.toString();
46
43
  } catch (e) {
47
- if (this.initialValue !== this.internalModel) {
48
- return true;
49
- }
50
- return false;
44
+ return this.initialValue !== this.internalModel;
51
45
  }
52
46
  }
53
47
  },
@@ -0,0 +1,136 @@
1
+ export default {
2
+ props: {
3
+ columns: {
4
+ type: Array
5
+ },
6
+ currentRules: {
7
+ type: Array
8
+ },
9
+ modelName: {
10
+ type: String,
11
+ required: true
12
+ }
13
+ },
14
+ data() {
15
+ return {
16
+ availableColumns: [],
17
+ height: 50,
18
+ grouped: false,
19
+ sortingTypes: [
20
+ {
21
+ text: 'puidatatables.ascendent',
22
+ value: 'asc'
23
+ },
24
+ {
25
+ text: 'puidatatables.descendent',
26
+ value: 'desc'
27
+ }
28
+ ],
29
+ rules: [],
30
+ colNames: []
31
+ };
32
+ },
33
+ created: function () {
34
+ this.rules = this.currentRules;
35
+ for (let n of this.columns) {
36
+ this.availableColumns.push(n.name);
37
+ this.colNames.push(n.name);
38
+ }
39
+ for (let col of this.currentRules) {
40
+ this.onRuleNameChanged(col.column);
41
+ }
42
+ this.translateSortingTypes();
43
+ },
44
+
45
+ watch: {
46
+ colNames(val) {
47
+ var size = 50;
48
+ if (val.length > 0) {
49
+ this.height = val.length * size;
50
+ } else {
51
+ this.height = size;
52
+ }
53
+ if (this.height > 250) {
54
+ this.height = 280;
55
+ }
56
+ }
57
+ },
58
+ computed: {
59
+ showAddBtn() {
60
+ if (this.columns.length > this.rules.length) {
61
+ return true;
62
+ }
63
+ return false;
64
+ },
65
+ getTitleRemove() {
66
+ return this.$t('puidatatables.removeBtnTitle');
67
+ },
68
+ heightPanel() {
69
+ return this.height + 'px';
70
+ }
71
+ },
72
+ methods: {
73
+ getAvailableColumns(index) {
74
+ const availableColumns = this.availableColumns;
75
+ const columnNameSelected = this.rules[index].column;
76
+ const columnsAvailableForTheSelect = this.colNames.filter((column) => {
77
+ return availableColumns.includes(column) || column === columnNameSelected;
78
+ });
79
+
80
+ return columnsAvailableForTheSelect;
81
+ },
82
+ removeSelectsFocus() {
83
+ for (let i = 0, length = this.rules.length; i < length; i++) {
84
+ this.$refs[`${i}-column`][0].$el.classList.remove('v-input--is-focused');
85
+ this.$refs[`${i}-sortType`][0].$el.classList.remove('v-input--is-focused');
86
+ }
87
+ },
88
+ removeRule(index) {
89
+ this.availableColumns.push(this.rules[index].column);
90
+ this.rules.splice(index, 1);
91
+ if (this.rules.length === 0) {
92
+ this.columns
93
+ .sort((a, b) => (a.title < b.title ? -1 : a.title > b.title ? 1 : 0))
94
+ .forEach((column) => {
95
+ this.availableColumns.push(column.removeRule);
96
+ });
97
+ this.addRule();
98
+ }
99
+ },
100
+ addRule() {
101
+ this.rules.push({ column: '', direction: 'asc' });
102
+ },
103
+ translateSortingTypes() {
104
+ for (var i = 0, length = this.sortingTypes.length; i < length; i++) {
105
+ this.sortingTypes[i].text = this.$t(this.sortingTypes[i].text);
106
+ }
107
+ },
108
+ onRuleNameChanged(value) {
109
+ //quitamos de las disponibles la nueva columna
110
+ this.removeColumnFromAvailable(value);
111
+ //a contiunación añadimos a disponibles la columna que se ha cambiado
112
+ const rulesColNames = this.rules.map((rule) => {
113
+ return rule.column;
114
+ });
115
+ this.colNames
116
+ .sort((a, b) => (a.title < b.title ? -1 : a.title > b.title ? 1 : 0))
117
+ .forEach((column) => {
118
+ if (rulesColNames.includes(column) === false && this.availableColumns.includes(column) === false) {
119
+ this.availableColumns.push(column);
120
+ }
121
+ });
122
+ },
123
+ removeColumnFromAvailable(columnName) {
124
+ for (let i = 0, length = this.availableColumns.length; i < length; i++) {
125
+ const column = this.availableColumns[i];
126
+ if (column === columnName) {
127
+ this.availableColumns.splice(i, 1);
128
+ break;
129
+ }
130
+ }
131
+ },
132
+ setIndex(index) {
133
+ this.index = index;
134
+ }
135
+ }
136
+ };
@@ -9,11 +9,21 @@ export default {
9
9
  return regexp.test(val);
10
10
  },
11
11
  truncateDecimal(number, decimals) {
12
- var a = Math.pow(10, decimals);
13
- var b = number * a;
14
- var c = parseInt(b);
15
- var d = c / a;
16
- return d;
12
+ // Limit the number of decimal places to prevent floating point errors
13
+ // a alguien le pareció bien la idea de poner por defecto 999 y hemos tumbado una máquina de AWS dividiendo Infinity's
14
+
15
+ if (decimals > 20) {
16
+ decimals = 20;
17
+ }
18
+
19
+ let pow = Math.pow(10, decimals);
20
+ let multiplied = number * pow;
21
+ let rounded = Math.round(multiplied);
22
+ let truncated = rounded / pow;
23
+
24
+ return truncated;
25
+
26
+ // return Math.trunc(number * Math.pow(10, decimals)) / Math.pow(10, decimals);
17
27
  }
18
28
  }
19
29
  };
@@ -1,5 +1,6 @@
1
1
  import Vue from 'vue';
2
- import Vuetify from 'vuetify/lib';
2
+ import Vuetify from 'vuetify'
3
+ import 'vuetify/dist/vuetify.min.css'
3
4
  import colors from 'vuetify/es5/util/colors';
4
5
  import es from 'vuetify/es5/locale/es';
5
6
  import ca from 'vuetify/es5/locale/ca';
package/src/utils.js CHANGED
@@ -80,6 +80,16 @@ export default {
80
80
 
81
81
  return tokens[tokens.length - 1];
82
82
  },
83
+ convertPkStringToPkObject: (model, pkStr) => {
84
+ const splits = pkStr.split("#");
85
+ const pkObj = {};
86
+ var i = 0;
87
+ model.columns.filter(c => c.isPk).forEach(c => {
88
+ pkObj[c.name] = splits[i++];
89
+ });
90
+
91
+ return pkObj;
92
+ },
83
93
  utf8ToB64: str => {
84
94
  if (str) {
85
95
  return window.btoa(unescape(encodeURIComponent(str)));
package/dist/demo.html DELETED
@@ -1,10 +0,0 @@
1
- <meta charset="utf-8">
2
- <title>pui9-components demo</title>
3
- <script src="./pui9-components.umd.js"></script>
4
-
5
- <link rel="stylesheet" href="./pui9-components.css">
6
-
7
-
8
- <script>
9
- console.log(pui9-components)
10
- </script>