interface.d.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import type { ExtractPropTypes, InjectionKey, PropType, Ref } from 'vue';
  2. import type { MouseEventHandler } from '../_util/EventInterface';
  3. import type { VueNode } from '../_util/type';
  4. export declare 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: 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: PropType<CheckboxValueType[]>;
  34. };
  35. value: {
  36. type: PropType<CheckboxValueType[]>;
  37. };
  38. onChange: {
  39. type: PropType<(checkedValue: Array<CheckboxValueType>) => void>;
  40. };
  41. 'onUpdate:value': {
  42. type: PropType<(checkedValue: Array<CheckboxValueType>) => void>;
  43. };
  44. name: StringConstructor;
  45. prefixCls: StringConstructor;
  46. options: {
  47. type: PropType<(string | number | CheckboxOptionType)[]>;
  48. default: () => (string | number | CheckboxOptionType)[];
  49. };
  50. disabled: BooleanConstructor;
  51. id: StringConstructor;
  52. };
  53. export declare type CheckboxGroupProps = Partial<ExtractPropTypes<ReturnType<typeof checkboxGroupProps>>>;
  54. export declare const abstractCheckboxProps: () => {
  55. prefixCls: StringConstructor;
  56. defaultChecked: {
  57. type: BooleanConstructor;
  58. default: any;
  59. };
  60. checked: {
  61. type: BooleanConstructor;
  62. default: any;
  63. };
  64. disabled: {
  65. type: BooleanConstructor;
  66. default: any;
  67. };
  68. isGroup: {
  69. type: BooleanConstructor;
  70. default: any;
  71. };
  72. value: import("vue-types").VueTypeValidableDef<any>;
  73. name: StringConstructor;
  74. id: StringConstructor;
  75. indeterminate: {
  76. type: BooleanConstructor;
  77. default: any;
  78. };
  79. type: {
  80. type: StringConstructor;
  81. default: string;
  82. };
  83. autofocus: {
  84. type: BooleanConstructor;
  85. default: any;
  86. };
  87. onChange: PropType<(e: CheckboxChangeEvent) => void>;
  88. 'onUpdate:checked': PropType<(checked: boolean) => void>;
  89. onClick: PropType<MouseEventHandler>;
  90. skipGroup: {
  91. type: BooleanConstructor;
  92. default: boolean;
  93. };
  94. };
  95. export declare const checkboxProps: () => {
  96. indeterminate: {
  97. type: BooleanConstructor;
  98. default: boolean;
  99. };
  100. prefixCls: StringConstructor;
  101. defaultChecked: {
  102. type: BooleanConstructor;
  103. default: any;
  104. };
  105. checked: {
  106. type: BooleanConstructor;
  107. default: any;
  108. };
  109. disabled: {
  110. type: BooleanConstructor;
  111. default: any;
  112. };
  113. isGroup: {
  114. type: BooleanConstructor;
  115. default: any;
  116. };
  117. value: import("vue-types").VueTypeValidableDef<any>;
  118. name: StringConstructor;
  119. id: StringConstructor;
  120. type: {
  121. type: StringConstructor;
  122. default: string;
  123. };
  124. autofocus: {
  125. type: BooleanConstructor;
  126. default: any;
  127. };
  128. onChange: PropType<(e: CheckboxChangeEvent) => void>;
  129. 'onUpdate:checked': PropType<(checked: boolean) => void>;
  130. onClick: PropType<MouseEventHandler>;
  131. skipGroup: {
  132. type: BooleanConstructor;
  133. default: boolean;
  134. };
  135. };
  136. export declare type CheckboxProps = Partial<ExtractPropTypes<ReturnType<typeof checkboxProps>>>;
  137. export declare type CheckboxGroupContext = {
  138. cancelValue: (id: Symbol) => void;
  139. registerValue: (id: Symbol, value: string) => void;
  140. toggleOption: (option: CheckboxOptionType) => void;
  141. name: Ref<string>;
  142. disabled: Ref<boolean>;
  143. mergedValue: Ref<CheckboxValueType[]>;
  144. };
  145. export declare const CheckboxGroupContextKey: InjectionKey<CheckboxGroupContext>;