Browse Source

feat: 添加关闭按钮

master
alan 6 years ago
parent
commit
160664bb9a
  1. 11
      src/app/app.component.scss
  2. 23
      src/app/title/title.component.ts
  3. BIN
      src/img/icon_close9x9_normal.png
  4. 22
      src/shared/crud/crud.request.ts
  5. 2
      tsconfig.json
  6. 1
      types/globals.d.ts

11
src/app/app.component.scss

@ -19,6 +19,17 @@
font-weight: 700; font-weight: 700;
cursor: pointer; cursor: pointer;
} }
.close-button {
position: absolute !important;
right: 5px;
top: 5px;
width: 30px;
height: 30px;
cursor: pointer;
background-image: url("../img/icon_close9x9_normal.png");
background-repeat: no-repeat;
background-position: center;
}
} }
.linkset{ .linkset{
margin: 10px; margin: 10px;

23
src/app/title/title.component.ts

@ -1,5 +1,6 @@
import {Left, WidgetType} from '@ui/index'; import {Left, WidgetType, IconButton} from '@ui/index';
import TitleItem from './title_item/title_item.component'; import TitleItem from './title_item/title_item.component';
import {isDesigner, closeWindow} from '@shared/crud/crud.request';
const tabs = ['数据连接管理', '连接池状态']; const tabs = ['数据连接管理', '连接池状态'];
const className = 'fr.title'; const className = 'fr.title';
const Widget: WidgetType = { const Widget: WidgetType = {
@ -7,14 +8,32 @@ const Widget: WidgetType = {
return { return {
type: Left, type: Left,
cls: 'title', cls: 'title',
items: BI.map(tabs, (index: number, text: string) => { items: [
...BI.map(tabs, (index: number, text: string) => {
return { return {
type: TitleItem, type: TitleItem,
text, text,
}; };
}), }),
{
type:IconButton,
cls:'close-button',
handler() {
closeWindow();
},
invisible: true,
ref: _ref => {
this.CloseButton = _ref;
},
},
],
}; };
}, },
mounted() {
if (isDesigner()) {
this.CloseButton.setVisible(true);
}
},
}; };
BI.shortcut(className, BI.inherit(BI.Widget, Widget)); BI.shortcut(className, BI.inherit(BI.Widget, Widget));

BIN
src/img/icon_close9x9_normal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

22
src/shared/crud/crud.request.ts

@ -1,6 +1,28 @@
import {linkList} from './curd.mock'; import {linkList} from './curd.mock';
import {LinkType} from '@ui/type'; import {LinkType} from '@ui/type';
const Dec: any = (window as any).parent.Dec; const Dec: any = (window as any).parent.Dec;
const PluginHelper: any = (window as any).PluginHelper;
/**
*
*/
export function isDesigner(): boolean {
if (PluginHelper) {
return PluginHelper.isDesigner();
}
return false;
}
/**
*
*/
export function closeWindow(): void{
if (PluginHelper) {
return PluginHelper.closeWindow();
}
console.log('关闭窗口');
}
/** /**
* *

2
tsconfig.json

@ -3,7 +3,7 @@
"baseUrl": ".", "baseUrl": ".",
"outDir": "./dist/", "outDir": "./dist/",
"sourceMap": true, "sourceMap": true,
"noImplicitAny": true, "noImplicitAny": false,
"target": "es2017", "target": "es2017",
"module": "es2015", "module": "es2015",
"lib": [ "lib": [

1
types/globals.d.ts vendored

@ -5,3 +5,4 @@ interface Obj {
declare let BI: Obj; declare let BI: Obj;
declare const Fix: Obj; declare const Fix: Obj;
declare const Dec: Obj; declare const Dec: Obj;
declare const PluginHelper: Obj;

Loading…
Cancel
Save