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, forcedModes: null,
showAllReportsLink: false, showAllReportsLink: false,
filters: null, filters: null,
startDate: null,
endDate: null,
showTrend: false, showTrend: false,
showHeader: true, showHeader: true,
showTitle: true, showTitle: true,

View File

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

View File

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

View File

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