Browse Source

水印提示文本

es6
windy 4 years ago
parent
commit
1344d9febc
  1. 2
      demo/js/widget/singleselct/demo.single_select_combo.js
  2. 1
      i18n/i18n.cn.js
  3. 3
      src/base/single/editor/editor.textarea.js
  4. 3
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  5. 1
      src/widget/multiselectlist/multiselectlist.insert.js
  6. 1
      src/widget/multiselectlist/multiselectlist.insert.nobar.js
  7. 17
      src/widget/singleselect/singleselect.combo.js
  8. 44
      src/widget/singleselect/singleselect.insert.combo.js
  9. 1
      src/widget/singleselect/singleselect.trigger.js
  10. 63
      src/widget/singleselect/singleselectlist.insert.js
  11. 5
      src/widget/singleselect/trigger/editor.singleselect.js
  12. 1
      src/widget/singleselect/trigger/searcher.singleselect.js

2
demo/js/widget/singleselct/demo.single_select_combo.js

@ -9,7 +9,7 @@ Demo.SingleSelectCombo = BI.inherit(BI.Widget, {
_createSingleSelectCombo: function () { _createSingleSelectCombo: function () {
var self = this; var self = this;
var widget = BI.createWidget({ var widget = BI.createWidget({
type: "bi.single_select_insert_combo", type: "bi.single_select_combo",
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
width: 200, width: 200,
ref: function () { ref: function () {

1
i18n/i18n.cn.js

@ -195,4 +195,5 @@ BI.i18n = {
"BI-Basic_Year_Range_Error": "请选择{R1}年-{R2}年的日期", "BI-Basic_Year_Range_Error": "请选择{R1}年-{R2}年的日期",
"BI-Basic_Year_Month_Range_Error": "请选择{R1}年{R2}月-{R3}年{R4}月的日期", "BI-Basic_Year_Month_Range_Error": "请选择{R1}年{R2}月-{R3}年{R4}月的日期",
"BI-Basic_Year_Quarter_Range_Error": "请选择{R1}年{R2}季度-{R3}年{R4}季度的日期", "BI-Basic_Year_Quarter_Range_Error": "请选择{R1}年{R2}季度-{R3}年{R4}季度的日期",
"BI-Basic_Search_And_Patch_Paste": "搜索,支持批量粘贴、粘贴值通过换行识别"
}; };

3
src/base/single/editor/editor.textarea.js

@ -107,7 +107,8 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.label", type: "bi.label",
cls: "bi-water-mark textarea-watermark", cls: "bi-water-mark textarea-watermark",
textAlign: "left", textAlign: "left",
whiteSpace: "normal", whiteSpace: o.scrolly ? "normal" : "nowrap",
title: o.watermark,
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled, disabled: o.disabled,

3
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -16,7 +16,8 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
adapter: null, adapter: null,
masker: {}, masker: {},
text: BI.i18nText("BI-Basic_Please_Select") text: BI.i18nText("BI-Basic_Please_Select"),
watermark: BI.i18nText("BI-Basic_Search_And_Patch_Paste"),
}); });
}, },

1
src/widget/multiselectlist/multiselectlist.insert.js

@ -66,6 +66,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
type: "bi.select_patch_editor", type: "bi.select_patch_editor",
el: { el: {
type: "bi.search_editor", type: "bi.search_editor",
watermark: BI.i18nText("BI-Basic_Search_And_Patch_Paste"),
}, },
ref: function (ref) { ref: function (ref) {
self.editor = ref; self.editor = ref;

1
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -70,6 +70,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
type: "bi.select_patch_editor", type: "bi.select_patch_editor",
el: { el: {
type: "bi.search_editor", type: "bi.search_editor",
watermark: BI.i18nText("BI-Basic_Search_And_Patch_Paste"),
}, },
ref: function (ref) { ref: function (ref) {
self.editor = ref; self.editor = ref;

17
src/widget/singleselect/singleselect.combo.js

@ -63,22 +63,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
self._setStartValue(); self._setStartValue();
self.fireEvent(BI.SingleSelectCombo.EVENT_STOP); self.fireEvent(BI.SingleSelectCombo.EVENT_STOP);
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function () {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue();
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
self.fireEvent(BI.SingleSelectCombo.EVENT_SEARCHING); self.fireEvent(BI.SingleSelectCombo.EVENT_SEARCHING);
}); });

44
src/widget/singleselect/singleselect.insert.combo.js

@ -12,7 +12,8 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn, valueFormatter: BI.emptyFn,
height: 24, height: 24,
allowEdit: true allowEdit: true,
watermark: BI.i18nText("BI-Basic_Search_And_Patch_Paste"),
}); });
}, },
@ -29,6 +30,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.single_select_trigger", type: "bi.single_select_trigger",
watermark: o.watermark,
height: o.height - 2, height: o.height - 2,
allowNoSelect: o.allowNoSelect, allowNoSelect: o.allowNoSelect,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
@ -72,22 +74,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
assertShowValue(); assertShowValue();
self._defaultState(); self._defaultState();
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function (keywords) { this.trigger.on(BI.SingleSelectTrigger.EVENT_SEARCHING, function () {
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.combo.setValue(self.storeValue);
assertShowValue();
self.combo.populate();
self._setStartValue();
} else {
self.combo.setValue(self.storeValue);
assertShowValue();
}
});
}
self.fireEvent(BI.SingleSelectInsertCombo.EVENT_SEARCHING); self.fireEvent(BI.SingleSelectInsertCombo.EVENT_SEARCHING);
}); });
@ -204,29 +191,6 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
return BI.makeObject(values || []); return BI.makeObject(values || []);
}, },
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
this.requesting = true;
o.itemsCreator({
type: BI.SingleSelectInsertCombo.REQ_GET_ALL_DATA,
keywords: keywords
}, function (ob) {
var values = BI.map(ob.items, "value");
digest(values);
});
function digest (items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
BI.remove(self.storeValue.value, val);
}
});
self._adjust(callback);
}
},
_adjust: function (callback) { _adjust: function (callback) {
var self = this, o = this.options; var self = this, o = this.options;
adjust(); adjust();

1
src/widget/singleselect/singleselect.trigger.js

@ -35,6 +35,7 @@ BI.SingleSelectTrigger = BI.inherit(BI.Trigger, {
this.searcher = BI.createWidget(o.searcher, { this.searcher = BI.createWidget(o.searcher, {
type: "bi.single_select_searcher", type: "bi.single_select_searcher",
watermark: o.watermark,
allowNoSelect: o.allowNoSelect, allowNoSelect: o.allowNoSelect,
text: o.text, text: o.text,
height: o.height, height: o.height,

63
src/widget/singleselect/singleselectlist.insert.js

@ -9,7 +9,8 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, {
baseCls: "bi-multi-select-insert-list", baseCls: "bi-multi-select-insert-list",
allowNoSelect: false, allowNoSelect: false,
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn valueFormatter: BI.emptyFn,
searcherHeight: 24,
}); });
}, },
_init: function () { _init: function () {
@ -60,6 +61,17 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.searcher", type: "bi.searcher",
el: {
type: "bi.select_patch_editor",
el: {
type: "bi.search_editor",
watermark: BI.i18nText("BI-Basic_Search_And_Patch_Paste"),
},
ref: function (ref) {
self.editor = ref;
},
height: o.searcherHeight,
},
isAutoSearch: false, isAutoSearch: false,
isAutoSync: false, isAutoSync: false,
onSearch: function (op, callback) { onSearch: function (op, callback) {
@ -90,7 +102,6 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, {
eventName: BI.Searcher.EVENT_PAUSE, eventName: BI.Searcher.EVENT_PAUSE,
action: function () { action: function () {
var keyword = this.getKeyword(); var keyword = this.getKeyword();
if (this.hasMatched()) {
self.storeValue = keyword; self.storeValue = keyword;
self._showAdapter(); self._showAdapter();
self.adapter.setValue(self.storeValue); self.adapter.setValue(self.storeValue);
@ -99,31 +110,8 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, {
self.adapter.populate(); self.adapter.populate();
self._setStartValue(); self._setStartValue();
self.fireEvent(BI.SingleSelectInsertList.EVENT_CHANGE); self.fireEvent(BI.SingleSelectInsertList.EVENT_CHANGE);
} else {
self._showAdapter();
}
} }
}, {
eventName: BI.Searcher.EVENT_SEARCHING,
action: function () {
var keywords = this.getKeyword();
var last = BI.last(keywords);
keywords = BI.initial(keywords || []);
if (keywords.length > 0) {
self._joinKeywords(keywords, function () {
if (BI.endWith(last, BI.BlankSplitChar)) {
self.adapter.setValue(self.storeValue);
assertShowValue();
self.adapter.populate();
self._setStartValue();
} else {
self.adapter.setValue(self.storeValue);
assertShowValue();
}
});
}
}
}, { }, {
eventName: BI.Searcher.EVENT_CHANGE, eventName: BI.Searcher.EVENT_CHANGE,
action: function () { action: function () {
@ -177,31 +165,6 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, {
return BI.makeObject(values || []); return BI.makeObject(values || []);
}, },
_joinKeywords: function (keywords, callback) {
var self = this, o = this.options;
this._assertValue(this.storeValue);
if (!this._allData) {
o.itemsCreator({
type: BI.SingleSelectInsertList.REQ_GET_ALL_DATA
}, function (ob) {
self._allData = BI.map(ob.items, "value");
digest(self._allData);
});
} else {
digest(this._allData);
}
function digest (items) {
var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) {
BI.pushDistinct(self.storeValue.value, val)
}
});
callback();
}
},
_setStartValue: function (value) { _setStartValue: function (value) {
this._startValue = value; this._startValue = value;
this.adapter.setStartValue(value); this.adapter.setStartValue(value);

5
src/widget/singleselect/trigger/editor.singleselect.js

@ -10,7 +10,8 @@ BI.SingleSelectEditor = BI.inherit(BI.Widget, {
return BI.extend(BI.SingleSelectEditor.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleSelectEditor.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-select-editor", baseCls: "bi-single-select-editor",
el: {}, el: {},
text: BI.i18nText("BI-Basic_Please_Select") text: BI.i18nText("BI-Basic_Please_Select"),
watermark: BI.i18nText("BI-Basic_Search"),
}); });
}, },
@ -21,7 +22,7 @@ BI.SingleSelectEditor = BI.inherit(BI.Widget, {
type: "bi.select_patch_editor", type: "bi.select_patch_editor",
element: this, element: this,
height: o.height, height: o.height,
watermark: BI.i18nText("BI-Basic_Search"), watermark: o.watermark,
allowBlank: true, allowBlank: true,
value: o.value, value: o.value,
defaultText: o.text, defaultText: o.text,

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

@ -25,6 +25,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
this.editor = BI.createWidget(o.el, { this.editor = BI.createWidget(o.el, {
type: "bi.single_select_editor", type: "bi.single_select_editor",
height: o.height, height: o.height,
watermark: o.watermark,
text: o.text, text: o.text,
listeners: [{ listeners: [{
eventName: BI.SingleSelectEditor.EVENT_FOCUS, eventName: BI.SingleSelectEditor.EVENT_FOCUS,

Loading…
Cancel
Save