本文整理匯總了TypeScript中@fullcalendar/core.refineProps函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript refineProps函數的具體用法?TypeScript refineProps怎麽用?TypeScript refineProps使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了refineProps函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: parse
} from '@fullcalendar/core'
interface RRuleParsedRecurring extends ParsedRecurring {
typeData: RRule
}
const EVENT_DEF_PROPS = {
rrule: null,
duration: createDuration
}
let recurring: RecurringType = {
parse(rawEvent: EventInput, leftoverProps: any, dateEnv: DateEnv): RRuleParsedRecurring | null {
if (rawEvent.rrule != null) {
let props = refineProps(rawEvent, EVENT_DEF_PROPS, {}, leftoverProps)
let parsed = parseRRule(props.rrule, dateEnv)
if (parsed) {
return {
typeData: parsed.rrule,
allDayGuess: parsed.allDayGuess,
duration: props.duration
}
}
}
return null
},
expand(rrule: RRule, framingRange: DateRange): DateMarker[] {
示例2: parseMeta
const STANDARD_PROPS = {
url: String,
googleCalendarApiKey: String, // TODO: rename with no prefix?
googleCalendarId: String,
data: null
}
let eventSourceDef: EventSourceDef = {
parseMeta(raw) {
if (typeof raw === 'string') {
raw = { url: raw }
}
if (typeof raw === 'object') {
let standardProps = refineProps(raw, STANDARD_PROPS)
if (!standardProps.googleCalendarId && standardProps.url) {
standardProps.googleCalendarId = parseGoogleCalendarId(standardProps.url)
}
delete standardProps.url
if (standardProps.googleCalendarId) {
return standardProps
}
}
return null
},