@ramathibodi/nuxt-commons 4.0.16 → 4.0.17

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 (29) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/device/IdCardButton.d.vue.ts +2 -2
  4. package/dist/runtime/components/device/IdCardButton.vue.d.ts +2 -2
  5. package/dist/runtime/components/dialog/Confirm.d.vue.ts +1 -1
  6. package/dist/runtime/components/dialog/Confirm.vue.d.ts +1 -1
  7. package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +2 -2
  8. package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +2 -2
  9. package/dist/runtime/components/dialog/default/Notify.d.vue.ts +3 -3
  10. package/dist/runtime/components/dialog/default/Notify.vue.d.ts +3 -3
  11. package/dist/runtime/components/dialog/default/VerifyUser.d.vue.ts +2 -2
  12. package/dist/runtime/components/dialog/default/VerifyUser.vue.d.ts +2 -2
  13. package/dist/runtime/components/form/CheckboxGroup.vue +2 -2
  14. package/dist/runtime/components/form/DateTime.d.vue.ts +1 -1
  15. package/dist/runtime/components/form/DateTime.vue.d.ts +1 -1
  16. package/dist/runtime/components/form/Login.d.vue.ts +1 -1
  17. package/dist/runtime/components/form/Login.vue.d.ts +1 -1
  18. package/dist/runtime/components/form/Pad.d.vue.ts +1 -1
  19. package/dist/runtime/components/form/Pad.vue +1 -1
  20. package/dist/runtime/components/form/Pad.vue.d.ts +1 -1
  21. package/dist/runtime/components/form/images/Capture.d.vue.ts +1 -1
  22. package/dist/runtime/components/form/images/Capture.vue.d.ts +1 -1
  23. package/dist/runtime/components/label/Field.d.vue.ts +2 -2
  24. package/dist/runtime/components/label/Field.vue.d.ts +2 -2
  25. package/dist/runtime/labs/Calendar.d.vue.ts +4 -4
  26. package/dist/runtime/labs/Calendar.vue.d.ts +4 -4
  27. package/dist/runtime/types/api.d.ts +36 -0
  28. package/package.json +1 -1
  29. package/templates/.codegen/plugin-schema-object.cjs +1 -1
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.3.1"
6
6
  },
7
- "version": "4.0.16",
7
+ "version": "4.0.17",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -36,7 +36,7 @@ const module$1 = defineNuxtModule({
36
36
  src: resolver.resolve("runtime/plugins/default"),
37
37
  mode: "client"
38
38
  });
39
- const typeFiles = ["modules", "alert", "menu", "graphqlOperation", "formDialog", "dialogManager", "permission", "clientConfig", "bridge"];
39
+ const typeFiles = ["modules", "alert", "menu", "graphqlOperation", "api", "formDialog", "dialogManager", "permission", "clientConfig", "bridge"];
40
40
  for (const file of typeFiles) {
41
41
  addTypeTemplate({
42
42
  src: resolver.resolve(`runtime/types/${file}.d.ts`),
@@ -17,16 +17,16 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
17
17
  reader: null;
18
18
  disableWhileLoading: boolean;
19
19
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
20
- loading: (loading: boolean) => any;
21
20
  error: (err: unknown) => any;
21
+ loading: (loading: boolean) => any;
22
22
  read: (payload: PatientRegisterPayload) => any;
23
23
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
24
24
  withPhoto: boolean;
25
25
  reader: null;
26
26
  disableWhileLoading: boolean;
27
27
  }>>> & Readonly<{
28
- onLoading?: ((loading: boolean) => any) | undefined;
29
28
  onError?: ((err: unknown) => any) | undefined;
29
+ onLoading?: ((loading: boolean) => any) | undefined;
30
30
  onRead?: ((payload: PatientRegisterPayload) => any) | undefined;
31
31
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -17,16 +17,16 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
17
17
  reader: null;
18
18
  disableWhileLoading: boolean;
19
19
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
20
- loading: (loading: boolean) => any;
21
20
  error: (err: unknown) => any;
21
+ loading: (loading: boolean) => any;
22
22
  read: (payload: PatientRegisterPayload) => any;
23
23
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
24
24
  withPhoto: boolean;
25
25
  reader: null;
26
26
  disableWhileLoading: boolean;
27
27
  }>>> & Readonly<{
28
- onLoading?: ((loading: boolean) => any) | undefined;
29
28
  onError?: ((err: unknown) => any) | undefined;
29
+ onLoading?: ((loading: boolean) => any) | undefined;
30
30
  onRead?: ((payload: PatientRegisterPayload) => any) | undefined;
31
31
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
32
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -21,9 +21,9 @@ declare const __VLS_base: import("vue").DefineComponent<DialogProps, {}, {}, {},
21
21
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
22
22
  "onUpdate:result"?: ((value: boolean) => any) | undefined;
23
23
  }>, {
24
- title: string;
25
24
  message: string;
26
25
  width: string;
26
+ title: string;
27
27
  buttonTrueText: string;
28
28
  buttonFalseText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -21,9 +21,9 @@ declare const __VLS_base: import("vue").DefineComponent<DialogProps, {}, {}, {},
21
21
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
22
22
  "onUpdate:result"?: ((value: boolean) => any) | undefined;
23
23
  }>, {
24
- title: string;
25
24
  message: string;
26
25
  width: string;
26
+ title: string;
27
27
  buttonTrueText: string;
28
28
  buttonFalseText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -23,10 +23,10 @@ declare const __VLS_base: import("vue").DefineComponent<DialogProps, {}, {}, {},
23
23
  onResolve?: ((value: boolean) => any) | undefined;
24
24
  onReject?: ((value: any) => any) | undefined;
25
25
  }>, {
26
- title: string;
27
- type: "primary" | "success" | "warning" | "info" | "error";
28
26
  message: string;
29
27
  width: string;
28
+ title: string;
29
+ type: "primary" | "success" | "warning" | "info" | "error";
30
30
  buttonTrueText: string;
31
31
  buttonFalseText: string;
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -23,10 +23,10 @@ declare const __VLS_base: import("vue").DefineComponent<DialogProps, {}, {}, {},
23
23
  onResolve?: ((value: boolean) => any) | undefined;
24
24
  onReject?: ((value: any) => any) | undefined;
25
25
  }>, {
26
- title: string;
27
- type: "primary" | "success" | "warning" | "info" | "error";
28
26
  message: string;
29
27
  width: string;
28
+ title: string;
29
+ type: "primary" | "success" | "warning" | "info" | "error";
30
30
  buttonTrueText: string;
31
31
  buttonFalseText: string;
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -13,11 +13,11 @@ declare const __VLS_export: import("vue").DefineComponent<DialogProps, {}, {}, {
13
13
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
14
14
  onResolve?: ((value: boolean) => any) | undefined;
15
15
  }>, {
16
- title: string;
17
- buttonText: string;
18
- type: "primary" | "success" | "warning" | "info" | "error";
19
16
  message: string;
20
17
  width: string;
18
+ title: string;
19
+ type: "primary" | "success" | "warning" | "info" | "error";
20
+ buttonText: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const _default: typeof __VLS_export;
23
23
  export default _default;
@@ -13,11 +13,11 @@ declare const __VLS_export: import("vue").DefineComponent<DialogProps, {}, {}, {
13
13
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
14
14
  onResolve?: ((value: boolean) => any) | undefined;
15
15
  }>, {
16
- title: string;
17
- buttonText: string;
18
- type: "primary" | "success" | "warning" | "info" | "error";
19
16
  message: string;
20
17
  width: string;
18
+ title: string;
19
+ type: "primary" | "success" | "warning" | "info" | "error";
20
+ buttonText: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const _default: typeof __VLS_export;
23
23
  export default _default;
@@ -17,10 +17,10 @@ declare const __VLS_export: import("vue").DefineComponent<DialogProps, {}, {}, {
17
17
  onResolve?: ((value: string) => any) | undefined;
18
18
  onReject?: ((value: any) => any) | undefined;
19
19
  }>, {
20
- title: string;
21
- type: "primary" | "success" | "warning" | "info" | "error";
22
20
  message: string;
23
21
  width: string;
22
+ title: string;
23
+ type: "primary" | "success" | "warning" | "info" | "error";
24
24
  confirmButtonText: string;
25
25
  cancelButtonText: string;
26
26
  fixedUsername: boolean | string;
@@ -17,10 +17,10 @@ declare const __VLS_export: import("vue").DefineComponent<DialogProps, {}, {}, {
17
17
  onResolve?: ((value: string) => any) | undefined;
18
18
  onReject?: ((value: any) => any) | undefined;
19
19
  }>, {
20
- title: string;
21
- type: "primary" | "success" | "warning" | "info" | "error";
22
20
  message: string;
23
21
  width: string;
22
+ title: string;
23
+ type: "primary" | "success" | "warning" | "info" | "error";
24
24
  confirmButtonText: string;
25
25
  cancelButtonText: string;
26
26
  fixedUsername: boolean | string;
@@ -71,7 +71,7 @@ watch(props.modelValue, () => {
71
71
  :value="item.value"
72
72
  density="compact"
73
73
  hide-details
74
- :error="isValid === false"
74
+ :error="isValid.value === false"
75
75
  :="$attrs"
76
76
  :label="item.label"
77
77
  @update:model-value="onInteract"
@@ -81,7 +81,7 @@ watch(props.modelValue, () => {
81
81
  v-if="computedOther"
82
82
  v-model="valuesOther"
83
83
  hide-details
84
- :error="isValid === false"
84
+ :error="isValid.value === false"
85
85
  :="$attrs"
86
86
  :label="computedOther.label"
87
87
  @update:model-value="onInteract"
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
22
22
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
23
23
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
24
24
  }>, {
25
+ readonly: boolean;
25
26
  locale: "TH" | "EN";
26
27
  format: dateFormat | string;
27
- readonly: boolean;
28
28
  dense: boolean;
29
29
  pickerOnly: boolean;
30
30
  defaultDate: boolean | string;
@@ -22,9 +22,9 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
22
22
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
23
23
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
24
24
  }>, {
25
+ readonly: boolean;
25
26
  locale: "TH" | "EN";
26
27
  format: dateFormat | string;
27
- readonly: boolean;
28
28
  dense: boolean;
29
29
  pickerOnly: boolean;
30
30
  defaultDate: boolean | string;
@@ -15,8 +15,8 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
15
15
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
16
16
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
17
17
  }>, {
18
- title: string;
19
18
  loading: boolean;
19
+ title: string;
20
20
  errorMessages: string;
21
21
  hint: string;
22
22
  btnSubmit: string;
@@ -15,8 +15,8 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
15
15
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
16
16
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
17
17
  }>, {
18
- title: string;
19
18
  loading: boolean;
19
+ title: string;
20
20
  errorMessages: string;
21
21
  hint: string;
22
22
  btnSubmit: string;
@@ -681,9 +681,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {
681
681
  }>, {
682
682
  disabled: boolean;
683
683
  readonly: boolean;
684
+ parentTemplates: string | string[];
684
685
  isolated: boolean;
685
686
  decoration: object;
686
- parentTemplates: string | string[];
687
687
  dirtyClass: string;
688
688
  dirtyOnCreate: boolean;
689
689
  sanitizeDelay: number;
@@ -313,5 +313,5 @@ defineExpose({
313
313
  </template>
314
314
 
315
315
  <style>
316
- .form-data-dirty:not(.v-input--error) :not(.v-chip):not(.v-chip *):not(.v-toolbar):not(.v-toolbar *){color:color-mix(in srgb,currentColor 70%,rgb(var(--v-theme-primary)))!important;text-shadow:0 0 .02em currentColor}
316
+ .form-data-dirty:not(.v-input--error) :not(.v-chip):not(.v-chip *):not(.v-toolbar):not(.v-toolbar *):not(.dp__main):not(.dp__main *){color:color-mix(in srgb,currentColor 70%,rgb(var(--v-theme-primary)))!important;text-shadow:0 0 .02em currentColor}
317
317
  </style>
@@ -681,9 +681,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {
681
681
  }>, {
682
682
  disabled: boolean;
683
683
  readonly: boolean;
684
+ parentTemplates: string | string[];
684
685
  isolated: boolean;
685
686
  decoration: object;
686
- parentTemplates: string | string[];
687
687
  dirtyClass: string;
688
688
  dirtyOnCreate: boolean;
689
689
  sanitizeDelay: number;
@@ -78,10 +78,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
78
78
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
79
79
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
80
80
  }>, {
81
- buttonText: string;
82
81
  disabled: boolean;
83
82
  maxWidth: string | number;
84
83
  readonly: boolean;
84
+ buttonText: string;
85
85
  imageFormat: ImageFormat;
86
86
  autoStart: boolean;
87
87
  fileOnly: boolean;
@@ -78,10 +78,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
78
78
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
79
79
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
80
80
  }>, {
81
- buttonText: string;
82
81
  disabled: boolean;
83
82
  maxWidth: string | number;
84
83
  readonly: boolean;
84
+ buttonText: string;
85
85
  imageFormat: ImageFormat;
86
86
  autoStart: boolean;
87
87
  fileOnly: boolean;
@@ -22,11 +22,11 @@ type __VLS_Slots = {} & {
22
22
  };
23
23
  declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
24
24
  value: string | null;
25
- label: string;
26
25
  size: "large" | "medium";
26
+ label: string;
27
27
  horizontal: boolean;
28
- truncate: boolean;
29
28
  notFoundText: string;
29
+ truncate: boolean;
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;
@@ -22,11 +22,11 @@ type __VLS_Slots = {} & {
22
22
  };
23
23
  declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
24
24
  value: string | null;
25
- label: string;
26
25
  size: "large" | "medium";
26
+ label: string;
27
27
  horizontal: boolean;
28
- truncate: boolean;
29
28
  notFoundText: string;
29
+ truncate: boolean;
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;
@@ -18,18 +18,18 @@ interface CalendarProps {
18
18
  mode: 'dayGridMonth' | 'timeGridDay';
19
19
  }
20
20
  declare const __VLS_export: import("vue").DefineComponent<CalendarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
- select: (...args: any[]) => void;
22
21
  dialog: (...args: any[]) => void;
22
+ select: (...args: any[]) => void;
23
23
  }, string, import("vue").PublicProps, Readonly<CalendarProps> & Readonly<{
24
- onSelect?: ((...args: any[]) => any) | undefined;
25
24
  onDialog?: ((...args: any[]) => any) | undefined;
25
+ onSelect?: ((...args: any[]) => any) | undefined;
26
26
  }>, {
27
+ height: string | number;
28
+ mode: "dayGridMonth" | "timeGridDay";
27
29
  locale: "th" | "en";
28
30
  toolBarLeft: string;
29
31
  toolBarCenter: string;
30
32
  toolBarRight: string;
31
- height: string | number;
32
- mode: "dayGridMonth" | "timeGridDay";
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  export default _default;
@@ -18,18 +18,18 @@ interface CalendarProps {
18
18
  mode: 'dayGridMonth' | 'timeGridDay';
19
19
  }
20
20
  declare const __VLS_export: import("vue").DefineComponent<CalendarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
- select: (...args: any[]) => void;
22
21
  dialog: (...args: any[]) => void;
22
+ select: (...args: any[]) => void;
23
23
  }, string, import("vue").PublicProps, Readonly<CalendarProps> & Readonly<{
24
- onSelect?: ((...args: any[]) => any) | undefined;
25
24
  onDialog?: ((...args: any[]) => any) | undefined;
25
+ onSelect?: ((...args: any[]) => any) | undefined;
26
26
  }>, {
27
+ height: string | number;
28
+ mode: "dayGridMonth" | "timeGridDay";
27
29
  locale: "th" | "en";
28
30
  toolBarLeft: string;
29
31
  toolBarCenter: string;
30
32
  toolBarRight: string;
31
- height: string | number;
32
- mode: "dayGridMonth" | "timeGridDay";
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  export default _default;
@@ -0,0 +1,36 @@
1
+ // Self-contained type template surfaced through `#build/types/api` via
2
+ // `addTypeTemplate` in src/module.ts (mirrors runtime/types/graphqlOperation.d.ts).
3
+ //
4
+ // Why a dedicated template instead of relying on `#imports`:
5
+ // `ApiIdempotencyOption` / `ApiFetchOptions` are **type-only** exports of
6
+ // src/runtime/composables/api.ts. In the playground `#imports` resolves them
7
+ // because unimport scans the TypeScript source, but a consumer installing the
8
+ // built package scans the compiled `.js` where interfaces are erased — so the
9
+ // types never land in the consumer's `#imports` and the codegen-generated
10
+ // `graphqlObject.ts` (`import type { ApiIdempotencyOption } from ...`) fails
11
+ // vue-tsc with TS2305 (see issue #253).
12
+ //
13
+ // This file must stay **self-contained** (no relative imports of ../composables/*)
14
+ // because type templates are copied verbatim into `.nuxt/types/`, where a relative
15
+ // path back into `src/` would not resolve. Keep these declarations in sync with
16
+ // src/runtime/composables/api.ts — that composable remains the runtime source of truth.
17
+ import type { UseFetchOptions } from 'nuxt/app'
18
+
19
+ /**
20
+ * Per-call options accepted by useApi alongside Nuxt's UseFetchOptions.
21
+ *
22
+ * `idempotent: false` skips Idempotency-Key header injection for this single call.
23
+ * Default is `true`. See the useApi() docblock for the full idempotency contract.
24
+ */
25
+ export interface ApiIdempotencyOption {
26
+ idempotent?: boolean
27
+ /**
28
+ * Optional discriminator folded as a trailing component into the
29
+ * Idempotency-Key hash: SHA-256(`<second>|<username>|<body>|<salt>`).
30
+ * Lets legitimately-identical payloads (e.g. duplicate bulk-import rows)
31
+ * resolve to distinct keys without weakening dedup elsewhere.
32
+ */
33
+ idempotencySalt?: string | number
34
+ }
35
+
36
+ export type ApiFetchOptions = UseFetchOptions<unknown> & ApiIdempotencyOption
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramathibodi/nuxt-commons",
3
- "version": "4.0.16",
3
+ "version": "4.0.17",
4
4
  "description": "Ramathibodi Nuxt modules for common components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -104,7 +104,7 @@ module.exports = {
104
104
  return `
105
105
  import * as graphQlClass from "~/types/graphql"
106
106
  import { useGraphQlOperation } from "#imports";
107
- import type { ApiIdempotencyOption } from "#imports";
107
+ import type { ApiIdempotencyOption } from "#build/types/api";
108
108
  import type {
109
109
  graphqlInputObject,
110
110
  graphqlOperationObject,