Cleanup some mobile modal screen sizes

And simplify the ko command bindinghandler to use CSS :enabled
This commit is contained in:
djmaze 2021-02-19 23:31:50 +01:00
parent f673344408
commit fe45179847
6 changed files with 12 additions and 49 deletions

View file

@ -323,12 +323,7 @@ export function startScreens(screensClasses) {
function decorateKoCommands(thisArg, commands) {
Object.entries(commands).forEach(([key, canExecute]) => {
let command = thisArg[key],
fn = function(...args) {
if (fn.enabled() && fn.canExecute()) {
command.apply(thisArg, args);
}
return false;
};
fn = (...args) => fn.enabled() && fn.canExecute() && command.apply(thisArg, args);
// fn.__realCanExecute = canExecute;
// fn.isCommand = true;
@ -337,7 +332,7 @@ function decorateKoCommands(thisArg, commands) {
fn.canExecute = (typeof canExecute === 'function')
? ko.computed(() => fn.enabled() && canExecute.call(thisArg, thisArg))
: ko.computed(() => fn.enabled() && !!canExecute);
: ko.computed(() => fn.enabled());
thisArg[key] = fn;
});