@hostlink/nuxt-light 0.0.99 → 0.0.100

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,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.99"
4
+ "version": "0.0.100"
5
5
  }
package/dist/module.mjs CHANGED
@@ -59,8 +59,7 @@ const module = defineNuxtModule({
59
59
  { name: "getModelColumns", from },
60
60
  { name: "getModelFields", from },
61
61
  { name: "getModelField", from },
62
- { name: "getGQLFields", from },
63
- { name: "sv", from }
62
+ { name: "getGQLFields", from }
64
63
  ]);
65
64
  addPlugin({
66
65
  src: resolver.resolve("./runtime/plugin"),
@@ -7,9 +7,9 @@ import { ref, computed, reactive, provide, watch } from 'vue';
7
7
  import { useRuntimeConfig } from 'nuxt/app';
8
8
 
9
9
  //download system value
10
- import { download } from './../lib/SystemValue'
10
+ /* import { download } from './../lib/SystemValue'
11
11
  await download();
12
-
12
+ */
13
13
  const config = useRuntimeConfig();
14
14
 
15
15
  const appVersion = config.public.appVersion ?? '0.0.1';
@@ -31,10 +31,11 @@ const COLORS = [
31
31
 
32
32
  defineEmits(['update:theme', 'update:menuOverlayHeader', 'update:dense', 'update:color', 'update:miniState', 'update:footer'])
33
33
 
34
- const color = defineModel("color", { type: String, default: "primary" })
35
-
36
-
37
34
  const props = defineProps({
35
+ color: {
36
+ type: String,
37
+ default: 'primary'
38
+ },
38
39
  menuOverlayHeader: {
39
40
  type: Boolean,
40
41
  default: false
@@ -20,7 +20,7 @@ const props = defineProps({
20
20
  sortable?: boolean,
21
21
  searchable?: boolean,
22
22
  searchType?: string,
23
- searchOptions?: Array<any>,
23
+ searchOptions?: Array<any> | Function,
24
24
  searchMultiple?: boolean,
25
25
  field?: string | Object,
26
26
  gqlField?: string | Array<string> | Object,
@@ -95,6 +95,19 @@ props.columns?.forEach((col) => {
95
95
  col.label = t(col.label)
96
96
  })
97
97
 
98
+ if (props.columns) {
99
+ for (let i = 0; i < props.columns.length; i++) {
100
+ if (props.columns[i].searchOptions) {
101
+ let opts = props.columns[i].searchOptions;
102
+ if (typeof opts == "function") {
103
+ props.columns[i].searchOptions = await opts();
104
+ }
105
+
106
+
107
+ }
108
+ }
109
+ }
110
+
98
111
  const renderColumns = computed(() => {
99
112
  if (props.columns == undefined) return undefined;
100
113
 
@@ -430,8 +443,8 @@ const filterFn = (val, update, abort) {
430
443
 
431
444
  const isDark = computed(() => {
432
445
  return light.theme == "dark";
433
-
434
446
  })
447
+
435
448
  </script>
436
449
 
437
450
  <template>
@@ -1,4 +1,5 @@
1
- export declare const sv_data: any;
2
- export declare const loadSV: (name: string) => void;
3
- export declare const download: () => Promise<void>;
1
+ export declare const loadSV: (name: string) => () => Promise<{
2
+ label: string;
3
+ value: any;
4
+ }>;
4
5
  export declare const getSV: (name: string, value: any) => string;
@@ -1,14 +1,7 @@
1
1
  import sv from "./sv.mjs";
2
2
  import { cache } from "./sv.mjs";
3
- export const sv_data = [];
4
3
  export const loadSV = (name) => {
5
- sv_data.push(name);
6
- };
7
- export const download = async () => {
8
- for (let i = 0; i < sv_data.length; i++) {
9
- const name = sv_data[i];
10
- await sv(name);
11
- }
4
+ return () => sv(name);
12
5
  };
13
6
  export const getSV = (name, value) => {
14
7
  const data = cache[name];
@@ -1,3 +1,6 @@
1
1
  export declare const cache: any;
2
- declare const _default: (name: string) => Promise<any>;
2
+ declare const _default: (name: string) => Promise<{
3
+ label: string;
4
+ value: any;
5
+ }>;
3
6
  export default _default;
@@ -1,16 +1,19 @@
1
1
  import { query } from "@hostlink/light";
2
2
  export const cache = {};
3
- export default async (name) => {
3
+ export default (name) => {
4
4
  if (cache[name]) {
5
5
  return cache[name];
6
6
  }
7
- const resp = await query({
8
- systemValue: {
9
- __args: {
10
- name
7
+ const p = new Promise(async (resolve, reject) => {
8
+ const resp = await query({
9
+ systemValue: {
10
+ __args: {
11
+ name
12
+ }
11
13
  }
12
- }
14
+ });
15
+ cache[name] = resp.systemValue;
16
+ resolve(resp.systemValue);
13
17
  });
14
- cache[name] = resp.systemValue;
15
- return resp.systemValue;
18
+ return p;
16
19
  };
@@ -38,13 +38,10 @@ export default {
38
38
  label: "Status",
39
39
  searchable: true,
40
40
  searchType: "select",
41
- searchOptions: [{
42
- label: "Active",
43
- value: 0
44
- }, {
45
- label: "Inactive",
46
- value: 1
47
- }],
41
+ searchOptions: [
42
+ { label: "Active", value: 0 },
43
+ { label: "Inactive", value: 1 }
44
+ ],
48
45
  format: (value) => {
49
46
  return ["Active", "Inactive"][value];
50
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",
@@ -1,3 +0,0 @@
1
- export declare const sv_data: any;
2
- declare const _default: (name: string) => Promise<void>;
3
- export default _default;
@@ -1,4 +0,0 @@
1
- export const sv_data = [];
2
- export default async (name) => {
3
- sv_data.push(name);
4
- };