more work on et2-image to get it fill the whole container and getting Et2VfsMime (et2-vfs-mime) working again after et2-image changes

This commit is contained in:
ralf 2024-08-16 10:09:41 +02:00
parent 599e38b9fc
commit cd5aba7b89
5 changed files with 46 additions and 37 deletions

View File

@ -8,7 +8,7 @@
* @author Nathan Gray
*/
import {css, html, LitElement, nothing, render} from "lit";
import {css, html, LitElement} from "lit";
import {Et2Widget} from "../Et2Widget/Et2Widget";
import {et2_IDetachedDOM} from "../et2_core_interfaces";
import {property} from "lit/decorators/property.js";

View File

@ -2,10 +2,15 @@ import {ExposeValue} from "../Expose/ExposeMixin";
import {et2_vfsMode} from "../et2_widget_vfs";
import {Et2ImageExpose} from "../Expose/Et2ImageExpose";
import {css, html} from "lit";
import {property} from "lit/decorators/property.js";
import {customElement} from "lit/decorators/custom-element.js";
@customElement('et2-vfs-mime')
export class Et2VfsMime extends Et2ImageExpose
{
/**
* @todo styles() are NOT working, probably because due to implementing createRenderRoot() returning this in Et2Image, there styles are moved to etemplate2.css
*/
static get styles()
{
return [
@ -16,34 +21,26 @@ export class Et2VfsMime extends Et2ImageExpose
}
img.overlay {
position: absolute;
bottom: 0px;
right: 0px;
bottom: 0;
right: 0;
z-index: 1;
width: 12px;
height: 12px;
width: 16px;
height: 16px;
}
`,
];
}
static get properties()
{
return {
...super.properties,
/**
* Mime type we're displaying
*/
mime: {type: String, reflect: true},
@property({type: String, reflect: true})
mime = "";
/**
* Mark the file as a link
*/
symlink: {type: Boolean, reflect: true},
/** Allow to pass all data */
value: {type: Object}
}
}
@property({type: Boolean, reflect: true})
symlink = false;
/**
* Mime type of directories
@ -56,8 +53,6 @@ export class Et2VfsMime extends Et2ImageExpose
constructor()
{
super();
this.__mime = "";
this.__symlink = false;
this.__download_url = "";
}
@ -179,6 +174,10 @@ export class Et2VfsMime extends Et2ImageExpose
this.value = _value;
}
/**
* Allow to pass all data as object with attributes "mime", "path", "download_url" and "mode"
*/
@property({type: Object})
set value(_value : ExposeValue | any)
{
if(!_value)
@ -238,9 +237,9 @@ export class Et2VfsMime extends Et2ImageExpose
render()
{
return html`
<slot></slot>
${this.__symlink ? html`<img src="${this.egw().image("symlink", "api")}"
class="overlay"/>` : ""}
${super.render()}
${this.symlink ? html`<img src="${this.egw().image("symlink", "api")}"
class="overlay" style="position: absolute; bottom: 0; right: 0; height: 12px; width: 12px; z-index: 1"/>` : ""}
`;
}
@ -256,7 +255,4 @@ export class Et2VfsMime extends Et2ImageExpose
this.egw().tooltipUnbind(this);
}
}
}
customElements.define("et2-vfs-mime", Et2VfsMime);

View File

@ -4222,3 +4222,15 @@ et2-vfs-select-dialog.egw_app_merge_document et2-checkbox {
order: 10;
margin-left: auto;
}
et2-vfs-mime {
position: relative;
}
et2-vfs-mime img.overlay {
position: absolute;
bottom: 0;
right: 0;
height: 16px;
width: 16px;
z-index: 1;
}

View File

@ -52,8 +52,9 @@
</template>
<template id="filemanager.index.header_left" template="" lang="" group="0" version="1.9.002">
<!-- Anonymous view has some extras - logo & button -->
<et2-image id="logo" disabled="!@show_refresh" hideOnReadonly="true" width="150px"></et2-image>
<et2-button id="reload" statustext="Reload" onclick="app.filemanager.et2.getInstanceManager().refresh()" disabled="!@show_refresh" hideOnReadonly="true" image="reload" noSubmit="true"></et2-button>
<et2-image id="logo" disabled="!@show_refresh" hideOnReadonly="true" style="max-width: 150px"></et2-image>
<et2-button id="reload" statustext="Reload" onclick="app.filemanager.et2.getInstanceManager().refresh()"
disabled="!@show_refresh" hideOnReadonly="true" image="reload" noSubmit="true"></et2-button>
<file label="Upload" statustext="Select file to upload in current directory" id="upload"
progress_dropdownlist="true" drop_target="filemanager-index" multiple="true"
onFinishOne="app.filemanager.uploadOnOne"/>
@ -61,7 +62,7 @@
<template id="filemanager.index.header_row" template="" lang="" group="0" version="1.9.002">
<et2-button id="home" statustext="Go to your home directory" image="gohome" onclick="app.filemanager.change_dir('~',widget);" noSubmit="true"></et2-button>
<et2-button id="up" statustext="Up" image="goup" onclick="app.filemanager.change_dir('..',widget);" noSubmit="true"></et2-button>
<vfs-path id="path" onchange="if(widget.getValue() == '') { app.filemanager.change_dir('~',widget);} return true;" size="80" class="address"/>
<et2-vfs-path id="path" onchange="if(widget.getValue() == '') { app.filemanager.change_dir('~',widget);} return true;" size="80" class="address"/>
<et2-button statustext="Tile view" id="button[change_view]" onclick="app.filemanager.change_view" image="list_tile" noSubmit="true"></et2-button>
</template>
<template id="filemanager.index.header_right" template="" lang="" group="0" version="1.9.003">

View File

@ -48,7 +48,7 @@
<et2-hbox>
<et2-image label="Up" src="goup" onclick="app.filemanager.change_dir('..',widget);" id="up"></et2-image>
</et2-hbox>
<vfs-name id="path" onchange="if(widget.getValue() == '') { app.filemanager.change_dir('~',widget);} return true;" size="80" class="address"/>
<et2-vfs-name id="path" onchange="if(widget.getValue() == '') { app.filemanager.change_dir('~',widget);} return true;" size="80" class="address"/>
<file label="" statustext="Select file to upload in current directory" class="plus_button" id="upload" progress_dropdownlist = "true" drop_target ="divAppbox" multiple="true" onFinishOne="app.filemanager.uploadOnOne"/>
</et2-hbox>
</template>