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", type: "bi.horizontal_auto",
items: [{ items: [{
type: "bi.icon_text_value_combo", type: "bi.icon_text_value_combo",
text: "默认值", value: "默认值",
width: 300, width: 300,
items: [{ items: [{
text: "MVC-1", text: "MVC-1",

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

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

96
dist/bundle.js vendored

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

4
dist/demo.js vendored

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

96
dist/fineui.js vendored

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

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

@ -26,6 +26,9 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
title: function () {
return o.text;
},
hgap: c.hgap, hgap: c.hgap,
readonly: o.readonly 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
this.text.setTitle(text);
} }
}); });
BI.shortcut("bi.text_trigger", BI.TextTrigger); 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({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, 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; var o = this.options;
vals = BI.isArray(vals) ? vals : [vals]; vals = BI.isArray(vals) ? vals : [vals];
var result = []; var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items); var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(items, function (i, item) { BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) { if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value); result.push(item.text || item.value);
} }
}); });
if (result.length > 0) { if (result.length > 0) {
this.trigger.setText(result.join(",")); return result.join(",");
} else { } else {
this.trigger.setText(o.text); return o.text;
} }
}, },
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) { populate: function (items) {
this.options.items = 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; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, 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; var o = this.options;
vals = BI.isArray(vals) ? vals : [vals]; vals = BI.isArray(vals) ? vals : [vals];
var result = []; var result = [];
var items = BI.Tree.transformToArrayFormat(this.options.items); var formatItems = BI.Tree.transformToArrayFormat(items);
BI.each(items, function (i, item) { BI.each(formatItems, function (i, item) {
if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) { if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) {
result.push(item.text || item.value); result.push(item.text || item.value);
} }
}); });
if (result.length > 0) { if (result.length > 0) {
this.trigger.element.removeClass("bi-water-mark"); return {
this.trigger.setText(result.join(",")); cls: "",
text: result.join(",")
}
} else { } else {
this.trigger.element.addClass("bi-water-mark"); return {
this.trigger.setText(o.text); cls: "bi-water-mark",
text: o.text
}
} }
}, },
setValue: function (vals) {
this.trigger.setText(this._digest(vals, this.options.items));
},
populate: function (items) { populate: function (items) {
this.options.items = 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) { if (o.isPrimary) {
header.items.push({ header.items.push({
type: "bi.icon", type: "bi.icon",
width: 16, width: 12,
height: 16, height: 16,
title: BI.i18nText("BI-Primary_Key") title: BI.i18nText("BI-Primary_Key")
}); });

Loading…
Cancel
Save