@dynamicforms/vuetify-inputs 0.10.1 → 0.10.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/index.d.ts CHANGED
@@ -454,6 +454,9 @@ clearable: boolean;
454
454
 
455
455
  declare interface DfFileProps extends BaseProps {
456
456
  comms: FileComms;
457
+ /** Milliseconds between keep-alive touches. Overrides `defaultTouchInterval` from the plugin's
458
+ * `VuetifyInputsSettings`, which in turn overrides the baked-in default of 60000. */
459
+ touchInterval?: number;
457
460
  }
458
461
 
459
462
  export declare const DfImage: DefineComponent<DfImageProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
@@ -476,6 +479,9 @@ fileInputRef: HTMLInputElement;
476
479
  */
477
480
  declare interface DfImageProps extends BaseProps {
478
481
  comms: FileComms;
482
+ /** Milliseconds between keep-alive touches. Overrides `defaultTouchInterval` from the plugin's
483
+ * `VuetifyInputsSettings`, which in turn overrides the baked-in default of 60000. */
484
+ touchInterval?: number;
479
485
  }
480
486
 
481
487
  export declare const DfInput: DefineComponent<DfInputProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
@@ -891,16 +897,36 @@ export declare interface FileComms {
891
897
  upload: (file: File, progressCallback?: FileProgressCallback) => Promise<string>;
892
898
  /**
893
899
  * delete is called when the file is removed from the input and needs to be deleted at the backend
900
+ *
901
+ * throw {@link FileGoneError} if the backend reports the file identifier is already gone; any other thrown
902
+ * error is treated as a transient failure
903
+ *
894
904
  * @param fileIdentifier the identifier that was returned by upload
895
905
  */
896
906
  delete: (fileIdentifier: string) => Promise<void>;
897
907
  /**
898
- * touch is called once per minute to let the backend know that the file is still in play and must not be discarded
908
+ * touch is called at a regular interval (see the `touchInterval` prop / `defaultTouchInterval` setting) to let
909
+ * the backend know that the file is still in play and must not be discarded
910
+ *
911
+ * throw {@link FileGoneError} if the backend reports the file identifier no longer exists; any other thrown
912
+ * error is treated as a transient failure and left to the consumer to act on, if at all
913
+ *
899
914
  * @param fileIdentifier the identifier that was returned by upload
900
915
  */
901
916
  touch: (fileIdentifier: string) => Promise<void>;
902
917
  }
903
918
 
919
+ /**
920
+ * Thrown by `FileComms.touch` or `FileComms.delete` when the backend confirms the file identifier no longer
921
+ * exists there (e.g. its keep-alive TTL expired). The component reacts to this specific type by clearing the
922
+ * field and, where a `control` is bound, showing `errorText` as a validation error. Any other thrown error is
923
+ * treated as transient and left entirely to the consumer.
924
+ */
925
+ export declare class FileGoneError extends Error {
926
+ errorText: string;
927
+ constructor(errorText: string);
928
+ }
929
+
904
930
  export declare type FileProgressCallback = (loaded: number, total: number) => void;
905
931
 
906
932
  export declare function getBreakpointName(dp: ReturnType<typeof useDisplay>): BreakpointNames;
@@ -952,6 +978,13 @@ export declare interface SelectChoice {
952
978
 
953
979
  export declare type SelectFetchChoices<T1 = any, T2 = any> = (queryValue?: T1, idValue?: T2) => Promise<SelectChoice[]>;
954
980
 
981
+ /**
982
+ * Reports a {@link FileGoneError}'s message on `control`, where one is bound. Kept outside the component's own
983
+ * script so the write to `control.errors` isn't seen as a `.vue` component mutating its own prop — the write
984
+ * goes through `Form.FieldBase`'s own setter, the same way `useInputBase`'s `touched` does.
985
+ */
986
+ export declare function setFileGoneError(control: default_2.FieldBase | undefined, errorText: string): void;
987
+
955
988
  declare type ShowAsGroup = 'no' | 'grouped' | 'grouped-no-borders';
956
989
 
957
990
  export declare const translatableStrings: {
@@ -1020,6 +1053,17 @@ export declare function translateStrings(translationCallback: (s: string) => str
1020
1053
 
1021
1054
  export declare function useBreakpoint(): ComputedRef<"xs" | "sm" | "md" | "lg" | "xl">;
1022
1055
 
1056
+ /**
1057
+ * Runs the `comms.touch` keep-alive interval for `<df-file>`/`<df-image>` while `value` holds a file
1058
+ * identifier: starts it once `value` becomes truthy, stops it once it doesn't, and stops it on unmount.
1059
+ * `onGone` is called with `err.errorText` whenever a touch rejects with a {@link FileGoneError}; any other
1060
+ * rejection is left unhandled beyond that (it's a transient failure, for the consumer to act on if at all).
1061
+ */
1062
+ export declare function useFileTouchKeepAlive(value: Ref<string | null>, comms: () => FileComms, touchIntervalProp: () => number | undefined, onGone: (errorText: string) => void): {
1063
+ setupTouchInterval: () => void;
1064
+ clearTouchInterval: () => void;
1065
+ };
1066
+
1023
1067
  export declare function useInputBase<T = any>(props: BaseProps<T>, emit: BaseEmits<T>): {
1024
1068
  value: WritableComputedRef<T, T>;
1025
1069
  valid: ComputedRef<boolean>;
@@ -1088,6 +1132,9 @@ export declare type VuetifyDensity = 'default' | 'comfortable' | 'compact';
1088
1132
  export declare interface VuetifyInputsSettings {
1089
1133
  defaultVariant?: FieldVariant;
1090
1134
  defaultDensity?: FieldDensity;
1135
+ /** Milliseconds between `<df-file>`/`<df-image>` keep-alive touches; overridable per field by their
1136
+ * `touchInterval` prop. Defaults to 60000 when neither is set. */
1137
+ defaultTouchInterval?: number;
1091
1138
  }
1092
1139
 
1093
1140
  export declare const vuetifyInputsSettingsKey: unique symbol;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dynamicforms/vuetify-inputs",
3
3
  "private": false,
4
- "version": "0.10.1",
4
+ "version": "0.10.3",
5
5
  "type": "module",
6
6
  "description": "Vuetify input components with guaranteed visual consistency across all form fields — unified density/variant system, globally configurable, with inline mode for table cells. Built for @dynamicforms/vue-forms.",
7
7
  "author": "Jure Erznožnik",