index.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { EpPropFinalized } from "../../utils/vue/props/types.js";
  2. import "../../utils/index.js";
  3. import * as vue from "vue";
  4. import { InjectionKey, Ref } from "vue";
  5. //#region ../../packages/hooks/use-empty-values/index.d.ts
  6. type ValueOnClear = string | number | boolean | Function | null;
  7. interface UseEmptyValuesProps {
  8. /**
  9. * @description empty values supported by the component
  10. */
  11. emptyValues?: unknown[];
  12. /**
  13. * @description return value when cleared, if you want to set `undefined`, use `() => undefined`
  14. */
  15. valueOnClear?: ValueOnClear;
  16. }
  17. declare const emptyValuesContextKey: InjectionKey<Ref<UseEmptyValuesProps>>;
  18. declare const SCOPE = "use-empty-values";
  19. declare const DEFAULT_EMPTY_VALUES: (string | null | undefined)[];
  20. declare const DEFAULT_VALUE_ON_CLEAR: undefined;
  21. /**
  22. * @deprecated Removed after 3.0.0, Use `UseEmptyValuesProps` instead.
  23. */
  24. declare const useEmptyValuesProps: {
  25. readonly emptyValues: ArrayConstructor;
  26. readonly valueOnClear: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
  27. };
  28. declare const useEmptyValues: (props: UseEmptyValuesProps, defaultValue?: null | undefined) => {
  29. emptyValues: vue.ComputedRef<unknown[]>;
  30. valueOnClear: vue.ComputedRef<any>;
  31. isEmptyValue: (value: unknown) => boolean;
  32. };
  33. //#endregion
  34. export { DEFAULT_EMPTY_VALUES, DEFAULT_VALUE_ON_CLEAR, SCOPE, UseEmptyValuesProps, emptyValuesContextKey, useEmptyValues, useEmptyValuesProps };