Merge branch 'main' of git.opencomputing.cn:yumoqing/bricks

This commit is contained in:
yumoqing 2025-11-13 14:01:58 +08:00
commit c02441e26e
3 changed files with 53 additions and 54 deletions

View File

@ -598,7 +598,10 @@ bricks.App = class extends bricks.Layout {
console.log('event=', event); console.log('event=', event);
event.preventDefault(); event.preventDefault();
event.stopPropagation() event.stopPropagation()
this.wins_panel = new bricks.WindowsPanel({}) var opts = bricks.get_popup_default_options();
opts.auto_open = false;
this.wins_panel = new bricks.WindowsPanel(opts);
this.wins_panel.open();
} }
get_color(){ get_color(){
return getComputedStyle(this.dom_element).color; return getComputedStyle(this.dom_element).color;

View File

@ -605,3 +605,9 @@ hr {
color: #00aaff; color: #00aaff;
background: #f0faff; background: #f0faff;
} }
.mini-window {
width: 50px;
height: 50px;
}

View File

@ -1,7 +1,7 @@
var bricks = window.bricks || {}; var bricks = window.bricks || {};
bricks.get_popup_default_options = function(){ bricks.get_popup_default_options = function(){
return { ret = {
timeout:0, timeout:0,
archor:'cc', archor:'cc',
auto_open:true, auto_open:true,
@ -11,6 +11,14 @@ bricks.get_popup_default_options = function(){
resizable:false, resizable:false,
modal:true modal:true
} }
if (bricks.is_mobile()) {
ret.width = '100%';
ret.height = '100%';
} else {
ret.width = '70%';
ret.height = '70%';
}
return ret
} }
bricks.Popup = class extends bricks.VBox { bricks.Popup = class extends bricks.VBox {
/* /*
@ -364,7 +372,7 @@ bricks.Popup = class extends bricks.VBox {
} }
bricks.get_popupwindow_default_options = function(){ bricks.get_popupwindow_default_options = function(){
return { ret = {
timeout:0, timeout:0,
archor:'cc', archor:'cc',
auto_open:true, auto_open:true,
@ -374,63 +382,45 @@ bricks.get_popupwindow_default_options = function(){
resizable:true, resizable:true,
modal:true modal:true
} }
if (bricks.is_mobile()) {
ret.width = '100%';
ret.height = '100%';
} else {
ret.width = '70%';
ret.height = '70%';
}
return ret
} }
bricks.WindowsPanel = class extends bricks.Popup { bricks.WindowsPanel = class extends bricks.Popup {
constructor(opts){ open(){
opts.width = "80%"; this.auto_open = false;
opts.auto_open = false; var dc = new bricks.DynamicColumn({});
opts.auto_dismiss = true; bricks.app.mwins.forEach(x => {
opts.auto_destroy = true; var w = new bricks.VBox({
opts.height = "80%"; "css": "mini-window card"
super(opts);
this.content = new bricks.Cols({
width: "100%",
height: "100%",
record_view: {
widgettype: "VBox",
options: {
css: "app-icon"
},
subwidgets: [
{
widgettype: "Text",
options: {
otext: "${title}",
i18n: true,
wrap: true
}
},
{
widgettype: "Svg",
options: {
rate: 2,
url: "${url}"
}
}
]
}
});
this.content.bind('record_click', this.del_window.bind(this));
var data = {
total: bricks.app.mwins.length,
rows:[]
};
for (var i=0; i< bricks.app.mwins.length; i++){
data.rows.push({
title: bricks.app.mwins[i].title,
url: bricks.app.mwins[i].url,
pos: i
}); });
} dc.add_widget(w);
this.content.dataHandle(data); w.bind('click', this.reopen_window.bind(this, x));
this.add_widget(this.content); var tw = new bricks.Title6({
width:'100%',
wrap:true,
text:x.title
});
var iw = new bricks.Svg({url:x.icon, rate:1.5});
w.add_widget(iw);
w.add_widget(tw);
});
this.add_widget(dc);
super.open();
} }
del_window(event){ reopen_window(w){
var pos = event.params.pos; var nws = [];
var w = bricks.app.mwins[pos];
w.open(); w.open();
bricks.app.mwins.splice(pos, 1); bricks.app.mwins.forEach(x => {
if (x != w) nws.push(x);
});
bricks.app.mwins = nws;
this.dismiss(); this.dismiss();
} }
} }