Skip to content

Commit

Permalink
fix: [#1149]修复RangePicker和CascaderPicker组件onVisibleChange事件参数未适配微信的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
IceApriler committed Apr 15, 2024
1 parent 65c2baa commit 946ac2a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions compiled/alipay/src/DatePicker/RangePicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PickerValue[]>(
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions compiled/alipay/src/Picker/CascaderPicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions compiled/wechat/src/DatePicker/RangePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions compiled/wechat/src/Picker/CascaderPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/DatePicker/RangePicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PickerValue[]>(
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions src/Picker/CascaderPicker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 946ac2a

Please sign in to comment.