Skip to content

Commit 941ef1e

Browse files
committed
feat: update gallery xml
1 parent 2332103 commit 941ef1e

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

packages/pluggableWidgets/gallery-web/src/Gallery.editorConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function getProperties(values: GalleryPreviewProps, defaultProperties: Pr
1818
hidePropertiesIn(defaultProperties, values, ["onSelectionChange", "itemSelectionMode"]);
1919
}
2020

21+
if (values.itemSelection !== "Multi") {
22+
hidePropertiesIn(defaultProperties, values, ["keepSelection"]);
23+
}
24+
2125
const usePersonalization = values.storeFilters || values.storeSort;
2226
if (!usePersonalization) {
2327
hidePropertiesIn(defaultProperties, values, ["stateStorageType", "stateStorageAttr", "onConfigurationChange"]);

packages/pluggableWidgets/gallery-web/src/Gallery.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<enumerationValue key="clear">No</enumerationValue>
3434
</enumerationValues>
3535
</property>
36+
<property key="keepSelection" type="boolean" defaultValue="false">
37+
<caption>Keep selection</caption>
38+
<description>If enabled, selected items will stay selected unless cleared by the user or a Nanoflow.</description>
39+
</property>
3640
<property key="content" type="widgets" dataSource="datasource" required="false">
3741
<caption>Content placeholder</caption>
3842
<description />

packages/pluggableWidgets/gallery-web/src/utils/test-utils.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export function createMockGalleryContext(): GalleryRootScope {
5656
stateStorageType: "localStorage",
5757
storeFilters: false,
5858
storeSort: false,
59-
refreshIndicator: false
59+
refreshIndicator: false,
60+
keepSelection: false
6061
};
6162

6263
// Create a proper gate provider and gate

packages/pluggableWidgets/gallery-web/typings/GalleryProps.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface GalleryContainerProps {
2929
datasource: ListValue;
3030
itemSelection?: SelectionSingleValue | SelectionMultiValue;
3131
itemSelectionMode: ItemSelectionModeEnum;
32+
keepSelection: boolean;
3233
content?: ListWidgetValue;
3334
refreshIndicator: boolean;
3435
desktopItems: number;
@@ -73,6 +74,7 @@ export interface GalleryPreviewProps {
7374
datasource: {} | { caption: string } | { type: string } | null;
7475
itemSelection: "None" | "Single" | "Multi";
7576
itemSelectionMode: ItemSelectionModeEnum;
77+
keepSelection: boolean;
7678
content: { widgetCount: number; renderer: ComponentType<{ children: ReactNode; caption?: string }> };
7779
refreshIndicator: boolean;
7880
desktopItems: number | null;

0 commit comments

Comments
 (0)