Browse Source

relationview支持联合主键

es6
windy 7 years ago
parent
commit
4ca1f226b8
  1. 8
      demo/js/widget/relationview/demo.relationview.js
  2. 3
      demo/version.js
  3. 44
      dist/bundle.js
  4. 10
      dist/bundle.min.js
  5. 3
      dist/config.js
  6. 8
      dist/demo.js
  7. 44
      dist/widget.js
  8. 36
      src/widget/relationview/relationview.item.js
  9. 8
      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": "联合关联"
};

44
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,48 @@ 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: 90,
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
});
},
@ -91416,8 +91434,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 +91463,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字段"},

44
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,48 @@ 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: 90,
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
});
},
@ -15362,8 +15380,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 +15409,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;
},
// 获取上方开始划线的位置

36
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,48 @@ 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: 90,
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
});
},

8
src/widget/relationview/relationview.region.js

@ -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