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.
- package/README.md +24 -0
- package/dist/demo.html +10 -0
- package/dist/pui9-datatables.common.js +89206 -0
- package/dist/pui9-datatables.common.js.map +1 -0
- package/dist/pui9-datatables.css +5 -0
- package/dist/pui9-datatables.umd.js +89216 -0
- package/dist/pui9-datatables.umd.js.map +1 -0
- package/dist/pui9-datatables.umd.min.js +55 -0
- package/dist/pui9-datatables.umd.min.js.map +1 -0
- package/package-lock.json +15982 -0
- package/package.json +89 -0
- package/src/App.vue +37 -0
- package/src/components/desktop/PuiDatatable.vue +709 -0
- package/src/components/desktop/PuiQuickEditionDatatable.vue +548 -0
- package/src/components/desktop/PuiSimpleDatatable.vue +1498 -0
- package/src/components/desktop/datatables.net-plugins/pagination/input.js +213 -0
- package/src/components/desktop/footer/PuiDatatableFooter.vue +65 -0
- package/src/components/desktop/footer/PuiGridActionFooter.vue +132 -0
- package/src/components/desktop/quickedition/PuiQuickEditionExportBtn.vue +138 -0
- package/src/components/desktop/quickedition/PuiQuickEditionForm.vue +60 -0
- package/src/components/desktop/quickedition/PuiQuickEditionToolbar.vue +144 -0
- package/src/components/desktop/row/PuiGridRowActions.vue +112 -0
- package/src/components/desktop/subdialogs/PuiDatatableColumnMenu.vue +186 -0
- package/src/components/desktop/toolbar/PuiGridToolbar.vue +310 -0
- package/src/components/desktop/toolbar/actions/PuiGridActionListItem.vue +34 -0
- package/src/components/desktop/toolbar/actions/PuiGridActionsBtn.vue +56 -0
- package/src/components/desktop/toolbar/actions/PuiGridActionsDialog.vue +66 -0
- package/src/components/desktop/toolbar/actions/audit/PuiAuditDialog.vue +92 -0
- package/src/components/desktop/toolbar/actions/docgen/PuiDocgenTemplateMatchingsDialog.vue +139 -0
- package/src/components/desktop/toolbar/actions/docgen/PuiDocgenTemplateParametersDialog.vue +317 -0
- package/src/components/desktop/toolbar/actions/importexport/PuiGridExportDialog.vue +187 -0
- package/src/components/desktop/toolbar/actions/importexport/PuiGridImportDialog.vue +421 -0
- package/src/components/desktop/toolbar/export/PuiGridExportBtn.vue +175 -0
- package/src/components/desktop/toolbar/filtercombo/PuiGridFilterCombo.vue +237 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterBtns.vue +163 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterDialog.vue +434 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterGroup.vue +313 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterListBtn.vue +85 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterListDialog.vue +254 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterListItem.vue +192 -0
- package/src/components/desktop/toolbar/filtering/PuiGridFilterRule.vue +517 -0
- package/src/components/desktop/toolbar/grid-configuration/PuiGridConfBtns.vue +99 -0
- package/src/components/desktop/toolbar/grid-configuration/PuiGridConfDialog.vue +640 -0
- package/src/components/desktop/toolbar/grid-configuration/PuiSaveConfigDialog.vue +154 -0
- package/src/components/desktop/toolbar/row/PuiGridCreateBtn.vue +39 -0
- package/src/components/desktop/toolbar/row/PuiGridDeleteBtn.vue +86 -0
- package/src/components/desktop/toolbar/row/PuiGridRefreshBtn.vue +39 -0
- package/src/components/desktop/toolbar/row/PuiGridUpdateBtn.vue +56 -0
- package/src/components/desktop/toolbar/searching/PuiGridSearcher.vue +67 -0
- package/src/components/desktop/toolbar/searching/PuiGridSearcherColumnsList.vue +43 -0
- package/src/components/desktop/toolbar/sorting/PuiGridSortBtn.vue +44 -0
- package/src/components/desktop/toolbar/sorting/PuiGridSortDialog.vue +113 -0
- package/src/components/mobile/PuiDatalist.vue +477 -0
- package/src/components/mobile/PuiSimpleDatalist.vue +313 -0
- package/src/components/mobile/actions/PuiListActionListItem.vue +34 -0
- package/src/components/mobile/actions/PuiListActionsBtn.vue +38 -0
- package/src/components/mobile/actions/PuiListActionsDialog.vue +66 -0
- package/src/components/mobile/footer/PuiListActionFooter.vue +56 -0
- package/src/components/mobile/toolbar/PuiListToolbar.vue +60 -0
- package/src/components/mobile/toolbar/searching/PuiListSearcher.vue +53 -0
- package/src/components/mobile/toolbar/searching/PuiListSearcherColumnsList.vue +43 -0
- package/src/components/mobile/toolbar/sorting/PuiListSortBtn.vue +46 -0
- package/src/components/mobile/toolbar/sorting/PuiListSortDialog.vue +140 -0
- package/src/components/puiaudit/PuiAuditForm.vue +107 -0
- package/src/generalActions.js +135 -0
- package/src/index.js +31 -0
- package/src/main.js +67 -0
- package/src/mixins/PuiActionsBtnMixin.js +287 -0
- package/src/mixins/PuiActionsDialogMixin.js +161 -0
- package/src/mixins/PuiActionsListItemMixin.js +62 -0
- package/src/mixins/PuiDatatablesKeepPage.js +15 -0
- package/src/mixins/PuiGridFormMethodsMixin.js +133 -0
- package/src/mixins/PuiModelConfigurationMixin.js +15 -0
- package/src/mixins/PuiSearcherColumnsListMixin.js +108 -0
- package/src/mixins/PuiSearcherMixin.js +192 -0
- package/src/mixins/PuiSortBtnMixin.js +54 -0
- package/src/mixins/PuiSortDialogMixin.js +256 -0
- package/src/mixins/PuiToolbarBtnMixin.js +66 -0
- package/src/mixins/PuiToolbarDialogMixin.js +12 -0
- package/src/router.js +18 -0
- package/src/tests/PuiContainer.vue +139 -0
- package/src/tests/PuiProfileTestSimpleDatatable.vue +66 -0
- package/src/tests/PuiUserTestCompleteDatatable.vue +126 -0
- package/src/tests/PuiVariableTestQuickEditionDatatable.vue +39 -0
- package/src/tests/PuiVariableTestQuickEditionForm.vue +18 -0
- package/src/tests/modelConfigurations.json +3516 -0
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<pui-list-toolbar v-if="ready" :columns="columns" :modelName="modelName" :showFilterListBtn="showFilterListBtn"></pui-list-toolbar>
|
|
4
|
+
<!-- list actions Master Detail-->
|
|
5
|
+
<v-layout v-if="masterDetail" wrap class="ml-3 mr-2 mb-2" ref="actionsInToolbarDetail">
|
|
6
|
+
<v-flex grow :class="getCompClass">
|
|
7
|
+
<pui-list-actions-btn :modelName="modelName" :actions="actions" insideForm v-if="showActions"></pui-list-actions-btn>
|
|
8
|
+
</v-flex>
|
|
9
|
+
<v-flex shrink class="pui-gridActionsBtn text-center">
|
|
10
|
+
<v-btn
|
|
11
|
+
v-if="showPuiGridCreateBtn"
|
|
12
|
+
:id="`gridlistbtn-create-${modelName}`"
|
|
13
|
+
icon
|
|
14
|
+
class="ml-2 elevation-0 pui-toolbar__actionBtn pui-toolbar__actionBtn--mobile"
|
|
15
|
+
color="primary"
|
|
16
|
+
@click.native="onCreate()"
|
|
17
|
+
>
|
|
18
|
+
<v-icon>far fa-plus-circle</v-icon>
|
|
19
|
+
</v-btn>
|
|
20
|
+
</v-flex>
|
|
21
|
+
</v-layout>
|
|
22
|
+
<pui-simple-datalist
|
|
23
|
+
v-if="ready"
|
|
24
|
+
ref="datalist"
|
|
25
|
+
:modelName="modelName"
|
|
26
|
+
:modelNameSuffix="modelNameSuffix"
|
|
27
|
+
:readOnly="readOnly"
|
|
28
|
+
:navigableDetail="navigableDetail"
|
|
29
|
+
:selectable="showActions"
|
|
30
|
+
:externalFilter="getCurrentFilter()"
|
|
31
|
+
:searchTextColumns="searchTextColumns"
|
|
32
|
+
:sortingRules="sortingRules"
|
|
33
|
+
:parentModelName="parentModelName"
|
|
34
|
+
>
|
|
35
|
+
<template slot="itemContent" slot-scope="{ item }">
|
|
36
|
+
<slot name="itemContent" :item="item" :config="configToShow"></slot>
|
|
37
|
+
</template>
|
|
38
|
+
<template slot="itemAction" slot-scope="{ item }">
|
|
39
|
+
<slot name="itemAction" :item="item" :config="configToShow"></slot>
|
|
40
|
+
</template>
|
|
41
|
+
</pui-simple-datalist>
|
|
42
|
+
<v-btn
|
|
43
|
+
v-if="!masterDetail && showPuiGridCreateBtn"
|
|
44
|
+
:id="`gridlistbtn-create-${modelName}`"
|
|
45
|
+
fixed
|
|
46
|
+
bottom
|
|
47
|
+
right
|
|
48
|
+
fab
|
|
49
|
+
dark
|
|
50
|
+
color="primary"
|
|
51
|
+
class="puiDatalist_createBtn"
|
|
52
|
+
@click.native="onCreate()"
|
|
53
|
+
>
|
|
54
|
+
<v-icon>far fa-plus-circle</v-icon>
|
|
55
|
+
</v-btn>
|
|
56
|
+
<!-- list actions -->
|
|
57
|
+
<v-layout v-if="!masterDetail" wrap :class="getCompClass" ref="actionsInToolbar">
|
|
58
|
+
<v-spacer></v-spacer>
|
|
59
|
+
<pui-list-actions-btn :modelName="modelName" :actions="actions" insideForm v-if="showActions"></pui-list-actions-btn>
|
|
60
|
+
</v-layout>
|
|
61
|
+
<!-- delete registry modal dialog -->
|
|
62
|
+
<pui-modal-dialog
|
|
63
|
+
v-if="showDeleteRegistryDialog"
|
|
64
|
+
:cancelText="$t('form.cancel')"
|
|
65
|
+
:okText="$t('pui9.accept')"
|
|
66
|
+
:titleText="$t('pui9.delete.title')"
|
|
67
|
+
:messageText="$t('pui9.delete.confirm')"
|
|
68
|
+
:dialogName="`deleteRegistry-${this.modelName}`"
|
|
69
|
+
></pui-modal-dialog>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
import $ from 'jquery';
|
|
75
|
+
import PuiModelConfigurationMixin from '../../mixins/PuiModelConfigurationMixin';
|
|
76
|
+
import PuiListToolbar from './toolbar/PuiListToolbar';
|
|
77
|
+
import PuiListActionsBtn from './actions/PuiListActionsBtn';
|
|
78
|
+
import PuiSimpleDatalist from './PuiSimpleDatalist';
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: 'PuiDatalist',
|
|
82
|
+
mixins: [PuiModelConfigurationMixin],
|
|
83
|
+
components: {
|
|
84
|
+
PuiListToolbar,
|
|
85
|
+
PuiListActionsBtn,
|
|
86
|
+
PuiSimpleDatalist
|
|
87
|
+
},
|
|
88
|
+
props: {
|
|
89
|
+
modelName: {
|
|
90
|
+
type: String,
|
|
91
|
+
required: true
|
|
92
|
+
},
|
|
93
|
+
modelNameSuffix: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: ''
|
|
96
|
+
},
|
|
97
|
+
readOnly: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false
|
|
100
|
+
},
|
|
101
|
+
navigableDetail: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: true
|
|
104
|
+
},
|
|
105
|
+
externalFilter: {
|
|
106
|
+
type: Object
|
|
107
|
+
},
|
|
108
|
+
actions: {
|
|
109
|
+
type: Array,
|
|
110
|
+
default: () => {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
showCreateBtn: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: true
|
|
117
|
+
},
|
|
118
|
+
showDeleteBtn: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: true
|
|
121
|
+
},
|
|
122
|
+
showFilterListBtn: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
parentModelName: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: null
|
|
129
|
+
},
|
|
130
|
+
masterDetail: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false
|
|
133
|
+
},
|
|
134
|
+
filterCombo: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: true
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
data() {
|
|
140
|
+
return {
|
|
141
|
+
ready: false,
|
|
142
|
+
model: null,
|
|
143
|
+
columns: [],
|
|
144
|
+
showActions: false,
|
|
145
|
+
searchTextColumns: null,
|
|
146
|
+
sortingRules: null,
|
|
147
|
+
showPuiGridCreateBtn: false,
|
|
148
|
+
showPuiGridDeleteBtn: false,
|
|
149
|
+
showDeleteRegistryDialog: false,
|
|
150
|
+
configToShow: {}
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
computed: {
|
|
154
|
+
getCompClass() {
|
|
155
|
+
return {
|
|
156
|
+
'pui-toolbar': true,
|
|
157
|
+
puiDatalist_actions: !this.masterDetail,
|
|
158
|
+
puiDatalist_actions_detail: this.masterDetail
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
onPuiModelsLoadedAndSaved() {
|
|
162
|
+
return this.$store.state.modelsLoadedAndSaved;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
watch: {
|
|
166
|
+
onPuiModelsLoadedAndSaved() {
|
|
167
|
+
this.model = this.$store.getters.getModelByName(this.modelName);
|
|
168
|
+
this.onReady();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
mounted() {
|
|
172
|
+
this.model = this.$store.getters.getModelByName(this.modelName);
|
|
173
|
+
if (this.model) {
|
|
174
|
+
this.onReady();
|
|
175
|
+
}
|
|
176
|
+
this.subscribeToToolbarEvents();
|
|
177
|
+
this.subscribeDeleteEvents();
|
|
178
|
+
},
|
|
179
|
+
beforeDestroy() {
|
|
180
|
+
$(this.$refs.actionsInToolbar).remove();
|
|
181
|
+
this.showActions = false;
|
|
182
|
+
},
|
|
183
|
+
destroyed() {
|
|
184
|
+
this.unsubscribeToToolbarEvents();
|
|
185
|
+
this.unsubscribeDeleteEvents();
|
|
186
|
+
},
|
|
187
|
+
methods: {
|
|
188
|
+
onReady() {
|
|
189
|
+
if (this.model.functionalities) {
|
|
190
|
+
this.showPuiGridCreateBtn =
|
|
191
|
+
this.showCreateBtn && this.$store.getters.hasFunctionality(this.model.functionalities.insert) && this.readOnly === false;
|
|
192
|
+
this.showPuiGridDeleteBtn =
|
|
193
|
+
this.showDeleteBtn && this.$store.getters.hasFunctionality(this.model.functionalities.delete) && this.readOnly === false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (!this.existDeleteAction() && this.showPuiGridDeleteBtn) {
|
|
197
|
+
var self = this;
|
|
198
|
+
const datalistDeleteAction = {
|
|
199
|
+
id: 'datalistDeleteAction',
|
|
200
|
+
selectionType: 'single',
|
|
201
|
+
label: 'puiaction.deleteregistry',
|
|
202
|
+
functionality: this.model.functionalities.delete,
|
|
203
|
+
checkAvailability: function () {
|
|
204
|
+
return true;
|
|
205
|
+
},
|
|
206
|
+
runAction: function (action, model, registries) {
|
|
207
|
+
this.$store.state.puiDatalistSelectedItem = Object.assign({}, registries[0]);
|
|
208
|
+
this.$puiEvents.$emit(`pui-modalDialog-deleteRegistry-${self.modelName}${self.modelNameSuffix}-show`);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
this.actions.unshift(datalistDeleteAction);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (this.actions.length > 0) {
|
|
215
|
+
if (!this.masterDetail) {
|
|
216
|
+
try {
|
|
217
|
+
const containerHeaderActions = $('.pui-containerHeader')[1];
|
|
218
|
+
containerHeaderActions.append(this.$refs.actionsInToolbar);
|
|
219
|
+
} catch (e) {
|
|
220
|
+
$(this.$refs.actionsInToolbar).remove();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
this.showActions = true;
|
|
224
|
+
} else {
|
|
225
|
+
if (!this.masterDetail) {
|
|
226
|
+
$(this.$refs.actionsInToolbar).remove();
|
|
227
|
+
} else {
|
|
228
|
+
$(this.$refs.actionsInToolbarDetail).remove();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (!this.$store.getters.gridIsInitialized(this.modelName)) {
|
|
233
|
+
this.setColumnsAndGridConfigurationForDatatable(true, false);
|
|
234
|
+
} else {
|
|
235
|
+
// If the grid was created and we are coming back
|
|
236
|
+
this.setColumnsAndGridConfigurationForDatatable(false, true);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
this.ready = true;
|
|
240
|
+
},
|
|
241
|
+
setColumnsAndGridConfigurationForDatatable(loadDefaultConfiguration, loadCurrentConfiguration) {
|
|
242
|
+
this.columns = [];
|
|
243
|
+
|
|
244
|
+
// Get the current configuration
|
|
245
|
+
if (loadCurrentConfiguration) {
|
|
246
|
+
this.gridConfiguration = this.cloneConfiguration(this.$store.getters.getDefaultGridConfiguration(this.modelName));
|
|
247
|
+
} else if (loadDefaultConfiguration) {
|
|
248
|
+
// Or load the default
|
|
249
|
+
const defaultConfig = this.$store.getters.getDefaultGridConfiguration(this.modelName);
|
|
250
|
+
if (defaultConfig) {
|
|
251
|
+
this.$store.commit('puiModelsSetCurrentGridConfiguration', { model: this.modelName, configuration: defaultConfig });
|
|
252
|
+
this.gridConfiguration = this.cloneConfiguration(defaultConfig);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// If there is no configuration (first time in the grid) a new one should be created to work with on runtime
|
|
257
|
+
if (!this.gridConfiguration || this.gridConfiguration === -1) {
|
|
258
|
+
this.gridConfiguration = {
|
|
259
|
+
model: this.modelName,
|
|
260
|
+
usr: this.$store.getters.getUser,
|
|
261
|
+
configuration: {
|
|
262
|
+
grouped: false,
|
|
263
|
+
columnSearch: false
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
this.model.columns.forEach((colObj, index) => {
|
|
267
|
+
if (colObj.visibility !== 'completelyhidden') {
|
|
268
|
+
const columnConfig = {
|
|
269
|
+
order: colObj.order || index,
|
|
270
|
+
title: this.$puiI18n.t(colObj.title),
|
|
271
|
+
name: colObj.name,
|
|
272
|
+
data: colObj.name,
|
|
273
|
+
visible: colObj.visibility === 'visible',
|
|
274
|
+
type: colObj.type,
|
|
275
|
+
orderable: true
|
|
276
|
+
};
|
|
277
|
+
this.columns.push(columnConfig);
|
|
278
|
+
this.setConfigToShow(columnConfig);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
} else {
|
|
282
|
+
this.gridConfiguration = this.cloneConfiguration(this.gridConfiguration);
|
|
283
|
+
this.gridConfiguration.configuration.columns
|
|
284
|
+
.sort((a, b) => {
|
|
285
|
+
return a.order - b.order;
|
|
286
|
+
})
|
|
287
|
+
.forEach((colObj, index) => {
|
|
288
|
+
delete colObj.bVisible;
|
|
289
|
+
colObj.title = this.$puiI18n.t(colObj.title);
|
|
290
|
+
const columnConfig = {
|
|
291
|
+
order: colObj.order || index,
|
|
292
|
+
title: colObj.title,
|
|
293
|
+
name: colObj.name,
|
|
294
|
+
data: colObj.name,
|
|
295
|
+
visible: colObj.visible,
|
|
296
|
+
type: colObj.type,
|
|
297
|
+
orderable: true
|
|
298
|
+
};
|
|
299
|
+
this.columns.push(columnConfig);
|
|
300
|
+
this.setConfigToShow(columnConfig);
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
setConfigToShow(columnConfig) {
|
|
305
|
+
this.configToShow[columnConfig.name] = {
|
|
306
|
+
visible: columnConfig.visible
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
subscribeToToolbarEvents() {
|
|
310
|
+
this.$puiEvents.$on(`onPui-apply-searching-${this.modelName}${this.modelNameSuffix}`, (columnsAndElement) => {
|
|
311
|
+
this.searchTextColumns = JSON.parse(JSON.stringify(columnsAndElement));
|
|
312
|
+
});
|
|
313
|
+
this.$puiEvents.$on(`onPui-apply-sorting-${this.modelName}${this.modelNameSuffix}`, (sortingRules) => {
|
|
314
|
+
this.sortingRules = JSON.parse(JSON.stringify(sortingRules));
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
subscribeDeleteEvents() {
|
|
318
|
+
this.$puiEvents.$on(`pui-modalDialog-deleteRegistry-${this.modelName}${this.modelNameSuffix}-show`, () => {
|
|
319
|
+
this.showDeleteRegistryDialog = true;
|
|
320
|
+
});
|
|
321
|
+
// delete registry modal
|
|
322
|
+
this.$puiEvents.$on(`pui-modalDialog-deleteRegistry-${this.modelName}${this.modelNameSuffix}-ok`, () => {
|
|
323
|
+
this.showDeleteRegistryDialog = false;
|
|
324
|
+
this.onDelete(this.$store.state.puiDatalistSelectedItem);
|
|
325
|
+
this.$store.state.puiDatalistSelectedItem = null;
|
|
326
|
+
});
|
|
327
|
+
this.$puiEvents.$on(`pui-modalDialog-deleteRegistry-${this.modelName}${this.modelNameSuffix}-cancel`, () => {
|
|
328
|
+
this.showDeleteRegistryDialog = false;
|
|
329
|
+
this.$store.state.puiDatalistSelectedItem = null;
|
|
330
|
+
this.$puiEvents.$emit(`onPui-action-running-cancelled-${this.modelName}${this.modelNameSuffix}`);
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
unsubscribeToToolbarEvents() {
|
|
334
|
+
this.$puiEvents.$off(`onPui-apply-searching-${this.modelName}${this.modelNameSuffix}`);
|
|
335
|
+
this.$puiEvents.$off(`onPui-apply-sorting-${this.modelName}${this.modelNameSuffix}`);
|
|
336
|
+
},
|
|
337
|
+
unsubscribeDeleteEvents() {
|
|
338
|
+
this.$puiEvents.$off(`pui-modalDialog-deleteRegistry-${this.modelName}${this.modelNameSuffix}-show`);
|
|
339
|
+
this.$puiEvents.$off(`pui-modalDialog-deleteRegistry-${this.modelName}${this.modelNameSuffix}-ok`);
|
|
340
|
+
this.$puiEvents.$off(`pui-modalDialog-deleteRegistry-${this.modelName}${this.modelNameSuffix}-cancel`);
|
|
341
|
+
},
|
|
342
|
+
getCurrentFilter() {
|
|
343
|
+
const filter = { groupOp: 'and', groups: [], rules: [] };
|
|
344
|
+
if (this.filterCombo) {
|
|
345
|
+
const currentFilterCombo = this.getCurrentFilterCombo();
|
|
346
|
+
if (currentFilterCombo) {
|
|
347
|
+
filter.groups.push(currentFilterCombo);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (this.externalFilter) {
|
|
351
|
+
filter.groups.push(this.externalFilter);
|
|
352
|
+
}
|
|
353
|
+
return filter;
|
|
354
|
+
},
|
|
355
|
+
getCurrentFilterCombo() {
|
|
356
|
+
const filterCombo = this.gridConfiguration && this.gridConfiguration.configuration && this.gridConfiguration.configuration.filterCombo;
|
|
357
|
+
if (!filterCombo) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const gridFilterProperties = [];
|
|
362
|
+
let gridFilterName = null;
|
|
363
|
+
|
|
364
|
+
for (let i = 0, length = filterCombo.length; i < length; i++) {
|
|
365
|
+
if (!Array.isArray(filterCombo[i].local.value)) {
|
|
366
|
+
gridFilterProperties.push(filterCombo[i].local.value);
|
|
367
|
+
} else {
|
|
368
|
+
for (let j = 0; j < filterCombo[i].local.value.length; j++) {
|
|
369
|
+
gridFilterProperties.push(filterCombo[i].local.value[j]);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (!gridFilterName) {
|
|
373
|
+
gridFilterName = filterCombo[i].search.model;
|
|
374
|
+
} else {
|
|
375
|
+
gridFilterName += '_' + filterCombo[i].search.model;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const gridFilterModel = this.$store.getters.getGridFilterComboModelByName(gridFilterName);
|
|
380
|
+
|
|
381
|
+
if (!gridFilterModel) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
this.$store.commit('saveModelNameWithGridFilterComboName', {
|
|
386
|
+
modelName: this.modelName,
|
|
387
|
+
gridFilterComboName: gridFilterName
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
const rules = [];
|
|
391
|
+
for (const property in gridFilterModel) {
|
|
392
|
+
for (let j = 0; j < gridFilterProperties.length; j++) {
|
|
393
|
+
const gridProperty = gridFilterProperties[j];
|
|
394
|
+
if (property === gridProperty) {
|
|
395
|
+
const value = gridFilterModel[property];
|
|
396
|
+
if (value) {
|
|
397
|
+
rules.push({ field: property, op: 'eq', data: value });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (rules.length > 0) {
|
|
404
|
+
return { groups: [], groupOp: 'and', rules: rules };
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
existDeleteAction() {
|
|
408
|
+
for (let index = 0, actionsLength = this.actions.length; index < actionsLength; index++) {
|
|
409
|
+
const action = this.actions[index];
|
|
410
|
+
if (action.id === 'datalistDeleteAction') {
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
|
+
},
|
|
416
|
+
onCreate() {
|
|
417
|
+
this.$refs.datalist.goToItem(null, 'create');
|
|
418
|
+
},
|
|
419
|
+
onDelete(item) {
|
|
420
|
+
const pk = this.$refs.datalist.getPk(item);
|
|
421
|
+
|
|
422
|
+
this.$puiRequests.deleteRequest(
|
|
423
|
+
`/${this.modelName}/delete`,
|
|
424
|
+
null,
|
|
425
|
+
() => {
|
|
426
|
+
this.$puiEvents.$emit(`onPui-action-running-ended-${this.modelName}${this.modelNameSuffix}`);
|
|
427
|
+
this.$puiNotify.success(this.$puiI18n.t('pui9.delete.success'));
|
|
428
|
+
},
|
|
429
|
+
(error) => {
|
|
430
|
+
this.$puiEvents.$emit(`onPui-action-running-ended-${this.modelName}${this.modelNameSuffix}`);
|
|
431
|
+
this.$store.dispatch('puiRequestShowServerError', { error });
|
|
432
|
+
},
|
|
433
|
+
pk
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
</script>
|
|
439
|
+
|
|
440
|
+
<style lang="postcss">
|
|
441
|
+
.puiDatalist_createBtn {
|
|
442
|
+
border-radius: 50% !important;
|
|
443
|
+
bottom: 55px !important;
|
|
444
|
+
}
|
|
445
|
+
.puiDatalist_actions {
|
|
446
|
+
padding-top: 10px;
|
|
447
|
+
padding-right: 8px;
|
|
448
|
+
}
|
|
449
|
+
.puiDatalist_actions_detail {
|
|
450
|
+
& .pui-toolbar__btn {
|
|
451
|
+
width: 100%;
|
|
452
|
+
border: solid 1px var(--N-50) !important;
|
|
453
|
+
min-height: 36px !important;
|
|
454
|
+
border-radius: 3px !important;
|
|
455
|
+
}
|
|
456
|
+
& .pui-toolbar__btn {
|
|
457
|
+
width: 100%;
|
|
458
|
+
border: solid 1px var(--N-50) !important;
|
|
459
|
+
min-height: 36px !important;
|
|
460
|
+
border-radius: 4px !important;
|
|
461
|
+
}
|
|
462
|
+
& .pui-toolbar__btn:not(.pui-toolbar__btn--active) {
|
|
463
|
+
background-color: transparent !important;
|
|
464
|
+
}
|
|
465
|
+
& .v-btn__content {
|
|
466
|
+
justify-content: space-between;
|
|
467
|
+
}
|
|
468
|
+
& .pui-gridActionsDialog--insideForm {
|
|
469
|
+
right: 0px;
|
|
470
|
+
width: 100%;
|
|
471
|
+
min-width: initial;
|
|
472
|
+
& .v-tabs {
|
|
473
|
+
width: 100%;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
</style>
|