props.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import { IBaseProps } from '../_util/base';
  2. export interface PickerData {
  3. value: PickerValue;
  4. label: string;
  5. }
  6. export declare type PickerValue = string | number | PickerData | (string | number | PickerData)[];
  7. /**
  8. * @description 选择器,包括一个或多个不同值的可滚动列表,每个值可以在视图的中心以较暗的文本形式显示。当用户激活 **Picker** 后,将会从底部弹出。
  9. */
  10. export interface IPickerProps extends IBaseProps {
  11. visible?: boolean;
  12. defaultVisible?: boolean;
  13. /**
  14. * @desciption 动画类型
  15. * @default "transform"
  16. */
  17. animationType: 'transform' | 'position';
  18. /**
  19. * @description picker 数据
  20. */
  21. value: PickerValue;
  22. /**
  23. * @description 格式化后的 value 文本, 优先级大于 onFormat
  24. */
  25. formattedValueText?: string;
  26. /**
  27. * @description 默认picker 数据
  28. */
  29. defaultValue: PickerValue;
  30. /**
  31. * @description 是否禁用
  32. */
  33. disabled?: boolean;
  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 picker 数据
  55. */
  56. options: PickerValue[];
  57. /**
  58. * @description 点击蒙层是否可以关闭
  59. * @default false
  60. */
  61. maskClosable: boolean;
  62. /**
  63. * @description 弹出框类名
  64. */
  65. popClassName: string;
  66. /**
  67. * @description 弹出框样式
  68. */
  69. popStyle: string;
  70. /**
  71. *@description 选中框样式
  72. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  73. */
  74. indicatorStyle?: string;
  75. /**
  76. *@description 选中框类名
  77. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  78. */
  79. indicatorClassName?: string;
  80. /**
  81. * @description 蒙层的样式。
  82. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  83. */
  84. maskStyle?: string;
  85. /**
  86. * @description 蒙层的类名。
  87. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  88. */
  89. maskClassName?: string;
  90. /**
  91. * @description 点击确认回调
  92. */
  93. onOk?: (value: PickerValue, column: PickerData, e: Record<string, any>) => void;
  94. /**
  95. * @description 点击取消回调
  96. */
  97. onCancel?: (e: Record<string, any>) => void;
  98. /**
  99. * @description 发生滚动即触发, 与 onChange 点击 ok 后触发不同
  100. */
  101. onChange?: (value: PickerValue, column: PickerData, e: Record<string, any>) => void;
  102. /**
  103. * @description 选中值的文本显示格式
  104. */
  105. onFormat?: (value: PickerValue, column: PickerValue) => string;
  106. /**
  107. * @description 切换显示隐藏
  108. */
  109. onVisibleChange?: (visible: boolean, e: Record<string, any>) => void;
  110. }
  111. export declare const PickerDefaultProps: Partial<IPickerProps>;
  112. export declare const PickerFunctionalProps: Partial<IPickerProps>;