mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Reduce JavaScript footprint
This commit is contained in:
parent
689126c57d
commit
b12852bd08
42 changed files with 240 additions and 426 deletions
|
|
@ -8,8 +8,6 @@ export class CheckboxComponent {
|
|||
|
||||
this.label = params.label;
|
||||
this.inline = params.inline;
|
||||
|
||||
this.labeled = null != params.label;
|
||||
}
|
||||
|
||||
click() {
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ export class EmailAddressesComponent {
|
|||
|
||||
_parseInput(force) {
|
||||
let val = this.input.value;
|
||||
if (force || val.includes(',') || val.includes(';')) {
|
||||
this._parseValue(val) && (this.input.value = '');
|
||||
if ((force || val.includes(',') || val.includes(';')) && this._parseValue(val)) {
|
||||
this.input.value = '';
|
||||
}
|
||||
this._resizeInput();
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ export class EmailAddressesComponent {
|
|||
lastIndex = kk;
|
||||
}
|
||||
|
||||
vv.value === v && (exists = true);
|
||||
exists |= vv.value === v;
|
||||
});
|
||||
|
||||
if (v !== '' && a[1] && !exists) {
|
||||
|
|
@ -195,7 +195,7 @@ export class EmailAddressesComponent {
|
|||
}
|
||||
});
|
||||
|
||||
if (values.length === 1 && values[0] === '' && self._lastEdit !== '') {
|
||||
if (1 === values.length && '' === values[0] && '' !== self._lastEdit) {
|
||||
self._lastEdit = '';
|
||||
self._renderTags();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { i18n } from 'Common/Translator';
|
||||
import { pInt } from 'Common/Utils';
|
||||
import { SaveSettingStatus } from 'Common/Enums';
|
||||
import { koComputable } from 'External/ko';
|
||||
import { dispose } from 'External/ko';
|
||||
|
|
@ -10,20 +8,20 @@ export class SelectComponent {
|
|||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
this.value = params.value || '';
|
||||
this.label = params.label || '';
|
||||
this.enable = null == params.enable ? true : params.enable;
|
||||
this.value = params.value;
|
||||
this.label = params.label;
|
||||
this.trigger = params.trigger?.subscribe ? params.trigger : null;
|
||||
this.placeholder = params.placeholder || '';
|
||||
|
||||
this.labeled = null != params.label;
|
||||
this.placeholder = params.placeholder;
|
||||
this.options = params.options;
|
||||
this.optionsText = params.optionsText;
|
||||
this.optionsValue = params.optionsValue;
|
||||
|
||||
let size = 0 < params.size ? 'span' + params.size : '';
|
||||
if (this.trigger) {
|
||||
const
|
||||
classForTrigger = ko.observable(''),
|
||||
setTriggerState = value => {
|
||||
switch (pInt(value)) {
|
||||
switch (value) {
|
||||
case SaveSettingStatus.Success:
|
||||
classForTrigger('success');
|
||||
break;
|
||||
|
|
@ -48,19 +46,12 @@ export class SelectComponent {
|
|||
];
|
||||
} else {
|
||||
this.className = size;
|
||||
this.disposables = [];
|
||||
}
|
||||
|
||||
this.options = params.options || '';
|
||||
|
||||
this.optionsText = params.optionsText || null;
|
||||
this.optionsValue = params.optionsValue || null;
|
||||
this.optionsCaption = i18n(params.optionsCaption || null);
|
||||
|
||||
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.disposables.forEach(dispose);
|
||||
this.disposables?.forEach(dispose);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue