@hostlink/nuxt-light 0.0.66 → 0.0.67

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.66"
4
+ "version": "0.0.67"
5
5
  }
@@ -1,15 +1,16 @@
1
1
  <script setup lang="ts">
2
2
  import { useQuasar, QTable } from 'quasar';
3
- import { useRoute } from 'vue-router';
4
3
  import { ref, computed, onMounted, useSlots, reactive, useAttrs } from "vue";
5
4
  import { t, deleteObject, q, f, useLight } from '../';
6
5
 
7
- const route = useRoute();
8
- const module = route.path.split("/")[1];
9
6
  const errors = ref<InstanceType<any>>([]);
10
7
 
11
8
  const light = useLight();
12
9
  const props = defineProps({
10
+ debug: {
11
+ type: Boolean,
12
+ default: false
13
+ },
13
14
  columns: {
14
15
  type: Array<{
15
16
  label: string,
@@ -35,8 +36,7 @@ const props = defineProps({
35
36
  default: "Records per page:"
36
37
  },
37
38
  rows: {
38
- type: Array,
39
- default: () => []
39
+ type: Array
40
40
  },
41
41
  rowKey: {
42
42
  type: String,
@@ -45,9 +45,6 @@ const props = defineProps({
45
45
  modelName: {
46
46
  type: String,
47
47
  default: null
48
- }, pagination: {
49
- type: Boolean,
50
- default: true
51
48
  },
52
49
  selection: {
53
50
  type: String,
@@ -57,6 +54,19 @@ const props = defineProps({
57
54
 
58
55
  const hideBottom = ref(false)
59
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
+ }
60
70
 
61
71
  //apply all aligns to the columns
62
72
  props.columns?.forEach((col) => {
@@ -71,7 +81,7 @@ props.columns?.forEach((col) => {
71
81
  })
72
82
 
73
83
  const renderColumns = computed(() => {
74
- if (!props.columns) return null;
84
+ if (props.columns == undefined) return undefined;
75
85
 
76
86
  let cols = [];
77
87
  if (props.actions.length > 0) {
@@ -109,13 +119,6 @@ if (props.actions.length > 0) {
109
119
  }
110
120
 
111
121
 
112
- const pagination = ref({
113
- sortBy: "",
114
- descending: true,
115
- page: 1,
116
- rowsPerPage: 10,
117
- rowsNumber: 0
118
- })
119
122
 
120
123
  if (props.sortBy) {
121
124
  let [sortBy, descending] = props.sortBy.split(":");
@@ -214,6 +217,10 @@ const onRequest = async (p: any) => {
214
217
  //
215
218
  let localFields: Array<any> = [];
216
219
 
220
+ if (props.rowKey) {
221
+ localFields.push(props.rowKey);
222
+ }
223
+
217
224
  fields.forEach((f) => {
218
225
  localFields.push(f);
219
226
  });
@@ -368,7 +375,6 @@ const attrs = {
368
375
  ...useAttrs()
369
376
  }
370
377
 
371
-
372
378
  </script>
373
379
  <template>
374
380
  <template v-if="errors.length > 0">
@@ -379,13 +385,24 @@ const attrs = {
379
385
  </div>
380
386
  </template>
381
387
 
382
- <q-table v-bind="$attrs" :flat="attrs.flat" :dense="attrs.dense" :bordered="attrs.bordered" :row-key="rowKey"
383
- :loading="loading" :hide-bottom="hideBottom" v-model:pagination="pagination" ref="table" @request="onRequest"
384
- :rows="rows" :rows-per-page-label="$t(props.rowsPerPageLabel)" :columns="renderColumns"
385
- :rows-per-page-options="rowsPerPageOptions"
386
- :selection="selection"
387
-
388
- >
388
+ <template v-if="debug">
389
+ <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
+ </pre>
399
+ rows:{{ props.rows }}
400
+ </template>
401
+
402
+ <q-table v-bind="attrs" :row-key="rowKey" :loading="loading" :rows="rows" :hide-bottom="hideBottom" ref="table"
403
+ @request="onRequest" :rows-per-page-label="$t(props.rowsPerPageLabel)" :columns="renderColumns"
404
+ :rows-per-page-options="rowsPerPageOptions" :selection="selection" :pagination="pagination">
405
+
389
406
 
390
407
  <template v-for="s in ss" v-slot:[s]="props">
391
408
  <slot :name="s" v-bind="props"></slot>
@@ -397,9 +414,9 @@ const attrs = {
397
414
  <div class="text-grey-8">
398
415
 
399
416
  <l-view-btn v-if="actionView && props.row.canView"
400
- :to="`/${modelName}/${props.row[primaryKey]}/view`"></l-view-btn>
417
+ :to="`/${modelName}/${props.row[primaryKey]}/view`" />
401
418
 
402
- <l-edit-btn :to="`/${modelName}/${props.row[primaryKey]}/edit`" v-if="activeEdit"></l-edit-btn>
419
+ <l-edit-btn :to="`/${modelName}/${props.row[primaryKey]}/edit`" v-if="activeEdit && props.row.canUpdate" />
403
420
 
404
421
  <l-delete-btn v-if="actionDelete && props.row.canDelete"
405
422
  @submit="onDelete(props.row[primaryKey])"></l-delete-btn>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",