Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show non-parsed businessHours as part of ResourceObject #538

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/resource-common/api/ResourceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ export default class ResourceApi {
// NOTE: user can't modify these because Object.freeze was called in event-def parsing
get eventClassNames(): string[] { return this._resource.ui.classNames }
get extendedProps(): any { return this._resource.extendedProps }
get businessHours(): any { return this._resource.businessHoursProps }

}
6 changes: 4 additions & 2 deletions src/resource-common/structs/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export interface Resource {
title: string
businessHours: EventStore | null
ui: EventUi
extendedProps: { [extendedProp: string]: any }
extendedProps: { [extendedProp: string]: any },
businessHoursProps?: any
}

export type ResourceHash = { [resourceId: string]: Resource }
Expand Down Expand Up @@ -63,14 +64,15 @@ export function parseResource(input: ResourceInput, parentId: string = '', store
if (!props.parentId) { // give precedence to the parentId property
props.parentId = parentId
}

props['businessHoursProps'] = props.businessHours ? props.businessHours : null
props.businessHours = props.businessHours ? parseBusinessHours(props.businessHours, calendar) : null
props.ui = ui
props.extendedProps = { ...leftovers1, ...props.extendedProps }

// help out ResourceApi from having user modify props
Object.freeze(ui.classNames)
Object.freeze(props.extendedProps)
Object.freeze(props['businessHoursProps'])

if (store[props.id]) {
// console.warn('duplicate resource ID')
Expand Down