// pipeline-app 首页 TabPanel 动态 tab 支持 // 由 HTML shell 自动加载(configuredServer.get_js_files 收集 wwwroot 下 .js) (function(){ if (typeof bricks === 'undefined' || !bricks.TabPanel) return; if (bricks.TabPanel.prototype._dyn_patched) return; bricks.TabPanel.prototype._dyn_patched = true; // 修复原生 add_tab 的 bug:this.add_removeable 不存在(应为 toolbar.add_removable), // 且 createTool 内部已调用 add_removable,这里只需创建 tool 按钮 bricks.TabPanel.prototype.add_tab = function(desc){ this.toolbar.createTool(desc); }; // 动态打开 tab:已存在(opts.items 同名)则切换,不存在则新增 bricks.TabPanel.prototype.open_tab = async function(desc){ // 1. 已存在判断:opts.items 里找同名(不用 content_buffer,因 content 可能构建失败) var existing = null; for (var i=0;i