Skip to content

Commit 029a3e4

Browse files
committed
fix: address minor issues
1 parent 197445b commit 029a3e4

5 files changed

Lines changed: 58 additions & 22 deletions

File tree

packages/pluggableWidgets/datagrid-web/src/Datagrid.editorConfig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ export function getProperties(values: DatagridPreviewProps, defaultProperties: P
8989
"dynamicPage",
9090
"dynamicPageSize",
9191
"useCustomPagination",
92-
"customPagination"
92+
"customPagination",
93+
"totalCountValue"
9394
]);
9495
}
9596

@@ -147,8 +148,7 @@ function hideSelectionProperties(defaultProperties: Properties, values: Datagrid
147148
"itemSelectionMethod",
148149
"itemSelectionMode",
149150
"onSelectionChange",
150-
"keepSelection",
151-
"totalCountValue"
151+
"keepSelection"
152152
]);
153153
}
154154

packages/pluggableWidgets/datagrid-web/src/Datagrid.editorPreview.tsx

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ function WidgetTopBar(): ReactElement {
105105
<div className={cls.topBar}>
106106
<div className={cls.pagingTop}>
107107
<div className={cls.ptStart}>{useTopCounter() ? <SelectionCounter /> : null}</div>
108-
<div className={cls.ptEnd}>{usePagingTop() ? <Pagination /> : null}</div>
108+
<div className={cls.ptEnd}>
109+
{usePagingTop() ? <Pagination /> : null}
110+
{useCustomPagination("top") ? <CustomPagination /> : null}
111+
</div>
109112
</div>
110113
</div>
111114
);
@@ -137,7 +140,10 @@ function WidgetFooter(): ReactElement {
137140
</button>
138141
) : null}
139142
</div>
140-
<div className={cls.pbEnd}>{usePagingBot() ? <Pagination /> : null}</div>
143+
<div className={cls.pbEnd}>
144+
{usePagingBot() ? <Pagination /> : null}
145+
{useCustomPagination("bottom") ? <CustomPagination /> : null}
146+
</div>
141147
</div>
142148
</div>
143149
);
@@ -326,6 +332,15 @@ const Pagination = (): ReactNode => {
326332
);
327333
};
328334

335+
const CustomPagination = (): ReactNode => {
336+
const { customPagination } = useProps();
337+
return (
338+
<customPagination.renderer caption="Custom pagination: Place widgets here">
339+
<div style={{ flexGrow: 1 }} />
340+
</customPagination.renderer>
341+
);
342+
};
343+
329344
function useColumns(): ColumnsPreviewType[] {
330345
const { columns } = useProps();
331346
return columns.length > 0 ? columns : initColumns;
@@ -381,12 +396,17 @@ function useBottomCounter(): boolean {
381396

382397
function usePagingTop(): boolean {
383398
const props = useProps();
384-
const visible = props.showNumberOfRows || props.pagination === "buttons";
399+
const visible = (props.showNumberOfRows || props.pagination === "buttons") && !props.useCustomPagination;
385400
return visible && props.pagingPosition !== "bottom";
386401
}
387402

388403
function usePagingBot(): boolean {
389404
const props = useProps();
390-
const visible = props.showNumberOfRows || props.pagination === "buttons";
405+
const visible = (props.showNumberOfRows || props.pagination === "buttons") && !props.useCustomPagination;
391406
return visible && props.pagingPosition !== "top";
392407
}
408+
409+
function useCustomPagination(location: "top" | "bottom"): boolean {
410+
const props = useProps();
411+
return props.useCustomPagination && (props.pagingPosition === location || props.pagingPosition === "both");
412+
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ export function getProperties(values: GalleryPreviewProps, defaultProperties: Pr
2020
}
2121

2222
if (values.itemSelection !== "Multi") {
23-
hidePropertiesIn(defaultProperties, values, [
24-
"keepSelection",
25-
"selectionCountPosition",
26-
"clearSelectionButtonLabel"
27-
]);
23+
hidePropertiesIn(defaultProperties, values, ["keepSelection", "selectionCountPosition"]);
2824
}
2925

3026
const usePersonalization = values.storeFilters || values.storeSort;

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ const Pagination = (): ReactNode => {
4444
);
4545
};
4646

47+
const CustomPagination = (): ReactNode => {
48+
const { customPagination } = useProps();
49+
return (
50+
<customPagination.renderer caption="Custom pagination: Place widgets here">
51+
<div style={{ flexGrow: 1 }} />
52+
</customPagination.renderer>
53+
);
54+
};
55+
4756
const SelectionCounter = (): ReactNode => {
4857
const props = useProps();
4958
return (
@@ -70,7 +79,10 @@ const TopControls = (): ReactNode => {
7079
return (
7180
<div className="widget-gallery-top-bar-controls">
7281
<div className="widget-gallery-tb-start">{useTopCounter() ? <SelectionCounter /> : null}</div>
73-
<div className="widget-gallery-tb-end">{usePagingTop() ? <Pagination /> : null}</div>
82+
<div className="widget-gallery-tb-end">
83+
{usePagingTop() ? <Pagination /> : null}
84+
{useCustomPagination("top") ? <CustomPagination /> : null}
85+
</div>
7486
</div>
7587
);
7688
};
@@ -139,7 +151,10 @@ const Footer = (): ReactNode => {
139151
<LoadMoreButton>{props.loadMoreButtonCaption}</LoadMoreButton>
140152
) : null}
141153
</div>
142-
<div className="widget-gallery-fc-end">{usePagingBot() ? <Pagination /> : null}</div>
154+
<div className="widget-gallery-fc-end">
155+
{usePagingBot() ? <Pagination /> : null}
156+
{useCustomPagination("bottom") ? <CustomPagination /> : null}
157+
</div>
143158
</div>
144159
</div>
145160
);
@@ -161,12 +176,17 @@ function useBottomCounter(): boolean {
161176

162177
function usePagingTop(): boolean {
163178
const props = useProps();
164-
const visible = props.showTotalCount || props.pagination === "buttons";
179+
const visible = (props.showTotalCount || props.pagination === "buttons") && !props.useCustomPagination;
165180
return visible && props.pagingPosition !== "bottom";
166181
}
167182

168183
function usePagingBot(): boolean {
169184
const props = useProps();
170-
const visible = props.showTotalCount || props.pagination === "buttons";
185+
const visible = (props.showTotalCount || props.pagination === "buttons") && !props.useCustomPagination;
171186
return visible && props.pagingPosition !== "top";
172187
}
188+
189+
function useCustomPagination(location: "top" | "bottom"): boolean {
190+
const props = useProps();
191+
return props.useCustomPagination && (props.pagingPosition === location || props.pagingPosition === "both");
192+
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,19 +254,19 @@
254254
</propertyGroup>
255255
<propertyGroup caption="Captions">
256256
<property key="selectedCountTemplateSingular" type="textTemplate" required="false">
257-
<caption>Row count singular</caption>
257+
<caption>Item count singular</caption>
258258
<description>Must include '%d' to denote number position</description>
259259
<translations>
260-
<translation lang="en_US">%d row selected</translation>
261-
<translation lang="nl_NL">%d rij geselecteerd</translation>
260+
<translation lang="en_US">%d item selected</translation>
261+
<translation lang="nl_NL">%d item geselecteerd</translation>
262262
</translations>
263263
</property>
264264
<property key="selectedCountTemplatePlural" type="textTemplate" required="false">
265-
<caption>Row count plural</caption>
265+
<caption>Item count plural</caption>
266266
<description>Must include '%d' to denote number position</description>
267267
<translations>
268-
<translation lang="en_US">%d rows selected</translation>
269-
<translation lang="nl_NL">%d rijen geselecteerd</translation>
268+
<translation lang="en_US">%d items selected</translation>
269+
<translation lang="nl_NL">%d items geselecteerd</translation>
270270
</translations>
271271
</property>
272272
<property key="clearSelectionButtonLabel" type="textTemplate" required="false">

0 commit comments

Comments
 (0)