props.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import { IBaseProps } from '../_util/base';
  2. export type PickerValue = Date;
  3. /**
  4. * @description 对话框
  5. */
  6. export interface IDatePickerProps extends IBaseProps {
  7. /**
  8. * @desciption 动画类型
  9. * @default "transform"
  10. */
  11. animationType?: 'transform' | 'position';
  12. /**
  13. * @description 时间格式化显示,例如YYYY-MM-DD
  14. */
  15. format: string;
  16. /**
  17. * @description 最小值
  18. * @default 十年前
  19. */
  20. min?: Date;
  21. /**
  22. * @description 最大值
  23. * @default 十年后
  24. */
  25. max?: Date;
  26. /**
  27. * @description 当前数据
  28. */
  29. value?: PickerValue;
  30. /**
  31. * @description 默认值
  32. */
  33. defaultValue?: PickerValue;
  34. /**
  35. * @description 标题
  36. */
  37. title?: string;
  38. /**
  39. * @description 确定按钮文案
  40. * @default "确定"
  41. */
  42. okText?: string;
  43. /**
  44. * @description 取消文案
  45. * @default "取消"
  46. */
  47. cancelText?: string;
  48. /**
  49. * @description 提示文案
  50. * @default '请选择'
  51. */
  52. placeholder?: string;
  53. /**
  54. * @description 是否受控
  55. * @default false
  56. */
  57. controlled?: boolean;
  58. /**
  59. * @description 点击确认回调
  60. */
  61. onOk?: (date: PickerValue, dateStr: string, e: Record<string, any>) => void;
  62. /**
  63. * @description 点击取消回调
  64. */
  65. onCancel?: (e: Record<string, any>) => void;
  66. /**
  67. * @description 发生滚动即触发, 与 onChange 点击 ok 后触发不同
  68. */
  69. onPickerChange?: (date: PickerValue, dateStr: string, e: Record<string, any>) => void;
  70. /**
  71. * @description 精度
  72. * @default 'day'
  73. */
  74. precision: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
  75. /**
  76. * @description 选中值的文本显示格式
  77. */
  78. onFormat?: (date: PickerValue, dateStr: string) => string;
  79. /**
  80. * @description 切换显示隐藏
  81. */
  82. onVisibleChange?: (visible: any, e: Record<string, any>) => void;
  83. /**
  84. * @description 点击蒙层是否可以关闭
  85. * @default false
  86. */
  87. maskClosable?: boolean;
  88. /**
  89. * @description 弹出框类名
  90. */
  91. popClassName?: string;
  92. /**
  93. * @description 弹出框样式
  94. */
  95. popStyle?: string;
  96. /**
  97. * 自定义每列展示的内容
  98. * @param type
  99. * @param value
  100. */
  101. onFormatLabel?(type: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second', value: number): string;
  102. }
  103. export declare const DatePickerDefaultProps: IDatePickerProps;