diff options
Diffstat (limited to '')
-rw-r--r-- | static/input_list.js | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/static/input_list.js b/static/input_list.js index b15162d6..3b24b719 100644 --- a/static/input_list.js +++ b/static/input_list.js @@ -1,6 +1,4 @@ /* - TODO document 'input-list'. - ∀ children('.input-list') => 'unit' ∈ classList(child) <div class="input-list"> @@ -73,5 +71,25 @@ function init_input_list() { transferListeners(oldUnit, unit); lst.unit = unit; + + if (lst.dataset.bindby) { + lst.get_value = lst.dataset.bindby; + } else if (lst.dataset.joinby) { + lst.get_value = get_value(lst.dataset.joinby); + } else { + lst.get_value = get_get_value(); + } } } + +/* -------------------------------------------------- */ + +/* different function forms since we want to capture one self */ +const get_get_value = (join=',') => function () { + return [...self.querySelectorAll('input')] + .map(x => x.value) + .filter(x => x != '') + .join(join); +} + +/* -------------------------------------------------- */ |