fix visualize bug after style changes

This commit is contained in:
DanyLE 2022-07-05 14:41:34 +02:00
parent e63cae1550
commit 52af4b6940
8 changed files with 104 additions and 88 deletions

Binary file not shown.

View File

@ -294,7 +294,8 @@ namespace OS {
.css("padding", 0)
.css("margin", 0)
.css("background-color", "transparent")
.css("width", v * 15 + "px");
.css("width", v * 15 + "px")
.css("flex-shrink", 0);
}
/**
@ -375,6 +376,9 @@ namespace OS {
$(this.refs.container)
.css("padding", 0)
.css("margin", 0)
.css("display","flex")
.css("flex-direction", "row")
.css("align-items", "center")
.css("white-space", "nowrap");
$(this.refs.itemholder).css("display", "inline-block");
$(this.refs.wrapper).on("click",(e) => {
@ -388,6 +392,7 @@ namespace OS {
$(this.refs.toggle)
.css("display", "inline-block")
.css("width", "15px")
.css("flex-shrink", 0)
.addClass("afx-tree-view-item")
.on("click",(e) => {
this.open = !this.open;

View File

@ -71,24 +71,26 @@ namespace OS {
this.view.contextmenuHandle = (e, m) => {
const file = this.view.selectedFile;
if (!file) {
return;
}
const apps = [];
if (file.type === "dir") {
file.mime = "dir";
}
for (let v of this._gui.appsByMime(file.mime)) {
apps.push({
text: v.text,
app: v.app,
icon: v.icon,
iconclass: v.iconclass,
});
}
let ctx_menu = [
{
this.mnFile(),
];
if(file)
{
ctx_menu.push(this.mnEdit());
if (file.type === "dir") {
file.mime = "dir";
}
for (let v of this._gui.appsByMime(file.mime)) {
apps.push({
text: v.text,
app: v.app,
icon: v.icon,
iconclass: v.iconclass,
});
}
ctx_menu.unshift( {
text: "__(Open with)",
nodes: apps,
onchildselect: (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
@ -98,77 +100,76 @@ namespace OS {
const it = e.data.item.data;
return this._gui.launch(it.app, [file]);
},
},
this.mnFile(),
this.mnEdit(),
];
if(file.mime === "application/zip")
{
ctx_menu = ctx_menu.concat([
{
text: "__(Extract Here)",
onmenuselect: (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
if (!e) {
return;
}
API.VFS.extractZip(file.path,
(z) => new Promise((r,e) => r(file.path.asFileHandle().parent().path)))
.catch((err) => this.error(__("Unable to extract file"), err));
},
},
{
text: "__(Extract to)",
onmenuselect: async (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
if (!e) {
return;
}
try {
OS.GUI.dialogs.FileDialog.last_opened = this.currdir.path;
const d = await this.openDialog("FileDialog", {
title: __("Select extract destination"),
type: "dir",
file: file.path.replace(".zip","").asFileHandle()
});
const path = `${d.file.path}/${d.name}`;
await API.VFS.mkdirAll([path]);
await API.VFS.extractZip(file.path,
(z) => new Promise((r,e) => r(path)));
} catch (error) {
this.error(__("Unable to extract file"), error);
}
},
},
]);
}
else
{
ctx_menu.push(
{
text: "__(Compress)",
onmenuselect: async (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
if (!e) {
return;
}
try {
OS.GUI.dialogs.FileDialog.last_opened = this.currdir.path;
const d = await this.openDialog("FileDialog", {
title: __("Save compressed file to"),
type: "dir",
file: `${this.currdir.path}/${file.name}.zip`.asFileHandle()
});
if(d.name.trim() === "")
{
return this.error(__("Invalid file name"));
});
if(file.mime === "application/zip")
{
ctx_menu = ctx_menu.concat([
{
text: "__(Extract Here)",
onmenuselect: (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
if (!e) {
return;
}
API.VFS.extractZip(file.path,
(z) => new Promise((r,e) => r(file.path.asFileHandle().parent().path)))
.catch((err) => this.error(__("Unable to extract file"), err));
},
},
{
text: "__(Extract to)",
onmenuselect: async (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
if (!e) {
return;
}
try {
OS.GUI.dialogs.FileDialog.last_opened = this.currdir.path;
const d = await this.openDialog("FileDialog", {
title: __("Select extract destination"),
type: "dir",
file: file.path.replace(".zip","").asFileHandle()
});
const path = `${d.file.path}/${d.name}`;
await API.VFS.mkdirAll([path]);
await API.VFS.extractZip(file.path,
(z) => new Promise((r,e) => r(path)));
} catch (error) {
this.error(__("Unable to extract file"), error);
}
},
},
]);
}
else
{
ctx_menu.push(
{
text: "__(Compress)",
onmenuselect: async (e: GUI.TagEventType<GUI.tag.MenuEventData>) => {
if (!e) {
return;
}
try {
OS.GUI.dialogs.FileDialog.last_opened = this.currdir.path;
const d = await this.openDialog("FileDialog", {
title: __("Save compressed file to"),
type: "dir",
file: `${this.currdir.path}/${file.name}.zip`.asFileHandle()
});
if(d.name.trim() === "")
{
return this.error(__("Invalid file name"));
}
const path = `${d.file.path}/${d.name}`;
await API.VFS.mkar(file.path, path);
this.notify(__("Archive file created: {0}",path ));
} catch (error) {
this.error(__("Unable to compress file, folder"), error);
}
const path = `${d.file.path}/${d.name}`;
await API.VFS.mkar(file.path, path);
this.notify(__("Archive file created: {0}",path ));
} catch (error) {
this.error(__("Unable to compress file, folder"), error);
}
}
}
);
);
}
}
m.items = ctx_menu;
m.show(e);
@ -764,7 +765,7 @@ namespace OS {
});
break;
case `${this.name}-download`:
if (file.type !== "file") {
if (!file || file.type !== "file") {
return;
}
file.path

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1.5-b",
"version":"0.1.6-b",
"category":"System",
"iconclass":"fa fa-hdd-o",
"mimes":["dir"],

View File

@ -13,7 +13,7 @@
</afx-vbox>
<afx-resizer data-width = "3" ></afx-resizer>
<afx-vbox data-id = "container">
<afx-label data-id = "appname" data-height = "25"></afx-label>
<afx-label data-id = "appname" data-height = "45"></afx-label>
<afx-hbox data-height = "50">
<div style = "text-align:left;">
<afx-button data-id = "bt-remove" text = "__(Uninstall)"></afx-button>

View File

@ -25,6 +25,11 @@ afx-file-view afx-list-view i.label-text{
word-break: break-word;
}
afx-file-view afx-list-view afx-label span
{
flex-direction: column;
}
afx-file-view afx-grid-view i{
display: inline-block;
}

View File

@ -6,6 +6,7 @@ afx-label span {
display: flex;
flex-direction: row;
align-items:center;
justify-content: center;
}
afx-label i.label-text{
font-weight: normal;

View File

@ -129,4 +129,8 @@ body
width: 1px;
height: 1px;
box-sizing: border-box;
}
afx-desktop > .list-container > ul > afx-list-item afx-label span {
flex-direction: column;
}