@hostlink/nuxt-light 1.48.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.48.1",
4
+ "version": "1.48.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -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
- gqlField?: LightModelGqlField;
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: LightModelFields;
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.getGQLField();
21
+ const gqlField = f.gqlField || f.gql;
22
22
  if (typeof gqlField === "string") {
23
23
  query[gqlField] = value;
24
24
  } else {
@@ -30,6 +30,9 @@ if (!props.context.onSubmit) {
30
30
  if (obj === null || obj === void 0) {
31
31
  return obj;
32
32
  }
33
+ if (obj instanceof File) {
34
+ return obj;
35
+ }
33
36
  if (Array.isArray(obj)) {
34
37
  return obj.map((item) => removeUndefined(item)).filter((item) => item !== void 0);
35
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.48.1",
3
+ "version": "1.48.3",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",