@12-apps/ui 6.68.0 → 6.69.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/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +8 -8
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +9 -9
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +7 -7
- package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +3 -3
- package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-overflow-costs.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-overflow-fields.js +2 -2
- package/dist/_internal/components/data-display/DataViews/data-views-overflow.js +3 -3
- package/dist/{chunk-L7HKMTKR.js → chunk-62YHJAWM.js} +2 -2
- package/dist/chunk-62YHJAWM.js.map +1 -0
- package/dist/{chunk-GCYGVWOI.js → chunk-AMT7IJYV.js} +2 -2
- package/dist/{chunk-T7ZERP7A.js → chunk-EYW6KXUC.js} +2 -2
- package/dist/{chunk-DNT5PZLF.js → chunk-GZOW6HNN.js} +4 -3
- package/dist/{chunk-DNT5PZLF.js.map → chunk-GZOW6HNN.js.map} +1 -1
- package/dist/{chunk-6CZC5S6O.js → chunk-JCHJYBDG.js} +2 -2
- package/dist/{chunk-6CZC5S6O.js.map → chunk-JCHJYBDG.js.map} +1 -1
- package/dist/{chunk-EZAQIEYB.js → chunk-LY6L3DMB.js} +12 -8
- package/dist/chunk-LY6L3DMB.js.map +1 -0
- package/dist/{chunk-WTGIW7LX.js → chunk-SAXALTRL.js} +2 -2
- package/dist/{chunk-CSLBRJ7N.js → chunk-SOQIWXFO.js} +9 -9
- package/dist/chunk-SOQIWXFO.js.map +1 -0
- package/dist/{chunk-TQXB2OHP.js → chunk-TLPFSA55.js} +3 -3
- package/dist/data-display/DataViews.js +9 -9
- package/dist/types/components/data-display/DataViews/DataViewsGrid.d.ts +7 -0
- package/dist/types/components/data-display/DataViews/DataViewsGrid.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/DataViewsTableBase.d.ts +2 -0
- package/dist/types/components/data-display/DataViews/DataViewsTableBase.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-grid-parts.d.ts +2 -0
- package/dist/types/components/data-display/DataViews/data-views-grid-parts.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-overflow-costs.d.ts +6 -2
- package/dist/types/components/data-display/DataViews/data-views-overflow-costs.d.ts.map +1 -1
- package/dist/types/components/data-display/DataViews/data-views-overflow.d.ts +1 -1
- package/dist/types/components/data-display/DataViews/data-views-overflow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/data-display/DataViews/DataViewsGrid.tsx +7 -0
- package/src/components/data-display/DataViews/DataViewsTableBase.tsx +2 -0
- package/src/components/data-display/DataViews/RESPONSIVE-BEHAVIOUR.md +10 -0
- package/src/components/data-display/DataViews/data-views-grid-parts.tsx +11 -1
- package/src/components/data-display/DataViews/data-views-overflow-costs.ts +8 -3
- package/src/components/data-display/DataViews/data-views-overflow.ts +6 -4
- package/dist/chunk-CSLBRJ7N.js.map +0 -1
- package/dist/chunk-EZAQIEYB.js.map +0 -1
- package/dist/chunk-L7HKMTKR.js.map +0 -1
- /package/dist/{chunk-GCYGVWOI.js.map → chunk-AMT7IJYV.js.map} +0 -0
- /package/dist/{chunk-T7ZERP7A.js.map → chunk-EYW6KXUC.js.map} +0 -0
- /package/dist/{chunk-WTGIW7LX.js.map → chunk-SAXALTRL.js.map} +0 -0
- /package/dist/{chunk-TQXB2OHP.js.map → chunk-TLPFSA55.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataViewsGrid
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-JCHJYBDG.js";
|
|
5
|
+
import "../../../../chunk-LY6L3DMB.js";
|
|
6
6
|
import "../../../../chunk-Y2CCXB7R.js";
|
|
7
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-TLPFSA55.js";
|
|
8
8
|
import "../../../../chunk-QLJU7UUI.js";
|
|
9
9
|
import "../../../../chunk-X3AFXHY5.js";
|
|
10
10
|
import "../../../../chunk-WQ32YFM5.js";
|
|
@@ -12,12 +12,12 @@ import "../../../../chunk-7TCOYCD7.js";
|
|
|
12
12
|
import "../../../../chunk-SZSS5KKX.js";
|
|
13
13
|
import "../../../../chunk-E5GYHN4X.js";
|
|
14
14
|
import "../../../../chunk-XZFTRGRW.js";
|
|
15
|
-
import "../../../../chunk-
|
|
16
|
-
import "../../../../chunk-
|
|
17
|
-
import "../../../../chunk-
|
|
15
|
+
import "../../../../chunk-SOQIWXFO.js";
|
|
16
|
+
import "../../../../chunk-SAXALTRL.js";
|
|
17
|
+
import "../../../../chunk-EYW6KXUC.js";
|
|
18
18
|
import "../../../../chunk-RQF4NXDC.js";
|
|
19
|
-
import "../../../../chunk-
|
|
20
|
-
import "../../../../chunk-
|
|
19
|
+
import "../../../../chunk-AMT7IJYV.js";
|
|
20
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
21
21
|
import "../../../../chunk-5WJFCQFN.js";
|
|
22
22
|
import "../../../../chunk-FJ3UZ4RC.js";
|
|
23
23
|
import "../../../../chunk-GCZJH4XL.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataViewsTableBase
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-62YHJAWM.js";
|
|
5
5
|
import "../../../../chunk-ZEVFMQAQ.js";
|
|
6
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-JCHJYBDG.js";
|
|
7
7
|
import "../../../../chunk-ZOLAYP2D.js";
|
|
8
|
-
import "../../../../chunk-
|
|
8
|
+
import "../../../../chunk-LY6L3DMB.js";
|
|
9
9
|
import "../../../../chunk-Y2CCXB7R.js";
|
|
10
|
-
import "../../../../chunk-
|
|
10
|
+
import "../../../../chunk-TLPFSA55.js";
|
|
11
11
|
import "../../../../chunk-QLJU7UUI.js";
|
|
12
12
|
import "../../../../chunk-X3AFXHY5.js";
|
|
13
13
|
import "../../../../chunk-WQ32YFM5.js";
|
|
@@ -15,12 +15,12 @@ import "../../../../chunk-7TCOYCD7.js";
|
|
|
15
15
|
import "../../../../chunk-SZSS5KKX.js";
|
|
16
16
|
import "../../../../chunk-E5GYHN4X.js";
|
|
17
17
|
import "../../../../chunk-XZFTRGRW.js";
|
|
18
|
-
import "../../../../chunk-
|
|
19
|
-
import "../../../../chunk-
|
|
20
|
-
import "../../../../chunk-
|
|
18
|
+
import "../../../../chunk-SOQIWXFO.js";
|
|
19
|
+
import "../../../../chunk-SAXALTRL.js";
|
|
20
|
+
import "../../../../chunk-EYW6KXUC.js";
|
|
21
21
|
import "../../../../chunk-RQF4NXDC.js";
|
|
22
|
-
import "../../../../chunk-
|
|
23
|
-
import "../../../../chunk-
|
|
22
|
+
import "../../../../chunk-AMT7IJYV.js";
|
|
23
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
24
24
|
import "../../../../chunk-5WJFCQFN.js";
|
|
25
25
|
import "../../../../chunk-FJ3UZ4RC.js";
|
|
26
26
|
import "../../../../chunk-GCZJH4XL.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
GridShell
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-LY6L3DMB.js";
|
|
5
5
|
import "../../../../chunk-Y2CCXB7R.js";
|
|
6
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-TLPFSA55.js";
|
|
7
7
|
import "../../../../chunk-QLJU7UUI.js";
|
|
8
8
|
import "../../../../chunk-X3AFXHY5.js";
|
|
9
9
|
import "../../../../chunk-WQ32YFM5.js";
|
|
@@ -11,12 +11,12 @@ import "../../../../chunk-7TCOYCD7.js";
|
|
|
11
11
|
import "../../../../chunk-SZSS5KKX.js";
|
|
12
12
|
import "../../../../chunk-E5GYHN4X.js";
|
|
13
13
|
import "../../../../chunk-XZFTRGRW.js";
|
|
14
|
-
import "../../../../chunk-
|
|
15
|
-
import "../../../../chunk-
|
|
16
|
-
import "../../../../chunk-
|
|
14
|
+
import "../../../../chunk-SOQIWXFO.js";
|
|
15
|
+
import "../../../../chunk-SAXALTRL.js";
|
|
16
|
+
import "../../../../chunk-EYW6KXUC.js";
|
|
17
17
|
import "../../../../chunk-RQF4NXDC.js";
|
|
18
|
-
import "../../../../chunk-
|
|
19
|
-
import "../../../../chunk-
|
|
18
|
+
import "../../../../chunk-AMT7IJYV.js";
|
|
19
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
20
20
|
import "../../../../chunk-5WJFCQFN.js";
|
|
21
21
|
import "../../../../chunk-FJ3UZ4RC.js";
|
|
22
22
|
import "../../../../chunk-GCZJH4XL.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
InlineFilterControls
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-TLPFSA55.js";
|
|
5
5
|
import "../../../../chunk-QLJU7UUI.js";
|
|
6
|
-
import "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-SOQIWXFO.js";
|
|
7
|
+
import "../../../../chunk-SAXALTRL.js";
|
|
8
|
+
import "../../../../chunk-EYW6KXUC.js";
|
|
9
9
|
import "../../../../chunk-RQF4NXDC.js";
|
|
10
|
-
import "../../../../chunk-
|
|
11
|
-
import "../../../../chunk-
|
|
10
|
+
import "../../../../chunk-AMT7IJYV.js";
|
|
11
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
12
12
|
import "../../../../chunk-5WJFCQFN.js";
|
|
13
13
|
import "../../../../chunk-FJ3UZ4RC.js";
|
|
14
14
|
import "../../../../chunk-GCZJH4XL.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
MoreGroup,
|
|
4
4
|
MoreQuick,
|
|
5
5
|
fieldClearing
|
|
6
|
-
} from "../../../../chunk-
|
|
6
|
+
} from "../../../../chunk-EYW6KXUC.js";
|
|
7
7
|
import "../../../../chunk-RQF4NXDC.js";
|
|
8
|
-
import "../../../../chunk-
|
|
9
|
-
import "../../../../chunk-
|
|
8
|
+
import "../../../../chunk-AMT7IJYV.js";
|
|
9
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
10
10
|
import "../../../../chunk-5WJFCQFN.js";
|
|
11
11
|
import "../../../../chunk-FJ3UZ4RC.js";
|
|
12
12
|
import "../../../../chunk-GCZJH4XL.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
MoreFilters
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-SAXALTRL.js";
|
|
5
|
+
import "../../../../chunk-EYW6KXUC.js";
|
|
6
6
|
import "../../../../chunk-RQF4NXDC.js";
|
|
7
|
-
import "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-AMT7IJYV.js";
|
|
8
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
9
9
|
import "../../../../chunk-5WJFCQFN.js";
|
|
10
10
|
import "../../../../chunk-FJ3UZ4RC.js";
|
|
11
11
|
import "../../../../chunk-GCZJH4XL.js";
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
keepChipsInOrder,
|
|
5
5
|
toOverflowFields,
|
|
6
6
|
toggleQuick
|
|
7
|
-
} from "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
7
|
+
} from "../../../../chunk-AMT7IJYV.js";
|
|
8
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
9
9
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
10
10
|
import "../../../../chunk-PZ5AY32C.js";
|
|
11
11
|
export {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useFilterOverflow
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-SOQIWXFO.js";
|
|
5
5
|
import {
|
|
6
6
|
isQuickActive,
|
|
7
7
|
toOverflowFields
|
|
8
|
-
} from "../../../../chunk-
|
|
9
|
-
import "../../../../chunk-
|
|
8
|
+
} from "../../../../chunk-AMT7IJYV.js";
|
|
9
|
+
import "../../../../chunk-GZOW6HNN.js";
|
|
10
10
|
import "../../../../chunk-NCS2TBIP.js";
|
|
11
11
|
import "../../../../chunk-Y4KKS6WL.js";
|
|
12
12
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-ZEVFMQAQ.js";
|
|
4
4
|
import {
|
|
5
5
|
DataViewsGrid
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JCHJYBDG.js";
|
|
7
7
|
import {
|
|
8
8
|
viewStateKey
|
|
9
9
|
} from "./chunk-ZOLAYP2D.js";
|
|
@@ -166,4 +166,4 @@ function renderViewDialogs(ctl, fields, columns, views, testIdPrefix, onSaved) {
|
|
|
166
166
|
export {
|
|
167
167
|
DataViewsTableBase
|
|
168
168
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-62YHJAWM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/DataViewsTableBase.tsx"],"sourcesContent":["\"use client\";\n\nimport type { SortFieldDefinition } from \"../../layout/ContentToolbar\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { DataViewsGrid } from \"./DataViewsGrid\";\nimport type { SelectionExtraRender } from \"./data-views-selection-extra\";\nimport type { ListGroupConfig } from \"./list-card-rails\";\nimport type { DisplayPanelView } from \"./data-views-display-panel\";\nimport { viewStateKey } from \"./data-views-dirty\";\nimport { DeleteViewDialog } from \"./DeleteViewDialog\";\nimport type { BoardConfig } from \"./DataViewsBoard\";\nimport type { DataViewExport } from \"./data-views-export\";\nimport type { ScopeConfig } from \"./data-views-scopes\";\nimport type { DataViewRowDetail } from \"./data-views-row-detail\";\nimport { ViewDialogs, ViewMutationErrorAlert } from \"./data-views-table-parts\";\nimport { useUrlEchoGuard, useUrlSyncState } from \"./data-views-url-echo\";\nimport {\n useSavedViewsController,\n type SavedViewsController,\n} from \"./use-saved-views-controller\";\nimport {\n type DataViewColumn,\n type DataViewsLayout,\n type DataViewServer,\n type DataViewState,\n type DataViewPersistence,\n type DataViewRouter,\n type FilterFieldConfig,\n type QuickFilterConfig,\n type RangeFieldConfig,\n type DataViewCardSelection,\n type RowAction,\n type SavedViewSummary,\n} from \"./data-views-types\";\n\nexport interface DataViewsTableBaseProps<T extends Record<string, unknown>> {\n /** The applied-view id read from the URL (`?view=`) on load, or null. */\n initialViewId?: string | null;\n /** Injected saved-view persistence (create/update/delete). */\n persistence: DataViewPersistence;\n /** Injected router side-effects (URL sync + refresh). */\n router: DataViewRouter;\n rows: T[];\n columns: DataViewColumn<T>[];\n fields: FilterFieldConfig<T>[];\n /** Optional numeric min/max range filters (advanced \"filter by amount\"). */\n rangeFields?: RangeFieldConfig<T>[];\n getRowId: (row: T) => string | number;\n onRowClick?: (row: T) => void;\n emptyState?: React.ReactNode;\n dataTestId?: string;\n testIdPrefix?: string;\n /** The user's + shared views for this table (from the server). */\n views: SavedViewSummary[];\n /** Big page title in the table header, beside the funnel + gear (GTA layout). */\n title?: string;\n /** Primary page actions (e.g. \"Novo produto\") rendered at the header's right. */\n headerActions?: React.ReactNode;\n /** Sort options for the toolbar's \"Sort By\" dropdown (defaults to sortable columns). */\n sortFields?: SortFieldDefinition[];\n /**\n * Per-sort-field VALUE KIND (`\"currency\" | \"number\" | \"date\" | \"text\"`), so the\n * Exibir panel phrases the direction in that column's own terms. \"Crescente\"\n * on a currency column is a puzzle; \"Menor → maior\" is not. Defaults to text.\n */\n sortKinds?: Record<string, string>;\n /**\n * Opt-in \"Exportar\" control. The grid hands the host the current query,\n * UNPAGINATED, and the host re-queries — the grid never fetches, and an\n * export therefore follows the filters rather than the loaded page.\n */\n exportConfig?: DataViewExport;\n /** Notified with the currently-visible (filtered) rows, so Export matches the view. */\n onVisibleRowsChange?: (rows: T[]) => void;\n /** Reusable row actions driving both the row \"⋮\" kebab and the bulk menu. */\n rowActions?: RowAction<T>[];\n /** Leading control in the auto kebab column (e.g. a favourite star). */\n rowActionsLeading?: (row: T) => React.ReactNode;\n /** Low-level bulk-action override; prefer `rowActions`. */\n bulkActions?: (selectedRows: T[], clearSelection: () => void) => React.ReactNode;\n /** A selection-widening control beside the count (e.g. \"select all matching\"). */\n selectionExtra?: SelectionExtraRender<T>;\n /** Bespoke per-row menu (an entity's self-contained 3-dots menu) instead of the auto kebab. */\n renderRowMenu?: (row: T) => React.ReactNode;\n /**\n * Row selection, default `true`. `false` draws no checkbox in any layout and\n * no select-all, so the toolbar's selection mode can never hide the search,\n * the pills and Exportar — for a grid with no bulk action. Row click and the\n * row menu are unaffected.\n */\n selectable?: boolean;\n /** Opt-in expandable rows (table layout only) — see {@link DataViewRowDetail}. */\n rowDetail?: DataViewRowDetail<T>;\n /** Opt-in \"Grade\" (cards) layout — a card renderer per row; adds a Grade/Tabela toggle. */\n renderCard?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /** Opt-in \"Quadro\" (board) layout — the loaded page as columns of one field. Needs `renderCard`. */\n board?: BoardConfig<T>;\n /** Opt-in \"Lista\" layout — one full-width, entity-rendered row per record (FUT-733). */\n renderListRow?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /** The Lista's shared columns, so its rows line up by construction not convention. */\n listGroup?: ListGroupConfig<T>;\n /** The page-level partition rendered as tabs under the toolbar (server mode only). */\n scopes?: ScopeConfig[];\n /** The row field the scopes partition by — used only to reject a pill over the same field. */\n scopeFieldId?: string;\n /** Which layout to show first when the user has expressed no preference (default \"table\"). */\n defaultLayout?: DataViewsLayout;\n /**\n * Ignore the remembered cross-screen layout preference and pin to\n * `defaultLayout`. For tables that exist to SHOW a layout — stories, docs,\n * screenshots — not for real screens.\n */\n ignoreStoredLayout?: boolean;\n /** Opt into the responsive inline filter UX (collapsible row / modal). Default keeps the panel. */\n inlineFilters?: boolean;\n /** Keep the inline search visible with no filter fields and no active search. */\n alwaysShowSearch?: boolean;\n /** One-click toggle chips at the head of the toolbar — see `QuickFilterConfig`. */\n quickFilters?: QuickFilterConfig[];\n /** Pin the toolbar and the table header while the page scrolls — see `DataViewsGrid`. */\n stickyToolbar?: boolean;\n /** Show the \"N de N\" counter (default `true`) — see `DataViewsGrid`. */\n showCounter?: boolean;\n /** Server-mode wiring (FUT-180): backend-driven rows/total + re-fetch. Omit for client mode. */\n server?: DataViewServer;\n /** Seed the initial view state (search/pills/ranges/sort) from the URL when no saved view applies. */\n initialState?: DataViewState;\n}\n\n/**\n * Resolve the initial applied view: a `?view=<id>` shortcut (FUT-90) wins, else\n * the user's default view, else none. Drives the seed state + trigger label.\n */\nfunction resolveInitialView(\n views: SavedViewSummary[],\n requestedId: string | null,\n): SavedViewSummary | undefined {\n const requested = requestedId ? views.find((view) => view.id === requestedId) : undefined;\n return requested ?? views.find((view) => view.isDefault);\n}\n\n/**\n * The Exibir panel's view chrome, assembled from the saved-views controller.\n * Extracted so {@link DataViewsTableBase} stays inside its size budget.\n */\nfunction buildDisplayView({\n ctl,\n views,\n activeView,\n dirty,\n onRequestDelete,\n}: {\n ctl: SavedViewsController;\n views: SavedViewSummary[];\n activeView: SavedViewSummary | undefined;\n dirty: boolean;\n /** Opens the confirmation; the delete itself happens on confirm. */\n onRequestDelete: (view: SavedViewSummary) => void;\n}): DisplayPanelView {\n return {\n activeViewName: ctl.activeViewName,\n dirty,\n onReset: () => (activeView ? ctl.applyView(activeView) : ctl.selectMain()),\n // Only offer \"Atualizar\" when there IS a view to update — otherwise the\n // single footer button is a plain \"Salvar visão\".\n onUpdate: activeView ? () => ctl.openEdit(activeView) : undefined,\n onSaveAs: ctl.openCreate,\n // The views themselves, not a dropdown: the panel renders them in its own\n // body (see `data-views-view-nav`), so there is no second popover to clip\n // the row actions.\n nav: {\n views,\n activeViewId: activeView?.id ?? null,\n onSelectView: (id) => {\n const next = id === null ? null : views.find((view) => view.id === id);\n if (next) ctl.applyView(next);\n else ctl.selectMain();\n },\n onEditView: ctl.openEdit,\n onPatchView: (view, changes) => void ctl.patchView(view, changes),\n onDeleteView: onRequestDelete,\n },\n };\n}\n\n/**\n * \"Are there unsaved changes?\" — the dot on Exibir, and whether Redefinir and\n * Salvar visão are live.\n *\n * Two things it gets right that the inline version did not. It compares\n * NORMALISED states (`viewStateKey`), so a filter applied and then removed is\n * clean again rather than clean-looking but flagged; and it re-baselines after\n * a SAVE, because the state just written is the clean one from that point.\n *\n * The baseline is the first state the grid emits for a view, not the view\n * itself: the grid normalises what it is handed — resolving visible columns,\n * filling in layout — so the applied view is never byte-identical to the state\n * it produces.\n */\nfunction useDirtyTracking(ctl: SavedViewsController): {\n dirty: boolean;\n noteState: (state: DataViewState) => void;\n markSaved: () => void;\n} {\n const [dirty, setDirty] = useState(false);\n const [savedAt, setSavedAt] = useState(0);\n const baseline = useRef<string | null>(null);\n const appliedKey = JSON.stringify(ctl.applied ?? null);\n\n useEffect(() => {\n baseline.current = null;\n setDirty(false);\n }, [appliedKey, savedAt]);\n\n return {\n dirty,\n noteState: (state) => {\n ctl.currentRef.current = state;\n const key = viewStateKey(state);\n if (baseline.current === null) {\n baseline.current = key;\n setDirty(false);\n return;\n }\n const next = key !== baseline.current;\n setDirty((prev) => (prev === next ? prev : next));\n },\n markSaved: () => setSavedAt((tick) => tick + 1),\n };\n}\n\n/**\n * The reusable admin table (FUT-89): the DataViews grid plus the full saved-views\n * experience — a views dropdown, a save/edit modal (with preview), and a manage\n * dialog. Framework-agnostic: saved-view persistence and router side-effects are\n * INJECTED (`persistence`, `router`, `initialViewId`) so the host app wires them\n * to its backend + framework router. A default view auto-applies on load; applying\n * a view restores its filters + columns + sort. Each table supplies its own columns\n * + filter fields; everything else is shared.\n */\nexport function DataViewsTableBase<T extends Record<string, unknown>>(\n props: DataViewsTableBaseProps<T>,\n): React.JSX.Element {\n // Forwarded as a whole rather than restated name-by-name twice (as in\n // DataViewsGrid): this component only ADDS the saved-views chrome, and a\n // 30-name destructure repeated in the JSX is exactly where a newly added prop\n // silently stops being passed on.\n const {\n initialViewId = null,\n persistence,\n router,\n columns,\n fields,\n testIdPrefix = \"table\",\n views,\n server,\n initialState,\n } = props;\n const initialView = resolveInitialView(views, initialViewId);\n const columnIds = columns.map((col) => col.id);\n const ctl = useSavedViewsController(persistence, router, columnIds, views, initialView, initialState);\n // Unsaved-changes flag for the Exibir panel. Set from `onStateChange` rather\n // than derived in render because the live state lives in a REF (the grid owns\n // it); the equality bail-out in `setDirty` is what stops the update loop.\n const { dirty, noteState, markSaved } = useDirtyTracking(ctl);\n // Deleting a saved view is confirmed, not immediate — see `DeleteViewDialog`.\n const [pendingDelete, setPendingDelete] = useState<SavedViewSummary | null>(null);\n // The view the panel's \"Redefinir\" restores: the applied one, or the built-in\n // \"Visão principal\" when none is.\n const activeView = views.find((view) => view.name === ctl.activeViewName);\n const displayView = buildDisplayView({\n ctl,\n views,\n activeView,\n dirty,\n onRequestDelete: setPendingDelete,\n });\n // Server-mode lists re-apply URL-derived controls on back/forward (not just\n // the mount seed), but never the grid's own query echoing back through the URL.\n const echo = useUrlEchoGuard(server);\n const syncState = useUrlSyncState(echo.server, initialState, echo.consumeEcho);\n\n return (\n <>\n <ViewMutationErrorAlert error={ctl.mutationError} onClose={ctl.clearMutationError} testIdPrefix={testIdPrefix} />\n <DataViewsGrid<T>\n {...props}\n server={echo.server}\n testIdPrefix={testIdPrefix}\n appliedState={ctl.applied}\n syncState={syncState}\n onStateChange={noteState}\n // The saved-views menu is NOT a toolbar control any more: it lives in\n // the Exibir panel's VISÃO header, passed through `displayView`.\n displayView={displayView}\n />\n {renderViewDialogs(ctl, fields, columns, views, testIdPrefix, markSaved)}\n <DeleteViewDialog\n view={pendingDelete}\n onClose={() => setPendingDelete(null)}\n onConfirm={(view) => {\n void ctl.handleDelete(view);\n setPendingDelete(null);\n }}\n testIdPrefix={testIdPrefix}\n />\n </>\n );\n}\n\n/** The save + manage saved-view dialogs, split out to keep the base thin. */\nfunction renderViewDialogs<T extends Record<string, unknown>>(\n ctl: SavedViewsController,\n fields: DataViewsTableBaseProps<T>[\"fields\"],\n columns: DataViewsTableBaseProps<T>[\"columns\"],\n views: SavedViewSummary[],\n testIdPrefix: string,\n onSaved: () => void,\n): React.JSX.Element {\n return (\n <ViewDialogs<T>\n saveOpen={ctl.saveOpen}\n onCloseSave={ctl.closeSave}\n currentState={ctl.editing ? ctl.editing.state : ctl.currentRef.current}\n fields={fields}\n columns={columns}\n editing={ctl.editing}\n onSave={async (payload) => {\n await ctl.handleSave(payload);\n // The saved state is the clean one from here on.\n onSaved();\n }}\n manageOpen={ctl.manageOpen}\n onCloseManage={() => ctl.setManageOpen(false)}\n views={views}\n onEditFromManage={ctl.editFromManage}\n onDelete={(view) => void ctl.handleDelete(view)}\n testIdPrefix={testIdPrefix}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,WAAW,QAAQ,gBAAgB;AAyRxC,mBACE,KADF;AAtJJ,SAAS,mBACP,OACA,aAC8B;AAC9B,QAAM,YAAY,cAAc,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,WAAW,IAAI;AAChF,SAAO,aAAa,MAAM,KAAK,CAAC,SAAS,KAAK,SAAS;AACzD;AAMA,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOqB;A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ACF;AAAA,KACF;AAEJ;AAGA,SAAS,kBACP,KACA,QACA,SACA,OACA,cACA,SACmB;AACnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,UAAU,IAAI;AAAA,MACd,aAAa,IAAI;AAAA,MACjB,cAAc,IAAI,UAAU,IAAI,QAAQ,QAAQ,IAAI,WAAW;AAAA,MAC/D;AAAA,MACA;AAAA,MACA,SAAS,IAAI;AAAA,MACb,QAAQ,OAAO,YAAY;AACzB,cAAM,IAAI,WAAW,OAAO;AAE5B,gBAAQ;AAAA,MACV;AAAA,MACA,YAAY,IAAI;AAAA,MAChB,eAAe,MAAM,IAAI,cAAc,KAAK;AAAA,MAC5C;AAAA,MACA,kBAAkB,IAAI;AAAA,MACtB,UAAU,CAAC,SAAS,KAAK,IAAI,aAAa,IAAI;AAAA,MAC9C;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isRangeSet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GZOW6HNN.js";
|
|
4
4
|
|
|
5
5
|
// src/components/data-display/DataViews/data-views-overflow-fields.ts
|
|
6
6
|
function toOverflowFields(fields, rangeFields, quickFilters = []) {
|
|
@@ -56,4 +56,4 @@ export {
|
|
|
56
56
|
keepChipsInOrder,
|
|
57
57
|
toggleQuick
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-AMT7IJYV.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-RQF4NXDC.js";
|
|
4
4
|
import {
|
|
5
5
|
isQuickActive
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AMT7IJYV.js";
|
|
7
7
|
import {
|
|
8
8
|
RangeBounds
|
|
9
9
|
} from "./chunk-5WJFCQFN.js";
|
|
@@ -227,4 +227,4 @@ export {
|
|
|
227
227
|
MoreQuick,
|
|
228
228
|
MoreGroup
|
|
229
229
|
};
|
|
230
|
-
//# sourceMappingURL=chunk-
|
|
230
|
+
//# sourceMappingURL=chunk-EYW6KXUC.js.map
|
|
@@ -97,9 +97,10 @@ var RESERVED = {
|
|
|
97
97
|
/** The gap between two controls. */
|
|
98
98
|
betweenControls: 8
|
|
99
99
|
};
|
|
100
|
-
function pricesFor(theme) {
|
|
100
|
+
function pricesFor(theme, showCounter = true) {
|
|
101
101
|
const entries = Object.entries(RESERVED).map(([key, px]) => [key, remPx(theme, px)]);
|
|
102
|
-
|
|
102
|
+
const prices = Object.fromEntries(entries);
|
|
103
|
+
return showCounter ? prices : { ...prices, counter: 0 };
|
|
103
104
|
}
|
|
104
105
|
function rightClusterCost(price, hasExport, compact) {
|
|
105
106
|
const one = compact ? price.displayControlCompact : price.displayControl;
|
|
@@ -118,4 +119,4 @@ export {
|
|
|
118
119
|
rightClusterCost,
|
|
119
120
|
furnitureCost
|
|
120
121
|
};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-GZOW6HNN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-overflow-costs.ts"],"sourcesContent":["/**\n * WHAT EACH THING ON THE TOOLBAR COSTS, IN PIXELS.\n *\n * The pricing half of the collapse ladder, split from `data-views-overflow` at\n * the file-size gate. Pure arithmetic and constants: no React, no measurement,\n * no decisions. `data-views-overflow` measures the row and spends what this\n * says it has.\n *\n * Every number here is either MEASURED in a browser (and says so) or\n * deliberately generous. Over-pricing sheds one control too early, which the\n * \"Mais\" button absorbs invisibly; under-pricing breaks the line.\n *\n * Every number is DESIGN px — measured at MUI's default type scale. The bar is\n * measured in real px, so a price reaches it through `remPx` (`estimateWidth`,\n * `pricesFor`): a theme that scales its type scales the controls, and so the\n * prices, together — a denser theme fits more pills on the same bar.\n */\nimport type { Theme } from \"@mui/material/styles/index.js\";\n\nimport { remPx } from \"../../../tokens/relative\";\n\nimport type { OverflowField } from \"./data-views-overflow\";\nimport type { RangeValue } from \"./data-views-types\";\n\n/**\n * Rough rendered width of a control, in px at `theme`'s type scale.\n *\n * An ESTIMATE from the label text rather than a real measurement, deliberately:\n * measuring the true width needs every control mounted first, and mounting them\n * to decide whether to mount them is the layout thrash this hook exists to\n * avoid. The estimate only has to rank controls and find the cut point — being\n * a few px out moves the cut by at most one control, and the overflow catches it.\n */\nexport function estimateWidth(theme: Theme, text: string, extra: number): number {\n /**\n * ~7.6px per character at the toolbar's font size, plus 76px of chrome:\n * horizontal padding, the border, and the dropdown chevron. The chrome used\n * to be 52, which under-priced every control by roughly a chevron's width —\n * six of them then \"fitted\" a row they overflowed, and because they are flex\n * children the row paid for it by squeezing labels to \"D…\" and \"V…\" rather\n * than by shedding a control into the overflow.\n *\n * Deliberately generous: over-pricing sheds one control too early, which the\n * \"Mais\" button absorbs invisibly. Under-pricing breaks the line.\n *\n * The chrome was 76, and generous had turned into wrong. MEASURED on the\n * Pedidos bar: \"Pagamento\" renders at 123px against an estimate of 144, and\n * \"Situação\" at 107 against 137 — every pill over-priced by ~22%, which on a\n * phone is the whole difference between one pill on the bar and none. 56 is\n * still above the ~50 measured, so the slack the comment above asks for is\n * intact; it is just slack rather than a second control's worth of budget.\n */\n return remPx(theme, Math.round(text.length * 7.6) + 56 + extra);\n}\n\n/** Is a range bounded at either end? */\nexport function isRangeSet(range: RangeValue | undefined): boolean {\n return Boolean(range && (range.min !== undefined || range.max !== undefined));\n}\n\n/** The label a pill actually renders, which is what decides its width. */\nexport function pillText<T extends Record<string, unknown>>(field: OverflowField<T>, values: string[]): string {\n if (values.length === 0) return field.label;\n if (values.length === 1) {\n const option = field.pill?.options.find((entry) => entry.value === values[0]);\n return `${field.label}: ${option?.label ?? values[0]}`;\n }\n return `${field.label}: ${values.length}`;\n}\n\n/** Fixed toolbar furniture the filters have to fit around, in design px. */\nexport const RESERVED = {\n /** The search box never shrinks below this. */\n search: 200,\n /**\n * The \"N de N\" counter.\n *\n * MEASURED at 35px, plus its divider and gap. The old 96 was priced for a\n * counter reading \"1.234 de 5.678\"; a phone shows \"3 de 3\", and charging\n * nearly triple its rendered width came straight out of the filter budget.\n */\n counter: 56,\n /**\n * ONE right-hand control (Exibir, or Exportar) WITH its text label.\n *\n * Priced per control rather than for the pair, because the pair is not what\n * every page renders: \"Exportar\" exists only when the host passes an\n * `exportConfig`, and several pages (Pedidos among them) put their export in\n * the PAGE HEADER instead. Charging 216 there billed the filters for a button\n * that was never on the bar — ~108px of budget spent on nothing, which on a\n * phone is the difference between one filter pill and none.\n */\n displayControl: 108,\n /**\n * The same control as an icon only — step 2 of the ladder.\n *\n * MEASURED at 133px for the PAIR (66 each: a Button's minimum tap target is\n * a good deal wider than the 20px glyph inside it); 70 keeps that total's\n * slack at one control's granularity.\n */\n displayControlCompact: 70,\n /**\n * What step 4 leaves behind: the search as a bare magnifier.\n *\n * MEASURED at 30px on the Pedidos bar (`…-search-all-collapsed`); 38 keeps a\n * tap target's worth of slack over it.\n */\n searchIcon: 38,\n /**\n * The narrowest keyword box still worth typing into — below it the operator\n * cannot read back what they wrote, and the box takes over the cluster\n * instead of sharing it (see `searchTakeover`).\n *\n * 120 rather than 140 because this is compared against the ESTIMATE, which\n * over-prices on purpose (see `estimateWidth`). At 140 a large phone took the\n * whole cluster to produce a box barely wider than the one it could have had\n * while keeping its filters — paying for nothing.\n */\n usableSearch: 120,\n /**\n * The \"Mais\" button, only charged when there IS an overflow — and priced by\n * the state it is actually in, like the right-hand cluster beside it.\n *\n * MEASURED: 128px with its label, badge and chevron; 69px once the ladder has\n * it down to icon + badge. One number for both was wrong in BOTH directions —\n * it under-priced the wide bar (the row's own failure mode) and over-priced\n * the narrow one by a whole pill.\n */\n overflowButton: 136,\n overflowButtonCompact: 80,\n /**\n * \"Limpar\", only charged when there IS something to clear.\n *\n * It appears exactly when the row is at its widest — every applied filter\n * has a longer label than the idle one it replaced — so leaving it unpriced\n * would break the line at the one moment the operator most needs it.\n * Measured at 64 as an icon; 72 with slack.\n */\n clearAll: 72,\n /**\n * The row's own padding, plus the gaps BETWEEN the fixed furniture.\n *\n * Not the per-control gaps — `splitFilters` already adds `betweenControls`\n * for every filter it keeps, so counting a fourth one here charged one gap twice.\n * MEASURED: 32px of padding (16 each side) + three 8px gaps between the\n * search, the counter and the right cluster.\n */\n chrome: 56,\n /** The gap between two controls. */\n betweenControls: 8,\n} as const;\n\n/** {@link RESERVED} at a theme's type scale — the px the measured bar is in. */\nexport type Prices = Record<keyof typeof RESERVED, number>;\n\n/** Price the furniture for `theme`: every {@link RESERVED} entry through `remPx`. */\nexport function pricesFor(theme: Theme): Prices {\n const entries = Object.entries(RESERVED).map(([key, px]) => [key, remPx(theme, px)]);\n return Object.fromEntries(entries) as Prices;\n}\n\n/** What the right-hand cluster costs, given what the host actually renders. */\nexport function rightClusterCost(price: Prices, hasExport: boolean, compact: boolean): number {\n const one = compact ? price.displayControlCompact : price.displayControl;\n return hasExport ? one * 2 : one;\n}\n\n/**\n * What the toolbar furniture costs at a given rung of the ladder — the budget\n * the filter controls have to fit AROUND.\n *\n * This exists because the two halves used to disagree. `splitFilters` priced\n * the furniture at its widest (search 200 + counter 96 + right 216) and shed\n * every filter to make room; the ladder then collapsed those very controls to\n * 44 + 0 + 140 and nobody handed the ~330px back. On a 428px phone that showed\n * as a bar carrying a magnifier, a \"Mais 5\" pill, and a band of nothing.\n */\nexport function furnitureCost(\n price: Prices,\n flags: { searchCollapsed: boolean; counterHidden: boolean; compactControls: boolean },\n hasExport: boolean,\n): number {\n return (\n (flags.searchCollapsed ? price.searchIcon : price.search) +\n (flags.counterHidden ? 0 : price.counter) +\n rightClusterCost(price, hasExport, flags.compactControls) +\n price.chrome\n );\n}\n"],"mappings":";;;;;AAiCO,SAAS,cAAc,OAAc,MAAc,OAAuB;AAmB/E,SAAO,MAAM,OAAO,KAAK,MAAM,KAAK,SAAS,GAAG,IAAI,KAAK,KAAK;AAChE;AAGO,SAAS,WAAW,OAAwC;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AAS,iBAAiB,OAAe,WAAoB,SAA0B;AAC5F,QAAM,MAAM,UAAU,MAAM,wBAAwB,MAAM;AAC1D,SAAO,YAAY,MAAM,IAAI;AAC/B;AAYO,SAAS,cACd,OACA,OACA,WACQ;AACR,UACG,MAAM,kBAAkB,MAAM,aAAa,MAAM,WACjD,MAAM,gBAAgB,IAAI,MAAM,WACjC,iBAAiB,OAAO,WAAW,MAAM,eAAe,IACxD,MAAM;AAEV;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-overflow-costs.ts"],"sourcesContent":["/**\n * WHAT EACH THING ON THE TOOLBAR COSTS, IN PIXELS.\n *\n * The pricing half of the collapse ladder, split from `data-views-overflow` at\n * the file-size gate. Pure arithmetic and constants: no React, no measurement,\n * no decisions. `data-views-overflow` measures the row and spends what this\n * says it has.\n *\n * Every number here is either MEASURED in a browser (and says so) or\n * deliberately generous. Over-pricing sheds one control too early, which the\n * \"Mais\" button absorbs invisibly; under-pricing breaks the line.\n *\n * Every number is DESIGN px — measured at MUI's default type scale. The bar is\n * measured in real px, so a price reaches it through `remPx` (`estimateWidth`,\n * `pricesFor`): a theme that scales its type scales the controls, and so the\n * prices, together — a denser theme fits more pills on the same bar.\n */\nimport type { Theme } from \"@mui/material/styles/index.js\";\n\nimport { remPx } from \"../../../tokens/relative\";\n\nimport type { OverflowField } from \"./data-views-overflow\";\nimport type { RangeValue } from \"./data-views-types\";\n\n/**\n * Rough rendered width of a control, in px at `theme`'s type scale.\n *\n * An ESTIMATE from the label text rather than a real measurement, deliberately:\n * measuring the true width needs every control mounted first, and mounting them\n * to decide whether to mount them is the layout thrash this hook exists to\n * avoid. The estimate only has to rank controls and find the cut point — being\n * a few px out moves the cut by at most one control, and the overflow catches it.\n */\nexport function estimateWidth(theme: Theme, text: string, extra: number): number {\n /**\n * ~7.6px per character at the toolbar's font size, plus 76px of chrome:\n * horizontal padding, the border, and the dropdown chevron. The chrome used\n * to be 52, which under-priced every control by roughly a chevron's width —\n * six of them then \"fitted\" a row they overflowed, and because they are flex\n * children the row paid for it by squeezing labels to \"D…\" and \"V…\" rather\n * than by shedding a control into the overflow.\n *\n * Deliberately generous: over-pricing sheds one control too early, which the\n * \"Mais\" button absorbs invisibly. Under-pricing breaks the line.\n *\n * The chrome was 76, and generous had turned into wrong. MEASURED on the\n * Pedidos bar: \"Pagamento\" renders at 123px against an estimate of 144, and\n * \"Situação\" at 107 against 137 — every pill over-priced by ~22%, which on a\n * phone is the whole difference between one pill on the bar and none. 56 is\n * still above the ~50 measured, so the slack the comment above asks for is\n * intact; it is just slack rather than a second control's worth of budget.\n */\n return remPx(theme, Math.round(text.length * 7.6) + 56 + extra);\n}\n\n/** Is a range bounded at either end? */\nexport function isRangeSet(range: RangeValue | undefined): boolean {\n return Boolean(range && (range.min !== undefined || range.max !== undefined));\n}\n\n/** The label a pill actually renders, which is what decides its width. */\nexport function pillText<T extends Record<string, unknown>>(field: OverflowField<T>, values: string[]): string {\n if (values.length === 0) return field.label;\n if (values.length === 1) {\n const option = field.pill?.options.find((entry) => entry.value === values[0]);\n return `${field.label}: ${option?.label ?? values[0]}`;\n }\n return `${field.label}: ${values.length}`;\n}\n\n/** Fixed toolbar furniture the filters have to fit around, in design px. */\nexport const RESERVED = {\n /** The search box never shrinks below this. */\n search: 200,\n /**\n * The \"N de N\" counter.\n *\n * MEASURED at 35px, plus its divider and gap. The old 96 was priced for a\n * counter reading \"1.234 de 5.678\"; a phone shows \"3 de 3\", and charging\n * nearly triple its rendered width came straight out of the filter budget.\n */\n counter: 56,\n /**\n * ONE right-hand control (Exibir, or Exportar) WITH its text label.\n *\n * Priced per control rather than for the pair, because the pair is not what\n * every page renders: \"Exportar\" exists only when the host passes an\n * `exportConfig`, and several pages (Pedidos among them) put their export in\n * the PAGE HEADER instead. Charging 216 there billed the filters for a button\n * that was never on the bar — ~108px of budget spent on nothing, which on a\n * phone is the difference between one filter pill and none.\n */\n displayControl: 108,\n /**\n * The same control as an icon only — step 2 of the ladder.\n *\n * MEASURED at 133px for the PAIR (66 each: a Button's minimum tap target is\n * a good deal wider than the 20px glyph inside it); 70 keeps that total's\n * slack at one control's granularity.\n */\n displayControlCompact: 70,\n /**\n * What step 4 leaves behind: the search as a bare magnifier.\n *\n * MEASURED at 30px on the Pedidos bar (`…-search-all-collapsed`); 38 keeps a\n * tap target's worth of slack over it.\n */\n searchIcon: 38,\n /**\n * The narrowest keyword box still worth typing into — below it the operator\n * cannot read back what they wrote, and the box takes over the cluster\n * instead of sharing it (see `searchTakeover`).\n *\n * 120 rather than 140 because this is compared against the ESTIMATE, which\n * over-prices on purpose (see `estimateWidth`). At 140 a large phone took the\n * whole cluster to produce a box barely wider than the one it could have had\n * while keeping its filters — paying for nothing.\n */\n usableSearch: 120,\n /**\n * The \"Mais\" button, only charged when there IS an overflow — and priced by\n * the state it is actually in, like the right-hand cluster beside it.\n *\n * MEASURED: 128px with its label, badge and chevron; 69px once the ladder has\n * it down to icon + badge. One number for both was wrong in BOTH directions —\n * it under-priced the wide bar (the row's own failure mode) and over-priced\n * the narrow one by a whole pill.\n */\n overflowButton: 136,\n overflowButtonCompact: 80,\n /**\n * \"Limpar\", only charged when there IS something to clear.\n *\n * It appears exactly when the row is at its widest — every applied filter\n * has a longer label than the idle one it replaced — so leaving it unpriced\n * would break the line at the one moment the operator most needs it.\n * Measured at 64 as an icon; 72 with slack.\n */\n clearAll: 72,\n /**\n * The row's own padding, plus the gaps BETWEEN the fixed furniture.\n *\n * Not the per-control gaps — `splitFilters` already adds `betweenControls`\n * for every filter it keeps, so counting a fourth one here charged one gap twice.\n * MEASURED: 32px of padding (16 each side) + three 8px gaps between the\n * search, the counter and the right cluster.\n */\n chrome: 56,\n /** The gap between two controls. */\n betweenControls: 8,\n} as const;\n\n/** {@link RESERVED} at a theme's type scale — the px the measured bar is in. */\nexport type Prices = Record<keyof typeof RESERVED, number>;\n\n/**\n * Price the furniture for `theme`: every {@link RESERVED} entry through `remPx`.\n * A counter the host turned off costs nothing at any rung: pricing it anyway\n * left a gap where it would have been, and shed controls for it.\n */\nexport function pricesFor(theme: Theme, showCounter = true): Prices {\n const entries = Object.entries(RESERVED).map(([key, px]) => [key, remPx(theme, px)]);\n const prices = Object.fromEntries(entries) as Prices;\n return showCounter ? prices : { ...prices, counter: 0 };\n}\n\n/** What the right-hand cluster costs, given what the host actually renders. */\nexport function rightClusterCost(price: Prices, hasExport: boolean, compact: boolean): number {\n const one = compact ? price.displayControlCompact : price.displayControl;\n return hasExport ? one * 2 : one;\n}\n\n/**\n * What the toolbar furniture costs at a given rung of the ladder — the budget\n * the filter controls have to fit AROUND.\n *\n * This exists because the two halves used to disagree. `splitFilters` priced\n * the furniture at its widest (search 200 + counter 96 + right 216) and shed\n * every filter to make room; the ladder then collapsed those very controls to\n * 44 + 0 + 140 and nobody handed the ~330px back. On a 428px phone that showed\n * as a bar carrying a magnifier, a \"Mais 5\" pill, and a band of nothing.\n */\nexport function furnitureCost(\n price: Prices,\n flags: { searchCollapsed: boolean; counterHidden: boolean; compactControls: boolean },\n hasExport: boolean,\n): number {\n return (\n (flags.searchCollapsed ? price.searchIcon : price.search) +\n (flags.counterHidden ? 0 : price.counter) +\n rightClusterCost(price, hasExport, flags.compactControls) +\n price.chrome\n );\n}\n"],"mappings":";;;;;AAiCO,SAAS,cAAc,OAAc,MAAc,OAAuB;AAmB/E,SAAO,MAAM,OAAO,KAAK,MAAM,KAAK,SAAS,GAAG,IAAI,KAAK,KAAK;AAChE;AAGO,SAAS,WAAW,OAAwC;AACjE,SAAO,QAAQ,UAAU,MAAM,QAAQ,UAAa,MAAM,QAAQ,OAAU;AAC9E;AAGO,SAAS,SAA4C,OAAyB,QAA0B;AAC7G,MAAI,OAAO,WAAW,EAAG,QAAO,MAAM;AACtC,MAAI,OAAO,WAAW,GAAG;AACvB,UAAM,SAAS,MAAM,MAAM,QAAQ,KAAK,CAAC,UAAU,MAAM,UAAU,OAAO,CAAC,CAAC;AAC5E,WAAO,GAAG,MAAM,KAA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AM,WACjC,iBAAiB,OAAO,WAAW,MAAM,eAAe,IACxD,MAAM;AAEV;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GridShell
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LY6L3DMB.js";
|
|
4
4
|
import {
|
|
5
5
|
useDataViewsState
|
|
6
6
|
} from "./chunk-2QB4WIU5.js";
|
|
@@ -27,4 +27,4 @@ function DataViewsGrid(props) {
|
|
|
27
27
|
export {
|
|
28
28
|
DataViewsGrid
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-JCHJYBDG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/DataViews/DataViewsGrid.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\nimport { type SortFieldDefinition } from \"../../layout/ContentToolbar\";\n\nimport { GridShell } from \"./data-views-grid-parts\";\nimport type { SelectionExtraRender } from \"./data-views-selection-extra\";\nimport type { ListGroupConfig } from \"./list-card-rails\";\nimport type { DisplayPanelView } from \"./data-views-display-panel\";\nimport type { BoardConfig } from \"./DataViewsBoard\";\nimport type { DataViewExport } from \"./data-views-export\";\nimport type { ScopeConfig } from \"./data-views-scopes\";\nimport type { DataViewCardSelection } from \"./data-views-types\";\nimport {\n type DataViewColumn,\n type DataViewsLayout,\n type DataViewServer,\n type DataViewState,\n type DataViewSyncState,\n type FilterFieldConfig,\n type QuickFilterConfig,\n type RangeFieldConfig,\n type RowAction,\n} from \"./data-views-types\";\nimport type { DataViewRowDetail } from \"./data-views-row-detail\";\nimport { useDataViewsState } from \"./use-data-views-state\";\n\ninterface DataViewsGridProps<T extends Record<string, unknown>> {\n rows: T[];\n columns: DataViewColumn<T>[];\n fields: FilterFieldConfig<T>[];\n /** Optional numeric min/max range filters (advanced \"filter by amount\"). */\n rangeFields?: RangeFieldConfig<T>[];\n getRowId: (row: T) => string | number;\n /** Row click opens the row; clicks in the actions column are ignored. */\n onRowClick?: (row: T) => void;\n emptyState?: React.ReactNode;\n dataTestId?: string;\n testIdPrefix?: string;\n /** Seed/replace the view state. A NEW reference re-applies (used to apply a saved view). */\n appliedState?: DataViewState;\n /**\n * URL-driven controls (search/pills/ranges/sort) that RE-APPLY on reference\n * change while preserving column visibility — for server-mode lists that keep\n * their filter/sort/page in the address bar (see {@link DataViewSyncState}).\n */\n syncState?: DataViewSyncState;\n /** Notified on every view-state change (so a save-view modal can read it). */\n onStateChange?: (state: DataViewState) => void;\n /**\n * Notified with the currently-visible (search + filter matched) rows whenever\n * they change — so a page-level Export exports what the user sees, not the\n * full dataset.\n */\n onVisibleRowsChange?: (rows: T[]) => void;\n /** Saved-views UI injected into the toolbar (FUT-89). */\n toolbarRightSlot?: React.ReactNode;\n /**\n * The saved-view chrome for the Exibir panel: its VISÃO header (with the\n * views dropdown) and its Redefinir / Salvar visão footer. Supplied by\n * `DataViewsTableBase`; without it the panel is tabs only.\n */\n displayView?: DisplayPanelView;\n /** Big page title in the header row (next to the funnel + gear). */\n title?: string;\n /** Primary page actions rendered at the header's right. */\n headerActions?: React.ReactNode;\n /**\n * Sort options for the toolbar's \"Sort By\" dropdown. Defaults to the sortable\n * columns (asc/desc each) when omitted.\n */\n sortFields?: SortFieldDefinition[];\n /**\n * Per-sort-field VALUE KIND (`\"currency\" | \"number\" | \"date\" | \"text\"`), so the\n * Exibir panel phrases the direction in that column's own terms. \"Crescente\"\n * on a currency column is a puzzle; \"Menor → maior\" is not. Defaults to text.\n */\n sortKinds?: Record<string, string>;\n /**\n * Opt-in \"Exportar\" control. The grid hands the host the current query,\n * UNPAGINATED, and the host re-queries — the grid never fetches, and an\n * export therefore follows the filters rather than the loaded page.\n */\n exportConfig?: DataViewExport;\n /**\n * A single, reusable list of row actions that drives BOTH the per-row \"⋮\"\n * kebab AND the bulk-actions menu (tabwoah model). When provided, the grid\n * appends a kebab actions column automatically (unless the page already\n * defines one) and shows an \"Ações\" bulk menu when rows are selected.\n */\n rowActions?: RowAction<T>[];\n /**\n * Extra leading control rendered in the auto kebab column, before the \"⋮\"\n * (e.g. a favourite star). Only used when `rowActions` is set.\n */\n rowActionsLeading?: (row: T) => React.ReactNode;\n /**\n * Low-level override for the selection bulk control. Prefer `rowActions`.\n * Receives the selected rows + a `clearSelection` callback.\n */\n bulkActions?: (selectedRows: T[], clearSelection: () => void) => React.ReactNode;\n /**\n * A control rendered beside the \"N selected\" count, for changing WHAT is\n * selected rather than what happens to it — a \"select all N matching the\n * filter\" widening, above all.\n *\n * Called only while something is selected, and handed\n * {@link SelectionExtraContext.allOnPageSelected} so the control can follow\n * the convention operators already know: the widening appears once the whole\n * page is ticked, and not before.\n */\n selectionExtra?: SelectionExtraRender<T>;\n /**\n * Render a bespoke per-row menu in the actions column instead of the auto\n * kebab — typically an entity's self-contained 3-dots menu that owns its own\n * popups, so the SAME menu component drives both the table row and the card.\n * `rowActions`/`bulkActions` still drive the multi-row bulk menu.\n */\n renderRowMenu?: (row: T) => React.ReactNode;\n /**\n * Row selection — on by default. `false` opts the grid out entirely: no\n * checkbox column in the table (and no width reserved for one), no checkbox\n * or checkbox gutter on cards and list rows, no select-all strip and no\n * count. With nothing selectable, the toolbar's selection mode never takes\n * over the search, the filter pills and Exportar. For a grid with no bulk\n * action, where a selection could only hide the toolbar. Row click and the\n * row menu are unaffected.\n */\n selectable?: boolean;\n /**\n * Opt-in expandable rows (table layout only): a chevron in a leading column\n * opens `render(row)` under the row. See {@link DataViewRowDetail}.\n */\n rowDetail?: DataViewRowDetail<T>;\n /**\n * Opt-in \"Grade\" (cards) layout. When provided, a Grade/Tabela toggle appears in\n * the toolbar and the cards body renders each visible row via this function\n * (reusing the same search/filter/sort). Omit ⇒ table only (unchanged).\n */\n renderCard?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /**\n * Opt-in \"Quadro\" (board) layout: the loaded page laid out as columns of one\n * grouping field. Reuses `renderCard`, so supplying a board WITHOUT one simply\n * offers no board. Best when the groups are states in a state machine — derive\n * these groups and `scopes` from ONE definition so the two cannot drift.\n */\n board?: BoardConfig<T>;\n /**\n * Opt-in \"Lista\" layout (FUT-733): one FULL-WIDTH row per record, rendered by\n * the entity — a marker, a title, a subtitle and a value on the right. Sits\n * between the table (compare columns) and the cards (browse); omit ⇒ not\n * offered, exactly as `renderCard` gates the cards.\n */\n renderListRow?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /**\n * The Lista's SHARED COLUMNS — declared once for the list, obeyed by every row.\n *\n * This is what makes a list line up by construction rather than by convention.\n * Omit it and each row still resolves its own tracks from its own config,\n * which agrees with its neighbours right up until one row carries an unusually\n * wide value.\n */\n listGroup?: ListGroupConfig<T>;\n /**\n * The page-level partition rendered as an exclusive tab strip above the\n * toolbar, with server-supplied counts. Requires `server`: a scope is applied\n * at the backend, never in the browser.\n */\n scopes?: ScopeConfig[];\n /** The row field the scopes partition by — used only to reject a pill over the same field. */\n scopeFieldId?: string;\n /** Which layout to show first when the user has expressed no preference (default \"table\"). */\n defaultLayout?: DataViewsLayout;\n /**\n * Ignore the remembered cross-screen layout preference and pin to\n * `defaultLayout`. For tables that exist to SHOW a layout — stories, docs,\n * screenshots — not for real screens.\n */\n ignoreStoredLayout?: boolean;\n /**\n * Opt into the responsive inline filter UX (collapsible filter row on wide\n * screens, modal on narrow). Default `false` keeps the classic slide-in panel.\n */\n inlineFilters?: boolean;\n /** Keep the inline search visible with no filter fields and no active search. */\n alwaysShowSearch?: boolean;\n /**\n * One-click filters drawn as toggle chips at the head of the toolbar, each\n * applying one value of a declared pill field. See {@link QuickFilterConfig}.\n */\n quickFilters?: QuickFilterConfig[];\n /**\n * Pin the toolbar to the top of the page's scroll area, and the table's\n * header row right under it, while the rows scroll past. For a list that IS\n * the page: what sits above the grid (title, summaries, notices) scrolls\n * away, and the controls and column names stay in reach. The table keeps its\n * own sideways scroll, which is why the header follows the page scroll\n * rather than relying on `position: sticky` (see `useStickyTableHead`).\n */\n stickyToolbar?: boolean;\n /** Server-mode wiring; when set the grid is backend-driven (no client filter/sort/paginate). */\n server?: DataViewServer;\n}\n\n/**\n * Surface the visible (filtered) rows so a page-level Export matches the view.\n *\n * Pages pass inline column/field arrays, so `matched` is a fresh reference on\n * every render even when its contents are unchanged. The guard is a signature\n * over the rows' *contents* (not just their ids), so the callback — and the\n * parent `useState` it usually drives — fires only when the visible data\n * actually changes. Ids alone are not enough: a server refresh can change a\n * visible row's values while keeping its id, and the export must reflect them.\n * Content-equal renders keep the same signature, so this never loops.\n */\nfunction useVisibleRowsNotifier<T>(matched: T[], onVisibleRowsChange?: (rows: T[]) => void): void {\n const visibleSignature = JSON.stringify(matched);\n const lastSignature = useRef<string | null>(null);\n useEffect(() => {\n if (lastSignature.current === visibleSignature) return;\n lastSignature.current = visibleSignature;\n onVisibleRowsChange?.(matched);\n }, [visibleSignature, matched, onVisibleRowsChange]);\n}\n\n/**\n * The reusable admin DataViews table (FUT-88): the shared ContentToolbar +\n * TableFilter panel over `@12-apps/ui` DataGrid. State + derived data live in\n * {@link useDataViewsState}; the render lives in `GridShell`. This component just\n * connects the two. Reused across every admin list page.\n */\nexport function DataViewsGrid<T extends Record<string, unknown>>(\n props: DataViewsGridProps<T>,\n): React.JSX.Element {\n // Forwarded as a whole rather than restated name-by-name twice: this component\n // only ADDS the controller, and a 25-name destructure repeated in the JSX is\n // where a newly added prop silently stops being passed on.\n const { rangeFields = [], testIdPrefix = \"table\" } = props;\n const controller = useDataViewsState({ ...props, rangeFields, testIdPrefix });\n useVisibleRowsNotifier(controller.matched, props.onVisibleRowsChange);\n return <GridShell {...props} c={controller} rangeFields={rangeFields} testIdPrefix={testIdPrefix} />;\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,WAAW,cAAc;AA+OzB;AAzBT,SAAS,uBAA0B,SAAc,qBAAiD;AAChG,QAAM,mBAAmB,KAAK,UAAU,OAAO;AAC/C,QAAM,gBAAgB,OAAsB,IAAI;AAChD,YAAU,MAAM;AACd,QAAI,cAAc,YAAY,iBAAkB;AAChD,kBAAc,UAAU;AACxB,0BAAsB,OAAO;AAAA,EAC/B,GAAG,CAAC,kBAAkB,SAAS,mBAAmB,CAAC;AACrD;AAQO,SAAS,cACd,OACmB;AAInB,QAAM,EAAE,cAAc,CAAC,GAAG,eAAe,QAAQ,IAAI;AACrD,QAAM,aAAa,kBAAkB,EAAE,GAAG,OAAO,aAAa,aAAa,CAAC;AAC5E,yBAAuB,WAAW,SAAS,MAAM,mBAAmB;AACpE,SAAO,oBAAC,aAAW,GAAG,OAAO,GAAG,YAAY,aAA0B,cAA4B;AACpG;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/DataViewsGrid.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\nimport { type SortFieldDefinition } from \"../../layout/ContentToolbar\";\n\nimport { GridShell } from \"./data-views-grid-parts\";\nimport type { SelectionExtraRender } from \"./data-views-selection-extra\";\nimport type { ListGroupConfig } from \"./list-card-rails\";\nimport type { DisplayPanelView } from \"./data-views-display-panel\";\nimport type { BoardConfig } from \"./DataViewsBoard\";\nimport type { DataViewExport } from \"./data-views-export\";\nimport type { ScopeConfig } from \"./data-views-scopes\";\nimport type { DataViewCardSelection } from \"./data-views-types\";\nimport {\n type DataViewColumn,\n type DataViewsLayout,\n type DataViewServer,\n type DataViewState,\n type DataViewSyncState,\n type FilterFieldConfig,\n type QuickFilterConfig,\n type RangeFieldConfig,\n type RowAction,\n} from \"./data-views-types\";\nimport type { DataViewRowDetail } from \"./data-views-row-detail\";\nimport { useDataViewsState } from \"./use-data-views-state\";\n\ninterface DataViewsGridProps<T extends Record<string, unknown>> {\n rows: T[];\n columns: DataViewColumn<T>[];\n fields: FilterFieldConfig<T>[];\n /** Optional numeric min/max range filters (advanced \"filter by amount\"). */\n rangeFields?: RangeFieldConfig<T>[];\n getRowId: (row: T) => string | number;\n /** Row click opens the row; clicks in the actions column are ignored. */\n onRowClick?: (row: T) => void;\n emptyState?: React.ReactNode;\n dataTestId?: string;\n testIdPrefix?: string;\n /** Seed/replace the view state. A NEW reference re-applies (used to apply a saved view). */\n appliedState?: DataViewState;\n /**\n * URL-driven controls (search/pills/ranges/sort) that RE-APPLY on reference\n * change while preserving column visibility — for server-mode lists that keep\n * their filter/sort/page in the address bar (see {@link DataViewSyncState}).\n */\n syncState?: DataViewSyncState;\n /** Notified on every view-state change (so a save-view modal can read it). */\n onStateChange?: (state: DataViewState) => void;\n /**\n * Notified with the currently-visible (search + filter matched) rows whenever\n * they change — so a page-level Export exports what the user sees, not the\n * full dataset.\n */\n onVisibleRowsChange?: (rows: T[]) => void;\n /** Saved-views UI injected into the toolbar (FUT-89). */\n toolbarRightSlot?: React.ReactNode;\n /**\n * The saved-view chrome for the Exibir panel: its VISÃO header (with the\n * views dropdown) and its Redefinir / Salvar visão footer. Supplied by\n * `DataViewsTableBase`; without it the panel is tabs only.\n */\n displayView?: DisplayPanelView;\n /** Big page title in the header row (next to the funnel + gear). */\n title?: string;\n /** Primary page actions rendered at the header's right. */\n headerActions?: React.ReactNode;\n /**\n * Sort options for the toolbar's \"Sort By\" dropdown. Defaults to the sortable\n * columns (asc/desc each) when omitted.\n */\n sortFields?: SortFieldDefinition[];\n /**\n * Per-sort-field VALUE KIND (`\"currency\" | \"number\" | \"date\" | \"text\"`), so the\n * Exibir panel phrases the direction in that column's own terms. \"Crescente\"\n * on a currency column is a puzzle; \"Menor → maior\" is not. Defaults to text.\n */\n sortKinds?: Record<string, string>;\n /**\n * Opt-in \"Exportar\" control. The grid hands the host the current query,\n * UNPAGINATED, and the host re-queries — the grid never fetches, and an\n * export therefore follows the filters rather than the loaded page.\n */\n exportConfig?: DataViewExport;\n /**\n * A single, reusable list of row actions that drives BOTH the per-row \"⋮\"\n * kebab AND the bulk-actions menu (tabwoah model). When provided, the grid\n * appends a kebab actions column automatically (unless the page already\n * defines one) and shows an \"Ações\" bulk menu when rows are selected.\n */\n rowActions?: RowAction<T>[];\n /**\n * Extra leading control rendered in the auto kebab column, before the \"⋮\"\n * (e.g. a favourite star). Only used when `rowActions` is set.\n */\n rowActionsLeading?: (row: T) => React.ReactNode;\n /**\n * Low-level override for the selection bulk control. Prefer `rowActions`.\n * Receives the selected rows + a `clearSelection` callback.\n */\n bulkActions?: (selectedRows: T[], clearSelection: () => void) => React.ReactNode;\n /**\n * A control rendered beside the \"N selected\" count, for changing WHAT is\n * selected rather than what happens to it — a \"select all N matching the\n * filter\" widening, above all.\n *\n * Called only while something is selected, and handed\n * {@link SelectionExtraContext.allOnPageSelected} so the control can follow\n * the convention operators already know: the widening appears once the whole\n * page is ticked, and not before.\n */\n selectionExtra?: SelectionExtraRender<T>;\n /**\n * Render a bespoke per-row menu in the actions column instead of the auto\n * kebab — typically an entity's self-contained 3-dots menu that owns its own\n * popups, so the SAME menu component drives both the table row and the card.\n * `rowActions`/`bulkActions` still drive the multi-row bulk menu.\n */\n renderRowMenu?: (row: T) => React.ReactNode;\n /**\n * Row selection — on by default. `false` opts the grid out entirely: no\n * checkbox column in the table (and no width reserved for one), no checkbox\n * or checkbox gutter on cards and list rows, no select-all strip and no\n * count. With nothing selectable, the toolbar's selection mode never takes\n * over the search, the filter pills and Exportar. For a grid with no bulk\n * action, where a selection could only hide the toolbar. Row click and the\n * row menu are unaffected.\n */\n selectable?: boolean;\n /**\n * Opt-in expandable rows (table layout only): a chevron in a leading column\n * opens `render(row)` under the row. See {@link DataViewRowDetail}.\n */\n rowDetail?: DataViewRowDetail<T>;\n /**\n * Opt-in \"Grade\" (cards) layout. When provided, a Grade/Tabela toggle appears in\n * the toolbar and the cards body renders each visible row via this function\n * (reusing the same search/filter/sort). Omit ⇒ table only (unchanged).\n */\n renderCard?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /**\n * Opt-in \"Quadro\" (board) layout: the loaded page laid out as columns of one\n * grouping field. Reuses `renderCard`, so supplying a board WITHOUT one simply\n * offers no board. Best when the groups are states in a state machine — derive\n * these groups and `scopes` from ONE definition so the two cannot drift.\n */\n board?: BoardConfig<T>;\n /**\n * Opt-in \"Lista\" layout (FUT-733): one FULL-WIDTH row per record, rendered by\n * the entity — a marker, a title, a subtitle and a value on the right. Sits\n * between the table (compare columns) and the cards (browse); omit ⇒ not\n * offered, exactly as `renderCard` gates the cards.\n */\n renderListRow?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /**\n * The Lista's SHARED COLUMNS — declared once for the list, obeyed by every row.\n *\n * This is what makes a list line up by construction rather than by convention.\n * Omit it and each row still resolves its own tracks from its own config,\n * which agrees with its neighbours right up until one row carries an unusually\n * wide value.\n */\n listGroup?: ListGroupConfig<T>;\n /**\n * The page-level partition rendered as an exclusive tab strip above the\n * toolbar, with server-supplied counts. Requires `server`: a scope is applied\n * at the backend, never in the browser.\n */\n scopes?: ScopeConfig[];\n /** The row field the scopes partition by — used only to reject a pill over the same field. */\n scopeFieldId?: string;\n /** Which layout to show first when the user has expressed no preference (default \"table\"). */\n defaultLayout?: DataViewsLayout;\n /**\n * Ignore the remembered cross-screen layout preference and pin to\n * `defaultLayout`. For tables that exist to SHOW a layout — stories, docs,\n * screenshots — not for real screens.\n */\n ignoreStoredLayout?: boolean;\n /**\n * Opt into the responsive inline filter UX (collapsible filter row on wide\n * screens, modal on narrow). Default `false` keeps the classic slide-in panel.\n */\n inlineFilters?: boolean;\n /** Keep the inline search visible with no filter fields and no active search. */\n alwaysShowSearch?: boolean;\n /**\n * One-click filters drawn as toggle chips at the head of the toolbar, each\n * applying one value of a declared pill field. See {@link QuickFilterConfig}.\n */\n quickFilters?: QuickFilterConfig[];\n /**\n * Pin the toolbar to the top of the page's scroll area, and the table's\n * header row right under it, while the rows scroll past. For a list that IS\n * the page: what sits above the grid (title, summaries, notices) scrolls\n * away, and the controls and column names stay in reach. The table keeps its\n * own sideways scroll, which is why the header follows the page scroll\n * rather than relying on `position: sticky` (see `useStickyTableHead`).\n */\n stickyToolbar?: boolean;\n /**\n * Show the \"N de N\" counter (default `true`). `false` removes it from the\n * bar AND from the ladder's budget, so nothing is shed to make room for it —\n * for a list whose rows are not all records (section headings handed in as\n * rows would be counted as results).\n */\n showCounter?: boolean;\n /** Server-mode wiring; when set the grid is backend-driven (no client filter/sort/paginate). */\n server?: DataViewServer;\n}\n\n/**\n * Surface the visible (filtered) rows so a page-level Export matches the view.\n *\n * Pages pass inline column/field arrays, so `matched` is a fresh reference on\n * every render even when its contents are unchanged. The guard is a signature\n * over the rows' *contents* (not just their ids), so the callback — and the\n * parent `useState` it usually drives — fires only when the visible data\n * actually changes. Ids alone are not enough: a server refresh can change a\n * visible row's values while keeping its id, and the export must reflect them.\n * Content-equal renders keep the same signature, so this never loops.\n */\nfunction useVisibleRowsNotifier<T>(matched: T[], onVisibleRowsChange?: (rows: T[]) => void): void {\n const visibleSignature = JSON.stringify(matched);\n const lastSignature = useRef<string | null>(null);\n useEffect(() => {\n if (lastSignature.current === visibleSignature) return;\n lastSignature.current = visibleSignature;\n onVisibleRowsChange?.(matched);\n }, [visibleSignature, matched, onVisibleRowsChange]);\n}\n\n/**\n * The reusable admin DataViews table (FUT-88): the shared ContentToolbar +\n * TableFilter panel over `@12-apps/ui` DataGrid. State + derived data live in\n * {@link useDataViewsState}; the render lives in `GridShell`. This component just\n * connects the two. Reused across every admin list page.\n */\nexport function DataViewsGrid<T extends Record<string, unknown>>(\n props: DataViewsGridProps<T>,\n): React.JSX.Element {\n // Forwarded as a whole rather than restated name-by-name twice: this component\n // only ADDS the controller, and a 25-name destructure repeated in the JSX is\n // where a newly added prop silently stops being passed on.\n const { rangeFields = [], testIdPrefix = \"table\" } = props;\n const controller = useDataViewsState({ ...props, rangeFields, testIdPrefix });\n useVisibleRowsNotifier(controller.matched, props.onVisibleRowsChange);\n return <GridShell {...props} c={controller} rangeFields={rangeFields} testIdPrefix={testIdPrefix} />;\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,WAAW,cAAc;AAsPzB;AAzBT,SAAS,uBAA0B,SAAc,qBAAiD;AAChG,QAAM,mBAAmB,KAAK,UAAU,OAAO;AAC/C,QAAM,gBAAgB,OAAsB,IAAI;AAChD,YAAU,MAAM;AACd,QAAI,cAAc,YAAY,iBAAkB;AAChD,kBAAc,UAAU;AACxB,0BAAsB,OAAO;AAAA,EAC/B,GAAG,CAAC,kBAAkB,SAAS,mBAAmB,CAAC;AACrD;AAQO,SAAS,cACd,OACmB;AAInB,QAAM,EAAE,cAAc,CAAC,GAAG,eAAe,QAAQ,IAAI;AACrD,QAAM,aAAa,kBAAkB,EAAE,GAAG,OAAO,aAAa,aAAa,CAAC;AAC5E,yBAAuB,WAAW,SAAS,MAAM,mBAAmB;AACpE,SAAO,oBAAC,aAAW,GAAG,OAAO,GAAG,YAAY,aAA0B,cAA4B;AACpG;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-Y2CCXB7R.js";
|
|
4
4
|
import {
|
|
5
5
|
InlineFilterControls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TLPFSA55.js";
|
|
7
7
|
import {
|
|
8
8
|
GridHeaderRow
|
|
9
9
|
} from "./chunk-X3AFXHY5.js";
|
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
} from "./chunk-XZFTRGRW.js";
|
|
20
20
|
import {
|
|
21
21
|
useFilterOverflow
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SOQIWXFO.js";
|
|
23
23
|
import {
|
|
24
24
|
toOverflowFields,
|
|
25
25
|
toggleQuick
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AMT7IJYV.js";
|
|
27
27
|
import {
|
|
28
28
|
allOnPageSelected,
|
|
29
29
|
resolveSelectionExtra
|
|
@@ -76,7 +76,8 @@ function useGridShellFilters({
|
|
|
76
76
|
testIdPrefix,
|
|
77
77
|
alwaysShowSearch,
|
|
78
78
|
hasExport,
|
|
79
|
-
quickFilters
|
|
79
|
+
quickFilters,
|
|
80
|
+
showCounter
|
|
80
81
|
}) {
|
|
81
82
|
const { state } = c;
|
|
82
83
|
const [openControls, setOpenControls] = useState(0);
|
|
@@ -85,7 +86,8 @@ function useGridShellFilters({
|
|
|
85
86
|
state.pills,
|
|
86
87
|
c.ranges,
|
|
87
88
|
openControls > 0,
|
|
88
|
-
hasExport
|
|
89
|
+
hasExport,
|
|
90
|
+
showCounter
|
|
89
91
|
);
|
|
90
92
|
const showInline = inlineFilters;
|
|
91
93
|
const useModal = false;
|
|
@@ -111,6 +113,7 @@ function useGridShellFilters({
|
|
|
111
113
|
inlineVisible,
|
|
112
114
|
filterProps,
|
|
113
115
|
split,
|
|
116
|
+
counterHidden: !showCounter || showInline && split.counterHidden,
|
|
114
117
|
onControlOpenChange: (open) => setOpenControls((count) => Math.max(0, count + (open ? 1 : -1)))
|
|
115
118
|
};
|
|
116
119
|
}
|
|
@@ -158,7 +161,7 @@ function ShellStack({
|
|
|
158
161
|
allOnPageSelected: allOnPageSelected(c, props.getRowId),
|
|
159
162
|
toolbarRightSlot: props.toolbarRightSlot,
|
|
160
163
|
compactControls: showInline && split.compactControls,
|
|
161
|
-
counterHidden:
|
|
164
|
+
counterHidden: filters.counterHidden,
|
|
162
165
|
showInline,
|
|
163
166
|
sticky: props.stickyToolbar === true
|
|
164
167
|
}
|
|
@@ -225,7 +228,8 @@ function GridShell(props) {
|
|
|
225
228
|
testIdPrefix,
|
|
226
229
|
alwaysShowSearch,
|
|
227
230
|
hasExport: props.exportConfig !== void 0,
|
|
228
|
-
quickFilters: props.quickFilters ?? []
|
|
231
|
+
quickFilters: props.quickFilters ?? [],
|
|
232
|
+
showCounter: props.showCounter !== false
|
|
229
233
|
});
|
|
230
234
|
return /* @__PURE__ */ jsxs(
|
|
231
235
|
DataViewsLayoutProvider,
|
|
@@ -247,4 +251,4 @@ function GridShell(props) {
|
|
|
247
251
|
export {
|
|
248
252
|
GridShell
|
|
249
253
|
};
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
254
|
+
//# sourceMappingURL=chunk-LY6L3DMB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DataViews/data-views-grid-parts.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { TableFilter } from \"../../layout/TableFilter\";\nimport { Stack } from \"../../../mui/Stack\";\n\nimport {\n DataViewsLayoutProvider,\n useDataViewsLayout,\n type DataViewsLayout,\n} from \"./data-views-layout-context\";\nimport { FilterDialog, GridFilterPanel } from \"./data-views-filter-panel\";\nimport { GridMain } from \"./data-views-grid-bodies\";\nimport type { ListGroupConfig } from \"./list-card-rails\";\nimport { InlineFilterControls } from \"./data-views-inline-bar\";\nimport { toOverflowFields, useFilterOverflow, type OverflowSplit } from \"./data-views-overflow\";\nimport { GridHeaderRow } from \"./data-views-header-row\";\nimport { allOnPageSelected, resolveSelectionExtra, type SelectionExtraRender } from \"./data-views-selection-extra\";\nimport { ShellToolbar } from \"./data-views-shell-toolbar\";\nimport type { DisplayPanelView } from \"./data-views-display-panel\";\nimport type { DataViewExport } from \"./data-views-export\";\nimport { useDataViewsCopy } from \"./data-views-copy-context\";\nimport { ShellEmpty } from \"./data-views-empty\";\nimport { DataViewsPagination } from \"./data-views-pagination\";\nimport type { BoardConfig } from \"./DataViewsBoard\";\nimport { type ScopeConfig } from \"./data-views-scopes\";\nimport { ScopeTabsSlot } from \"./data-views-scope-tabs\";\nimport { SHELL_PROPS, useStickyBarTop } from \"./data-views-sticky-head\";\nimport { togglePillValues } from \"./data-views-grid-helpers\";\nimport { toggleQuick } from \"./data-views-overflow-fields\";\nimport type {\n DataViewCardSelection,\n FilterFieldConfig,\n QuickFilterConfig,\n RangeFieldConfig,\n RangeValue,\n RowAction,\n} from \"./data-views-types\";\nimport type { DataViewRowDetail } from \"./data-views-row-detail\";\nimport type { DataViewsController } from \"./use-data-views-state\";\n\n/* ── Layout ⇄ view-state mirror ──────────────────────────────────────────── */\n\n/**\n * Mirrors the LIVE layout back into the view state, so saving a view captures\n * the layout the user is actually looking at.\n *\n * A component rather than a callback prop because only something INSIDE the\n * provider can read the layout, and only the controller can write the state.\n * The `stored !== layout` guard is what makes it idempotent: `c` is rebuilt on\n * every render, so an unguarded effect here would patch → re-render → patch.\n *\n * It re-fires when `stored` changes too, which is the case that matters after\n * applying a saved view: `appliedState` REPLACES the state, so a view saved\n * before layouts were captured clears `state.layout`, and the mirror puts the\n * current one back rather than leaving the next save with nothing to store.\n */\nfunction LayoutStateSync<T extends Record<string, unknown>>({\n c,\n}: {\n c: DataViewsController<T>;\n}): null {\n const { layout } = useDataViewsLayout();\n const stored = c.state.layout;\n useEffect(() => {\n if (stored !== layout) c.patch({ layout });\n // `c` is intentionally out of the deps — see the guard above.\n }, [layout, stored]);\n return null;\n}\n\n/* ── Shell (composes toolbar + body + panel) ─────────────────────────────── */\n\n/** The shared filter-surface props consumed by the inline bar, panel, and modal. */\ninterface FilterSurfaceProps<T extends Record<string, unknown>> {\n testIdPrefix: string;\n search: string;\n fields: FilterFieldConfig<T>[];\n rangeFields: RangeFieldConfig<T>[];\n pills: Record<string, string[]>;\n ranges: Record<string, RangeValue>;\n onSearchChange: (value: string) => void;\n onTogglePill: (fieldId: string, value: string, checked: boolean) => void;\n onChangeRange: (fieldId: string, range: RangeValue) => void;\n onClearField: (fieldId: string) => void;\n onClearAll: () => void;\n /** Press a quick chip (its field becomes `[value]`), or release the pressed one. */\n onToggleQuick: (quick: QuickFilterConfig) => void;\n}\n\n/**\n * Derives the responsive filter state (which surface to show at this width) and\n * the filter-mutation handlers from the controller — pulled out of `GridShell`\n * so the component body stays under the size/complexity budget.\n */\n/** Grouped rather than positional: the list had grown past readability. */\ninterface GridShellFiltersArgs<T extends Record<string, unknown>> {\n c: DataViewsController<T>;\n inlineFilters: boolean;\n fields: FilterFieldConfig<T>[];\n rangeFields: RangeFieldConfig<T>[];\n testIdPrefix: string;\n alwaysShowSearch: boolean;\n /** Is \"Exportar\" on the bar? Half the right cluster's cost when it is not. */\n hasExport: boolean;\n quickFilters: QuickFilterConfig[];\n /** Is the \"N de N\" counter on the bar? Priced at 0 when it is not. */\n showCounter: boolean;\n}\n\nfunction useGridShellFilters<T extends Record<string, unknown>>({\n c,\n inlineFilters,\n fields,\n rangeFields,\n testIdPrefix,\n alwaysShowSearch,\n hasExport,\n quickFilters,\n showCounter,\n}: GridShellFiltersArgs<T>): {\n showInline: boolean;\n useModal: boolean;\n inlineVisible: boolean;\n filterProps: FilterSurfaceProps<T>;\n split: OverflowSplit<T>;\n /** The counter is off: the host turned it off, or the ladder shed it. */\n counterHidden: boolean;\n onControlOpenChange: (open: boolean) => void;\n} {\n const { state } = c;\n // How many filter controls are open. A COUNT, not a flag: closing one popover\n // by opening another overlaps, and a boolean would unfreeze mid-handover.\n const [openControls, setOpenControls] = useState(0);\n // ONE measurement for the whole shell: the filter row decides which controls\n // it can keep, and the TOOLBAR needs the same answer to drop its labels.\n // Measuring twice would let the two disagree at the crossover width.\n const split = useFilterOverflow(\n toOverflowFields(fields, rangeFields, quickFilters),\n state.pills,\n c.ranges,\n openControls > 0,\n hasExport,\n showCounter,\n );\n // THE BAR RENDERS AT EVERY WIDTH. It used to be swapped for a full-screen\n // filter MODAL below `lg`, which was the responsive strategy before the\n // measured ladder existed — and the two now do the same job, badly together:\n // the modal took the bar away at 1199px, and with it the very degradation\n // (labels off, search collapsed, filters into \"Mais\") that exists to make a\n // narrow bar work. So a 900px window got no bar and no ladder, and the\n // operator lost the search entirely rather than gaining a compact one.\n //\n // The ladder is measured, so it already covers every width the modal did.\n const showInline = inlineFilters;\n const useModal = false;\n const inlineVisible =\n showInline &&\n (alwaysShowSearch ||\n fields.length > 0 ||\n rangeFields.length > 0 ||\n quickFilters.length > 0 ||\n state.search !== \"\");\n const filterProps: FilterSurfaceProps<T> = {\n testIdPrefix,\n search: state.search,\n fields,\n rangeFields,\n pills: state.pills,\n ranges: c.ranges,\n onSearchChange: (value) => c.patch({ search: value }),\n // Updater, never the render's `state` — see {@link DataViewStatePatch}.\n onTogglePill: (fieldId, value, checked) =>\n c.patch(({ pills }) => ({ pills: { ...pills, [fieldId]: togglePillValues(pills[fieldId], value, checked) } })),\n onChangeRange: (fieldId, range) => c.patch({ ranges: { ...c.ranges, [fieldId]: range } }),\n onClearField: (fieldId) => c.patch({ pills: { ...state.pills, [fieldId]: [] } }),\n onClearAll: () => c.patch({ search: \"\", pills: {}, ranges: {} }),\n onToggleQuick: (quick) => c.patch(({ pills }) => ({ pills: toggleQuick(pills, quick) })),\n };\n return {\n showInline,\n useModal,\n inlineVisible,\n filterProps,\n split,\n counterHidden: !showCounter || (showInline && split.counterHidden),\n onControlOpenChange: (open) =>\n setOpenControls((count) => Math.max(0, count + (open ? 1 : -1))),\n };\n}\n\ninterface GridShellProps<T extends Record<string, unknown>> {\n c: DataViewsController<T>;\n rows: T[];\n fields: FilterFieldConfig<T>[];\n rangeFields: RangeFieldConfig<T>[];\n getRowId: (row: T) => string | number;\n testIdPrefix: string;\n dataTestId?: string;\n emptyState?: React.ReactNode;\n toolbarRightSlot?: React.ReactNode;\n rowActions?: RowAction<T>[];\n bulkActions?: (selectedRows: T[], clearSelection: () => void) => React.ReactNode;\n /** A widening control beside the selection count — see `resolveSelectionExtra`. */\n selectionExtra?: SelectionExtraRender<T>;\n /** Opt-in \"Grade\" (cards) layout: renders each row as an entity-supplied card.\n * Omit ⇒ table only (no layout toggle). */\n renderCard?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /**\n * Opt-in \"Quadro\" (board) layout. Needs `renderCard` too — the board reuses\n * the entity's card, so a board config without one simply offers no board\n * rather than failing: that is a config gap, not a runtime error.\n */\n board?: BoardConfig<T>;\n /** Opt-in \"Lista\" layout: one full-width, entity-rendered row per record. */\n renderListRow?: (row: T, selection: DataViewCardSelection) => React.ReactNode;\n /** The Lista's shared columns, so its rows line up by construction. */\n listGroup?: ListGroupConfig<T>;\n /** Opt-in expandable rows, drawn by the table layout only. */\n rowDetail?: DataViewRowDetail<T>;\n /** Row selection, on by default. False ⇒ no checkboxes in any layout, no select-all. */\n selectable?: boolean;\n /** The page-level partition rendered as tabs under the toolbar. */\n scopes?: ScopeConfig[];\n /**\n * The row field the scopes partition by. Compared against the board's\n * `groupBy` so the two are not shown as the same partition twice.\n */\n scopeFieldId?: string;\n /** Per-sort-field value kind, so directions read in the column's own terms. */\n sortKinds?: Record<string, string>;\n /** The saved-view chrome bracketing the Exibir panel. */\n displayView?: DisplayPanelView;\n /** Injected export — the host re-queries; the grid never fetches. */\n exportConfig?: DataViewExport;\n /** Page title in the grid's own header row, above the scopes + toolbar. */\n title?: string;\n /** Primary page actions rendered at the header row's right. */\n headerActions?: React.ReactNode;\n /** Which layout to show first when the user has expressed no preference (default \"table\"). */\n defaultLayout?: DataViewsLayout;\n /** Pin to `defaultLayout`, ignoring the remembered preference (stories/docs). */\n ignoreStoredLayout?: boolean;\n /**\n * Opt into the responsive inline filter UX: a collapsible filter row below the\n * toolbar on wide screens and a modal on narrow ones. When false (default),\n * keep the classic slide-in filter panel opened by the \"Filtros\" button.\n */\n inlineFilters?: boolean;\n /**\n * Keep the inline search box on screen even with no filter fields and no\n * active search. Without it a grid whose only filter IS the search (`fields`\n * empty) can never OFFER one: the row renders only once a search exists, so\n * the operator would have to hand-edit the URL to start one. Default false —\n * every grid that ships filter fields already shows the row.\n */\n alwaysShowSearch?: boolean;\n /** One-click toggle chips at the head of the bar — see `QuickFilterConfig`. */\n quickFilters?: QuickFilterConfig[];\n /** Pin the toolbar and the table header while the page scrolls. */\n stickyToolbar?: boolean;\n /** Hide the \"N de N\" counter — see `DataViewsGrid`. */\n showCounter?: boolean;\n}\n\n/** The scrollable content region: scope tabs, toolbar, filter bar, body, pager. */\nfunction ShellStack<T extends Record<string, unknown>>({\n props,\n filters,\n}: {\n props: GridShellProps<T>;\n filters: ReturnType<typeof useGridShellFilters<T>>;\n}): React.JSX.Element {\n const copy = useDataViewsCopy();\n const { c, testIdPrefix, dataTestId, scopes = [], emptyState, inlineFilters = false } = props;\n const { showInline, useModal, inlineVisible, filterProps, split, onControlOpenChange } = filters;\n const shellRef = useRef<HTMLDivElement>(null);\n useStickyBarTop(shellRef, props.stickyToolbar === true);\n const body = <ShellEmpty c={c} emptyState={emptyState} testIdPrefix={testIdPrefix} />;\n return (\n <TableFilter\n copy={copy.tableFilter} open={c.filterOpen} onOpenChange={c.setFilterOpen}\n hasActiveFilters={c.activeFilterCount > 0}\n >\n <Stack ref={shellRef} spacing={0} data-testid={dataTestId ? `${dataTestId}-container` : undefined} {...(props.stickyToolbar ? SHELL_PROPS : {})}>\n <GridHeaderRow title={props.title} headerActions={props.headerActions} testIdPrefix={testIdPrefix} />\n <ShellToolbar\n c={c}\n rows={props.rows}\n sortKinds={props.sortKinds}\n displayView={props.displayView}\n exportConfig={props.exportConfig}\n filterControls={\n inlineVisible ? (\n <InlineFilterControls\n {...filterProps} split={split} activeFilterCount={c.activeFilterCount}\n onControlOpenChange={onControlOpenChange}\n />\n ) : undefined\n }\n barRef={split.barRef}\n testIdPrefix={testIdPrefix}\n rowActions={props.rowActions}\n bulkActions={props.bulkActions}\n selectionExtra={resolveSelectionExtra(props)}\n allOnPageSelected={allOnPageSelected(c, props.getRowId)}\n toolbarRightSlot={props.toolbarRightSlot}\n compactControls={showInline && split.compactControls}\n counterHidden={filters.counterHidden}\n showInline={showInline}\n sticky={props.stickyToolbar === true}\n />\n <ScopeTabsSlot\n scopes={scopes} scopeFieldId={props.scopeFieldId} board={props.board}\n value={c.scope} onChange={c.setScope} counts={c.scopeCounts}\n testIdPrefix={testIdPrefix}\n />\n <TableFilter.Layout>\n <TableFilter.Main>\n <GridMain\n c={c}\n getRowId={props.getRowId}\n renderCard={props.renderCard}\n renderListRow={props.renderListRow}\n listGroup={props.listGroup}\n board={props.board}\n rowDetail={props.rowDetail} selectable={props.selectable !== false}\n dataTestId={dataTestId}\n testIdPrefix={testIdPrefix}\n emptyState={body}\n stickyHead={props.stickyToolbar === true}\n />\n <DataViewsPagination c={c} testIdPrefix={testIdPrefix} />\n </TableFilter.Main>\n {inlineFilters ? null : <GridFilterPanel {...filterProps} />}\n </TableFilter.Layout>\n {useModal && <FilterDialog open={c.filterOpen} onClose={() => c.setFilterOpen(false)} {...filterProps} />}\n </Stack>\n </TableFilter>\n );\n}\n\nexport function GridShell<T extends Record<string, unknown>>(props: GridShellProps<T>): React.JSX.Element {\n const {\n c,\n fields,\n rangeFields,\n testIdPrefix,\n renderCard,\n renderListRow,\n board,\n defaultLayout,\n ignoreStoredLayout,\n inlineFilters = false,\n alwaysShowSearch = false,\n } = props;\n const filters = useGridShellFilters({\n c,\n inlineFilters,\n fields,\n rangeFields,\n testIdPrefix,\n alwaysShowSearch,\n hasExport: props.exportConfig !== undefined,\n quickFilters: props.quickFilters ?? [],\n showCounter: props.showCounter !== false,\n });\n return (\n <DataViewsLayoutProvider\n canUseCards={Boolean(renderCard)}\n canUseList={Boolean(renderListRow)}\n // The board reuses the entity's card, so it needs BOTH — a `board` with no\n // `renderCard` offers no board rather than throwing.\n canUseBoard={Boolean(board && renderCard)}\n defaultLayout={defaultLayout}\n ignoreStoredLayout={ignoreStoredLayout}\n viewLayout={c.state.layout}\n >\n <LayoutStateSync c={c} />\n <ShellStack props={props} filters={filters} />\n </DataViewsLayoutProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,WAAW,QAAQ,gBAAgB;AAqR7B,cAwCL,YAxCK;AA7Nf,SAAS,gBAAmD;AAAA,EAC1D;AACF,GAES;AACP,QAAM,EAAE,OAAO,IAAI,mBAAmB;AACtC,QAAM,SAAS,EAAE,MAAM;AACvB,YAAU,MAAM;AACd,QAAI,WAAW,OAAQ,GAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EAE3C,GAAG,CAAC,QAAQ,MAAM,CAAC;AACnB,SAAO;AACT;AAyCA,SAAS,oBAAuD;AAAA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A;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,EACrB,IAAI;AACJ,QAAM,UAAU,oBAAoB;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,MAAM,iBAAiB;AAAA,IAClC,cAAc,MAAM,gBAAgB,CAAC;AAAA,IACrC,aAAa,MAAM,gBAAgB;AAAA,EACrC,CAAC;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,QAAQ,UAAU;AAAA,MAC/B,YAAY,QAAQ,aAAa;AAAA,MAGjC,aAAa,QAAQ,SAAS,UAAU;AAAA,MACxC;AAAA,MACA;AAAA,MACA,YAAY,EAAE,MAAM;AAAA,MAEtB;AAAA,4BAAC,mBAAgB,GAAM;AAAA,QACvB,oBAAC,cAAW,OAAc,SAAkB;AAAA;AAAA;AAAA,EAC5C;AAEJ;","names":["default"]}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
MoreGroup,
|
|
3
3
|
MoreQuick,
|
|
4
4
|
fieldClearing
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EYW6KXUC.js";
|
|
6
6
|
import {
|
|
7
7
|
useDataViewsCopy
|
|
8
8
|
} from "./chunk-KHG57NAE.js";
|
|
@@ -193,4 +193,4 @@ function MoreFilters({
|
|
|
193
193
|
export {
|
|
194
194
|
MoreFilters
|
|
195
195
|
};
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
196
|
+
//# sourceMappingURL=chunk-SAXALTRL.js.map
|