Browse Source

Merge remote-tracking branch 'origin/master'

es6
guy 6 years ago
parent
commit
c7c555197a
  1. 2
      Gruntfile.js
  2. 46
      dist/base.js
  3. 35
      src/base/single/editor/editor.js
  4. 11
      src/base/single/input/input.js

2
Gruntfile.js

@ -107,7 +107,7 @@ module.exports = function (grunt) {
fineuiJs: { fineuiJs: {
src: ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "dist/base.js", src: ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "dist/base.js",
"dist/case.js", "dist/widget.js", "dist/fix/fix.compact.js", "dist/router.js", "ui/js/**/*.js", "!ui/js/fineui.i18n.js"], "dist/case.js", "dist/widget.js", "dist/router.js", "dist/fix/fix.compact.js", "ui/js/**/*.js", "!ui/js/fineui.i18n.js"],
dest: "dist/fineui.js" dest: "dist/fineui.js"
}, },

46
dist/base.js vendored

@ -8469,18 +8469,30 @@ BI.Editor = BI.inherit(BI.Single, {
} }
e.stopEvent(); e.stopEvent();
}); });
this.watermark.element.css({ }
position: "absolute",
left: "3px", var _items = [];
right: "3px", if (this.watermark) {
top: "0px", _items.push({
bottom: "0px" el: this.watermark,
left: 3,
right: 3,
top: 0,
bottom: 0
}); });
} }
_items.push({
el: this.editor,
left: 0,
right: 0,
top: 0,
bottom: 0
});
var items = [{ var items = [{
el: { el: {
type: "bi.default", type: "bi.absolute",
items: this.watermark ? [this.editor, this.watermark] : [this.editor] items: _items
}, },
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
right: o.hgap + o.rgap, right: o.hgap + o.rgap,
@ -8515,8 +8527,11 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_KEY_DOWN, function (v) { this.editor.on(BI.Input.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.Editor.EVENT_KEY_DOWN, arguments); self.fireEvent(BI.Editor.EVENT_KEY_DOWN, arguments);
}); });
this.editor.on(BI.Input.EVENT_QUICK_DOWN, function (v) { this.editor.on(BI.Input.EVENT_QUICK_DOWN, function (e) {
self.watermark && self.watermark.invisible(); // tab键就不要隐藏了
if (e.keyCode !== BI.KeyCode.TAB && self.watermark) {
self.watermark.invisible();
}
}); });
this.editor.on(BI.Input.EVENT_VALID, function () { this.editor.on(BI.Input.EVENT_VALID, function () {
@ -9756,6 +9771,10 @@ BI.Input = BI.inherit(BI.Single, {
"leading": true, "leading": true,
"trailing": false "trailing": false
}); });
this._focusDebounce = BI.debounce(BI.bind(this._focus, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, { this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true, "leading": true,
"trailing": false "trailing": false
@ -9764,7 +9783,7 @@ BI.Input = BI.inherit(BI.Single, {
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false; inputEventValid = false;
ctrlKey = e.ctrlKey; ctrlKey = e.ctrlKey;
self.fireEvent(BI.Input.EVENT_QUICK_DOWN); self.fireEvent(BI.Input.EVENT_QUICK_DOWN, arguments);
}) })
.keyup(function (e) { .keyup(function (e) {
if (!(inputEventValid && e.keyCode === BI.KeyCode.ENTER)) { if (!(inputEventValid && e.keyCode === BI.KeyCode.ENTER)) {
@ -9787,6 +9806,9 @@ BI.Input = BI.inherit(BI.Single, {
.mousedown(function (e) { .mousedown(function (e) {
self.element.val(self.element.val()); self.element.val(self.element.val());
}) })
.focus(function (e) { // 可以不用冒泡
self._focusDebounce();
})
.focusout(function (e) { .focusout(function (e) {
self._blurDebounce(); self._blurDebounce();
}); });
@ -9834,7 +9856,6 @@ BI.Input = BI.inherit(BI.Single, {
_click: function () { _click: function () {
if (this._isEditing !== true) { if (this._isEditing !== true) {
this._focus();
this.selectAll(); this.selectAll();
this.fireEvent(BI.Input.EVENT_CLICK); this.fireEvent(BI.Input.EVENT_CLICK);
} }
@ -9935,7 +9956,6 @@ BI.Input = BI.inherit(BI.Single, {
} }
if (!this._isEditing === true) { if (!this._isEditing === true) {
this.element.focus(); this.element.focus();
this._focus();
this.selectAll(); this.selectAll();
} }
}, },

35
src/base/single/editor/editor.js

@ -74,18 +74,30 @@ BI.Editor = BI.inherit(BI.Single, {
} }
e.stopEvent(); e.stopEvent();
}); });
this.watermark.element.css({ }
position: "absolute",
left: "3px", var _items = [];
right: "3px", if (this.watermark) {
top: "0px", _items.push({
bottom: "0px" el: this.watermark,
left: 3,
right: 3,
top: 0,
bottom: 0
}); });
} }
_items.push({
el: this.editor,
left: 0,
right: 0,
top: 0,
bottom: 0
});
var items = [{ var items = [{
el: { el: {
type: "bi.default", type: "bi.absolute",
items: this.watermark ? [this.editor, this.watermark] : [this.editor] items: _items
}, },
left: o.hgap + o.lgap, left: o.hgap + o.lgap,
right: o.hgap + o.rgap, right: o.hgap + o.rgap,
@ -120,8 +132,11 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_KEY_DOWN, function (v) { this.editor.on(BI.Input.EVENT_KEY_DOWN, function (v) {
self.fireEvent(BI.Editor.EVENT_KEY_DOWN, arguments); self.fireEvent(BI.Editor.EVENT_KEY_DOWN, arguments);
}); });
this.editor.on(BI.Input.EVENT_QUICK_DOWN, function (v) { this.editor.on(BI.Input.EVENT_QUICK_DOWN, function (e) {
self.watermark && self.watermark.invisible(); // tab键就不要隐藏了
if (e.keyCode !== BI.KeyCode.TAB && self.watermark) {
self.watermark.invisible();
}
}); });
this.editor.on(BI.Input.EVENT_VALID, function () { this.editor.on(BI.Input.EVENT_VALID, function () {

11
src/base/single/input/input.js

@ -29,6 +29,10 @@ BI.Input = BI.inherit(BI.Single, {
"leading": true, "leading": true,
"trailing": false "trailing": false
}); });
this._focusDebounce = BI.debounce(BI.bind(this._focus, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, { this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true, "leading": true,
"trailing": false "trailing": false
@ -37,7 +41,7 @@ BI.Input = BI.inherit(BI.Single, {
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false; inputEventValid = false;
ctrlKey = e.ctrlKey; ctrlKey = e.ctrlKey;
self.fireEvent(BI.Input.EVENT_QUICK_DOWN); self.fireEvent(BI.Input.EVENT_QUICK_DOWN, arguments);
}) })
.keyup(function (e) { .keyup(function (e) {
if (!(inputEventValid && e.keyCode === BI.KeyCode.ENTER)) { if (!(inputEventValid && e.keyCode === BI.KeyCode.ENTER)) {
@ -60,6 +64,9 @@ BI.Input = BI.inherit(BI.Single, {
.mousedown(function (e) { .mousedown(function (e) {
self.element.val(self.element.val()); self.element.val(self.element.val());
}) })
.focus(function (e) { // 可以不用冒泡
self._focusDebounce();
})
.focusout(function (e) { .focusout(function (e) {
self._blurDebounce(); self._blurDebounce();
}); });
@ -107,7 +114,6 @@ BI.Input = BI.inherit(BI.Single, {
_click: function () { _click: function () {
if (this._isEditing !== true) { if (this._isEditing !== true) {
this._focus();
this.selectAll(); this.selectAll();
this.fireEvent(BI.Input.EVENT_CLICK); this.fireEvent(BI.Input.EVENT_CLICK);
} }
@ -208,7 +214,6 @@ BI.Input = BI.inherit(BI.Single, {
} }
if (!this._isEditing === true) { if (!this._isEditing === true) {
this.element.focus(); this.element.focus();
this._focus();
this.selectAll(); this.selectAll();
} }
}, },

Loading…
Cancel
Save