Removed CheckboxSimple component (was only used at login)

This commit is contained in:
the-djmaze 2022-09-28 23:32:04 +02:00
parent 976b1d54bd
commit 456f304338
8 changed files with 38 additions and 61 deletions

View file

@ -11,7 +11,6 @@ import { ThemeStore } from 'Stores/Theme';
import { InputComponent } from 'Component/Input';
import { SelectComponent } from 'Component/Select';
import { CheckboxMaterialDesignComponent } from 'Component/MaterialDesign/Checkbox';
import { CheckboxComponent } from 'Component/Checkbox';
export class AbstractApp {
/**
@ -49,7 +48,6 @@ export class AbstractApp {
register('Input', InputComponent);
register('Select', SelectComponent);
register('Checkbox', CheckboxMaterialDesignComponent, 'CheckboxMaterialDesignComponent');
register('CheckboxSimple', CheckboxComponent, 'CheckboxComponent');
initOnStartOrLangChange();

View file

@ -1,23 +0,0 @@
import ko from 'ko';
export class AbstractCheckbox {
/**
* @param {Object} params = {}
*/
constructor(params = {}) {
this.value = ko.isObservable(params.value) ? params.value
: ko.observable(!!params.value);
this.enable = ko.isObservable(params.enable) ? params.enable
: ko.observable(undefined === params.enable || !!params.enable);
this.label = params.label || '';
this.inline = !!params.inline;
this.labeled = undefined !== params.label;
}
click() {
this.enable() && this.value(!this.value());
}
}

View file

@ -1,3 +0,0 @@
import { AbstractCheckbox } from 'Component/AbstractCheckbox';
export class CheckboxComponent extends AbstractCheckbox {}

View file

@ -1,3 +1,18 @@
import { AbstractCheckbox } from 'Component/AbstractCheckbox';
export class CheckboxMaterialDesignComponent {
constructor(params = {}) {
this.value = ko.isObservable(params.value) ? params.value
: ko.observable(!!params.value);
export class CheckboxMaterialDesignComponent extends AbstractCheckbox {}
this.enable = ko.isObservable(params.enable) ? params.enable
: ko.observable(undefined === params.enable || !!params.enable);
this.label = params.label;
this.inline = params.inline;
this.labeled = null != params.label;
}
click() {
this.enable() && this.value(!this.value());
}
}

View file

@ -41,23 +41,6 @@
outline: 1px dotted;
}
&.e-checkbox {
cursor: pointer;
margin-bottom: 6px;
margin-left: -2px;
padding: 2px;
&:focus {
outline: 1px dotted;
}
&.disabled {
cursor: not-allowed;
opacity: 0.5;
}
}
span {
margin-left: 0.5em;
white-space: normal;
@ -69,6 +52,23 @@
}
}
.e-checkbox {
cursor: pointer;
margin-bottom: 6px;
margin-left: -2px;
padding: 2px;
&:focus {
outline: 1px dotted;
}
&.disabled {
cursor: not-allowed;
opacity: 0.5;
}
}
.e-checkbox.material-design {
line-height: 20px;

View file

@ -135,7 +135,6 @@
.language-buttons {
flex-grow: 1;
margin-top: 5px;
text-align: right;
}

View file

@ -1,6 +0,0 @@
<div class="e-component e-checkbox" tabindex="0" data-bind="click: click, onSpace: click, css: { 'disabled': !enable() }">
<i role="checkbox" class="e-checkbox-icon fontastic" data-bind="text: value() ? '☑' : '☐'"></i>
<!-- ko if: labeled -->
<span data-bind="attr: {'data-i18n': label}"></span>
<!-- /ko -->
</div>

View file

@ -25,13 +25,10 @@
</div>
<div id="plugin-Login-BottomControlGroup"></div>
<div class="controls" style="display: flex">
<div class="signMeLabel" data-bind="visible: signMeVisibility, component: {
name: 'CheckboxSimple',
params: {
label: 'LOGIN/LABEL_SIGN_ME',
value: signMe
}
}"></div>
<div class="e-checkbox" tabindex="0" data-bind="click: function(){signMe(!signMe())}, onSpace: function(){signMe(!signMe())}">
<i role="checkbox" class="fontastic" data-bind="text: signMe() ? '☑' : '☐'"></i>
<span data-i18n="LOGIN/LABEL_SIGN_ME"></span>
</div>
<div class="language-buttons">
<a href="#" class="language-button fontastic"
data-bind="visible: allowLanguagesOnLogin, click: selectLanguage, css: { 'icon-spinner' : langRequest }"