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,313 @@
1
+ <template>
2
+ <div>
3
+ <span class="pl-3">{{ totalRecordsComp }}</span>
4
+ <v-divider></v-divider>
5
+ <v-list three-line :style="listStyleComp" class="overflow-y-auto">
6
+ <template v-for="(item, index) in theItems">
7
+ <v-list-item :key="index">
8
+ <v-list-item-action class="puiDatalist_itemSelected" v-if="selectable">
9
+ <v-checkbox color="primary" v-model="selectedItems" :value="item" :disabled="disabledItems[index].disabled"></v-checkbox>
10
+ </v-list-item-action>
11
+ <v-list-item-content @click="showItem(item)">
12
+ <slot name="itemContent" :item="item"></slot>
13
+ </v-list-item-content>
14
+ <v-list-item-action>
15
+ <slot name="itemAction" :item="item"></slot>
16
+ </v-list-item-action>
17
+ </v-list-item>
18
+ <v-divider v-if="index + 1 < theItems.length" :key="`divider_${index}`"></v-divider>
19
+ </template>
20
+ <infinite-loading ref="infiniteLoading" @infinite="getItemsFromPuiList"></infinite-loading>
21
+ </v-list>
22
+ <pui-list-action-footer
23
+ v-show="actionFooter"
24
+ :action="actionRunning"
25
+ :registries="selectedItems"
26
+ :modelName="modelName"
27
+ ></pui-list-action-footer>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import PuiListActionFooter from './footer/PuiListActionFooter';
33
+
34
+ export default {
35
+ name: 'PuiSimpleDatalist',
36
+ components: { PuiListActionFooter },
37
+ props: {
38
+ modelName: {
39
+ type: String,
40
+ required: true
41
+ },
42
+ modelNameSuffix: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+ readOnly: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ navigableDetail: {
51
+ type: Boolean,
52
+ default: true
53
+ },
54
+ selectable: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ externalFilter: {
59
+ type: Object
60
+ },
61
+ searchTextColumns: {
62
+ type: Array
63
+ },
64
+ sortingRules: {
65
+ type: Array
66
+ },
67
+ parentModelName: {
68
+ type: String,
69
+ default: null
70
+ }
71
+ },
72
+ data() {
73
+ return {
74
+ internalModel: null,
75
+ internalController: null,
76
+ page: 0,
77
+ rows: 20,
78
+ totalRecords: 0,
79
+ theItems: [],
80
+ selectedItems: [],
81
+ disabledItems: [],
82
+ singleSelection: true,
83
+ actionFooter: false,
84
+ actionRunning: null
85
+ };
86
+ },
87
+ computed: {
88
+ listStyleComp() {
89
+ // header = 60; toolbar = 70; footer = 50;
90
+ const maxHeight = window.innerHeight - 60 - 70 - 50;
91
+ return `max-height: ${maxHeight}px`;
92
+ },
93
+ totalRecordsComp() {
94
+ return this.totalRecords + ' ' + this.$t('puidatatables.totalRecords');
95
+ }
96
+ },
97
+ watch: {
98
+ searchTextColumns() {
99
+ this.refreshDatalist();
100
+ },
101
+ sortingRules() {
102
+ this.refreshDatalist();
103
+ },
104
+ selectedItems() {
105
+ if (this.singleSelection && this.selectedItems.length > 1) {
106
+ this.selectedItems.shift();
107
+ }
108
+
109
+ const selectedRows = [];
110
+ if (this.selectedItems.length > 0) {
111
+ selectedRows.push({ not_used_property: this.selectedItems[0] });
112
+ }
113
+ this.$puiEvents.$emit(`onPui-selectItem-dataTable-${this.modelName}`, selectedRows);
114
+ }
115
+ },
116
+ created() {
117
+ this.internalModel = this.$store.getters.getModelByName(this.modelName);
118
+ this.internalController = this.internalModel.url.list;
119
+ this.hasReadFunctionality = this.$store.getters.hasFunctionality(this.internalModel.functionalities.get);
120
+ this.hasUpdateFunctionality = this.$store.getters.hasFunctionality(this.internalModel.functionalities.update);
121
+ this.subscribeToActionsEvents();
122
+ },
123
+ destroyed() {
124
+ this.$puiEvents.$off(`onPui-action-before-running-${this.modelName}${this.modelNameSuffix}`);
125
+ this.$puiEvents.$off(`onPui-action-running-${this.modelName}${this.modelNameSuffix}`);
126
+ this.$puiEvents.$off(`onPui-action-running-ended-${this.modelName}${this.modelNameSuffix}`);
127
+ this.$puiEvents.$off(`onPui-action-running-cancelled-${this.modelName}${this.modelNameSuffix}`);
128
+ },
129
+ methods: {
130
+ getItemsFromPuiList($state) {
131
+ this.page++;
132
+ const loadItems = response => {
133
+ if (response && response.data) {
134
+ this.totalRecords = response.data.totalRecords;
135
+ response.data.data.forEach(() => {
136
+ this.disabledItems.push({ disabled: false });
137
+ });
138
+ this.theItems.push(...response.data.data);
139
+ if (this.actionRunning && this.actionRunning.selectionType === 'multiple') {
140
+ this.applyDisableItemsByAction();
141
+ }
142
+ $state.loaded();
143
+ if (response.data.totalPages <= this.page) {
144
+ $state.complete();
145
+ }
146
+ }
147
+ };
148
+ const bodyRequest = this.getBodyRequest();
149
+ this.postRequest(bodyRequest, loadItems);
150
+ },
151
+ postRequest(body, successCallback) {
152
+ this.$puiRequests.postRequest(this.internalController, body, successCallback, error => {
153
+ console.log(error);
154
+ });
155
+ },
156
+ getBodyRequest() {
157
+ const paginateItemsParams = {
158
+ model: this.modelName,
159
+ page: this.page,
160
+ rows: this.rows,
161
+ filter: this.createFilter()
162
+ };
163
+
164
+ const searchOrder = this.createOrder();
165
+ if (searchOrder) {
166
+ paginateItemsParams.order = searchOrder;
167
+ }
168
+ const searchText = this.createQueryText();
169
+ if (searchText) {
170
+ paginateItemsParams.queryText = searchText;
171
+ }
172
+ const searchFields = this.createQueryFields();
173
+ if (searchFields.length > 0) {
174
+ paginateItemsParams.queryFields = searchFields;
175
+ }
176
+
177
+ return paginateItemsParams;
178
+ },
179
+ createFilter() {
180
+ return this.externalFilter;
181
+ },
182
+ createOrder() {
183
+ return this.sortingRules;
184
+ },
185
+ createQueryText() {
186
+ if (!this.searchTextColumns) {
187
+ return null;
188
+ }
189
+ return this.searchTextColumns[0];
190
+ },
191
+ createQueryFields() {
192
+ if (!this.searchTextColumns) {
193
+ return [];
194
+ }
195
+ const queryFields = [];
196
+ const searchColumns = this.searchTextColumns[1];
197
+ searchColumns.forEach(column => {
198
+ if (column.checked === true) {
199
+ queryFields.push(column.name);
200
+ }
201
+ });
202
+ return queryFields;
203
+ },
204
+ showItem(item) {
205
+ if (this.navigableDetail) {
206
+ if (this.readOnly) {
207
+ this.goToItem(item, 'read');
208
+ } else if (this.hasUpdateFunctionality) {
209
+ this.goToItem(item, 'update');
210
+ } else if (this.hasReadFunctionality) {
211
+ this.goToItem(item, 'read');
212
+ }
213
+ }
214
+ },
215
+ goToItem(item, method) {
216
+ const pk = this.getPk(item);
217
+ const pkStr = JSON.stringify(pk);
218
+ const pkB64 = this.$puiUtils.utf8ToB64(pkStr);
219
+ if (this.parentModelName) {
220
+ this.$puiEvents.$emit(`onPuiGotoTableDetail-${this.parentModelName}`);
221
+ }
222
+ const params = {
223
+ router: this.$router,
224
+ url: `${this.modelName}/${method}/${pkB64}/`,
225
+ params: null,
226
+ query: {}
227
+ };
228
+ this.$store.dispatch('puiRouterGoToUrl', params);
229
+ },
230
+ getPk(item) {
231
+ const pk = {};
232
+ if (item != null) {
233
+ for (var index in this.internalModel.columns) {
234
+ const column = this.internalModel.columns[index];
235
+ if (column.isPk) {
236
+ pk[column.name] = item[column.name];
237
+ }
238
+ }
239
+ }
240
+ return pk;
241
+ },
242
+ subscribeToActionsEvents() {
243
+ this.$puiEvents.$on(`onPui-action-before-running-${this.modelName}${this.modelNameSuffix}`, obj => {
244
+ this.actionRunning = obj.action;
245
+ if (this.actionRunning.selectionType === 'multiple') {
246
+ this.actionFooter = true;
247
+ this.singleSelection = false;
248
+ this.selectedItems = [];
249
+ this.applyDisableItemsByAction();
250
+ } else if (this.selectedItems.length > 0 || this.actionRunning.selectionType === 'general') {
251
+ // Run action
252
+ this.actionFooter = false;
253
+ if (this.actionRunning.selectionType === 'single') {
254
+ this.internalModel.selectedRows = this.selectedItems;
255
+ }
256
+ this.actionRunning.runAction.call(this, this.actionRunning, this.internalModel, this.selectedItems);
257
+ }
258
+ });
259
+ this.$puiEvents.$on(`onPui-action-running-${this.modelName}${this.modelNameSuffix}`, () => {
260
+ this.actionFooter = false;
261
+ });
262
+ this.$puiEvents.$on(`onPui-action-running-ended-${this.modelName}${this.modelNameSuffix}`, () => {
263
+ if (this.actionRunning && this.actionRunning.selectionType === 'multiple') {
264
+ this.singleSelection = true;
265
+ this.selectedItems = [];
266
+ this.applyEnableItemsByAction();
267
+ }
268
+ this.actionFooter = false;
269
+ this.actionRunning = null;
270
+ this.refreshDatalist();
271
+ });
272
+ this.$puiEvents.$on(`onPui-action-running-cancelled-${this.modelName}${this.modelNameSuffix}`, () => {
273
+ if (this.actionRunning.selectionType === 'multiple') {
274
+ this.singleSelection = true;
275
+ this.selectedItems = [];
276
+ this.applyEnableItemsByAction();
277
+ }
278
+ this.actionFooter = false;
279
+ this.actionRunning = null;
280
+ });
281
+ },
282
+ applyDisableItemsByAction() {
283
+ for (let index = 0, itemsLength = this.theItems.length; index < itemsLength; index++) {
284
+ const item = this.theItems[index];
285
+ const itemValid = this.actionRunning.checkAvailability.call(this, item);
286
+ this.disabledItems[index].disabled = !itemValid;
287
+ }
288
+ },
289
+ applyEnableItemsByAction() {
290
+ for (let index = 0, itemsLength = this.theItems.length; index < itemsLength; index++) {
291
+ this.disabledItems[index].disabled = false;
292
+ }
293
+ },
294
+ refreshDatalist() {
295
+ this.page = 0;
296
+ this.totalRecords = 0;
297
+ this.theItems = [];
298
+ this.disabledItems = [];
299
+ this.$refs.infiniteLoading.stateChanger.reset();
300
+ }
301
+ }
302
+ };
303
+ </script>
304
+
305
+ <style>
306
+ .puiDatalist_itemSelected {
307
+ min-width: 30px;
308
+ }
309
+ .puiDatalist_subtitle {
310
+ white-space: nowrap !important;
311
+ display: list-item !important;
312
+ }
313
+ </style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <v-layout :id="getUniqueID" ref="theItem" wrap class="puiGridActionListItem mb-1 mt-1" :class="getCompClass" @click="selectItem()">
3
+ <v-flex xs12>
4
+ <span class="puiGridActionListItem__titleicon" v-if="isSingleAction">
5
+ <v-icon class="puiGridActionListItem__icon">far fa-bolt</v-icon>
6
+ </span>
7
+ <span class="puiGridActionListItem__titleicon" v-if="isMultipleAction">
8
+ <v-icon class="puiGridActionListItem__icon">fas fa-bolt</v-icon>
9
+ </span>
10
+ <span class="puiGridActionListItem__titleicon" v-if="isGeneralAction">
11
+ <v-icon class="puiGridActionListItem__icon">far fa-asterisk</v-icon>
12
+ </span>
13
+ <span class="puiGridActionListItem__title">{{ getTranslatedLabel }}</span>
14
+ <span class="puiGridActionListItem__titleicon__favorite" v-if="isFavoriteAction" @click.stop="unsetFavorite()">
15
+ <v-icon class="puiGridActionListItem__icon">fas fa-star</v-icon>
16
+ </span>
17
+ <span class="puiGridActionListItem__titleicon__nofavorite" v-else @click.stop="setFavorite()">
18
+ <v-icon class="puiGridActionListItem__icon">far fa-star</v-icon>
19
+ </span>
20
+ <span class="puiGridActionListItem__titleicon__lock" v-show="isLockedAction">
21
+ <v-icon class="puiGridActionListItem__icon">fas fa-lock</v-icon>
22
+ </span>
23
+ </v-flex>
24
+ </v-layout>
25
+ </template>
26
+
27
+ <script>
28
+ import PuiActionsListItemMixin from '../../../mixins/PuiActionsListItemMixin';
29
+
30
+ export default {
31
+ name: 'puilistactionlistitem',
32
+ mixins: [PuiActionsListItemMixin]
33
+ };
34
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div class="pui-gridActionsBtn">
3
+ <v-btn
4
+ :id="`gridlistbtn-actions-${modelName}`"
5
+ class="elevation-0 pui-toolbar__btn ml-0"
6
+ :class="compClass"
7
+ @click.native.stop="showSubPanel"
8
+ >
9
+ <span>{{ $t('puidatatables.actions') }}</span>
10
+ <span class="ml-2">
11
+ <v-icon v-if="!states.active" small>fa fa-angle-down</v-icon>
12
+ <v-icon v-else small>fa fa-angle-up</v-icon>
13
+ </span>
14
+ </v-btn>
15
+ <label v-if="label">{{ label }}</label>
16
+ <puilistactionsdialog
17
+ :modelName="modelName"
18
+ :actions="internalActions"
19
+ :position="panel.position"
20
+ v-show="states.active"
21
+ :visibility="states.active"
22
+ :insideForm="insideForm"
23
+ ></puilistactionsdialog>
24
+ </div>
25
+ </template>
26
+
27
+ <script>
28
+ import PuiActionsBtnMixin from '../../../mixins/PuiActionsBtnMixin';
29
+ import PuiListActionsDialog from './PuiListActionsDialog';
30
+
31
+ export default {
32
+ name: 'puilistactionsbtn',
33
+ mixins: [PuiActionsBtnMixin],
34
+ components: {
35
+ puilistactionsdialog: PuiListActionsDialog
36
+ }
37
+ };
38
+ </script>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div class="pui-gridActionsDialog" :class="{ 'pui-gridActionsDialog--insideForm': insideForm }" :ref="'dialog'" @click.stop>
3
+ <v-layout wrap class="mb-1">
4
+ <v-tabs centered grow v-model="tabActive" slider-color="primary" ref="tabs">
5
+ <v-tab href="#tab1" ref="tab1">{{ $t('puidatatables.all') }}</v-tab>
6
+ <v-tab href="#tab2" ref="tab2">{{ $t('puidatatables.favorites') }}</v-tab>
7
+
8
+ <v-tab-item value="tab1" class="mt-2">
9
+ <pui-text-field
10
+ id="searchFilter3"
11
+ class="ma-1 mr-2 ml-2"
12
+ :placeholder="getPlaceholder"
13
+ v-model="searchAll"
14
+ clearable
15
+ prepend-inner-icon="far fa-search"
16
+ noeditable
17
+ realtime
18
+ ></pui-text-field>
19
+ <div>
20
+ <puilistactionlistitem
21
+ v-for="action in filteredActionsAll"
22
+ :key="action.id"
23
+ :action="action"
24
+ :modelName="modelName"
25
+ :ref="`simple-${action.id}`"
26
+ ></puilistactionlistitem>
27
+ </div>
28
+ </v-tab-item>
29
+ <v-tab-item value="tab2" class="mt-2">
30
+ <pui-text-field
31
+ id="searchFilter4"
32
+ class="ma-1 mr-2 ml-2"
33
+ :placeholder="getPlaceholder"
34
+ v-model="searchFav"
35
+ clearable
36
+ prepend-inner-icon="far fa-search"
37
+ noeditable
38
+ realtime
39
+ ></pui-text-field>
40
+ <div>
41
+ <puilistactionlistitem
42
+ v-for="action in filteredActionsFavorites"
43
+ :key="action.id"
44
+ :action="action"
45
+ :modelName="modelName"
46
+ :ref="`favorites-${action.id}`"
47
+ ></puilistactionlistitem>
48
+ </div>
49
+ </v-tab-item>
50
+ </v-tabs>
51
+ </v-layout>
52
+ </div>
53
+ </template>
54
+
55
+ <script>
56
+ import PuiActionsDialogMixin from '../../../mixins/PuiActionsDialogMixin';
57
+ import PuiListActionListItem from './PuiListActionListItem';
58
+
59
+ export default {
60
+ name: 'puilistactionsdialog',
61
+ mixins: [PuiActionsDialogMixin],
62
+ components: {
63
+ puilistactionlistitem: PuiListActionListItem
64
+ }
65
+ };
66
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="pui-listActionFooter">
3
+ <v-layout justify-space-between>
4
+ <v-btn text outlined @click.native="back()">{{ this.$t('form.cancel') }}</v-btn>
5
+ <v-btn :disabled="isDisabled" depressed color="secondary" class="elevation-0" @click.native="runAction()">{{
6
+ this.$t('puidatatables.applyAction')
7
+ }}</v-btn>
8
+ </v-layout>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: 'PuiListActionFooter',
15
+ props: {
16
+ modelName: {
17
+ type: String,
18
+ required: true
19
+ },
20
+ action: {
21
+ type: Object
22
+ },
23
+ registries: {
24
+ type: Array
25
+ }
26
+ },
27
+ computed: {
28
+ isDisabled() {
29
+ if (this.registries && this.registries.length > 0) {
30
+ return false;
31
+ }
32
+ return true;
33
+ }
34
+ },
35
+ methods: {
36
+ runAction() {
37
+ this.$puiEvents.$emit(`onPui-action-running-${this.modelName}`);
38
+ const model = this.$store.getters.getModelByName(this.modelName);
39
+ this.action.runAction.call(this, this.action, model, this.registries);
40
+ },
41
+ back() {
42
+ this.$puiEvents.$emit(`onPui-action-running-cancelled-${this.modelName}`);
43
+ }
44
+ }
45
+ };
46
+ </script>
47
+
48
+ <style lang="postcss" scoped>
49
+ .pui-listActionFooter {
50
+ position: fixed;
51
+ background-color: var(--N-0);
52
+ bottom: 0px;
53
+ width: 100%;
54
+ z-index: 100;
55
+ }
56
+ </style>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="pt-2 pb-2">
3
+ <v-layout class="pui-toolbar">
4
+ <pui-list-searcher :columns="configColumns" :modelName="modelName"></pui-list-searcher>
5
+ <pui-list-sort-btn :columns="configColumns" :modelName="modelName"></pui-list-sort-btn>
6
+ <pui-grid-filter-list-btn ref="filterListBtn" v-if="showFilterListBtn" :modelName="modelName"></pui-grid-filter-list-btn>
7
+ </v-layout>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ import PuiListSearcher from './searching/PuiListSearcher';
13
+ import PuiListSortBtn from './sorting/PuiListSortBtn';
14
+ import PuiGridFilterListBtn from '../../desktop/toolbar/filtering/PuiGridFilterListBtn';
15
+
16
+ export default {
17
+ name: 'PuiListToolbar',
18
+ components: { PuiListSearcher, PuiListSortBtn, PuiGridFilterListBtn },
19
+ props: {
20
+ columns: {
21
+ type: Array,
22
+ required: true
23
+ },
24
+ modelName: {
25
+ type: String,
26
+ required: true
27
+ },
28
+ showFilterListBtn: {
29
+ type: Boolean,
30
+ default: true
31
+ }
32
+ },
33
+ data() {
34
+ return {
35
+ configColumns: null
36
+ };
37
+ },
38
+ created() {
39
+ this.splitColumns();
40
+ },
41
+ methods: {
42
+ splitColumns() {
43
+ //las columnas que se pueden ver, y por tanto son configurables
44
+ this.configColumns = this.columns
45
+ .filter((column) => {
46
+ return column.completelyhidden !== true;
47
+ })
48
+ .sort(function (a, b) {
49
+ if (a.name > b.name) {
50
+ return 1;
51
+ }
52
+ if (a.name < b.name) {
53
+ return -1;
54
+ }
55
+ return 0;
56
+ });
57
+ }
58
+ }
59
+ };
60
+ </script>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="puiListSearcher" :class="compClass" @click.stop>
3
+ <div class="v-btn__content puiListSearcher__icon" @click="goDialog()" :title="getTitle">
4
+ <v-icon style="font-size: 1.2rem" small :class="compIconClass">fa fa-search</v-icon>
5
+ <v-icon v-if="!active" style="font-size: 0.75rem" :class="compIconClass">fa fa-sm fa-caret-down</v-icon>
6
+ <v-icon v-else style="font-size: 0.75rem" :class="compIconClass">fa fa-sm fa-caret-up</v-icon>
7
+ </div>
8
+ <v-text-field
9
+ id="puilistsearcherinput"
10
+ @focus="hideDialog()"
11
+ v-model="input.searchingText"
12
+ class="puiListSearcher__textInput"
13
+ hide-details
14
+ single-line
15
+ solo
16
+ outlined
17
+ flat
18
+ :placeholder="getPlaceholder"
19
+ @keyup="goSearch"
20
+ @click:clear="goClearSearch"
21
+ ></v-text-field>
22
+ <pui-list-searcher-columns-list
23
+ v-show="active"
24
+ :position="panel.position"
25
+ :modelName="modelName"
26
+ ref="searchdialog"
27
+ ></pui-list-searcher-columns-list>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import PuiSearcherMixin from '../../../../mixins/PuiSearcherMixin';
33
+ import PuiListSearcherColumnsList from './PuiListSearcherColumnsList';
34
+
35
+ export default {
36
+ name: 'PuiListSearcher',
37
+ mixins: [PuiSearcherMixin],
38
+ components: {
39
+ PuiListSearcherColumnsList
40
+ },
41
+ data() {
42
+ return {
43
+ idTool: 'listsearcher'
44
+ };
45
+ }
46
+ };
47
+ </script>
48
+
49
+ <style>
50
+ .puiListSearcher .v-input__control {
51
+ max-height: 36px !important;
52
+ }
53
+ </style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <v-card flat class="puiSearcherColumnsList pl-3 pr-3 pt-1 pb-1 elevation-5" :style="compStyle" :ref="'dialog'" @click.stop>
3
+ <v-layout class="mt-1">
4
+ <v-flex xs8 class="puiSearcherColumnsList__textSwitch">{{ $t('puidatatables.searchAll') }}</v-flex>
5
+ <v-flex xs2>
6
+ <pui-switch label v-model="searchAll"></pui-switch>
7
+ </v-flex>
8
+ </v-layout>
9
+ <v-layout>
10
+ <v-flex xs12>{{ $t('puidatatables.columns') }}</v-flex>
11
+ </v-layout>
12
+ <v-layout class="mt-2" :style="compStyleMaxHeight">
13
+ <v-flex xs12>
14
+ <pui-checkbox
15
+ v-for="column in checkColumns"
16
+ :key="column.title"
17
+ :label="column.title"
18
+ :disabled="searchAll"
19
+ v-model="column.checked"
20
+ ></pui-checkbox>
21
+ </v-flex>
22
+ </v-layout>
23
+ </v-card>
24
+ </template>
25
+
26
+ <script>
27
+ import PuiSearcherColumnsListMixin from '../../../../mixins/PuiSearcherColumnsListMixin';
28
+
29
+ export default {
30
+ name: 'PuiListSearcherColumnsList',
31
+ mixins: [PuiSearcherColumnsListMixin],
32
+ computed: {
33
+ // Override mixin
34
+ compStyle() {
35
+ var style = {
36
+ top: this.position.top + 'px',
37
+ left: '36px'
38
+ };
39
+ return style;
40
+ }
41
+ }
42
+ };
43
+ </script>