date-time-picker.d.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import type { Dayjs } from 'dayjs';
  2. import { SuperComponent } from '../common/src/index';
  3. /**
  4. *
  5. mode 数组 [日期选择器的最后一个时间点,时间选择器的最后一个时间点]
  6. [year] ------ 年
  7. [month] ------ 年/月
  8. [date] ------ 年/月/日
  9. [hour] ------ 年/月/日/小时
  10. [minute] ------ 年/月/日/小时/分钟
  11. [year, hour] ------ 年/小时
  12. [year, minute] ------ 年/小时/分钟
  13. [month, hour] ------ 年/月/小时
  14. [month, minute] ------ 年/月/小时/分钟
  15. [date, hour] ------ 年/月/日/小时
  16. [date, minute] ------ 年/月/日/小时/分钟
  17. */
  18. declare enum ModeType {
  19. YEAR = "year",
  20. MONTH = "month",
  21. DATE = "date",
  22. HOUR = "hour",
  23. MINUTE = "minute",
  24. YEAR_ADD_HOUR = "year+hour",
  25. YEAR_ADD_MINUTE = "year+minute",
  26. MONTH_ADD_HOUR = "month+hour",
  27. MONTH_ADD_MINUTE = "month+minute",
  28. MONTH_ADD_DATE = "month+date",
  29. DATE_ADD_HOUR = "date+hour",
  30. DATE_ADD_MINUTE = "date+minute",
  31. NULL_HOUR = "null+hour",
  32. NULL_MINUTE = "null+minute"
  33. }
  34. interface ColumnItemValue {
  35. type: string;
  36. value: string | number;
  37. label: string | number;
  38. }
  39. export default class DateTimePicker extends SuperComponent {
  40. properties: import("./type").TdDateTimePickerProps;
  41. externalClasses: string[];
  42. options: {
  43. multipleSlots: boolean;
  44. };
  45. observers: {
  46. value(): void;
  47. mode(m: any): void;
  48. };
  49. data: {
  50. date: any;
  51. columns: any[];
  52. columnsValue: any[];
  53. modeName: string;
  54. locale: {
  55. year: string;
  56. month: string;
  57. day: string;
  58. hour: string;
  59. minute: string;
  60. am: string;
  61. pm: string;
  62. confirm: string;
  63. cancel: string;
  64. };
  65. };
  66. methods: {
  67. updateColumns(): void;
  68. getModeNameByPropsMode(mode: any): ModeType;
  69. getMinDate(): Dayjs;
  70. getMaxDate(): Dayjs;
  71. getMinYear(): number;
  72. getMaxYear(): number;
  73. getMinMonth(): number;
  74. getMaxMonth(): number;
  75. getMinDay(): number;
  76. getMaxDay(): number;
  77. getMinHour(): number;
  78. getMaxHour(): number;
  79. getMinMinute(): number;
  80. getMaxMinute(): number;
  81. getDate(): Dayjs;
  82. clipDate(date: any): Dayjs;
  83. setYear(date: Dayjs, year: number): Dayjs;
  84. setMonth(date: Dayjs, month: number): Dayjs;
  85. getDateData(): Array<ColumnItemValue[]>;
  86. getValueCols(this: DateTimePicker): {
  87. columns: any;
  88. columnsValue: any;
  89. };
  90. getColumnsValue(): string[];
  91. getNewDate(value: number, type: ModeType): Dayjs;
  92. onColumnChange(e: WechatMiniprogram.CustomEvent): void;
  93. onConfirm(): void;
  94. onCancel(): void;
  95. };
  96. }
  97. export {};