pui9-datatables 1.16.4

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 (86) hide show
  1. package/README.md +24 -0
  2. package/dist/demo.html +10 -0
  3. package/dist/pui9-datatables.common.js +89206 -0
  4. package/dist/pui9-datatables.common.js.map +1 -0
  5. package/dist/pui9-datatables.css +5 -0
  6. package/dist/pui9-datatables.umd.js +89216 -0
  7. package/dist/pui9-datatables.umd.js.map +1 -0
  8. package/dist/pui9-datatables.umd.min.js +55 -0
  9. package/dist/pui9-datatables.umd.min.js.map +1 -0
  10. package/package-lock.json +15982 -0
  11. package/package.json +89 -0
  12. package/src/App.vue +37 -0
  13. package/src/components/desktop/PuiDatatable.vue +709 -0
  14. package/src/components/desktop/PuiQuickEditionDatatable.vue +548 -0
  15. package/src/components/desktop/PuiSimpleDatatable.vue +1498 -0
  16. package/src/components/desktop/datatables.net-plugins/pagination/input.js +213 -0
  17. package/src/components/desktop/footer/PuiDatatableFooter.vue +65 -0
  18. package/src/components/desktop/footer/PuiGridActionFooter.vue +132 -0
  19. package/src/components/desktop/quickedition/PuiQuickEditionExportBtn.vue +138 -0
  20. package/src/components/desktop/quickedition/PuiQuickEditionForm.vue +60 -0
  21. package/src/components/desktop/quickedition/PuiQuickEditionToolbar.vue +144 -0
  22. package/src/components/desktop/row/PuiGridRowActions.vue +112 -0
  23. package/src/components/desktop/subdialogs/PuiDatatableColumnMenu.vue +186 -0
  24. package/src/components/desktop/toolbar/PuiGridToolbar.vue +310 -0
  25. package/src/components/desktop/toolbar/actions/PuiGridActionListItem.vue +34 -0
  26. package/src/components/desktop/toolbar/actions/PuiGridActionsBtn.vue +56 -0
  27. package/src/components/desktop/toolbar/actions/PuiGridActionsDialog.vue +66 -0
  28. package/src/components/desktop/toolbar/actions/audit/PuiAuditDialog.vue +92 -0
  29. package/src/components/desktop/toolbar/actions/docgen/PuiDocgenTemplateMatchingsDialog.vue +139 -0
  30. package/src/components/desktop/toolbar/actions/docgen/PuiDocgenTemplateParametersDialog.vue +317 -0
  31. package/src/components/desktop/toolbar/actions/importexport/PuiGridExportDialog.vue +187 -0
  32. package/src/components/desktop/toolbar/actions/importexport/PuiGridImportDialog.vue +421 -0
  33. package/src/components/desktop/toolbar/export/PuiGridExportBtn.vue +175 -0
  34. package/src/components/desktop/toolbar/filtercombo/PuiGridFilterCombo.vue +237 -0
  35. package/src/components/desktop/toolbar/filtering/PuiGridFilterBtns.vue +163 -0
  36. package/src/components/desktop/toolbar/filtering/PuiGridFilterDialog.vue +434 -0
  37. package/src/components/desktop/toolbar/filtering/PuiGridFilterGroup.vue +313 -0
  38. package/src/components/desktop/toolbar/filtering/PuiGridFilterListBtn.vue +85 -0
  39. package/src/components/desktop/toolbar/filtering/PuiGridFilterListDialog.vue +254 -0
  40. package/src/components/desktop/toolbar/filtering/PuiGridFilterListItem.vue +192 -0
  41. package/src/components/desktop/toolbar/filtering/PuiGridFilterRule.vue +517 -0
  42. package/src/components/desktop/toolbar/grid-configuration/PuiGridConfBtns.vue +99 -0
  43. package/src/components/desktop/toolbar/grid-configuration/PuiGridConfDialog.vue +640 -0
  44. package/src/components/desktop/toolbar/grid-configuration/PuiSaveConfigDialog.vue +154 -0
  45. package/src/components/desktop/toolbar/row/PuiGridCreateBtn.vue +39 -0
  46. package/src/components/desktop/toolbar/row/PuiGridDeleteBtn.vue +86 -0
  47. package/src/components/desktop/toolbar/row/PuiGridRefreshBtn.vue +39 -0
  48. package/src/components/desktop/toolbar/row/PuiGridUpdateBtn.vue +56 -0
  49. package/src/components/desktop/toolbar/searching/PuiGridSearcher.vue +67 -0
  50. package/src/components/desktop/toolbar/searching/PuiGridSearcherColumnsList.vue +43 -0
  51. package/src/components/desktop/toolbar/sorting/PuiGridSortBtn.vue +44 -0
  52. package/src/components/desktop/toolbar/sorting/PuiGridSortDialog.vue +113 -0
  53. package/src/components/mobile/PuiDatalist.vue +477 -0
  54. package/src/components/mobile/PuiSimpleDatalist.vue +313 -0
  55. package/src/components/mobile/actions/PuiListActionListItem.vue +34 -0
  56. package/src/components/mobile/actions/PuiListActionsBtn.vue +38 -0
  57. package/src/components/mobile/actions/PuiListActionsDialog.vue +66 -0
  58. package/src/components/mobile/footer/PuiListActionFooter.vue +56 -0
  59. package/src/components/mobile/toolbar/PuiListToolbar.vue +60 -0
  60. package/src/components/mobile/toolbar/searching/PuiListSearcher.vue +53 -0
  61. package/src/components/mobile/toolbar/searching/PuiListSearcherColumnsList.vue +43 -0
  62. package/src/components/mobile/toolbar/sorting/PuiListSortBtn.vue +46 -0
  63. package/src/components/mobile/toolbar/sorting/PuiListSortDialog.vue +140 -0
  64. package/src/components/puiaudit/PuiAuditForm.vue +107 -0
  65. package/src/generalActions.js +135 -0
  66. package/src/index.js +31 -0
  67. package/src/main.js +67 -0
  68. package/src/mixins/PuiActionsBtnMixin.js +287 -0
  69. package/src/mixins/PuiActionsDialogMixin.js +161 -0
  70. package/src/mixins/PuiActionsListItemMixin.js +62 -0
  71. package/src/mixins/PuiDatatablesKeepPage.js +15 -0
  72. package/src/mixins/PuiGridFormMethodsMixin.js +133 -0
  73. package/src/mixins/PuiModelConfigurationMixin.js +15 -0
  74. package/src/mixins/PuiSearcherColumnsListMixin.js +108 -0
  75. package/src/mixins/PuiSearcherMixin.js +192 -0
  76. package/src/mixins/PuiSortBtnMixin.js +54 -0
  77. package/src/mixins/PuiSortDialogMixin.js +256 -0
  78. package/src/mixins/PuiToolbarBtnMixin.js +66 -0
  79. package/src/mixins/PuiToolbarDialogMixin.js +12 -0
  80. package/src/router.js +18 -0
  81. package/src/tests/PuiContainer.vue +139 -0
  82. package/src/tests/PuiProfileTestSimpleDatatable.vue +66 -0
  83. package/src/tests/PuiUserTestCompleteDatatable.vue +126 -0
  84. package/src/tests/PuiVariableTestQuickEditionDatatable.vue +39 -0
  85. package/src/tests/PuiVariableTestQuickEditionForm.vue +18 -0
  86. package/src/tests/modelConfigurations.json +3516 -0
@@ -0,0 +1,144 @@
1
+ <template>
2
+ <div>
3
+ <v-layout ml-3 mr-3>
4
+ <pui-quick-edition-export-btn
5
+ v-if="showPuiGridExportBtn"
6
+ :modelName="modelName"
7
+ :externalFilter="externalFilter"
8
+ ></pui-quick-edition-export-btn>
9
+ <v-btn
10
+ v-if="!formDisabled"
11
+ icon
12
+ class="elevation-0 pui-toolbar__actionBtn white--text primary"
13
+ :class="compClass"
14
+ :title="$t('puigridinsert.title')"
15
+ @click.native.stop="onSave"
16
+ style="margin-right: 5px !important"
17
+ >
18
+ <v-icon>far fa-save</v-icon>
19
+ </v-btn>
20
+ <v-btn
21
+ v-if="!formDisabled"
22
+ icon
23
+ class="elevation-0 pui-toolbar__actionBtn white--text secondary"
24
+ :class="compClass"
25
+ :title="$t('puigriddelete.title')"
26
+ @click.native.stop="onDelete"
27
+ style="margin-right: 5px !important"
28
+ >
29
+ <v-icon>far fa-trash-alt</v-icon>
30
+ </v-btn>
31
+ </v-layout>
32
+ <pui-modal-dialog
33
+ v-if="showSaveRegistryDialog"
34
+ :cancelText="$t('form.cancel')"
35
+ :okText="$t('pui9.accept')"
36
+ :titleText="getTitleSaveDialog()"
37
+ :messageText="getMessageSaveDialog()"
38
+ :dialogName="`saveRegistry-${this.modelName}`"
39
+ ></pui-modal-dialog>
40
+ </div>
41
+ </template>
42
+
43
+ <script>
44
+ import PuiQuickEditionExportBtn from './PuiQuickEditionExportBtn';
45
+
46
+ export default {
47
+ name: 'PuiQuickEditionToolbar',
48
+ components: {
49
+ PuiQuickEditionExportBtn
50
+ },
51
+ data() {
52
+ return {
53
+ showPuiGridExportBtn: false,
54
+ showSaveRegistryDialog: false
55
+ };
56
+ },
57
+ props: {
58
+ modelName: {
59
+ type: String,
60
+ required: true
61
+ },
62
+ formDisabled: {
63
+ type: Boolean,
64
+ required: true
65
+ },
66
+ showSaveModal: {
67
+ type: Object,
68
+ required: false
69
+ },
70
+ externalFilter: {
71
+ type: Object,
72
+ required: false
73
+ },
74
+ exportable: {
75
+ type: Boolean,
76
+ default: false
77
+ }
78
+ },
79
+ computed: {
80
+ compClass() {
81
+ return this.$store.getters.isMobile ? 'pui-toolbar__actionBtn--mobile' : 'pui-toolbar__actionBtn--desktop';
82
+ }
83
+ },
84
+ created() {
85
+ const model = this.$store.getters.getModelByName(this.modelName);
86
+ if (model) {
87
+ this.showPuiGridExportBtn = this.exportable && model.url && model.url.export;
88
+ }
89
+ },
90
+ mounted() {
91
+ this.subscribeEvents();
92
+ },
93
+ destroyed() {
94
+ this.$puiEvents.$off(`pui-modalDialog-saveRegistry-${this.modelName}-validate`);
95
+ this.$puiEvents.$off(`pui-modalDialog-saveRegistry-${this.modelName}-ok`);
96
+ this.$puiEvents.$off(`pui-modalDialog-saveRegistry-${this.modelName}-cancel`);
97
+ },
98
+ methods: {
99
+ onSave() {
100
+ this.$puiEvents.$emit(`onPui-quickEditionForm-${this.modelName}-validate`);
101
+ },
102
+ onDelete() {
103
+ this.$puiEvents.$emit(`onPui-quickEditionForm-${this.modelName}-delete`);
104
+ },
105
+ subscribeEvents() {
106
+ // save registry validate form
107
+ this.$puiEvents.$on(`pui-modalDialog-saveRegistry-${this.modelName}-validate`, (valid) => {
108
+ if (!valid) {
109
+ this.$puiNotify.error(this.$t('pui9.error.form_errors'));
110
+ } else {
111
+ if (this.showSaveModal !== undefined && this.showSaveModal.indShow === true) {
112
+ this.showSaveRegistryDialog = true;
113
+ } else {
114
+ this.$puiEvents.$emit(`onPui-quickEditionForm-${this.modelName}-save`);
115
+ }
116
+ }
117
+ });
118
+ // save registry modal ok press
119
+ this.$puiEvents.$on(`pui-modalDialog-saveRegistry-${this.modelName}-ok`, () => {
120
+ this.$puiEvents.$emit(`onPui-quickEditionForm-${this.modelName}-save`);
121
+ this.showSaveRegistryDialog = false;
122
+ });
123
+ // save registry modal cancel press
124
+ this.$puiEvents.$on(`pui-modalDialog-saveRegistry-${this.modelName}-cancel`, () => {
125
+ this.showSaveRegistryDialog = false;
126
+ });
127
+ },
128
+ getMessageSaveDialog() {
129
+ if (this.showSaveModal.messageText !== undefined) {
130
+ return this.showSaveModal.messageText;
131
+ } else {
132
+ return this.$t('pui9.save.confirm');
133
+ }
134
+ },
135
+ getTitleSaveDialog() {
136
+ if (this.showSaveModal.titleText !== undefined) {
137
+ return this.showSaveModal.titleText;
138
+ } else {
139
+ return this.$t('pui9.save.title');
140
+ }
141
+ }
142
+ }
143
+ };
144
+ </script>
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div
3
+ class="pui-rowActions mr-2"
4
+ v-show="show"
5
+ @mouseover="(mouseInside = true), (show = true)"
6
+ @mouseout="mouseInside = false"
7
+ @mousewheel="handleScroll"
8
+ >
9
+ <v-btn icon @click.native.stop="onViewButton" class="pui-rowActions__btn">
10
+ <v-icon>far fa-eye</v-icon>
11
+ </v-btn>
12
+ <v-btn icon @click.native.stop="onEditButton" class="pui-rowActions__btn" v-if="showEditButton">
13
+ <v-icon>far fa-edit</v-icon>
14
+ </v-btn>
15
+ <v-btn icon @click.native.stop="onDeleteButton" class="pui-rowActions__btn" v-if="showDeleteButton">
16
+ <v-icon>far fa-trash-alt</v-icon>
17
+ </v-btn>
18
+ <!-- dialogo alerta borrado de registro -->
19
+ <pui-modal-dialog
20
+ v-if="showDeleteRegistryDialog"
21
+ :cancelText="$t('form.cancel')"
22
+ :okText="$t('pui9.accept')"
23
+ :titleText="$t('pui9.delete.title')"
24
+ :messageText="$t('pui9.delete.confirm')"
25
+ :dialogName="`deleteRecordAlert-${this.modelName}`"
26
+ ></pui-modal-dialog>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ export default {
32
+ name: 'PuiGridRowActions',
33
+ data() {
34
+ return {
35
+ show: false,
36
+ positionX: 32,
37
+ showDeleteRegistryDialog: false,
38
+ mouseInside: false
39
+ };
40
+ },
41
+ props: {
42
+ modelName: {
43
+ required: true,
44
+ type: String
45
+ },
46
+ mouseOut: {
47
+ type: Boolean
48
+ },
49
+ showEditButton: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ showDeleteButton: {
54
+ type: Boolean,
55
+ default: true
56
+ }
57
+ },
58
+ watch: {
59
+ mouseOut(newVal) {
60
+ if (this.mouseInside === true) {
61
+ return;
62
+ }
63
+ this.show = !newVal;
64
+ }
65
+ },
66
+ mounted() {
67
+ this.$el.style.right = `${this.positionX}px`;
68
+ this.$puiEvents.$on(`onPui-hoverRow-dataTable-${this.modelName}`, this.onHover);
69
+ this.$puiEvents.$on(`pui-modalDialog-deleteRecordAlert-${this.modelName}-ok`, () => {
70
+ this.$parent.deleteRegistry(this.row);
71
+ this.showDeleteRegistryDialog = false;
72
+ });
73
+ this.$puiEvents.$on(`pui-modalDialog-deleteRecordAlert-${this.modelName}-cancel`, () => {
74
+ this.showDeleteRegistryDialog = false;
75
+ });
76
+ },
77
+ destroyed() {
78
+ this.$puiEvents.$off(`pui-modalDialog-deleteRecordAlert-${this.modelName}-ok`);
79
+ this.$puiEvents.$off(`pui-modalDialog-deleteRecordAlert-${this.modelName}-cancel`);
80
+ this.$puiEvents.$off(`onPui-hoverRow-dataTable-${this.modelName}`, this.onHover);
81
+ },
82
+ methods: {
83
+ handleScroll(e) {
84
+ this.show = false;
85
+ this.$parent.handleWheelRowActions(e);
86
+ },
87
+ onHover(hoverInfo) {
88
+ //TODO añadir clase de hover a la fila cuando se esta sobre el div de puiRowActions y quitar a la anterior fila
89
+ this.show = true;
90
+ this.positionY = hoverInfo.y + 30;
91
+ if (this.$store.state.global.appContainerHeader) {
92
+ this.positionY = this.positionY + 64;
93
+ }
94
+ this.row = hoverInfo.row;
95
+ this.$el.style.top = `${this.positionY}px`;
96
+ },
97
+ onViewButton() {
98
+ this.$parent.editRegistry(this.row, 'read');
99
+ },
100
+ onEditButton() {
101
+ if (this.$parent.isEditableRegistry(this.row.data())) {
102
+ this.$parent.editRegistry(this.row, 'update');
103
+ } else {
104
+ this.$parent.editRegistry(this.row, 'read');
105
+ }
106
+ },
107
+ onDeleteButton() {
108
+ this.showDeleteRegistryDialog = true;
109
+ }
110
+ }
111
+ };
112
+ </script>
@@ -0,0 +1,186 @@
1
+ <template>
2
+ <v-menu
3
+ transition="scale-transition"
4
+ v-model="headerContextMenu.opened"
5
+ absolute
6
+ :position-x="headerContextMenu.x"
7
+ :position-y="headerContextMenu.y"
8
+ :close-on-content-click="false"
9
+ >
10
+ <v-list>
11
+ <v-list-item
12
+ :class="{ 'v-list__tile--active': item.selected, 'white--text': item.selected }"
13
+ @click="item.click"
14
+ v-for="(item, index) in items"
15
+ :key="index"
16
+ >
17
+ <v-list-item-action>
18
+ <v-icon small :class="{ 'white--text': item.selected }">{{ item.icon }}</v-icon>
19
+ </v-list-item-action>
20
+ <v-list-item-content>
21
+ <v-list-item-title>{{ item.text }}</v-list-item-title>
22
+ </v-list-item-content>
23
+ <v-list-item-action>
24
+ <v-icon v-if="item.selected" small :class="{ 'white--text': item.selected }">check</v-icon>
25
+ </v-list-item-action>
26
+ </v-list-item>
27
+ </v-list>
28
+ </v-menu>
29
+ </template>
30
+
31
+ <script>
32
+ import $ from 'jquery';
33
+
34
+ export default {
35
+ name: 'PuiDatatableColumnMenu',
36
+ props: ['colHeader', 'modelName', 'fixed', 'grouped'],
37
+ data() {
38
+ return {
39
+ headerContextMenu: {
40
+ opened: false,
41
+ x: null,
42
+ y: null,
43
+ selectedColumnIndex: -1
44
+ },
45
+ headerActions: {
46
+ //sortColumnName: null,
47
+ //sortColumn: [-1, null],
48
+ groupColumn: -1,
49
+ fixedColumn: -1
50
+ }
51
+ };
52
+ },
53
+ computed: {
54
+ items() {
55
+ const selectedIndex = this.headerContextMenu.selectedColumnIndex;
56
+ const {
57
+ groupColumn,
58
+ //sortColumn: [sortIndex, sortDirection],
59
+ fixedColumn
60
+ } = this.headerActions;
61
+
62
+ return [
63
+ {
64
+ text: this.$t(selectedIndex === fixedColumn ? 'xDettachColumn' : 'xFixColumn'),
65
+ icon: selectedIndex === fixedColumn ? 'far fa-thumbtack' : 'fas fa-thumbtack',
66
+ click: () => {
67
+ let index = selectedIndex;
68
+ if (selectedIndex === fixedColumn) {
69
+ index = -1;
70
+ // eslint-disable-next-line
71
+ this.headerActions.fixedColumn = -1;
72
+ } else {
73
+ if (selectedIndex === 0) {
74
+ index = 1;
75
+ }
76
+ //desagrupamos si se fija una columna
77
+ this.headerActions.groupColumn !== -1 && this.$parent.setGroupColumn(-1);
78
+ }
79
+
80
+ this.$parent.pinColumnToLeft(index);
81
+ // eslint-disable-next-line
82
+ this.headerContextMenu.opened = false;
83
+ }
84
+ },
85
+ {
86
+ text: this.$t(selectedIndex === groupColumn ? 'xUngroupColumn' : 'xGroupColumn'),
87
+ icon: selectedIndex === groupColumn ? 'far fa-clone' : 'fas fa-clone',
88
+ click: () => {
89
+ let index = selectedIndex;
90
+ if (selectedIndex === groupColumn) {
91
+ index = -1;
92
+ // eslint-disable-next-line
93
+ this.headerActions.groupColumn = -1;
94
+ } else if (this.headerActions.fixedColumn !== -1) {
95
+ //desprendemos la columna fijada si la hubiera
96
+ this.$parent.pinColumnToLeft(-1);
97
+ } else {
98
+ // eslint-disable-next-line
99
+ this.headerActions.groupColumn = index;
100
+ }
101
+ this.$parent.setGroupColumn(index);
102
+ // eslint-disable-next-line
103
+ this.headerContextMenu.opened = false;
104
+ }
105
+ }
106
+ ];
107
+ }
108
+ },
109
+ created() {
110
+ this.onTableCreated();
111
+ },
112
+ methods: {
113
+ onRightClick(ev, index) {
114
+ // prevents showing the native contextmenu
115
+ ev.preventDefault();
116
+ const wasOpened = this.headerContextMenu.opened === true;
117
+ // prettier-ignore
118
+ this.headerContextMenu.selectedColumnIndex = index;
119
+ this.headerContextMenu.opened = false;
120
+ this.headerContextMenu.x = ev.clientX;
121
+ this.headerContextMenu.y = ev.clientY;
122
+
123
+ this.$nextTick(() => {
124
+ setTimeout(
125
+ () => {
126
+ this.headerContextMenu.opened = true;
127
+ },
128
+ wasOpened ? 120 : 0
129
+ );
130
+ });
131
+ },
132
+ onClick(e) {
133
+ $(e.currentTarget).off('click.DT');
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ const currentOrder = e.target.className.split('_')[1];
137
+ const direction = currentOrder === 'asc' ? 'desc' : 'asc';
138
+
139
+ if (this.grouped === true) {
140
+ this.$parent.orderInGroupedColumn(e.target.cellIndex, direction);
141
+ return;
142
+ }
143
+ const sortingRule = [];
144
+ this.$parent.applyOrder([[e.target.cellIndex, direction]], false);
145
+ sortingRule[0] = { column: this.$parent.getColumnName(e.target.cellIndex), direction };
146
+ this.$puiEvents.$emit(`onPui-apply-sorting-dataTable-${this.modelName}`, sortingRule);
147
+ },
148
+ onTableCreated() {
149
+ if (this.fixed === true) {
150
+ this.headerActions.fixedColumn = 1;
151
+ this.headerActions.groupColumn = -1;
152
+ } else if (this.grouped === true) {
153
+ this.headerActions.groupColumn = 1;
154
+ this.headerActions.fixedColumn = -1;
155
+ }
156
+ const addContextAndClickListeners = (th, index) => {
157
+ if (index === 0) {
158
+ return;
159
+ }
160
+ //to show the column context menu
161
+ th.addEventListener('contextmenu', (ev) => this.onRightClick(ev, index));
162
+ //to capture order event and notify the grid Configuration Manager and Sorting Dialog
163
+ const $th = $(th);
164
+ $th.off('click');
165
+ $th.on('click', this.onClick);
166
+ $th.on('keydown', (ev) => {
167
+ ev.keyCode === 13 && this.onClick(ev);
168
+ });
169
+ };
170
+
171
+ // Show contextmenu for each th
172
+ if (this.fixed === true) {
173
+ const fixedColumnHeader = this.colHeader.parent().parent().parent().find('.DTFC_LeftHeadWrapper');
174
+ addContextAndClickListeners(fixedColumnHeader.find('th')[1], 1);
175
+ }
176
+ [...this.colHeader.find('th')].forEach(addContextAndClickListeners);
177
+ }
178
+ }
179
+ };
180
+ </script>
181
+
182
+ <style lang="postcss" scoped>
183
+ .v-list__tile__title {
184
+ font-size: 0.9rem;
185
+ }
186
+ </style>