@itwin/frontend-devtools
Version:
Debug menu and supporting UI widgets
39 lines • 1.47 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.appendDataListEntries = appendDataListEntries;
exports.createDataList = createDataList;
function _appendDataListEntry(list, entry) {
const option = document.createElement("option");
if (undefined !== entry.value)
option.value = entry.value.toString();
list.appendChild(option);
}
/** @alpha */
function appendDataListEntries(dl, entries) {
for (const entry of entries) {
_appendDataListEntry(dl.list, entry);
}
}
/** @alpha */
function createDataList(props) {
const list = document.createElement("datalist");
list.id = props.id;
for (const entry of props.entries) {
_appendDataListEntry(list, entry);
}
const handler = props.handler;
if (undefined !== handler)
list.onselect = () => handler(list);
const div = document.createElement("div");
if (props.inline)
div.style.display = "inline";
div.appendChild(list);
if (undefined !== props.parent)
props.parent.appendChild(div);
return { div, list };
}
//# sourceMappingURL=DataList.js.map