@gridui/data-explorer 1.4.0 → 2.0.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/README.md +25 -16
- package/dist/data-explorer/data-explorer.d.ts +8 -1
- package/dist/data-explorer-column-visibility/data-explorer-column-visibility.d.ts +7 -1
- package/dist/data-explorer-filter-control/data-explorer-filter-control.d.ts +7 -1
- package/dist/data-explorer-filters/data-explorer-filters.d.ts +9 -2
- package/dist/data-explorer-filters/filter-editor.d.ts +4 -1
- package/dist/data-explorer-provider/data-explorer-provider.d.ts +6 -0
- package/dist/data-explorer-search/data-explorer-search.d.ts +7 -1
- package/dist/data-explorer-sort/data-explorer-sort.d.ts +7 -1
- package/dist/data-explorer-table/column-layout.d.ts +0 -2
- package/dist/data-explorer-toolbar/data-explorer-toolbar.d.ts +7 -1
- package/dist/data-explorer-view/data-explorer-view.d.ts +9 -2
- package/dist/data-explorer-view/style.d.ts +1 -1
- package/dist/index.js +68 -30
- package/dist/index.js.map +4 -4
- package/dist/shared/controller.d.ts +6 -0
- package/dist/shared/explorer-context.d.ts +6 -0
- package/dist/shared/explorer-options.d.ts +2 -0
- package/dist/shared/label-style.d.ts +2 -2
- package/dist/shared/labels.d.ts +6 -0
- package/dist/shared/presentation.d.ts +14 -0
- package/dist/styled.js +8 -0
- package/dist/styles.css +3007 -2
- package/dist/styles.local.css +125 -0
- package/docs/catalog.json +3 -2
- package/docs/reference/data-explorer-bulk-actions.md +6 -0
- package/docs/reference/data-explorer-column-visibility.md +6 -0
- package/docs/reference/data-explorer-filter-control.md +6 -0
- package/docs/reference/data-explorer-filters.md +10 -0
- package/docs/reference/data-explorer-pagination.md +6 -0
- package/docs/reference/data-explorer-search.md +6 -0
- package/docs/reference/data-explorer-sort.md +6 -0
- package/docs/reference/data-explorer-table.md +11 -1
- package/docs/reference/data-explorer-toolbar.md +6 -0
- package/docs/reference/data-explorer-view.md +14 -0
- package/docs/reference/data-explorer.md +10 -0
- package/package.json +30 -12
package/README.md
CHANGED
|
@@ -3,40 +3,42 @@
|
|
|
3
3
|
Data family. Public API: `DataExplorerProvider`, `DataExplorerView`, `useDataExplorer`, `DataExplorerSearch`, `DataExplorerFilterControl`, `DataExplorerSort`, `DataExplorerColumnVisibility`, `DataExplorerFilters`, `DataExplorer`, `DataExplorerToolbar`, `DataExplorerBulkActions`, `DataExplorerTable`, `DataExplorerPagination`, `DataExplorerColumn`, `DataExplorerFilter`, `DataExplorerProps`, `DataExplorerRow`, `DataExplorerState`, `DataExplorerValue`.
|
|
4
4
|
|
|
5
5
|
Import components from `@gridui/data-explorer` and load `@gridui/data-explorer/styles.css` after Theme.
|
|
6
|
-
Load the
|
|
6
|
+
Load Theme and the self-contained family stylesheet:
|
|
7
7
|
```css
|
|
8
8
|
@import "@gridui/theme/styles.css";
|
|
9
|
-
@import "@gridui/button/styles.css";
|
|
10
|
-
@import "@gridui/form/styles.css";
|
|
11
|
-
@import "@gridui/choice/styles.css";
|
|
12
|
-
@import "@gridui/grid/styles.css";
|
|
13
|
-
@import "@gridui/overlay/styles.css";
|
|
14
|
-
@import "@gridui/input/styles.css";
|
|
15
|
-
@import "@gridui/dropdown-menu/styles.css";
|
|
16
|
-
@import "@gridui/select/styles.css";
|
|
17
|
-
@import "@gridui/table/styles.css";
|
|
18
9
|
@import "@gridui/data-explorer/styles.css";
|
|
10
|
+
@import "@gridui/dropdown-menu/styles.css"; // Required when composing DropdownMenu.
|
|
19
11
|
```
|
|
20
12
|
|
|
21
13
|
Applications own routes, labels, state persistence, and branding.
|
|
22
14
|
|
|
23
15
|
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-data/data-explorer/.changeset/history).
|
|
24
16
|
|
|
17
|
+
## Styles
|
|
18
|
+
|
|
19
|
+
Load Theme once. Use `@gridui/data-explorer/styled` for automatic component CSS in
|
|
20
|
+
CSS-aware bundlers, or keep the CSS-free root import and load `@gridui/data-explorer/styles.css`.
|
|
21
|
+
Both entries expose the same root API. The standalone stylesheet includes component
|
|
22
|
+
dependency styles; Theme/reset remain separate. See the
|
|
23
|
+
[integration guide](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/integration.md)
|
|
24
|
+
for static HTML loading, SSR limits, and avoiding duplicate CSS.
|
|
25
|
+
|
|
26
|
+
|
|
25
27
|
## Data exploration and supporting APIs
|
|
26
28
|
|
|
27
29
|
DataExplorer belongs to Data because it coordinates generic dataset exploration
|
|
28
|
-
through
|
|
30
|
+
through Controls, Layout regions, and DataTable. Composer and ApprovalPanel
|
|
29
31
|
remain Dashboard task compositions. See
|
|
30
32
|
[task workspace compositions](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/task-workspace.md) for controlled state,
|
|
31
33
|
callbacks, and application responsibilities.
|
|
32
34
|
|
|
33
|
-
Standalone [InlineNotice](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
34
|
-
[Collection items](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
35
|
-
[FollowScroll](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
36
|
-
[Breadcrumb/Pagination](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/navigation.md)
|
|
35
|
+
Standalone [InlineNotice](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-feedback/inline-notice/docs/inline-notice.md) comes from its Feedback family.
|
|
36
|
+
[Collection items](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/collection/docs/collection.md),
|
|
37
|
+
[FollowScroll](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/follow-scroll/docs/follow-scroll.md), and
|
|
38
|
+
[Breadcrumb/Pagination](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/navigation.md) belong to Data, Layout, and Navigation respectively.
|
|
37
39
|
|
|
38
40
|
Grid owns the structural seams between the header, content, selection toolbar,
|
|
39
|
-
and footer through `Split`.
|
|
41
|
+
and footer through `Split`. Grid styles are included in this family stylesheet.
|
|
40
42
|
|
|
41
43
|
DataTable receives `blockEdges="none"` and `inlineEdges="none"`: the enclosing
|
|
42
44
|
Explorer frame and Grid regions own those edges. Table retains internal column,
|
|
@@ -155,3 +157,10 @@ Column sizing composes the shared pointer session from React-utils. Capture
|
|
|
155
157
|
loss, Escape, window blur, pointer cancellation and becoming busy restore the
|
|
156
158
|
starting width. Unmount only releases resources and preserves the last emitted
|
|
157
159
|
width. Column geometry and RTL-aware keyboard behavior remain Explorer-owned.
|
|
160
|
+
|
|
161
|
+
## Sizing and density
|
|
162
|
+
|
|
163
|
+
DataExplorer and DataExplorerView accept size and density, defaulting to medium and comfortable. The private presentation scope reaches owned toolbar, selection, filter, bulk and pagination controls and table spacing. Relevant parts may override defaults. DataExplorerProvider/controller remain focused on dataset state; pixel column widths and resizing remain independent.
|
|
164
|
+
|
|
165
|
+
See the [shared sizing contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/usage/sizing.md)
|
|
166
|
+
for native attributes, scope precedence, tokens and target behavior.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorer
|
|
5
|
+
* @description Data Explorer
|
|
6
|
+
*/
|
|
7
|
+
import type { ExplorerPresentationOptions } from "../shared/presentation";
|
|
1
8
|
import type { ExplorerOptions } from "../shared/explorer-options";
|
|
2
9
|
import type { ComponentPropsWithRef, FC } from "react";
|
|
3
|
-
export type DataExplorerProps = ComponentPropsWithRef<"section"> & ExplorerOptions;
|
|
10
|
+
export type DataExplorerProps = ComponentPropsWithRef<"section"> & ExplorerOptions & ExplorerPresentationOptions;
|
|
4
11
|
/** The original ready-to-use composition remains a convenience over the parts. */
|
|
5
12
|
export declare const DataExplorer: FC<DataExplorerProps>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerColumnVisibility
|
|
5
|
+
* @description Data Explorer Column Visibility
|
|
6
|
+
*/
|
|
1
7
|
import type { ExplorerPartOptions } from "../shared/explorer-options";
|
|
2
8
|
export type DataExplorerColumnVisibilityProps = ExplorerPartOptions & {
|
|
3
9
|
readonly label?: string;
|
|
4
10
|
};
|
|
5
|
-
export declare function DataExplorerColumnVisibility({ label, className }: DataExplorerColumnVisibilityProps): import("react").JSX.Element | null;
|
|
11
|
+
export declare function DataExplorerColumnVisibility({ size: ownSize, label, className }: DataExplorerColumnVisibilityProps): import("react").JSX.Element | null;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerFilterControl
|
|
5
|
+
* @description Data Explorer Filter Control
|
|
6
|
+
*/
|
|
1
7
|
import type { ExplorerPartOptions } from "../shared/explorer-options";
|
|
2
8
|
export type DataExplorerFilterControlProps = ExplorerPartOptions & {
|
|
3
9
|
readonly allLabel: string;
|
|
4
10
|
};
|
|
5
|
-
export declare function DataExplorerFilterControl({ allLabel, className }: DataExplorerFilterControlProps): import("react").JSX.Element | null;
|
|
11
|
+
export declare function DataExplorerFilterControl({ size: ownSize, allLabel, className }: DataExplorerFilterControlProps): import("react").JSX.Element | null;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerFilters
|
|
5
|
+
* @description Data Explorer Filters
|
|
6
|
+
*/
|
|
7
|
+
import { type ExplorerPresentationOptions } from "../shared/presentation";
|
|
1
8
|
import type { DataExplorerFiltering } from "../shared/features";
|
|
2
|
-
export type DataExplorerFiltersProps = {
|
|
9
|
+
export type DataExplorerFiltersProps = ExplorerPresentationOptions & {
|
|
3
10
|
readonly labels?: DataExplorerFiltering["labels"];
|
|
4
11
|
};
|
|
5
|
-
export declare function DataExplorerFilters({ labels }: DataExplorerFiltersProps): import("react").JSX.Element | null;
|
|
12
|
+
export declare function DataExplorerFilters({ labels, size: ownSize, density: ownDensity }: DataExplorerFiltersProps): import("react").JSX.Element | null;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @author WMXPY
|
|
3
3
|
* @package Data Explorer
|
|
4
|
-
* @namespace
|
|
4
|
+
* @namespace DataExplorerFilters
|
|
5
5
|
* @description Filter Editor
|
|
6
6
|
*/
|
|
7
|
+
import type { Size, Density } from "@gridui/theme";
|
|
7
8
|
import type { DataExplorerFiltering } from "../shared/features";
|
|
8
9
|
import type { DataExplorerCondition } from "../shared/model";
|
|
9
10
|
import { type FC } from "react";
|
|
10
11
|
export type FilterEditorProps = {
|
|
12
|
+
readonly size: Size;
|
|
13
|
+
readonly density: Density;
|
|
11
14
|
readonly filtering: DataExplorerFiltering;
|
|
12
15
|
readonly conditions: readonly DataExplorerCondition[];
|
|
13
16
|
readonly disabled: boolean;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerProvider
|
|
5
|
+
* @description Data Explorer Provider
|
|
6
|
+
*/
|
|
1
7
|
import type { DataExplorerOptions } from "../shared/explorer-options";
|
|
2
8
|
import type { ReactNode } from "react";
|
|
3
9
|
export type DataExplorerProviderProps = DataExplorerOptions & {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerSearch
|
|
5
|
+
* @description Data Explorer Search
|
|
6
|
+
*/
|
|
1
7
|
import type { ExplorerPartOptions } from "../shared/explorer-options";
|
|
2
8
|
export type DataExplorerSearchProps = ExplorerPartOptions & {
|
|
3
9
|
readonly label: string;
|
|
4
10
|
};
|
|
5
|
-
export declare function DataExplorerSearch({ label, className }: DataExplorerSearchProps): import("react").JSX.Element;
|
|
11
|
+
export declare function DataExplorerSearch({ size: ownSize, label, className }: DataExplorerSearchProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerSort
|
|
5
|
+
* @description Data Explorer Sort
|
|
6
|
+
*/
|
|
1
7
|
import type { DataExplorerLabels, ExplorerPartOptions } from "../shared/explorer-options";
|
|
2
8
|
export type DataExplorerSortProps = ExplorerPartOptions & {
|
|
3
9
|
readonly labels: Pick<DataExplorerLabels, "sort" | "unsorted" | "ascending" | "descending">;
|
|
4
10
|
};
|
|
5
|
-
export declare function DataExplorerSort({ labels, className }: DataExplorerSortProps): import("react").JSX.Element;
|
|
11
|
+
export declare function DataExplorerSort({ size: ownSize, labels, className }: DataExplorerSortProps): import("react").JSX.Element;
|
|
@@ -8,7 +8,6 @@ import { type DataExplorerColumn } from "../shared/model";
|
|
|
8
8
|
type ColumnLayoutOptions = {
|
|
9
9
|
readonly columns: readonly DataExplorerColumn[];
|
|
10
10
|
readonly columnWidths: Readonly<Record<string, number>> | undefined;
|
|
11
|
-
readonly hasSelection: boolean;
|
|
12
11
|
readonly hasDetails: boolean;
|
|
13
12
|
};
|
|
14
13
|
type SizedColumn = {
|
|
@@ -20,7 +19,6 @@ type ColumnLayout = {
|
|
|
20
19
|
readonly stickyOffset: number;
|
|
21
20
|
})[];
|
|
22
21
|
readonly fixedWidths: boolean;
|
|
23
|
-
readonly selectionWidth: number;
|
|
24
22
|
readonly detailsWidth: number;
|
|
25
23
|
readonly tableWidth: number;
|
|
26
24
|
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerToolbar
|
|
5
|
+
* @description Data Explorer Toolbar
|
|
6
|
+
*/
|
|
1
7
|
import type { ExplorerPartOptions } from "../shared/explorer-options";
|
|
2
8
|
import type { ReactNode } from "react";
|
|
3
9
|
export type DataExplorerToolbarProps = ExplorerPartOptions & {
|
|
4
10
|
readonly children?: ReactNode;
|
|
5
11
|
};
|
|
6
|
-
export declare function DataExplorerToolbar({ className, children }: DataExplorerToolbarProps): import("react").JSX.Element;
|
|
12
|
+
export declare function DataExplorerToolbar({ size: ownSize, className, children }: DataExplorerToolbarProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorerView
|
|
5
|
+
* @description Data Explorer View
|
|
6
|
+
*/
|
|
7
|
+
import { type ExplorerPresentationOptions } from "../shared/presentation";
|
|
1
8
|
import type { ComponentPropsWithRef } from "react";
|
|
2
|
-
export type DataExplorerViewProps = ComponentPropsWithRef<"section"> & {
|
|
9
|
+
export type DataExplorerViewProps = ComponentPropsWithRef<"section"> & ExplorerPresentationOptions & {
|
|
3
10
|
readonly label: string;
|
|
4
11
|
};
|
|
5
12
|
/** Optional frame; the provider and custom controls do not depend on it. */
|
|
6
|
-
export declare function DataExplorerView({ label, className, children, ...rest }: DataExplorerViewProps): import("react").JSX.Element;
|
|
13
|
+
export declare function DataExplorerView({ label, className, children, size, density, ...rest }: DataExplorerViewProps): import("react").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
// src/shared/presentation.ts
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
var ExplorerPresentation = createContext({ size: "medium", density: "comfortable" });
|
|
4
|
+
var useExplorerPresentation = () => useContext(ExplorerPresentation);
|
|
5
|
+
var useExplorerSize = (size) => {
|
|
6
|
+
const inherited = useExplorerPresentation();
|
|
7
|
+
return size ?? inherited.size;
|
|
8
|
+
};
|
|
9
|
+
|
|
1
10
|
// src/shared/control-row-style.ts
|
|
2
11
|
import { cva } from "class-variance-authority";
|
|
3
|
-
var explorerControlRowStyles = cva("gridui-u-data-explorer--flex gridui-u-data-explorer--min-w-0 gridui-u-data-explorer--flex-wrap gridui-u-data-explorer--items-end gridui-u-data-explorer--gap-gridui-16 gridui-u-data-explorer--
|
|
12
|
+
var explorerControlRowStyles = cva("gridui-u-data-explorer--flex gridui-u-data-explorer--min-w-0 gridui-u-data-explorer--flex-wrap gridui-u-data-explorer--items-end gridui-u-data-explorer--gap-gridui-16 gridui-u-data-explorer--px-gridui-16 gridui-u-data-explorer--py-(--gridui-explorer-row-block,var(--gridui-space-16))");
|
|
4
13
|
|
|
5
14
|
// src/shared/model.ts
|
|
6
15
|
var compareValues = (left, right, direction) => {
|
|
@@ -172,15 +181,15 @@ var createExplorerController = (options) => {
|
|
|
172
181
|
};
|
|
173
182
|
|
|
174
183
|
// src/shared/explorer-context.ts
|
|
175
|
-
import { createContext, useContext, useId } from "react";
|
|
184
|
+
import { createContext as createContext2, useContext as useContext2, useId } from "react";
|
|
176
185
|
var useExplorerController = (options) => {
|
|
177
186
|
const tableId = useId();
|
|
178
187
|
const controller = createExplorerController(options);
|
|
179
188
|
return { ...options, ...controller, tableId, controller };
|
|
180
189
|
};
|
|
181
|
-
var explorerContext =
|
|
190
|
+
var explorerContext = createContext2(null);
|
|
182
191
|
var useExplorer = () => {
|
|
183
|
-
const explorer =
|
|
192
|
+
const explorer = useContext2(explorerContext);
|
|
184
193
|
if (!explorer) {
|
|
185
194
|
throw new Error("DataExplorer parts require a DataExplorerProvider or DataExplorer.");
|
|
186
195
|
}
|
|
@@ -203,6 +212,7 @@ import { Checkbox } from "@gridui/choice";
|
|
|
203
212
|
import { cn } from "@gridui/style-utils";
|
|
204
213
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
205
214
|
var DataExplorerBulkActions = (props) => {
|
|
215
|
+
const size = useExplorerSize(props.size);
|
|
206
216
|
const { actions = [], busy, labels: inheritedLabels, onSelectionChange, pageIds, selectedPageCount, selectedRowIds } = useExplorer();
|
|
207
217
|
const labels = { ...inheritedLabels, ...props.labels };
|
|
208
218
|
if (!onSelectionChange) {
|
|
@@ -217,6 +227,7 @@ var DataExplorerBulkActions = (props) => {
|
|
|
217
227
|
/* @__PURE__ */ jsx(
|
|
218
228
|
Checkbox,
|
|
219
229
|
{
|
|
230
|
+
size,
|
|
220
231
|
checked: pageIds.length > 0 && selectedPageCount === pageIds.length,
|
|
221
232
|
indeterminate: selectedPageCount > 0 && selectedPageCount < pageIds.length,
|
|
222
233
|
disabled: busy || pageIds.length === 0,
|
|
@@ -239,6 +250,7 @@ var DataExplorerBulkActions = (props) => {
|
|
|
239
250
|
return /* @__PURE__ */ jsx(
|
|
240
251
|
Button,
|
|
241
252
|
{
|
|
253
|
+
size,
|
|
242
254
|
variant: "secondary",
|
|
243
255
|
disabled: busy || selectedRowIds.length === 0 || action.disabled,
|
|
244
256
|
onClick: () => {
|
|
@@ -261,6 +273,7 @@ import { cva as cva2 } from "class-variance-authority";
|
|
|
261
273
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
262
274
|
var explorerFooterStyles = cva2("gridui-u-data-explorer--flex gridui-u-data-explorer--flex-wrap gridui-u-data-explorer--items-center gridui-u-data-explorer--justify-between gridui-u-data-explorer--gap-gridui-8 gridui-u-data-explorer--p-gridui-16");
|
|
263
275
|
var DataExplorerPagination = (props) => {
|
|
276
|
+
const size = useExplorerSize(props.size);
|
|
264
277
|
const { busy, labels: inheritedLabels, updateState, view } = useExplorer();
|
|
265
278
|
const labels = { ...inheritedLabels, ...props.labels };
|
|
266
279
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -271,6 +284,7 @@ var DataExplorerPagination = (props) => {
|
|
|
271
284
|
/* @__PURE__ */ jsx2(
|
|
272
285
|
Button2,
|
|
273
286
|
{
|
|
287
|
+
size,
|
|
274
288
|
variant: "secondary",
|
|
275
289
|
disabled: busy || view.page === 0,
|
|
276
290
|
onClick: () => {
|
|
@@ -289,6 +303,7 @@ var DataExplorerPagination = (props) => {
|
|
|
289
303
|
/* @__PURE__ */ jsx2(
|
|
290
304
|
Button2,
|
|
291
305
|
{
|
|
306
|
+
size,
|
|
292
307
|
variant: "secondary",
|
|
293
308
|
disabled: busy || view.page + 1 >= view.pageCount,
|
|
294
309
|
onClick: () => {
|
|
@@ -327,7 +342,7 @@ var calculateStickyOffset = (columns, index) => {
|
|
|
327
342
|
}, 0);
|
|
328
343
|
};
|
|
329
344
|
var calculateColumnLayout = (options) => {
|
|
330
|
-
const { columns, columnWidths,
|
|
345
|
+
const { columns, columnWidths, hasDetails } = options;
|
|
331
346
|
const fixedWidths = columnWidths !== void 0 || columns.some((column) => {
|
|
332
347
|
return column.width !== void 0 || column.sticky !== void 0;
|
|
333
348
|
});
|
|
@@ -337,7 +352,6 @@ var calculateColumnLayout = (options) => {
|
|
|
337
352
|
width: resolveExplorerWidth(column, columnWidths?.[column.key] ?? column.width)
|
|
338
353
|
};
|
|
339
354
|
});
|
|
340
|
-
const selectionWidth = hasSelection ? 56 : 0;
|
|
341
355
|
const detailsWidth = hasDetails ? 96 : 0;
|
|
342
356
|
const dataWidth = sizedColumns.reduce((total, column) => {
|
|
343
357
|
return total + column.width;
|
|
@@ -350,9 +364,8 @@ var calculateColumnLayout = (options) => {
|
|
|
350
364
|
};
|
|
351
365
|
}),
|
|
352
366
|
fixedWidths,
|
|
353
|
-
selectionWidth,
|
|
354
367
|
detailsWidth,
|
|
355
|
-
tableWidth: dataWidth +
|
|
368
|
+
tableWidth: dataWidth + detailsWidth
|
|
356
369
|
};
|
|
357
370
|
};
|
|
358
371
|
|
|
@@ -448,7 +461,8 @@ import { DataTable } from "@gridui/table";
|
|
|
448
461
|
import { Children } from "react";
|
|
449
462
|
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
450
463
|
var DataExplorerTable = (props) => {
|
|
451
|
-
const
|
|
464
|
+
const inherited = useExplorerPresentation();
|
|
465
|
+
const { className, labels: ownLabels, size = inherited.size, density = inherited.density, ...presentation } = props;
|
|
452
466
|
const {
|
|
453
467
|
busy,
|
|
454
468
|
columnSizing,
|
|
@@ -467,12 +481,13 @@ var DataExplorerTable = (props) => {
|
|
|
467
481
|
const hasNotice = Children.toArray(notice).some((child) => {
|
|
468
482
|
return child !== "";
|
|
469
483
|
});
|
|
470
|
-
const { columns, fixedWidths,
|
|
484
|
+
const { columns, fixedWidths, detailsWidth, tableWidth } = calculateColumnLayout({
|
|
471
485
|
columns: visibleColumns,
|
|
472
486
|
columnWidths: columnSizing?.widths,
|
|
473
|
-
hasSelection: onSelectionChange !== void 0,
|
|
474
487
|
hasDetails: details !== void 0
|
|
475
488
|
});
|
|
489
|
+
const selectionColumnWidth = `calc(max(var(--gridui-control-min-height-${size}), var(--gridui-target-min-size)) + 2 * var(--gridui-table-cell-padding-inline, var(--gridui-space-16)) + 2px)`;
|
|
490
|
+
const resolvedTableWidth = onSelectionChange ? `calc(${tableWidth}px + ${selectionColumnWidth})` : tableWidth;
|
|
476
491
|
const tableColumns = columns.map(({ column, width, stickyOffset }) => {
|
|
477
492
|
return {
|
|
478
493
|
key: `column:${column.key}`,
|
|
@@ -521,7 +536,7 @@ var DataExplorerTable = (props) => {
|
|
|
521
536
|
tableColumns.unshift({
|
|
522
537
|
key: "control:selection",
|
|
523
538
|
label: explorerLabel(labels, "selection"),
|
|
524
|
-
...fixedWidths ? { sizing: { width:
|
|
539
|
+
...fixedWidths ? { sizing: { width: selectionColumnWidth } } : {}
|
|
525
540
|
});
|
|
526
541
|
}
|
|
527
542
|
if (details) {
|
|
@@ -546,6 +561,7 @@ var DataExplorerTable = (props) => {
|
|
|
546
561
|
cells.unshift(/* @__PURE__ */ jsx5(
|
|
547
562
|
Checkbox2,
|
|
548
563
|
{
|
|
564
|
+
size,
|
|
549
565
|
"aria-label": explorerLabel(labels, "selectRow")(row),
|
|
550
566
|
checked: selectedRowIdSet.has(row.id),
|
|
551
567
|
disabled: busy,
|
|
@@ -562,6 +578,7 @@ var DataExplorerTable = (props) => {
|
|
|
562
578
|
cells.unshift(/* @__PURE__ */ jsx5(
|
|
563
579
|
Button3,
|
|
564
580
|
{
|
|
581
|
+
size,
|
|
565
582
|
variant: "quiet",
|
|
566
583
|
disabled: busy,
|
|
567
584
|
"aria-expanded": expanded,
|
|
@@ -604,6 +621,7 @@ var DataExplorerTable = (props) => {
|
|
|
604
621
|
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(
|
|
605
622
|
DataTable,
|
|
606
623
|
{
|
|
624
|
+
density,
|
|
607
625
|
...presentation,
|
|
608
626
|
label: explorerLabel(labels, "table"),
|
|
609
627
|
variant: "structured",
|
|
@@ -613,10 +631,10 @@ var DataExplorerTable = (props) => {
|
|
|
613
631
|
rows: tableRows,
|
|
614
632
|
...fixedWidths ? {
|
|
615
633
|
style: {
|
|
616
|
-
width:
|
|
634
|
+
width: resolvedTableWidth,
|
|
617
635
|
tableLayout: "fixed"
|
|
618
636
|
},
|
|
619
|
-
minWidth:
|
|
637
|
+
minWidth: resolvedTableWidth
|
|
620
638
|
} : {}
|
|
621
639
|
}
|
|
622
640
|
) }),
|
|
@@ -637,7 +655,8 @@ var DataExplorerTable = (props) => {
|
|
|
637
655
|
import { Checkbox as Checkbox3 } from "@gridui/choice";
|
|
638
656
|
import { cn as cn4 } from "@gridui/style-utils";
|
|
639
657
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
640
|
-
function DataExplorerColumnVisibility({ label, className }) {
|
|
658
|
+
function DataExplorerColumnVisibility({ size: ownSize, label, className }) {
|
|
659
|
+
const size = useExplorerSize(ownSize);
|
|
641
660
|
const { busy, columnSettings, columns, visibleColumns } = useExplorer();
|
|
642
661
|
if (!columnSettings) {
|
|
643
662
|
return null;
|
|
@@ -650,6 +669,7 @@ function DataExplorerColumnVisibility({ label, className }) {
|
|
|
650
669
|
/* @__PURE__ */ jsx6(
|
|
651
670
|
Checkbox3,
|
|
652
671
|
{
|
|
672
|
+
size,
|
|
653
673
|
checked: visible,
|
|
654
674
|
disabled: busy || visible && visibleColumns.length === 1,
|
|
655
675
|
onCheckedChange: (checked) => void columnSettings.onHiddenKeysChange(checked ? columnSettings.hiddenKeys.filter((key) => key !== column.key) : [.../* @__PURE__ */ new Set([...columnSettings.hiddenKeys, column.key])])
|
|
@@ -669,7 +689,8 @@ var explorerLabelStyles = cva3("gridui-u-data-explorer--flex gridui-u-data-explo
|
|
|
669
689
|
import { Select } from "@gridui/select";
|
|
670
690
|
import { cn as cn5 } from "@gridui/style-utils";
|
|
671
691
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
672
|
-
function DataExplorerFilterControl({ allLabel, className }) {
|
|
692
|
+
function DataExplorerFilterControl({ size: ownSize, allLabel, className }) {
|
|
693
|
+
const size = useExplorerSize(ownSize);
|
|
673
694
|
const { busy, filter, state, setFilterValue } = useExplorer();
|
|
674
695
|
if (!filter) {
|
|
675
696
|
return null;
|
|
@@ -679,6 +700,7 @@ function DataExplorerFilterControl({ allLabel, className }) {
|
|
|
679
700
|
/* @__PURE__ */ jsx7(
|
|
680
701
|
Select,
|
|
681
702
|
{
|
|
703
|
+
size,
|
|
682
704
|
"aria-label": filter.label,
|
|
683
705
|
value: state.filterValue,
|
|
684
706
|
disabled: busy,
|
|
@@ -696,7 +718,7 @@ import { Select as Select2 } from "@gridui/select";
|
|
|
696
718
|
import { useId as useId2, useRef } from "react";
|
|
697
719
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
698
720
|
var FilterEditor = (props) => {
|
|
699
|
-
const { filtering, conditions, disabled, onChange } = props;
|
|
721
|
+
const { size, density, filtering, conditions, disabled, onChange } = props;
|
|
700
722
|
const id = useId2();
|
|
701
723
|
const sequence = useRef(0);
|
|
702
724
|
const addButton = useRef(null);
|
|
@@ -707,7 +729,7 @@ var FilterEditor = (props) => {
|
|
|
707
729
|
return currentIndex === index ? condition : current;
|
|
708
730
|
}));
|
|
709
731
|
};
|
|
710
|
-
return /* @__PURE__ */ jsxs6("div", { children: [
|
|
732
|
+
return /* @__PURE__ */ jsxs6("div", { className: "gridui-explorer-filters", "data-density": density, children: [
|
|
711
733
|
conditions.map((condition, index) => {
|
|
712
734
|
const definition = definitions.find((entry) => {
|
|
713
735
|
return entry.key === condition.key;
|
|
@@ -748,6 +770,7 @@ var FilterEditor = (props) => {
|
|
|
748
770
|
/* @__PURE__ */ jsx8(
|
|
749
771
|
Select2,
|
|
750
772
|
{
|
|
773
|
+
size,
|
|
751
774
|
"aria-label": labels.field,
|
|
752
775
|
disabled,
|
|
753
776
|
value: condition.key,
|
|
@@ -782,6 +805,7 @@ var FilterEditor = (props) => {
|
|
|
782
805
|
/* @__PURE__ */ jsx8(
|
|
783
806
|
Select2,
|
|
784
807
|
{
|
|
808
|
+
size,
|
|
785
809
|
"aria-label": labels.operator,
|
|
786
810
|
disabled,
|
|
787
811
|
value: condition.operator,
|
|
@@ -816,6 +840,7 @@ var FilterEditor = (props) => {
|
|
|
816
840
|
definition?.type === "enum" ? /* @__PURE__ */ jsx8(
|
|
817
841
|
Select2,
|
|
818
842
|
{
|
|
843
|
+
size,
|
|
819
844
|
"aria-label": labels.value,
|
|
820
845
|
disabled,
|
|
821
846
|
value: String(condition.value ?? ""),
|
|
@@ -831,6 +856,7 @@ var FilterEditor = (props) => {
|
|
|
831
856
|
) : /* @__PURE__ */ jsx8(
|
|
832
857
|
Input,
|
|
833
858
|
{
|
|
859
|
+
size,
|
|
834
860
|
"aria-label": labels.value,
|
|
835
861
|
disabled,
|
|
836
862
|
type: definition?.type === "number" ? "number" : "text",
|
|
@@ -850,6 +876,7 @@ var FilterEditor = (props) => {
|
|
|
850
876
|
/* @__PURE__ */ jsx8(
|
|
851
877
|
Button4,
|
|
852
878
|
{
|
|
879
|
+
size,
|
|
853
880
|
variant: "quiet",
|
|
854
881
|
disabled,
|
|
855
882
|
onClick: () => {
|
|
@@ -873,6 +900,7 @@ var FilterEditor = (props) => {
|
|
|
873
900
|
children: /* @__PURE__ */ jsx8(
|
|
874
901
|
Button4,
|
|
875
902
|
{
|
|
903
|
+
size,
|
|
876
904
|
ref: addButton,
|
|
877
905
|
variant: "secondary",
|
|
878
906
|
disabled: disabled || !first,
|
|
@@ -901,7 +929,10 @@ var FilterEditor = (props) => {
|
|
|
901
929
|
|
|
902
930
|
// src/data-explorer-filters/data-explorer-filters.tsx
|
|
903
931
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
904
|
-
function DataExplorerFilters({ labels }) {
|
|
932
|
+
function DataExplorerFilters({ labels, size: ownSize, density: ownDensity }) {
|
|
933
|
+
const presentation = useExplorerPresentation();
|
|
934
|
+
const size = ownSize ?? presentation.size;
|
|
935
|
+
const density = ownDensity ?? presentation.density;
|
|
905
936
|
const { busy, filtering, state, setFilters } = useExplorer();
|
|
906
937
|
if (!filtering) {
|
|
907
938
|
return null;
|
|
@@ -909,6 +940,8 @@ function DataExplorerFilters({ labels }) {
|
|
|
909
940
|
return /* @__PURE__ */ jsx9(
|
|
910
941
|
FilterEditor,
|
|
911
942
|
{
|
|
943
|
+
size,
|
|
944
|
+
density,
|
|
912
945
|
filtering: labels ? { ...filtering, labels } : filtering,
|
|
913
946
|
conditions: state.filters ?? [],
|
|
914
947
|
disabled: busy,
|
|
@@ -921,13 +954,15 @@ function DataExplorerFilters({ labels }) {
|
|
|
921
954
|
import { Input as Input2 } from "@gridui/input";
|
|
922
955
|
import { cn as cn6 } from "@gridui/style-utils";
|
|
923
956
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
924
|
-
function DataExplorerSearch({ label, className }) {
|
|
957
|
+
function DataExplorerSearch({ size: ownSize, label, className }) {
|
|
958
|
+
const size = useExplorerSize(ownSize);
|
|
925
959
|
const { busy, state, setQuery } = useExplorer();
|
|
926
960
|
return /* @__PURE__ */ jsxs7("label", { className: cn6(explorerLabelStyles(), className), children: [
|
|
927
961
|
label,
|
|
928
962
|
/* @__PURE__ */ jsx10(
|
|
929
963
|
Input2,
|
|
930
964
|
{
|
|
965
|
+
size,
|
|
931
966
|
type: "search",
|
|
932
967
|
value: state.query,
|
|
933
968
|
disabled: busy,
|
|
@@ -942,7 +977,8 @@ import { Button as Button5 } from "@gridui/button";
|
|
|
942
977
|
import { Select as Select3 } from "@gridui/select";
|
|
943
978
|
import { cn as cn7 } from "@gridui/style-utils";
|
|
944
979
|
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
945
|
-
function DataExplorerSort({ labels, className }) {
|
|
980
|
+
function DataExplorerSort({ size: ownSize, labels, className }) {
|
|
981
|
+
const size = useExplorerSize(ownSize);
|
|
946
982
|
const { busy, columns, state, setSort } = useExplorer();
|
|
947
983
|
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
948
984
|
/* @__PURE__ */ jsxs8("label", { className: cn7(explorerLabelStyles(), className), children: [
|
|
@@ -950,6 +986,7 @@ function DataExplorerSort({ labels, className }) {
|
|
|
950
986
|
/* @__PURE__ */ jsx11(
|
|
951
987
|
Select3,
|
|
952
988
|
{
|
|
989
|
+
size,
|
|
953
990
|
"aria-label": labels.sort,
|
|
954
991
|
value: state.sort?.key ?? "",
|
|
955
992
|
disabled: busy,
|
|
@@ -958,7 +995,7 @@ function DataExplorerSort({ labels, className }) {
|
|
|
958
995
|
}
|
|
959
996
|
)
|
|
960
997
|
] }),
|
|
961
|
-
/* @__PURE__ */ jsx11(Button5, { variant: "secondary", disabled: busy || !state.sort, onClick: () => {
|
|
998
|
+
/* @__PURE__ */ jsx11(Button5, { size, variant: "secondary", disabled: busy || !state.sort, onClick: () => {
|
|
962
999
|
if (state.sort) {
|
|
963
1000
|
setSort({ ...state.sort, direction: state.sort.direction === "ascending" ? "descending" : "ascending" });
|
|
964
1001
|
}
|
|
@@ -969,24 +1006,25 @@ function DataExplorerSort({ labels, className }) {
|
|
|
969
1006
|
// src/data-explorer-toolbar/data-explorer-toolbar.tsx
|
|
970
1007
|
import { cn as cn8 } from "@gridui/style-utils";
|
|
971
1008
|
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
972
|
-
function DataExplorerToolbar({ className, children }) {
|
|
1009
|
+
function DataExplorerToolbar({ size: ownSize, className, children }) {
|
|
1010
|
+
const size = useExplorerSize(ownSize);
|
|
973
1011
|
const { labels, filter } = useExplorer();
|
|
974
1012
|
if (children !== void 0) {
|
|
975
1013
|
return /* @__PURE__ */ jsx12("div", { className: cn8(explorerControlRowStyles(), className), children });
|
|
976
1014
|
}
|
|
977
1015
|
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
978
1016
|
/* @__PURE__ */ jsxs9("div", { className: cn8(explorerControlRowStyles(), className), children: [
|
|
979
|
-
/* @__PURE__ */ jsx12(DataExplorerSearch, { label: explorerLabel(labels, "search") }),
|
|
980
|
-
filter && /* @__PURE__ */ jsx12(DataExplorerFilterControl, { allLabel: explorerLabel(labels, "all") }),
|
|
981
|
-
/* @__PURE__ */ jsx12(DataExplorerSort, { labels: {
|
|
1017
|
+
/* @__PURE__ */ jsx12(DataExplorerSearch, { size, label: explorerLabel(labels, "search") }),
|
|
1018
|
+
filter && /* @__PURE__ */ jsx12(DataExplorerFilterControl, { size, allLabel: explorerLabel(labels, "all") }),
|
|
1019
|
+
/* @__PURE__ */ jsx12(DataExplorerSort, { size, labels: {
|
|
982
1020
|
sort: explorerLabel(labels, "sort"),
|
|
983
1021
|
unsorted: explorerLabel(labels, "unsorted"),
|
|
984
1022
|
ascending: explorerLabel(labels, "ascending"),
|
|
985
1023
|
descending: explorerLabel(labels, "descending")
|
|
986
1024
|
} })
|
|
987
1025
|
] }),
|
|
988
|
-
/* @__PURE__ */ jsx12(DataExplorerColumnVisibility, {}),
|
|
989
|
-
/* @__PURE__ */ jsx12(DataExplorerFilters, {})
|
|
1026
|
+
/* @__PURE__ */ jsx12(DataExplorerColumnVisibility, { size }),
|
|
1027
|
+
/* @__PURE__ */ jsx12(DataExplorerFilters, { size })
|
|
990
1028
|
] });
|
|
991
1029
|
}
|
|
992
1030
|
|
|
@@ -998,8 +1036,8 @@ var explorerStyles = cva4("gridui-u-data-explorer--min-w-0 gridui-u-data-explore
|
|
|
998
1036
|
import { Split as Split2 } from "@gridui/grid";
|
|
999
1037
|
import { cn as cn9 } from "@gridui/style-utils";
|
|
1000
1038
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1001
|
-
function DataExplorerView({ label, className, children, ...rest }) {
|
|
1002
|
-
return /* @__PURE__ */ jsx13("section", { ...rest, "aria-label": label, className: cn9(explorerStyles(), className), children: /* @__PURE__ */ jsx13(Split2, { direction: "column", children }) });
|
|
1039
|
+
function DataExplorerView({ label, className, children, size = "medium", density = "comfortable", ...rest }) {
|
|
1040
|
+
return /* @__PURE__ */ jsx13(ExplorerPresentation, { value: { size, density }, children: /* @__PURE__ */ jsx13("section", { ...rest, "aria-label": label, className: cn9(explorerStyles(), className), children: /* @__PURE__ */ jsx13(Split2, { direction: "column", children }) }) });
|
|
1003
1041
|
}
|
|
1004
1042
|
|
|
1005
1043
|
// src/data-explorer/data-explorer.tsx
|