@ramathibodi/nuxt-commons 4.0.2 → 4.0.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.
Files changed (43) hide show
  1. package/README.md +35 -0
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/BarcodeReader.vue +3 -2
  4. package/dist/runtime/components/form/ActionPad.d.vue.ts +2 -2
  5. package/dist/runtime/components/form/ActionPad.vue.d.ts +2 -2
  6. package/dist/runtime/components/form/DateTime.vue +7 -1
  7. package/dist/runtime/components/form/Dialog.d.vue.ts +2 -2
  8. package/dist/runtime/components/form/Dialog.vue.d.ts +2 -2
  9. package/dist/runtime/components/form/EditPad.d.vue.ts +2 -2
  10. package/dist/runtime/components/form/EditPad.vue.d.ts +2 -2
  11. package/dist/runtime/components/form/System.vue +1 -1
  12. package/dist/runtime/components/label/Field.d.vue.ts +1 -1
  13. package/dist/runtime/components/label/Field.vue.d.ts +1 -1
  14. package/dist/runtime/components/model/Autocomplete.d.vue.ts +6 -1
  15. package/dist/runtime/components/model/Autocomplete.vue +8 -6
  16. package/dist/runtime/components/model/Autocomplete.vue.d.ts +6 -1
  17. package/dist/runtime/components/model/Combobox.d.vue.ts +6 -1
  18. package/dist/runtime/components/model/Combobox.vue +8 -6
  19. package/dist/runtime/components/model/Combobox.vue.d.ts +6 -1
  20. package/dist/runtime/components/model/Pad.d.vue.ts +5 -2
  21. package/dist/runtime/components/model/Pad.vue +3 -1
  22. package/dist/runtime/components/model/Pad.vue.d.ts +5 -2
  23. package/dist/runtime/components/model/Select.d.vue.ts +6 -1
  24. package/dist/runtime/components/model/Select.vue +8 -6
  25. package/dist/runtime/components/model/Select.vue.d.ts +6 -1
  26. package/dist/runtime/components/model/Table.d.vue.ts +55 -52
  27. package/dist/runtime/components/model/Table.vue +3 -1
  28. package/dist/runtime/components/model/Table.vue.d.ts +55 -52
  29. package/dist/runtime/components/model/iterator.d.vue.ts +65 -62
  30. package/dist/runtime/components/model/iterator.vue +3 -1
  31. package/dist/runtime/components/model/iterator.vue.d.ts +65 -62
  32. package/dist/runtime/components/model/label.d.vue.ts +2 -0
  33. package/dist/runtime/components/model/label.vue +14 -2
  34. package/dist/runtime/components/model/label.vue.d.ts +2 -0
  35. package/dist/runtime/composables/apiLookupList.d.ts +26 -0
  36. package/dist/runtime/composables/apiLookupList.js +245 -0
  37. package/dist/runtime/composables/apiModel.d.ts +40 -0
  38. package/dist/runtime/composables/apiModel.js +191 -0
  39. package/dist/runtime/composables/apiModelItem.d.ts +16 -0
  40. package/dist/runtime/composables/apiModelItem.js +101 -0
  41. package/package.json +3 -4
  42. package/templates/.codegen/codegen.ts +5 -3
  43. /package/templates/.codegen/{plugin-schema-object.js → plugin-schema-object.cjs} +0 -0
package/README.md CHANGED
@@ -30,6 +30,41 @@ export default defineNuxtConfig({
30
30
 
31
31
  Supported Nuxt versions: `^3.16.0 || ^4.0.0`
32
32
 
33
+ ## Plugin Initialization (Required)
34
+
35
+ After registering the module, apps **must** create a Nuxt plugin that provides `$appGraphql` and `$appAuthentication`. This wires up the module's internal bridge system so that `ModelTable`, `ModelSelect`, `useGraphQl()`, and other model-driven components can resolve GraphQL operations and access authentication state.
36
+
37
+ ```ts
38
+ // app/plugins/graphql.ts (or any plugin name)
39
+ // graphqlOperation, graphqlType, graphqlInputType, scalarType are
40
+ // auto-imported from your generated composables/graphqlObject.ts.
41
+ // useAuthentication is auto-imported from your app/composables/authentication.ts.
42
+
43
+ export default defineNuxtPlugin(() => {
44
+ return {
45
+ provide: {
46
+ appAuthentication: () => useAuthentication(),
47
+ appGraphql: {
48
+ scalarType,
49
+ graphqlType,
50
+ graphqlInputType,
51
+ graphqlOperation,
52
+ },
53
+ },
54
+ }
55
+ })
56
+ ```
57
+
58
+ **`$appGraphql`** — Provides generated GraphQL operation metadata (scalar types, object types, input types, and operations) so `useGraphqlBridge()` and `useGraphqlModelOperation()` inside the module can resolve queries/mutations by name.
59
+
60
+ **`$appAuthentication`** — Provides a factory function returning the app's authentication state (`token`, `hasPermission`, `login`, `logout`, etc.) so the module's `useAuthentication()` bridge can access auth context for API calls and permission checks.
61
+
62
+ Prerequisites:
63
+ 1. Run your GraphQL codegen to generate `composables/graphqlObject.ts` and `types/graphql.ts`.
64
+ 2. Implement `useAuthentication()` in your app returning at minimum `{ token, hasPermission, login, logout }`.
65
+
66
+ See [`playground/plugins/nuxtCommon.ts`](playground/plugins/nuxtCommon.ts) for a working example.
67
+
33
68
  ## What The Module Registers
34
69
 
35
70
  Configured in `src/module.ts`:
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.3.1"
6
6
  },
7
- "version": "4.0.2",
7
+ "version": "4.0.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -58,10 +58,11 @@ function scanImageFile(selectedFile) {
58
58
  const reader = new FileReader();
59
59
  reader.onload = async (event) => {
60
60
  try {
61
- const result = await barcodeReader.decodeFromImageUrl(event.target?.result);
61
+ const imageReader = new BrowserMultiFormatReader();
62
+ const result = await imageReader.decodeFromImageUrl(event.target?.result);
62
63
  emit("decode", result.getText());
63
64
  } catch (e) {
64
- void e;
65
+ emit("error", e);
65
66
  }
66
67
  };
67
68
  reader.readAsDataURL(scanImageSingleFile);
@@ -74,8 +74,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
74
74
  }>;
75
75
  formPad: import("vue").Ref<any, any>;
76
76
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
77
- update: (...args: any[]) => void;
78
77
  create: (...args: any[]) => void;
78
+ update: (...args: any[]) => void;
79
79
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
80
80
  saveCaption: string;
81
81
  cancelCaption: string;
@@ -83,8 +83,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
83
83
  showTitle: boolean;
84
84
  skipValidation: boolean;
85
85
  }>>> & Readonly<{
86
- onUpdate?: ((...args: any[]) => any) | undefined;
87
86
  onCreate?: ((...args: any[]) => any) | undefined;
87
+ onUpdate?: ((...args: any[]) => any) | undefined;
88
88
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
89
89
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
90
90
  declare const _default: typeof __VLS_export;
@@ -74,8 +74,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
74
74
  }>;
75
75
  formPad: import("vue").Ref<any, any>;
76
76
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
77
- update: (...args: any[]) => void;
78
77
  create: (...args: any[]) => void;
78
+ update: (...args: any[]) => void;
79
79
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
80
80
  saveCaption: string;
81
81
  cancelCaption: string;
@@ -83,8 +83,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
83
83
  showTitle: boolean;
84
84
  skipValidation: boolean;
85
85
  }>>> & Readonly<{
86
- onUpdate?: ((...args: any[]) => any) | undefined;
87
86
  onCreate?: ((...args: any[]) => any) | undefined;
87
+ onUpdate?: ((...args: any[]) => any) | undefined;
88
88
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
89
89
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
90
90
  declare const _default: typeof __VLS_export;
@@ -120,16 +120,22 @@ watch(() => props.modelValue, () => {
120
120
  pauseEmit.value = true;
121
121
  if (!props.modelValue) {
122
122
  reset();
123
+ nextTick(() => {
124
+ pauseEmit.value = false;
125
+ });
123
126
  } else {
124
127
  const dateTime = Datetime().fromString(props.modelValue);
125
128
  if (dateTime.luxonDateTime.isValid) {
126
129
  datePart.value = dateTime.toFormat("yyyy-MM-dd");
127
130
  timePart.value = dateTime.toFormat("HH:mm:ss");
131
+ pauseEmit.value = false;
128
132
  } else {
129
133
  reset();
134
+ nextTick(() => {
135
+ pauseEmit.value = false;
136
+ });
130
137
  }
131
138
  }
132
- pauseEmit.value = false;
133
139
  }, { immediate: true });
134
140
  </script>
135
141
 
@@ -45,13 +45,13 @@ type __VLS_Slots = {} & {
45
45
  action?: (props: typeof __VLS_69) => any;
46
46
  };
47
47
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
- update: (...args: any[]) => void;
49
48
  create: (...args: any[]) => void;
49
+ update: (...args: any[]) => void;
50
50
  "update:modelValue": (value: boolean) => void;
51
51
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
52
52
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
53
- onUpdate?: ((...args: any[]) => any) | undefined;
54
53
  onCreate?: ((...args: any[]) => any) | undefined;
54
+ onUpdate?: ((...args: any[]) => any) | undefined;
55
55
  }>, {
56
56
  readonly: boolean;
57
57
  saveCaption: string;
@@ -45,13 +45,13 @@ type __VLS_Slots = {} & {
45
45
  action?: (props: typeof __VLS_69) => any;
46
46
  };
47
47
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
- update: (...args: any[]) => void;
49
48
  create: (...args: any[]) => void;
49
+ update: (...args: any[]) => void;
50
50
  "update:modelValue": (value: boolean) => void;
51
51
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
52
52
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
53
- onUpdate?: ((...args: any[]) => any) | undefined;
54
53
  onCreate?: ((...args: any[]) => any) | undefined;
54
+ onUpdate?: ((...args: any[]) => any) | undefined;
55
55
  }>, {
56
56
  readonly: boolean;
57
57
  saveCaption: string;
@@ -73,8 +73,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
73
73
  }>;
74
74
  formPad: import("vue").Ref<any, any>;
75
75
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
76
- update: (...args: any[]) => void;
77
76
  create: (...args: any[]) => void;
77
+ update: (...args: any[]) => void;
78
78
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
79
79
  saveCaption: string;
80
80
  cancelCaption: string;
@@ -82,8 +82,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
82
82
  showTitle: boolean;
83
83
  skipValidation: boolean;
84
84
  }>>> & Readonly<{
85
- onUpdate?: ((...args: any[]) => any) | undefined;
86
85
  onCreate?: ((...args: any[]) => any) | undefined;
86
+ onUpdate?: ((...args: any[]) => any) | undefined;
87
87
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
88
88
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
89
89
  declare const _default: typeof __VLS_export;
@@ -73,8 +73,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
73
73
  }>;
74
74
  formPad: import("vue").Ref<any, any>;
75
75
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
76
- update: (...args: any[]) => void;
77
76
  create: (...args: any[]) => void;
77
+ update: (...args: any[]) => void;
78
78
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
79
79
  saveCaption: string;
80
80
  cancelCaption: string;
@@ -82,8 +82,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
82
82
  showTitle: boolean;
83
83
  skipValidation: boolean;
84
84
  }>>> & Readonly<{
85
- onUpdate?: ((...args: any[]) => any) | undefined;
86
85
  onCreate?: ((...args: any[]) => any) | undefined;
86
+ onUpdate?: ((...args: any[]) => any) | undefined;
87
87
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
88
88
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
89
89
  declare const _default: typeof __VLS_export;
@@ -13,7 +13,7 @@ watch(() => props.templateId, (newValue) => {
13
13
  }).catch((_error) => {
14
14
  currentTemplate.value = {};
15
15
  });
16
- });
16
+ }, { immediate: true });
17
17
  </script>
18
18
 
19
19
  <template>
@@ -25,8 +25,8 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
25
25
  size: "large" | "medium";
26
26
  label: string;
27
27
  horizontal: boolean;
28
- notFoundText: string;
29
28
  truncate: boolean;
29
+ notFoundText: string;
30
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
32
  declare const _default: typeof __VLS_export;
@@ -25,8 +25,8 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
25
25
  size: "large" | "medium";
26
26
  label: string;
27
27
  horizontal: boolean;
28
- notFoundText: string;
29
28
  truncate: boolean;
29
+ notFoundText: string;
30
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
32
32
  declare const _default: typeof __VLS_export;
@@ -11,7 +11,10 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VAutocomplete['$pr
11
11
  * Public props accepted by ModelAutocomplete.
12
12
  * Document each prop field with intent, defaults, and side effects for clear generated docs.
13
13
  */
14
- type __VLS_Props = Props & LookupProps & PersistSlimProps;
14
+ interface ApiProp {
15
+ api?: boolean;
16
+ }
17
+ type __VLS_Props = Props & LookupProps & PersistSlimProps & ApiProp;
15
18
  type __VLS_ModelProps = {
16
19
  modelValue?: any;
17
20
  };
@@ -33,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
33
36
  activeValue: string;
34
37
  hideInactiveInList: boolean;
35
38
  preventSelectingInactive: boolean;
39
+ api: boolean;
36
40
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
41
  "update:modelValue": (value: any) => any;
38
42
  } & {
@@ -50,6 +54,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
50
54
  activeValue: string;
51
55
  hideInactiveInList: boolean;
52
56
  preventSelectingInactive: boolean;
57
+ api: boolean;
53
58
  }>>> & Readonly<{
54
59
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
55
60
  "onUpdate:selectedObject"?: ((object: any) => any) | undefined;
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { VAutocomplete } from "vuetify/components/VAutocomplete";
3
3
  import { useLookupList } from "../../composables/lookupList";
4
+ import { useApiLookupList } from "../../composables/apiLookupList";
4
5
  import { useLocalStorageModel } from "../../composables/localStorageModel";
5
6
  const props = defineProps({
6
7
  serverSearch: { type: Boolean, required: false, default: false },
@@ -37,7 +38,8 @@ const props = defineProps({
37
38
  persistTtl: { type: Number, required: false },
38
39
  persistEncrypt: { type: Boolean, required: false },
39
40
  persistSecret: { type: String, required: false },
40
- persistAlwaysHydrate: { type: Boolean, required: false }
41
+ persistAlwaysHydrate: { type: Boolean, required: false },
42
+ api: { type: Boolean, required: false, default: false }
41
43
  });
42
44
  const emit = defineEmits(["update:selectedObject"]);
43
45
  const selectedItems = defineModel({ type: null });
@@ -52,7 +54,7 @@ const {
52
54
  isErrorLoading,
53
55
  onUpdateModelValue
54
56
  // ✅ moved into composable
55
- } = useLookupList(props, emit, selectedItems);
57
+ } = props.api ? useApiLookupList(props, emit, selectedItems) : useLookupList(props, emit, selectedItems);
56
58
  </script>
57
59
 
58
60
  <template>
@@ -77,12 +79,12 @@ const {
77
79
  <slot :name="name" v-bind="slotData || {}" />
78
80
  </template>
79
81
 
80
- <template v-if="!$slots.item" #item="{ props: itemProps, item }">
81
- <v-list-item v-bind="itemProps" :title="(props.showCode ? item.value + '-' : '') + item.title" />
82
+ <template v-if="!$slots.item" #item="{ props: itemProps }">
83
+ <v-list-item v-bind="itemProps" :title="(props.showCode ? itemProps.value + '-' : '') + itemProps.title" />
82
84
  </template>
83
85
 
84
- <template v-if="!$slots.selection && props.showCode" #selection="{ item }">
85
- {{ item.value + "-" + item.title }}
86
+ <template v-if="!$slots.selection && props.showCode" #selection="{ internalItem }">
87
+ {{ internalItem.value + "-" + internalItem.title }}
86
88
  </template>
87
89
 
88
90
  <template v-if="isErrorLoading" #append>
@@ -11,7 +11,10 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VAutocomplete['$pr
11
11
  * Public props accepted by ModelAutocomplete.
12
12
  * Document each prop field with intent, defaults, and side effects for clear generated docs.
13
13
  */
14
- type __VLS_Props = Props & LookupProps & PersistSlimProps;
14
+ interface ApiProp {
15
+ api?: boolean;
16
+ }
17
+ type __VLS_Props = Props & LookupProps & PersistSlimProps & ApiProp;
15
18
  type __VLS_ModelProps = {
16
19
  modelValue?: any;
17
20
  };
@@ -33,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
33
36
  activeValue: string;
34
37
  hideInactiveInList: boolean;
35
38
  preventSelectingInactive: boolean;
39
+ api: boolean;
36
40
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
41
  "update:modelValue": (value: any) => any;
38
42
  } & {
@@ -50,6 +54,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
50
54
  activeValue: string;
51
55
  hideInactiveInList: boolean;
52
56
  preventSelectingInactive: boolean;
57
+ api: boolean;
53
58
  }>>> & Readonly<{
54
59
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
55
60
  "onUpdate:selectedObject"?: ((object: any) => any) | undefined;
@@ -11,7 +11,10 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VCombobox['$props'
11
11
  * Public props accepted by ModelCombobox.
12
12
  * Document each prop field with intent, defaults, and side effects for clear generated docs.
13
13
  */
14
- type __VLS_Props = Props & LookupProps & PersistSlimProps;
14
+ interface ApiProp {
15
+ api?: boolean;
16
+ }
17
+ type __VLS_Props = Props & LookupProps & PersistSlimProps & ApiProp;
15
18
  type __VLS_ModelProps = {
16
19
  modelValue?: any;
17
20
  };
@@ -33,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
33
36
  activeValue: string;
34
37
  hideInactiveInList: boolean;
35
38
  preventSelectingInactive: boolean;
39
+ api: boolean;
36
40
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
41
  "update:modelValue": (value: any) => any;
38
42
  } & {
@@ -50,6 +54,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
50
54
  activeValue: string;
51
55
  hideInactiveInList: boolean;
52
56
  preventSelectingInactive: boolean;
57
+ api: boolean;
53
58
  }>>> & Readonly<{
54
59
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
55
60
  "onUpdate:selectedObject"?: ((object: any) => any) | undefined;
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { VCombobox } from "vuetify/components/VCombobox";
3
3
  import { useLookupList } from "../../composables/lookupList";
4
+ import { useApiLookupList } from "../../composables/apiLookupList";
4
5
  import { useLocalStorageModel } from "../../composables/localStorageModel";
5
6
  const props = defineProps({
6
7
  serverSearch: { type: Boolean, required: false, default: false },
@@ -37,7 +38,8 @@ const props = defineProps({
37
38
  persistTtl: { type: Number, required: false },
38
39
  persistEncrypt: { type: Boolean, required: false },
39
40
  persistSecret: { type: String, required: false },
40
- persistAlwaysHydrate: { type: Boolean, required: false }
41
+ persistAlwaysHydrate: { type: Boolean, required: false },
42
+ api: { type: Boolean, required: false, default: false }
41
43
  });
42
44
  const emit = defineEmits(["update:selectedObject"]);
43
45
  const selectedItems = defineModel({ type: null });
@@ -52,7 +54,7 @@ const {
52
54
  isErrorLoading,
53
55
  onUpdateModelValue
54
56
  // ✅ from composable
55
- } = useLookupList(props, emit, selectedItems);
57
+ } = props.api ? useApiLookupList(props, emit, selectedItems) : useLookupList(props, emit, selectedItems);
56
58
  </script>
57
59
 
58
60
  <template>
@@ -78,12 +80,12 @@ const {
78
80
  <slot :name="name" v-bind="slotData || {}" />
79
81
  </template>
80
82
 
81
- <template v-if="!$slots.item" #item="{ props: itemProps, item }">
82
- <v-list-item v-bind="itemProps" :title="(props.showCode ? item.value + '-' : '') + item.title" />
83
+ <template v-if="!$slots.item" #item="{ props: itemProps }">
84
+ <v-list-item v-bind="itemProps" :title="(props.showCode ? itemProps.value + '-' : '') + itemProps.title" />
83
85
  </template>
84
86
 
85
- <template v-if="!$slots.selection && props.showCode" #selection="{ item }">
86
- {{ item.value + "-" + item.title }}
87
+ <template v-if="!$slots.selection && props.showCode" #selection="{ internalItem }">
88
+ {{ internalItem.value + "-" + internalItem.title }}
87
89
  </template>
88
90
 
89
91
  <template v-if="isErrorLoading" #append>
@@ -11,7 +11,10 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VCombobox['$props'
11
11
  * Public props accepted by ModelCombobox.
12
12
  * Document each prop field with intent, defaults, and side effects for clear generated docs.
13
13
  */
14
- type __VLS_Props = Props & LookupProps & PersistSlimProps;
14
+ interface ApiProp {
15
+ api?: boolean;
16
+ }
17
+ type __VLS_Props = Props & LookupProps & PersistSlimProps & ApiProp;
15
18
  type __VLS_ModelProps = {
16
19
  modelValue?: any;
17
20
  };
@@ -33,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
33
36
  activeValue: string;
34
37
  hideInactiveInList: boolean;
35
38
  preventSelectingInactive: boolean;
39
+ api: boolean;
36
40
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
41
  "update:modelValue": (value: any) => any;
38
42
  } & {
@@ -50,6 +54,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
50
54
  activeValue: string;
51
55
  hideInactiveInList: boolean;
52
56
  preventSelectingInactive: boolean;
57
+ api: boolean;
53
58
  }>>> & Readonly<{
54
59
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
55
60
  "onUpdate:selectedObject"?: ((object: any) => any) | undefined;
@@ -4,6 +4,7 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof EditPad['$props']>
4
4
  title?: string;
5
5
  saveCaption?: string;
6
6
  cancelCaption?: string;
7
+ api?: boolean;
7
8
  }
8
9
  /**
9
10
  * Public props accepted by ModelPad.
@@ -30,19 +31,21 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
30
31
  fields: () => string[];
31
32
  saveCaption: string;
32
33
  cancelCaption: string;
34
+ api: boolean;
33
35
  }>>, {
34
36
  operation: any;
35
37
  formPad: any;
36
38
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
- update: (...args: any[]) => void;
38
39
  create: (...args: any[]) => void;
40
+ update: (...args: any[]) => void;
39
41
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
40
42
  fields: () => string[];
41
43
  saveCaption: string;
42
44
  cancelCaption: string;
45
+ api: boolean;
43
46
  }>>> & Readonly<{
44
- onUpdate?: ((...args: any[]) => any) | undefined;
45
47
  onCreate?: ((...args: any[]) => any) | undefined;
48
+ onUpdate?: ((...args: any[]) => any) | undefined;
46
49
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
47
50
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
48
51
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, useTemplateRef } from "vue";
3
3
  import { useGraphqlModelItem } from "../../composables/graphqlModelItem";
4
+ import { useApiModelItem } from "../../composables/apiModelItem";
4
5
  import EditPad from "../form/EditPad.vue";
5
6
  import { useDialog } from "../../composables/dialog";
6
7
  defineOptions({
@@ -10,6 +11,7 @@ const props = defineProps({
10
11
  title: { type: String, required: false },
11
12
  saveCaption: { type: String, required: false, default: "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01" },
12
13
  cancelCaption: { type: String, required: false, default: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01" },
14
+ api: { type: Boolean, required: false, default: false },
13
15
  modelName: { type: String, required: true },
14
16
  modelKey: { type: String, required: false },
15
17
  modelBy: { type: Object, required: false },
@@ -28,7 +30,7 @@ const {
28
30
  updateItem,
29
31
  reload,
30
32
  isLoading
31
- } = useGraphqlModelItem(props);
33
+ } = props.api ? useApiModelItem(props) : useGraphqlModelItem(props);
32
34
  const editPad = useTemplateRef("editPadRef");
33
35
  const canSave = computed(() => {
34
36
  return canCreate.value && editPad.value?.operation?.isCreating?.value || canUpdate.value;
@@ -4,6 +4,7 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof EditPad['$props']>
4
4
  title?: string;
5
5
  saveCaption?: string;
6
6
  cancelCaption?: string;
7
+ api?: boolean;
7
8
  }
8
9
  /**
9
10
  * Public props accepted by ModelPad.
@@ -30,19 +31,21 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
30
31
  fields: () => string[];
31
32
  saveCaption: string;
32
33
  cancelCaption: string;
34
+ api: boolean;
33
35
  }>>, {
34
36
  operation: any;
35
37
  formPad: any;
36
38
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
- update: (...args: any[]) => void;
38
39
  create: (...args: any[]) => void;
40
+ update: (...args: any[]) => void;
39
41
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
40
42
  fields: () => string[];
41
43
  saveCaption: string;
42
44
  cancelCaption: string;
45
+ api: boolean;
43
46
  }>>> & Readonly<{
44
- onUpdate?: ((...args: any[]) => any) | undefined;
45
47
  onCreate?: ((...args: any[]) => any) | undefined;
48
+ onUpdate?: ((...args: any[]) => any) | undefined;
46
49
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
47
50
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
48
51
  declare const _default: typeof __VLS_export;
@@ -11,7 +11,10 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VSelect['$props']>
11
11
  * Public props accepted by ModelSelect.
12
12
  * Document each prop field with intent, defaults, and side effects for clear generated docs.
13
13
  */
14
- type __VLS_Props = Props & StaticLookupProps & PersistSlimProps;
14
+ interface ApiProp {
15
+ api?: boolean;
16
+ }
17
+ type __VLS_Props = Props & StaticLookupProps & PersistSlimProps & ApiProp;
15
18
  type __VLS_ModelProps = {
16
19
  modelValue?: any;
17
20
  };
@@ -28,6 +31,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
28
31
  activeValue: string;
29
32
  hideInactiveInList: boolean;
30
33
  preventSelectingInactive: boolean;
34
+ api: boolean;
31
35
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
36
  "update:modelValue": (value: any) => any;
33
37
  } & {
@@ -40,6 +44,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
40
44
  activeValue: string;
41
45
  hideInactiveInList: boolean;
42
46
  preventSelectingInactive: boolean;
47
+ api: boolean;
43
48
  }>>> & Readonly<{
44
49
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
45
50
  "onUpdate:selectedObject"?: ((object: any) => any) | undefined;
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { VSelect } from "vuetify/components/VSelect";
3
3
  import { useLookupList } from "../../composables/lookupList";
4
+ import { useApiLookupList } from "../../composables/apiLookupList";
4
5
  import { useLocalStorageModel } from "../../composables/localStorageModel";
5
6
  const props = defineProps({
6
7
  fuzzy: { type: Boolean, required: false, default: false },
@@ -28,7 +29,8 @@ const props = defineProps({
28
29
  persistTtl: { type: Number, required: false },
29
30
  persistEncrypt: { type: Boolean, required: false },
30
31
  persistSecret: { type: String, required: false },
31
- persistAlwaysHydrate: { type: Boolean, required: false }
32
+ persistAlwaysHydrate: { type: Boolean, required: false },
33
+ api: { type: Boolean, required: false, default: false }
32
34
  });
33
35
  const emit = defineEmits(["update:selectedObject"]);
34
36
  const selectedItems = defineModel({ type: null });
@@ -39,7 +41,7 @@ const {
39
41
  isLoading,
40
42
  isErrorLoading,
41
43
  onUpdateModelValue
42
- } = useLookupList(props, emit, selectedItems);
44
+ } = props.api ? useApiLookupList(props, emit, selectedItems) : useLookupList(props, emit, selectedItems);
43
45
  </script>
44
46
 
45
47
  <template>
@@ -61,12 +63,12 @@ const {
61
63
  <slot :name="name" v-bind="slotData || {}" />
62
64
  </template>
63
65
 
64
- <template v-if="!$slots.item" #item="{ props: itemProps, item }">
65
- <v-list-item v-bind="itemProps" :title="(props.showCode ? item.value + '-' : '') + item.title" />
66
+ <template v-if="!$slots.item" #item="{ props: itemProps }">
67
+ <v-list-item v-bind="itemProps" :title="(props.showCode ? itemProps.value + '-' : '') + itemProps.title" />
66
68
  </template>
67
69
 
68
- <template v-if="!$slots.selection && props.showCode" #selection="{ item }">
69
- {{ item.value + "-" + item.title }}
70
+ <template v-if="!$slots.selection && props.showCode" #selection="{ internalItem }">
71
+ {{ internalItem.value + "-" + internalItem.title }}
70
72
  </template>
71
73
 
72
74
  <template v-if="isErrorLoading" #append>
@@ -11,7 +11,10 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VSelect['$props']>
11
11
  * Public props accepted by ModelSelect.
12
12
  * Document each prop field with intent, defaults, and side effects for clear generated docs.
13
13
  */
14
- type __VLS_Props = Props & StaticLookupProps & PersistSlimProps;
14
+ interface ApiProp {
15
+ api?: boolean;
16
+ }
17
+ type __VLS_Props = Props & StaticLookupProps & PersistSlimProps & ApiProp;
15
18
  type __VLS_ModelProps = {
16
19
  modelValue?: any;
17
20
  };
@@ -28,6 +31,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
28
31
  activeValue: string;
29
32
  hideInactiveInList: boolean;
30
33
  preventSelectingInactive: boolean;
34
+ api: boolean;
31
35
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
36
  "update:modelValue": (value: any) => any;
33
37
  } & {
@@ -40,6 +44,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
40
44
  activeValue: string;
41
45
  hideInactiveInList: boolean;
42
46
  preventSelectingInactive: boolean;
47
+ api: boolean;
43
48
  }>>> & Readonly<{
44
49
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
45
50
  "onUpdate:selectedObject"?: ((object: any) => any) | undefined;