@hostlink/nuxt-light 0.0.67 → 0.0.68
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/module.json +1 -1
- package/dist/runtime/components/l-table.vue +39 -44
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -49,23 +49,25 @@ const props = defineProps({
|
|
|
49
49
|
selection: {
|
|
50
50
|
type: String,
|
|
51
51
|
default: "none"
|
|
52
|
+
},
|
|
53
|
+
rowsPerPageOptions: {
|
|
54
|
+
type: Array,
|
|
55
|
+
default: () => [3, 5, 7, 10, 15, 20, 25, 50, 0]
|
|
56
|
+
}, pagination: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => {
|
|
59
|
+
return {
|
|
60
|
+
sortBy: "",
|
|
61
|
+
descending: true,
|
|
62
|
+
page: 1,
|
|
63
|
+
rowsPerPage: 10,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
52
66
|
}
|
|
53
67
|
})
|
|
54
68
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const pagination = ref({
|
|
58
|
-
sortBy: "",
|
|
59
|
-
descending: true,
|
|
60
|
-
page: 1,
|
|
61
|
-
rowsPerPage: 10,
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (props.rows == undefined) {
|
|
66
|
-
console.log(props.rows);
|
|
67
|
-
//server side
|
|
68
|
-
//pagination.value.rowsNumber = 0;
|
|
69
|
+
if (props.rowsPerPageOptions[0] == 0) {
|
|
70
|
+
props.pagination.rowsPerPage = 0;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
//apply all aligns to the columns
|
|
@@ -122,8 +124,8 @@ if (props.actions.length > 0) {
|
|
|
122
124
|
|
|
123
125
|
if (props.sortBy) {
|
|
124
126
|
let [sortBy, descending] = props.sortBy.split(":");
|
|
125
|
-
pagination.
|
|
126
|
-
pagination.
|
|
127
|
+
props.pagination.sortBy = sortBy;
|
|
128
|
+
props.pagination.descending = descending == "desc";
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
const hasSearch = computed(() => {
|
|
@@ -277,11 +279,11 @@ const onRequest = async (p: any) => {
|
|
|
277
279
|
modelName.value = allData.meta.name;
|
|
278
280
|
|
|
279
281
|
|
|
280
|
-
pagination.
|
|
281
|
-
pagination.
|
|
282
|
-
pagination.
|
|
283
|
-
pagination.
|
|
284
|
-
pagination.
|
|
282
|
+
props.pagination.rowsPerPage = p.pagination.rowsPerPage;
|
|
283
|
+
props.pagination.page = p.pagination.page;
|
|
284
|
+
props.pagination.sortBy = p.pagination.sortBy;
|
|
285
|
+
props.pagination.descending = p.pagination.descending;
|
|
286
|
+
props.pagination.rowsNumber = allData.meta.total;
|
|
285
287
|
loading.value = false;
|
|
286
288
|
validateData()
|
|
287
289
|
|
|
@@ -324,9 +326,9 @@ const onFilters = () => {
|
|
|
324
326
|
onRequest({
|
|
325
327
|
pagination: {
|
|
326
328
|
page: 1,
|
|
327
|
-
rowsPerPage: pagination.
|
|
328
|
-
sortBy: pagination.
|
|
329
|
-
descending: pagination.
|
|
329
|
+
rowsPerPage: props.pagination.rowsPerPage,
|
|
330
|
+
sortBy: props.pagination.sortBy,
|
|
331
|
+
descending: props.pagination.descending
|
|
330
332
|
}
|
|
331
333
|
})
|
|
332
334
|
}
|
|
@@ -358,14 +360,6 @@ const onDelete = async (id: any) => {
|
|
|
358
360
|
|
|
359
361
|
//style
|
|
360
362
|
|
|
361
|
-
let rowsPerPageOptions = [3, 5, 7, 10, 15, 20, 25, 50, 0];
|
|
362
|
-
if (props.pagination == false) {
|
|
363
|
-
hideBottom.value = true;
|
|
364
|
-
pagination.value = null;
|
|
365
|
-
rowsPerPageOptions = [0]
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
363
|
const attrs = {
|
|
370
364
|
...{
|
|
371
365
|
dense: light.getStyle("tableDense", false),
|
|
@@ -387,20 +381,20 @@ const attrs = {
|
|
|
387
381
|
|
|
388
382
|
<template v-if="debug">
|
|
389
383
|
<pre>primaryKey:{{ primaryKey }}
|
|
390
|
-
modelName:{{ modelName }}
|
|
391
|
-
filters:{{ filters }}
|
|
392
|
-
pagination:{{ pagination }}
|
|
393
|
-
actionView:{{ actionView }}
|
|
394
|
-
actionDelete:{{ actionDelete }}
|
|
395
|
-
activeEdit:{{ activeEdit }}
|
|
396
|
-
attrs:{{ attrs }}
|
|
397
|
-
$attrs:{{ $attrs }}
|
|
398
|
-
|
|
384
|
+
modelName:{{ modelName }}
|
|
385
|
+
filters:{{ filters }}
|
|
386
|
+
pagination:{{ pagination }}
|
|
387
|
+
actionView:{{ actionView }}
|
|
388
|
+
actionDelete:{{ actionDelete }}
|
|
389
|
+
activeEdit:{{ activeEdit }}
|
|
390
|
+
attrs:{{ attrs }}
|
|
391
|
+
$attrs:{{ $attrs }}
|
|
392
|
+
</pre>
|
|
399
393
|
rows:{{ props.rows }}
|
|
400
394
|
</template>
|
|
401
395
|
|
|
402
|
-
<q-table v-bind="attrs" :row-key="rowKey" :loading="loading" :rows="rows"
|
|
403
|
-
|
|
396
|
+
<q-table v-bind="attrs" :row-key="rowKey" :loading="loading" :rows="rows" ref="table" @request="onRequest"
|
|
397
|
+
:rows-per-page-label="$t(props.rowsPerPageLabel)" :columns="renderColumns"
|
|
404
398
|
:rows-per-page-options="rowsPerPageOptions" :selection="selection" :pagination="pagination">
|
|
405
399
|
|
|
406
400
|
|
|
@@ -416,7 +410,8 @@ $attrs:{{ $attrs }}
|
|
|
416
410
|
<l-view-btn v-if="actionView && props.row.canView"
|
|
417
411
|
:to="`/${modelName}/${props.row[primaryKey]}/view`" />
|
|
418
412
|
|
|
419
|
-
<l-edit-btn :to="`/${modelName}/${props.row[primaryKey]}/edit`"
|
|
413
|
+
<l-edit-btn :to="`/${modelName}/${props.row[primaryKey]}/edit`"
|
|
414
|
+
v-if="activeEdit && props.row.canUpdate" />
|
|
420
415
|
|
|
421
416
|
<l-delete-btn v-if="actionDelete && props.row.canDelete"
|
|
422
417
|
@submit="onDelete(props.row[primaryKey])"></l-delete-btn>
|