Skip to content

Commit 918e456

Browse files
committed
feat: change wording and add switch
1 parent 941ef1e commit 918e456

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function useCreateGalleryScope(props: GalleryContainerProps): GalleryRootScope {
102102
props.itemSelection,
103103
props.datasource,
104104
props.onSelectionChange,
105-
"always keep"
105+
props.keepSelection ? "always keep" : "always clear"
106106
);
107107
const itemSelectHelper = useItemSelectHelper(props.itemSelection, selectionHelper);
108108

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@
191191
<description>Assistive technology will read this upon reaching each gallery item.</description>
192192
</property>
193193
<property key="sCountFmtSingular" type="textTemplate" required="false">
194-
<caption>Row count singular</caption>
195-
<description>Must include '%d' to denote number position ('%d row selected')</description>
194+
<caption>Item count singular</caption>
195+
<description>Must include '%d' to denote number position ('%d item selected')</description>
196196
</property>
197197
<property key="sCountFmtPlural" type="textTemplate" required="false">
198-
<caption>Row count plural</caption>
199-
<description>Must include '%d' to denote number position ('%d rows selected')</description>
198+
<caption>Item count plural</caption>
199+
<description>Must include '%d' to denote number position ('%d items selected')</description>
200200
</property>
201201
</propertyGroup>
202202
</propertyGroup>

packages/pluggableWidgets/gallery-web/src/stores/GalleryStore.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export class GalleryStore extends BaseControllerHost {
7474
showTotalCount: spec.showTotalCount
7575
});
7676

77-
this.selectionCountStore = new SelectionCountStore(spec.gate);
77+
this.selectionCountStore = new SelectionCountStore(spec.gate, {
78+
singular: "%d item selected",
79+
plural: "%d items selected"
80+
});
7881

7982
this._filtersHost = new CustomFilterHost();
8083

packages/shared/widget-plugin-grid/src/selection/stores/SelectionCountStore.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ type Gate = DerivedPropsGate<{
1010

1111
export class SelectionCountStore {
1212
private gate: Gate;
13+
private singular: string = "%d row selected";
14+
private plural: string = "%d rows selected";
1315

14-
constructor(gate: Gate) {
16+
constructor(gate: Gate, spec: { singular?: string; plural?: string } = {}) {
17+
this.singular = spec.singular ?? this.singular;
18+
this.plural = spec.plural ?? this.plural;
1519
this.gate = gate;
1620

1721
makeObservable(this, {
@@ -23,11 +27,11 @@ export class SelectionCountStore {
2327
}
2428

2529
get fmtSingular(): string {
26-
return this.gate.props.sCountFmtSingular?.value || "%d row selected";
30+
return this.gate.props.sCountFmtSingular?.value || this.singular;
2731
}
2832

2933
get fmtPlural(): string {
30-
return this.gate.props.sCountFmtPlural?.value || "%d rows selected";
34+
return this.gate.props.sCountFmtPlural?.value || this.plural;
3135
}
3236

3337
get selectedCount(): number {

0 commit comments

Comments
 (0)