@monoui/vuejs 1.1.17 → 1.1.18
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/dist/main.js +4 -4
- package/package.json +1 -1
- package/src/components/Table/Table.vue +111 -78
package/package.json
CHANGED
|
@@ -185,69 +185,73 @@
|
|
|
185
185
|
</div>
|
|
186
186
|
<slot name="pagination-seperator" />
|
|
187
187
|
<slot name="pagination">
|
|
188
|
-
<div class="
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
188
|
+
<div :class="paginationClass">
|
|
189
|
+
<div
|
|
190
|
+
class="d-flex justify-content-between align-items-center mt-2"
|
|
191
|
+
>
|
|
192
|
+
<slot name="pagination-filters">
|
|
193
|
+
<div>
|
|
194
|
+
<div v-show="!isDataEmpty">
|
|
195
|
+
<span>Show</span>
|
|
196
|
+
<b-dropdown
|
|
197
|
+
:text="itemPerPageText"
|
|
198
|
+
class="m-md-2"
|
|
199
|
+
size="sm"
|
|
200
|
+
variant="light"
|
|
201
201
|
>
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
@click="changeItemPerPage(perPage)"
|
|
202
|
+
<template
|
|
203
|
+
v-for="perPage in filteredPerPageValues"
|
|
205
204
|
>
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
v-if="inLimit()"
|
|
219
|
-
@click="
|
|
220
|
-
changeItemPerPage(
|
|
221
|
-
settings.totalItemCount
|
|
222
|
-
)
|
|
205
|
+
<b-dropdown-item
|
|
206
|
+
:key="'per-page-' + perPage"
|
|
207
|
+
@click="changeItemPerPage(perPage)"
|
|
208
|
+
>
|
|
209
|
+
{{ perPage }}
|
|
210
|
+
</b-dropdown-item>
|
|
211
|
+
</template>
|
|
212
|
+
<b-dropdown-divider
|
|
213
|
+
v-if="
|
|
214
|
+
filteredPerPageValues &&
|
|
215
|
+
filteredPerPageValues.length &&
|
|
216
|
+
inLimit()
|
|
223
217
|
"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
218
|
+
/>
|
|
219
|
+
<template>
|
|
220
|
+
<b-dropdown-item
|
|
221
|
+
v-if="inLimit()"
|
|
222
|
+
@click="
|
|
223
|
+
changeItemPerPage(
|
|
224
|
+
settings.totalItemCount
|
|
225
|
+
)
|
|
226
|
+
"
|
|
227
|
+
>
|
|
228
|
+
All ({{ settings.totalItemCount }})
|
|
229
|
+
</b-dropdown-item>
|
|
230
|
+
</template>
|
|
231
|
+
</b-dropdown>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</slot>
|
|
235
|
+
<slot name="pagination-center" v-bind="settings">
|
|
236
|
+
<div>
|
|
237
|
+
<span v-show="!isDataEmpty">
|
|
238
|
+
{{ settings.totalItemCount }} rows
|
|
239
|
+
</span>
|
|
229
240
|
</div>
|
|
230
|
-
</
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
:total-rows="settings.totalItemCount"
|
|
245
|
-
:per-page="settings.itemPerPage"
|
|
246
|
-
@change="changePage"
|
|
247
|
-
v-bind="pagination"
|
|
248
|
-
/>
|
|
249
|
-
</div>
|
|
250
|
-
</slot>
|
|
241
|
+
</slot>
|
|
242
|
+
<slot name="pagination-buttons">
|
|
243
|
+
<div>
|
|
244
|
+
<b-pagination
|
|
245
|
+
v-if="settings.pageCount > 1"
|
|
246
|
+
v-model="settings.currentPage"
|
|
247
|
+
:total-rows="settings.totalItemCount"
|
|
248
|
+
:per-page="settings.itemPerPage"
|
|
249
|
+
@change="changePage"
|
|
250
|
+
v-bind="pagination"
|
|
251
|
+
/>
|
|
252
|
+
</div>
|
|
253
|
+
</slot>
|
|
254
|
+
</div>
|
|
251
255
|
</div>
|
|
252
256
|
</slot>
|
|
253
257
|
<slot name="footer" />
|
|
@@ -408,6 +412,11 @@ export default {
|
|
|
408
412
|
type: Number,
|
|
409
413
|
required: false,
|
|
410
414
|
default: 300
|
|
415
|
+
},
|
|
416
|
+
paginationClass: {
|
|
417
|
+
type: String,
|
|
418
|
+
required: false,
|
|
419
|
+
default: ""
|
|
411
420
|
}
|
|
412
421
|
},
|
|
413
422
|
watch: {
|
|
@@ -417,6 +426,12 @@ export default {
|
|
|
417
426
|
},
|
|
418
427
|
data() {
|
|
419
428
|
return {
|
|
429
|
+
defaultSettings: {
|
|
430
|
+
currentPage: 1,
|
|
431
|
+
pageCount: 0,
|
|
432
|
+
itemPerPage: 10,
|
|
433
|
+
totalItemCount: 0
|
|
434
|
+
},
|
|
420
435
|
settings: {
|
|
421
436
|
currentPage: 1,
|
|
422
437
|
pageCount: 0,
|
|
@@ -451,27 +466,45 @@ export default {
|
|
|
451
466
|
return this.settings.totalItemCount <= 0;
|
|
452
467
|
}
|
|
453
468
|
},
|
|
469
|
+
created() {
|
|
470
|
+
this.addPopStateListener();
|
|
471
|
+
},
|
|
454
472
|
async mounted() {
|
|
455
|
-
this.
|
|
456
|
-
"page",
|
|
457
|
-
this.settings.currentPage
|
|
458
|
-
);
|
|
459
|
-
this.settings.itemPerPage = this.getHistoryParameter(
|
|
460
|
-
"limit",
|
|
461
|
-
this.settings.itemPerPage
|
|
462
|
-
);
|
|
463
|
-
if (this.searchColumn) {
|
|
464
|
-
this.searchWord = this.getHistoryParameter(
|
|
465
|
-
`f-${this.searchColumn}`,
|
|
466
|
-
this.searchWord
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
this.loadHistoryFilters();
|
|
470
|
-
this.loadHistorySorting();
|
|
473
|
+
this.loadHistory();
|
|
471
474
|
if (this.autoLoad) await this.getValues();
|
|
472
475
|
},
|
|
473
|
-
created() {},
|
|
474
476
|
methods: {
|
|
477
|
+
addPopStateListener() {
|
|
478
|
+
window.addEventListener("popstate", this.popStateEvent);
|
|
479
|
+
},
|
|
480
|
+
removePopStateListener() {
|
|
481
|
+
window.removeEventListener("popstate", this.popStateEvent);
|
|
482
|
+
},
|
|
483
|
+
async popStateEvent() {
|
|
484
|
+
this.loadHistory();
|
|
485
|
+
await this.getValues(false);
|
|
486
|
+
},
|
|
487
|
+
loadHistory() {
|
|
488
|
+
this.settings.currentPage = this.getHistoryParameter(
|
|
489
|
+
"page",
|
|
490
|
+
this.defaultSettings.currentPage
|
|
491
|
+
);
|
|
492
|
+
this.settings.itemPerPage = this.getHistoryParameter(
|
|
493
|
+
"limit",
|
|
494
|
+
this.defaultSettings.itemPerPage
|
|
495
|
+
);
|
|
496
|
+
if (this.searchColumn) {
|
|
497
|
+
this.searchWord = this.getHistoryParameter(
|
|
498
|
+
`f-${this.searchColumn}`,
|
|
499
|
+
this.searchWord
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
this.loadHistoryFilters();
|
|
503
|
+
this.loadHistorySorting();
|
|
504
|
+
// console.log("loadHistory:settings", this.settings);
|
|
505
|
+
// console.log("loadHistory:filters", this.filters);
|
|
506
|
+
// console.log("loadHistory:sorting", this.sorting);
|
|
507
|
+
},
|
|
475
508
|
sortableIcon(column) {
|
|
476
509
|
const currentSort = this.sorting.find(x => x.Column === column);
|
|
477
510
|
if (!currentSort) {
|
|
@@ -824,13 +857,13 @@ export default {
|
|
|
824
857
|
},
|
|
825
858
|
addHistoryParameter(name, value, storage = this.historyStorage) {
|
|
826
859
|
if (!this.history || !name || !storage) return;
|
|
827
|
-
|
|
860
|
+
// console.log("addHistoryParameter", name, value, storage);
|
|
828
861
|
try {
|
|
829
862
|
if (storage === "query") {
|
|
830
863
|
const url = new URL(window.location);
|
|
831
864
|
const historyName = this.getHistoryName(name);
|
|
832
865
|
url.searchParams.set(historyName, value);
|
|
833
|
-
window.history.pushState(
|
|
866
|
+
window.history.pushState(null, "", url);
|
|
834
867
|
return;
|
|
835
868
|
}
|
|
836
869
|
|