viewkitjs 0.27.0 → 0.28.0
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/CHANGELOG.md +71 -0
- package/MIGRATION.md +40 -3
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +3 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/use-cell-format.d.ts +8 -1
- package/views/dist/cells/use-cell-format.js +13 -2
- package/views/dist/contract.d.ts +70 -3
- package/views/dist/contract.js +76 -0
- package/views/dist/controls/alert/alert.d.ts +46 -0
- package/views/dist/controls/alert/alert.js +11 -0
- package/views/dist/controls/alert/looks.d.ts +4 -0
- package/views/dist/controls/alert/looks.js +19 -0
- package/views/dist/controls/alert/tokens.d.ts +92 -0
- package/views/dist/controls/alert/tokens.js +25 -0
- package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
- package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
- package/views/dist/controls/alert-dialog/confirm.js +11 -0
- package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
- package/views/dist/controls/alert-dialog/looks.js +17 -0
- package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
- package/views/dist/controls/alert-dialog/tokens.js +32 -0
- package/views/dist/controls/alert-dialog.css +95 -0
- package/views/dist/controls/alert.css +51 -0
- package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
- package/views/dist/controls/collapsible/collapsible.js +18 -0
- package/views/dist/controls/collapsible/looks.d.ts +4 -0
- package/views/dist/controls/collapsible/looks.js +5 -0
- package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
- package/views/dist/controls/collapsible/map-collapse.js +6 -0
- package/views/dist/controls/collapsible/tokens.d.ts +68 -0
- package/views/dist/controls/collapsible/tokens.js +19 -0
- package/views/dist/controls/collapsible.css +83 -0
- package/views/dist/controls/compound-editor/place-parts.js +5 -1
- package/views/dist/controls/controls.d.ts +9 -0
- package/views/dist/controls/controls.js +9 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/filter-editor/filter-editor.d.ts +56 -0
- package/views/dist/controls/filter-editor/filter-editor.js +208 -0
- package/views/dist/controls/filter-editor/how.d.ts +23 -0
- package/views/dist/controls/filter-editor/how.js +13 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +18 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +164 -0
- package/views/dist/controls/filter-editor/map-rules.d.ts +85 -0
- package/views/dist/controls/filter-editor/map-rules.js +273 -0
- package/views/dist/controls/filter-editor/parts.d.ts +46 -0
- package/views/dist/controls/filter-editor/parts.js +75 -0
- package/views/dist/controls/filter-editor/rules.d.ts +104 -0
- package/views/dist/controls/filter-editor/rules.js +148 -0
- package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
- package/views/dist/controls/filter-editor/tokens.js +23 -0
- package/views/dist/controls/filter-editor/words.d.ts +59 -0
- package/views/dist/controls/filter-editor/words.js +40 -0
- package/views/dist/controls/filter-editor.css +124 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
- package/views/dist/controls/group-editor/group-editor.js +126 -0
- package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
- package/views/dist/controls/group-editor/map-group-body.js +106 -0
- package/views/dist/controls/group-editor/rules.d.ts +48 -0
- package/views/dist/controls/group-editor/rules.js +41 -0
- package/views/dist/controls/group-editor/tokens.d.ts +15 -0
- package/views/dist/controls/group-editor/tokens.js +6 -0
- package/views/dist/controls/group-editor/words.d.ts +39 -0
- package/views/dist/controls/group-editor/words.js +21 -0
- package/views/dist/controls/group-editor.css +20 -0
- package/views/dist/controls/index.d.ts +19 -1
- package/views/dist/controls/index.js +19 -1
- package/views/dist/controls/internal/editor-parts.d.ts +8 -1
- package/views/dist/controls/internal/editor-parts.js +5 -0
- package/views/dist/controls/internal/step-return.d.ts +9 -0
- package/views/dist/controls/internal/step-return.js +27 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +5 -3
- package/views/dist/controls/links-editor/links-editor.js +38 -17
- package/views/dist/controls/links-editor/map-links-body.js +4 -1
- package/views/dist/controls/links-editor.css +1 -1
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
- package/views/dist/controls/menu-list/menu-list.js +25 -16
- package/views/dist/controls/modal/looks.d.ts +4 -0
- package/views/dist/controls/modal/looks.js +25 -0
- package/views/dist/controls/modal/modal.d.ts +69 -0
- package/views/dist/controls/modal/modal.js +62 -0
- package/views/dist/controls/modal/tokens.d.ts +192 -0
- package/views/dist/controls/modal/tokens.js +50 -0
- package/views/dist/controls/modal.css +130 -0
- package/views/dist/controls/notice/notice.d.ts +49 -0
- package/views/dist/controls/notice/notice.js +35 -0
- package/views/dist/controls/notice/tokens.d.ts +99 -0
- package/views/dist/controls/notice/tokens.js +27 -0
- package/views/dist/controls/notice.css +100 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/pane/looks.d.ts +4 -0
- package/views/dist/controls/pane/looks.js +11 -0
- package/views/dist/controls/pane/pane.d.ts +63 -0
- package/views/dist/controls/pane/pane.js +98 -0
- package/views/dist/controls/pane/state.d.ts +14 -0
- package/views/dist/controls/pane/state.js +7 -0
- package/views/dist/controls/pane/tokens.d.ts +79 -0
- package/views/dist/controls/pane/tokens.js +22 -0
- package/views/dist/controls/pane.css +104 -0
- package/views/dist/controls/picker/rows.d.ts +4 -2
- package/views/dist/controls/picker/rows.js +4 -3
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
- package/views/dist/controls/sort-editor/rules.d.ts +48 -0
- package/views/dist/controls/sort-editor/rules.js +24 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
- package/views/dist/controls/sort-editor/sort-editor.js +180 -0
- package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
- package/views/dist/controls/sort-editor/tokens.js +22 -0
- package/views/dist/controls/sort-editor/words.d.ts +48 -0
- package/views/dist/controls/sort-editor/words.js +25 -0
- package/views/dist/controls/sort-editor.css +96 -0
- package/views/dist/controls/toast/toast.d.ts +75 -0
- package/views/dist/controls/toast/toast.js +99 -0
- package/views/dist/controls/toast/tokens.d.ts +100 -0
- package/views/dist/controls/toast/tokens.js +27 -0
- package/views/dist/controls/toast.css +93 -0
- package/views/dist/controls/tokens.js +20 -0
- package/views/dist/controls/values-editor/values-editor.js +7 -1
- package/views/dist/display/date.js +2 -2
- package/views/dist/display/format.js +10 -2
- package/views/dist/display/options.d.ts +3 -1
- package/views/dist/display/use-display-options.d.ts +3 -0
- package/views/dist/display/use-display-options.js +10 -2
- package/views/dist/display/viewer.d.ts +1 -1
- package/views/dist/display/viewer.js +1 -1
- package/views/dist/editors/DateEditor.js +11 -9
- package/views/dist/editors/relation-panel.js +7 -1
- package/views/dist/editors/relation-picker.d.ts +2 -1
- package/views/dist/editors/relation-picker.js +4 -3
- package/views/dist/editors/relation-source.d.ts +4 -1
- package/views/dist/editors/relation-source.js +5 -2
- package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
- package/views/dist/fields/number-edit.d.ts +6 -0
- package/views/dist/fields/number-edit.js +8 -1
- package/views/dist/grid/chrome/GridCellEditors.js +2 -2
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
- package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
- package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
- package/views/dist/grid/chrome/GridFooter.js +2 -2
- package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
- package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
- package/views/dist/grid/core/commit-model.d.ts +7 -0
- package/views/dist/grid/core/commit-model.js +5 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/editing-model.js +3 -7
- package/views/dist/grid/core/undo-owner.d.ts +6 -0
- package/views/dist/grid/core/undo-owner.js +13 -0
- package/views/dist/grid/core/useGridEditing.d.ts +2 -0
- package/views/dist/grid/core/useGridEditing.js +4 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/panels/model.d.ts +6 -1
- package/views/dist/panels/react/customize-body.d.ts +4 -2
- package/views/dist/panels/react/customize-body.js +3 -3
- package/views/dist/panels/react/customize.js +4 -2
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +9 -6
- package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
- package/views/dist/panels/react/filter/filter-body.js +17 -6
- package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
- package/views/dist/panels/react/filter/filter-part-body.js +3 -1
- package/views/dist/panels/react/panel-sheet.d.ts +5 -1
- package/views/dist/panels/react/panel-sheet.js +6 -2
- package/views/dist/panels/react/panel-step.d.ts +12 -0
- package/views/dist/panels/react/panel-step.js +26 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
- package/views/dist/panels/react/sort/SortEditor.js +5 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +84 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +49 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +36 -21
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
- package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
- package/views/dist/panels/react/toolbar/panel-part.js +2 -2
- package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
- package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
- package/views/dist/panels/react.d.ts +1 -0
- package/views/dist/panels/react.js +1 -0
- package/views/dist/panels/settings/filter-groups.js +35 -1
- package/views/dist/panels/settings/group-buckets.js +1 -0
- package/views/dist/provider/ViewsProvider.d.ts +7 -1
- package/views/dist/provider/ViewsProvider.js +23 -3
- package/views/dist/provider/components.d.ts +30 -4
- package/views/dist/provider/moment.d.ts +6 -0
- package/views/dist/provider/moment.js +10 -0
- package/views/dist/styles.css +847 -52
- package/views/dist/styles.unlayered.css +848 -52
- package/views/docs/contract.md +15 -9
- package/views/docs/controls/alert-dialog.md +37 -0
- package/views/docs/controls/alert.md +30 -0
- package/views/docs/controls/collapsible.md +22 -0
- package/views/docs/controls/filter-editor.md +28 -0
- package/views/docs/controls/group-editor.md +11 -0
- package/views/docs/controls/modal.md +55 -0
- package/views/docs/controls/notice.md +32 -0
- package/views/docs/controls/pane.md +25 -0
- package/views/docs/controls/sort-editor.md +27 -0
- package/views/docs/controls/toast.md +32 -0
- package/views/docs/guides/cells.md +1 -1
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +19 -0
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +213 -7
- package/views/docs/reference/display.md +2 -2
- package/views/docs/reference/editors-relation.md +1 -1
- package/views/docs/reference/looks.md +10 -0
- package/views/docs/reference/panels-react.md +7 -6
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +7 -7
- package/views/docs/reference/views.md +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { gridCellKey, } from "./commit-model.js";
|
|
2
2
|
import { applyGridPending, carryGridPutBack, createGridHistory, gridEditValue, gridOverlayValue, gridHistoryValue, gridKeptValue, groupGridPendingByRow, groupGridPendingSettlement, keepGridPending, markGridPendingSettlement, planGridPendingAssignments, pressGridHistory, pruneGridEntry, pruneGridHistoryEntry, reconcileGridPending, recordGridHistory, revertGridHistoryPress, rollbackGridPending, } from "./editing-model.js";
|
|
3
3
|
import { setGridWriteStates } from "./write-states.js";
|
|
4
|
+
import { noteGridEdited } from "./undo-owner.js";
|
|
4
5
|
const confirmed = (outcome) => outcome ?? { status: "confirmed" };
|
|
5
6
|
export class GridEditingController {
|
|
6
7
|
callbacks;
|
|
@@ -38,6 +39,7 @@ export class GridEditingController {
|
|
|
38
39
|
commit(cells) {
|
|
39
40
|
if (cells.length === 0)
|
|
40
41
|
return Promise.resolve(true);
|
|
42
|
+
noteGridEdited(this);
|
|
41
43
|
const entry = {
|
|
42
44
|
id: this.nextHistoryId++,
|
|
43
45
|
edits: cells.map(({ cell }) => cell),
|
|
@@ -100,10 +102,16 @@ export class GridEditingController {
|
|
|
100
102
|
this.publishPending(next);
|
|
101
103
|
}
|
|
102
104
|
undo(resolveRow, onApply) {
|
|
103
|
-
|
|
105
|
+
const applied = this.canUndo() && this.enqueueApply("undo", resolveRow, onApply);
|
|
106
|
+
if (applied)
|
|
107
|
+
noteGridEdited(this);
|
|
108
|
+
return applied;
|
|
104
109
|
}
|
|
105
110
|
redo(resolveRow, onApply) {
|
|
106
|
-
|
|
111
|
+
const applied = this.canRedo() && this.enqueueApply("redo", resolveRow, onApply);
|
|
112
|
+
if (applied)
|
|
113
|
+
noteGridEdited(this);
|
|
114
|
+
return applied;
|
|
107
115
|
}
|
|
108
116
|
reportRefusals(cells, results) {
|
|
109
117
|
const failed = cells.flatMap(({ cell }, index) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gridCellKey } from "./commit-model.js";
|
|
1
|
+
import { gridCellFromKey, gridCellKey } from "./commit-model.js";
|
|
2
2
|
import { sameListValue } from "viewkitjs/fields";
|
|
3
3
|
import { markGridKeptValue } from "./value-equality.js";
|
|
4
4
|
const GRID_UNDO_MAX = 50;
|
|
@@ -139,9 +139,7 @@ export function reconcileGridPending(state, matchedKeys) {
|
|
|
139
139
|
export function groupGridPendingByRow(state) {
|
|
140
140
|
const byRow = new Map();
|
|
141
141
|
for (const [key, entry] of state) {
|
|
142
|
-
const
|
|
143
|
-
const rowId = key.slice(0, separator);
|
|
144
|
-
const columnId = key.slice(separator + 1);
|
|
142
|
+
const { rowId, columnId } = gridCellFromKey(key);
|
|
145
143
|
const existing = byRow.get(rowId);
|
|
146
144
|
if (existing)
|
|
147
145
|
existing[columnId] = entry.value;
|
|
@@ -155,9 +153,7 @@ export function groupGridPendingSettlement(state) {
|
|
|
155
153
|
for (const [key, entry] of state) {
|
|
156
154
|
if (!entry.settlement)
|
|
157
155
|
continue;
|
|
158
|
-
const
|
|
159
|
-
const rowId = key.slice(0, separator);
|
|
160
|
-
const columnId = key.slice(separator + 1);
|
|
156
|
+
const { rowId, columnId } = gridCellFromKey(key);
|
|
161
157
|
const existing = byRow.get(rowId);
|
|
162
158
|
if (existing)
|
|
163
159
|
existing[columnId] = entry.settlement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** This grid made an edit, an undo or a redo: it is now the page's newest. */
|
|
2
|
+
export declare function noteGridEdited(owner: object): void;
|
|
3
|
+
/** This grid left the page. */
|
|
4
|
+
export declare function forgetGridEdited(owner: object): void;
|
|
5
|
+
/** Whether this grid is the one the page edited last. */
|
|
6
|
+
export declare function isLastEditedGrid(owner: object): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const edited = [];
|
|
2
|
+
export function noteGridEdited(owner) {
|
|
3
|
+
forgetGridEdited(owner);
|
|
4
|
+
edited.push(owner);
|
|
5
|
+
}
|
|
6
|
+
export function forgetGridEdited(owner) {
|
|
7
|
+
const index = edited.indexOf(owner);
|
|
8
|
+
if (index >= 0)
|
|
9
|
+
edited.splice(index, 1);
|
|
10
|
+
}
|
|
11
|
+
export function isLastEditedGrid(owner) {
|
|
12
|
+
return edited.length > 0 && edited[edited.length - 1] === owner;
|
|
13
|
+
}
|
|
@@ -64,6 +64,8 @@ type GridEditingApi<Row> = {
|
|
|
64
64
|
columnId: string;
|
|
65
65
|
}[];
|
|
66
66
|
forgetSent: (rowId: string, columnId: string) => void;
|
|
67
|
+
/** This grid is the one the page edited last (`undo-owner.ts`): ⌘Z with the focus in no grid undoes here. */
|
|
68
|
+
isLastEdited: () => boolean;
|
|
67
69
|
};
|
|
68
70
|
export declare function useGridEditing<Row>(onCellCommit?: GridCellCommitFn<Row>, onCellsCommit?: GridCellsCommitFn<Row>,
|
|
69
71
|
/** Told once per write the app refused (`GridEditingCallbacks.onRefused`). */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { gridRowIdFromKey } from "./coordinates.js";
|
|
3
3
|
import { GridEditingController } from "./editing-controller.js";
|
|
4
|
+
import { forgetGridEdited, isLastEditedGrid } from "./undo-owner.js";
|
|
4
5
|
import { sameListValue } from "viewkitjs/fields";
|
|
5
6
|
import { prepareGridCommitCells, } from "./editing-model.js";
|
|
6
7
|
import { gridFigureOf } from "./clipboard-model.js";
|
|
@@ -14,6 +15,8 @@ export function useGridEditing(onCellCommit, onCellsCommit, onRefused, keepsSent
|
|
|
14
15
|
setPendingByRow(pending);
|
|
15
16
|
setSettlementByRow(settlement);
|
|
16
17
|
}, setWriteStateByRow));
|
|
18
|
+
useEffect(() => () => forgetGridEdited(controller), [controller]);
|
|
19
|
+
const isLastEdited = useCallback(() => isLastEditedGrid(controller), [controller]);
|
|
17
20
|
useEffect(() => {
|
|
18
21
|
const callbacks = { onCellCommit, onCellsCommit, onRefused, keepsSent };
|
|
19
22
|
controller.setCallbacks(callbacks);
|
|
@@ -101,5 +104,6 @@ export function useGridEditing(onCellCommit, onCellsCommit, onRefused, keepsSent
|
|
|
101
104
|
sent,
|
|
102
105
|
sentCells,
|
|
103
106
|
forgetSent,
|
|
107
|
+
isLastEdited,
|
|
104
108
|
};
|
|
105
109
|
}
|
|
@@ -27,7 +27,12 @@ export { LIST_LOOKS, type ListOptionId } from "../controls/list/looks.js";
|
|
|
27
27
|
export { PICKER_LOOKS, type PickerOptionId } from "../controls/picker/looks.js";
|
|
28
28
|
export { AVATAR_LOOKS, type AvatarLookOptionId } from "../controls/avatar/looks.js";
|
|
29
29
|
export { MENU_LIST_CARD_FRAME } from "../controls/menu-list/looks.js";
|
|
30
|
+
export { PANE_LOOKS, type PaneOptionId } from "../controls/pane/looks.js";
|
|
30
31
|
export { VIEWS_LIST_LOOKS, type ViewsListOptionId } from "../controls/views-list/looks.js";
|
|
32
|
+
export { MODAL_LOOKS, type ModalOptionId } from "../controls/modal/looks.js";
|
|
33
|
+
export { ALERT_DIALOG_LOOKS, type AlertDialogOptionId } from "../controls/alert-dialog/looks.js";
|
|
34
|
+
export { COLLAPSIBLE_LOOKS, type CollapsibleOptionId } from "../controls/collapsible/looks.js";
|
|
35
|
+
export { ALERT_LOOKS, type AlertOptionId } from "../controls/alert/looks.js";
|
|
31
36
|
export { TEXT_EDITOR_LOOKS, type TextEditorLookOptionId } from "../controls/text-editor/looks.js";
|
|
32
37
|
export { DATE_EDITOR_LOOKS, type DateEditorLookOptionId } from "../controls/date-editor/looks.js";
|
|
33
38
|
export { COMPOUND_EDITOR_LOOKS, type CompoundEditorOptionId } from "../controls/compound-editor/looks.js";
|
|
@@ -23,7 +23,12 @@ export { LIST_LOOKS } from "../controls/list/looks.js";
|
|
|
23
23
|
export { PICKER_LOOKS } from "../controls/picker/looks.js";
|
|
24
24
|
export { AVATAR_LOOKS } from "../controls/avatar/looks.js";
|
|
25
25
|
export { MENU_LIST_CARD_FRAME } from "../controls/menu-list/looks.js";
|
|
26
|
+
export { PANE_LOOKS } from "../controls/pane/looks.js";
|
|
26
27
|
export { VIEWS_LIST_LOOKS } from "../controls/views-list/looks.js";
|
|
28
|
+
export { MODAL_LOOKS } from "../controls/modal/looks.js";
|
|
29
|
+
export { ALERT_DIALOG_LOOKS } from "../controls/alert-dialog/looks.js";
|
|
30
|
+
export { COLLAPSIBLE_LOOKS } from "../controls/collapsible/looks.js";
|
|
31
|
+
export { ALERT_LOOKS } from "../controls/alert/looks.js";
|
|
27
32
|
export { TEXT_EDITOR_LOOKS } from "../controls/text-editor/looks.js";
|
|
28
33
|
export { DATE_EDITOR_LOOKS } from "../controls/date-editor/looks.js";
|
|
29
34
|
export { COMPOUND_EDITOR_LOOKS } from "../controls/compound-editor/looks.js";
|
|
@@ -20,7 +20,12 @@ import { MENU_LIST_LOOKS } from "../controls/menu-list/looks.js";
|
|
|
20
20
|
import { AVATAR_LOOKS } from "../controls/avatar/looks.js";
|
|
21
21
|
import { LIST_LOOKS } from "../controls/list/looks.js";
|
|
22
22
|
import { PICKER_LOOKS } from "../controls/picker/looks.js";
|
|
23
|
+
import { PANE_LOOKS } from "../controls/pane/looks.js";
|
|
23
24
|
import { VIEWS_LIST_LOOKS } from "../controls/views-list/looks.js";
|
|
25
|
+
import { MODAL_LOOKS } from "../controls/modal/looks.js";
|
|
26
|
+
import { ALERT_DIALOG_LOOKS } from "../controls/alert-dialog/looks.js";
|
|
27
|
+
import { COLLAPSIBLE_LOOKS } from "../controls/collapsible/looks.js";
|
|
28
|
+
import { ALERT_LOOKS } from "../controls/alert/looks.js";
|
|
24
29
|
import { TEXT_EDITOR_LOOKS } from "../controls/text-editor/looks.js";
|
|
25
30
|
import { DATE_EDITOR_LOOKS } from "../controls/date-editor/looks.js";
|
|
26
31
|
import { COMPOUND_EDITOR_LOOKS } from "../controls/compound-editor/looks.js";
|
|
@@ -49,7 +54,12 @@ export const LOOKS = [
|
|
|
49
54
|
LIST_LOOKS,
|
|
50
55
|
PICKER_LOOKS,
|
|
51
56
|
AVATAR_LOOKS,
|
|
57
|
+
PANE_LOOKS,
|
|
52
58
|
VIEWS_LIST_LOOKS,
|
|
59
|
+
MODAL_LOOKS,
|
|
60
|
+
ALERT_DIALOG_LOOKS,
|
|
61
|
+
COLLAPSIBLE_LOOKS,
|
|
62
|
+
ALERT_LOOKS,
|
|
53
63
|
TEXT_EDITOR_LOOKS,
|
|
54
64
|
DATE_EDITOR_LOOKS,
|
|
55
65
|
COMPOUND_EDITOR_LOOKS,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { FieldType } from "viewkitjs/fields";
|
|
3
3
|
import type { BucketOrderMode, FilterRule, FilterTree, SetAsideReason, SortDirection } from "viewkitjs/fields/query";
|
|
4
|
+
import type { ViewsPickerItem } from "../provider/components.js";
|
|
4
5
|
import { type OrderChoice } from "../grouping/sort-groups.js";
|
|
5
6
|
import type { FieldMark } from "../model/column-mark.js";
|
|
6
7
|
import type { ListColumnItem, ListColumnsConfig } from "../model/column-state.js";
|
|
@@ -104,6 +105,9 @@ export type FilterTreeConfig = {
|
|
|
104
105
|
* read from `rule` and each change handed to `write` as the rule with its new value; null for a rule no body
|
|
105
106
|
* edits (a set-aside rule, an operator taking no value). `relation`: the relation's field key, for a far rule. */
|
|
106
107
|
valueOf: (rule: FilterRule, write: (next: FilterRule) => void, relation?: string) => FilterConfig<string> | null;
|
|
108
|
+
/** A choice field's values as the Picker draws them, where they are known as the list opens; undefined where they are read on
|
|
109
|
+
* demand or the field is no choice. `relation`: the relation's field key, for a far field. */
|
|
110
|
+
optionsOf?: (fieldKey: string, part?: string, relation?: string) => readonly ViewsPickerItem[] | undefined;
|
|
107
111
|
label?: string;
|
|
108
112
|
};
|
|
109
113
|
type GroupGranularity = {
|
|
@@ -128,12 +132,13 @@ export type GroupDimension<D extends string = string> = {
|
|
|
128
132
|
defaultGranularity?: string;
|
|
129
133
|
};
|
|
130
134
|
/** One group as the Group panel lists it (POR-498). `empty`: hidden only by
|
|
131
|
-
* Hide empty groups; `hidden`: the reader hid it. */
|
|
135
|
+
* Hide empty groups; `hidden`: the reader hid it; `count`: how many records it holds, where the list counts them. */
|
|
132
136
|
export type GroupListEntry = {
|
|
133
137
|
key: string;
|
|
134
138
|
label: string;
|
|
135
139
|
empty: boolean;
|
|
136
140
|
hidden: boolean;
|
|
141
|
+
count?: number;
|
|
137
142
|
};
|
|
138
143
|
export type GroupConfig<D extends string = string> = {
|
|
139
144
|
dimensions: GroupDimension<D>[];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import type { ViewsBodyStep } from "../../provider/components.js";
|
|
2
3
|
import type { GroupConfig } from "../model.js";
|
|
3
4
|
import type { ViewOptionsPanelContentProps } from "./customize.js";
|
|
4
5
|
/** The app's `GroupBody` over a group: inside Customize, whose head holds the ✕, it gets no `actions`; its `onDone`
|
|
5
|
-
* goes back to Customize's list. Null without the slot. */
|
|
6
|
-
export declare function AppGroupBody({ group, form, onDone, }: {
|
|
6
|
+
* goes back to Customize's list, and the level it tells (`onStepChange`) heads Customize. Null without the slot. */
|
|
7
|
+
export declare function AppGroupBody({ group, form, onDone, onStepChange, }: {
|
|
7
8
|
group: GroupConfig;
|
|
8
9
|
form: "computer" | "phone";
|
|
9
10
|
onDone: () => void;
|
|
11
|
+
onStepChange?: (step: ViewsBodyStep | null) => void;
|
|
10
12
|
}): ReactNode;
|
|
11
13
|
/** The app's `CustomizeBody` over Customize's own props: the view's settings as data, the page mapped onto the body's,
|
|
12
14
|
* the ✕ on a phone only where the sheet's head doesn't draw it. Null without the slot. */
|
|
@@ -7,19 +7,19 @@ import { filterBodyChangeFits, takesValue } from "../settings/filter-groups.js";
|
|
|
7
7
|
import { sortBodyOptions } from "../sort-body-options.js";
|
|
8
8
|
import { filterBodyFields } from "./filter/filter-body.js";
|
|
9
9
|
import { FilterValueBody } from "./filter/FilterValueBody.js";
|
|
10
|
-
export function AppGroupBody({ group, form, onDone, }) {
|
|
10
|
+
export function AppGroupBody({ group, form, onDone, onStepChange, }) {
|
|
11
11
|
const { components, messages } = useViews();
|
|
12
12
|
const GroupBody = components.GroupBody;
|
|
13
13
|
if (!GroupBody)
|
|
14
14
|
return null;
|
|
15
|
-
return _jsx(GroupBody, { ...groupBodyProps(group, messages), form: form, onDone: onDone });
|
|
15
|
+
return _jsx(GroupBody, { ...groupBodyProps(group, messages), form: form, onDone: onDone, ...(onStepChange && { onStepChange }) });
|
|
16
16
|
}
|
|
17
17
|
function customizeFilterOf(filterTree, messages) {
|
|
18
18
|
const level = { op: filterTree.tree.op, items: filterTree.tree.items };
|
|
19
19
|
const levels = FILTER_TREE_MAX_UI_DEPTH;
|
|
20
20
|
return {
|
|
21
21
|
label: filterTree.label ?? messages({ key: "views.panels.filter" }),
|
|
22
|
-
fields: filterBodyFields(filterTree.fields),
|
|
22
|
+
fields: filterBodyFields(filterTree.fields, filterTree.optionsOf),
|
|
23
23
|
filter: level,
|
|
24
24
|
levels,
|
|
25
25
|
excludable: false,
|
|
@@ -15,6 +15,7 @@ import { CompactLayoutDetail } from "./layout-detail.js";
|
|
|
15
15
|
import { LayoutColumnsList } from "./LayoutColumnsList.js";
|
|
16
16
|
import { PanelHeader } from "./panel-header.js";
|
|
17
17
|
import { useSheetPanels } from "./panel-sheet.js";
|
|
18
|
+
import { usePanelStep } from "./panel-step.js";
|
|
18
19
|
import { CompactGroupByDetail, CompactGroupDateByDetail, CompactGroupDetail, CompactGroupSortDetail, CompactSortDetail, } from "./order-details.js";
|
|
19
20
|
import { PopoverColumnDetail } from "./PopoverColumnDetail.js";
|
|
20
21
|
import { PopoverRootList } from "./root-list.js";
|
|
@@ -24,6 +25,7 @@ export function ViewOptionsPanelContent(props) {
|
|
|
24
25
|
const views = useViews();
|
|
25
26
|
const { messages } = views;
|
|
26
27
|
const sheet = useSheetPanels();
|
|
28
|
+
const groupStep = usePanelStep();
|
|
27
29
|
const [backHandler, setBackHandlerRaw] = useState(null);
|
|
28
30
|
const setBackHandler = useCallback((fn) => {
|
|
29
31
|
setBackHandlerRaw(fn ? { fn } : null);
|
|
@@ -100,7 +102,7 @@ export function ViewOptionsPanelContent(props) {
|
|
|
100
102
|
: (activePanel?.type ?? "root");
|
|
101
103
|
if (views.components.CustomizeBody && !perFieldFiltersOnly(props))
|
|
102
104
|
return _jsx(AppCustomizeBody, { ...props, form: sheet ? "phone" : "computer" });
|
|
103
|
-
return (_jsxs("div", { className: cx("flex flex-col", fill && "h-full min-h-0"), children: [_jsx(PanelHeader, { title: activePanel ? panelTitle : messages({ key: "views.panels.customize-title" }), onBack: activePanel ? onBackClick : undefined, onClose: closeButton ? onClose : undefined, trailing: !activePanel &&
|
|
105
|
+
return (_jsxs("div", { className: cx("flex flex-col", fill && "h-full min-h-0"), children: [_jsx(PanelHeader, { title: activePanel ? (groupStep.title ?? panelTitle) : messages({ key: "views.panels.customize-title" }), onBack: activePanel ? (groupStep.back ?? onBackClick) : undefined, onClose: closeButton ? onClose : undefined, trailing: !activePanel &&
|
|
104
106
|
!view &&
|
|
105
107
|
anyActive && (drawPanelButton(views, {
|
|
106
108
|
own: "shrink-0 text-xs text-(color:--vk-fg-brand) transition-colors",
|
|
@@ -109,5 +111,5 @@ export function ViewOptionsPanelContent(props) {
|
|
|
109
111
|
size: "sm",
|
|
110
112
|
onClick: clearAll,
|
|
111
113
|
children: messages({ key: "views.panels.clear-all" }),
|
|
112
|
-
})) }), _jsx("div", { className: cx("animate-in fade-in-0 slide-in-from-right-2 duration-(--vk-duration,150ms)", fill && "flex-1 min-h-0 overflow-y-auto overscroll-contain **:data-vs-detail:max-h-none"), children: activePanel?.type === "layout" && layout ? (_jsx(CompactLayoutDetail, { layout: layout })) : views.components.GroupBody && group && customizePageOf(activePanel) === "group" ? (_jsx(AppGroupBody, { group: group, form: sheet ? "phone" : "computer", onDone: () => onOpenPanel(null) })) : activePanel?.type === "group" && group ? (_jsx(CompactGroupDetail, { group: group, onOpenPanel: onOpenPanel })) : activePanel?.type === "groupBy" && group ? (_jsx(CompactGroupByDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "groupSort" && group ? (_jsx(CompactGroupSortDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "groupDateBy" && group ? (_jsx(CompactGroupDateByDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "sort" && sort ? (_jsx(CompactSortDetail, { sort: sort })) : activePanel?.type === "timeScope" && timeScopeConfig ? (_jsx(CompactTimeScopeDetail, { timeScopeConfig: timeScopeConfig, onBack: () => onOpenPanel(null), registerBackHandler: setBackHandler })) : activeDateRange ? (_jsx(CompactDateRangeDetail, { dateRangeConfig: activeDateRange })) : activeToggle ? (_jsx(CompactToggleDetail, { toggle: activeToggle, onBack: () => onOpenPanel(null) })) : activeField ? (_jsx(CompactFilterDetail, { filter: activeField })) : activeFilter ? (_jsx(CompactFilterDetail, { filter: activeFilter, onOpenField: (field) => onOpenPanel({ type: "filter", key: activeFilter.key, field }), onConverted: sheet ? undefined : () => onOpenPanel({ type: "filters" }) })) : activePanel?.type === "columns" && layout?.columns ? (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: _jsx(LayoutColumnsList, { columns: layout.columns, showNewLine: !!layout.columns.newLine?.views.includes(layout.value), onOpenColumn: (id) => onOpenPanel({ type: "column", key: id }), fieldEditor: fieldEditor }) })) : activeColumn && layout?.columns ? (_jsx(PopoverColumnDetail, { column: activeColumn, columns: layout.columns, onDone: onClose ?? (() => onOpenPanel({ type: "columns" })), fieldEditor: fieldEditor })) : activePanel?.type === "filters" ? (_jsx(CompactFilterList, { filters: filters, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, onOpenPanel: onOpenPanel })) : (_jsx(PopoverRootList, { filters: filters, sort: sort, group: group, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, toggles: toggles, layout: layout, onOpenPanel: onOpenPanel, foldFilters: foldFilters })) }, panelKey), !activePanel && viewFoot !== "none" && (view || footClear) && (_jsx(ViewFooter, { view: view, onClear: view ? undefined : footClear, words: viewFoot === "kit" ? "kit" : undefined }))] }));
|
|
114
|
+
})) }), _jsx("div", { className: cx("animate-in fade-in-0 slide-in-from-right-2 duration-(--vk-duration,150ms)", fill && "flex-1 min-h-0 overflow-y-auto overscroll-contain **:data-vs-detail:max-h-none"), children: activePanel?.type === "layout" && layout ? (_jsx(CompactLayoutDetail, { layout: layout })) : views.components.GroupBody && group && customizePageOf(activePanel) === "group" ? (_jsx(AppGroupBody, { group: group, form: sheet ? "phone" : "computer", onDone: () => onOpenPanel(null), onStepChange: groupStep.onStepChange })) : activePanel?.type === "group" && group ? (_jsx(CompactGroupDetail, { group: group, onOpenPanel: onOpenPanel })) : activePanel?.type === "groupBy" && group ? (_jsx(CompactGroupByDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "groupSort" && group ? (_jsx(CompactGroupSortDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "groupDateBy" && group ? (_jsx(CompactGroupDateByDetail, { group: group, onBack: () => onOpenPanel({ type: "group" }) })) : activePanel?.type === "sort" && sort ? (_jsx(CompactSortDetail, { sort: sort })) : activePanel?.type === "timeScope" && timeScopeConfig ? (_jsx(CompactTimeScopeDetail, { timeScopeConfig: timeScopeConfig, onBack: () => onOpenPanel(null), registerBackHandler: setBackHandler })) : activeDateRange ? (_jsx(CompactDateRangeDetail, { dateRangeConfig: activeDateRange })) : activeToggle ? (_jsx(CompactToggleDetail, { toggle: activeToggle, onBack: () => onOpenPanel(null) })) : activeField ? (_jsx(CompactFilterDetail, { filter: activeField })) : activeFilter ? (_jsx(CompactFilterDetail, { filter: activeFilter, onOpenField: (field) => onOpenPanel({ type: "filter", key: activeFilter.key, field }), onConverted: sheet ? undefined : () => onOpenPanel({ type: "filters" }) })) : activePanel?.type === "columns" && layout?.columns ? (_jsx("div", { "data-vs-detail": true, className: cx("max-h-96", PANEL_LIST_CLASS), children: _jsx(LayoutColumnsList, { columns: layout.columns, showNewLine: !!layout.columns.newLine?.views.includes(layout.value), onOpenColumn: (id) => onOpenPanel({ type: "column", key: id }), fieldEditor: fieldEditor }) })) : activeColumn && layout?.columns ? (_jsx(PopoverColumnDetail, { column: activeColumn, columns: layout.columns, onDone: onClose ?? (() => onOpenPanel({ type: "columns" })), fieldEditor: fieldEditor })) : activePanel?.type === "filters" ? (_jsx(CompactFilterList, { filters: filters, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, onOpenPanel: onOpenPanel })) : (_jsx(PopoverRootList, { filters: filters, sort: sort, group: group, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, toggles: toggles, layout: layout, onOpenPanel: onOpenPanel, foldFilters: foldFilters })) }, panelKey), !activePanel && viewFoot !== "none" && (view || footClear) && (_jsx(ViewFooter, { view: view, onClear: view ? undefined : footClear, words: viewFoot === "kit" ? "kit" : undefined }))] }));
|
|
113
115
|
}
|
|
@@ -254,7 +254,7 @@ function RuleRow({ ctx, rule, rel, relation, inPending, }) {
|
|
|
254
254
|
return (_jsxs("div", { "data-slot": "vk-filter-rule", className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: [_jsxs(Button, { ref: fieldBox, variant: "outline", size: "sm", "aria-label": `${messages({ key: "views.panels.filter-field" })}: ${name}`, "aria-haspopup": "dialog", ...box(opens === "field"), onClick: () => setOpens(opens === "field" ? null : "field"), children: [_jsx("span", { className: "truncate", children: name }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx(Popover, { open: opens === "field", onOpenChange: (next) => setOpens(next ? "field" : null), anchor: fieldBox, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(FilterFieldList, { fields: fields, own: field.key, relations: false, onPick: (picked) => {
|
|
255
255
|
setOpens(null);
|
|
256
256
|
pickField(ctx, ruleAtHere, rule, field, picked);
|
|
257
|
-
}, onDone: () => setOpens(null) }) }), _jsxs(Button, { ref: wayBox, variant: "outline", size: "sm", "aria-label": `${messages({ key: "views.panels.filter-way" })}: ${wayWords}`, "aria-haspopup": partBody ? "dialog" : "menu", ...box(opens === "way"), onClick: () => setOpens(opens === "way" ? null : "way"), children: [_jsx("span", { className: "truncate", children: wayWords }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), partBody ? (_jsx(Popover, { open: opens === "way", onOpenChange: (next) => setOpens(next ? "way" : null), anchor: wayBox, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, own: null, form: "computer", onWay: (operator) => {
|
|
257
|
+
}, onDone: () => setOpens(null) }) }), _jsxs(Button, { ref: wayBox, variant: "outline", size: "sm", "aria-label": `${messages({ key: "views.panels.filter-way" })}: ${wayWords}`, "aria-haspopup": partBody ? "dialog" : "menu", ...box(opens === "way"), onClick: () => setOpens(opens === "way" ? null : "way"), children: [_jsx("span", { className: "truncate", children: wayWords }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), partBody ? (_jsx(Popover, { open: opens === "way", onOpenChange: (next) => setOpens(next ? "way" : null), anchor: wayBox, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: null, form: "computer", onWay: (operator) => {
|
|
258
258
|
setOpens(null);
|
|
259
259
|
pickWay(ctx, ruleAtHere, rule, field, operator);
|
|
260
260
|
}, onValue: write, onDone: () => setOpens(null) }) })) : (_jsx(Menu, { open: opens === "way", onOpenChange: (next) => setOpens(next ? "way" : null), anchor: wayBox, align: "start", label: messages({ key: "views.panels.filter-way" }), items: ways.map((way) => ({
|
|
@@ -266,7 +266,7 @@ function RuleRow({ ctx, rule, rel, relation, inPending, }) {
|
|
|
266
266
|
setOpens(null);
|
|
267
267
|
pickWay(ctx, ruleAtHere, rule, field, way.value);
|
|
268
268
|
},
|
|
269
|
-
})) })), config && (_jsxs(_Fragment, { children: [_jsxs(Button, { ref: valueBox, variant: "outline", size: "sm", "aria-label": `${messages({ key: "views.panels.filter-value" })}: ${valueWords}`, "aria-haspopup": "dialog", ...box(opens === "value"), onClick: () => setOpens(opens === "value" ? null : "value"), children: [_jsx("span", { className: "truncate", children: valueWords }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx(Popover, { open: opens === "value", onOpenChange: (next) => setOpens(next ? "value" : null), anchor: valueBox, align: "start", sideOffset: 4, chrome: "menu", initialFocus: false, children: partBody ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, own: _jsx(FilterValueBody, { filter: config }), form: "computer", onWay: (operator) => pickWay(ctx, ruleAtHere, rule, field, operator), onValue: write, onDone: () => setOpens(null) })) : (_jsx(FilterValueBody, { filter: config })) })] })), _jsx(RuleMenu, { ctx: ctx, rel: rel, name: name, anchor: moreBox, open: opens === "more", setOpen: (o) => setOpens(o ? "more" : null), grouping: grouping, className: "ml-auto" })] }));
|
|
269
|
+
})) })), config && (_jsxs(_Fragment, { children: [_jsxs(Button, { ref: valueBox, variant: "outline", size: "sm", "aria-label": `${messages({ key: "views.panels.filter-value" })}: ${valueWords}`, "aria-haspopup": "dialog", ...box(opens === "value"), onClick: () => setOpens(opens === "value" ? null : "value"), children: [_jsx("span", { className: "truncate", children: valueWords }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx(Popover, { open: opens === "value", onOpenChange: (next) => setOpens(next ? "value" : null), anchor: valueBox, align: "start", sideOffset: 4, chrome: "menu", initialFocus: false, children: partBody ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: _jsx(FilterValueBody, { filter: config }), form: "computer", onWay: (operator) => pickWay(ctx, ruleAtHere, rule, field, operator), onValue: write, onDone: () => setOpens(null) })) : (_jsx(FilterValueBody, { filter: config })) })] })), _jsx(RuleMenu, { ctx: ctx, rel: rel, name: name, anchor: moreBox, open: opens === "more", setOpen: (o) => setOpens(o ? "more" : null), grouping: grouping, className: "ml-auto" })] }));
|
|
270
270
|
}
|
|
271
271
|
function RuleMenu({ ctx, rel, name, anchor, open, setOpen, grouping, className, why, putBack, }) {
|
|
272
272
|
const { components, icons, messages } = useViews();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { ViewsSheetActions } from "../../../provider/components.js";
|
|
2
|
+
import type { ViewsFilterBodyProps, ViewsSheetActions } from "../../../provider/components.js";
|
|
3
3
|
import type { FilterTreeConfig } from "../../model.js";
|
|
4
4
|
/** The filter editor's ✕ and ✓ for a phone's sheet, and its body (told whether it draws its own ✕ and ✓). */
|
|
5
5
|
export declare function usePhoneFilterEditor(o: {
|
|
@@ -11,12 +11,18 @@ export declare function usePhoneFilterEditor(o: {
|
|
|
11
11
|
}): {
|
|
12
12
|
body: (closeButton?: boolean) => ReactNode;
|
|
13
13
|
head: ViewsSheetActions;
|
|
14
|
+
/** An app's body's step (VK-720), for the sheet's title while it stands. */
|
|
15
|
+
title: string | undefined;
|
|
16
|
+
/** The sheet's Escape: goes back a step where one stands. Whether it is spent. */
|
|
17
|
+
escapeBack: () => boolean;
|
|
14
18
|
};
|
|
15
19
|
/** The phone's body: the rules, or one box's list in their place. */
|
|
16
|
-
export declare function PhoneFilterEditor({ filterTree, head, onDone, }: {
|
|
20
|
+
export declare function PhoneFilterEditor({ filterTree, head, onDone, onStepChange, }: {
|
|
17
21
|
filterTree: FilterTreeConfig;
|
|
18
22
|
/** The ✕ and ✓ the body draws in its own head, where the sheet's head draws none; null where it does. */
|
|
19
23
|
head: ViewsSheetActions | null;
|
|
20
24
|
/** The job is done and what holds it closes: an app's own `FilterBody` calls it. */
|
|
21
25
|
onDone?: () => void;
|
|
26
|
+
/** An app's own `FilterBody`'s step, told to the sheet (VK-720). */
|
|
27
|
+
onStepChange?: ViewsFilterBodyProps["onStepChange"];
|
|
22
28
|
}): ReactNode;
|
|
@@ -8,6 +8,7 @@ import { filterWaysOf, takesValue } from "../../settings/filter-groups.js";
|
|
|
8
8
|
import { PanelHeader } from "../panel-header.js";
|
|
9
9
|
import { fieldOfRule, relationOf, useEditorCtx, } from "./editor-ctx.js";
|
|
10
10
|
import { AppFilterBody } from "./filter-body.js";
|
|
11
|
+
import { usePanelStep } from "../panel-step.js";
|
|
11
12
|
import { Excluded, Level } from "./FilterEditor.js";
|
|
12
13
|
import { FilterFieldList } from "./FilterFieldList.js";
|
|
13
14
|
import { AppFilterPart, useFilterPartBody } from "./filter-part-body.js";
|
|
@@ -16,6 +17,7 @@ import { addPicked, addState, everyBlocked, pickField, pickQuantifier, pickWay,
|
|
|
16
17
|
export function usePhoneFilterEditor(o) {
|
|
17
18
|
const { filterTree, open, onDone } = o;
|
|
18
19
|
const { messages } = useViews();
|
|
20
|
+
const step = usePanelStep();
|
|
19
21
|
const latest = useRef(filterTree.tree);
|
|
20
22
|
useLayoutEffect(() => {
|
|
21
23
|
latest.current = filterTree.tree;
|
|
@@ -48,11 +50,12 @@ export function usePhoneFilterEditor(o) {
|
|
|
48
50
|
},
|
|
49
51
|
},
|
|
50
52
|
done: { label: messages({ key: "views.panels.filter-done" }), onPress: () => onDone?.() },
|
|
53
|
+
...(step.back && { back: { label: messages({ key: "views.panels.back" }), onPress: step.back } }),
|
|
51
54
|
};
|
|
52
|
-
const body = (closeButton = true) => (_jsx(PhoneFilterEditor, { filterTree: tracked, head: closeButton ? head : null, onDone: onDone }));
|
|
53
|
-
return { body, head };
|
|
55
|
+
const body = (closeButton = true) => (_jsx(PhoneFilterEditor, { filterTree: tracked, head: closeButton ? head : null, onDone: onDone, onStepChange: step.onStepChange }));
|
|
56
|
+
return { body, head, title: step.title, escapeBack: step.escapeBack };
|
|
54
57
|
}
|
|
55
|
-
export function PhoneFilterEditor({ filterTree, head, onDone, }) {
|
|
58
|
+
export function PhoneFilterEditor({ filterTree, head, onDone, onStepChange, }) {
|
|
56
59
|
const { components, icons, messages } = useViews();
|
|
57
60
|
const { Button } = components;
|
|
58
61
|
const [page, setPage] = useState({ to: "rules" });
|
|
@@ -64,7 +67,7 @@ export function PhoneFilterEditor({ filterTree, head, onDone, }) {
|
|
|
64
67
|
openPage: setPage,
|
|
65
68
|
});
|
|
66
69
|
if (components.FilterBody)
|
|
67
|
-
return group ? (_jsx(AppFilterBody, { ctx: ctx, level: group, relation: null, excludable: false, label: filterTree.label ?? messages({ key: "views.panels.filter" }), onDone: onDone, actions: head ?? undefined })) : null;
|
|
70
|
+
return group ? (_jsx(AppFilterBody, { ctx: ctx, level: group, relation: null, excludable: false, label: filterTree.label ?? messages({ key: "views.panels.filter" }), onDone: onDone, actions: head ?? undefined, onStepChange: onStepChange })) : null;
|
|
68
71
|
const back = () => setPage({ to: "rules" });
|
|
69
72
|
if (!pageResolves(ctx, page))
|
|
70
73
|
setPage({ to: "rules" });
|
|
@@ -140,7 +143,7 @@ function Turned({ ctx, page, setPage, back, }) {
|
|
|
140
143
|
};
|
|
141
144
|
if (page.to === "way") {
|
|
142
145
|
const ways = filterWaysOf(field, conventions);
|
|
143
|
-
return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: messages({ key: "views.panels.filter-way" }), onBack: back }), _jsxs("div", { className: scroll, children: [partBody ? (_jsx(AppFilterPart, { part: "way", rule: rule, field: field, own: null, form: "phone", onWay: (operator) => {
|
|
146
|
+
return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: messages({ key: "views.panels.filter-way" }), onBack: back }), _jsxs("div", { className: scroll, children: [partBody ? (_jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, at.relation?.fieldKey), own: null, form: "phone", onWay: (operator) => {
|
|
144
147
|
pickWay(ctx, at, rule, field, operator);
|
|
145
148
|
back();
|
|
146
149
|
}, onValue: write, onDone: back })) : null, partBody ? null : ways.map((way) => (_jsxs("div", { children: [way.value === "is_empty" && (_jsx("div", { role: "separator", className: "my-1 border-t border-solid border-(color:--vk-border)" })), _jsx(RadioRow, { mark: "box", selected: way.value === rule.operator, label: way.label, onClick: () => {
|
|
@@ -153,7 +156,7 @@ function Turned({ ctx, page, setPage, back, }) {
|
|
|
153
156
|
: null;
|
|
154
157
|
if (!config)
|
|
155
158
|
return null;
|
|
156
|
-
return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: field.label, onBack: back }), _jsx("div", { className: scroll, children: partBody ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, own: _jsx(FilterValueBody, { filter: config }), form: "phone", onWay: (operator) => {
|
|
159
|
+
return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: field.label, onBack: back }), _jsx("div", { className: scroll, children: partBody ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, at.relation?.fieldKey), own: _jsx(FilterValueBody, { filter: config }), form: "phone", onWay: (operator) => {
|
|
157
160
|
pickWay(ctx, at, rule, field, operator);
|
|
158
161
|
if (!at.rel)
|
|
159
162
|
back();
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type FilterGroup, type FilterRelationRule } from "viewkitjs/fields/query";
|
|
3
|
-
import type { ViewsFilterBodyField, ViewsSheetActions } from "../../../provider/components.js";
|
|
4
|
-
import type { FilterEditorField } from "../../model.js";
|
|
3
|
+
import type { ViewsFilterBodyField, ViewsFilterBodyProps, ViewsSheetActions } from "../../../provider/components.js";
|
|
4
|
+
import type { FilterEditorField, FilterTreeConfig } from "../../model.js";
|
|
5
5
|
import { type Ctx } from "./editor-ctx.js";
|
|
6
6
|
/** The fields as an app's body is handed them: each without its `mark` (the field lists' own, `FieldsBody`), its far
|
|
7
|
-
* fields the same, so `ViewsFilterBodyField` stays what it says
|
|
8
|
-
|
|
7
|
+
* fields the same, so `ViewsFilterBodyField` stays what it says; each choice field with its values where ViewKit holds them
|
|
8
|
+
* (`optionsOf`, VK-720), a far field's by its relation. */
|
|
9
|
+
export declare function filterBodyFields(fields: readonly FilterEditorField[], optionsOf?: FilterTreeConfig["optionsOf"], relation?: string): ViewsFilterBodyField[];
|
|
9
10
|
/** The app's `FilterBody` over the editor's state: `level` the container it stands on, `relation` the relation rule
|
|
10
11
|
* edited in place whose where it is. */
|
|
11
|
-
export declare function AppFilterBody({ ctx, level, relation, excludable, label, onDone, actions, }: {
|
|
12
|
+
export declare function AppFilterBody({ ctx, level, relation, excludable, label, onDone, actions, onStepChange, }: {
|
|
12
13
|
ctx: Ctx;
|
|
13
14
|
level: FilterGroup;
|
|
14
15
|
relation: FilterRelationRule | null;
|
|
@@ -16,4 +17,6 @@ export declare function AppFilterBody({ ctx, level, relation, excludable, label,
|
|
|
16
17
|
label: string;
|
|
17
18
|
onDone?: () => void;
|
|
18
19
|
actions?: ViewsSheetActions;
|
|
20
|
+
/** On a phone, the body's own step told to the sheet (`usePanelStep`). */
|
|
21
|
+
onStepChange?: ViewsFilterBodyProps["onStepChange"];
|
|
19
22
|
}): ReactNode;
|
|
@@ -5,6 +5,7 @@ import { FILTER_TREE_MAX_UI_DEPTH, isRelationRule, } from "viewkitjs/fields/quer
|
|
|
5
5
|
import { nodeAt, replaceAt, shownRuleCount } from "../../../filters/filter-tree.js";
|
|
6
6
|
import { useViews } from "../../../provider/context.js";
|
|
7
7
|
import { filterBodyChangeFits, takesValue } from "../../settings/filter-groups.js";
|
|
8
|
+
import { asideFilterWords, barFilterWords } from "../../toolbar/filter-words.js";
|
|
8
9
|
import { relationOf } from "./editor-ctx.js";
|
|
9
10
|
import { FilterValueBody } from "./FilterValueBody.js";
|
|
10
11
|
const QUANTIFIERS = ["any", "none", "every"];
|
|
@@ -22,13 +23,18 @@ function putLevel(tree, at, next, quantifier) {
|
|
|
22
23
|
});
|
|
23
24
|
return replaceAt(tree, at, { op: next.op, items });
|
|
24
25
|
}
|
|
25
|
-
export function filterBodyFields(fields) {
|
|
26
|
-
return fields.map(({ mark: _mark, far, ...field }) =>
|
|
26
|
+
export function filterBodyFields(fields, optionsOf, relation) {
|
|
27
|
+
return fields.map(({ mark: _mark, far, ...field }) => {
|
|
28
|
+
if (far)
|
|
29
|
+
return { ...field, far: filterBodyFields(far, optionsOf, field.fieldKey) };
|
|
30
|
+
const options = optionsOf?.(field.fieldKey, field.part, relation);
|
|
31
|
+
return options ? { ...field, options } : field;
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
|
-
export function AppFilterBody({ ctx, level, relation, excludable, label, onDone, actions, }) {
|
|
29
|
-
const { components, messages } = useViews();
|
|
34
|
+
export function AppFilterBody({ ctx, level, relation, excludable, label, onDone, actions, onStepChange, }) {
|
|
35
|
+
const { components, conventions, messages } = useViews();
|
|
30
36
|
const FilterBody = components.FilterBody;
|
|
31
|
-
const fields = useMemo(() => filterBodyFields(ctx.filterTree.fields), [ctx.filterTree.fields]);
|
|
37
|
+
const fields = useMemo(() => filterBodyFields(ctx.filterTree.fields, ctx.filterTree.optionsOf), [ctx.filterTree.fields, ctx.filterTree.optionsOf]);
|
|
32
38
|
if (!FilterBody)
|
|
33
39
|
return null;
|
|
34
40
|
const far = relation ? relationOf(ctx, relation.fieldKey) : undefined;
|
|
@@ -59,6 +65,11 @@ export function AppFilterBody({ ctx, level, relation, excludable, label, onDone,
|
|
|
59
65
|
const config = ctx.filterTree.valueOf(rule, onRuleChange, at);
|
|
60
66
|
return config ? _jsx(FilterValueBody, { filter: config }) : null;
|
|
61
67
|
};
|
|
68
|
+
const ruleWords = (rule, at) => {
|
|
69
|
+
const node = at !== undefined ? { fieldKey: at, quantifier: "any", where: { op: "and", items: [rule] } } : rule;
|
|
70
|
+
const words = rule.setAside ? asideFilterWords(rule, ctx.filterTree, conventions, messages, at) : barFilterWords({ kind: "held", node }, ctx.filterTree, conventions, messages);
|
|
71
|
+
return { field: words.field, way: words.way, value: words.value };
|
|
72
|
+
};
|
|
62
73
|
return (_jsx(FilterBody, { label: label, fields: fields, filter: level, levels: levels, excludable: excludable, relation: relation
|
|
63
74
|
? {
|
|
64
75
|
fieldKey: relation.fieldKey,
|
|
@@ -68,5 +79,5 @@ export function AppFilterBody({ ctx, level, relation, excludable, label, onDone,
|
|
|
68
79
|
quantifier: relation.quantifier,
|
|
69
80
|
...(gone ? { gone: messages({ key: "views.panels.filter-relation-gone" }) } : {}),
|
|
70
81
|
}
|
|
71
|
-
: undefined, form: ctx.form, onFilterChange: onFilterChange, ruleValue: ruleValue, onDone: () => onDone?.(), actions: actions }));
|
|
82
|
+
: undefined, form: ctx.form, onFilterChange: onFilterChange, ruleValue: ruleValue, onDone: () => onDone?.(), actions: actions, ruleWords: ruleWords, ...(onStepChange ? { onStepChange } : {}) }));
|
|
72
83
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { FilterOperator, FilterRule } from "viewkitjs/fields/query";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
+
import type { ViewsPickerItem } from "../../../provider/components.js";
|
|
3
4
|
import type { FilterEditorField } from "../../model.js";
|
|
4
5
|
/** Whether the app handed a `FilterPartBody`: a holder then opens a popover for the way in place of its menu. */
|
|
5
6
|
export declare function useFilterPartBody(): boolean;
|
|
6
7
|
/** The app's `FilterPartBody` for a rule's way or value, over the holder's own writes; null when the app handed none,
|
|
7
8
|
* so the holder draws ViewKit's own. */
|
|
8
|
-
export declare function AppFilterPart({ part, rule, field, own, form, onWay, onValue, onDone, }: {
|
|
9
|
+
export declare function AppFilterPart({ part, rule, field, own, options, form, onWay, onValue, onDone, }: {
|
|
9
10
|
part: "way" | "value";
|
|
10
11
|
rule: FilterRule;
|
|
11
12
|
field: FilterEditorField;
|
|
13
|
+
/** The field's values as the Picker draws them, where ViewKit holds them (`FilterTreeConfig.optionsOf`). */
|
|
14
|
+
options?: readonly ViewsPickerItem[];
|
|
12
15
|
/** ViewKit's own value body for the rule (`<FilterValueBody filter={config} />`), null at `way`. */
|
|
13
16
|
own: ReactNode;
|
|
14
17
|
form: "computer" | "phone";
|
|
@@ -6,13 +6,15 @@ import { filterBodyFields } from "./filter-body.js";
|
|
|
6
6
|
export function useFilterPartBody() {
|
|
7
7
|
return !!useViews().components.FilterPartBody;
|
|
8
8
|
}
|
|
9
|
-
export function AppFilterPart({ part, rule, field, own, form, onWay, onValue, onDone, }) {
|
|
9
|
+
export function AppFilterPart({ part, rule, field, own, options, form, onWay, onValue, onDone, }) {
|
|
10
10
|
const { components, conventions, messages } = useViews();
|
|
11
11
|
const FilterPartBody = components.FilterPartBody;
|
|
12
12
|
if (!FilterPartBody)
|
|
13
13
|
return null;
|
|
14
14
|
const [shown] = filterBodyFields([field]);
|
|
15
15
|
const { far: _far, ...bodyField } = shown;
|
|
16
|
+
if (options)
|
|
17
|
+
bodyField.options = options;
|
|
16
18
|
return (_jsx(FilterPartBody, { part: part, label: messages({ key: part === "way" ? "views.panels.filter-way" : "views.panels.filter-value" }), rule: rule, field: bodyField, ways: filterWaysOf(field, conventions), own: own, form: form, onRuleChange: (next) => {
|
|
17
19
|
const fits = filterPartChangeFits(field, rule, next);
|
|
18
20
|
if (fits === "way")
|
|
@@ -5,7 +5,7 @@ import type { ViewsSheetActions } from "../../provider/components.js";
|
|
|
5
5
|
export declare function useSheetPanels(): boolean;
|
|
6
6
|
/** Whether the sheet's head draws the panel's ✕ (`sheetActions: "head"`), so the panel draws none of its own. */
|
|
7
7
|
export declare function useSheetDrawsClose(): boolean;
|
|
8
|
-
export declare function PanelSheet({ open, onOpenChange, title, snap, slot, headed, actions, children, }: {
|
|
8
|
+
export declare function PanelSheet({ open, onOpenChange, title, snap, slot, headed, actions, sheetTitle, onSheetEscape, children, }: {
|
|
9
9
|
open: boolean;
|
|
10
10
|
onOpenChange: (open: boolean) => void;
|
|
11
11
|
/** The panel's name in words: the sheet's accessible name, and its title unless the panel heads itself. */
|
|
@@ -19,5 +19,9 @@ export declare function PanelSheet({ open, onOpenChange, title, snap, slot, head
|
|
|
19
19
|
/** The panel's own ✕ and ✓ (the sort editor's, VK-188): with `sheetActions: "head"` handed to the Sheet in place
|
|
20
20
|
* of its ✕ alone; with `bar` the panel draws them, and the Sheet is handed none. */
|
|
21
21
|
actions?: ViewsSheetActions;
|
|
22
|
+
/** The sheet's title and name while the panel stands on a step of its own, in place of `title` (VK-721). */
|
|
23
|
+
sheetTitle?: string;
|
|
24
|
+
/** The sheet's Escape, asked first: true when the panel answered it (a step gone back), and the sheet stays open. */
|
|
25
|
+
onSheetEscape?: () => boolean;
|
|
22
26
|
children: ReactNode;
|
|
23
27
|
}): ReactNode;
|
|
@@ -13,12 +13,16 @@ export function useSheetPanels() {
|
|
|
13
13
|
export function useSheetDrawsClose() {
|
|
14
14
|
return useViews().sheetActions === "head";
|
|
15
15
|
}
|
|
16
|
-
export function PanelSheet({ open, onOpenChange, title, snap, slot, headed = false, actions, children, }) {
|
|
16
|
+
export function PanelSheet({ open, onOpenChange, title, snap, slot, headed = false, actions, sheetTitle, onSheetEscape, children, }) {
|
|
17
17
|
const { components, messages } = useViews();
|
|
18
18
|
const { Sheet } = components;
|
|
19
19
|
const head = useSheetDrawsClose();
|
|
20
20
|
const keep = (event) => event.stopPropagation();
|
|
21
|
-
return (_jsx("span", { className: "contents", onClick: keep, onDoubleClick: keep, onContextMenu: keep, children: _jsx(Sheet, { open: open, onOpenChange: (next
|
|
21
|
+
return (_jsx("span", { className: "contents", onClick: keep, onDoubleClick: keep, onContextMenu: keep, children: _jsx(Sheet, { open: open, onOpenChange: (next, details) => {
|
|
22
|
+
if (!next && details?.reason === "escape-key" && onSheetEscape?.())
|
|
23
|
+
return;
|
|
24
|
+
onOpenChange(next);
|
|
25
|
+
}, ...(!headed && { title: sheetTitle ?? title }), label: sheetTitle ?? title, snap: snap, ...(head && {
|
|
22
26
|
actions: actions ?? { close: { label: messages({ key: "views.panels.close" }), onPress: () => onOpenChange(false) } },
|
|
23
27
|
}), children: _jsx("div", { "data-slot": slot, className: "flex h-full min-h-0 flex-col", children: children }) }) }));
|
|
24
28
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViewsBodyStep } from "../../provider/components.js";
|
|
2
|
+
export type PanelStep = {
|
|
3
|
+
/** Handed to the body: the step it stands on, or `null` once it is back. */
|
|
4
|
+
onStepChange: (step: ViewsBodyStep | null) => void;
|
|
5
|
+
/** The step's title while one stands. */
|
|
6
|
+
title: string | undefined;
|
|
7
|
+
/** Back, while a step stands: the body's own. */
|
|
8
|
+
back: (() => void) | undefined;
|
|
9
|
+
/** The sheet's Escape: goes back when a step stands (or reports one this key already answered). Whether it is spent. */
|
|
10
|
+
escapeBack: () => boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function usePanelStep(): PanelStep;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
+
export function usePanelStep() {
|
|
4
|
+
const [step, setStep] = useState(null);
|
|
5
|
+
const held = useRef(null);
|
|
6
|
+
const answered = useRef(false);
|
|
7
|
+
const onStepChange = useCallback((next) => {
|
|
8
|
+
held.current = next;
|
|
9
|
+
setStep((now) => (next === null ? null : now?.title === next.title ? now : { title: next.title }));
|
|
10
|
+
}, []);
|
|
11
|
+
const goBack = useCallback(() => held.current?.onBack(), []);
|
|
12
|
+
const escapeBack = useCallback(() => {
|
|
13
|
+
if (answered.current)
|
|
14
|
+
return true;
|
|
15
|
+
const now = held.current;
|
|
16
|
+
if (!now)
|
|
17
|
+
return false;
|
|
18
|
+
answered.current = true;
|
|
19
|
+
window.setTimeout(() => {
|
|
20
|
+
answered.current = false;
|
|
21
|
+
}, 0);
|
|
22
|
+
now.onBack();
|
|
23
|
+
return true;
|
|
24
|
+
}, []);
|
|
25
|
+
return useMemo(() => ({ onStepChange, title: step?.title, back: step ? goBack : undefined, escapeBack }), [onStepChange, step, goBack, escapeBack]);
|
|
26
|
+
}
|