props.d.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import { IBaseProps } from '../../_util/base';
  2. export interface ICascaderOption {
  3. label: string;
  4. value: any;
  5. children?: ICascaderOption[];
  6. }
  7. /**
  8. * @description 级联组件,基于Picker封装
  9. */
  10. export interface ICascaderProps extends IBaseProps {
  11. /**
  12. * @desciption 动画类型
  13. * @default "transform"
  14. */
  15. animationType: 'transform' | 'position';
  16. /**
  17. * @description 当前数据
  18. */
  19. value: any[];
  20. /**
  21. * @description 默认值
  22. */
  23. defaultValue: any[];
  24. /**
  25. * @description 可选项数据
  26. */
  27. options: ICascaderOption[];
  28. /**
  29. * @description 提示文案
  30. * @default '请选择'
  31. */
  32. placeholder: string;
  33. /**
  34. * @description 取消文案
  35. * @default "取消"
  36. */
  37. cancelText: string;
  38. /**
  39. * @description 是否禁用
  40. */
  41. disabled?: boolean;
  42. /**
  43. * @description 标题
  44. */
  45. title: string;
  46. /**
  47. * @description 确定按钮文案
  48. * @default "确定"
  49. */
  50. okText: string;
  51. /**
  52. *@description 选中框样式
  53. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  54. */
  55. indicatorStyle?: string;
  56. /**
  57. *@description 选中框类名
  58. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  59. */
  60. indicatorClassName?: string;
  61. /**
  62. * @description 蒙层的样式。
  63. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  64. */
  65. maskStyle?: string;
  66. /**
  67. * @description 蒙层的类名。
  68. * 版本要求: 支付宝小程序基础库 1.10.0 及以上
  69. */
  70. maskClassName?: string;
  71. /**
  72. * @description 点击确认回调
  73. */
  74. onOk?: (value: any[], selectedOptions: ICascaderOption[], e: Record<string, any>) => void;
  75. /**
  76. * @description 点击取消回调
  77. */
  78. onCancel?: (e: Record<string, any>) => void;
  79. /**
  80. * @description 选中值的文本显示格式
  81. */
  82. onFormat?: (value: any[], selectedOptions: ICascaderOption[]) => string;
  83. /**
  84. * @description 切换显示隐藏
  85. */
  86. onVisibleChange?: (visible: boolean, e: Record<string, any>) => void;
  87. /**
  88. * @description 发生滚动即触发, 与 onChange 点击 ok 后触发不同
  89. */
  90. onChange?: (value: any[], selectedOptions: ICascaderOption[], e: Record<string, any>) => void;
  91. /**
  92. * @description 点击蒙层是否可以关闭
  93. * @default false
  94. */
  95. maskClosable: boolean;
  96. /**
  97. * @description 弹出框类名
  98. */
  99. popClassName: string;
  100. /**
  101. * @description 弹出框样式
  102. */
  103. popStyle: string;
  104. }
  105. export declare const CascaderDefaultProps: Partial<ICascaderProps>;
  106. export declare const CascaderFunctionalProps: Partial<ICascaderProps>;