feat(sort): custom series sort in study panel (#4214)

This commit is contained in:
Ibrahim authored and GitHub committed 2024-06-20 16:58:59 -04:00
1 parent 6f93449149
commit a433d406e2
17 files changed
+211 -15

No files matched your search

@@ -177,9 +177,10 @@ export default class CustomizationService extends PubSubService {
defaultCustomization ||
{};
// use the source merge type if not provided then fallback to merge
this.modeCustomizations.set(
customizationId,
this.mergeValue(sourceCustomization, customization, merge)
this.mergeValue(sourceCustomization, customization, sourceCustomization.merge ?? merge)
);
this.transformedCustomizations.clear();
this._broadcastEvent(this.EVENTS.CUSTOMIZATION_MODIFIED, {
@@ -424,4 +424,24 @@ export default class DisplaySetService extends PubSubService {
return result;
}
/**
*
* @param sortFn function to sort the display sets
* @param direction direction to sort the display sets
* @returns void
*/
public sortDisplaySets(
sortFn: (a: DisplaySet, b: DisplaySet) => number,
direction: string,
suppressEvent = false
): void {
this.activeDisplaySets.sort(sortFn);
if (direction === 'descending') {
this.activeDisplaySets.reverse();
}
if (!suppressEvent) {
this._broadcastEvent(EVENTS.DISPLAY_SETS_CHANGED, this.activeDisplaySets);
}
}
}
+1
View File
@@ -70,6 +70,7 @@ declare global {
customizationService?: any;
extensions?: string[];
modes?: string[];
experimentalStudyBrowserSort?: boolean;
defaultDataSourceName?: string;
hotkeys?: Record<string, Hotkey> | Hotkey[];
useSharedArrayBuffer?: 'AUTO' | 'FALSE' | 'TRUE';