From a523c39d2748fd66e0506df43da57ecd23762cdf Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 6 Jul 2021 21:58:05 +0800 Subject: [PATCH] fix: timepicker error border not show #4331 --- .../__snapshots__/index.test.js.snap | 102 +++++++++--------- .../__snapshots__/index.test.js.snap | 2 +- components/time-picker/index.tsx | 4 + components/vc-time-picker/TimePicker.jsx | 4 +- 4 files changed, 59 insertions(+), 53 deletions(-) diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index 7c1beb76d..10a6cb023 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -609,7 +609,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
- + ~ @@ -1155,7 +1155,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
- + ~ @@ -1701,7 +1701,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
- + ~ @@ -2247,7 +2247,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
- + ~ @@ -2793,7 +2793,7 @@ exports[`Locale Provider should display the text as da 1`] = `
- + ~ @@ -3339,7 +3339,7 @@ exports[`Locale Provider should display the text as de 1`] = `
- + ~ @@ -3885,7 +3885,7 @@ exports[`Locale Provider should display the text as el 1`] = `
- + ~ @@ -4431,7 +4431,7 @@ exports[`Locale Provider should display the text as en 1`] = `
- + ~ @@ -4977,7 +4977,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
- + ~ @@ -5523,7 +5523,7 @@ exports[`Locale Provider should display the text as es 1`] = `
- + ~ @@ -6069,7 +6069,7 @@ exports[`Locale Provider should display the text as et 1`] = `
- + ~ @@ -6615,7 +6615,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
- + ~ @@ -7161,7 +7161,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
- + ~ @@ -7707,7 +7707,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
- + ~ @@ -8253,7 +8253,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
- + ~ @@ -8799,7 +8799,7 @@ exports[`Locale Provider should display the text as he 1`] = `
- + ~ @@ -9345,7 +9345,7 @@ exports[`Locale Provider should display the text as hi 1`] = `
- + ~ @@ -9891,7 +9891,7 @@ exports[`Locale Provider should display the text as hr 1`] = `
- + ~ @@ -10437,7 +10437,7 @@ exports[`Locale Provider should display the text as hu 1`] = `
- + ~ @@ -10983,7 +10983,7 @@ exports[`Locale Provider should display the text as hy 1`] = `
- + ~ @@ -11529,7 +11529,7 @@ exports[`Locale Provider should display the text as id 1`] = `
- + ~ @@ -12075,7 +12075,7 @@ exports[`Locale Provider should display the text as is 1`] = `
- + ~ @@ -12621,7 +12621,7 @@ exports[`Locale Provider should display the text as it 1`] = `
- + ~ @@ -13167,7 +13167,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
- + ~ @@ -13713,7 +13713,7 @@ exports[`Locale Provider should display the text as kn 1`] = `
- + ~ @@ -14259,7 +14259,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
- + ~ @@ -14805,7 +14805,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
- + ~ @@ -15351,7 +15351,7 @@ exports[`Locale Provider should display the text as lv 1`] = `
- + ~ @@ -15897,7 +15897,7 @@ exports[`Locale Provider should display the text as mk 1`] = `
- + ~ @@ -16443,7 +16443,7 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
- + ~ @@ -16989,7 +16989,7 @@ exports[`Locale Provider should display the text as ms-my 1`] = `
- + ~ @@ -17535,7 +17535,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
- + ~ @@ -18081,7 +18081,7 @@ exports[`Locale Provider should display the text as ne-np 1`] = `
- + ~ @@ -18627,7 +18627,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
- + ~ @@ -19173,7 +19173,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
- + ~ @@ -19719,7 +19719,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
- + ~ @@ -20265,7 +20265,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
- + ~ @@ -20811,7 +20811,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
- + ~ @@ -21357,7 +21357,7 @@ exports[`Locale Provider should display the text as ro 1`] = `
- + ~ @@ -21903,7 +21903,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
- + ~ @@ -22449,7 +22449,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
- + ~ @@ -22995,7 +22995,7 @@ exports[`Locale Provider should display the text as sl 1`] = `
- + ~ @@ -23541,7 +23541,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
- + ~ @@ -24087,7 +24087,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
- + ~ @@ -24633,7 +24633,7 @@ exports[`Locale Provider should display the text as ta 1`] = `
- + ~ @@ -25179,7 +25179,7 @@ exports[`Locale Provider should display the text as th 1`] = `
- + ~ @@ -25725,7 +25725,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
- + ~ @@ -26271,7 +26271,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
- + ~ @@ -26817,7 +26817,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
- + ~ @@ -27363,7 +27363,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
- + ~ @@ -27909,7 +27909,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
- + ~ diff --git a/components/time-picker/__tests__/__snapshots__/index.test.js.snap b/components/time-picker/__tests__/__snapshots__/index.test.js.snap index efdd99b93..20ee54124 100644 --- a/components/time-picker/__tests__/__snapshots__/index.test.js.snap +++ b/components/time-picker/__tests__/__snapshots__/index.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TimePicker not render clean icon when allowClear is false 1`] = ` - + `; diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index 479561920..8103baf17 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -20,6 +20,7 @@ import { TimeOrTimesType, } from '../_util/moment-util'; import { tuple, withInstall } from '../_util/type'; +import classNames from '../_util/classNames'; export function generateShowHourMinuteSecond(format: string) { // Ref: http://momentjs.com/docs/#/parsing/string-format/ @@ -213,6 +214,8 @@ const TimePicker = defineComponent({ const { prefixCls: customizePrefixCls, getPopupContainer, placeholder, size } = props; const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('time-picker', customizePrefixCls); + const inputPrefixCls = getPrefixCls('input'); + const pickerInputClass = classNames(`${prefixCls}-input`, inputPrefixCls); const format = this.getDefaultFormat(); const pickerClassName = { @@ -236,6 +239,7 @@ const TimePicker = defineComponent({ ...this.$attrs, allowEmpty: this.getAllowClear(), prefixCls, + pickerInputClass, getPopupContainer: getPopupContainer || getContextPopupContainer, format, value: this.sValue, diff --git a/components/vc-time-picker/TimePicker.jsx b/components/vc-time-picker/TimePicker.jsx index 8f16b52be..acf433302 100644 --- a/components/vc-time-picker/TimePicker.jsx +++ b/components/vc-time-picker/TimePicker.jsx @@ -35,6 +35,7 @@ export default defineComponent({ return moment(); }, }, + pickerInputClass: String, inputReadOnly: PropTypes.looseBool, disabled: PropTypes.looseBool, allowEmpty: PropTypes.looseBool, @@ -346,6 +347,7 @@ export default defineComponent({ onFocus, onBlur, popupStyle, + pickerInputClass, } = this; const { class: className, style } = this.$attrs; const popupClassName = this.getPopupClassName(); @@ -368,7 +370,7 @@ export default defineComponent({ >