Browse Source

Merge pull request #290 in ~GUY/fineui from ~WINDY/fineui:master to master

* commit 'a4884a9db2752f68dbc0b3f2468fedc748e7e3f8':
  trigger整理
es6
windy 7 years ago
parent
commit
7bf947a4a6
  1. 2
      demo/js/case/combo/demo.icon_text_value_combo.js
  2. 2
      demo/js/case/combo/demo.text_value_combo.js
  3. 96
      dist/bundle.js
  4. 4
      dist/bundle.min.js
  5. 94
      dist/case.js
  6. 4
      dist/demo.js
  7. 96
      dist/fineui.js
  8. 4
      dist/fineui.min.js
  9. 2
      dist/widget.js
  10. 5
      src/case/trigger/trigger.icon.text.js
  11. 30
      src/case/trigger/trigger.icon.text.select.js
  12. 9
      src/case/trigger/trigger.text.js
  13. 20
      src/case/trigger/trigger.text.select.js
  14. 30
      src/case/trigger/trigger.text.select.small.js
  15. 2
      src/widget/relationview/relationview.item.js

2
demo/js/case/combo/demo.icon_text_value_combo.js

@ -11,7 +11,7 @@ Demo.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
text: "默认值",
value: "默认值",
width: 300,
items: [{
text: "MVC-1",

2
demo/js/case/combo/demo.text_value_combo.js

@ -10,7 +10,7 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
type: "bi.text_value_combo",
value: "默认值",
width: 300,
items: [{

96
dist/bundle.js vendored

@ -75833,6 +75833,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap
});
this.trigerButton = BI.createWidget({
@ -75870,7 +75873,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -75892,7 +75894,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);/**
@ -75911,22 +75912,22 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SelectIconTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digist(o.value, o.items);
this.trigger = BI.createWidget({
type: "bi.icon_text_trigger",
element: this,
text: obj.text,
iconClass: obj.iconClass,
height: o.height
});
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
setValue: function (vals) {
_digist: function (vals, items) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result;
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.any(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.any(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value)) {
result = {
text: item.text || item.value,
@ -75937,14 +75938,24 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
});
if (BI.isNotNull(result)) {
this.trigger.setText(result.text);
this.trigger.setIcon(result.iconClass);
return {
text: result.text,
iconClass: result.iconClass
};
} else {
this.trigger.setText(o.value);
this.trigger.setIcon("");
return {
text: o.value,
iconClass: ""
};
}
},
setValue: function (vals) {
var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconClass);
},
populate: function (items) {
this.options.items = items;
}
@ -75977,6 +75988,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap,
readonly: o.readonly
});
@ -76000,14 +76014,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
});
},
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.text_trigger", BI.TextTrigger);/**
@ -76033,31 +76041,33 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.trigger = BI.createWidget({
type: "bi.text_trigger",
element: this,
height: o.height
height: o.height,
text: this._digest(o.text, o.items)
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.setText(result.join(","));
return result.join(",");
} else {
this.trigger.setText(o.text);
return o.text;
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}
@ -76081,36 +76091,44 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digest(o.text, o.items);
this.trigger = BI.createWidget({
type: "bi.small_text_trigger",
element: this,
height: o.height - 2
height: o.height - 2,
text: obj.text,
cls: obj.cls
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
return {
cls: "",
text: result.join(",")
}
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
return {
cls: "bi-water-mark",
text: o.text
}
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}
@ -91019,7 +91037,7 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
if (o.isPrimary) {
header.items.push({
type: "bi.icon",
width: 16,
width: 12,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});

4
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

94
dist/case.js vendored

@ -13687,6 +13687,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap
});
this.trigerButton = BI.createWidget({
@ -13724,7 +13727,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -13746,7 +13748,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);/**
@ -13765,22 +13766,22 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SelectIconTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digist(o.value, o.items);
this.trigger = BI.createWidget({
type: "bi.icon_text_trigger",
element: this,
text: obj.text,
iconClass: obj.iconClass,
height: o.height
});
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
setValue: function (vals) {
_digist: function (vals, items) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result;
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.any(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.any(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value)) {
result = {
text: item.text || item.value,
@ -13791,14 +13792,24 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
});
if (BI.isNotNull(result)) {
this.trigger.setText(result.text);
this.trigger.setIcon(result.iconClass);
return {
text: result.text,
iconClass: result.iconClass
};
} else {
this.trigger.setText(o.value);
this.trigger.setIcon("");
return {
text: o.value,
iconClass: ""
};
}
},
setValue: function (vals) {
var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconClass);
},
populate: function (items) {
this.options.items = items;
}
@ -13831,6 +13842,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap,
readonly: o.readonly
});
@ -13854,14 +13868,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
});
},
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.text_trigger", BI.TextTrigger);/**
@ -13887,31 +13895,33 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.trigger = BI.createWidget({
type: "bi.text_trigger",
element: this,
height: o.height
height: o.height,
text: this._digest(o.text, o.items)
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.setText(result.join(","));
return result.join(",");
} else {
this.trigger.setText(o.text);
return o.text;
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}
@ -13935,34 +13945,42 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digest(o.text, o.items);
this.trigger = BI.createWidget({
type: "bi.small_text_trigger",
element: this,
height: o.height - 2
height: o.height - 2,
text: obj.text,
cls: obj.cls
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
return {
cls: "",
text: result.join(",")
}
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
return {
cls: "bi-water-mark",
text: o.text
}
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {

4
dist/demo.js vendored

@ -1808,7 +1808,7 @@ Demo.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
text: "默认值",
value: "默认值",
width: 300,
items: [{
text: "MVC-1",
@ -1885,7 +1885,7 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.icon_text_value_combo",
type: "bi.text_value_combo",
value: "默认值",
width: 300,
items: [{

96
dist/fineui.js vendored

@ -77527,6 +77527,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap
});
this.trigerButton = BI.createWidget({
@ -77564,7 +77567,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -77586,7 +77588,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);/**
@ -77605,22 +77606,22 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SelectIconTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digist(o.value, o.items);
this.trigger = BI.createWidget({
type: "bi.icon_text_trigger",
element: this,
text: obj.text,
iconClass: obj.iconClass,
height: o.height
});
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
setValue: function (vals) {
_digist: function (vals, items) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result;
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.any(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.any(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value)) {
result = {
text: item.text || item.value,
@ -77631,14 +77632,24 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
});
if (BI.isNotNull(result)) {
this.trigger.setText(result.text);
this.trigger.setIcon(result.iconClass);
return {
text: result.text,
iconClass: result.iconClass
};
} else {
this.trigger.setText(o.value);
this.trigger.setIcon("");
return {
text: o.value,
iconClass: ""
};
}
},
setValue: function (vals) {
var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconClass);
},
populate: function (items) {
this.options.items = items;
}
@ -77671,6 +77682,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap,
readonly: o.readonly
});
@ -77694,14 +77708,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
});
},
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.text_trigger", BI.TextTrigger);/**
@ -77727,31 +77735,33 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.trigger = BI.createWidget({
type: "bi.text_trigger",
element: this,
height: o.height
height: o.height,
text: this._digest(o.text, o.items)
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.setText(result.join(","));
return result.join(",");
} else {
this.trigger.setText(o.text);
return o.text;
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}
@ -77775,36 +77785,44 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digest(o.text, o.items);
this.trigger = BI.createWidget({
type: "bi.small_text_trigger",
element: this,
height: o.height - 2
height: o.height - 2,
text: obj.text,
cls: obj.cls
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
return {
cls: "",
text: result.join(",")
}
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
return {
cls: "bi-water-mark",
text: o.text
}
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}
@ -92713,7 +92731,7 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
if (o.isPrimary) {
header.items.push({
type: "bi.icon",
width: 16,
width: 12,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/widget.js vendored

@ -14846,7 +14846,7 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
if (o.isPrimary) {
header.items.push({
type: "bi.icon",
width: 16,
width: 12,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});

5
src/case/trigger/trigger.icon.text.js

@ -26,6 +26,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap
});
this.trigerButton = BI.createWidget({
@ -63,7 +66,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -85,7 +87,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.icon_text_trigger", BI.IconTextTrigger);

30
src/case/trigger/trigger.icon.text.select.js

@ -14,22 +14,22 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SelectIconTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digist(o.value, o.items);
this.trigger = BI.createWidget({
type: "bi.icon_text_trigger",
element: this,
text: obj.text,
iconClass: obj.iconClass,
height: o.height
});
if (BI.isKey(o.value)) {
this.setValue(o.value);
}
},
setValue: function (vals) {
_digist: function (vals, items) {
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result;
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.any(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.any(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value)) {
result = {
text: item.text || item.value,
@ -40,14 +40,24 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
});
if (BI.isNotNull(result)) {
this.trigger.setText(result.text);
this.trigger.setIcon(result.iconClass);
return {
text: result.text,
iconClass: result.iconClass
};
} else {
this.trigger.setText(o.value);
this.trigger.setIcon("");
return {
text: o.value,
iconClass: ""
};
}
},
setValue: function (vals) {
var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconClass);
},
populate: function (items) {
this.options.items = items;
}

9
src/case/trigger/trigger.text.js

@ -26,6 +26,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left",
height: o.height,
text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap,
readonly: o.readonly
});
@ -49,14 +52,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
});
},
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setText: function (text) {
this.text.setText(text);
this.text.setTitle(text);
}
});
BI.shortcut("bi.text_trigger", BI.TextTrigger);

20
src/case/trigger/trigger.text.select.js

@ -21,31 +21,33 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.trigger = BI.createWidget({
type: "bi.text_trigger",
element: this,
height: o.height
height: o.height,
text: this._digest(o.text, o.items)
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.setText(result.join(","));
return result.join(",");
} else {
this.trigger.setText(o.text);
return o.text;
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}

30
src/case/trigger/trigger.text.select.small.js

@ -17,36 +17,44 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digest(o.text, o.items);
this.trigger = BI.createWidget({
type: "bi.small_text_trigger",
element: this,
height: o.height - 2
height: o.height - 2,
text: obj.text,
cls: obj.cls
});
if (BI.isKey(o.text)) {
this.setValue(o.text);
}
},
setValue: function (vals) {
_digest: function(vals, items){
var o = this.options;
vals = BI.isArray(vals) ? vals : [vals];
var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items);
BI.each(items, function (i, item) {
var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value);
}
});
if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark");
this.trigger.setText(result.join(","));
return {
cls: "",
text: result.join(",")
}
} else {
this.trigger.element.addClass("bi-water-mark");
this.trigger.setText(o.text);
return {
cls: "bi-water-mark",
text: o.text
}
}
},
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) {
this.options.items = items;
}

2
src/widget/relationview/relationview.item.js

@ -29,7 +29,7 @@ BI.RelationViewItem = BI.inherit(BI.BasicButton, {
if (o.isPrimary) {
header.items.push({
type: "bi.icon",
width: 16,
width: 12,
height: 16,
title: BI.i18nText("BI-Primary_Key")
});

Loading…
Cancel
Save