Skip to content

Commit d1a9cb4

Browse files
committed
refactor: remove unused properties and logic from deprecated hook
1 parent c841e55 commit d1a9cb4

File tree

2 files changed

+2
-76
lines changed

2 files changed

+2
-76
lines changed

packages/pluggableWidgets/datagrid-web/src/Datagrid.xml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,10 @@
1616
<caption>Refresh time (in seconds)</caption>
1717
<description />
1818
</property>
19-
<property key="itemSelection" type="selection" dataSource="datasource">
20-
<caption>Selection</caption>
21-
<description />
22-
<selectionTypes>
23-
<selectionType name="None" />
24-
<selectionType name="Single" />
25-
<selectionType name="Multi" />
26-
</selectionTypes>
27-
</property>
28-
<property key="itemSelectionMethod" type="enumeration" defaultValue="checkbox">
29-
<caption>Selection method</caption>
30-
<description />
31-
<enumerationValues>
32-
<enumerationValue key="checkbox">Checkbox</enumerationValue>
33-
<enumerationValue key="rowClick">Row click</enumerationValue>
34-
</enumerationValues>
35-
</property>
3619
<property key="autoSelect" type="boolean" defaultValue="false">
3720
<caption>Auto select first row</caption>
3821
<description>Automatically select the first row</description>
3922
</property>
40-
<property key="itemSelectionMode" type="enumeration" defaultValue="clear">
41-
<caption>Toggle on click</caption>
42-
<description>Defines item selection behavior.</description>
43-
<enumerationValues>
44-
<enumerationValue key="toggle">Yes</enumerationValue>
45-
<enumerationValue key="clear">No</enumerationValue>
46-
</enumerationValues>
47-
</property>
48-
<property key="showSelectAllToggle" type="boolean" defaultValue="true">
49-
<caption>Show (un)check all toggle</caption>
50-
<description>Show a checkbox in the grid header to check or uncheck multiple items.</description>
51-
</property>
52-
<property key="keepSelection" type="boolean" defaultValue="false">
53-
<caption>Keep selection</caption>
54-
<description>If enabled, selected items will stay selected unless cleared by the user or a Nanoflow.</description>
55-
</property>
56-
<property key="clearSelectionButtonLabel" type="textTemplate" required="false">
57-
<caption>Clear selection label</caption>
58-
<description>Customize the label of the 'Clear section' button</description>
59-
<translations>
60-
<translation lang="en_US">Clear selection</translation>
61-
</translations>
62-
</property>
63-
<property key="loadingType" type="enumeration" defaultValue="spinner" required="true">
64-
<caption>Loading type</caption>
65-
<description />
66-
<enumerationValues>
67-
<enumerationValue key="spinner">Spinner</enumerationValue>
68-
<enumerationValue key="skeleton">Skeleton</enumerationValue>
69-
</enumerationValues>
70-
</property>
71-
<property key="refreshIndicator" type="boolean" defaultValue="false">
72-
<caption>Show refresh indicator</caption>
73-
<description>Show a refresh indicator when the data is being loaded.</description>
74-
</property>
7523
</propertyGroup>
7624
<propertyGroup caption="Columns">
7725
<property key="columns" type="object" isList="true">

packages/shared/widget-plugin-grid/src/selection/helpers.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -346,40 +346,18 @@ export function useSelectionHelper(
346346
selection: SelectionSingleValue | SelectionMultiValue | undefined,
347347
dataSource: ListValue,
348348
onSelectionChange: ActionValue | undefined,
349-
keepSelection: Parameters<typeof selectionStateHandler>[0],
350-
selectFirstRow?: boolean
349+
keepSelection: Parameters<typeof selectionStateHandler>[0]
351350
): SelectionHelper | undefined {
352351
const prevObjectListRef = useRef<ObjectItem[]>([]);
353352
const firstLoadDone = useRef(false);
354-
const hasAutoSelected = useRef(false);
353+
355354
useState(() => {
356355
if (selection) {
357356
selection.setKeepSelection(selectionStateHandler(keepSelection));
358357
}
359358
});
360359
firstLoadDone.current ||= dataSource?.status !== "loading";
361360

362-
useEffect(() => {
363-
if (
364-
selectFirstRow &&
365-
dataSource.status === "available" &&
366-
dataSource.items &&
367-
dataSource.items.length > 0 &&
368-
selection &&
369-
selection.type === "Single" &&
370-
!selection.selection &&
371-
!hasAutoSelected.current
372-
) {
373-
setTimeout(() => {
374-
if (!selection.selection) {
375-
const firstItem = dataSource.items![0];
376-
selection.setSelection(firstItem);
377-
hasAutoSelected.current = true;
378-
}
379-
}, 100);
380-
}
381-
}, [dataSource.status, dataSource.items, selectFirstRow, selection]);
382-
383361
useEffect(() => {
384362
const prevObjectList = prevObjectListRef.current;
385363
const current = selection?.selection ?? [];

0 commit comments

Comments
 (0)