Browse Source

REPORT-77978 fix: 下拉树水印表现异常问题

es6
zsmj 2 years ago
parent
commit
9018cbaa12
  1. 7
      src/case/editor/editor.state.simple.js
  2. 1
      src/component/treevaluechooser/combo.listtreevaluechooser.js
  3. 1
      src/component/treevaluechooser/combo.treevaluechooser.insert.js
  4. 1
      src/widget/multiselect/multiselect.trigger.js
  5. 2
      src/widget/multiselect/trigger/editor.multiselect.js
  6. 1
      src/widget/multiselect/trigger/searcher.multiselect.js
  7. 29
      src/widget/multitree/multi.tree.combo.js
  8. 29
      src/widget/multitree/multi.tree.list.combo.js
  9. 1
      src/widget/multitree/trigger/searcher.list.multi.tree.js
  10. 3
      src/widget/multitree/trigger/searcher.multi.tree.js

7
src/case/editor/editor.state.simple.js

@ -136,7 +136,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
items: [this.editor] items: [this.editor]
}); });
this._showHint(); this._showHint();
if(BI.isNotNull(o.text)){ if (BI.isNotNull(o.text)) {
this.setState(o.text); this.setState(o.text);
} }
}, },
@ -232,6 +232,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
setState: function (v) { setState: function (v) {
var o = this.options; var o = this.options;
BI.SimpleStateEditor.superclass.setValue.apply(this, arguments); BI.SimpleStateEditor.superclass.setValue.apply(this, arguments);
var defaultText = BI.isFunction(o.defaultText) ? o.defaultText() : o.defaultText;
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this._setText(BI.i18nText("BI-Already_Selected")); this._setText(BI.i18nText("BI-Already_Selected"));
@ -240,7 +241,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
this._setText(BI.i18nText("BI-Already_Selected")); this._setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("bi-water-mark"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this._setText(o.text); this._setText(BI.isKey(defaultText) ? defaultText : o.text);
this.text.element.addClass("bi-water-mark"); this.text.element.addClass("bi-water-mark");
} }
return; return;
@ -280,4 +281,4 @@ BI.SimpleStateEditor.EVENT_RESTRICT = "EVENT_RESTRICT";
BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE"; BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE";
BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY";
BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor); BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);

1
src/component/treevaluechooser/combo.listtreevaluechooser.js

@ -30,6 +30,7 @@ BI.ListTreeValueChooserInsertCombo = BI.inherit(BI.AbstractListTreeValueChooser,
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
element: this, element: this,
text: o.text, text: o.text,
defaultText: o.defaultText,
value: o.value, value: o.value,
watermark: o.watermark, watermark: o.watermark,
allowInsertValue: o.allowInsertValue, allowInsertValue: o.allowInsertValue,

1
src/component/treevaluechooser/combo.treevaluechooser.insert.js

@ -30,6 +30,7 @@ BI.TreeValueChooserInsertCombo = BI.inherit(BI.AbstractTreeValueChooser, {
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,
defaultText: o.defaultText,
value: o.value, value: o.value,
watermark: o.watermark, watermark: o.watermark,
element: this, element: this,

1
src/widget/multiselect/multiselect.trigger.js

@ -37,6 +37,7 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
type: "bi.multi_select_searcher", type: "bi.multi_select_searcher",
height: o.height, height: o.height,
text: o.text, text: o.text,
defaultText: o.defaultText,
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,

2
src/widget/multiselect/trigger/editor.multiselect.js

@ -24,7 +24,7 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, {
watermark: o.watermark, watermark: o.watermark,
allowBlank: true, allowBlank: true,
value: o.value, value: o.value,
defaultText: o.text, defaultText: o.defaultText,
text: o.text, text: o.text,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle, warningTitle: o.warningTitle,

1
src/widget/multiselect/trigger/searcher.multiselect.js

@ -27,6 +27,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
type: "bi.multi_select_editor", type: "bi.multi_select_editor",
height: o.height, height: o.height,
text: o.text, text: o.text,
defaultText: o.defaultText,
watermark: o.watermark, watermark: o.watermark,
listeners: [{ listeners: [{
eventName: BI.MultiSelectEditor.EVENT_FOCUS, eventName: BI.MultiSelectEditor.EVENT_FOCUS,

29
src/widget/multitree/multi.tree.combo.js

@ -22,7 +22,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.storeValue = {value: o.value || {}}; this.storeValue = { value: o.value || {} };
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
@ -30,6 +30,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
height: o.height - (o.simple ? 1 : 2), height: o.height - (o.simple ? 1 : 2),
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
text: o.text, text: o.text,
defaultText: o.defaultText,
watermark: o.watermark, watermark: o.watermark,
// adapter: this.popup, // adapter: this.popup,
masker: { masker: {
@ -44,7 +45,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
type: "bi.multi_tree_searcher", type: "bi.multi_tree_searcher",
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
}, },
value: {value: o.value || {}} value: { value: o.value || {} }
}); });
this.combo = BI.createWidget({ this.combo = BI.createWidget({
@ -105,7 +106,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
maxWidth: o.isNeedAdjustWidth ? "auto" : 500, maxWidth: o.isNeedAdjustWidth ? "auto" : 500,
}, },
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
value: {value: o.value || {}}, value: { value: o.value || {} },
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0; self.numberCounter.element.find(e.target).length === 0;
@ -131,12 +132,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
this.setValue(self.storeValue); this.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self.storeValue = {value: this.getValue()}; self.storeValue = { value: this.getValue() };
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
@ -151,11 +152,11 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.MultiTreeCombo.EVENT_SEARCHING); self.fireEvent(BI.MultiTreeCombo.EVENT_SEARCHING);
}); });
function showCounter () { function showCounter() {
if (isSearching()) { if (isSearching()) {
self.storeValue = {value: self.trigger.getValue()}; self.storeValue = { value: self.trigger.getValue() };
} else if (isPopupView()) { } else if (isPopupView()) {
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
} }
self.trigger.setValue(self.storeValue); self.trigger.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
@ -174,7 +175,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
var checked = this.getSearcher().hasChecked(); var checked = this.getSearcher().hasChecked();
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: checked ? {1: 1} : {} value: checked ? { 1: 1 } : {}
}; };
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
@ -186,7 +187,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
return; return;
} }
if (change === true) { if (change === true) {
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
change = false; change = false;
} }
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
@ -201,9 +202,9 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
} else { } else {
if (isPopupView()) { if (isPopupView()) {
self._stopEditing(); self._stopEditing();
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
if (clear === true) { if (clear === true) {
self.storeValue = {value: {}}; self.storeValue = { value: {} };
} }
self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM);
} }
@ -245,7 +246,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}, },
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
value: {value: o.value || {}} value: { value: o.value || {} }
}); });
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () {
if (!self.combo.isViewVisible()) { if (!self.combo.isViewVisible()) {
@ -306,7 +307,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
}); });
}, },
_stopEditing: function() { _stopEditing: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },

29
src/widget/multitree/multi.tree.list.combo.js

@ -14,6 +14,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
allowEdit: true, allowEdit: true,
allowInsertValue: true, allowInsertValue: true,
isNeedAdjustWidth: true, isNeedAdjustWidth: true,
text: "",
defaultText: "",
}); });
}, },
@ -23,12 +25,13 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
var isInit = false; var isInit = false;
var want2showCounter = false; var want2showCounter = false;
this.storeValue = {value: o.value || []}; this.storeValue = { value: o.value || [] };
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.multi_select_trigger", type: "bi.multi_select_trigger",
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,
defaultText: o.defaultText,
watermark: o.watermark, watermark: o.watermark,
height: o.height - (o.simple ? 1 : 2), height: o.height - (o.simple ? 1 : 2),
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
@ -74,7 +77,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator itemsCreator: o.itemsCreator
} }
}, },
value: {value: o.value || {}} value: { value: o.value || {} }
}); });
@ -139,7 +142,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
maxWidth: o.isNeedAdjustWidth ? "auto" : 500, maxWidth: o.isNeedAdjustWidth ? "auto" : 500,
}, },
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
value: {value: o.value || {}}, value: { value: o.value || {} },
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0; self.numberCounter.element.find(e.target).length === 0;
@ -165,12 +168,12 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () {
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
this.setValue(self.storeValue); this.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () {
self.storeValue = {value: this.getValue()}; self.storeValue = { value: this.getValue() };
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
BI.nextTick(function () { BI.nextTick(function () {
@ -185,11 +188,11 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.MultiTreeListCombo.EVENT_SEARCHING); self.fireEvent(BI.MultiTreeListCombo.EVENT_SEARCHING);
}); });
function showCounter () { function showCounter() {
if (isSearching()) { if (isSearching()) {
self.storeValue = {value: self.trigger.getValue()}; self.storeValue = { value: self.trigger.getValue() };
} else if (isPopupView()) { } else if (isPopupView()) {
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
} }
self.trigger.setValue(self.storeValue); self.trigger.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue); self.numberCounter.setValue(self.storeValue);
@ -203,7 +206,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
var checked = this.getSearcher().hasChecked(); var checked = this.getSearcher().hasChecked();
var val = { var val = {
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: checked ? {1: 1} : {} value: checked ? { 1: 1 } : {}
}; };
this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None); this.getSearcher().setState(checked ? BI.Selection.Multi : BI.Selection.None);
self.numberCounter.setButtonChecked(val); self.numberCounter.setButtonChecked(val);
@ -215,7 +218,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
return; return;
} }
if (change === true) { if (change === true) {
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
change = false; change = false;
} }
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
@ -230,9 +233,9 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
} else { } else {
if (isPopupView()) { if (isPopupView()) {
self._stopEditing(); self._stopEditing();
self.storeValue = {value: self.combo.getValue()}; self.storeValue = { value: self.combo.getValue() };
if (clear === true) { if (clear === true) {
self.storeValue = {value: []}; self.storeValue = { value: [] };
} }
self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiTreeListCombo.EVENT_CONFIRM);
} }
@ -340,7 +343,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.numberCounter.setButtonChecked(this.storeValue); this.numberCounter.setButtonChecked(this.storeValue);
}, },
_stopEditing: function() { _stopEditing: function () {
this.trigger.stopEditing(); this.trigger.stopEditing();
this.numberCounter.hideView(); this.numberCounter.hideView();
}, },

1
src/widget/multitree/trigger/searcher.list.multi.tree.js

@ -27,6 +27,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, {
type: "bi.multi_select_editor", type: "bi.multi_select_editor",
height: o.height, height: o.height,
text: o.text, text: o.text,
defaultText: o.defaultText,
watermark: o.watermark, watermark: o.watermark,
el: { el: {
type: "bi.simple_state_editor", type: "bi.simple_state_editor",

3
src/widget/multitree/trigger/searcher.multi.tree.js

@ -30,6 +30,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
el: { el: {
type: "bi.simple_state_editor", type: "bi.simple_state_editor",
text: o.text, text: o.text,
defaultText: o.defaultText,
height: o.height height: o.height
}, },
listeners: [{ listeners: [{
@ -149,7 +150,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
} }
} }
function getChildrenNode (ob) { function getChildrenNode(ob) {
var text = ""; var text = "";
var index = 0, size = BI.size(ob); var index = 0, size = BI.size(ob);
var names = BI.Func.getSortedResult(BI.keys(ob)); var names = BI.Func.getSortedResult(BI.keys(ob));

Loading…
Cancel
Save