index.d.mts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import * as vue from 'vue';
  2. import { ComponentPropsOptions, ExtractPropTypes, VNodeChild, VNode, Ref } from 'vue';
  3. type SlotsToProps<U extends RawSlots, T = MakeInternalSlots<U>> = {
  4. $children?: (VNodeChild | (T extends {
  5. default: infer V;
  6. } ? V : {}) | {
  7. [K in keyof T]?: T[K];
  8. });
  9. 'v-slots'?: {
  10. [K in keyof T]?: T[K] | false;
  11. };
  12. } & {
  13. [K in keyof T as `v-slot:${K & string}`]?: T[K] | false;
  14. };
  15. type RawSlots = Record<string, unknown>;
  16. type Slot<T> = [T] extends [never] ? () => VNodeChild : (arg: T) => VNodeChild;
  17. type VueSlot<T> = [T] extends [never] ? () => VNode[] : (arg: T) => VNode[];
  18. type MakeInternalSlots<T extends RawSlots> = {
  19. [K in keyof T]: Slot<T[K]>;
  20. };
  21. type MakeSlots<T extends RawSlots> = {
  22. [K in keyof T]: VueSlot<T[K]>;
  23. };
  24. type GenericProps<Props, Slots extends Record<string, unknown>> = {
  25. $props: Props & SlotsToProps<Slots>;
  26. $slots: MakeSlots<Slots>;
  27. };
  28. interface FilterPropsOptions<PropsOptions extends Readonly<ComponentPropsOptions>, Props = ExtractPropTypes<PropsOptions>> {
  29. filterProps<T extends Partial<Props>, U extends Exclude<keyof Props, Exclude<keyof Props, keyof T>>>(props: T): Partial<Pick<T, U>>;
  30. }
  31. type VConfirmEditSlots<T> = {
  32. default: {
  33. model: Ref<T>;
  34. save: () => void;
  35. cancel: () => void;
  36. isPristine: boolean;
  37. get actions(): (props?: {}) => VNode;
  38. };
  39. };
  40. declare const VConfirmEdit: {
  41. new (...args: any[]): vue.CreateComponentPublicInstance<{
  42. cancelText: string;
  43. okText: string;
  44. } & {
  45. color?: string | undefined;
  46. } & {
  47. onCancel?: (() => any) | undefined;
  48. }, {
  49. save: () => void;
  50. cancel: () => void;
  51. isPristine: vue.ComputedRef<boolean>;
  52. }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
  53. cancel: () => true;
  54. save: (value: any) => true;
  55. 'update:modelValue': (value: any) => true;
  56. }, "$children" | "v-slots" | "v-slot:default" | "modelValue" | "update:modelValue" | "save">, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & {
  57. cancelText: string;
  58. okText: string;
  59. } & {
  60. color?: string | undefined;
  61. } & {
  62. onCancel?: (() => any) | undefined;
  63. }, {
  64. cancelText: string;
  65. okText: string;
  66. }, true, {}, vue.SlotsType<Partial<{
  67. default: (arg: {
  68. model: Ref<unknown>;
  69. save: () => void;
  70. cancel: () => void;
  71. isPristine: boolean;
  72. readonly actions: (props?: {}) => VNode;
  73. }) => VNode[];
  74. }>>, {
  75. P: {};
  76. B: {};
  77. D: {};
  78. C: {};
  79. M: {};
  80. Defaults: {};
  81. }, {
  82. cancelText: string;
  83. okText: string;
  84. } & {
  85. color?: string | undefined;
  86. } & {
  87. onCancel?: (() => any) | undefined;
  88. }, {
  89. save: () => void;
  90. cancel: () => void;
  91. isPristine: vue.ComputedRef<boolean>;
  92. }, {}, {}, {}, {
  93. cancelText: string;
  94. okText: string;
  95. }>;
  96. __isFragment?: never;
  97. __isTeleport?: never;
  98. __isSuspense?: never;
  99. } & vue.ComponentOptionsBase<{
  100. cancelText: string;
  101. okText: string;
  102. } & {
  103. color?: string | undefined;
  104. } & {
  105. onCancel?: (() => any) | undefined;
  106. }, {
  107. save: () => void;
  108. cancel: () => void;
  109. isPristine: vue.ComputedRef<boolean>;
  110. }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Omit<{
  111. cancel: () => true;
  112. save: (value: any) => true;
  113. 'update:modelValue': (value: any) => true;
  114. }, "$children" | "v-slots" | "v-slot:default" | "modelValue" | "update:modelValue" | "save">, string, {
  115. cancelText: string;
  116. okText: string;
  117. }, {}, string, vue.SlotsType<Partial<{
  118. default: (arg: {
  119. model: Ref<unknown>;
  120. save: () => void;
  121. cancel: () => void;
  122. isPristine: boolean;
  123. readonly actions: (props?: {}) => VNode;
  124. }) => VNode[];
  125. }>>> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new <T>(props: {
  126. modelValue?: T;
  127. "onUpdate:modelValue"?: (value: T) => void;
  128. "onSave"?: (value: T) => void;
  129. }, slots: VConfirmEditSlots<T>) => GenericProps<typeof props, typeof slots>) & FilterPropsOptions<{
  130. modelValue: null;
  131. color: StringConstructor;
  132. cancelText: {
  133. type: StringConstructor;
  134. default: string;
  135. };
  136. okText: {
  137. type: StringConstructor;
  138. default: string;
  139. };
  140. }, vue.ExtractPropTypes<{
  141. modelValue: null;
  142. color: StringConstructor;
  143. cancelText: {
  144. type: StringConstructor;
  145. default: string;
  146. };
  147. okText: {
  148. type: StringConstructor;
  149. default: string;
  150. };
  151. }>>;
  152. type VConfirmEdit = InstanceType<typeof VConfirmEdit>;
  153. export { VConfirmEdit };