@hostlink/nuxt-light 1.54.1 → 1.54.3

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.54.1",
4
+ "version": "1.54.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -358,7 +358,6 @@ const module$1 = defineNuxtModule({
358
358
  });
359
359
  addImports({ name: "isGranted", from: "@hostlink/light" });
360
360
  addImports({ name: "getGrantedRights", from: "@hostlink/light" });
361
- addImports({ name: "list", from: "@hostlink/light" });
362
361
  addImports({ name: "query", as: "q", from: "@hostlink/light" });
363
362
  addImports({ name: "mutation", from: "@hostlink/light" });
364
363
  addImports({ name: "query", from: "@hostlink/light" });
@@ -366,10 +365,11 @@ const module$1 = defineNuxtModule({
366
365
  path: resolver.resolve("./runtime/components")
367
366
  });
368
367
  addImportsDir(resolver.resolve("./runtime/composables"));
368
+ const files0 = await resolveFiles(resolver.resolve("./runtime/models"), ["*"]);
369
369
  const files = await resolveFiles(process.cwd() + "/models", ["*"]);
370
370
  const files2 = await resolveFiles(process.cwd() + "/app/models", ["*"]);
371
371
  let content = "";
372
- for (const file of [...files, ...files2]) {
372
+ for (const file of [...files0, ...files, ...files2]) {
373
373
  content += `(await import('${file}')).default();
374
374
  `;
375
375
  }
@@ -7,6 +7,7 @@ export type LightModelField = Omit<LTableColumn, "name" | "field"> & Field & {
7
7
  export interface LightModel {
8
8
  name: string;
9
9
  fields: Record<string, LightModelField>;
10
+ dataPath?: string;
10
11
  }
11
12
  declare const _default: (model: LightModel) => () => void;
12
13
  export default _default;
@@ -1,6 +1,9 @@
1
- import { getApiClient } from "@hostlink/light";
1
+ import { defineModel } from "@hostlink/light";
2
2
  export default (model) => {
3
3
  return () => {
4
- getApiClient().models.create(model.name, model.fields);
4
+ const m = defineModel(model.name, model.fields);
5
+ if (model.dataPath) {
6
+ m.setDataPath(model.dataPath);
7
+ }
5
8
  };
6
9
  };
@@ -1,2 +1,2 @@
1
- declare const _default: (name: string, fields: string[]) => Record<string, any>;
1
+ declare const _default: (name: string, fields: string[]) => any;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (name: string, field: string) => import("@hostlink/light").Field | null;
1
+ declare const _default: (name: string, field: string) => any;
2
2
  export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: (name: string, fields: Record<string, any>) => any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { getModel } from "@hostlink/light";
2
+ export default (name, fields) => {
3
+ console.log(name);
4
+ const m = getModel(name);
5
+ return m.list(fields);
6
+ };
@@ -1,7 +1,2 @@
1
- import type { Model } from '@hostlink/light';
2
- import type { LTableColumn } from "../components/l-table.vue.js";
3
- interface LModel extends Model {
4
- columns(fields: string[]): Array<LTableColumn>;
5
- }
6
- declare const _default: (name: string) => LModel;
1
+ declare const _default: (name: string) => any;
7
2
  export default _default;
@@ -1,7 +1,9 @@
1
- import { useGlobalModel } from "@hostlink/light";
1
+ import { getModel } from "@hostlink/light";
2
+ import defu from "defu";
2
3
  export default (name) => {
3
- const m = useGlobalModel().getModel(name);
4
- return Object.assign(m, {
4
+ const m = getModel(name);
5
+ console.log(m.getDataPath());
6
+ return defu(m, {
5
7
  columns(fields) {
6
8
  let columns = [];
7
9
  if (!Array.isArray(fields)) {
@@ -1,26 +1,2 @@
1
- declare const _default: {
2
- name: string;
3
- fields: {
4
- name: {
5
- label: string;
6
- sortable: boolean;
7
- searchable: boolean;
8
- };
9
- model: {
10
- label: string;
11
- sortable: boolean;
12
- searchable: boolean;
13
- };
14
- type: {
15
- label: string;
16
- sortable: boolean;
17
- searchable: boolean;
18
- };
19
- validation: {
20
- label: string;
21
- sortable: boolean;
22
- searchable: boolean;
23
- };
24
- };
25
- };
1
+ declare const _default: () => void;
26
2
  export default _default;
@@ -1,4 +1,5 @@
1
- export default {
1
+ import { defineLightModel } from "#imports";
2
+ export default defineLightModel({
2
3
  name: "CustomField",
3
4
  fields: {
4
5
  name: {
@@ -22,4 +23,4 @@ export default {
22
23
  searchable: true
23
24
  }
24
25
  }
25
- };
26
+ });
@@ -1,38 +1,2 @@
1
- declare const _default: {
2
- name: string;
3
- fields: {
4
- eventlog_id: {
5
- label: string;
6
- sortable: boolean;
7
- searchable: boolean;
8
- autoWidth: boolean;
9
- };
10
- class: {
11
- label: string;
12
- sortable: boolean;
13
- searchable: boolean;
14
- };
15
- id: {
16
- label: string;
17
- sortable: boolean;
18
- searchable: boolean;
19
- };
20
- action: {
21
- label: string;
22
- sortable: boolean;
23
- searchable: boolean;
24
- };
25
- created_time: {
26
- label: string;
27
- sortable: boolean;
28
- searchable: boolean;
29
- searchType: string;
30
- };
31
- username: {
32
- label: string;
33
- sortable: boolean;
34
- searchable: boolean;
35
- };
36
- };
37
- };
1
+ declare const _default: () => void;
38
2
  export default _default;
@@ -1,5 +1,7 @@
1
- export default {
1
+ import { defineLightModel } from "#imports";
2
+ export default defineLightModel({
2
3
  name: "EventLog",
4
+ dataPath: "app.listEventLog",
3
5
  fields: {
4
6
  eventlog_id: {
5
7
  label: "EventLog ID",
@@ -34,4 +36,4 @@ export default {
34
36
  searchable: true
35
37
  }
36
38
  }
37
- };
39
+ });
@@ -1,34 +1,2 @@
1
- declare const _default: {
2
- name: string;
3
- fields: {
4
- maillog_id: {
5
- label: string;
6
- sortable: boolean;
7
- searchable: boolean;
8
- searchType: string;
9
- autoWidth: boolean;
10
- };
11
- from: {
12
- label: string;
13
- sortable: boolean;
14
- searchable: boolean;
15
- };
16
- to: {
17
- label: string;
18
- sortable: boolean;
19
- searchable: boolean;
20
- };
21
- subject: {
22
- label: string;
23
- sortable: boolean;
24
- searchable: boolean;
25
- };
26
- created_time: {
27
- label: string;
28
- sortable: boolean;
29
- searchable: boolean;
30
- searchType: string;
31
- };
32
- };
33
- };
1
+ declare const _default: () => void;
34
2
  export default _default;
@@ -1,5 +1,7 @@
1
- export default {
1
+ import { defineLightModel } from "#imports";
2
+ export default defineLightModel({
2
3
  name: "MailLog",
4
+ dataPath: "app.listMailLog",
3
5
  fields: {
4
6
  maillog_id: {
5
7
  label: "ID",
@@ -30,4 +32,4 @@ export default {
30
32
  searchType: "date"
31
33
  }
32
34
  }
33
- };
35
+ });
@@ -1,71 +1,2 @@
1
- declare const _default: {
2
- name: string;
3
- fields: {
4
- Name: {
5
- label: string;
6
- gql: {
7
- first_name: boolean;
8
- last_name: boolean;
9
- };
10
- format: (row: any) => string;
11
- };
12
- username: {
13
- label: string;
14
- sortable: boolean;
15
- searchable: boolean;
16
- required: boolean;
17
- };
18
- first_name: {
19
- label: string;
20
- sortable: boolean;
21
- searchable: boolean;
22
- };
23
- last_name: {
24
- label: string;
25
- sortable: boolean;
26
- searchable: boolean;
27
- };
28
- email: {
29
- label: string;
30
- sortable: boolean;
31
- searchable: boolean;
32
- };
33
- phone: {
34
- label: string;
35
- sortable: boolean;
36
- searchable: boolean;
37
- };
38
- join_date: {
39
- label: string;
40
- sortable: boolean;
41
- searchable: boolean;
42
- searchType: string;
43
- };
44
- roles: {
45
- label: string;
46
- format: (value: any) => any;
47
- };
48
- status: {
49
- label: string;
50
- searchable: boolean;
51
- searchType: string;
52
- searchOptions: {
53
- label: string;
54
- value: number;
55
- }[];
56
- format: (value: any) => string | undefined;
57
- };
58
- has2FA: {
59
- label: string;
60
- format: (value: any) => "" | "✔️";
61
- };
62
- _test2: {
63
- label: string;
64
- component: any;
65
- componentProps: (a: any) => {
66
- test: any;
67
- };
68
- };
69
- };
70
- };
1
+ declare const _default: () => void;
71
2
  export default _default;
@@ -1,6 +1,7 @@
1
- import MyTest from "../components/MyTest.vue";
2
- export default {
1
+ import { defineLightModel } from "#imports";
2
+ export default defineLightModel({
3
3
  name: "User",
4
+ dataPath: "app.listUser",
4
5
  fields: {
5
6
  Name: {
6
7
  label: "Name",
@@ -17,16 +18,6 @@ export default {
17
18
  sortable: true,
18
19
  searchable: true,
19
20
  required: true
20
- //cellClass: (row: any) => (row.username == "admin" ? "text-danger" : ""),
21
- /* backgroundColor: (row: any) => {
22
-
23
-
24
- if (row.username == "admin") {
25
- return "red";
26
- } else {
27
- return "white";
28
- }
29
- } */
30
21
  },
31
22
  first_name: {
32
23
  label: "First name",
@@ -67,7 +58,7 @@ export default {
67
58
  { label: "Inactive", value: 1 }
68
59
  ],
69
60
  format: (value) => {
70
- return ["Active", "Inactive"][value];
61
+ return value == 0 ? "Active" : "Inactive";
71
62
  }
72
63
  },
73
64
  has2FA: {
@@ -75,15 +66,6 @@ export default {
75
66
  format: (value) => {
76
67
  return value ? "\u2714\uFE0F" : "";
77
68
  }
78
- },
79
- _test2: {
80
- label: "Test",
81
- component: MyTest,
82
- componentProps: (a) => {
83
- return {
84
- test: a.username
85
- };
86
- }
87
69
  }
88
70
  }
89
- };
71
+ });
@@ -1,51 +1,2 @@
1
- declare const _default: {
2
- name: string;
3
- fields: {
4
- userlog_id: {
5
- label: string;
6
- sortable: boolean;
7
- searchable: boolean;
8
- autoWidth: boolean;
9
- };
10
- username: {
11
- label: string;
12
- sortable: boolean;
13
- searchable: boolean;
14
- };
15
- login_dt: {
16
- label: string;
17
- sortable: boolean;
18
- searchable: boolean;
19
- searchType: string;
20
- };
21
- logout_dt: {
22
- label: string;
23
- sortable: boolean;
24
- searchable: boolean;
25
- };
26
- result: {
27
- label: string;
28
- sortable: boolean;
29
- searchable: boolean;
30
- searchType: string;
31
- searchOptions: {
32
- label: string;
33
- value: string;
34
- }[];
35
- autoWidth: boolean;
36
- };
37
- user_agent: {
38
- label: string;
39
- sortable: boolean;
40
- searchable: boolean;
41
- whiteSpace: string;
42
- };
43
- last_access_time: {
44
- label: string;
45
- sortable: boolean;
46
- searchable: boolean;
47
- searchType: string;
48
- };
49
- };
50
- };
1
+ declare const _default: () => void;
51
2
  export default _default;
@@ -1,4 +1,5 @@
1
- export default {
1
+ import { defineLightModel } from "#imports";
2
+ export default defineLightModel({
2
3
  name: "UserLog",
3
4
  fields: {
4
5
  userlog_id: {
@@ -44,7 +45,7 @@ export default {
44
45
  label: "User agent",
45
46
  sortable: true,
46
47
  searchable: true,
47
- whiteSpace: "pre-line"
48
+ style: "white-space:pre-wrap;"
48
49
  },
49
50
  last_access_time: {
50
51
  label: "Last access time",
@@ -53,4 +54,4 @@ export default {
53
54
  searchType: "date"
54
55
  }
55
56
  }
56
- };
57
+ });
@@ -37,10 +37,10 @@ const options = [
37
37
  { label: "Active", value: 0 },
38
38
  { label: "Inactive", value: 1 }
39
39
  ];
40
- const tt = await q({
41
- app: ["languages"]
40
+ const { app } = await q({
41
+ app: { languages: true }
42
42
  });
43
- const languages = tt.app.languages.map((lang) => {
43
+ const languages = app.languages.map((lang) => {
44
44
  return {
45
45
  label: lang.name,
46
46
  value: lang.value
@@ -50,7 +50,7 @@ const languages = tt.app.languages.map((lang) => {
50
50
 
51
51
  <template>
52
52
  <l-page>
53
-
53
+
54
54
  <FormKit type="l-form" :value="obj">
55
55
  <l-row class="col">
56
56
  <l-col md="6">
@@ -1,4 +1,4 @@
1
1
  import '@quasar/quasar-ui-qmarkdown/dist/index.css';
2
2
  import "./assets/main.css.js";
3
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
3
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
4
4
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import QMarkdownVuePlugin from "@quasar/quasar-ui-qmarkdown";
2
2
  import "@quasar/quasar-ui-qmarkdown/dist/index.css";
3
- import { createClient, useGlobalModel, setApiClient } from "@hostlink/light";
3
+ import { createClient, setApiClient, defineModel } from "@hostlink/light";
4
4
  import { q } from "#imports";
5
5
  import { createI18n } from "vue-i18n";
6
6
  import createLight from "./composables/createLight.js";
@@ -14,12 +14,6 @@ import { createLightPlugin } from "./formkit/index.js";
14
14
  import { plugin, defaultConfig } from "@formkit/vue";
15
15
  import getApiBase from "./composables/getApiBase.js";
16
16
  import useLight from "./composables/useLight.js";
17
- import TypeUser from "./models/User.js";
18
- import TypeUserLog from "./models/UserLog.js";
19
- import TypeSystemValue from "./models/SystemValue.js";
20
- import TypeMailLog from "./models/MailLog.js";
21
- import TypeEventLog from "./models/EventLog.js";
22
- import TypeCustomerField from "./models/CustomField.js";
23
17
  import { zhTW } from "@formkit/i18n";
24
18
  export default defineNuxtPlugin((nuxtApp) => {
25
19
  addRouteMiddleware("auth", async (to, from) => {
@@ -44,20 +38,9 @@ export default defineNuxtPlugin((nuxtApp) => {
44
38
  }, { global: true });
45
39
  const client = createClient(getApiBase());
46
40
  setApiClient(client);
47
- const models = useGlobalModel();
48
- models.createModel("User", TypeUser.fields);
49
- models.createModel("CustomField", TypeCustomerField.fields);
50
- models.createModel("UserLog", TypeUserLog.fields);
51
- models.createModel("SystemValue", TypeSystemValue.fields);
52
- models.createModel("MailLog", TypeMailLog.fields);
53
- models.createModel("EventLog", TypeEventLog.fields);
54
- models.createModel("Permission", {});
55
- models.getModel("User").setDataPath("app.listUser");
56
- models.getModel("MailLog").setDataPath("app.listMailLog");
57
- models.getModel("EventLog").setDataPath("app.listEventLog");
58
- models.getModel("UserLog").setDataPath("app.listUserLog");
59
- models.getModel("SystemValue").setDataPath("app.listSystemValue");
60
- models.getModel("Permission").setDataPath("app.listPermission");
41
+ defineModel("Permission", {}).setDataPath("app.listPermission");
42
+ defineModel("SystemValue", {}).setDataPath("app.listSystemValue");
43
+ defineModel("Config", {}).setDataPath("app.listConfig");
61
44
  nuxtApp.vueApp.config.errorHandler = (err, instance, info) => {
62
45
  const $route = useRoute();
63
46
  const light = useLight();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.54.1",
3
+ "version": "1.54.3",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@azure/msal-browser": "^4.26.2",
34
34
  "@formkit/drag-and-drop": "^0.5.3",
35
- "@hostlink/light": "^3.0.1",
35
+ "@hostlink/light": "^3.0.5",
36
36
  "@nuxt/module-builder": "^1.0.1",
37
37
  "@quasar/extras": "^1.17.0",
38
38
  "@quasar/quasar-ui-qmarkdown": "^2.0.5",
@@ -1,14 +0,0 @@
1
- declare const _default: {
2
- name: string;
3
- fields: {
4
- name: {
5
- label: string;
6
- sortable: boolean;
7
- searchable: boolean;
8
- };
9
- value: {
10
- label: string;
11
- };
12
- };
13
- };
14
- export default _default;
@@ -1,13 +0,0 @@
1
- export default {
2
- name: "SystemValue",
3
- fields: {
4
- name: {
5
- label: "Name",
6
- sortable: true,
7
- searchable: true
8
- },
9
- value: {
10
- label: "Value"
11
- }
12
- }
13
- };