perf: add truthProp util (#8522)

* perf: add TruthyProp util

* chore: rename

* chore: upd
This commit is contained in:
neverland
2021-04-14 10:26:21 +08:00
committed by GitHub
parent 9381640d2e
commit bd609e1df0
59 changed files with 226 additions and 460 deletions
+17 -41
View File
@@ -9,7 +9,13 @@ import {
} from 'vue';
// Utils
import { pick, isDate, getScrollTop, ComponentInstance } from '../utils';
import {
pick,
isDate,
truthProp,
getScrollTop,
ComponentInstance,
} from '../utils';
import {
t,
bem,
@@ -46,69 +52,39 @@ export default defineComponent({
show: Boolean,
title: String,
color: String,
round: truthProp,
readonly: Boolean,
poppable: truthProp,
teleport: [String, Object] as PropType<TeleportProps['to']>,
showMark: truthProp,
showTitle: truthProp,
formatter: Function as PropType<(item: CalendarDayItem) => CalendarDayItem>,
rowHeight: [Number, String],
confirmText: String,
rangePrompt: String,
lazyRender: truthProp,
showConfirm: truthProp,
// TODO: remove any
// see: https://github.com/vuejs/vue-next/issues/2668
defaultDate: [Date, Array] as any,
allowSameDay: Boolean,
showSubtitle: truthProp,
closeOnPopstate: truthProp,
confirmDisabledText: String,
closeOnClickOverlay: truthProp,
safeAreaInsetBottom: truthProp,
type: {
type: String as PropType<CalendarType>,
default: 'single',
},
round: {
type: Boolean,
default: true,
},
position: {
type: String as PropType<PopupPosition>,
default: 'bottom',
},
poppable: {
type: Boolean,
default: true,
},
maxRange: {
type: [Number, String],
default: null,
},
lazyRender: {
type: Boolean,
default: true,
},
showMark: {
type: Boolean,
default: true,
},
showTitle: {
type: Boolean,
default: true,
},
showConfirm: {
type: Boolean,
default: true,
},
showSubtitle: {
type: Boolean,
default: true,
},
closeOnPopstate: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
minDate: {
type: Date,
validator: isDate,