-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Start adding full calendar #7356
Draft
ahuang11
wants to merge
34
commits into
main
Choose a base branch
from
add_full_calendar
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
019f015
start adding full calendar
ahuang11 458f8ed
add many view parrams
ahuang11 8687fe1
lint
ahuang11 47851cc
Update CHANGELOG
philippjfr d1a754f
Bump panel.js version to 1.5.2
philippjfr ca45454
chore: Update pre-commit (#7366)
hoxbro 827fe64
Corrected styles in doc (#7371)
chryshumble 2309bfe
Prevent pipeline network plot from linking with other plots (#7372)
TheoMathurin 63f2d8d
docs: Update nested tabulator example (#7379)
hoxbro 417e325
Bump django from 3.2.25 to 4.2.16 in /examples/apps/django_multi_apps…
dependabot[bot] 3260b7e
ci: Update pixi channels (#7378)
hoxbro a172064
Fix oauth guest endpoint (#7385)
aktech ef5d0be
Fix type hint for `oauth_guest_endpoints` (#7383)
aktech 2986f18
fix import map typing (#7392)
MarcSkovMadsen ae110a5
Ensure that autoreload records modules to watch before startup (#7399)
philippjfr 2454da9
Various fixes for custom component compilation (#7381)
philippjfr c69b81d
Address issues with Tabulator embed_content and optimize row expansio…
philippjfr 8bb20b8
Update components_overview.md with text fixes (#7335)
Coderambling 2b981da
Prevent tabulator from overlapping when max_height is set (#7403)
ahuang11 e01e53e
docs: fix typo in panel.io.server docstring (#7405)
haojungc 0f3f98d
Sync dark mode on browser_info object (#7382)
philippjfr 6c3a9ce
Allow loading ESM bundles from URL (#7410)
philippjfr 4fbf361
Only attempt loading ESM bundles from URL when running server (#7412)
philippjfr 01529d6
Add CHANGELOG for 1.5.3 (#7409)
philippjfr 7cb5436
Bump panel.js version to 1.5.3-a.1
philippjfr 7ee8cd6
Add test (#7418)
philippjfr c931756
Bump Tabulator version to 6.3 (#7419)
philippjfr cc3ecc1
Set table null formatter to empty string (#7421)
philippjfr 4c56f74
Bump django from 3.2.25 to 4.2.16 in /examples/apps/django (#7413)
dependabot[bot] 5efff82
Do not mutate Children inplace (#7417)
philippjfr 516b9e0
Update CHANGELOG for 1.5.3b1
philippjfr 9237b13
Bump panel.js version to 1.5.3-b.1
philippjfr c509a44
add docstrings, allow triggering views, bugfixes
ahuang11 2ce0c19
Merge branch 'main' into add_full_calendar
ahuang11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,104 @@ | ||
import {Calendar} from "@fullcalendar/core" | ||
|
||
export function render({model, el}) { | ||
function createCalendar(plugins) { | ||
const calendar = new Calendar(el, { | ||
businessHours: model.business_hours, | ||
buttonIcons: model.button_icons, | ||
buttonText: model.button_text, | ||
contentHeight: model.content_height, | ||
dateIncrement: model.date_increment, | ||
events: model.value, | ||
expandRows: model.expand_rows, | ||
footerToolbar: model.footer_toolbar, | ||
handleWindowResize: model.handle_window_resize, | ||
headerToolbar: model.header_toolbar, | ||
initialView: model.current_view, | ||
navLinks: model.nav_links, | ||
nowIndicator: model.now_indicator, | ||
plugins, | ||
showNonCurrentDates: model.show_non_current_dates, | ||
stickyFooterScrollbar: model.sticky_footer_scrollbar, | ||
stickyHeaderDates: model.sticky_header_dates, | ||
titleFormat: model.title_format, | ||
titleRangeSeparator: model.title_range_separator, | ||
validRange: model.valid_range, | ||
windowResizeDelay: model.window_resize_delay, | ||
datesSet(info) { | ||
model.send_msg({current_date: calendar.getDate().toISOString()}) | ||
}, | ||
viewClassNames(info) { | ||
model.send_msg({current_view: info.view.type}) | ||
}, | ||
navLinkDayClick(date, jsEvent) { | ||
calendar.changeView("timeGridDay", date) | ||
}, | ||
navLinkWeekClick(weekStart, jsEvent) { | ||
}, | ||
}) | ||
|
||
// there's initialDate, but if it's set, there's buggy behavior on re-renders | ||
if (model.current_date) { | ||
calendar.gotoDate(model.current_date) | ||
} | ||
|
||
// these cannot be set in the constructor if null | ||
if (model.dateAlignment) { | ||
calendar.setOption("dateAlignment", model.dateAlignment) | ||
} | ||
|
||
if (model.current_view == "multiMonth") { | ||
calendar.setOption("multiMonthMaxColumns", model.multi_month_max_columns) | ||
} | ||
|
||
if (model.aspect_ratio) { | ||
calendar.setOption("aspectRatio", model.aspect_ratio) | ||
} | ||
|
||
model.on("msg:custom", (event) => { | ||
if (event.type === "next") { | ||
calendar.next() | ||
} else if (event.type === "prev") { | ||
calendar.prev() | ||
} else if (event.type === "prevYear") { | ||
calendar.prevYear() | ||
} else if (event.type === "nextYear") { | ||
calendar.nextYear() | ||
} else if (event.type === "today") { | ||
calendar.today() | ||
} else if (event.type === "gotoDate") { | ||
calendar.gotoDate(event.date) | ||
} else if (event.type === "incrementDate") { | ||
calendar.incrementDate(event.increment) | ||
} else if (event.type === "updateOption") { | ||
calendar.setOption(event.key, event.value) | ||
} else if (event.type === "changeView") { | ||
calendar.changeView(event.view, event.date) | ||
} | ||
}) | ||
calendar.render() | ||
} | ||
|
||
const plugins = [] | ||
function loadPluginIfNeeded(viewName, pluginName) { | ||
if (model.current_view.startsWith(viewName) || | ||
(model.header_toolbar && Object.values(model.header_toolbar).some(v => v.includes(viewName))) || | ||
(model.footer_toolbar && Object.values(model.footer_toolbar).some(v => v.includes(viewName)))) { | ||
return import(`@fullcalendar/${pluginName}`).then(plugin => { | ||
plugins.push(plugin.default) | ||
return plugin.default | ||
}) | ||
} | ||
return Promise.resolve(null) | ||
} | ||
|
||
Promise.all([ | ||
loadPluginIfNeeded("dayGrid", "daygrid"), | ||
loadPluginIfNeeded("timeGrid", "timegrid"), | ||
loadPluginIfNeeded("list", "list"), | ||
loadPluginIfNeeded("multiMonth", "multimonth"), | ||
]).then(loadedPlugins => { | ||
const filteredPlugins = loadedPlugins.filter(plugin => plugin !== null) | ||
createCalendar(filteredPlugins) | ||
}) | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I don't believe this component is "core" Panel. Optimally this would be in a separate package like
panel-mermaid
.It increases the complexity of the Panel project. And the download size which is important in for example Pyodide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant part of the compilation.
Is 136 KBs significant?
https://bundlephobia.com/package/@fullcalendar/core@6.1.15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not the js I'm "worried" about. Its the panel python package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also leaning towards splitting this out. That said:
Pyodide bundles do not and will not ship with the JS bundles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess many people will get Panel directly from PyPI in pyodide. We probably should finally figure out how to split that package, so
panel/dist
is shipped separately. For backward compatibility we'd probably have to create a new package calledpanel-core
and then makepanel
a metapackage that depends onpanel-core
and additionally shipspanel/dist
.