mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Drop ko.extenders.limitedList
This commit is contained in:
parent
deeb86bd5f
commit
d1d820da73
8 changed files with 14 additions and 77 deletions
24
dev/External/ko.js
vendored
24
dev/External/ko.js
vendored
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
|||
import { i18nToNodes } from 'Common/Translator';
|
||||
import { doc, createElement } from 'Common/Globals';
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { arrayLength, isFunction, forEachObjectEntry } from 'Common/Utils';
|
||||
import { isFunction, forEachObjectEntry } from 'Common/Utils';
|
||||
|
||||
export const
|
||||
errorTip = (element, value) => value
|
||||
|
|
@ -146,28 +146,6 @@ Object.assign(ko.bindingHandlers, {
|
|||
|
||||
// extenders
|
||||
|
||||
ko.extenders.limitedList = (target, limitedList) => {
|
||||
const result = ko
|
||||
.computed({
|
||||
read: target,
|
||||
write: newValue => {
|
||||
let currentValue = target(),
|
||||
list = ko.unwrap(limitedList);
|
||||
list = arrayLength(list) ? list : [''];
|
||||
if (!list.includes(newValue)) {
|
||||
newValue = list.includes(currentValue, list) ? currentValue : list[0];
|
||||
target(newValue + ' ');
|
||||
}
|
||||
target(newValue);
|
||||
}
|
||||
})
|
||||
.extend({ notify: 'always' });
|
||||
|
||||
result(target());
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
ko.extenders.toggleSubscribeProperty = (target, options) => {
|
||||
const prop = options[1];
|
||||
if (prop) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue