").addClass("input-group").append($input));
+
+ const $actionCell = $("
");
+ const $multiplicityCell = $(" | ");
+
+ $tr
+ .append($labelCell)
+ .append($inputCell)
+ .append($actionCell)
+ .append($multiplicityCell);
+
+ if (valueAttr.type === 'label') {
+ if (definition.labelType === 'text') {
+ $input.prop("type", "text");
+
+ // no need to await for this, can be done asynchronously
+ server.get('attributes/values/' + encodeURIComponent(valueAttr.name)).then(attributeValues => {
+ if (attributeValues.length === 0) {
+ return;
+ }
+
+ attributeValues = attributeValues.map(attribute => { return { value: attribute }; });
+
+ $input.autocomplete({
+ appendTo: document.querySelector('body'),
+ hint: false,
+ autoselect: true,
+ openOnFocus: true,
+ minLength: 0
+ }, [{
+ displayKey: 'value',
+ source: function (term, cb) {
+ term = term.toLowerCase();
+
+ const filtered = attributeValues.filter(attr => attr.value.toLowerCase().includes(term));
+
+ cb(filtered);
+ }
+ }]);
+ });
+ }
+ else if (definition.labelType === 'number') {
+ $input.prop("type", "number");
+ }
+ else if (definition.labelType === 'boolean') {
+ $input.prop("type", "checkbox");
+
+ if (valueAttr.value === "true") {
+ $input.prop("checked", "checked");
+ }
+ }
+ else if (definition.labelType === 'date') {
+ $input.prop("type", "date");
+
+ const $todayButton = $(" |