-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more adjustment to new context, move things out of Calendar
- Loading branch information
Showing
10 changed files
with
96 additions
and
92 deletions.
There are no files selected for viewing
Submodule packages-premium
updated
from 7ca7da to c21b2c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { PointerDragEvent } from './interactions/pointer' | ||
import { buildDateSpanApi, DateSpanApi, DatePointApi, DateSpan, buildDatePointApi } from './structs/date-span' | ||
import { ReducerContext } from './reducers/ReducerContext' | ||
import { __assign } from 'tslib' | ||
import { ViewApi } from './ViewApi' | ||
|
||
|
||
export function triggerDateSelect(selection: DateSpan, pev: PointerDragEvent | null, context: ReducerContext & { viewApi?: ViewApi }) { | ||
const arg = { | ||
...buildDateSpanApiWithContext(selection, context), | ||
jsEvent: pev ? pev.origEvent as MouseEvent : null, // Is this always a mouse event? See #4655 | ||
view: context.viewApi || context.calendar.view | ||
} | ||
|
||
context.emitter.trigger('select', arg) | ||
} | ||
|
||
|
||
export function triggerDateUnselect(pev: PointerDragEvent | null, context: ReducerContext & { viewApi?: ViewApi }) { | ||
context.emitter.trigger('unselect', { | ||
jsEvent: pev ? pev.origEvent : null, | ||
view: context.viewApi || context.calendar.view | ||
}) | ||
} | ||
|
||
|
||
// TODO: receive pev? | ||
export function triggerDateClick(dateSpan: DateSpan, dayEl: HTMLElement, ev: UIEvent, context: ReducerContext & { viewApi?: ViewApi }) { | ||
const arg = { | ||
...buildDatePointApiWithContext(dateSpan, context), | ||
dayEl, | ||
jsEvent: ev as MouseEvent, // Is this always a mouse event? See #4655 | ||
view: context.viewApi || context.calendar.view | ||
} | ||
|
||
context.emitter.trigger('dateClick', arg) | ||
} | ||
|
||
|
||
export function buildDatePointApiWithContext(dateSpan: DateSpan, context: ReducerContext) { | ||
let props = {} as DatePointApi | ||
|
||
for (let transform of context.pluginHooks.datePointTransforms) { | ||
__assign(props, transform(dateSpan, context)) | ||
} | ||
|
||
__assign(props, buildDatePointApi(dateSpan, context.dateEnv)) | ||
|
||
return props | ||
} | ||
|
||
|
||
export function buildDateSpanApiWithContext(dateSpan: DateSpan, context: ReducerContext) { | ||
let props = {} as DateSpanApi | ||
|
||
for (let transform of context.pluginHooks.dateSpanTransforms) { | ||
__assign(props, transform(dateSpan, context)) | ||
} | ||
|
||
__assign(props, buildDateSpanApi(dateSpan, context.dateEnv)) | ||
|
||
return props | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters