Jelajahi Sumber

move fullcalendar into a new example

Falko Schindler 1 tahun lalu
induk
melakukan
647608cff6

+ 0 - 1
DEPENDENCIES.md

@@ -7,7 +7,6 @@
 - es-module-shims: 1.8.0 ([MIT](https://opensource.org/licenses/MIT))
 - es-module-shims: 1.8.0 ([MIT](https://opensource.org/licenses/MIT))
 - aggrid: 30.2.0 ([MIT](https://opensource.org/licenses/MIT))
 - aggrid: 30.2.0 ([MIT](https://opensource.org/licenses/MIT))
 - echarts: 5.4.3 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0))
 - echarts: 5.4.3 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0))
-- fullcalendar: 6.1.10 ([MIT](https://opensource.org/licenses/MIT))
 - leaflet: 1.9.4 ([BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause))
 - leaflet: 1.9.4 ([BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause))
 - leaflet-draw: 1.0.4 ([MIT](https://opensource.org/licenses/MIT))
 - leaflet-draw: 1.0.4 ([MIT](https://opensource.org/licenses/MIT))
 - mermaid: 10.5.1 ([MIT](https://opensource.org/licenses/MIT))
 - mermaid: 10.5.1 ([MIT](https://opensource.org/licenses/MIT))

+ 0 - 0
nicegui/elements/fullcalendar.js → examples/fullcalendar/fullcalendar.js


+ 3 - 3
nicegui/elements/fullcalendar.py → examples/fullcalendar/fullcalendar.py

@@ -1,8 +1,8 @@
 from pathlib import Path
 from pathlib import Path
 from typing import Any, Callable, Dict, List, Optional
 from typing import Any, Callable, Dict, List, Optional
 
 
-from ..element import Element
-from ..events import handle_event
+from nicegui.element import Element
+from nicegui.events import handle_event
 
 
 
 
 class FullCalendar(Element, component='fullcalendar.js'):
 class FullCalendar(Element, component='fullcalendar.js'):
@@ -16,7 +16,7 @@ class FullCalendar(Element, component='fullcalendar.js'):
         :param on_click: callback function that is called when a calendar event is clicked.
         :param on_click: callback function that is called when a calendar event is clicked.
         """
         """
         super().__init__()
         super().__init__()
-        self.add_resource(Path(__file__).parent / 'lib' / 'fullcalendar')
+        self.add_resource(Path(__file__).parent / 'lib')
         self._props['options'] = options
         self._props['options'] = options
 
 
         if on_click:
         if on_click:

+ 0 - 0
nicegui/elements/lib/fullcalendar/index.global.min.js → examples/fullcalendar/lib/index.global.min.js


+ 54 - 0
examples/fullcalendar/main.py

@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+from datetime import datetime
+
+from fullcalendar import FullCalendar as fullcalendar
+
+from nicegui import events, ui
+
+options = {
+    'initialView': 'dayGridMonth',
+    'headerToolbar': {'left': 'title', 'right': ''},
+    'footerToolbar': {'right': 'prev,next today'},
+    'slotMinTime': '05:00:00',
+    'slotMaxTime': '22:00:00',
+    'allDaySlot': False,
+    'timeZone': 'local',
+    'height': 'auto',
+    'width': 'auto',
+    'events': [
+        {
+            'title': 'Math',
+            'start': datetime.now().strftime(r'%Y-%m-%d') + ' 08:00:00',
+            'end': datetime.now().strftime(r'%Y-%m-%d') + ' 10:00:00',
+            'color': 'red',
+        },
+        {
+            'title': 'Physics',
+            'start': datetime.now().strftime(r'%Y-%m-%d') + ' 10:00:00',
+            'end': datetime.now().strftime(r'%Y-%m-%d') + ' 12:00:00',
+            'color': 'green',
+        },
+        {
+            'title': 'Chemistry',
+            'start': datetime.now().strftime(r'%Y-%m-%d') + ' 13:00:00',
+            'end': datetime.now().strftime(r'%Y-%m-%d') + ' 15:00:00',
+            'color': 'blue',
+        },
+        {
+            'title': 'Biology',
+            'start': datetime.now().strftime(r'%Y-%m-%d') + ' 15:00:00',
+            'end': datetime.now().strftime(r'%Y-%m-%d') + ' 17:00:00',
+            'color': 'orange',
+        },
+    ],
+}
+
+
+def handle_click(event: events.GenericEventArguments):
+    if 'info' in event.args:
+        ui.notify(event.args['info']['event'])
+
+
+fullcalendar(options, on_click=handle_click)
+
+ui.run()

+ 0 - 2
nicegui/ui.py

@@ -25,7 +25,6 @@ __all__ = [
     'echart',
     'echart',
     'editor',
     'editor',
     'expansion',
     'expansion',
-    'fullcalendar',
     'grid',
     'grid',
     'highchart',
     'highchart',
     'html',
     'html',
@@ -132,7 +131,6 @@ from .elements.dialog import Dialog as dialog
 from .elements.echart import EChart as echart
 from .elements.echart import EChart as echart
 from .elements.editor import Editor as editor
 from .elements.editor import Editor as editor
 from .elements.expansion import Expansion as expansion
 from .elements.expansion import Expansion as expansion
-from .elements.fullcalendar import FullCalendar as fullcalendar
 from .elements.grid import Grid as grid
 from .elements.grid import Grid as grid
 from .elements.highchart import highchart
 from .elements.highchart import highchart
 from .elements.html import Html as html
 from .elements.html import Html as html

+ 0 - 7
npm.json

@@ -52,13 +52,6 @@
       "package/dist/": ""
       "package/dist/": ""
     }
     }
   },
   },
-  "fullcalendar": {
-    "destination": "nicegui/elements/lib",
-    "keep": ["package/index.global.min.js"],
-    "rename": {
-      "package/": ""
-    }
-  },
   "leaflet": {
   "leaflet": {
     "destination": "nicegui/elements/lib/leaflet",
     "destination": "nicegui/elements/lib/leaflet",
     "keep": [
     "keep": [

+ 0 - 23
website/documentation/content/fullcalendar_documentation.py

@@ -1,23 +0,0 @@
-from nicegui import ui
-
-from . import doc
-
-
-@doc.demo(ui.fullcalendar)
-def main_demo() -> None:
-    options = {
-        'initialView': 'dayGridMonth',
-        'headerToolbar': {'left': 'title', 'right': ''},
-        'footerToolbar': {'right': 'prev,next today'},
-        'slotMinTime': '05:00:00',
-        'slotMaxTime': '22:00:00',
-        'allDaySlot': False,
-        'timeZone': 'local',
-        'height': 'auto',
-        'width': 'auto',
-        'events': [],
-    }
-    ui.fullcalendar(options, on_click=ui.notify)
-
-
-doc.reference(ui.fullcalendar)

+ 4 - 5
website/documentation/content/section_data_elements.py

@@ -1,10 +1,10 @@
 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, fullcalendar_documentation, highchart_documentation, json_editor_documentation,
-               leaflet_documentation, line_plot_documentation, linear_progress_documentation, log_documentation,
-               plotly_documentation, pyplot_documentation, scene_documentation, spinner_documentation,
-               table_documentation, tree_documentation)
+               editor_documentation, highchart_documentation, json_editor_documentation, leaflet_documentation,
+               line_plot_documentation, linear_progress_documentation, log_documentation, plotly_documentation,
+               pyplot_documentation, scene_documentation, spinner_documentation, table_documentation,
+               tree_documentation)
 
 
 doc.title('*Data* Elements')
 doc.title('*Data* Elements')
 
 
@@ -28,4 +28,3 @@ 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(fullcalendar_documentation)