fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

700 lines
24 KiB

8 years ago
Demo.Face = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-face"
},
8 years ago
_createLabel: function (text) {
return {
width: 200,
el: {
type: "bi.label",
text: text,
textAlign: "left",
hgap: 5,
height: 40,
cls: "config-label"
}
7 years ago
};
8 years ago
},
_createColorPicker: function (ref, action) {
return {
el: {
type: "bi.vertical_adapt",
items: [{
type: "bi.color_chooser",
listeners: [{
eventName: BI.ColorChooser.EVENT_CHANGE,
action: action
}],
ref: ref,
width: 30,
height: 30
}]
}
7 years ago
};
8 years ago
},
_createBackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("背景色:"), this._createColorPicker(function () {
self.backgroundColor = this;
}, function () {
self._runGlobalStyle();
})]
7 years ago
};
8 years ago
},
_createFontConfig: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("字体颜色:"), this._createColorPicker(function () {
self.fontColor = this;
}, function () {
self._runGlobalStyle();
})]
7 years ago
};
8 years ago
},
8 years ago
_createActiveFontConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("激活状态字体颜色:"), this._createColorPicker(function () {
self.activeFontColor = this;
}, function () {
self._runGlobalStyle();
7 years ago
}), {
width: 100,
el: {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试激活状态",
forceCenter: true
}
}]
7 years ago
};
8 years ago
},
_createSelectFontConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("选中状态字体颜色:"), this._createColorPicker(function () {
self.selectFontColor = this;
}, function () {
self._runGlobalStyle();
7 years ago
}), {
width: 100,
el: {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试选中状态",
forceCenter: true
}
}]
7 years ago
};
8 years ago
},
_createGrayFontConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
7 years ago
items: [this._createLabel("tip提示字体颜色:"), this._createColorPicker(function () {
8 years ago
self.grayFontColor = this;
}, function () {
self._runGlobalStyle();
7 years ago
}), {
width: 100,
el: {
type: "bi.icon_text_item",
cls: "bi-tips copy-font",
height: 40,
text: "测试提示文字"
}
}]
7 years ago
};
8 years ago
},
8 years ago
_createDisableFontConfig: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("灰化字体颜色:"), this._createColorPicker(function () {
self.disabledFontColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
el: {
type: "bi.text_button",
text: "这个按钮是灰化的",
forceCenter: true,
disabled: true
}
}]
7 years ago
};
8 years ago
},
7 years ago
_createCardBackgroundConfig: function () {
8 years ago
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
7 years ago
items: [this._createLabel("Card背景颜色:"), this._createColorPicker(function () {
8 years ago
self.cardBackgroundColor = this;
}, function () {
self._runGlobalStyle();
})]
7 years ago
};
8 years ago
},
_createHoverBackgroundColor: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("悬浮状态背景颜色:"), this._createColorPicker(function () {
self.hoverBackgroundColor = this;
}, function () {
self._runGlobalStyle();
7 years ago
}), {
width: 100,
el: {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试悬浮状态",
forceCenter: true
}
}]
7 years ago
};
8 years ago
},
_createActiveBackgroundColor: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("激活状态背景颜色:"), this._createColorPicker(function () {
self.activeBackgroundColor = this;
}, function () {
self._runGlobalStyle();
7 years ago
}), {
width: 100,
el: {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试激活状态",
forceCenter: true
}
}]
7 years ago
};
8 years ago
},
8 years ago
_createSelectBackgroundColor: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("选中状态背景颜色:"), this._createColorPicker(function () {
self.selectBackgroundColor = this;
}, function () {
self._runGlobalStyle();
7 years ago
}), {
width: 100,
el: {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试选中状态",
forceCenter: true
}
}]
7 years ago
};
8 years ago
},
_createSlitColor: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
7 years ago
items: [this._createLabel("分割线颜色:"), this._createColorPicker(function () {
8 years ago
self.slitColor = this;
}, function () {
self._runGlobalStyle();
})]
7 years ago
};
8 years ago
},
8 years ago
_createBaseConfig: function () {
return {
type: "bi.vertical",
8 years ago
items: [this._createLabel("--通用配色--"),
8 years ago
this._createBackgroundConfig(),
7 years ago
this._createCardBackgroundConfig(),
8 years ago
this._createFontConfig(),
8 years ago
this._createActiveFontConfig(),
this._createSelectFontConfig(),
this._createGrayFontConfig(),
8 years ago
this._createDisableFontConfig(),
this._createHoverBackgroundColor(),
8 years ago
this._createActiveBackgroundColor(),
this._createSelectBackgroundColor(),
this._createSlitColor()
8 years ago
]
7 years ago
};
8 years ago
},
8 years ago
_createButton1BackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("按钮背景色1:"), this._createColorPicker(function () {
self.button1BackgroundColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
el: {
type: "bi.vertical_adapt",
height: 40,
items: [{
type: "bi.button",
cls: "config-button1",
text: "测试按钮"
}]
}
}]
7 years ago
};
8 years ago
},
_createButton2BackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("按钮背景色2:"), this._createColorPicker(function () {
self.button2BackgroundColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
el: {
type: "bi.vertical_adapt",
height: 40,
items: [{
type: "bi.button",
level: "success",
cls: "config-button2",
text: "测试按钮"
}]
}
}]
7 years ago
};
8 years ago
},
_createButton3BackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("按钮背景色3:"), this._createColorPicker(function () {
self.button3BackgroundColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
el: {
type: "bi.vertical_adapt",
height: 40,
items: [{
type: "bi.button",
level: "warning",
cls: "config-button3",
text: "测试按钮"
}]
}
}]
7 years ago
};
8 years ago
},
_createButton4BackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
cls: "config-item bi-border-bottom",
height: 40,
items: [this._createLabel("按钮背景色4:"), this._createColorPicker(function () {
self.button4BackgroundColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
el: {
type: "bi.vertical_adapt",
height: 40,
items: [{
type: "bi.button",
level: "ignore",
cls: "config-button4",
text: "测试按钮"
}]
}
}]
7 years ago
};
8 years ago
},
8 years ago
_createScrollBackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("滚动条底色:"), this._createColorPicker(function () {
self.scrollBackgroundColor = this;
}, function () {
self._runGlobalStyle();
})]
7 years ago
};
8 years ago
},
_createScrollThumbConfig: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("滚动条thumb颜色:"), this._createColorPicker(function () {
self.scrollThumbColor = this;
}, function () {
self._runGlobalStyle();
})]
7 years ago
};
8 years ago
},
_createPopupBackgroundConfig: function () {
8 years ago
var self = this;
8 years ago
return {
8 years ago
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("下拉框背景颜色:"), this._createColorPicker(function () {
self.popupBackgroundColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
8 years ago
el: {
8 years ago
type: "bi.vertical_adapt",
items: [{
type: "bi.down_list_combo",
items: [[{
el: {
text: "column 1111",
iconCls1: "check-mark-e-font",
value: 11
},
children: [
{
text: "column 1.1",
value: 21,
cls: "dot-e-font",
selected: true
}, {
text: "column 1.222222222222222222222222222222222222",
cls: "dot-e-font",
7 years ago
value: 22
8 years ago
}, {
text: "column 1.3",
cls: "dot-e-font",
7 years ago
value: 23
8 years ago
}, {
text: "column 1.4",
cls: "dot-e-font",
7 years ago
value: 24
8 years ago
}, {
text: "column 1.5",
cls: "dot-e-font",
value: 25
}
]
}], [
{
el: {
type: "bi.icon_text_icon_item",
text: "column 2",
iconCls1: "chart-type-e-font",
cls: "dot-e-font",
value: 12
},
disabled: true,
children: [{
type: "bi.icon_text_item",
cls: "dot-e-font",
height: 25,
text: "column 2.1",
value: 11
7 years ago
}, {text: "column 2.2", value: 12, cls: "dot-e-font"}]
8 years ago
}
], [
{
text: "column 33333333333333333333333333333333",
cls: "style-set-e-font",
value: 13
}
], [
{
text: "column 4",
cls: "filter-e-font",
value: 14
}
], [
{
text: "column 5",
cls: "copy-e-font",
value: 15
}
], [
{
text: "column 6",
cls: "delete-e-font",
value: 16
}
], [
{
text: "column 7",
cls: "dimension-from-e-font",
value: 17,
disabled: true
}
]]
}]
}
8 years ago
}]
7 years ago
};
8 years ago
},
8 years ago
_createMaskBackgroundConfig: function () {
var self = this;
return {
type: "bi.htape",
8 years ago
cls: "config-item bi-border-bottom",
8 years ago
height: 40,
items: [this._createLabel("弹出层蒙版颜色:"), this._createColorPicker(function () {
self.maskBackgroundColor = this;
}, function () {
self._runGlobalStyle();
}), {
width: 100,
el: {
type: "bi.vertical_adapt",
items: [{
type: "bi.button",
text: "mask测试",
handler: function () {
7 years ago
BI.Msg.alert("弹出层", "弹出层面板");
8 years ago
}
}]
}
}]
7 years ago
};
8 years ago
},
_createCommonConfig: function () {
return {
type: "bi.vertical",
items: [this._createLabel("--一般配色--"),
8 years ago
this._createButton1BackgroundConfig(),
this._createButton2BackgroundConfig(),
this._createButton3BackgroundConfig(),
this._createButton4BackgroundConfig(),
8 years ago
this._createScrollBackgroundConfig(),
this._createScrollThumbConfig(),
this._createPopupBackgroundConfig(),
this._createMaskBackgroundConfig()
]
7 years ago
};
8 years ago
},
render: function () {
var self = this;
return {
type: "bi.grid",
items: [[{
column: 0,
row: 0,
el: {
8 years ago
type: "demo.preview"
8 years ago
}
}, {
column: 1,
row: 0,
el: {
8 years ago
type: "bi.vertical",
8 years ago
cls: "face-config bi-border-left",
8 years ago
items: [this._createBaseConfig(),
this._createCommonConfig()]
8 years ago
}
}]]
7 years ago
};
8 years ago
},
_setStyle: function (objects) {
var result = "";
BI.each(objects, function (cls, object) {
result += cls + "{";
BI.each(object, function (name, value) {
7 years ago
result += name + ":" + value + ";";
8 years ago
});
result += "} ";
});
BI.StyleLoaders.removeStyle("style").loadStyle("style", result);
},
_runGlobalStyle: function () {
var backgroundColor = this.backgroundColor.getValue();
var fontColor = this.fontColor.getValue();
8 years ago
var activeFontColor = this.activeFontColor.getValue();
var selectFontColor = this.selectFontColor.getValue();
var grayFontColor = this.grayFontColor.getValue();
8 years ago
var disabledFontColor = this.disabledFontColor.getValue();
var cardBackgroundColor = this.cardBackgroundColor.getValue();
var hoverBackgroundColor = this.hoverBackgroundColor.getValue();
var activeBackgroundColor = this.activeBackgroundColor.getValue();
8 years ago
var selectBackgroundColor = this.selectBackgroundColor.getValue();
var slitColor = this.slitColor.getValue();
8 years ago
8 years ago
var button1BackgroundColor = this.button1BackgroundColor.getValue();
var button2BackgroundColor = this.button2BackgroundColor.getValue();
var button3BackgroundColor = this.button3BackgroundColor.getValue();
var button4BackgroundColor = this.button4BackgroundColor.getValue();
8 years ago
var scrollBackgroundColor = this.scrollBackgroundColor.getValue();
var scrollThumbColor = this.scrollThumbColor.getValue();
var popupBackgroundColor = this.popupBackgroundColor.getValue();
var maskBackgroundColor = this.maskBackgroundColor.getValue();
this._setStyle({
8 years ago
"#wrapper.bi-background, #wrapper .bi-background": {
"background-color": backgroundColor,
7 years ago
color: fontColor
8 years ago
},
8 years ago
"#wrapper .bi-card": {
7 years ago
"background-color": cardBackgroundColor,
color: fontColor
8 years ago
},
8 years ago
"#wrapper .bi-tips": {
7 years ago
color: grayFontColor
8 years ago
},
8 years ago
"div::-webkit-scrollbar,.scrollbar-layout-main": {
"background-color": scrollBackgroundColor + "!important"
},
"div::-webkit-scrollbar-thumb,.public-scrollbar-face:after": {
"background-color": scrollThumbColor + "!important"
},
".base-disabled": {
color: disabledFontColor + "!important"
},
".base-disabled .b-font:before": {
color: disabledFontColor + "!important"
},
".list-view-outer": {
"background-color": popupBackgroundColor + "!important"
},
".bi-z-index-mask": {
"background-color": maskBackgroundColor + "!important"
},
".bi-list-item:hover,.bi-list-item-hover:hover,.bi-list-item-active:hover,.bi-list-item-select:hover,.bi-list-item-effect:hover": {
8 years ago
"background-color": hoverBackgroundColor + "!important"
8 years ago
},
".bi-list-item-active:active,.bi-list-item-select:active,.bi-list-item-effect:active": {
8 years ago
"background-color": activeBackgroundColor + "!important",
7 years ago
color: activeFontColor + "!important"
8 years ago
},
".bi-list-item-active.active,.bi-list-item-select.active,.bi-list-item-effect.active": {
"background-color": selectBackgroundColor + "!important",
7 years ago
color: selectFontColor + "!important"
8 years ago
},
".bi-button": {
"background-color": button1BackgroundColor,
"border-color": button1BackgroundColor
},
".bi-button.button-success": {
"background-color": button2BackgroundColor,
"border-color": button2BackgroundColor
},
".bi-button.button-warning": {
"background-color": button3BackgroundColor,
"border-color": button3BackgroundColor
},
".bi-button.button-ignore": {
"background-color": button4BackgroundColor
},
7 years ago
// 以下是分割线颜色
"#wrapper .bi-border,#wrapper .bi-border-top,#wrapper .bi-border-bottom,#wrapper .bi-border-left,#wrapper .bi-border-right": {
"border-color": slitColor
},
8 years ago
".bi-collection-table-cell": {
"border-right-color": slitColor,
"border-bottom-color": slitColor
},
".bi-collection-table-cell.first-col": {
"border-left-color": slitColor
},
".bi-collection-table-cell.first-row": {
"border-top-color": slitColor
8 years ago
}
7 years ago
});
8 years ago
},
8 years ago
mounted: function () {
8 years ago
this.backgroundColor.setValue("");
this.fontColor.setValue("");
8 years ago
this.activeFontColor.setValue("");
this.selectFontColor.setValue("");
this.grayFontColor.setValue("");
8 years ago
this.disabledFontColor.setValue("");
this.cardBackgroundColor.setValue("");
this.hoverBackgroundColor.setValue("");
this.activeBackgroundColor.setValue("");
8 years ago
this.selectBackgroundColor.setValue("");
8 years ago
8 years ago
this.button1BackgroundColor.setValue("");
this.button2BackgroundColor.setValue("");
this.button3BackgroundColor.setValue("");
this.button4BackgroundColor.setValue("");
8 years ago
this.scrollBackgroundColor.setValue("");
this.scrollThumbColor.setValue("");
this.popupBackgroundColor.setValue("");
this.maskBackgroundColor.setValue("");
8 years ago
this.slitColor.setValue("");
8 years ago
this._runGlobalStyle();
8 years ago
}
});
8 years ago
BI.shortcut("demo.face", Demo.Face);