@gridkitjs/react 0.0.0-dev-20261109130950 → 0.0.0-dev-20261109132710
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -5
- package/dist/index.js +26 -21
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -174,7 +174,7 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
174
174
|
selectRows(rowIds: readonly string[], intent?: "replace" | "toggle"): void;
|
|
175
175
|
/** Expands every group at once, as the `group.expandAll` command does. */
|
|
176
176
|
expandAllGroups(): void;
|
|
177
|
-
/** Collapses every group
|
|
177
|
+
/** Collapses every group at once, as the `group.collapseAll` command does — one nested under a collapsed group, and one that appears later, too. */
|
|
178
178
|
collapseAllGroups(): void;
|
|
179
179
|
/** Moves to the given page, clamped into range. */
|
|
180
180
|
goToPage(pageIndex: number): void;
|
|
@@ -210,7 +210,7 @@ interface DataGridApi<Row> extends GridExportApi, GridPrintApi, GridPanelApi {
|
|
|
210
210
|
setColumnSort(sort: ColumnSortState): void;
|
|
211
211
|
/** Replaces the group-by stack. Reports through `onGroupByChange`. */
|
|
212
212
|
setGroupBy(groupBy: GroupByState): void;
|
|
213
|
-
/** Replaces the
|
|
213
|
+
/** Replaces the group expansion. Reports through `onGroupExpansionChange` with `groupId: null`, and nothing for an equal expansion. */
|
|
214
214
|
setGroupExpansion(expansion: GroupExpansionState): void;
|
|
215
215
|
/** Replaces the page and page size as given. Reports through `onPaginationChange`. */
|
|
216
216
|
setPagination(pagination: PaginationState): void;
|
|
@@ -397,14 +397,14 @@ interface GroupByStateApi {
|
|
|
397
397
|
* outside the grid's own DOM.
|
|
398
398
|
*
|
|
399
399
|
* The ref's `setGroupBy` and `setGroupExpansion` change the grouping and the
|
|
400
|
-
*
|
|
400
|
+
* group expansion for a custom group-by UI; this hook carries only the
|
|
401
401
|
* all-at-once expansion actions. A specific
|
|
402
402
|
* group's own computed aggregates are read off `getDisplayRows()`'s
|
|
403
403
|
* per-header `aggregates` field instead of a getter here — see
|
|
404
404
|
* `useAggregateState` for the grand-total equivalent.
|
|
405
405
|
*
|
|
406
|
-
* Before the grid mounts,
|
|
407
|
-
* no-ops.
|
|
406
|
+
* Before the grid mounts, `groupBy` reads as empty, `groupExpansion` as
|
|
407
|
+
* `ALL_EXPANDED`, and the actions are no-ops.
|
|
408
408
|
*/
|
|
409
409
|
declare function useGroupByState<Row>(gridRef: RefObject<DataGridApi<Row> | null>): GroupByStateApi;
|
|
410
410
|
|
package/dist/index.js
CHANGED
|
@@ -1533,7 +1533,8 @@ function GroupByBar({
|
|
|
1533
1533
|
|
|
1534
1534
|
// src/DataGrid/announcedCallbacks.ts
|
|
1535
1535
|
import {
|
|
1536
|
-
isColumnVisible
|
|
1536
|
+
isColumnVisible,
|
|
1537
|
+
isGroupExpanded
|
|
1537
1538
|
} from "@gridkitjs/core";
|
|
1538
1539
|
function announcedCallbacks({
|
|
1539
1540
|
callbacks,
|
|
@@ -1624,20 +1625,21 @@ function announcedCallbacks({
|
|
|
1624
1625
|
);
|
|
1625
1626
|
},
|
|
1626
1627
|
/**
|
|
1627
|
-
* `groupId: null` marks `expandAll`/`collapseAll
|
|
1628
|
-
* group in one call rather than
|
|
1629
|
-
*
|
|
1628
|
+
* `groupId: null` marks `expandAll`/`collapseAll` and
|
|
1629
|
+
* `setGroupExpansion`, which touch every group in one call rather than
|
|
1630
|
+
* one at a time — announced as a single summary of the mode the groups
|
|
1631
|
+
* now follow, instead of naming a group that doesn't apply.
|
|
1630
1632
|
*/
|
|
1631
1633
|
onGroupExpansionChange: (event) => {
|
|
1632
1634
|
callbacks.onGroupExpansionChange?.(event);
|
|
1633
1635
|
if (event.groupId === null) {
|
|
1634
1636
|
announce(
|
|
1635
|
-
event.expansion.
|
|
1637
|
+
event.expansion.mode === "allExpanded" ? messages.allGroupsExpanded : messages.allGroupsCollapsed
|
|
1636
1638
|
);
|
|
1637
1639
|
return;
|
|
1638
1640
|
}
|
|
1639
1641
|
announce(
|
|
1640
|
-
event.expansion
|
|
1642
|
+
isGroupExpanded(event.expansion, event.groupId) ? messages.groupExpanded : messages.groupCollapsed
|
|
1641
1643
|
);
|
|
1642
1644
|
},
|
|
1643
1645
|
onPaginationChange: (event) => {
|
|
@@ -2718,7 +2720,8 @@ import {
|
|
|
2718
2720
|
describeColumnFilter,
|
|
2719
2721
|
filterDraftChanged,
|
|
2720
2722
|
filterEditorReducer,
|
|
2721
|
-
initialFilterEditorDraft
|
|
2723
|
+
initialFilterEditorDraft,
|
|
2724
|
+
toValuesDraft
|
|
2722
2725
|
} from "@gridkitjs/core";
|
|
2723
2726
|
function openValues(filter, columnId, values) {
|
|
2724
2727
|
const shape = describeColumnFilter(filter, columnId);
|
|
@@ -2729,7 +2732,7 @@ function openValues(filter, columnId, values) {
|
|
|
2729
2732
|
};
|
|
2730
2733
|
}
|
|
2731
2734
|
function initialExcelEditorState(opened) {
|
|
2732
|
-
return { opened, draft: opened.draft };
|
|
2735
|
+
return { opened, draft: toValuesDraft(opened.draft) };
|
|
2733
2736
|
}
|
|
2734
2737
|
function showsAlike(a, b) {
|
|
2735
2738
|
return a.shape.kind === b.shape.kind && a.draft.options === b.draft.options && !filterDraftChanged(a.draft, b.draft);
|
|
@@ -2738,7 +2741,10 @@ function excelEditorReducer(state, action) {
|
|
|
2738
2741
|
if (action.type === "filterChanged") {
|
|
2739
2742
|
return showsAlike(state.opened, action.opened) ? { ...state, opened: action.opened } : initialExcelEditorState(action.opened);
|
|
2740
2743
|
}
|
|
2741
|
-
return {
|
|
2744
|
+
return {
|
|
2745
|
+
...state,
|
|
2746
|
+
draft: toValuesDraft(filterEditorReducer(state.draft, action))
|
|
2747
|
+
};
|
|
2742
2748
|
}
|
|
2743
2749
|
|
|
2744
2750
|
// src/DataGrid/menu/useMenuButton.ts
|
|
@@ -2880,7 +2886,7 @@ import {
|
|
|
2880
2886
|
conditionsFromRows as conditionsFromRows2,
|
|
2881
2887
|
draftToFilter,
|
|
2882
2888
|
filterDraftChanged as filterDraftChanged2,
|
|
2883
|
-
filterEditorReducer as
|
|
2889
|
+
filterEditorReducer as filterEditorReducer2
|
|
2884
2890
|
} from "@gridkitjs/core";
|
|
2885
2891
|
|
|
2886
2892
|
// src/DataGrid/filterMenu/ConditionRow.tsx
|
|
@@ -3006,7 +3012,6 @@ import {
|
|
|
3006
3012
|
conditionRowsFrom,
|
|
3007
3013
|
conditionsFromRows,
|
|
3008
3014
|
describeColumnFilter as describeColumnFilter2,
|
|
3009
|
-
filterEditorReducer as filterEditorReducer2,
|
|
3010
3015
|
initialFilterEditorDraft as initialFilterEditorDraft2
|
|
3011
3016
|
} from "@gridkitjs/core";
|
|
3012
3017
|
var NO_ROWS = [];
|
|
@@ -3021,14 +3026,11 @@ function filterDraftShown(shape, rows, columnId, type) {
|
|
|
3021
3026
|
...NO_VALUES,
|
|
3022
3027
|
columnType: type
|
|
3023
3028
|
});
|
|
3024
|
-
if (
|
|
3029
|
+
if (draft.kind !== "conditions") {
|
|
3025
3030
|
return draft;
|
|
3026
3031
|
}
|
|
3027
3032
|
const shown = conditionsFromRows(rows, columnId, type);
|
|
3028
|
-
return shown.invalid.length > 0 ? draft :
|
|
3029
|
-
type: "setConditions",
|
|
3030
|
-
conditions: shown.conditions
|
|
3031
|
-
});
|
|
3033
|
+
return shown.invalid.length > 0 ? draft : { ...draft, conditions: shown.conditions };
|
|
3032
3034
|
}
|
|
3033
3035
|
function openConditions(filter, columnId, operators, type, operator) {
|
|
3034
3036
|
const shape = describeColumnFilter2(filter, columnId);
|
|
@@ -3049,14 +3051,14 @@ function openConditions(filter, columnId, operators, type, operator) {
|
|
|
3049
3051
|
function initialSimpleEditorState(opened) {
|
|
3050
3052
|
return { opened, draft: opened.draft, invalid: NO_ROWS };
|
|
3051
3053
|
}
|
|
3052
|
-
function
|
|
3054
|
+
function sameConditionRows(a, b) {
|
|
3053
3055
|
return a.combinator === b.combinator && a.rows.length === b.rows.length && a.rows.every((row, index) => {
|
|
3054
3056
|
const other = b.rows[index];
|
|
3055
3057
|
return other !== void 0 && row.operator === other.operator && row.text === other.text && row.textTo === other.textTo;
|
|
3056
3058
|
});
|
|
3057
3059
|
}
|
|
3058
3060
|
function showsAlike2(a, b) {
|
|
3059
|
-
return a.custom === b.custom &&
|
|
3061
|
+
return a.custom === b.custom && sameConditionRows(a.draft, b.draft);
|
|
3060
3062
|
}
|
|
3061
3063
|
function simpleEditorReducer(state, action) {
|
|
3062
3064
|
switch (action.type) {
|
|
@@ -3146,7 +3148,7 @@ function SimpleFilterEditor({
|
|
|
3146
3148
|
const invalidMessageId = useId();
|
|
3147
3149
|
const combinatorName = useId();
|
|
3148
3150
|
function applyConditions(conditions) {
|
|
3149
|
-
const applied =
|
|
3151
|
+
const applied = filterEditorReducer2(opened.filterDraft, {
|
|
3150
3152
|
type: "setConditions",
|
|
3151
3153
|
conditions,
|
|
3152
3154
|
combinator: draft.combinator
|
|
@@ -3170,7 +3172,7 @@ function SimpleFilterEditor({
|
|
|
3170
3172
|
applyConditions(parsed.conditions);
|
|
3171
3173
|
return true;
|
|
3172
3174
|
}
|
|
3173
|
-
if (
|
|
3175
|
+
if (sameConditionRows(draft, opened.draft) && !unreadable.includes(true)) {
|
|
3174
3176
|
return true;
|
|
3175
3177
|
}
|
|
3176
3178
|
dispatch({ type: "markInvalid", rows: marked });
|
|
@@ -5122,8 +5124,11 @@ function usePaginationState(gridRef) {
|
|
|
5122
5124
|
|
|
5123
5125
|
// src/DataGrid/hooks/useGroupByState.ts
|
|
5124
5126
|
import { useCallback as useCallback6 } from "react";
|
|
5127
|
+
import {
|
|
5128
|
+
ALL_EXPANDED
|
|
5129
|
+
} from "@gridkitjs/core";
|
|
5125
5130
|
var FALLBACK_GROUP_BY = [];
|
|
5126
|
-
var FALLBACK_EXPANSION =
|
|
5131
|
+
var FALLBACK_EXPANSION = ALL_EXPANDED;
|
|
5127
5132
|
function useGroupByState(gridRef) {
|
|
5128
5133
|
const groupBy = useGridSnapshot(
|
|
5129
5134
|
gridRef,
|