Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-limited-list-projection' int…
Browse files Browse the repository at this point in the history
…o improvements-from-website
  • Loading branch information
joswarmer committed Nov 28, 2024
2 parents 9d47606 + 756040d commit afb7d96
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 27 deletions.
6 changes: 2 additions & 4 deletions packages/core/src/editor/simplifiedBoxAPI/BoxUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,10 @@ export class BoxUtil {
node: FreNode,
propertyName: string,
scoper: FreScoper,
isLimited: boolean,
listInfo?: FreListInfo,
initializer?: Partial<VerticalListBox>,
): VerticalListBox {
return UtilRefHelpers.verticalReferenceListBox(node, propertyName, scoper, isLimited, listInfo, initializer);
return UtilRefHelpers.verticalReferenceListBox(node, propertyName, scoper, listInfo, initializer);
}

/**
Expand All @@ -315,11 +314,10 @@ export class BoxUtil {
node: FreNode,
propertyName: string,
scoper: FreScoper,
isLimited: boolean,
listJoin?: FreListInfo,
initializer?: Partial<HorizontalListBox>,
): HorizontalListBox {
return UtilRefHelpers.horizontalReferenceListBox(node, propertyName, scoper, isLimited, listJoin, initializer);
return UtilRefHelpers.horizontalReferenceListBox(node, propertyName, scoper, listJoin, initializer);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
BoxFactory,
ExternalRefListBox,
HorizontalListBox,
LimitedDisplay,
ReferenceBox,
SelectOption,
VerticalListBox,
Expand Down Expand Up @@ -93,7 +92,6 @@ export class UtilRefHelpers {
node: FreNode,
propertyName: string,
scoper: FreScoper,
isLimited: boolean,
listInfo?: FreListInfo,
initializer?: Partial<VerticalListBox>,
): VerticalListBox {
Expand All @@ -106,7 +104,6 @@ export class UtilRefHelpers {
node,
property as FreNodeReference<FreNamedNode>[],
propertyName,
isLimited,
scoper,
listInfo,
);
Expand All @@ -131,7 +128,6 @@ export class UtilRefHelpers {
node: FreNode,
propertyName: string,
scoper: FreScoper,
isLimited: boolean,
listJoin?: FreListInfo,
initializer?: Partial<HorizontalListBox>,
): HorizontalListBox {
Expand All @@ -145,7 +141,6 @@ export class UtilRefHelpers {
node,
property as FreNodeReference<FreNamedNode>[],
propertyName,
isLimited,
scoper,
listJoin,
);
Expand Down Expand Up @@ -187,7 +182,6 @@ export class UtilRefHelpers {
node,
property as FreNodeReference<FreNamedNode>[],
propertyName,
false,
scoper,
);
// determine the role
Expand Down Expand Up @@ -230,7 +224,6 @@ export class UtilRefHelpers {
element: FreNode,
properties: FreNodeReference<FreNamedNode>[],
propertyName: string,
asSelect: boolean,
scoper: FreScoper,
listJoin?: FreListInfo,
): Box[] {
Expand All @@ -247,12 +240,7 @@ export class UtilRefHelpers {
listElem.name = selected;
return BehaviorExecutionResult.EXECUTED;
};
let innerBox: Box;
if (asSelect) {
innerBox = BoxUtil.limitedBox(element, propertyName, setFunc, LimitedDisplay.SELECT, scoper, index);
} else {
innerBox = BoxUtil.referenceBox(element, propertyName, setFunc, scoper, index);
}
let innerBox = BoxUtil.referenceBox(element, propertyName, setFunc, scoper, index);
if (listJoin !== null && listJoin !== undefined) {
result.push(...UtilCommon.addListJoin(listJoin, index, numberOfItems, element, roleName, propertyName, innerBox));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,15 @@ export class ItemBoxHelper {
language,
item.listInfo,
property,
elementVarName,
false
elementVarName
);
} else if (!!item.listInfo) {
// if there is information on how to project the property as a list, make it a list
innerResult = this._myListPropHelper.generateReferenceAsList(
language,
item.listInfo,
property,
elementVarName,
false
elementVarName
);
}
if (!!item.externalInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ export class LimitedBoxHelper {
language,
listInfo,
property,
elementVarName,
true
elementVarName
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ export class ListPropertyBoxHelper {
language: FreMetaLanguage,
listJoin: FreEditListInfo,
reference: FreMetaConceptProperty,
element: string,
isLimited: boolean
element: string
): string {
ListUtil.addIfNotPresent(this._myTemplate.coreImports, "BoxUtil");
ListUtil.addIfNotPresent(this._myTemplate.configImports, Names.environment(language));
const joinEntry = this.getJoinEntry(listJoin);
if (listJoin.direction === FreEditProjectionDirection.Vertical) {
return `BoxUtil.verticalReferenceListBox(${element}, "${reference.name}", ${Names.environment(language)}.getInstance().scoper, ${isLimited}, ${joinEntry})`;
return `BoxUtil.verticalReferenceListBox(${element}, "${reference.name}", ${Names.environment(language)}.getInstance().scoper, ${joinEntry})`;
} // else
return `BoxUtil.horizontalReferenceListBox(${element}, "${reference.name}", ${Names.environment(language)}.getInstance().scoper, ${isLimited}, ${joinEntry})`;
return `BoxUtil.horizontalReferenceListBox(${element}, "${reference.name}", ${Names.environment(language)}.getInstance().scoper, ${joinEntry})`;
}

public getJoinEntry(listJoin: FreEditListInfo): string {
Expand Down

0 comments on commit afb7d96

Please sign in to comment.