Skip to content

Commit

Permalink
feat: temp
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Jun 29, 2022
1 parent c0ae4da commit 04a7c69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function useRangeActiveValue(
setActiveValue([fromValue, calcValidActiveDate(fromValue, toValue, 'to')])
}

const [activeValue, setActiveValue] = useControlledProp(props, 'activeValue', () => [
const [activeValue, setActiveValue] = useControlledProp(props, 'activeValue', [
fromPanelValue.value ?? now,
calcValidActiveDate(fromPanelValue.value ?? now, toPanelValue.value, 'to'),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import type { DateRangePickerPanelProps } from '../types'
import type { DateRangePanelProps } from '../types'
import type { DateConfig } from '@idux/components/config'

import { type ComputedRef, computed } from 'vue'
import { type ComputedRef, computed, watch } from 'vue'

import { callEmit, convertArray, useState } from '@idux/cdk/utils'

Expand All @@ -22,9 +22,15 @@ export interface RangePanelStateContext {
handleDatePanelCellMouseenter: (value: Date) => void
}

export function useRangePanelState(props: DateRangePickerPanelProps, dateConfig: DateConfig): RangePanelStateContext {
export function useRangePanelState(props: DateRangePanelProps, dateConfig: DateConfig): RangePanelStateContext {
const [selectingDate, setSelectingDate] = useState<(Date | undefined)[] | undefined>(props.value)
const [isSelecting, setIsSelecting] = useState<boolean>(false)
watch(
() => props.visible,
() => {
setIsSelecting(false)
},
)

const panelValue = computed(() => {
if (isSelecting.value) {
Expand Down

0 comments on commit 04a7c69

Please sign in to comment.