@hostlink/nuxt-light 1.10.16 → 1.10.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/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.10.16"
4
+ "version": "1.10.18"
5
5
  }
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import type { QTabPanelProps, QTabProps } from 'quasar';
3
3
  import { getCurrentInstance } from 'vue';
4
- defineProps<QTabPanelProps | QTabProps>()
4
+
5
5
  const instance = getCurrentInstance();
6
+ defineProps<QTabPanelProps | QTabProps>()
6
7
 
7
8
  // check parent is q-tab-panels or q-tabs
8
-
9
9
  const parent_type = instance?.parent?.type.name
10
10
 
11
-
12
11
  </script>
13
12
  <template>
14
13
  <template v-if="parent_type == 'QTabPanels'">
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { useQuasar, QTable, type QTableColumn, type QTableProps } from 'quasar';
3
3
 
4
- import { ref, computed, onMounted, useSlots, useAttrs, watch } from "vue";
4
+ import { ref, computed, onMounted, useSlots, useAttrs, watch, defineComponent, h } from "vue";
5
5
  import { t, q, useLight, GQLFieldBuilder, model } from '../';
6
6
  import { toQuery } from '@hostlink/light';
7
7
 
@@ -57,6 +57,9 @@ const props = withDefaults(defineProps<LTableProps>(), {
57
57
  noDataLabel: "No data available",
58
58
  });
59
59
 
60
+ const isServerSide = (props.rows == undefined);
61
+
62
+
60
63
  const light = useLight();
61
64
 
62
65
  const pagination = ref(props.pagination);
@@ -147,18 +150,12 @@ const table = ref<InstanceType<typeof QTable>>();
147
150
 
148
151
  const filters = ref<InstanceType<any>>({});
149
152
  const rows = ref<InstanceType<any>>(props.rows);
153
+ if (rows.value == undefined) {
154
+ rows.value = [];
155
+ }
150
156
 
151
157
  onMounted(() => {
152
- if (table.value) {
153
- table.value.requestServerInteraction();
154
- }
155
-
156
- })
157
-
158
-
159
-
160
- const isServerSide = computed(() => {
161
- return props.rows == undefined;
158
+ table.value && table.value.requestServerInteraction();
162
159
  })
163
160
 
164
161
  let primaryKey = ref(props.rowKey);
@@ -246,7 +243,7 @@ const getData = async (
246
243
  }
247
244
 
248
245
  const onRequest = async (p: any) => {
249
- if (!isServerSide.value) return;
246
+ if (!isServerSide) return;
250
247
 
251
248
 
252
249
  let sort = "";
@@ -517,6 +514,13 @@ const localSelected = computed({
517
514
  watch(() => props.rows, (val) => {
518
515
  rows.value = val;
519
516
  });
517
+
518
+ const computedColumns = computed(() => {
519
+ return props.columns;
520
+ })
521
+
522
+
523
+
520
524
  </script>
521
525
 
522
526
 
@@ -547,6 +551,8 @@ watch(() => props.rows, (val) => {
547
551
  </q-tr>
548
552
  </template>
549
553
 
554
+
555
+
550
556
  <template #body="props">
551
557
  <q-tr :props="props">
552
558
  <q-td v-if="selection != 'none'" auto-width>
@@ -575,6 +581,8 @@ watch(() => props.rows, (val) => {
575
581
 
576
582
  </q-td>
577
583
 
584
+
585
+
578
586
  <template v-for="col in props.cols">
579
587
  <template v-if="ss.indexOf('body-cell-' + col.name) >= 0">
580
588
  <slot :name="'body-cell-' + col.name" v-bind="props"></slot>
@@ -1,13 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import type { QTabsProps } from 'quasar';
3
-
3
+ import { onMounted, useSlots } from '#imports';
4
4
  const model = defineModel<string | number | null | undefined>()
5
- interface LTabsProps extends QTabsProps {
5
+ export interface LTabsProps extends QTabsProps {
6
6
  }
7
+ defineProps<LTabsProps>();
8
+ const slots = useSlots()
7
9
 
8
-
9
- defineProps<LTabsProps>()
10
-
10
+ if (model.value === undefined) {
11
+ model.value = slots.default?.()[0]?.props?.name
12
+ }
11
13
  </script>
12
14
 
13
15
  <template>
@@ -1,3 +1,12 @@
1
+ export interface User {
2
+ user_id?: number;
3
+ username: string;
4
+ password: string;
5
+ first_name: string;
6
+ last_name?: string;
7
+ email: string;
8
+ language?: string;
9
+ }
1
10
  declare const app: {
2
11
  company: string;
3
12
  companyLogo: string;
@@ -6,6 +15,15 @@ declare const app: {
6
15
  isAdmin: boolean;
7
16
  permissions: string[];
8
17
  myFavorites: any[];
18
+ users: {
19
+ create: (user: User) => Promise<User>;
20
+ del: (user_id: number) => Promise<any>;
21
+ update: (id: number, user: User) => Promise<any>;
22
+ list: (args: any) => Promise<any>;
23
+ };
24
+ roles: {
25
+ list: () => Promise<any>;
26
+ };
9
27
  getColorValue: () => string;
10
28
  setMyFavorites: (favorites: any[]) => void;
11
29
  reloadMyFavorites: () => Promise<void>;
@@ -46,6 +64,15 @@ export declare const useLight: (options?: {
46
64
  isAdmin: boolean;
47
65
  permissions: string[];
48
66
  myFavorites: any[];
67
+ users: {
68
+ create: (user: User) => Promise<User>;
69
+ del: (user_id: number) => Promise<any>;
70
+ update: (id: number, user: User) => Promise<any>;
71
+ list: (args: any) => Promise<any>;
72
+ };
73
+ roles: {
74
+ list: () => Promise<any>;
75
+ };
49
76
  getColorValue: () => string;
50
77
  setMyFavorites: (favorites: Array<any>) => void;
51
78
  reloadMyFavorites: () => Promise<void>;
@@ -47,6 +47,44 @@ const app = reactive({
47
47
  isAdmin: false,
48
48
  permissions: Array(),
49
49
  myFavorites: Array(),
50
+ users: {
51
+ create: async (user) => {
52
+ const u = await m("addUser", { data: user });
53
+ user.user_id = u;
54
+ return user;
55
+ },
56
+ del: async (user_id) => {
57
+ return await m("deleteUser", { id: user_id });
58
+ },
59
+ update: async (id, user) => {
60
+ return await m("updateUser", {
61
+ id,
62
+ data: user
63
+ });
64
+ },
65
+ list: async (args) => {
66
+ const { listUser } = await q({
67
+ listUser: {
68
+ data: {
69
+ __args: args,
70
+ user_id: true,
71
+ name: true
72
+ }
73
+ }
74
+ });
75
+ return listUser.data;
76
+ }
77
+ },
78
+ roles: {
79
+ list: async () => {
80
+ const { listRole } = await q({
81
+ listRole: {
82
+ name: true
83
+ }
84
+ });
85
+ return listRole;
86
+ }
87
+ },
50
88
  getColorValue: () => {
51
89
  return COLOR_CODE[app.color];
52
90
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.10.16",
3
+ "version": "1.10.18",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",