@gears-frontx/ui-kit 0.4.0-alpha.7 → 0.4.1
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/NOTICE +1 -0
- package/README.md +2 -1
- package/dist/chunks/data-grid.DIkpRRaf.css +1 -0
- package/dist/chunks/deep-equal.js +15 -0
- package/dist/chunks/deep-equal.js.map +1 -0
- package/dist/chunks/messages.js +42 -0
- package/dist/chunks/messages.js.map +1 -0
- package/dist/chunks/order.D7Jg_Mg8.css +1 -0
- package/dist/chunks/pagination.Cn8tIWMX.css +1 -0
- package/dist/chunks/plugins-helpers.js +41 -0
- package/dist/chunks/plugins-helpers.js.map +1 -0
- package/dist/chunks/segment.js +18 -0
- package/dist/chunks/segment.js.map +1 -0
- package/dist/chunks/text-search.BeZYac6V.css +1 -0
- package/dist/components/data-grid/components/data-grid-content.d.ts +3 -0
- package/dist/components/data-grid/components/data-grid-content.d.ts.map +1 -0
- package/dist/components/data-grid/components/data-grid-empty-state.d.ts +3 -0
- package/dist/components/data-grid/components/data-grid-empty-state.d.ts.map +1 -0
- package/dist/components/data-grid/components/data-grid-spinner.d.ts +16 -0
- package/dist/components/data-grid/components/data-grid-spinner.d.ts.map +1 -0
- package/dist/components/data-grid/components/load-controlled.d.ts +15 -0
- package/dist/components/data-grid/components/load-controlled.d.ts.map +1 -0
- package/dist/components/data-grid/components/segment.d.ts +15 -0
- package/dist/components/data-grid/components/segment.d.ts.map +1 -0
- package/dist/components/data-grid/create-data-grid.d.ts +4 -0
- package/dist/components/data-grid/create-data-grid.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid-types.d.ts +142 -0
- package/dist/components/data-grid/data-grid-types.d.ts.map +1 -0
- package/dist/components/data-grid/data-grid.d.ts +3 -0
- package/dist/components/data-grid/data-grid.d.ts.map +1 -0
- package/dist/components/data-grid/messages.d.ts +39 -0
- package/dist/components/data-grid/messages.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/empty-state/empty-state-plugin.d.ts +5 -0
- package/dist/components/data-grid/plugins/empty-state/empty-state-plugin.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/empty-state/empty-state-types.d.ts +14 -0
- package/dist/components/data-grid/plugins/empty-state/empty-state-types.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/empty-state/public.d.ts +3 -0
- package/dist/components/data-grid/plugins/empty-state/public.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts +3 -0
- package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/components/data-grid-order-header-cell-label.d.ts +8 -0
- package/dist/components/data-grid/plugins/order/components/data-grid-order-header-cell-label.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/components/data-grid-order-icon.d.ts +7 -0
- package/dist/components/data-grid/plugins/order/components/data-grid-order-icon.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/order-plugin.d.ts +4 -0
- package/dist/components/data-grid/plugins/order/order-plugin.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/order-types.d.ts +66 -0
- package/dist/components/data-grid/plugins/order/order-types.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/public.d.ts +5 -0
- package/dist/components/data-grid/plugins/order/public.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/services/order-labels.d.ts +8 -0
- package/dist/components/data-grid/plugins/order/services/order-labels.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/order/services/order-option.d.ts +3 -0
- package/dist/components/data-grid/plugins/order/services/order-option.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts +3 -0
- package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/pagination/components/pager.d.ts +22 -0
- package/dist/components/data-grid/plugins/pagination/components/pager.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/pagination/pagination-plugin.d.ts +31 -0
- package/dist/components/data-grid/plugins/pagination/pagination-plugin.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/pagination/public.d.ts +3 -0
- package/dist/components/data-grid/plugins/pagination/public.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/pagination/services/pagination-items.d.ts +14 -0
- package/dist/components/data-grid/plugins/pagination/services/pagination-items.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/text-search/components/data-grid-text-search.d.ts +3 -0
- package/dist/components/data-grid/plugins/text-search/components/data-grid-text-search.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/text-search/public.d.ts +3 -0
- package/dist/components/data-grid/plugins/text-search/public.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/text-search/text-search-plugin.d.ts +38 -0
- package/dist/components/data-grid/plugins/text-search/text-search-plugin.d.ts.map +1 -0
- package/dist/components/data-grid/public.d.ts +12 -0
- package/dist/components/data-grid/public.d.ts.map +1 -0
- package/dist/components/data-grid/services/columns/create-column-auto-size.d.ts +7 -0
- package/dist/components/data-grid/services/columns/create-column-auto-size.d.ts.map +1 -0
- package/dist/components/data-grid/services/core/core-service.d.ts +3 -0
- package/dist/components/data-grid/services/core/core-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/core/core-types.d.ts +28 -0
- package/dist/components/data-grid/services/core/core-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/core/data-grid-context.d.ts +17 -0
- package/dist/components/data-grid/services/core/data-grid-context.d.ts.map +1 -0
- package/dist/components/data-grid/services/hooked/hooked-types.d.ts +34 -0
- package/dist/components/data-grid/services/hooked/hooked-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/hooked/hooked.d.ts +4 -0
- package/dist/components/data-grid/services/hooked/hooked.d.ts.map +1 -0
- package/dist/components/data-grid/services/internal/internal-helpers.d.ts +2 -0
- package/dist/components/data-grid/services/internal/internal-helpers.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-content.d.ts +7 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-content.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-main-slot-selector.d.ts +4 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-main-slot-selector.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-main.d.ts +3 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-main.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-slot.d.ts +7 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-slot.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-top-default.d.ts +3 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-top-default.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-top.d.ts +3 -0
- package/dist/components/data-grid/services/layout/components/data-grid-layout-top.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/data-grid-view.d.ts +16 -0
- package/dist/components/data-grid/services/layout/data-grid-view.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/layout-service.d.ts +4 -0
- package/dist/components/data-grid/services/layout/layout-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/layout-slot-ids.d.ts +3 -0
- package/dist/components/data-grid/services/layout/layout-slot-ids.d.ts.map +1 -0
- package/dist/components/data-grid/services/layout/layout-types.d.ts +74 -0
- package/dist/components/data-grid/services/layout/layout-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/load/load-instance.d.ts +4 -0
- package/dist/components/data-grid/services/load/load-instance.d.ts.map +1 -0
- package/dist/components/data-grid/services/load/load-service.d.ts +4 -0
- package/dist/components/data-grid/services/load/load-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/load/load-types.d.ts +76 -0
- package/dist/components/data-grid/services/load/load-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/load/use-data-grid-loading.d.ts +16 -0
- package/dist/components/data-grid/services/load/use-data-grid-loading.d.ts.map +1 -0
- package/dist/components/data-grid/services/persistent-state/persistent-state-service.d.ts +4 -0
- package/dist/components/data-grid/services/persistent-state/persistent-state-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/persistent-state/persistent-state-types.d.ts +36 -0
- package/dist/components/data-grid/services/persistent-state/persistent-state-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/plugins/plugins-helpers.d.ts +49 -0
- package/dist/components/data-grid/services/plugins/plugins-helpers.d.ts.map +1 -0
- package/dist/components/data-grid/services/plugins/plugins-service.d.ts +4 -0
- package/dist/components/data-grid/services/plugins/plugins-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/plugins/plugins-types.d.ts +62 -0
- package/dist/components/data-grid/services/plugins/plugins-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/storage/storage-helpers.d.ts +4 -0
- package/dist/components/data-grid/services/storage/storage-helpers.d.ts.map +1 -0
- package/dist/components/data-grid/services/storage/storage-service.d.ts +4 -0
- package/dist/components/data-grid/services/storage/storage-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/storage/storage-types.d.ts +93 -0
- package/dist/components/data-grid/services/storage/storage-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-body-cell-content.d.ts +9 -0
- package/dist/components/data-grid/services/table/components/data-grid-body-cell-content.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-cell.d.ts +57 -0
- package/dist/components/data-grid/services/table/components/data-grid-cell.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-content.d.ts +7 -0
- package/dist/components/data-grid/services/table/components/data-grid-content.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-extra-body-columns.d.ts +8 -0
- package/dist/components/data-grid/services/table/components/data-grid-extra-body-columns.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-extra-header-cell.d.ts +12 -0
- package/dist/components/data-grid/services/table/components/data-grid-extra-header-cell.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-extra-header-columns.d.ts +10 -0
- package/dist/components/data-grid/services/table/components/data-grid-extra-header-columns.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-cell-content.d.ts +7 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-cell-content.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-cell-label.d.ts +8 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-cell-label.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-cell.d.ts +11 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-cell.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-group.d.ts +10 -0
- package/dist/components/data-grid/services/table/components/data-grid-header-group.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-row.d.ts +8 -0
- package/dist/components/data-grid/services/table/components/data-grid-row.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-body.d.ts +3 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-body.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-header.d.ts +3 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-header.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-record.d.ts +8 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-record.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-records.d.ts +8 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-records.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-slot.d.ts +7 -0
- package/dist/components/data-grid/services/table/components/data-grid-table-slot.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table.d.ts +3 -0
- package/dist/components/data-grid/services/table/components/data-grid-table.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/data-grid-record-context.d.ts +5 -0
- package/dist/components/data-grid/services/table/data-grid-record-context.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/ignore-row-click.d.ts +2 -0
- package/dist/components/data-grid/services/table/ignore-row-click.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/resolve-body-cell-props.d.ts +21 -0
- package/dist/components/data-grid/services/table/resolve-body-cell-props.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/resolve-column-style.d.ts +62 -0
- package/dist/components/data-grid/services/table/resolve-column-style.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-columns-persistence.d.ts +19 -0
- package/dist/components/data-grid/services/table/table-columns-persistence.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-columns.d.ts +15 -0
- package/dist/components/data-grid/services/table/table-columns.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-context.d.ts +4 -0
- package/dist/components/data-grid/services/table/table-context.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-extra-columns.d.ts +12 -0
- package/dist/components/data-grid/services/table/table-extra-columns.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-header.d.ts +11 -0
- package/dist/components/data-grid/services/table/table-header.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-helpers.d.ts +13 -0
- package/dist/components/data-grid/services/table/table-helpers.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-min-content-width.d.ts +36 -0
- package/dist/components/data-grid/services/table/table-min-content-width.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-service.d.ts +4 -0
- package/dist/components/data-grid/services/table/table-service.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-slots.d.ts +9 -0
- package/dist/components/data-grid/services/table/table-slots.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-sticky.d.ts +35 -0
- package/dist/components/data-grid/services/table/table-sticky.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-store.d.ts +4 -0
- package/dist/components/data-grid/services/table/table-store.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/table-types.d.ts +239 -0
- package/dist/components/data-grid/services/table/table-types.d.ts.map +1 -0
- package/dist/components/data-grid/utils/debounce.d.ts +7 -0
- package/dist/components/data-grid/utils/debounce.d.ts.map +1 -0
- package/dist/components/data-grid/utils/deep-equal.d.ts +7 -0
- package/dist/components/data-grid/utils/deep-equal.d.ts.map +1 -0
- package/dist/components/data-grid/utils/hooked.d.ts +17 -0
- package/dist/components/data-grid/utils/hooked.d.ts.map +1 -0
- package/dist/components/data-grid/utils/is-record.d.ts +3 -0
- package/dist/components/data-grid/utils/is-record.d.ts.map +1 -0
- package/dist/components/data-grid/utils/load-state.d.ts +22 -0
- package/dist/components/data-grid/utils/load-state.d.ts.map +1 -0
- package/dist/components/data-grid/utils/use-latest.d.ts +4 -0
- package/dist/components/data-grid/utils/use-latest.d.ts.map +1 -0
- package/dist/data-grid/empty-state.d.ts +1 -0
- package/dist/data-grid/empty-state.js +27 -0
- package/dist/data-grid/empty-state.js.map +1 -0
- package/dist/data-grid/order.d.ts +1 -0
- package/dist/data-grid/order.js +254 -0
- package/dist/data-grid/order.js.map +1 -0
- package/dist/data-grid/pagination.d.ts +1 -0
- package/dist/data-grid/pagination.js +215 -0
- package/dist/data-grid/pagination.js.map +1 -0
- package/dist/data-grid/text-search.d.ts +1 -0
- package/dist/data-grid/text-search.js +112 -0
- package/dist/data-grid/text-search.js.map +1 -0
- package/dist/data-grid.d.ts +1 -0
- package/dist/data-grid.js +1650 -0
- package/dist/data-grid.js.map +1 -0
- package/dist/docs/data-grid.md +588 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +385 -367
- package/dist/index.js.map +1 -1
- package/llms.txt +11 -3
- package/package.json +4 -2
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { DataGridItem } from '../../data-grid-types';
|
|
3
|
+
export declare const TableLayouts: readonly ["fixed", "auto"];
|
|
4
|
+
export type DataGridTableLayout = (typeof TableLayouts)[number];
|
|
5
|
+
export declare const TableColumnOverflows: readonly ["wrap", "nowrap"];
|
|
6
|
+
export type DataGridTableColumnOverflow = (typeof TableColumnOverflows)[number];
|
|
7
|
+
export interface DataGridTableColumn<TItem extends DataGridItem = DataGridItem> {
|
|
8
|
+
id: string;
|
|
9
|
+
key?: string;
|
|
10
|
+
label: string | (() => string);
|
|
11
|
+
type?: 'string' | 'number' | 'date';
|
|
12
|
+
/**
|
|
13
|
+
* Column width. Under `tableLayout="fixed"` (default) this is the column's shared track — a
|
|
14
|
+
* proportional weight when every column has a `width`, an exact size when some columns are
|
|
15
|
+
* widthless. Under `tableLayout="auto"` it is a preferred size that also acts as a floor unless
|
|
16
|
+
* `minWidth` is set. A `%` string maps to `inline-size`; any other value maps to `width` +
|
|
17
|
+
* `min-inline-size`.
|
|
18
|
+
*
|
|
19
|
+
* `'min-content'` is a first-class value: it sizes the column to its own header content, in
|
|
20
|
+
* both layout modes -- the literal CSS keyword isn't honored by either table-layout algorithm
|
|
21
|
+
* as a sizing hint on its own, so `DataGridHeaderCell` measures the header cell's content and
|
|
22
|
+
* applies the result as a pixel width instead (the column's size under `auto`, its shared track
|
|
23
|
+
* under `fixed`). See `resolveColumnStyle`. For choosing a width strategy per column, see the
|
|
24
|
+
* decision guide in `data-grid.md` ("Choosing column widths").
|
|
25
|
+
*/
|
|
26
|
+
width?: number | 'min-content' | (string & {});
|
|
27
|
+
/**
|
|
28
|
+
* Minimum column width in px. Under `tableLayout="auto"` this is an independent floor. Under
|
|
29
|
+
* `tableLayout="fixed"` the three width props collapse to a single track: a lone `minWidth`
|
|
30
|
+
* (no `width`, no `maxWidth`) aliases to the track, while combining it with `width` triggers a
|
|
31
|
+
* DEV-only console warning and `width` wins, since fixed layout cannot honor both.
|
|
32
|
+
*/
|
|
33
|
+
minWidth?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum column width in px, enforced via a content-cap wrapper. Under `tableLayout="auto"`
|
|
36
|
+
* this is a real, independent cap. Under `tableLayout="fixed"` the three width props collapse
|
|
37
|
+
* to a single track: a lone `maxWidth` (no `width`, no `minWidth`) aliases to the track, while
|
|
38
|
+
* combining it with `width` triggers a DEV-only console warning and `width` wins, since fixed
|
|
39
|
+
* layout cannot honor both.
|
|
40
|
+
*/
|
|
41
|
+
maxWidth?: number;
|
|
42
|
+
visible?: boolean;
|
|
43
|
+
sticky?: boolean;
|
|
44
|
+
visibleToggleDisabled?: boolean;
|
|
45
|
+
formatter?: (value: unknown) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Header-only overflow handling. Default `'nowrap'` — the label stays on one line and clips
|
|
48
|
+
* with an ellipsis ("…") on overflow, auto-setting `title` with the full label for the default
|
|
49
|
+
* label renderer; when `headerComponent` is set the kit cannot supply that fallback and the
|
|
50
|
+
* consumer is responsible for it. `'wrap'` lets the label wrap across lines instead.
|
|
51
|
+
*/
|
|
52
|
+
headerOverflow?: DataGridTableColumnOverflow;
|
|
53
|
+
/**
|
|
54
|
+
* Body-cell overflow handling. Default `'wrap'`: the value wraps across lines. `'nowrap'` keeps the value on one line and clips it with an ellipsis ("…") on
|
|
55
|
+
* overflow, auto-setting `title` with the formatted value for the default value renderer; when
|
|
56
|
+
* `component` or `render` is set the kit cannot supply that fallback and the consumer is
|
|
57
|
+
* responsible for it.
|
|
58
|
+
*/
|
|
59
|
+
cellOverflow?: DataGridTableColumnOverflow;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use `headerOverflow: 'nowrap'` instead. Normalized to `headerOverflow` at
|
|
62
|
+
* column ingestion and kept working for one release with a dev-only deprecation warning.
|
|
63
|
+
*/
|
|
64
|
+
headerTruncate?: boolean;
|
|
65
|
+
component?: ComponentType<{
|
|
66
|
+
item: TItem;
|
|
67
|
+
column: DataGridTableColumn<TItem>;
|
|
68
|
+
value: unknown;
|
|
69
|
+
}>;
|
|
70
|
+
headerComponent?: ComponentType<{
|
|
71
|
+
column: DataGridTableColumn<TItem>;
|
|
72
|
+
}>;
|
|
73
|
+
render?: ((item: TItem) => ReactNode) | ReactNode;
|
|
74
|
+
getClassName?: (item: TItem) => string | undefined;
|
|
75
|
+
groupId?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface DataGridTableGroup<TItem extends DataGridItem = DataGridItem> {
|
|
78
|
+
id: string;
|
|
79
|
+
label: string | (() => string);
|
|
80
|
+
columns: DataGridTableColumn<TItem>[];
|
|
81
|
+
component?: ComponentType<{
|
|
82
|
+
group: DataGridTableGroup<TItem>;
|
|
83
|
+
}>;
|
|
84
|
+
visible?: boolean;
|
|
85
|
+
sticky?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export declare function isTableGroup<TItem extends DataGridItem>(item: DataGridTableColumn<TItem> | DataGridTableGroup<TItem>): item is DataGridTableGroup<TItem>;
|
|
88
|
+
export type TableSlotName = 'subheader' | 'footer' | 'header-cell-end';
|
|
89
|
+
export interface TableSlot {
|
|
90
|
+
id: string;
|
|
91
|
+
name: TableSlotName;
|
|
92
|
+
component: ComponentType<any>;
|
|
93
|
+
order: number;
|
|
94
|
+
}
|
|
95
|
+
export interface TableSlotOption {
|
|
96
|
+
component: ComponentType<any>;
|
|
97
|
+
order?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface TableSlotOptions {
|
|
100
|
+
subheader: TableSlotOption;
|
|
101
|
+
footer: TableSlotOption;
|
|
102
|
+
'header-cell-end': TableSlotOption;
|
|
103
|
+
}
|
|
104
|
+
export type ExtraColumnPosition = 'start' | 'end';
|
|
105
|
+
export interface ExtraColumn {
|
|
106
|
+
id: string;
|
|
107
|
+
header?: ComponentType;
|
|
108
|
+
body?: ComponentType;
|
|
109
|
+
position: ExtraColumnPosition;
|
|
110
|
+
order: number;
|
|
111
|
+
/**
|
|
112
|
+
* Any CSS length, applied as the column's width. A pinned `end` column's contribution to the
|
|
113
|
+
* offsets of the columns pinned inside it is read from this only while the header has not been
|
|
114
|
+
* measured yet, and only when the value is a plain px length -- anything else contributes `0`
|
|
115
|
+
* until the measurement lands.
|
|
116
|
+
*/
|
|
117
|
+
width?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Pins the column to the table's inline-end edge, so it stays reachable while the rows scroll
|
|
120
|
+
* sideways. Read only for `end` columns; a `start` extra column is not pinned by it, and is not
|
|
121
|
+
* pinned by the table's own sticky columns either -- it only offsets them. Setting it on a
|
|
122
|
+
* `start` column logs a DEV-only warning. Defaults to unpinned.
|
|
123
|
+
*/
|
|
124
|
+
sticky?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* When `true`, the rendered header and body cells for this column carry
|
|
127
|
+
* `data-grid-row-ignore-click`, so a plugin that reacts to row clicks can skip clicks
|
|
128
|
+
* anywhere in the cell (including its padding, not just the inner content).
|
|
129
|
+
*/
|
|
130
|
+
ignoreRowClick?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export type ExtraColumnOption = Partial<ExtraColumn>;
|
|
133
|
+
export type TableComponentName = 'row' | 'header-cell' | 'header-cell-label' | 'header-group' | 'body-cell-content' | 'content';
|
|
134
|
+
/**
|
|
135
|
+
* How the registry stores a component registered under a `TableComponentName`. Each name takes its
|
|
136
|
+
* own props, so the registry holds them as taking none it could name: every function component
|
|
137
|
+
* (a `memo`, `forwardRef` or `lazy` one too) is assignable to `ComponentType<never>`, and
|
|
138
|
+
* `useComponent` hands one back as the props its caller renders. A class component is not: its
|
|
139
|
+
* instance carries its props (`this.props`), which `never` cannot hold. So this is the stored
|
|
140
|
+
* form only; the public `registerComponent` still takes `ComponentType<any>` and asserts a class
|
|
141
|
+
* component into it.
|
|
142
|
+
*/
|
|
143
|
+
export type RegisteredTableComponent = ComponentType<never>;
|
|
144
|
+
export interface TableHeaderCell<TItem extends DataGridItem = DataGridItem> {
|
|
145
|
+
type: 'group' | 'column';
|
|
146
|
+
item: DataGridTableGroup<TItem> | DataGridTableColumn<TItem>;
|
|
147
|
+
component: RegisteredTableComponent;
|
|
148
|
+
colspan?: number;
|
|
149
|
+
rowspan?: number;
|
|
150
|
+
}
|
|
151
|
+
export interface TableStore<TItem extends DataGridItem = DataGridItem> {
|
|
152
|
+
columns: (DataGridTableColumn<TItem> | DataGridTableGroup<TItem>)[];
|
|
153
|
+
flatColumns: DataGridTableColumn<TItem>[];
|
|
154
|
+
columnVisibility: Map<string, boolean>;
|
|
155
|
+
columnSticky: Map<string, boolean>;
|
|
156
|
+
groupSticky: Map<string, boolean>;
|
|
157
|
+
columnWidths: Map<string, number>;
|
|
158
|
+
/**
|
|
159
|
+
* Measured pixel width of `tableLayout="auto"` columns with `width: 'min-content'` -- see
|
|
160
|
+
* `table-min-content-width.ts`. Kept separate from `columnWidths` above: that one is read-only
|
|
161
|
+
* telemetry off a cell's already-rendered width (for sticky-offset math) and never feeds back
|
|
162
|
+
* into that cell's own size, so it never needs a dedup guard. This one directly drives the
|
|
163
|
+
* column's own CSS width, so it must dedupe writes to avoid a measure -> apply -> relayout ->
|
|
164
|
+
* re-measure loop.
|
|
165
|
+
*/
|
|
166
|
+
minContentWidths: Map<string, number>;
|
|
167
|
+
extraColumnsStart: ExtraColumn[];
|
|
168
|
+
extraColumnsEnd: ExtraColumn[];
|
|
169
|
+
slots: Map<TableSlotName, TableSlot[]>;
|
|
170
|
+
components: Map<TableComponentName, RegisteredTableComponent>;
|
|
171
|
+
tableLayout: DataGridTableLayout;
|
|
172
|
+
/** Mirrors `DataGrid`'s `stickyHeader` prop; read by the header renderers. */
|
|
173
|
+
stickyHeader: boolean;
|
|
174
|
+
}
|
|
175
|
+
export interface ConfigurationColumn {
|
|
176
|
+
id: string;
|
|
177
|
+
label: string;
|
|
178
|
+
visible: boolean;
|
|
179
|
+
sticky: boolean;
|
|
180
|
+
visibleToggleDisabled: boolean;
|
|
181
|
+
}
|
|
182
|
+
export interface ConfigurationGroup {
|
|
183
|
+
id: string;
|
|
184
|
+
label: string;
|
|
185
|
+
visible: boolean;
|
|
186
|
+
sticky: boolean;
|
|
187
|
+
columns: ConfigurationColumn[];
|
|
188
|
+
}
|
|
189
|
+
export type ConfigurationEntry = ConfigurationColumn | ConfigurationGroup;
|
|
190
|
+
export declare function isConfigurationGroup(entry: ConfigurationEntry): entry is ConfigurationGroup;
|
|
191
|
+
export interface TablePublicApi<TItem extends DataGridItem = DataGridItem> {
|
|
192
|
+
registerTableSlot: <T extends TableSlotName>(name: T, options: TableSlotOptions[T]) => void;
|
|
193
|
+
registerExtraColumn: (options: ExtraColumnOption) => void;
|
|
194
|
+
updateExtraColumnWidth: (columnId: string, width: string) => void;
|
|
195
|
+
updateExtraColumnOrder: (columnId: string, order: number) => void;
|
|
196
|
+
updateExtraColumnSticky: (columnId: string, sticky: boolean) => void;
|
|
197
|
+
registerComponent: (name: TableComponentName, component: ComponentType<any>) => void;
|
|
198
|
+
updateColumns: (columns: (DataGridTableColumn<TItem> | DataGridTableGroup<TItem>)[]) => void;
|
|
199
|
+
updateColumnVisibility: (columnId: string, visible: boolean) => void;
|
|
200
|
+
updateColumnSticky: (id: string, sticky: boolean) => void;
|
|
201
|
+
updateTableLayout: (tableLayout: DataGridTableLayout) => void;
|
|
202
|
+
updateStickyHeader: (stickyHeader: boolean) => void;
|
|
203
|
+
}
|
|
204
|
+
export interface TableService<TItem extends DataGridItem = DataGridItem> extends TablePublicApi<TItem> {
|
|
205
|
+
registerSlot: <T extends TableSlotName>(name: T, options: TableSlotOptions[T]) => void;
|
|
206
|
+
useSlots: <T extends TableSlotName>(name: T) => TableSlot[];
|
|
207
|
+
useComponent: <TProps = unknown>(name: TableComponentName) => ComponentType<TProps>;
|
|
208
|
+
useExtraColumns: (position: ExtraColumnPosition) => ExtraColumn[];
|
|
209
|
+
initializeColumns: (columns: (DataGridTableColumn<TItem> | DataGridTableGroup<TItem>)[]) => {
|
|
210
|
+
columns: (DataGridTableColumn<TItem> | DataGridTableGroup<TItem>)[];
|
|
211
|
+
flatColumns: DataGridTableColumn<TItem>[];
|
|
212
|
+
columnVisibility: Map<string, boolean>;
|
|
213
|
+
};
|
|
214
|
+
useVisibleColumns: () => DataGridTableColumn<TItem>[];
|
|
215
|
+
initializeStickyState: (columns: (DataGridTableColumn<TItem> | DataGridTableGroup<TItem>)[]) => {
|
|
216
|
+
columnSticky: Map<string, boolean>;
|
|
217
|
+
groupSticky: Map<string, boolean>;
|
|
218
|
+
};
|
|
219
|
+
getOrderedColumnsWithSticky: (visibleColumns: DataGridTableColumn<TItem>[], columnSticky: Map<string, boolean>) => DataGridTableColumn<TItem>[];
|
|
220
|
+
onResizeColumn: (columnId: string, width: number) => void;
|
|
221
|
+
isColumnSticky: (columnId: string) => boolean;
|
|
222
|
+
isGroupSticky: (groupId: string) => boolean;
|
|
223
|
+
useColumnStickyOffset: (columnId: string) => number | undefined;
|
|
224
|
+
useColumnEndStickyOffset: (columnId: string) => number | undefined;
|
|
225
|
+
useGroupStickyOffset: (groupId: string) => number | undefined;
|
|
226
|
+
useHasGroups: () => boolean;
|
|
227
|
+
useFirstRowHeaderCells: () => TableHeaderCell<TItem>[];
|
|
228
|
+
useSecondRowHeaderColumns: () => DataGridTableColumn<TItem>[];
|
|
229
|
+
useConfigurationColumns: () => ConfigurationEntry[];
|
|
230
|
+
useTableLayout: () => DataGridTableLayout;
|
|
231
|
+
useStickyHeader: () => boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Measured pixel width for a `tableLayout="auto"` column with `width: 'min-content'` -- see
|
|
234
|
+
* `table-min-content-width.ts` and `DataGridHeaderCell`'s measurement effect.
|
|
235
|
+
*/
|
|
236
|
+
useMinContentWidth: (columnId: string) => number | undefined;
|
|
237
|
+
setMinContentWidth: (columnId: string, width: number) => void;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=table-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-types.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/services/table/table-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,eAAO,MAAM,YAAY,4BAA6B,CAAC;AACvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC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,OAAO,CAAC;IAC5C,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAChE,wBAAwB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACnE,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAE9D,YAAY,EAAE,MAAM,OAAO,CAAC;IAC5B,sBAAsB,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IACvD,yBAAyB,EAAE,MAAM,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;IAE9D,uBAAuB,EAAE,MAAM,kBAAkB,EAAE,CAAC;IACpD,cAAc,EAAE,MAAM,mBAAmB,CAAC;IAC1C,eAAe,EAAE,MAAM,OAAO,CAAC;IAE/B;;;OAGG;IACH,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7D,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface Debounced<Args extends unknown[], Result> {
|
|
2
|
+
(...args: Args): Result | undefined;
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
flush: () => Result | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function debounce<Args extends unknown[], Result>(fn: (...args: Args) => Result, waitMs: number): Debounced<Args, Result>;
|
|
7
|
+
//# sourceMappingURL=debounce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../../../src/components/data-grid/utils/debounce.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,SAAS,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM;IACvD,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,wBAAgB,QAAQ,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EACrD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,EAC7B,MAAM,EAAE,MAAM,GACb,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAmCzB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural equality for plain data: same keys, same values, recursively. Not a general
|
|
3
|
+
* comparator: it is used to decide whether a plugin's configuration props really changed, so it
|
|
4
|
+
* does not look at prototypes, dates or cycles.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isDeepEqual(a: unknown, b: unknown): boolean;
|
|
7
|
+
//# sourceMappingURL=deep-equal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-equal.d.ts","sourceRoot":"","sources":["../../../../src/components/data-grid/utils/deep-equal.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAS3D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type HookName<THooks> = keyof THooks & string;
|
|
2
|
+
type HookArgs<THooks, Name extends keyof THooks> = THooks[Name] extends (...args: infer Args) => unknown ? Args : never;
|
|
3
|
+
type HookReturn<THooks, Name extends keyof THooks> = THooks[Name] extends (...args: never[]) => infer Return ? Return : never;
|
|
4
|
+
export type HookFn<THooks, Name extends keyof THooks> = (...args: HookArgs<THooks, Name>) => HookReturn<THooks, Name> | Promise<HookReturn<THooks, Name>>;
|
|
5
|
+
export interface Hooked<THooks> {
|
|
6
|
+
/** Registers a handler. Returns the function that removes it again. */
|
|
7
|
+
hook: <Name extends HookName<THooks>>(name: Name, fn: HookFn<THooks, Name>) => () => void;
|
|
8
|
+
/** Runs the handlers one after another, each after the previous one settled. */
|
|
9
|
+
callHook: <Name extends HookName<THooks>>(name: Name, ...args: HookArgs<THooks, Name>) => Promise<HookReturn<THooks, Name>[]>;
|
|
10
|
+
/** Runs all the handlers at once. */
|
|
11
|
+
callHookParallel: <Name extends HookName<THooks>>(name: Name, ...args: HookArgs<THooks, Name>) => Promise<HookReturn<THooks, Name>[]>;
|
|
12
|
+
/** Runs the handlers synchronously and returns their results. */
|
|
13
|
+
callHookSync: <Name extends HookName<THooks>>(name: Name, ...args: HookArgs<THooks, Name>) => HookReturn<THooks, Name>[];
|
|
14
|
+
}
|
|
15
|
+
export declare function createHooked<THooks>(): Hooked<THooks>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=hooked.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooked.d.ts","sourceRoot":"","sources":["../../../../src/components/data-grid/utils/hooked.ts"],"names":[],"mappings":"AAWA,KAAK,QAAQ,CAAC,MAAM,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC;AAE9C,KAAK,QAAQ,CAAC,MAAM,EAAE,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CACtE,GAAG,IAAI,EAAE,MAAM,IAAI,KAChB,OAAO,GACR,IAAI,GACJ,KAAK,CAAC;AAEV,KAAK,UAAU,CAAC,MAAM,EAAE,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CACxE,GAAG,IAAI,EAAE,KAAK,EAAE,KACb,MAAM,MAAM,GACb,MAAM,GACN,KAAK,CAAC;AAEV,MAAM,MAAM,MAAM,CAAC,MAAM,EAAE,IAAI,SAAS,MAAM,MAAM,IAAI,CACtD,GAAG,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,KAC5B,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OA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AAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StoreApi, UseBoundStore } from 'zustand';
|
|
2
|
+
export type LoadState = 'blank' | 'loading' | 'error' | 'loaded';
|
|
3
|
+
export interface LoadStateStore {
|
|
4
|
+
loadState: LoadState;
|
|
5
|
+
}
|
|
6
|
+
export type UseLoadStateStore = UseBoundStore<StoreApi<LoadStateStore>>;
|
|
7
|
+
export interface LoadStateManager {
|
|
8
|
+
useLoadState: UseLoadStateStore;
|
|
9
|
+
setLoading: () => void;
|
|
10
|
+
setLoaded: () => void;
|
|
11
|
+
setError: () => void;
|
|
12
|
+
setBlank: () => void;
|
|
13
|
+
/** Back to idle, and detaches the `loadPromise` in flight so its outcome no longer writes. */
|
|
14
|
+
reset: () => void;
|
|
15
|
+
loadPromise: <T>(promise: Promise<T>) => Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A zustand store holding a `blank -> loading -> loaded | error` state, plus the helpers that move
|
|
19
|
+
* it. `loadPromise` follows a promise: loading while it is pending, then loaded or error.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createLoadStateManager(): LoadStateManager;
|
|
22
|
+
//# sourceMappingURL=load-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-state.d.ts","sourceRoot":"","sources":["../../../../src/components/data-grid/utils/load-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGvD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,iBAAiB,CAAC;IAChC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,8FAA8F;IAC9F,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,WAAW,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACrD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAoDzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-latest.d.ts","sourceRoot":"","sources":["../../../../src/components/data-grid/utils/use-latest.ts"],"names":[],"mappings":";AAEA,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,gCAUpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../components/data-grid/plugins/empty-state/public.js'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { create as c } from "zustand";
|
|
4
|
+
import { c as a } from "../chunks/plugins-helpers.js";
|
|
5
|
+
const i = "empty_state", f = a("emptyState", (n) => {
|
|
6
|
+
const o = c(() => ({
|
|
7
|
+
component: null
|
|
8
|
+
}));
|
|
9
|
+
return n.registerSlot("empty", {
|
|
10
|
+
id: i,
|
|
11
|
+
component: p
|
|
12
|
+
}), {
|
|
13
|
+
useComponent: () => o((t) => t.component),
|
|
14
|
+
onPropsChange: e
|
|
15
|
+
};
|
|
16
|
+
function e(t) {
|
|
17
|
+
o.setState({ component: t.component });
|
|
18
|
+
}
|
|
19
|
+
function p() {
|
|
20
|
+
const t = o((m) => m.component);
|
|
21
|
+
return t ? /* @__PURE__ */ r(t, {}) : null;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
f as DataGridEmptyStatePlugin
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.js","sources":["../../src/components/data-grid/plugins/empty-state/empty-state-plugin.tsx"],"sourcesContent":["// Load-bearing: a plugin is rendered as a child of <DataGrid>, so a Server Component can import\n// and render it, and the component it returns calls hooks. This directive puts the banner on the\n// plugin's own entry chunk (dist/data-grid/<plugin>.js). client-boundaries.test.ts only scans a\n// component's top-level files, so scripts/verify-consumer.sh is what checks the built banner of\n// every plugin entry.\n'use client';\n\nimport { create } from 'zustand';\nimport type { DataGridItem } from '../../data-grid-types';\nimport { createDataGridPlugin } from '../../services/plugins/plugins-helpers';\nimport type { DataGridEmptyStatePluginApi, DataGridEmptyStatePluginProps } from './empty-state-types';\n\nexport type { DataGridEmptyStatePluginApi, DataGridEmptyStatePluginProps };\n\nexport const EMPTY_STATE_LAYOUT_SLOT_ID = 'empty_state';\n\ninterface EmptyStateStore {\n component: React.ComponentType | null;\n}\n\nexport const DataGridEmptyStatePlugin = createDataGridPlugin<\n DataGridItem,\n 'emptyState',\n DataGridEmptyStatePluginProps\n>('emptyState', (context) => {\n const useStore = create<EmptyStateStore>(() => ({\n component: null,\n }));\n\n context.registerSlot('empty', {\n id: EMPTY_STATE_LAYOUT_SLOT_ID,\n component: EmptyStateSlot,\n });\n\n const api: DataGridEmptyStatePluginApi = {\n useComponent: () => useStore((s) => s.component),\n onPropsChange,\n };\n\n return api;\n\n function onPropsChange(props: DataGridEmptyStatePluginProps) {\n useStore.setState({ component: props.component });\n }\n\n // Renders nothing until onPropsChange lands the component in the store: the slot is registered\n // during setup, so falling back to the built-in copy here would flash \"No results found\" on the\n // first paint of the very state this plugin exists to replace.\n function EmptyStateSlot() {\n const Component = useStore((s) => s.component);\n\n return Component ? <Component /> : null;\n }\n});\n"],"names":["EMPTY_STATE_LAYOUT_SLOT_ID","DataGridEmptyStatePlugin","createDataGridPlugin","context","useStore","create","EmptyStateSlot","s","onPropsChange","props","Component","jsx"],"mappings":";;;;AAcO,MAAMA,IAA6B,eAM7BC,IAA2BC,EAItC,cAAc,CAACC,MAAY;AAC3B,QAAMC,IAAWC,EAAwB,OAAO;AAAA,IAC9C,WAAW;AAAA,EAAA,EACX;AAEF,SAAAF,EAAQ,aAAa,SAAS;AAAA,IAC5B,IAAIH;AAAA,IACJ,WAAWM;AAAA,EAAA,CACZ,GAEwC;AAAA,IACvC,cAAc,MAAMF,EAAS,CAACG,MAAMA,EAAE,SAAS;AAAA,IAC/C,eAAAC;AAAA,EAAA;AAKF,WAASA,EAAcC,GAAsC;AAC3D,IAAAL,EAAS,SAAS,EAAE,WAAWK,EAAM,WAAW;AAAA,EAClD;AAKA,WAASH,IAAiB;AACxB,UAAMI,IAAYN,EAAS,CAACG,MAAMA,EAAE,SAAS;AAE7C,WAAOG,IAAY,gBAAAC,EAACD,GAAA,CAAA,CAAU,IAAK;AAAA,EACrC;AACF,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../components/data-grid/plugins/order/public.js'
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { i as N } from "../chunks/deep-equal.js";
|
|
3
|
+
import { create as w } from "zustand";
|
|
4
|
+
import { u as k, c as j } from "../chunks/plugins-helpers.js";
|
|
5
|
+
import { jsx as c, jsxs as p } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronUpIcon as q, ChevronDownIcon as x, CheckIcon as D, PencilLineIcon as V, ArrowUpIcon as $, ArrowDownIcon as H } from "lucide-react";
|
|
7
|
+
import { useState as R } from "react";
|
|
8
|
+
import { m as u } from "../chunks/messages.js";
|
|
9
|
+
import { Popover as J, PopoverTrigger as K, PopoverContent as Q } from "../popover.js";
|
|
10
|
+
import { DropdownMenu as W, DropdownMenuGroup as G, DropdownMenuLabel as z, DropdownMenuItem as _, DropdownMenuSeparator as X } from "../dropdown-menu.js";
|
|
11
|
+
import { Button as B } from "../button.js";
|
|
12
|
+
import '../chunks/order.D7Jg_Mg8.css';function Y(r = "string") {
|
|
13
|
+
return r === "number" ? {
|
|
14
|
+
ascending: u.order.ascNumber,
|
|
15
|
+
descending: u.order.descNumber
|
|
16
|
+
} : r === "date" ? {
|
|
17
|
+
ascending: u.order.ascDate,
|
|
18
|
+
descending: u.order.descDate
|
|
19
|
+
} : {
|
|
20
|
+
ascending: u.order.ascString,
|
|
21
|
+
descending: u.order.descString
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const Z = "_orderPopover_53ftr_1", ee = "_menuItem_53ftr_12", re = "_check_53ftr_18", g = {
|
|
25
|
+
orderPopover: Z,
|
|
26
|
+
menuItem: ee,
|
|
27
|
+
check: re
|
|
28
|
+
};
|
|
29
|
+
function ne() {
|
|
30
|
+
var S;
|
|
31
|
+
const d = k().getPlugin("order"), [i, t] = R(!1), n = d.useOrder(), m = d.useOptions(), l = n ? m.find((a) => a.id === n.columnId) ?? null : null, I = (l == null ? void 0 : l.type) ?? "string", h = Y(I), b = l ? l.label : u.order.sort;
|
|
32
|
+
function y(a) {
|
|
33
|
+
d.setOrder(a, "desc"), t(!1);
|
|
34
|
+
}
|
|
35
|
+
function O(a) {
|
|
36
|
+
n && (d.setOrder(n.columnId, a), t(!1));
|
|
37
|
+
}
|
|
38
|
+
const C = (n == null ? void 0 : n.direction) === "asc" ? /* @__PURE__ */ c(q, {}) : (n == null ? void 0 : n.direction) === "desc" ? /* @__PURE__ */ c(x, {}) : null, v = (
|
|
39
|
+
// `lg` is the height of the search field it sits beside in the toolbar (both are the kit's
|
|
40
|
+
// 40px step); the default step would sit 4px shorter than the field.
|
|
41
|
+
/* @__PURE__ */ c(
|
|
42
|
+
B,
|
|
43
|
+
{
|
|
44
|
+
variant: "outline",
|
|
45
|
+
size: "lg",
|
|
46
|
+
icon: /* @__PURE__ */ c(V, {}),
|
|
47
|
+
end: C,
|
|
48
|
+
"aria-label": u.order.sort,
|
|
49
|
+
children: b
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
), f = (S = d.popover) != null && S.minInlineSize ? { minInlineSize: `${d.popover.minInlineSize}px` } : void 0;
|
|
53
|
+
return m.length === 0 ? null : /* @__PURE__ */ p(J, { open: i, onOpenChange: t, children: [
|
|
54
|
+
/* @__PURE__ */ c(K, { render: v }),
|
|
55
|
+
/* @__PURE__ */ c(Q, { side: "bottom", align: "end", children: /* @__PURE__ */ c(W, { open: !0, modal: !1, children: /* @__PURE__ */ p("div", { className: g.orderPopover, style: f, children: [
|
|
56
|
+
/* @__PURE__ */ p(G, { children: [
|
|
57
|
+
/* @__PURE__ */ c(z, { children: u.order.sortBy }),
|
|
58
|
+
m.map((a) => /* @__PURE__ */ p(
|
|
59
|
+
_,
|
|
60
|
+
{
|
|
61
|
+
className: g.menuItem,
|
|
62
|
+
onClick: () => y(a.id),
|
|
63
|
+
children: [
|
|
64
|
+
a.label,
|
|
65
|
+
(n == null ? void 0 : n.columnId) === a.id && /* @__PURE__ */ c(D, { className: g.check })
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
a.id
|
|
69
|
+
))
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ c(X, {}),
|
|
72
|
+
/* @__PURE__ */ p(G, { children: [
|
|
73
|
+
/* @__PURE__ */ c(z, { children: u.order.order }),
|
|
74
|
+
/* @__PURE__ */ p(
|
|
75
|
+
_,
|
|
76
|
+
{
|
|
77
|
+
className: g.menuItem,
|
|
78
|
+
disabled: !n,
|
|
79
|
+
onClick: () => O("asc"),
|
|
80
|
+
children: [
|
|
81
|
+
h.ascending,
|
|
82
|
+
(n == null ? void 0 : n.direction) === "asc" && /* @__PURE__ */ c(D, { className: g.check })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ p(
|
|
87
|
+
_,
|
|
88
|
+
{
|
|
89
|
+
className: g.menuItem,
|
|
90
|
+
disabled: !n,
|
|
91
|
+
onClick: () => O("desc"),
|
|
92
|
+
children: [
|
|
93
|
+
h.descending,
|
|
94
|
+
(n == null ? void 0 : n.direction) === "desc" && /* @__PURE__ */ c(D, { className: g.check })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] })
|
|
99
|
+
] }) }) })
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
const oe = "_orderLabel_o0d7f_1", te = {
|
|
103
|
+
orderLabel: oe
|
|
104
|
+
};
|
|
105
|
+
function ie({
|
|
106
|
+
column: r
|
|
107
|
+
}) {
|
|
108
|
+
const i = k().getPlugin("order"), t = !i.useIsColumnExcluded(r.id), n = typeof r.label == "function" ? r.label() : r.label;
|
|
109
|
+
return t ? /* @__PURE__ */ c(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
type: "button",
|
|
113
|
+
className: te.orderLabel,
|
|
114
|
+
"aria-label": u.order.changeSorting(n),
|
|
115
|
+
onClick: () => i.toggleOrder(r.id),
|
|
116
|
+
children: n
|
|
117
|
+
}
|
|
118
|
+
) : /* @__PURE__ */ c("span", { children: n });
|
|
119
|
+
}
|
|
120
|
+
function de({ column: r }) {
|
|
121
|
+
const i = k().getPlugin("order"), t = i.useOrder();
|
|
122
|
+
if (!(!i.useIsColumnExcluded(r.id) && (t == null ? void 0 : t.columnId) === r.id)) return null;
|
|
123
|
+
const l = typeof r.label == "function" ? r.label() : r.label;
|
|
124
|
+
return /* @__PURE__ */ c(
|
|
125
|
+
B,
|
|
126
|
+
{
|
|
127
|
+
variant: "ghost",
|
|
128
|
+
size: "sm",
|
|
129
|
+
"aria-label": u.order.changeSorting(l),
|
|
130
|
+
icon: t.direction === "asc" ? /* @__PURE__ */ c($, {}) : /* @__PURE__ */ c(H, {}),
|
|
131
|
+
onClick: () => i.toggleOrder(r.id)
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
const A = { columnId: "__cleared__", direction: "asc" }, P = [], E = [];
|
|
136
|
+
function M(r) {
|
|
137
|
+
return (r == null ? void 0 : r.columnId) === "__cleared__";
|
|
138
|
+
}
|
|
139
|
+
const be = j(
|
|
140
|
+
"order",
|
|
141
|
+
(r) => {
|
|
142
|
+
const d = r.registerPersistentState("order", {
|
|
143
|
+
schema: { columnId: "string", direction: "string" }
|
|
144
|
+
});
|
|
145
|
+
let i = d.value;
|
|
146
|
+
const t = w(() => ({
|
|
147
|
+
order: void 0
|
|
148
|
+
})), n = w(() => ({
|
|
149
|
+
excludedColumns: E,
|
|
150
|
+
options: P,
|
|
151
|
+
popover: void 0
|
|
152
|
+
}));
|
|
153
|
+
let m = !1;
|
|
154
|
+
r.registerComponent("header-cell-label", ie), r.registerTableSlot("header-cell-end", { component: de }), r.registerSlot("top-end", {
|
|
155
|
+
id: "order",
|
|
156
|
+
component: ne,
|
|
157
|
+
order: -10
|
|
158
|
+
});
|
|
159
|
+
const l = () => t((e) => e.order), I = () => t((e) => {
|
|
160
|
+
var o;
|
|
161
|
+
return (o = e.order) == null ? void 0 : o.columnId;
|
|
162
|
+
}), h = () => t((e) => {
|
|
163
|
+
var o;
|
|
164
|
+
return (o = e.order) == null ? void 0 : o.direction;
|
|
165
|
+
});
|
|
166
|
+
r.hook("load:context", () => {
|
|
167
|
+
m = !0;
|
|
168
|
+
const { order: e } = t.getState();
|
|
169
|
+
if (!(!e || f(e.columnId)))
|
|
170
|
+
return { order: [{ column: e.columnId, direction: e.direction }] };
|
|
171
|
+
});
|
|
172
|
+
function b(e) {
|
|
173
|
+
f(e.columnId) || (i = e, t.setState({ order: e }), d.setValue(e), r.refresh({ resetFilters: !1 }));
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
useOrder: l,
|
|
177
|
+
useColumnId: I,
|
|
178
|
+
useDirection: h,
|
|
179
|
+
toggleOrder: O,
|
|
180
|
+
setOrder: C,
|
|
181
|
+
useIsColumnExcluded: v,
|
|
182
|
+
useOptions: F,
|
|
183
|
+
get popover() {
|
|
184
|
+
return n.getState().popover;
|
|
185
|
+
},
|
|
186
|
+
onPropsChange: T
|
|
187
|
+
};
|
|
188
|
+
function O(e) {
|
|
189
|
+
const { order: o } = t.getState();
|
|
190
|
+
if ((o == null ? void 0 : o.columnId) === e) {
|
|
191
|
+
if (o.direction === "desc") {
|
|
192
|
+
b({ columnId: e, direction: "asc" });
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
i = A, t.setState({ order: void 0 }), d.setValue(A), r.refresh({ resetFilters: !1 });
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
b({ columnId: e, direction: "desc" });
|
|
199
|
+
}
|
|
200
|
+
function C(e, o) {
|
|
201
|
+
b({ columnId: e, direction: o });
|
|
202
|
+
}
|
|
203
|
+
function v(e) {
|
|
204
|
+
return n((o) => o.excludedColumns.includes(e));
|
|
205
|
+
}
|
|
206
|
+
function f(e) {
|
|
207
|
+
const { excludedColumns: o, options: s } = n.getState();
|
|
208
|
+
return o.includes(e) && !s.some((U) => U.id === e);
|
|
209
|
+
}
|
|
210
|
+
function S() {
|
|
211
|
+
if (!(!i || M(i)))
|
|
212
|
+
return { columnId: i.columnId, direction: i.direction };
|
|
213
|
+
}
|
|
214
|
+
function a(e) {
|
|
215
|
+
const o = S();
|
|
216
|
+
if (o && !f(o.columnId)) return o;
|
|
217
|
+
if (M(i)) return;
|
|
218
|
+
const { order: s } = t.getState();
|
|
219
|
+
if (s && !f(s.columnId)) return s;
|
|
220
|
+
if (e && !f(e.id))
|
|
221
|
+
return { columnId: e.id, direction: e.direction };
|
|
222
|
+
}
|
|
223
|
+
function L(e) {
|
|
224
|
+
const { order: o } = t.getState(), s = a(e);
|
|
225
|
+
(o == null ? void 0 : o.columnId) === (s == null ? void 0 : s.columnId) && (o == null ? void 0 : o.direction) === (s == null ? void 0 : s.direction) || (t.setState({ order: s }), m && r.refresh({ resetFilters: !1 }));
|
|
226
|
+
}
|
|
227
|
+
function F() {
|
|
228
|
+
return n((e) => e.options);
|
|
229
|
+
}
|
|
230
|
+
function T(e) {
|
|
231
|
+
n.setState({
|
|
232
|
+
excludedColumns: e.excludedColumns ?? E,
|
|
233
|
+
options: e.options ?? P,
|
|
234
|
+
popover: e.popover
|
|
235
|
+
}), L(e.defaultOrder);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
(r, d) => {
|
|
239
|
+
var i, t, n, m, l, I;
|
|
240
|
+
return N(r.options, d.options) && N(r.excludedColumns, d.excludedColumns) && ((i = r.defaultOrder) == null ? void 0 : i.id) === ((t = d.defaultOrder) == null ? void 0 : t.id) && ((n = r.defaultOrder) == null ? void 0 : n.direction) === ((m = d.defaultOrder) == null ? void 0 : m.direction) && ((l = r.popover) == null ? void 0 : l.minInlineSize) === ((I = d.popover) == null ? void 0 : I.minInlineSize);
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
function he(r) {
|
|
244
|
+
return {
|
|
245
|
+
id: r.id,
|
|
246
|
+
label: r.label,
|
|
247
|
+
type: r.type
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
export {
|
|
251
|
+
be as DataGridOrderPlugin,
|
|
252
|
+
he as createDataGridOrderOption
|
|
253
|
+
};
|
|
254
|
+
//# sourceMappingURL=order.js.map
|