56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
![]() |
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
var tslib_1 = require("tslib");
|
||
|
var props_1 = require("./props");
|
||
|
var fmtEvent_1 = tslib_1.__importDefault(require("../_util/fmtEvent"));
|
||
|
var value_1 = tslib_1.__importDefault(require("../mixins/value"));
|
||
|
Component({
|
||
|
props: props_1.InputDefaultProps,
|
||
|
mixins: [(0, value_1.default)()],
|
||
|
data: {
|
||
|
selfFocus: false,
|
||
|
},
|
||
|
methods: {
|
||
|
onChange: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
if (!this.isControlled()) {
|
||
|
this.update(value);
|
||
|
}
|
||
|
if (this.props.onChange) {
|
||
|
this.props.onChange(value, (0, fmtEvent_1.default)(this.props, e));
|
||
|
}
|
||
|
},
|
||
|
onFocus: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
this.setData({
|
||
|
selfFocus: true,
|
||
|
});
|
||
|
if (this.props.onFocus) {
|
||
|
this.props.onFocus(value, (0, fmtEvent_1.default)(this.props, e));
|
||
|
}
|
||
|
},
|
||
|
onBlur: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
this.setData({
|
||
|
selfFocus: false,
|
||
|
});
|
||
|
if (this.props.onBlur) {
|
||
|
this.props.onBlur(value, (0, fmtEvent_1.default)(this.props, e));
|
||
|
}
|
||
|
},
|
||
|
onConfirm: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
if (this.props.onConfirm) {
|
||
|
this.props.onConfirm(value, (0, fmtEvent_1.default)(this.props, e));
|
||
|
}
|
||
|
},
|
||
|
onClear: function (e) {
|
||
|
if (!this.isControlled()) {
|
||
|
this.update('');
|
||
|
}
|
||
|
if (this.props.onChange) {
|
||
|
this.props.onChange('', (0, fmtEvent_1.default)(this.props, e));
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
});
|