interface.d.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. import type { ExtractPropTypes, InjectionKey, Ref } from 'vue';
  2. import type { MouseEventHandler } from '../_util/EventInterface';
  3. import type { VueNode } from '../_util/type';
  4. export type CheckboxValueType = string | number | boolean;
  5. export interface CheckboxOptionType {
  6. label?: VueNode;
  7. value: CheckboxValueType;
  8. disabled?: boolean;
  9. indeterminate?: boolean;
  10. onChange?: (e: CheckboxChangeEvent) => void;
  11. }
  12. export interface CheckboxChangeEvent {
  13. target: CheckboxChangeEventTarget;
  14. stopPropagation: () => void;
  15. preventDefault: () => void;
  16. nativeEvent: MouseEvent;
  17. }
  18. export interface CheckboxChangeEventTarget extends CheckboxProps {
  19. checked: boolean;
  20. }
  21. export declare const abstractCheckboxGroupProps: () => {
  22. name: StringConstructor;
  23. prefixCls: StringConstructor;
  24. options: {
  25. type: import("vue").PropType<(string | number | CheckboxOptionType)[]>;
  26. default: (string | number | CheckboxOptionType)[];
  27. };
  28. disabled: BooleanConstructor;
  29. id: StringConstructor;
  30. };
  31. export declare const checkboxGroupProps: () => {
  32. defaultValue: {
  33. type: import("vue").PropType<CheckboxValueType[]>;
  34. default: CheckboxValueType[];
  35. };
  36. value: {
  37. type: import("vue").PropType<CheckboxValueType[]>;
  38. default: CheckboxValueType[];
  39. };
  40. onChange: {
  41. type: import("vue").PropType<(checkedValue: Array<CheckboxValueType>) => void>;
  42. default: (checkedValue: Array<CheckboxValueType>) => void;
  43. };
  44. 'onUpdate:value': {
  45. type: import("vue").PropType<(checkedValue: Array<CheckboxValueType>) => void>;
  46. default: (checkedValue: Array<CheckboxValueType>) => void;
  47. };
  48. name: StringConstructor;
  49. prefixCls: StringConstructor;
  50. options: {
  51. type: import("vue").PropType<(string | number | CheckboxOptionType)[]>;
  52. default: (string | number | CheckboxOptionType)[];
  53. };
  54. disabled: BooleanConstructor;
  55. id: StringConstructor;
  56. };
  57. export type CheckboxGroupProps = Partial<ExtractPropTypes<ReturnType<typeof checkboxGroupProps>>>;
  58. export declare const abstractCheckboxProps: () => {
  59. prefixCls: StringConstructor;
  60. defaultChecked: {
  61. type: BooleanConstructor;
  62. default: boolean;
  63. };
  64. checked: {
  65. type: BooleanConstructor;
  66. default: boolean;
  67. };
  68. disabled: {
  69. type: BooleanConstructor;
  70. default: boolean;
  71. };
  72. isGroup: {
  73. type: BooleanConstructor;
  74. default: boolean;
  75. };
  76. value: import("vue-types").VueTypeValidableDef<any>;
  77. name: StringConstructor;
  78. id: StringConstructor;
  79. indeterminate: {
  80. type: BooleanConstructor;
  81. default: boolean;
  82. };
  83. type: {
  84. type: import("vue").PropType<"checkbox">;
  85. default: "checkbox";
  86. };
  87. autofocus: {
  88. type: BooleanConstructor;
  89. default: boolean;
  90. };
  91. onChange: {
  92. type: import("vue").PropType<(e: CheckboxChangeEvent) => void>;
  93. default: (e: CheckboxChangeEvent) => void;
  94. };
  95. 'onUpdate:checked': {
  96. type: import("vue").PropType<(checked: boolean) => void>;
  97. default: (checked: boolean) => void;
  98. };
  99. onClick: {
  100. type: import("vue").PropType<MouseEventHandler>;
  101. default: MouseEventHandler;
  102. };
  103. skipGroup: {
  104. type: BooleanConstructor;
  105. default: boolean;
  106. };
  107. };
  108. export declare const checkboxProps: () => {
  109. indeterminate: {
  110. type: BooleanConstructor;
  111. default: boolean;
  112. };
  113. prefixCls: StringConstructor;
  114. defaultChecked: {
  115. type: BooleanConstructor;
  116. default: boolean;
  117. };
  118. checked: {
  119. type: BooleanConstructor;
  120. default: boolean;
  121. };
  122. disabled: {
  123. type: BooleanConstructor;
  124. default: boolean;
  125. };
  126. isGroup: {
  127. type: BooleanConstructor;
  128. default: boolean;
  129. };
  130. value: import("vue-types").VueTypeValidableDef<any>;
  131. name: StringConstructor;
  132. id: StringConstructor;
  133. type: {
  134. type: import("vue").PropType<"checkbox">;
  135. default: "checkbox";
  136. };
  137. autofocus: {
  138. type: BooleanConstructor;
  139. default: boolean;
  140. };
  141. onChange: {
  142. type: import("vue").PropType<(e: CheckboxChangeEvent) => void>;
  143. default: (e: CheckboxChangeEvent) => void;
  144. };
  145. 'onUpdate:checked': {
  146. type: import("vue").PropType<(checked: boolean) => void>;
  147. default: (checked: boolean) => void;
  148. };
  149. onClick: {
  150. type: import("vue").PropType<MouseEventHandler>;
  151. default: MouseEventHandler;
  152. };
  153. skipGroup: {
  154. type: BooleanConstructor;
  155. default: boolean;
  156. };
  157. };
  158. export type CheckboxProps = Partial<ExtractPropTypes<ReturnType<typeof checkboxProps>>>;
  159. export type CheckboxGroupContext = {
  160. cancelValue: (id: Symbol) => void;
  161. registerValue: (id: Symbol, value: string) => void;
  162. toggleOption: (option: CheckboxOptionType) => void;
  163. name: Ref<string>;
  164. disabled: Ref<boolean>;
  165. mergedValue: Ref<CheckboxValueType[]>;
  166. };
  167. export declare const CheckboxGroupContextKey: InjectionKey<CheckboxGroupContext>;