"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/common/src/structs/view-spec.ts" between
fullcalendar-5.9.0.tar.gz and fullcalendar-5.10.0.tar.gz

About: FullCalendar is a full-sized drag & drop JavaScript event calendar.

view-spec.ts  (fullcalendar-5.9.0):view-spec.ts  (fullcalendar-5.10.0)
skipping to change at line 25 skipping to change at line 25
export interface ViewSpec { export interface ViewSpec {
type: string type: string
component: ViewComponentType component: ViewComponentType
duration: Duration duration: Duration
durationUnit: string durationUnit: string
singleUnit: string singleUnit: string
optionDefaults: ViewOptions optionDefaults: ViewOptions
optionOverrides: ViewOptions optionOverrides: ViewOptions
buttonTextOverride: string buttonTextOverride: string
buttonTextDefault: string buttonTextDefault: string
buttonTitleOverride: string | ((...args: any[]) => string)
buttonTitleDefault: string | ((...args: any[]) => string)
} }
export type ViewSpecHash = { [viewType: string]: ViewSpec } export type ViewSpecHash = { [viewType: string]: ViewSpec }
export function buildViewSpecs( export function buildViewSpecs(
defaultInputs: ViewConfigInputHash, defaultInputs: ViewConfigInputHash,
optionOverrides: CalendarOptions, optionOverrides: CalendarOptions,
dynamicOptionOverrides: CalendarOptions, dynamicOptionOverrides: CalendarOptions,
localeDefaults, localeDefaults,
): ViewSpecHash { ): ViewSpecHash {
skipping to change at line 81 skipping to change at line 83
} }
} }
let queryButtonText = (optionsSubset) => { let queryButtonText = (optionsSubset) => {
let buttonTextMap = optionsSubset.buttonText || {} let buttonTextMap = optionsSubset.buttonText || {}
let buttonTextKey = viewDef.defaults.buttonTextKey as string let buttonTextKey = viewDef.defaults.buttonTextKey as string
if (buttonTextKey != null && buttonTextMap[buttonTextKey] != null) { if (buttonTextKey != null && buttonTextMap[buttonTextKey] != null) {
return buttonTextMap[buttonTextKey] return buttonTextMap[buttonTextKey]
} }
if (buttonTextMap[viewDef.type] != null) { if (buttonTextMap[viewDef.type] != null) {
return buttonTextMap[viewDef.type] return buttonTextMap[viewDef.type]
} }
if (buttonTextMap[singleUnit] != null) { if (buttonTextMap[singleUnit] != null) {
return buttonTextMap[singleUnit] return buttonTextMap[singleUnit]
} }
return null
}
let queryButtonTitle = (optionsSubset) => { // TODO: more DRY with queryButton
Text
let buttonHints = optionsSubset.buttonHints || {}
let buttonKey = viewDef.defaults.buttonTextKey as string // use same key as
text
if (buttonKey != null && buttonHints[buttonKey] != null) {
return buttonHints[buttonKey]
}
if (buttonHints[viewDef.type] != null) {
return buttonHints[viewDef.type]
}
if (buttonHints[singleUnit] != null) {
return buttonHints[singleUnit]
}
return null return null
} }
return { return {
type: viewDef.type, type: viewDef.type,
component: viewDef.component, component: viewDef.component,
duration, duration,
durationUnit, durationUnit,
singleUnit, singleUnit,
optionDefaults: viewDef.defaults, optionDefaults: viewDef.defaults,
optionOverrides: { ...singleUnitOverrides, ...viewDef.overrides }, optionOverrides: { ...singleUnitOverrides, ...viewDef.overrides },
buttonTextOverride: buttonTextOverride:
queryButtonText(dynamicOptionOverrides) || queryButtonText(dynamicOptionOverrides) ||
queryButtonText(optionOverrides) || // constructor-specified buttonText lo okup hash takes precedence queryButtonText(optionOverrides) || // constructor-specified buttonText lo okup hash takes precedence
viewDef.overrides.buttonText, // `buttonText` for view-specific options is a string viewDef.overrides.buttonText, // `buttonText` for view-specific options is a string
buttonTextDefault: buttonTextDefault:
queryButtonText(localeDefaults) || queryButtonText(localeDefaults) ||
viewDef.defaults.buttonText || viewDef.defaults.buttonText ||
queryButtonText(BASE_OPTION_DEFAULTS) || queryButtonText(BASE_OPTION_DEFAULTS) ||
viewDef.type, // fall back to given view name viewDef.type, // fall back to given view name
// not DRY
buttonTitleOverride:
queryButtonTitle(dynamicOptionOverrides) ||
queryButtonTitle(optionOverrides) ||
viewDef.overrides.buttonHint,
buttonTitleDefault:
queryButtonTitle(localeDefaults) ||
viewDef.defaults.buttonHint ||
queryButtonTitle(BASE_OPTION_DEFAULTS),
// will eventually fall back to buttonText
} }
} }
// hack to get memoization working // hack to get memoization working
let durationInputMap: { [json: string]: Duration } = {} let durationInputMap: { [json: string]: Duration } = {}
function createDurationCached(durationInput: DurationInput) { function createDurationCached(durationInput: DurationInput) {
let json = JSON.stringify(durationInput) let json = JSON.stringify(durationInput)
let res = durationInputMap[json] let res = durationInputMap[json]
 End of changes. 7 change blocks. 
3 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)