Browse Source

Merge pull request #217 in FUI/fineui from ~GUY/fineui:master to master

* commit '09e5f9d3e211cc7d829634a52455b81e95ffc9b4':
  样式
  relationview支持联合主键
  relationView同一层级的两个region高度不同,矮的那个下部的连线会少一截
master
guy 7 years ago
parent
commit
24fc83f1cd
  1. 8
      demo/js/widget/relationview/demo.relationview.js
  2. 3
      demo/version.js
  3. 47
      dist/bundle.js
  4. 10
      dist/bundle.min.js
  5. 3
      dist/config.js
  6. 8
      dist/demo.js
  7. 47
      dist/widget.js
  8. 35
      src/widget/relationview/relationview.item.js
  9. 2
      src/widget/relationview/relationview.js
  10. 10
      src/widget/relationview/relationview.region.js

8
demo/js/widget/relationview/demo.relationview.js

@ -11,18 +11,18 @@ Demo.RelationView = BI.inherit(BI.Widget, {
items: [
{
primary: {
region: "B", regionText: "比", regionTitle: "bbb", regionHandler: function () {
region: "B", regionText: "比", text: ["try", "try1"], regionTitle: "bbb", regionHandler: function () {
alert("a");
},
isPrimary: true,
title: "b2...",
value: "b2", text: "b2字段",
value: "b2",
handler: function () {
alert("d");
}
},
foreign: {region: "C", value: "c1", text: "c1字段"}
foreign: {region: "C", text: ["try", "try1"], value: "c1"}
},
{
primary: {region: "A", value: "a1", text: "a1字段"},

3
demo/version.js

@ -126,5 +126,6 @@ BI.i18n = {
"BI-Basic_Simple_Thursday": "四",
"BI-Multi_Date_Year_Prev": "年前",
"BI-Tiao_Data": "条数据",
"BI-Basic_Italic": "斜体"
"BI-Basic_Italic": "斜体",
"BI-Basic_Union_Relation": "联合关联"
};

47
dist/bundle.js vendored

@ -90879,7 +90879,6 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-relation-view-item bi-list-item-active",
height: 25,
hoverIn: BI.emptyFn,
hoverOut: BI.emptyFn
});
@ -90889,29 +90888,47 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
BI.RelationViewItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.element.hover(o.hoverIn, o.hoverOut);
var items = [];
o.text = BI.isArray(o.text) ? o.text : [o.text];
var body = [];
var header = {
type: "bi.vertical_adapt",
cls: "primary-key-font",
items: []
};
if (o.isPrimary) {
items.push({
header.items.push({
type: "bi.icon",
width: 16,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});
}
items.push({
header.items.push({
type: "bi.label",
text: o.text,
text: o.text.length > 1 ? BI.i18nText("BI-Basic_Union_Relation") : o.text[0],
value: o.value,
height: o.height,
height: 25,
textAlign: "left",
width: o.isPrimary ? 70 : 90,
lgap: o.isPrimary ? 0 : 10
});
if(o.text.length > 1){
body = BI.map(o.text, function (idx, text) {
return {
type: "bi.label",
text: text,
value: o.value,
height: 25,
textAlign: "left",
width: 70,
lgap: 20
}
})
}
BI.createWidget({
type: "bi.vertical_adapt",
type: "bi.vertical",
element: this,
items: items,
cls: "primary-key-font",
items: BI.concat([header], body),
lgap: 5
});
},
@ -91161,7 +91178,7 @@ BI.RelationView = BI.inherit(BI.Widget, {
// }
var draw = function (i, j, direction, isForeign) {
var x = offsetWidths[j] + (widths[j] - views[i][j].getWidth()) / 2;
var y = offsetHeights[i] + (heights[i] - views[i][j].getHeight()) / 2;
var y = offsetHeights[i];
var path = "", position;
switch (direction) {
case top:
@ -91404,7 +91421,7 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
cls: "relation-view-region-container bi-card bi-border " + (o.belongPackage ? "" : "other-package"),
items: [{
type: "bi.vertical_adapt",
cls: "relation-view-region-title bi-border-bottom",
cls: "relation-view-region-title bi-border-bottom bi-background",
items: [this.preview, this.title]
}, this.button_group]
}],
@ -91416,8 +91433,10 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
_createItems: function (items) {
var self = this;
return BI.map(items, function (i, item) {
var texts = BI.isArray(item.text) ? item.text : [item.text];
return BI.extend(item, {
type: "bi.relation_view_item",
height: texts.length > 1 ? (texts.length + 1) * 25 : 25,
hoverIn: function () {
self.setValue(item.value);
self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN, item.value);
@ -91443,7 +91462,11 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
},
getHeight: function () {
return this.button_group.getAllButtons().length * 25 + 25 + 2 * 20 + 3;
var height = 0;
BI.each(this.button_group.getAllButtons(), function (idx, button) {
height += button.getHeight();
});
return height + 25 + 2 * 20 + 3;
},
// 获取上方开始划线的位置

10
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

3
dist/config.js vendored

@ -126,5 +126,6 @@ BI.i18n = {
"BI-Basic_Simple_Thursday": "四",
"BI-Multi_Date_Year_Prev": "年前",
"BI-Tiao_Data": "条数据",
"BI-Basic_Italic": "斜体"
"BI-Basic_Italic": "斜体",
"BI-Basic_Union_Relation": "联合关联"
};

8
dist/demo.js vendored

@ -13072,18 +13072,18 @@ Demo.RelationView = BI.inherit(BI.Widget, {
items: [
{
primary: {
region: "B", regionText: "比", regionTitle: "bbb", regionHandler: function () {
region: "B", regionText: "比", text: ["try", "try1"], regionTitle: "bbb", regionHandler: function () {
alert("a");
},
isPrimary: true,
title: "b2...",
value: "b2", text: "b2字段",
value: "b2",
handler: function () {
alert("d");
}
},
foreign: {region: "C", value: "c1", text: "c1字段"}
foreign: {region: "C", text: ["try", "try1"], value: "c1"}
},
{
primary: {region: "A", value: "a1", text: "a1字段"},

47
dist/widget.js vendored

@ -14825,7 +14825,6 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-relation-view-item bi-list-item-active",
height: 25,
hoverIn: BI.emptyFn,
hoverOut: BI.emptyFn
});
@ -14835,29 +14834,47 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
BI.RelationViewItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.element.hover(o.hoverIn, o.hoverOut);
var items = [];
o.text = BI.isArray(o.text) ? o.text : [o.text];
var body = [];
var header = {
type: "bi.vertical_adapt",
cls: "primary-key-font",
items: []
};
if (o.isPrimary) {
items.push({
header.items.push({
type: "bi.icon",
width: 16,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});
}
items.push({
header.items.push({
type: "bi.label",
text: o.text,
text: o.text.length > 1 ? BI.i18nText("BI-Basic_Union_Relation") : o.text[0],
value: o.value,
height: o.height,
height: 25,
textAlign: "left",
width: o.isPrimary ? 70 : 90,
lgap: o.isPrimary ? 0 : 10
});
if(o.text.length > 1){
body = BI.map(o.text, function (idx, text) {
return {
type: "bi.label",
text: text,
value: o.value,
height: 25,
textAlign: "left",
width: 70,
lgap: 20
}
})
}
BI.createWidget({
type: "bi.vertical_adapt",
type: "bi.vertical",
element: this,
items: items,
cls: "primary-key-font",
items: BI.concat([header], body),
lgap: 5
});
},
@ -15107,7 +15124,7 @@ BI.RelationView = BI.inherit(BI.Widget, {
// }
var draw = function (i, j, direction, isForeign) {
var x = offsetWidths[j] + (widths[j] - views[i][j].getWidth()) / 2;
var y = offsetHeights[i] + (heights[i] - views[i][j].getHeight()) / 2;
var y = offsetHeights[i];
var path = "", position;
switch (direction) {
case top:
@ -15350,7 +15367,7 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
cls: "relation-view-region-container bi-card bi-border " + (o.belongPackage ? "" : "other-package"),
items: [{
type: "bi.vertical_adapt",
cls: "relation-view-region-title bi-border-bottom",
cls: "relation-view-region-title bi-border-bottom bi-background",
items: [this.preview, this.title]
}, this.button_group]
}],
@ -15362,8 +15379,10 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
_createItems: function (items) {
var self = this;
return BI.map(items, function (i, item) {
var texts = BI.isArray(item.text) ? item.text : [item.text];
return BI.extend(item, {
type: "bi.relation_view_item",
height: texts.length > 1 ? (texts.length + 1) * 25 : 25,
hoverIn: function () {
self.setValue(item.value);
self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN, item.value);
@ -15389,7 +15408,11 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
},
getHeight: function () {
return this.button_group.getAllButtons().length * 25 + 25 + 2 * 20 + 3;
var height = 0;
BI.each(this.button_group.getAllButtons(), function (idx, button) {
height += button.getHeight();
});
return height + 25 + 2 * 20 + 3;
},
// 获取上方开始划线的位置

35
src/widget/relationview/relationview.item.js

@ -10,7 +10,6 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-relation-view-item bi-list-item-active",
height: 25,
hoverIn: BI.emptyFn,
hoverOut: BI.emptyFn
});
@ -20,29 +19,47 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
BI.RelationViewItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.element.hover(o.hoverIn, o.hoverOut);
var items = [];
o.text = BI.isArray(o.text) ? o.text : [o.text];
var body = [];
var header = {
type: "bi.vertical_adapt",
cls: "primary-key-font",
items: []
};
if (o.isPrimary) {
items.push({
header.items.push({
type: "bi.icon",
width: 16,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});
}
items.push({
header.items.push({
type: "bi.label",
text: o.text,
text: o.text.length > 1 ? BI.i18nText("BI-Basic_Union_Relation") : o.text[0],
value: o.value,
height: o.height,
height: 25,
textAlign: "left",
width: o.isPrimary ? 70 : 90,
lgap: o.isPrimary ? 0 : 10
});
if(o.text.length > 1){
body = BI.map(o.text, function (idx, text) {
return {
type: "bi.label",
text: text,
value: o.value,
height: 25,
textAlign: "left",
width: 70,
lgap: 20
}
})
}
BI.createWidget({
type: "bi.vertical_adapt",
type: "bi.vertical",
element: this,
items: items,
cls: "primary-key-font",
items: BI.concat([header], body),
lgap: 5
});
},

2
src/widget/relationview/relationview.js

@ -233,7 +233,7 @@ BI.RelationView = BI.inherit(BI.Widget, {
// }
var draw = function (i, j, direction, isForeign) {
var x = offsetWidths[j] + (widths[j] - views[i][j].getWidth()) / 2;
var y = offsetHeights[i] + (heights[i] - views[i][j].getHeight()) / 2;
var y = offsetHeights[i];
var path = "", position;
switch (direction) {
case top:

10
src/widget/relationview/relationview.region.js

@ -65,7 +65,7 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
cls: "relation-view-region-container bi-card bi-border " + (o.belongPackage ? "" : "other-package"),
items: [{
type: "bi.vertical_adapt",
cls: "relation-view-region-title bi-border-bottom",
cls: "relation-view-region-title bi-border-bottom bi-background",
items: [this.preview, this.title]
}, this.button_group]
}],
@ -77,8 +77,10 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
_createItems: function (items) {
var self = this;
return BI.map(items, function (i, item) {
var texts = BI.isArray(item.text) ? item.text : [item.text];
return BI.extend(item, {
type: "bi.relation_view_item",
height: texts.length > 1 ? (texts.length + 1) * 25 : 25,
hoverIn: function () {
self.setValue(item.value);
self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN, item.value);
@ -104,7 +106,11 @@ BI.RelationViewRegion = BI.inherit(BI.BasicButton, {
},
getHeight: function () {
return this.button_group.getAllButtons().length * 25 + 25 + 2 * 20 + 3;
var height = 0;
BI.each(this.button_group.getAllButtons(), function (idx, button) {
height += button.getHeight();
});
return height + 25 + 2 * 20 + 3;
},
// 获取上方开始划线的位置

Loading…
Cancel
Save