Pārlūkot izejas kodu

adding fullcalendar

frankvp11 1 gadu atpakaļ
vecāks
revīzija
59d4b7dc94

+ 1 - 13
DEPENDENCIES.md

@@ -1,15 +1,3 @@
 # Included Web Dependencies
 
-- vue: 3.3.6 ([MIT](https://opensource.org/licenses/MIT))
-- quasar: 2.13.0 ([MIT](https://opensource.org/licenses/MIT))
-- tailwindcss: 3.2.0 ([MIT](https://opensource.org/licenses/MIT))
-- socket.io: 4.7.2 ([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))
-- echarts: 5.4.3 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0))
-- mermaid: 10.5.1 ([MIT](https://opensource.org/licenses/MIT))
-- nipplejs: 0.10.1 ([MIT](https://opensource.org/licenses/MIT))
-- plotly: 2.27.0 ([MIT](https://opensource.org/licenses/MIT))
-- three: 0.157.0 ([MIT](https://opensource.org/licenses/MIT))
-- tween: 21.0.0 ([MIT](https://opensource.org/licenses/MIT))
-- vanilla-jsoneditor: 0.18.10 ([ISC](https://opensource.org/licenses/ISC))
+- fullcalendar: 6.1.9 ([MIT](https://opensource.org/licenses/MIT))

+ 31 - 0
nicegui/elements/fullcalendar.js

@@ -0,0 +1,31 @@
+// fullcalendar.js
+import FullCalendar from './lib/fullcalendar/index.global.min.js';
+export default {
+    template: "<div></div>",
+    props: {
+      eventsData: Array,
+      elementId: String,
+    },
+    mounted() {
+      this.renderFullCalendar();
+    },
+    methods: {
+      renderFullCalendar() {
+        var calendarEl = this.$el;
+  
+        if (calendarEl) {
+          window.calendarInstance = new FullCalendar.Calendar(calendarEl, {
+            initialView: 'timeGridWeek',
+            slotMinTime: "05:00:00",
+            slotMaxTime: "22:00:00",
+            allDaySlot: false,
+            timeZone: 'local',
+            height: 'auto',
+            events: this.eventsData,
+          });
+  
+          window.calendarInstance.render();
+        }
+      },
+    },
+  };

+ 9 - 0
nicegui/elements/fullcalendar.py

@@ -0,0 +1,9 @@
+
+from typing import List, Dict
+from ..element import Element
+
+class FullCalendar(Element, component="fullcalendar.js", exposed_libraries=["https://cdn.jsdelivr.net/npm/fullcalendar@6.1.9/main.min.css", "https://cdn.jsdelivr.net/npm/fullcalendar@6.1.9/index.global.min.js"]):
+    def __init__(self, events_data: List[Dict], element_id: str = 'full-calendar') -> None:
+        super().__init__('fullcalendar.js')
+        self._props['eventsData'] = events_data
+        self._props['elementId'] = element_id

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 5 - 0
nicegui/elements/lib/fullcalendar/index.global.min.js


+ 2 - 0
nicegui/ui.py

@@ -58,6 +58,7 @@ __all__ = [
     'scroll_area',
     'select',
     'separator',
+    'fullcalendar',
     'slider',
     'spinner',
     'splitter',
@@ -176,6 +177,7 @@ from .elements.time import Time as time
 from .elements.timeline import Timeline as timeline
 from .elements.timeline import TimelineEntry as timeline_entry
 from .elements.timer import Timer as timer
+from .elements.fullcalendar import FullCalendar as fullcalendar
 from .elements.toggle import Toggle as toggle
 from .elements.tooltip import Tooltip as tooltip
 from .elements.tree import Tree as tree

+ 8 - 0
npm.json

@@ -108,4 +108,12 @@
       "package/": ""
     }
   }
+  ,
+  "fullcalendar": {
+    "destination": "nicegui/elements/lib",
+    "keep": ["package/index.global.min.js"],
+    "rename": {
+      "package/": ""
+    }
+  }
 }

+ 7 - 0
website/more_documentation/fullcalendar_test.py

@@ -0,0 +1,7 @@
+from nicegui import ui
+
+
+
+ui.fullcalendar([])
+
+ui.run()

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels