Skip to content

Commit

Permalink
render selected values
Browse files Browse the repository at this point in the history
  • Loading branch information
SteinerPascal committed Sep 11, 2022
1 parent c6292ea commit d5f44f9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/configs/client-configs/ISettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface ISettings {
language: string;
addDistinct?: boolean;
typePredicate?: string;
maxDepth?: number;
maxOr?: number;
maxDepth: number;
maxOr: number;
backgroundBaseColor?: string; //TODO '250,136,3'
sparqlPrefixes?: any;
defaultEndpoint?: () => string;
Expand Down
1 change: 1 addition & 0 deletions src/configs/client-configs/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const settings: ISettings = {
config: null,
language: "en",
maxDepth: 4, // max amount of where clauses
maxOr:6,
addDistinct: true,
// backgroundBaseColor: "2,184,117",
backgroundBaseColor: "29, 224, 153",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class TreeWidget extends AbstractWidget {
}
}

if (this_.jsTree.jstree().get_top_checked().length >= this.settings.maxOr) {
if (this_.jsTree.jstree().get_top_checked().length >= this_.settings.maxOr) {
for (var i = 0; i < items.length; i++) {
var id = $(items[i]).attr("id");
if (selecteds.indexOf(id) == -1) {
Expand Down Expand Up @@ -303,27 +303,35 @@ export class TreeWidget extends AbstractWidget {

onClickSelect = function (e: any) {
let this_ = e.data.arg1;
const values = this_.getValue()
values.forEach((val:TreeWidgetValue) => {
this_.renderWidgetVal(val)
});
this.displayLayer.hide();
};

onClickClose = function (e: any) {
let this_ = e.data.arg1;
this.displayLayer.hide();
this?.displayLayer?.hide();
$(this_.ParentComponent).trigger("change");
};

getValue = function () {
getValue = function ():Array<TreeWidgetValue> {
var checked = this.jsTree.jstree().get_top_checked(true);

// rebuild a clean data structure
var values = [];
for (var node in checked) {
var v = {
key: checked[node].id,
label: checked[node].original.text,
uri: checked[node].id,
};
values.push(v);
const val:TreeWidgetValue = {
value: {
key: checked[node].id,
label: checked[node].original.text,
uri: checked[node].id
},
valueType: ValueType.MULTIPLE
}

values.push(val);
}

return values;
Expand Down

0 comments on commit d5f44f9

Please sign in to comment.