@hostlink/nuxt-light 1.48.2 → 1.48.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 +1 -1
- package/dist/runtime/components/l-table.d.vue.ts +4 -0
- package/dist/runtime/components/l-table.vue +4 -0
- package/dist/runtime/components/l-table.vue.d.ts +4 -0
- package/dist/runtime/composables/collect.js +0 -13
- package/dist/runtime/composables/defineLightModel.d.ts +6 -9
- package/dist/runtime/composables/getObject.js +4 -2
- package/dist/runtime/composables/useObject.js +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -6,6 +6,10 @@ export interface LTableColumn extends QTableColumn {
|
|
|
6
6
|
searchOptions?: Array<any> | Function;
|
|
7
7
|
searchMultiple?: boolean;
|
|
8
8
|
searchIndex?: string;
|
|
9
|
+
gql?: Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use gql instead
|
|
12
|
+
*/
|
|
9
13
|
gqlField?: string | Array<string> | Object;
|
|
10
14
|
backgroundColor?: string | Function;
|
|
11
15
|
searchMethod?: string;
|
|
@@ -194,6 +194,10 @@ const onLocalRequest = async (p) => {
|
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
props.columns?.forEach((col) => {
|
|
197
|
+
if (col.gql) {
|
|
198
|
+
localFields = defu(localFields, col.gql);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
197
201
|
if (col.gqlField) {
|
|
198
202
|
localFields = defu(localFields, col.gqlField);
|
|
199
203
|
return;
|
|
@@ -6,6 +6,10 @@ export interface LTableColumn extends QTableColumn {
|
|
|
6
6
|
searchOptions?: Array<any> | Function;
|
|
7
7
|
searchMultiple?: boolean;
|
|
8
8
|
searchIndex?: string;
|
|
9
|
+
gql?: Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use gql instead
|
|
12
|
+
*/
|
|
9
13
|
gqlField?: string | Array<string> | Object;
|
|
10
14
|
backgroundColor?: string | Function;
|
|
11
15
|
searchMethod?: string;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { default as api } from "./api.js";
|
|
2
|
-
import { default as model } from "./model.js";
|
|
3
|
-
import { defu } from "defu";
|
|
4
2
|
export default (name, fields) => {
|
|
5
3
|
return api.collect(name, fields);
|
|
6
|
-
const m = model(name);
|
|
7
|
-
let f = {};
|
|
8
|
-
Object.entries(fields).forEach(([key, value]) => {
|
|
9
|
-
const field = m.field(key);
|
|
10
|
-
if (field && field.getGQLField() && value === true) {
|
|
11
|
-
f = defu(f, field.getGQLField());
|
|
12
|
-
} else {
|
|
13
|
-
f[key] = value;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return api.collect(name, f);
|
|
17
4
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { Component } from "vue";
|
|
2
2
|
import { type Field } from "@hostlink/light";
|
|
3
|
-
export interface LightModelGqlField {
|
|
4
|
-
[key: string]: string | LightModelGqlField | boolean;
|
|
5
|
-
}
|
|
6
3
|
export interface LightModelField extends Field {
|
|
7
4
|
label: string;
|
|
8
5
|
sortable?: boolean;
|
|
@@ -10,22 +7,22 @@ export interface LightModelField extends Field {
|
|
|
10
7
|
autoWidth?: boolean;
|
|
11
8
|
searchType?: "date" | "text" | "number" | "select";
|
|
12
9
|
name?: string;
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use gql instead
|
|
12
|
+
*/
|
|
13
|
+
gqlField?: Record<string, any>;
|
|
14
14
|
to?: (row: any) => string;
|
|
15
15
|
field?: (row: any) => string;
|
|
16
16
|
component?: Component;
|
|
17
17
|
componentProps?: any;
|
|
18
|
-
format?: (value: any) => any;
|
|
18
|
+
format?: (value: any, row: object) => any;
|
|
19
19
|
style?: any;
|
|
20
20
|
align?: "left" | "center" | "right";
|
|
21
21
|
searchOptions?: Record<string, any>[];
|
|
22
22
|
}
|
|
23
|
-
export interface LightModelFields {
|
|
24
|
-
[key: string]: LightModelField;
|
|
25
|
-
}
|
|
26
23
|
export interface LightModel {
|
|
27
24
|
name: string;
|
|
28
|
-
fields:
|
|
25
|
+
fields: Record<string, LightModelField>;
|
|
29
26
|
}
|
|
30
27
|
declare const _default: (model: LightModel) => import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
|
|
31
28
|
export default _default;
|
|
@@ -19,11 +19,13 @@ export default async function(fields = []) {
|
|
|
19
19
|
if (typeof field == "string") {
|
|
20
20
|
const f = getModelField(module, field);
|
|
21
21
|
if (f) {
|
|
22
|
+
if (f.gql) {
|
|
23
|
+
return f.gql;
|
|
24
|
+
}
|
|
22
25
|
if (f.gqlField) {
|
|
23
26
|
return f.gqlField;
|
|
24
|
-
} else {
|
|
25
|
-
return field;
|
|
26
27
|
}
|
|
28
|
+
return field;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
return field;
|
|
@@ -18,7 +18,7 @@ export default async function(fields) {
|
|
|
18
18
|
for (const [key, value] of Object.entries(fields)) {
|
|
19
19
|
const f = getModelField(module, key);
|
|
20
20
|
if (f) {
|
|
21
|
-
const gqlField = f.
|
|
21
|
+
const gqlField = f.gqlField || f.gql;
|
|
22
22
|
if (typeof gqlField === "string") {
|
|
23
23
|
query[gqlField] = value;
|
|
24
24
|
} else {
|