@hostlink/nuxt-light 1.21.0 → 1.21.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.21.0",
4
+ "version": "1.21.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -267,37 +267,36 @@ const module = defineNuxtModule({
267
267
  await addComponentsDir({
268
268
  path: resolver.resolve("./runtime/components")
269
269
  });
270
- const from = resolver.resolve("./runtime/lib");
271
270
  const index = resolver.resolve("./runtime/index");
272
271
  const SystemValue = resolver.resolve("./runtime/lib/SystemValue");
273
272
  addImports([
274
- { name: "api", from },
275
- { name: "id", from },
276
- { name: "getID", from },
277
- { name: "addObject", from },
278
- { name: "f", from },
279
- { name: "getApiUrl", from },
280
- { name: "getCurrentUser", from },
281
- { name: "getObject", from },
282
- { name: "list", from },
283
- { name: "m", from },
284
- { name: "q", from },
285
- { name: "removeObject", from },
286
- { name: "t", from },
273
+ { name: "api", from: index },
274
+ { name: "id", from: index },
275
+ { name: "getID", from: index },
276
+ { name: "addObject", from: index },
277
+ { name: "f", from: index },
278
+ { name: "getApiUrl", from: index },
279
+ { name: "getCurrentUser", from: index },
280
+ { name: "getObject", from: index },
281
+ { name: "list", from: index },
282
+ { name: "m", from: index },
283
+ { name: "q", from: index },
284
+ { name: "removeObject", from: index },
285
+ { name: "t", from: index },
287
286
  { name: "useLight", from: index },
288
- { name: "isGranted", from },
289
- { name: "sv", from },
287
+ { name: "isGranted", from: index },
288
+ { name: "sv", from: index },
290
289
  { name: "loadSV", from: SystemValue },
291
290
  { name: "getSV", from: SystemValue },
292
- { name: "getModelColumns", from },
293
- { name: "getModelFields", from },
294
- { name: "getModelField", from },
295
- { name: "getGQLFields", from },
296
- { name: "model", from },
297
- { name: "notify", from },
298
- { name: "defineLightModel", from },
299
- { name: "LightModelField", from, type: true },
300
- { name: "LightModel", from, type: true },
291
+ { name: "getModelColumns", from: index },
292
+ { name: "getModelFields", from: index },
293
+ { name: "getModelField", from: index },
294
+ { name: "getGQLFields", from: index },
295
+ { name: "model", from: index },
296
+ { name: "notify", from: index },
297
+ { name: "defineLightModel", from: index },
298
+ { name: "LightModelField", from: index, type: true },
299
+ { name: "LightModel", from: index, type: true },
301
300
  { name: "collect", from: index }
302
301
  ]);
303
302
  const files = await resolveFiles(process.cwd() + "/models", ["*"]);
@@ -1,79 +1,48 @@
1
1
  <script setup lang="ts">
2
2
 
3
- import { model } from "#imports";
4
- const props = defineProps(['id']);
5
-
6
- const obj = await model('User').get({ user_id: props.id }, ["user_id", "username", "first_name", "last_name", "email", "phone", "roles", 'status', 'join_date'])
3
+ import { collect, model } from "#imports";
4
+ const props = defineProps({
5
+ id: {
6
+ type: String,
7
+ required: true
8
+ }
9
+ });
10
+
11
+ const obj = await collect("User", {
12
+ user_id: true,
13
+ username: true,
14
+ first_name: true,
15
+ last_name: true,
16
+ email: true,
17
+ phone: true,
18
+ roles: true,
19
+ status: true,
20
+ join_date: true
21
+ }).where("user_id", props.id).first()
7
22
 
8
23
  </script>
9
24
  <template>
10
- <l-card class="q-mb-md">
25
+ <l-card>
11
26
  <q-card-section>
12
27
  <l-row>
13
- <l-col md="5">
28
+ <l-col md="6">
14
29
  <q-list dense separator>
15
- <q-item>
16
- <q-item-section>
17
- <q-item-label>{{ $t('Username') }}</q-item-label>
18
- </q-item-section>
19
- <q-item-section>{{ obj.username }}</q-item-section>
20
- </q-item>
21
- <q-item>
22
- <q-item-section>
23
- <q-item-label>{{ $t('First name') }}</q-item-label>
24
- </q-item-section>
25
- <q-item-section>{{ obj.first_name }}</q-item-section>
26
- </q-item>
27
- <q-item>
28
- <q-item-section>
29
- <q-item-label>{{ $t('Last name') }}</q-item-label>
30
- </q-item-section>
31
- <q-item-section>{{ obj.last_name }}</q-item-section>
32
- </q-item>
33
- <q-item>
34
- <q-item-section>
35
- <q-item-label>{{ $t('Email') }}</q-item-label>
36
- </q-item-section>
37
- <q-item-section>{{ obj.email }}</q-item-section>
38
- </q-item>
39
- <q-item>
40
- <q-item-section>
41
- <q-item-label>{{ $t('Phone') }}</q-item-label>
42
- </q-item-section>
43
- <q-item-section>{{ obj.phone }}</q-item-section>
44
- </q-item>
45
-
46
- <q-item>
47
- <q-item-section>
48
- <q-item-label>{{ $t('Roles') }}</q-item-label>
49
- </q-item-section>
50
- <q-item-section>
51
- <div class="q-gutter-xs float-left">
52
- <q-badge v-for="role in obj.roles" :key="role" :color="$light.color">{{ role }}</q-badge>
53
- </div>
54
- </q-item-section>
55
- </q-item>
56
-
57
- <q-item>
58
- <q-item-section>
59
- <q-item-label>{{ $t('Status') }}</q-item-label>
60
- </q-item-section>
61
- <q-item-section>{{ model('User').columns(["status"])[0].format(obj.status) }}</q-item-section>
62
- </q-item>
63
-
64
- <q-item>
65
- <q-item-section>
66
- <q-item-label>{{ $t('Join date') }}</q-item-label>
67
- </q-item-section>
68
- <q-item-section>{{ obj.join_date }}</q-item-section>
69
- </q-item>
30
+ <l-item label="Username">{{ obj.username }}</l-item>
31
+ <l-item label="First name">{{ obj.first_name }}</l-item>
32
+ <l-item label="Last name">{{ obj.last_name }}</l-item>
33
+ <l-item label="Email">{{ obj.email }}</l-item>
34
+ <l-item label="Phone">{{ obj.phone }}</l-item>
35
+ <l-item label="Roles">
36
+ <div class="q-gutter-xs float-left">
37
+ <q-badge v-for="role in obj.roles" :key="role" :color="$light.color">{{ role
38
+ }}</q-badge>
39
+ </div>
40
+ </l-item>
41
+ <l-item label="Status">{{ model('User').columns(["status"])[0].format(obj.status) }}</l-item>
42
+ <l-item label="Join date">{{ obj.join_date }}</l-item>
70
43
  </q-list>
71
-
72
-
73
44
  </l-col>
74
45
  </l-row>
75
-
76
46
  </q-card-section>
77
-
78
47
  </l-card>
79
48
  </template>
@@ -35,5 +35,3 @@ declare module '@formkit/inputs' {
35
35
  }
36
36
  }
37
37
  export * from "./lib/index.js";
38
- import { api } from "./lib/index.js";
39
- export declare const collect: (name: string, fields: Object) => ReturnType<typeof api.collect>;
@@ -1,5 +1 @@
1
1
  export * from "./lib/index.js";
2
- import { api } from "./lib/index.js";
3
- export const collect = (name, fields) => {
4
- return api.collect(name, fields);
5
- };
@@ -0,0 +1,3 @@
1
+ import { default as api } from "./api.js";
2
+ declare const _default: (name: string, fields: Object) => ReturnType<typeof api.collect>;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { default as api } from "./api.js";
2
+ export default (name, fields) => {
3
+ return api.collect(name, fields);
4
+ };
@@ -1,7 +1,7 @@
1
1
  import { toQuery } from "@hostlink/light";
2
2
  import { useRoute } from "vue-router";
3
3
  import { default as getModelField } from "./getModelField.js";
4
- import { collect } from "#imports";
4
+ import { default as collect } from "./collect.js";
5
5
  export default async function(fields = []) {
6
6
  let route = useRoute();
7
7
  if (!route.name) {
@@ -1,4 +1,5 @@
1
1
  export { default as api } from "./api.js";
2
+ export { default as collect } from "./collect.js";
2
3
  export { default as f } from "./f.js";
3
4
  export { default as getApiUrl } from "./getApiUrl.js";
4
5
  export { default as getCurrentUser } from "./getCurrentUser.js";
@@ -1,6 +1,7 @@
1
1
  import { useRuntimeConfig } from "nuxt/app";
2
2
  import { Notify } from "quasar";
3
3
  export { default as api } from "./api.js";
4
+ export { default as collect } from "./collect.js";
4
5
  export { default as f } from "./f.js";
5
6
  export { default as getApiUrl } from "./getApiUrl.js";
6
7
  export { default as getCurrentUser } from "./getCurrentUser.js";
@@ -4,16 +4,18 @@ import { m, api } from '#imports'
4
4
  import { useI18n } from 'vue-i18n';
5
5
  const { t } = useI18n();
6
6
 
7
- const { app, listRole: roles } = await api.query({
7
+ const { app } = await api.query({
8
8
  app: {
9
- permissions: true
10
- },
11
- listRole: {
12
- name: true,
13
- permissions: true
9
+ permissions: true,
10
+ roles: {
11
+ name: true,
12
+ permissions: true
13
+ }
14
14
  }
15
15
  })
16
16
 
17
+ const roles = app.roles;
18
+
17
19
  const columns = [{
18
20
  label: t("Permission"),
19
21
  field: "permission",
@@ -6,18 +6,17 @@ const obj = reactive({
6
6
  roles: []
7
7
  });
8
8
 
9
- const { app, listRole } = await api.query({
9
+ const { app } = await api.query({
10
10
  app: {
11
- permissions: true
12
- },
13
- listRole: {
14
- name: true,
15
- permissions: true
11
+ permissions: true,
12
+ roles: {
13
+ name: true,
14
+ permissions: true
15
+ }
16
16
  }
17
-
18
17
  })
19
18
 
20
- let roles = listRole.map((role) => {
19
+ let roles = app.roles.map((role) => {
21
20
  return {
22
21
  label: role.name,
23
22
  value: role.name,
@@ -27,7 +26,7 @@ let roles = listRole.map((role) => {
27
26
  const submit = () => {
28
27
 
29
28
  //filter roles
30
- let e = listRole.filter((role) => {
29
+ let e = app.roles.filter((role) => {
31
30
  return obj.roles.indexOf(role.name) != -1;
32
31
  });
33
32
 
@@ -14,6 +14,7 @@ const columns = [
14
14
  }
15
15
  ]
16
16
 
17
+
17
18
  </script>
18
19
  <template>
19
20
  <l-page>
@@ -89,12 +89,13 @@ const columns = [
89
89
  ]"></FormKit>
90
90
 
91
91
  <FormKit type="group" name="data">
92
+ <FormKit type="l-input" label="Url" name="url"
93
+ hint="URL is used to generate the full URL of the file.">
94
+ </FormKit>
95
+
92
96
  <template v-if="value.type == 'local'">
93
97
  <FormKit type="l-input" label="Location" name="location" validation="required"
94
98
  hint="Location is the path to the directory where the files are stored."></FormKit>
95
- <FormKit type="l-input" label="Base Url" name="base_url" validation="required"
96
- hint="Base URL is used to generate the full URL of the file."></FormKit>
97
-
98
99
  </template>
99
100
 
100
101
  <template v-if="value.type == 's3'">
@@ -30,6 +30,7 @@ export default defineNuxtPlugin((nuxtApp) => {
30
30
  api.model("User").setDataPath("app.listUser");
31
31
  api.model("UserLog").setDataPath("app.listUserLog");
32
32
  api.model("SystemValue").setDataPath("app.listSystemValue");
33
+ api.model("Permission").setDataPath("app.listPermission");
33
34
  nuxtApp.vueApp.config.errorHandler = (err, instance, info) => {
34
35
  console.log(err);
35
36
  const light = useLight();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.21.0",
3
+ "version": "1.21.2",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",