瀏覽代碼

improve documentation

Falko Schindler 1 年之前
父節點
當前提交
70d29a74c9

+ 13 - 0
nicegui/elements/fullcalendar.py

@@ -23,12 +23,24 @@ class FullCalendar(Element, component='fullcalendar.js'):
             self.on('click', lambda e: handle_event(on_click, e))
             self.on('click', lambda e: handle_event(on_click, e))
 
 
     def add_event(self, title: str, start: str, end: str, **kwargs) -> None:
     def add_event(self, title: str, start: str, end: str, **kwargs) -> None:
+        """Add an event to the calendar.
+
+        :param title: title of the event
+        :param start: start time of the event
+        :param end: end time of the event
+        """
         event_dict = {'title': title, 'start': start, 'end': end, **kwargs}
         event_dict = {'title': title, 'start': start, 'end': end, **kwargs}
         self._props['options']['events'].append(event_dict)
         self._props['options']['events'].append(event_dict)
         self.update()
         self.update()
         self.run_method('update_calendar')
         self.run_method('update_calendar')
 
 
     def remove_event(self, title: str, start: str, end: str) -> None:
     def remove_event(self, title: str, start: str, end: str) -> None:
+        """Remove an event from the calendar.
+
+        :param title: title of the event
+        :param start: start time of the event
+        :param end: end time of the event
+        """
         for event in self._props['options']['events']:
         for event in self._props['options']['events']:
             if event['title'] == title and event['start'] == start and event['end'] == end:
             if event['title'] == title and event['start'] == start and event['end'] == end:
                 self._props['options']['events'].remove(event)
                 self._props['options']['events'].remove(event)
@@ -39,4 +51,5 @@ class FullCalendar(Element, component='fullcalendar.js'):
 
 
     @property
     @property
     def events(self) -> List[Dict]:
     def events(self) -> List[Dict]:
+        """List of events currently displayed in the calendar."""
         return self._props['options']['events']
         return self._props['options']['events']

+ 2 - 0
website/documentation/content/full_calendar_documentation.py → website/documentation/content/fullcalendar_documentation.py

@@ -7,6 +7,8 @@ from . import doc
 def main_demo() -> None:
 def main_demo() -> None:
     options = {
     options = {
         'initialView': 'dayGridMonth',
         'initialView': 'dayGridMonth',
+        'headerToolbar': {'left': 'title', 'right': ''},
+        'footerToolbar': {'right': 'prev,next today'},
         'slotMinTime': '05:00:00',
         'slotMinTime': '05:00:00',
         'slotMaxTime': '22:00:00',
         'slotMaxTime': '22:00:00',
         'allDaySlot': False,
         'allDaySlot': False,

+ 2 - 2
website/documentation/content/section_data_elements.py

@@ -1,7 +1,7 @@
 from nicegui import optional_features
 from nicegui import optional_features
 
 
 from . import (aggrid_documentation, circular_progress_documentation, code_documentation, doc, echart_documentation,
 from . import (aggrid_documentation, circular_progress_documentation, code_documentation, doc, echart_documentation,
-               editor_documentation, full_calendar_documentation, highchart_documentation, json_editor_documentation,
+               editor_documentation, fullcalendar_documentation, highchart_documentation, json_editor_documentation,
                leaflet_documentation, line_plot_documentation, linear_progress_documentation, log_documentation,
                leaflet_documentation, line_plot_documentation, linear_progress_documentation, log_documentation,
                plotly_documentation, pyplot_documentation, scene_documentation, spinner_documentation,
                plotly_documentation, pyplot_documentation, scene_documentation, spinner_documentation,
                table_documentation, tree_documentation)
                table_documentation, tree_documentation)
@@ -28,4 +28,4 @@ doc.intro(log_documentation)
 doc.intro(editor_documentation)
 doc.intro(editor_documentation)
 doc.intro(code_documentation)
 doc.intro(code_documentation)
 doc.intro(json_editor_documentation)
 doc.intro(json_editor_documentation)
-doc.intro(full_calendar_documentation)
+doc.intro(fullcalendar_documentation)