Commit ed6d69b2 authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

UTILS.js - add createSelectComponent method

parent 873c93e1
...@@ -264,6 +264,21 @@ UTILS.parseRegistryList = list => { ...@@ -264,6 +264,21 @@ UTILS.parseRegistryList = list => {
return result; return result;
} }
UTILS.createSelectComponent = (label, items, multiple = false) => {
const container = $('<div>', {class: 'uk-margin-small'});
const fc = $('<div>', {class: 'uk-form-controls'});
const select = $('<select class="uk-select" style="min-width: 100px;">');
if(multiple) select.attr('multiple', 'multiple');
if(items) items.sort((a,b) => a.value - b.value)
.forEach(item => select.append(`<option value="${item.value}" title="${item.label}">${item.label}</option>`));
fc.append(select);
container.append(`<label class="uk-form-label uk-text-bold">${label}</label>`).append(fc);
return {container, select};
}
UTILS.detectBrowser = () => { UTILS.detectBrowser = () => {
const browserVersion = (userAgent, regex) => { const browserVersion = (userAgent, regex) => {
return userAgent.match(regex) ? userAgent.match(regex)[2] : null; return userAgent.match(regex) ? userAgent.match(regex)[2] : null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment