REFACTOR: removes overwritten properties and duplicates fn (#9686)

This commit is contained in:
Joffrey JAFFEUX 2020-05-07 16:39:53 +02:00 committed by GitHub
parent 265baa40c6
commit 1dd9df9cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 29 deletions

View File

@ -59,8 +59,6 @@ export default Component.extend({
forcedModes: null,
showAllReportsLink: false,
filters: null,
startDate: null,
endDate: null,
showTrend: false,
showHeader: true,
showTitle: true,

View File

@ -6,9 +6,6 @@ import { next, debounce, cancel } from "@ember/runloop";
const DEBOUNCE_MS = 500;
export default TextField.extend({
_prevValue: null,
_timer: null,
attributeBindings: [
"autocorrect",
"autocapitalize",
@ -17,13 +14,22 @@ export default TextField.extend({
"dir"
],
init() {
this._super(...arguments);
this._prevValue = null;
this._timer = null;
},
didReceiveAttrs() {
this._super(...arguments);
this._prevValue = this.value;
},
didUpdateAttrs() {
this._super(...arguments);
if (this._prevValue !== this.value) {
if (this.onChangeImmediate) {
next(() => this.onChangeImmediate(this.value));
@ -71,27 +77,6 @@ export default TextField.extend({
}
},
didReceiveAttrs() {
this._super(...arguments);
this._prevValue = this.value;
},
didUpdateAttrs() {
this._super(...arguments);
if (this._prevValue !== this.value) {
if (this.onChangeImmediate) {
next(() => this.onChangeImmediate(this.value));
}
if (this.onChange) {
debounce(this, this._debouncedChange, DEBOUNCE_MS);
}
}
},
_debouncedChange() {
next(() => this.onChange(this.value));
},
@discourseComputed("placeholderKey")
placeholder: {
get() {

View File

@ -95,8 +95,6 @@ export default Controller.extend({
scopedCategoryId: null,
lastValidatedAt: null,
isUploading: false,
allowUpload: false,
uploadIcon: "upload",
topic: null,
linkLookup: null,
showPreview: true,

View File

@ -24,7 +24,6 @@ export default Component.extend({
formats: null,
recurring: null,
advancedMode: false,
isValid: true,
timezone: null,
fromSelected: null,
fromFilled: notEmpty("date"),