From 5824afdda940d046682b51af9f77b16aed3b73ad Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 4 Jun 2019 15:20:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BD=BF=E7=94=A8bi.linear=5Fsegme?= =?UTF-8?q?nt=E6=9B=BF=E6=8D=A2=E6=8E=89=E8=87=AA=E5=B7=B1=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E7=9A=84tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.ts | 2 +- src/app/title/item/title_item.service.ts | 13 ------- src/app/title/item/title_item.ts | 39 ------------------- .../title_item.model.ts => title.model.ts} | 0 src/app/title/title.ts | 35 +++++++++++------ src/ui/fineui.ts | 1 + 6 files changed, 26 insertions(+), 64 deletions(-) delete mode 100644 src/app/title/item/title_item.service.ts delete mode 100644 src/app/title/item/title_item.ts rename src/app/title/{item/title_item.model.ts => title.model.ts} (100%) diff --git a/src/app/app.ts b/src/app/app.ts index d198418..de16680 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,4 +1,4 @@ -import {Vtape, Absolute} from '../ui/index'; +import {Vtape, Absolute, LinearSegment} from '../ui/index'; import appModel from './app.model'; import title from './title/title'; import linkSet from './connection/link_set'; diff --git a/src/app/title/item/title_item.service.ts b/src/app/title/item/title_item.service.ts deleted file mode 100644 index 2bb4109..0000000 --- a/src/app/title/item/title_item.service.ts +++ /dev/null @@ -1,13 +0,0 @@ -export function getSelectStyle(status: string, nowStatus: string): any { - if (status === nowStatus) { - return { - color: '#3685f2', - 'border-bottom': 'solid 2px #3685f2', - }; - } - - return { - color: '#3d4d66', - 'border-bottom': 'none', - }; -} diff --git a/src/app/title/item/title_item.ts b/src/app/title/item/title_item.ts deleted file mode 100644 index b271a34..0000000 --- a/src/app/title/item/title_item.ts +++ /dev/null @@ -1,39 +0,0 @@ -import {Label} from '@ui'; -import tableItemModel from './title_item.model'; -import {getSelectStyle} from './title_item.service'; -const className = 'dec.dcm.title.item'; -const Widget = BI.inherit(BI.BasicButton, { - props: { - baseCls: 'bi-font-bold', - text: '', - }, - _store() { - return BI.Models.getModel(tableItemModel); - }, - watch: { - tab(tab: string) { - const {value} = this.options; - this.title.setStyle(getSelectStyle(value, tab)); - }, - }, - render() { - const {text} = this.options; - - return { - type: Label, - height: 40, - hgap: 15, - ref: _ref => { - this.title = _ref; - }, - text, - }; - }, - doClick() { - const {value} = this.options; - this.store.setTab(value); - }, -}); -BI.shortcut(className, Widget); - -export default className; diff --git a/src/app/title/item/title_item.model.ts b/src/app/title/title.model.ts similarity index 100% rename from src/app/title/item/title_item.model.ts rename to src/app/title/title.model.ts diff --git a/src/app/title/title.ts b/src/app/title/title.ts index 0cb46c4..1a31ea0 100644 --- a/src/app/title/title.ts +++ b/src/app/title/title.ts @@ -1,6 +1,6 @@ import './title.less'; -import {WidgetType, IconButton, LeftRightVerticalAdapt} from '@ui/index'; -import TitleItem from './item/title_item'; +import {WidgetType, IconButton, LeftRightVerticalAdapt, LinearSegment} from '@ui/index'; +import Model from './title.model'; import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants'; const className = 'dec.dcm.title'; @@ -8,23 +8,36 @@ const Widget: WidgetType = { props: { baseCls: 'dec-webui-dcm-title bi-card bi-border-bottom', }, + _store() { + return BI.Models.getModel(Model); + }, render() { const showCloseButton = isDesigner(); + const that = this; return { type: LeftRightVerticalAdapt, items: { left: [ { - type: TitleItem, - cls: 'title-item-selected bi-border-bottom', - text: BI.i18nText('Dec-Dcm_Connection_Management'), - value: TAB_LINK_SET, - }, - { - type: TitleItem, - text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), - value: TAB_LINK_POOL, + type: LinearSegment, + cls: 'bi-card', + height: 40, + width: 200, + items: [{ + text: BI.i18nText('Dec-Dcm_Connection_Management'), + value: TAB_LINK_SET, + selected: true, + }, { + text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), + value: TAB_LINK_POOL, + }], + listeners: [{ + eventName: 'EVENT_CHANGE', + action () { + that.store.setTab(this.getValue()[0]); + }, + }], }, ], right: [ diff --git a/src/ui/fineui.ts b/src/ui/fineui.ts index 8653849..f40ddad 100644 --- a/src/ui/fineui.ts +++ b/src/ui/fineui.ts @@ -34,6 +34,7 @@ export const TextBubblePopupBarView = 'bi.text_bubble_bar_popup_view'; export const BubbleCombo = 'bi.bubble_combo'; export const SearchEditor = 'bi.search_editor'; export const Img = 'bi.img'; +export const LinearSegment = 'bi.linear_segment'; // 布局 export const VerticalAdapt = 'bi.vertical_adapt';