m-calendar icon indicating copy to clipboard operation
m-calendar copied to clipboard

Calendar 依赖 TimePicker 时缺少参数

Open monsterooo opened this issue 3 years ago • 0 comments

@zhang740 @likezero 你们好,发现一个 Calendar 中 依赖 rmc-data-picker 传参的问题,问题描述如下:

在 https://github.com/react-component/m-calendar/blob/master/src/TimePicker.tsx#L64 中使用了 rmc-date-picker ,但是在代码中只向 rmc-date-picker 传递了少量的参数:

当前代码:

<DateTimePicker
      prefixCls={prefixCls}
      pickerPrefixCls={pickerPrefixCls}
      style={{
        height: height > 164 || height < 0 ? 164 : height,
        overflow: 'hidden'
      } as React.CSSProperties}
      mode="time"
      date={date}
      locale={locale}
      minDate={this.getMinTime(date)}
      maxDate={this.getMaxTime(date)}
      onDateChange={this.onDateChange}
      use12Hours
/>

理想代码:

<DateTimePicker
      prefixCls={prefixCls}
      pickerPrefixCls={pickerPrefixCls}
      style={{
        height: height > 164 || height < 0 ? 164 : height,
        overflow: 'hidden'
      } as React.CSSProperties}
      mode="time"
      date={date}
      locale={locale}
      minDate={this.getMinTime(date)}
      maxDate={this.getMaxTime(date)}
      onDateChange={this.onDateChange}
      use12Hours
      ...props // 这里应该解构剩余的参数到DateTimePicker中
/>

在 rmc-date-picker 中有 https://www.npmjs.com/package/rmc-date-picker#api 许多的参数没有传递进来,导致无法在 Calendar 中无法更好的控制 rmc-data-picker

目标:应该结构多余的参数到 rmc-date-pick

monsterooo avatar Apr 06 '22 10:04 monsterooo