@dynamicforms/vuetify-inputs 0.10.0 → 0.10.2

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,34 @@ 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;
460
+ }
461
+
462
+ export declare const DfImage: DefineComponent<DfImageProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
463
+ "update:modelValue": (value: any) => any;
464
+ "click:clear": () => any;
465
+ }, string, PublicProps, Readonly<DfImageProps> & Readonly<{
466
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
467
+ "onClick:clear"?: (() => any) | undefined;
468
+ }>, {
469
+ enabled: boolean;
470
+ clearable: boolean;
471
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
472
+ fileInputRef: HTMLInputElement;
473
+ }, any>;
474
+
475
+ /**
476
+ * `comms.upload` must resolve to a value directly usable as an `<img>` src (typically the URL your backend
477
+ * serves the image from): the component has no separate lookup for turning an identifier into a display URL,
478
+ * so it renders `modelValue` itself as the preview once a file has been uploaded.
479
+ */
480
+ declare interface DfImageProps extends BaseProps {
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;
457
485
  }
458
486
 
459
487
  export declare const DfInput: DefineComponent<DfInputProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
@@ -479,6 +507,7 @@ export declare namespace DfInputComponentProps {
479
507
  DfColorProps,
480
508
  DfDateTimeProps,
481
509
  DfFileProps,
510
+ DfImageProps,
482
511
  DfInputProps,
483
512
  DfInputHintProps,
484
513
  DfLabelProps,
@@ -495,6 +524,7 @@ export declare namespace DfInputComponents {
495
524
  DfColor,
496
525
  DfDateTime,
497
526
  DfFile,
527
+ DfImage,
498
528
  DfInput,
499
529
  DfInputHint,
500
530
  DfLabel,
@@ -564,6 +594,18 @@ export declare const dfInputComponentsByTag: {
564
594
  enabled: boolean;
565
595
  clearable: boolean;
566
596
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
597
+ readonly 'df-image': DefineComponent<DfImageProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
598
+ "update:modelValue": (value: any) => any;
599
+ "click:clear": () => any;
600
+ }, string, PublicProps, Readonly<DfImageProps> & Readonly<{
601
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
602
+ "onClick:clear"?: (() => any) | undefined;
603
+ }>, {
604
+ enabled: boolean;
605
+ clearable: boolean;
606
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
607
+ fileInputRef: HTMLInputElement;
608
+ }, any>;
567
609
  readonly 'df-input': DefineComponent<DfInputProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
568
610
  "update:modelValue": (value: any) => any;
569
611
  "click:clear": () => any;
@@ -855,16 +897,36 @@ export declare interface FileComms {
855
897
  upload: (file: File, progressCallback?: FileProgressCallback) => Promise<string>;
856
898
  /**
857
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
+ *
858
904
  * @param fileIdentifier the identifier that was returned by upload
859
905
  */
860
906
  delete: (fileIdentifier: string) => Promise<void>;
861
907
  /**
862
- * 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
+ *
863
914
  * @param fileIdentifier the identifier that was returned by upload
864
915
  */
865
916
  touch: (fileIdentifier: string) => Promise<void>;
866
917
  }
867
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
+
868
930
  export declare type FileProgressCallback = (loaded: number, total: number) => void;
869
931
 
870
932
  export declare function getBreakpointName(dp: ReturnType<typeof useDisplay>): BreakpointNames;
@@ -916,6 +978,13 @@ export declare interface SelectChoice {
916
978
 
917
979
  export declare type SelectFetchChoices<T1 = any, T2 = any> = (queryValue?: T1, idValue?: T2) => Promise<SelectChoice[]>;
918
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
+
919
988
  declare type ShowAsGroup = 'no' | 'grouped' | 'grouped-no-borders';
920
989
 
921
990
  export declare const translatableStrings: {
@@ -962,6 +1031,8 @@ export declare const translatableStrings: {
962
1031
  ImageUrl: string;
963
1032
  ImageUpload: string;
964
1033
  ImageInsert: string;
1034
+ ImageDropHint: string;
1035
+ ImageReplace: string;
965
1036
  Table: string;
966
1037
  TableInsert: string;
967
1038
  TableAddRowAbove: string;
@@ -982,6 +1053,17 @@ export declare function translateStrings(translationCallback: (s: string) => str
982
1053
 
983
1054
  export declare function useBreakpoint(): ComputedRef<"xs" | "sm" | "md" | "lg" | "xl">;
984
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
+
985
1067
  export declare function useInputBase<T = any>(props: BaseProps<T>, emit: BaseEmits<T>): {
986
1068
  value: WritableComputedRef<T, T>;
987
1069
  valid: ComputedRef<boolean>;
@@ -1050,6 +1132,9 @@ export declare type VuetifyDensity = 'default' | 'comfortable' | 'compact';
1050
1132
  export declare interface VuetifyInputsSettings {
1051
1133
  defaultVariant?: FieldVariant;
1052
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;
1053
1138
  }
1054
1139
 
1055
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.0",
4
+ "version": "0.10.2",
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",