@hostlink/nuxt-light 1.10.17 → 1.10.19

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.17"
4
+ "version": "1.10.19"
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,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
  },
@@ -4,13 +4,26 @@ export default (name) => {
4
4
  return Object.assign(m, {
5
5
  columns(fields) {
6
6
  let columns = [];
7
- for (let f of fields) {
8
- const field = getModelField(name, f);
9
- if (!field)
10
- continue;
11
- const option = field.getRaw();
12
- option.name = field.getName();
13
- columns.push(option);
7
+ if (Array.isArray(fields)) {
8
+ for (let f of fields) {
9
+ const field = getModelField(name, f);
10
+ if (!field)
11
+ continue;
12
+ const option = field.getRaw();
13
+ option.name = field.getName();
14
+ columns.push(option);
15
+ }
16
+ } else {
17
+ for (let f in fields) {
18
+ if (!fields[f])
19
+ continue;
20
+ const field = getModelField(name, f);
21
+ if (!field)
22
+ continue;
23
+ const option = field.getRaw();
24
+ option.name = field.getName();
25
+ columns.push(option);
26
+ }
14
27
  }
15
28
  return columns;
16
29
  }
@@ -5,7 +5,17 @@ const onRequest = async (request) => {
5
5
 
6
6
  request.loadObjects("User", { status: status.value });
7
7
  };
8
- const columns = model("User").columns(["username", "first_name", "label_name", "email", "phone", "join_date", "status", "has2FA"]);
8
+ const columns = model("User").columns({
9
+ username: true,
10
+ first_name: true,
11
+ label_name: true,
12
+ email: true,
13
+ phone: true,
14
+ join_date: true,
15
+ status: true,
16
+ has2FA: true,
17
+ })
18
+
9
19
  const status = ref("0");
10
20
  </script>
11
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.10.17",
3
+ "version": "1.10.19",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",