@hostlink/nuxt-light 1.9.2 → 1.10.1
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
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addImports,
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, addImports, addVitePlugin, resolveFiles, addPlugin } from '@nuxt/kit';
|
|
2
2
|
import { quasar } from '@quasar/vite-plugin';
|
|
3
3
|
|
|
4
4
|
const module = defineNuxtModule({
|
|
@@ -8,7 +8,7 @@ const module = defineNuxtModule({
|
|
|
8
8
|
},
|
|
9
9
|
// Default configuration options of the Nuxt module
|
|
10
10
|
defaults: {},
|
|
11
|
-
setup(options, nuxt) {
|
|
11
|
+
async setup(options, nuxt) {
|
|
12
12
|
const resolver = createResolver(import.meta.url);
|
|
13
13
|
nuxt.options.css.push("quasar/dist/quasar.prod.css");
|
|
14
14
|
nuxt.options.css.push("@quasar/extras/material-icons/material-icons.css");
|
|
@@ -20,7 +20,7 @@ const module = defineNuxtModule({
|
|
|
20
20
|
rel: "stylesheet",
|
|
21
21
|
href: "https://fonts.googleapis.com/css2?family=Noto+Sans&family=Noto+Sans+HK&family=Noto+Sans+TC&family=Material+Symbols+Outlined"
|
|
22
22
|
});
|
|
23
|
-
addComponentsDir({
|
|
23
|
+
await addComponentsDir({
|
|
24
24
|
path: resolver.resolve("./runtime/components")
|
|
25
25
|
});
|
|
26
26
|
const from = resolver.resolve("./runtime/lib");
|
|
@@ -52,13 +52,28 @@ const module = defineNuxtModule({
|
|
|
52
52
|
{ name: "getModelField", from },
|
|
53
53
|
{ name: "getGQLFields", from },
|
|
54
54
|
{ name: "model", from },
|
|
55
|
-
{ name: "notify", from }
|
|
55
|
+
{ name: "notify", from },
|
|
56
|
+
{ name: "defineLightModel", from },
|
|
57
|
+
{ name: "LightModelField", from, type: true },
|
|
58
|
+
{ name: "LightModel", from, type: true }
|
|
56
59
|
]);
|
|
60
|
+
addVitePlugin(quasar());
|
|
61
|
+
const files = await resolveFiles(process.cwd() + "/models", ["*"]);
|
|
62
|
+
nuxt.options.runtimeConfig.public.light = {
|
|
63
|
+
model: []
|
|
64
|
+
};
|
|
65
|
+
for (const file of files) {
|
|
66
|
+
const n1 = "Model_" + file.match(/([a-zA-Z0-9]+)\.ts$/)?.[1];
|
|
67
|
+
addPlugin({
|
|
68
|
+
src: file,
|
|
69
|
+
mode: "client",
|
|
70
|
+
name: n1
|
|
71
|
+
});
|
|
72
|
+
}
|
|
57
73
|
addPlugin({
|
|
58
74
|
src: resolver.resolve("./runtime/plugin"),
|
|
59
75
|
mode: "client"
|
|
60
76
|
});
|
|
61
|
-
addVitePlugin(quasar());
|
|
62
77
|
}
|
|
63
78
|
});
|
|
64
79
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface LightModelGqlField {
|
|
2
|
+
[key: string]: string | LightModelGqlField | boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface LightModelField {
|
|
5
|
+
label: string;
|
|
6
|
+
sortable?: boolean;
|
|
7
|
+
searchable?: boolean;
|
|
8
|
+
autoWidth?: boolean;
|
|
9
|
+
searchType?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
gqlField?: LightModelGqlField;
|
|
12
|
+
to?: (row: any) => string;
|
|
13
|
+
field?: (row: any) => string;
|
|
14
|
+
}
|
|
15
|
+
export interface LightModelFields {
|
|
16
|
+
[key: string]: LightModelField;
|
|
17
|
+
}
|
|
18
|
+
export interface LightModel {
|
|
19
|
+
name: string;
|
|
20
|
+
fields: LightModelFields;
|
|
21
|
+
}
|
|
22
|
+
declare const _default: (model: LightModel) => any;
|
|
23
|
+
export default _default;
|
|
@@ -16,6 +16,8 @@ export { default as getModelFields } from "./getModelFields";
|
|
|
16
16
|
export { default as getModelColumns } from "./getModelColumns";
|
|
17
17
|
export { default as sv } from "./sv";
|
|
18
18
|
export { default as model } from "./model";
|
|
19
|
+
export { default as defineLightModel } from "./defineLightModel";
|
|
20
|
+
export { type LightModelField, type LightModel } from "./defineLightModel";
|
|
19
21
|
export declare const notify: (message: string, color?: string) => void;
|
|
20
22
|
export { default as getID } from "./getID";
|
|
21
23
|
export { default as id } from "./getID";
|
|
@@ -18,6 +18,7 @@ export { default as getModelFields } from "./getModelFields.mjs";
|
|
|
18
18
|
export { default as getModelColumns } from "./getModelColumns.mjs";
|
|
19
19
|
export { default as sv } from "./sv.mjs";
|
|
20
20
|
export { default as model } from "./model.mjs";
|
|
21
|
+
export { default as defineLightModel } from "./defineLightModel.mjs";
|
|
21
22
|
export const notify = function(message, color = "positive") {
|
|
22
23
|
Notify.create({
|
|
23
24
|
message,
|