From 946ac2a2cbb0255b7a8ddf6c34bd92758756df59 Mon Sep 17 00:00:00 2001 From: qimengjie Date: Mon, 15 Apr 2024 17:38:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20[#1149]=E4=BF=AE=E5=A4=8DRangePicker?= =?UTF-8?q?=E5=92=8CCascaderPicker=E7=BB=84=E4=BB=B6onVisibleChange?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=8F=82=E6=95=B0=E6=9C=AA=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiled/alipay/src/DatePicker/RangePicker/index.ts | 5 +++-- compiled/alipay/src/Picker/CascaderPicker/index.ts | 5 +++-- compiled/wechat/src/DatePicker/RangePicker/index.js | 5 +++-- compiled/wechat/src/Picker/CascaderPicker/index.js | 5 +++-- src/DatePicker/RangePicker/index.ts | 5 +++-- src/Picker/CascaderPicker/index.ts | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/compiled/alipay/src/DatePicker/RangePicker/index.ts b/compiled/alipay/src/DatePicker/RangePicker/index.ts index 50d189a37..cff844ceb 100644 --- a/compiled/alipay/src/DatePicker/RangePicker/index.ts +++ b/compiled/alipay/src/DatePicker/RangePicker/index.ts @@ -13,7 +13,7 @@ import { useDateState } from './useDateState'; import { mountComponent } from '../../_util/component'; import { PickerValue } from '../props'; import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; -import { resolveEventValues } from '../../_util/platform'; +import { resolveEventValues, resolveEventValue } from '../../_util/platform'; const RangePicker = (props: IDateRangePickerProps) => { const [realValue, { isControlled, update }] = useMixState( @@ -82,7 +82,8 @@ const RangePicker = (props: IDateRangePickerProps) => { const formattedValueText = onFormat(realValue); - useEvent('onVisibleChange', (visible) => { + useEvent('onVisibleChange', (event) => { + const visible = resolveEventValue(event) if (visible) { const state = init(realValue); const currentValue = getValueByDate( diff --git a/compiled/alipay/src/Picker/CascaderPicker/index.ts b/compiled/alipay/src/Picker/CascaderPicker/index.ts index 72fbe6103..25504a950 100644 --- a/compiled/alipay/src/Picker/CascaderPicker/index.ts +++ b/compiled/alipay/src/Picker/CascaderPicker/index.ts @@ -3,7 +3,7 @@ import { mountComponent } from '../../_util/component'; import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; import { useComponentUpdateEffect } from '../../_util/hooks/useLayoutEffect'; import { useMixState } from '../../_util/hooks/useMixState'; -import { resolveEventValues } from '../../_util/platform'; +import { resolveEventValues, resolveEventValue } from '../../_util/platform'; import { CascaderFunctionalProps, ICascaderProps } from './props'; import { defaultFormat, getterColumns, getValidValue } from './utils'; @@ -83,7 +83,8 @@ const CascaderPicker = (props: ICascaderProps) => { return defaultFormat(realValue, getOptionByValue(realValue, props.options)); }, [realValue]); - useEvent('onVisibleChange', (visible) => { + useEvent('onVisibleChange', (event) => { + const visible = resolveEventValue(event) if (visible) { const newColumns = getterColumns(realValue, props.options); const currentValue = getValidValue(realValue, newColumns); diff --git a/compiled/wechat/src/DatePicker/RangePicker/index.js b/compiled/wechat/src/DatePicker/RangePicker/index.js index ff470b9f9..10f97d308 100644 --- a/compiled/wechat/src/DatePicker/RangePicker/index.js +++ b/compiled/wechat/src/DatePicker/RangePicker/index.js @@ -7,7 +7,7 @@ import { useFormatValue, useMinAndMax, useFormatLabel } from './hooks'; import { useDateState } from './useDateState'; import { mountComponent } from '../../_util/component'; import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; -import { resolveEventValues } from '../../_util/platform'; +import { resolveEventValues, resolveEventValue } from '../../_util/platform'; var RangePicker = function (props) { var _a = useMixState(props.defaultValue, { value: props.value, @@ -59,7 +59,8 @@ var RangePicker = function (props) { doUpdateColumns({ columns: newColumns, currentValue: currentValue }); } var formattedValueText = onFormat(realValue); - useEvent('onVisibleChange', function (visible) { + useEvent('onVisibleChange', function (event) { + var visible = resolveEventValue(event); if (visible) { var state = init(realValue); var currentValue_1 = getValueByDate(state.pickerType === 'start' ? state.start : state.end, props.precision); diff --git a/compiled/wechat/src/Picker/CascaderPicker/index.js b/compiled/wechat/src/Picker/CascaderPicker/index.js index 29c40b095..7a901654b 100644 --- a/compiled/wechat/src/Picker/CascaderPicker/index.js +++ b/compiled/wechat/src/Picker/CascaderPicker/index.js @@ -3,7 +3,7 @@ import { mountComponent } from '../../_util/component'; import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; import { useComponentUpdateEffect } from '../../_util/hooks/useLayoutEffect'; import { useMixState } from '../../_util/hooks/useMixState'; -import { resolveEventValues } from '../../_util/platform'; +import { resolveEventValues, resolveEventValue } from '../../_util/platform'; import { CascaderFunctionalProps } from './props'; import { defaultFormat, getterColumns, getValidValue } from './utils'; var CascaderPicker = function (props) { @@ -71,7 +71,8 @@ var CascaderPicker = function (props) { } return defaultFormat(realValue, getOptionByValue(realValue, props.options)); }, [realValue]); - useEvent('onVisibleChange', function (visible) { + useEvent('onVisibleChange', function (event) { + var visible = resolveEventValue(event); if (visible) { var newColumns = getterColumns(realValue, props.options); var currentValue = getValidValue(realValue, newColumns); diff --git a/src/DatePicker/RangePicker/index.ts b/src/DatePicker/RangePicker/index.ts index 50d189a37..cff844ceb 100644 --- a/src/DatePicker/RangePicker/index.ts +++ b/src/DatePicker/RangePicker/index.ts @@ -13,7 +13,7 @@ import { useDateState } from './useDateState'; import { mountComponent } from '../../_util/component'; import { PickerValue } from '../props'; import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; -import { resolveEventValues } from '../../_util/platform'; +import { resolveEventValues, resolveEventValue } from '../../_util/platform'; const RangePicker = (props: IDateRangePickerProps) => { const [realValue, { isControlled, update }] = useMixState( @@ -82,7 +82,8 @@ const RangePicker = (props: IDateRangePickerProps) => { const formattedValueText = onFormat(realValue); - useEvent('onVisibleChange', (visible) => { + useEvent('onVisibleChange', (event) => { + const visible = resolveEventValue(event) if (visible) { const state = init(realValue); const currentValue = getValueByDate( diff --git a/src/Picker/CascaderPicker/index.ts b/src/Picker/CascaderPicker/index.ts index 72fbe6103..25504a950 100644 --- a/src/Picker/CascaderPicker/index.ts +++ b/src/Picker/CascaderPicker/index.ts @@ -3,7 +3,7 @@ import { mountComponent } from '../../_util/component'; import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; import { useComponentUpdateEffect } from '../../_util/hooks/useLayoutEffect'; import { useMixState } from '../../_util/hooks/useMixState'; -import { resolveEventValues } from '../../_util/platform'; +import { resolveEventValues, resolveEventValue } from '../../_util/platform'; import { CascaderFunctionalProps, ICascaderProps } from './props'; import { defaultFormat, getterColumns, getValidValue } from './utils'; @@ -83,7 +83,8 @@ const CascaderPicker = (props: ICascaderProps) => { return defaultFormat(realValue, getOptionByValue(realValue, props.options)); }, [realValue]); - useEvent('onVisibleChange', (visible) => { + useEvent('onVisibleChange', (event) => { + const visible = resolveEventValue(event) if (visible) { const newColumns = getterColumns(realValue, props.options); const currentValue = getValidValue(realValue, newColumns);