Browse Source

trigger整理

es6
windy 7 years ago
parent
commit
f197ea70b3
  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. 2
      dist/bundle.min.css
  5. 36
      dist/bundle.min.js
  6. 94
      dist/case.js
  7. 4
      dist/demo.js
  8. 96
      dist/fineui.js
  9. 2
      dist/fineui.min.css
  10. 82
      dist/fineui.min.js
  11. 2
      dist/widget.js
  12. 5
      src/case/trigger/trigger.icon.text.js
  13. 30
      src/case/trigger/trigger.icon.text.select.js
  14. 9
      src/case/trigger/trigger.text.js
  15. 20
      src/case/trigger/trigger.text.select.js
  16. 30
      src/case/trigger/trigger.text.select.small.js
  17. 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

@ -75839,6 +75839,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({
@ -75876,7 +75879,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -75898,7 +75900,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);/**
@ -75917,22 +75918,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,
@ -75943,14 +75944,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;
}
@ -75983,6 +75994,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
});
@ -76006,14 +76020,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);/**
@ -76039,31 +76047,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;
}
@ -76087,36 +76097,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;
}
@ -91025,7 +91043,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")
});

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

36
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

94
dist/case.js vendored

@ -13693,6 +13693,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({
@ -13730,7 +13733,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -13752,7 +13754,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);/**
@ -13771,22 +13772,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,
@ -13797,14 +13798,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;
}
@ -13837,6 +13848,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
});
@ -13860,14 +13874,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);/**
@ -13893,31 +13901,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;
}
@ -13941,36 +13951,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;
}

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

@ -77533,6 +77533,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({
@ -77570,7 +77573,6 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setValue: function (value) {
this.text.setValue(value);
this.text.setTitle(value);
},
setIcon: function (iconCls) {
@ -77592,7 +77594,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);/**
@ -77611,22 +77612,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,
@ -77637,14 +77638,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;
}
@ -77677,6 +77688,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
});
@ -77700,14 +77714,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);/**
@ -77733,31 +77741,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;
}
@ -77781,36 +77791,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;
}
@ -92719,7 +92737,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")
});

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

82
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