Browse Source

refactor: 优化BI.BasicButton的用法

qufenxi
alan 6 years ago
parent
commit
a99a87d336
  1. 11
      src/app/connection/left/item/left_item.ts
  2. 1
      src/app/connection/left/item/left_item_icon.ts
  3. 7
      src/app/status/left/left_item.ts
  4. 2
      src/app/title/item/title_item.ts
  5. 6
      src/app/title/title.ts

11
src/app/connection/left/item/left_item.ts

@ -1,4 +1,4 @@
import {WidgetType, Left, Label, Icon, TextButton, Right, LeftRightVerticalAdapt} from '@ui';
import {WidgetType, Icon, TextButton, LeftRightVerticalAdapt} from '@ui';
import ItemIcon from './left_item_icon';
import Model from '../../link_set.model';
import {ACTION_COPY, ACTION_TEST, ACTION_DELETE, DEFAULT_INFO} from '@private/constants';
@ -36,9 +36,6 @@ const Widget: WidgetType = {
textAlign: 'left',
text: title,
title,
handler: () => {
this.store.setLinkSelected(title);
},
},
],
right: [
@ -73,6 +70,10 @@ const Widget: WidgetType = {
},
};
},
doClick() {
const {title} = this.options;
this.store.setLinkSelected(title);
},
};
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
BI.shortcut(className, BI.inherit(BI.BasicButton, Widget));
export default className;

1
src/app/connection/left/item/left_item_icon.ts

@ -64,6 +64,7 @@ const Widget: WidgetType = {
type: IconButton,
height: 24,
width: 26,
stopEvent: true,
title,
handler: () => {
const {value, id, title} = this.options;

7
src/app/status/left/left_item.ts

@ -26,13 +26,14 @@ const Widget: WidgetType = {
textAlign: 'left',
text: title,
title,
handler: () => {
this.store.setStatusSelected(title);
},
},
],
};
},
doClick() {
const {title} = this.options;
this.store.setStatusSelected(title);
},
};
BI.shortcut(className, BI.inherit(BI.BasicButton, Widget));
export default className;

2
src/app/title/item/title_item.ts

@ -26,7 +26,7 @@ const Widget = BI.inherit(BI.BasicButton, {
text,
};
},
select() {
doClick() {
const {value} = this.options;
this.store.setTab(value);
},

6
src/app/title/title.ts

@ -17,17 +17,11 @@ const Widget: WidgetType = {
cls: 'title-item-selected',
text: BI.i18nText('Dec-Dcm_Connection_Management'),
value: TAB_LINK_SET,
handler() {
this.select();
},
},
{
type: TitleItem,
text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'),
value: TAB_LINK_POOL,
handler() {
this.select();
},
},
],
right: [

Loading…
Cancel
Save