From 4696a2553f0e708e5527c202ace1b23d2bed3269 Mon Sep 17 00:00:00 2001 From: alan Date: Tue, 28 May 2019 12:00:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89text=5Fvalue=5Fco?= =?UTF-8?q?mbo=E7=9A=84boder=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E8=87=AA=E5=B8=A6=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../right/right_edit/right_edit.model.ts | 2 +- .../connection/right/right_edit/right_edit.ts | 2 -- .../right/right_edit/right_edit_jndi.ts | 7 +++-- .../right/right_edit/right_edit_mysql.ts | 2 -- .../right/right_show/right_show.model.ts | 20 ++++++++++++++ .../right/right_show/right_show_jndi.ts | 26 ++++++++++++------- 6 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 src/app/connection/right/right_show/right_show.model.ts diff --git a/src/app/connection/right/right_edit/right_edit.model.ts b/src/app/connection/right/right_edit/right_edit.model.ts index 54e1f91..21f99ed 100644 --- a/src/app/connection/right/right_edit/right_edit.model.ts +++ b/src/app/connection/right/right_edit/right_edit.model.ts @@ -1,4 +1,4 @@ -export const className = 'report.model.components.right.edit'; +export const className = 'dec.dcm.model.components.right.edit'; export const Model = BI.inherit(Fix.Model, { state() { return { diff --git a/src/app/connection/right/right_edit/right_edit.ts b/src/app/connection/right/right_edit/right_edit.ts index 251d1d2..8393f0b 100644 --- a/src/app/connection/right/right_edit/right_edit.ts +++ b/src/app/connection/right/right_edit/right_edit.ts @@ -71,7 +71,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.driver, items: getDrivers(linkSelected), @@ -111,7 +110,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, items: [ diff --git a/src/app/connection/right/right_edit/right_edit_jndi.ts b/src/app/connection/right/right_edit/right_edit_jndi.ts index 2173e00..deb3836 100644 --- a/src/app/connection/right/right_edit/right_edit_jndi.ts +++ b/src/app/connection/right/right_edit/right_edit_jndi.ts @@ -11,7 +11,7 @@ const Widget = BI.inherit(BI.Widget, { }, watch: { isCollapse(isCollapse) { - const height = isCollapse ? 550 : 180; + const height = isCollapse ? 550 : 200; const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); this.jndiFormRef.setHeight(height); this.collapseRef.setText(text); @@ -39,12 +39,13 @@ const Widget = BI.inherit(BI.Widget, { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 180, + height: 200, ref: _ref => { this.jndiFormRef = _ref; }, form: { type: Vertical, + vgap: 10, items: [ { type: FormItem, @@ -52,7 +53,6 @@ const Widget = BI.inherit(BI.Widget, { width: 180, form: { type: TextValueCombo, - cls: 'bi-border', width: 300, value: factory, items: BI.map(JNDI_FACTORYS, (index: number, item: string) => { @@ -162,7 +162,6 @@ const Widget = BI.inherit(BI.Widget, { width: 180, form: { type: TextValueCombo, - cls: 'bi-border', width: 300, items: [{ text: BI.i18nText('Dec-Dcm_Connection_Form_Auto'), diff --git a/src/app/connection/right/right_edit/right_edit_mysql.ts b/src/app/connection/right/right_edit/right_edit_mysql.ts index bd3cc7f..ab3fe3e 100644 --- a/src/app/connection/right/right_edit/right_edit_mysql.ts +++ b/src/app/connection/right/right_edit/right_edit_mysql.ts @@ -43,7 +43,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_Driver'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.driver, items: getDrivers(linkSelected), @@ -83,7 +82,6 @@ const Widget: WidgetType = { text: BI.i18nText('Dec-Dcm_Connection_Form_OriginalCharsetName'), form: { type: TextValueCombo, - cls: 'bi-border', width: 300, text: linkSelected.originalCharsetName === '' ? BI.i18nText('Dec-Dcm_Connection_Form_Auto') : linkSelected.originalCharsetName, items: [ diff --git a/src/app/connection/right/right_show/right_show.model.ts b/src/app/connection/right/right_show/right_show.model.ts new file mode 100644 index 0000000..4209415 --- /dev/null +++ b/src/app/connection/right/right_show/right_show.model.ts @@ -0,0 +1,20 @@ +export const className = 'dec.dcm.model.components.right.show'; +export const Model = BI.inherit(Fix.Model, { + state() { + return { + isCollapse: false, + }; + }, + + computed: { + + }, + + actions: { + setIsCollapse(status: boolean) { + this.model.isCollapse = status; + }, + }, +}); +BI.model(className, Model); +export default className; diff --git a/src/app/connection/right/right_show/right_show_jndi.ts b/src/app/connection/right/right_show/right_show_jndi.ts index 41d6efb..8ac6b8c 100644 --- a/src/app/connection/right/right_show/right_show_jndi.ts +++ b/src/app/connection/right/right_show/right_show_jndi.ts @@ -2,9 +2,22 @@ import {Vertical, TextButton, Label} from '@ui'; import FormItem from '@shared/components/form_item'; import {OTHER_ATTRIBUTES} from '@private/constants'; import {AttributeType} from '../right.typing'; +import ModelName from './right_show.model'; const className = 'dec.dcm.component.right.show.jndi'; const Widget = BI.inherit(BI.Widget, { + _store() { + return BI.Models.getModel(ModelName); + }, + watch: { + isCollapse(isCollapse) { + const height = isCollapse ? 550 : 200; + const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); + this.jndiFormRef.setHeight(height); + this.collapseRef.setText(text); + this.otherAttributesRef.setVisible(isCollapse); + }, + }, render() { const {connectionName, url, factory, principal, credentials, originalCharsetName} = this.options; @@ -23,12 +36,13 @@ const Widget = BI.inherit(BI.Widget, { { type: FormItem, text: BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Context'), - height: 160, + height: 200, ref: _ref => { this.jndiFormRef = _ref; }, form: { type: Vertical, + vgap: 10, items: [ { type: FormItem, @@ -79,19 +93,13 @@ const Widget = BI.inherit(BI.Widget, { this.collapseRef = _ref; }, handler: () => { - const isCollapse = this.collapseRef.getValue(); - const height = isCollapse ? 550 : 160; - const text = isCollapse ? BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Collapse-Attributes') : BI.i18nText('Dec-Dcm_Connection_Form_JNDI_Other_Attributes'); - this.jndiFormRef.setHeight(height); - this.collapseRef.setValue(!isCollapse); - this.collapseRef.setText(text); - this.otherAttributesRef.setVisible(isCollapse); + this.store.setIsCollapse(!this.model.isCollapse); }, }, }, { type: Vertical, - invisible: false, + invisible: true, ref: _ref => { this.otherAttributesRef = _ref; },