Home WIP: Get calendar working

This commit is contained in:
nathan 2023-03-06 14:47:48 -07:00
parent fc3feb974a
commit 1538496df1
5 changed files with 47 additions and 15 deletions

View File

@ -21,6 +21,7 @@ import shoelace from "../Styles/shoelace";
import {Et2Dialog} from "../Et2Dialog/Et2Dialog"; import {Et2Dialog} from "../Et2Dialog/Et2Dialog";
import {et2_IResizeable} from "../et2_core_interfaces"; import {et2_IResizeable} from "../et2_core_interfaces";
import {HomeApp} from "../../../../home/js/app"; import {HomeApp} from "../../../../home/js/app";
import {etemplate2} from "../etemplate2";
/** /**
* Participate in Home * Participate in Home
@ -181,13 +182,14 @@ export class Et2Portlet extends Et2Widget(SlCard)
this.settings = typeof attrs.settings == "string" ? data.value || data.settings || {} : attrs.settings; this.settings = typeof attrs.settings == "string" ? data.value || data.settings || {} : attrs.settings;
// Set size & position, if available // Set size & position, if available
if(data && (data.row || data.height)) // NB: initial load can't find them by entry in array mgr, we check the data directly
if(attrs.row || attrs.height || data.row || data.height)
{ {
this.style.gridRow = (data.row || "auto") + " / span " + (data.height || 1); this.style.gridRow = (attrs.row || data.row || "auto") + " / span " + (attrs.height || data.height || 1);
} }
if(data && (data.col || data.width)) if(attrs.col || attrs.width || data.col || data.width)
{ {
this.style.gridColumn = (data.col || "auto") + " / span " + (data.width || 1); this.style.gridColumn = (attrs.col || data.col || "auto") + " / span " + (attrs.width || data.width || 1);
} }
} }
@ -345,6 +347,9 @@ export class Et2Portlet extends Et2Widget(SlCard)
// Update position settings // Update position settings
this.update_settings({row: row, col: col, width: width, height: height}); this.update_settings({row: row, col: col, width: width, height: height});
// If there's a full etemplate living inside, make it resize
etemplate2.getById(this.id).resize();
} }
@ -469,9 +474,6 @@ export class Et2Portlet extends Et2Widget(SlCard)
// Only resize once, and only if needed // Only resize once, and only if needed
if(data.attributes.width || data.attributes.height) if(data.attributes.width || data.attributes.height)
{ {
this.style.columnSpan = data.attributes.width;
this.style.rowSpan = data.attributes.height;
// Tell children // Tell children
try try
{ {

View File

@ -15,8 +15,8 @@ use EGroupware\Api\Framework;
use EGroupware\Api\Etemplate; use EGroupware\Api\Etemplate;
/** /**
* The addressbook_list_portlet uses a nextmatch / favorite * The list uses a nextmatch / favorite
* to display a list of entries. * to display a list of entries, but other views do their own things
*/ */
class calendar_favorite_portlet extends home_favorite_portlet class calendar_favorite_portlet extends home_favorite_portlet
{ {
@ -246,7 +246,8 @@ class calendar_favorite_portlet extends home_favorite_portlet
return $properties; return $properties;
} }
public function get_actions() { public function get_actions()
{
if($this->favorite['state']['view'] == 'listview' || !$this->actions) if($this->favorite['state']['view'] == 'listview' || !$this->actions)
{ {
return array(); return array();
@ -256,4 +257,9 @@ class calendar_favorite_portlet extends home_favorite_portlet
return $this->actions; return $this->actions;
} }
} }
public function get_type()
{
return 'et2-portlet-calendar';
}
} }

View File

@ -0,0 +1,26 @@
import shoelace from "../../api/js/etemplate/Styles/shoelace";
import {css} from "@lion/core";
import {Et2PortletFavorite} from "../../home/js/Et2PortletFavorite";
/**
* Home portlet to show a note
*/
export class Et2PortletCalendar extends Et2PortletFavorite
{
static get styles()
{
return [
...shoelace,
...(super.styles || []),
css`
`
]
}
}
if(!customElements.get("et2-portlet-calendar"))
{
customElements.define("et2-portlet-calendar", Et2PortletCalendar);
}

View File

@ -2296,10 +2296,7 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet
// Take the whole tab height, or home portlet // Take the whole tab height, or home portlet
if(this.getInstanceManager().app === 'home') if(this.getInstanceManager().app === 'home')
{ {
var height = jQuery(this.getParent().getDOMNode(this)).parentsUntil('.et2_portlet').last().parent().innerHeight(); var height = jQuery(this.getParent().getDOMNode(this)).parentsUntil('et2-portlet-calendar').last().innerHeight();
// Allow for portlet header
height -= jQuery('.ui-widget-header',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true);
} }
else else
{ {
@ -2324,7 +2321,7 @@ export class et2_calendar_timegrid extends et2_calendar_view implements et2_IDet
if(this.getInstanceManager().app === 'home') if(this.getInstanceManager().app === 'home')
{ {
var modify_node = jQuery(this.getParent().getDOMNode(this)).parentsUntil('.et2_portlet').last(); var modify_node = jQuery(this.getParent().getDOMNode(this)).parentsUntil('et2-portlet-calendar').last();
} }
else else
{ {

View File

@ -16,6 +16,7 @@ import {Et2PortletFavorite} from "./Et2PortletFavorite";
import {loadWebComponent} from "../../api/js/etemplate/Et2Widget/Et2Widget"; import {loadWebComponent} from "../../api/js/etemplate/Et2Widget/Et2Widget";
import "./Et2PortletList"; import "./Et2PortletList";
import "./Et2PortletNote"; import "./Et2PortletNote";
import "../../calendar/js/Et2PortletCalendar"
import Sortable from "sortablejs/modular/sortable.complete.esm.js"; import Sortable from "sortablejs/modular/sortable.complete.esm.js";
/** /**