@pibit.ai/cure-design-system 0.3.37 → 0.3.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.d.ts +1 -1
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +880 -805
- package/dist/patterns/table/index.d.ts +3 -3
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/tableZoomLayout.d.ts +59 -0
- package/dist/patterns/table/tableZoomLayout.d.ts.map +1 -0
- package/dist/patterns/table/tableZoomLayout.js +37 -0
- package/dist/patterns/table/tableZoomLayout.test.d.ts +2 -0
- package/dist/patterns/table/tableZoomLayout.test.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/TableToolbar.d.ts +2 -0
- package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/TableToolbar.js +104 -102
- package/dist/patterns/table/types.d.ts +38 -1
- package/dist/patterns/table/types.d.ts.map +1 -1
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { Table, TableCard, TableCell, TableRowActionsDropdown } from './table';
|
|
2
2
|
export { TableWrapper, type TableWrapperProps } from './TableWrapper';
|
|
3
|
-
export type { TableWrapperPaginationConfig, TableWrapperToolbarConfig, BulkActionContext, TableWrapperEditChrome, TableWrapperSelectedKeys, TableWrapperSelectionChange, ColumnConfig, TableCellCoord, TableCellRangeRect, TableCellSelection, } from './types';
|
|
3
|
+
export type { TableWrapperPaginationConfig, TableWrapperToolbarConfig, BulkActionContext, TableWrapperEditChrome, TableWrapperSelectedKeys, TableWrapperSelectionChange, TableZoomConfig, ColumnConfig, TableCellCoord, TableCellRangeRect, TableCellSelection, } from './types';
|
|
4
4
|
export { buildCellRangeRect, getCellRangeVisualState, getDragScrollDeltas, isSingleCellSelection, selectionFromSingleCell, } from './cellRangeSelection';
|
|
5
|
-
export { TablePagination, type TablePaginationConfig, type TablePaginationProps } from './TablePagination';
|
|
5
|
+
export { TablePagination, type TablePaginationConfig, type TablePaginationProps, } from './TablePagination';
|
|
6
6
|
export { PaginationCardDefault } from './pagination-card';
|
|
7
7
|
export { Pagination } from './pagination-base';
|
|
8
8
|
export { ROW_HEIGHT_ICONS, type RowHeightIconKey } from './row-height-icons';
|
|
9
9
|
export { TOOLBAR_ICONS } from './toolbar-icons';
|
|
10
|
-
export type { TableColumnSchema, TableColumnMenuSchema, TableColumnValueType } from './types';
|
|
10
|
+
export type { TableColumnSchema, TableColumnMenuSchema, TableColumnValueType, } from './types';
|
|
11
11
|
export { TableToolbar, pickCoreToolbarProps, registerToolbarExtensions, getToolbarExtensions, RowHeightDropdown, HideFieldsDropdown, AlignDropdown, GroupByDropdown, ShowSummaryDropdown, SummaryFooterRow, ColumnHeaderMenu, RowActionsMenu, BulkActionBar, applyHideAndReorder, getDefaultAlignmentForType, getEffectiveAlignment, alignmentClass, getAggregationsForType, computeAggregation, groupRows, resolveColumnLabel, resolveSummaryDisplayValueType, ROW_HEIGHT_CLASS, AGGREGATION_LABELS, } from './toolbar';
|
|
12
12
|
export type { SearchToolConfig, SortToolConfig, FilterToolConfig, RowHeightToolConfig, HideFieldsToolConfig, AlignToolConfig, GroupByToolConfig, SummaryToolConfig, UndoRedoToolConfig, ToolbarExtensionComponents, LegacySortToolConfig, LegacyFilterToolConfig, RowHeightOption, SummaryFooterRowProps, ColumnMenuAction, ColumnMenuCapabilities, RowActionsConfig, CellAlignment, AggregationType, AggregationOption, RowGroup, } from './toolbar';
|
|
13
13
|
export { GridNavProvider, useGridKeyboardNavigation, isWithinCellEditor, findGridCell, focusGridCell, getGridNeighbor, getGridTabNeighbor, type FocusGridCellOptions, type GridNavDirection, type GridNeighbor, type GridNavValue, } from './useGridKeyboardNavigation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,eAAe,EACf,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU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B,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,kCAAkC,EAClC,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,EACzB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,+BAA+B,GACrC,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TableZoomConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Pure layout maths behind TableWrapper's zoom. Kept out of the component so the invariants
|
|
4
|
+
* can be asserted directly — the width model here has been subtly wrong more than once, and
|
|
5
|
+
* the failures are all silent (columns that look plausible but stop short of the container,
|
|
6
|
+
* or a zoom that cancels itself out and only changes the font size).
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_TABLE_ZOOM = 100;
|
|
9
|
+
export declare const DEFAULT_TABLE_ZOOM_MIN = 60;
|
|
10
|
+
export declare const DEFAULT_TABLE_ZOOM_MAX = 120;
|
|
11
|
+
export declare const DEFAULT_TABLE_ZOOM_STEP = 10;
|
|
12
|
+
export declare const DEFAULT_COLUMN_MAX_WIDTH = "300px";
|
|
13
|
+
export declare const DEFAULT_ZOOMABLE_COLUMN_MIN_WIDTH = "160px";
|
|
14
|
+
/**
|
|
15
|
+
* Sub-pixel slack for the overflow test. The painted width and the container are exactly
|
|
16
|
+
* equal at the point where the grid stops overflowing, and rounding there must not show a
|
|
17
|
+
* scrollbar for a fraction of a pixel.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SCROLL_EPSILON_PX = 0.5;
|
|
20
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
21
|
+
export declare const parsePxValue: (value: string | undefined) => number;
|
|
22
|
+
/**
|
|
23
|
+
* CSS `zoom` is the mechanism the whole feature rests on (Chrome 128+, Safari, Firefox 126+).
|
|
24
|
+
* Where it is unsupported the grid must fall back to its unzoomed layout rather than render
|
|
25
|
+
* a control that silently does nothing. Treated as supported when `CSS` is unavailable at all
|
|
26
|
+
* (SSR), so the server renders the same markup a current browser will.
|
|
27
|
+
*/
|
|
28
|
+
export declare const supportsCssZoom: () => boolean;
|
|
29
|
+
export declare const normalizeZoomConfig: (config: TableZoomConfig) => {
|
|
30
|
+
minZoom: number;
|
|
31
|
+
maxZoom: number;
|
|
32
|
+
step: number;
|
|
33
|
+
defaultZoom: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The grid's layout width with zoom held at 100%: fill the container, but never shrink below
|
|
37
|
+
* what the columns' minimums need.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately independent of the zoom level. A base that tracked the zoom (`containerWidth /
|
|
40
|
+
* zoomScale`) is cancelled out by the `zoom` applied afterwards, leaving every column the same
|
|
41
|
+
* painted width at every level and reducing the control to a font-size slider.
|
|
42
|
+
*/
|
|
43
|
+
export declare const computeFillBaseWidth: (containerWidth: number | null, minTableWidth: number) => number;
|
|
44
|
+
/** The grid overflows when its painted width exceeds the container it scrolls inside. */
|
|
45
|
+
export declare const computeNeedsHorizontalScroll: (fillBaseWidth: number | null, containerWidth: number | null, zoomScale: number) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Width handed to the table, in its own pre-zoom space.
|
|
48
|
+
*
|
|
49
|
+
* The container width is a hard minimum on the *painted* result: the grid must never paint
|
|
50
|
+
* narrower than the element it sits in, so it is never left floating with dead space to its
|
|
51
|
+
* right. While the zoomed base is wider than the container that base wins and zooming
|
|
52
|
+
* genuinely resizes the columns; once it would fall short, the width becomes whatever fills
|
|
53
|
+
* the container at the current zoom. `containerWidth / zoomScale` is that width expressed in
|
|
54
|
+
* the table's own pre-zoom space.
|
|
55
|
+
*/
|
|
56
|
+
export declare const computeEffectiveTableWidth: (fillBaseWidth: number | null, containerWidth: number | null, zoomScale: number) => number | null;
|
|
57
|
+
/** Pre-zoom width each flexible column receives once fixed-width columns are accounted for. */
|
|
58
|
+
export declare const computeFlexColumnWidth: (effectiveTableWidth: number | null, fixedColumnWidthTotal: number, flexibleColumnCount: number) => number | null;
|
|
59
|
+
//# sourceMappingURL=tableZoomLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableZoomLayout.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/tableZoomLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,iCAAiC,UAAU,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,WACxB,CAAC;AAEtC,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,MAIxD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAO,OAGJ,CAAC;AAEhC,eAAO,MAAM,mBAAmB,GAAI,QAAQ,eAAe;;;;;CAc1D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,MAAM,GAAG,IAAI,EAC7B,eAAe,MAAM,KACpB,MAAoF,CAAC;AAExF,yFAAyF;AACzF,eAAO,MAAM,4BAA4B,GACvC,eAAe,MAAM,GAAG,IAAI,EAC5B,gBAAgB,MAAM,GAAG,IAAI,EAC7B,WAAW,MAAM,KAChB,OAKA,CAAC;AAEJ;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACrC,eAAe,MAAM,GAAG,IAAI,EAC5B,gBAAgB,MAAM,GAAG,IAAI,EAC7B,WAAW,MAAM,KAChB,MAAM,GAAG,IAKX,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,sBAAsB,GACjC,qBAAqB,MAAM,GAAG,IAAI,EAClC,uBAAuB,MAAM,EAC7B,qBAAqB,MAAM,KAC1B,MAAM,GAAG,IAOX,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const s = 100, L = 60, M = 120, E = 10, O = "300px", r = "160px", u = 0.5, m = (o, t, _) => Math.min(Math.max(o, t), _), c = (o) => {
|
|
2
|
+
if (!o) return 0;
|
|
3
|
+
const t = o.match(/^(\d+(?:\.\d+)?)px$/);
|
|
4
|
+
return t ? Number(t[1]) : 0;
|
|
5
|
+
}, A = () => typeof CSS > "u" || typeof CSS.supports != "function" ? !0 : CSS.supports("zoom", "1"), T = (o) => {
|
|
6
|
+
const t = Math.max(1, o.minZoom ?? 60), _ = Math.max(t, o.maxZoom ?? 120), n = Math.max(1, o.step ?? 10);
|
|
7
|
+
return {
|
|
8
|
+
minZoom: t,
|
|
9
|
+
maxZoom: _,
|
|
10
|
+
step: n,
|
|
11
|
+
defaultZoom: m(
|
|
12
|
+
o.defaultZoom ?? 100,
|
|
13
|
+
t,
|
|
14
|
+
_
|
|
15
|
+
)
|
|
16
|
+
};
|
|
17
|
+
}, a = (o, t) => o ? Math.max(o, t) : t, e = (o, t, _) => !!(o && t && o * _ > t + 0.5), p = (o, t, _) => o == null ? null : t ? Math.max(o, t / _) : o, Z = (o, t, _) => !o || _ === 0 ? null : Math.max(
|
|
18
|
+
0,
|
|
19
|
+
(o - t) / _
|
|
20
|
+
);
|
|
21
|
+
export {
|
|
22
|
+
O as DEFAULT_COLUMN_MAX_WIDTH,
|
|
23
|
+
s as DEFAULT_TABLE_ZOOM,
|
|
24
|
+
M as DEFAULT_TABLE_ZOOM_MAX,
|
|
25
|
+
L as DEFAULT_TABLE_ZOOM_MIN,
|
|
26
|
+
E as DEFAULT_TABLE_ZOOM_STEP,
|
|
27
|
+
r as DEFAULT_ZOOMABLE_COLUMN_MIN_WIDTH,
|
|
28
|
+
u as SCROLL_EPSILON_PX,
|
|
29
|
+
m as clamp,
|
|
30
|
+
p as computeEffectiveTableWidth,
|
|
31
|
+
a as computeFillBaseWidth,
|
|
32
|
+
Z as computeFlexColumnWidth,
|
|
33
|
+
e as computeNeedsHorizontalScroll,
|
|
34
|
+
T as normalizeZoomConfig,
|
|
35
|
+
c as parsePxValue,
|
|
36
|
+
A as supportsCssZoom
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableZoomLayout.test.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/tableZoomLayout.test.ts"],"names":[],"mappings":""}
|
|
@@ -39,6 +39,8 @@ export interface TableToolbarProps {
|
|
|
39
39
|
align?: AlignToolConfig;
|
|
40
40
|
groupBy?: GroupByToolConfig;
|
|
41
41
|
summary?: SummaryToolConfig;
|
|
42
|
+
/** Rendered immediately to the LEFT of the search input. `trailing` sits to its right. */
|
|
43
|
+
beforeSearch?: ReactNode;
|
|
42
44
|
trailing?: ReactNode;
|
|
43
45
|
searchCollapsible?: boolean;
|
|
44
46
|
disableExtendedTools?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableToolbar.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/TableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,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CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uGAAuG;IACvG,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,0GAA0G;IAC1G,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AA2GD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAkH9C,CAAC;AAsHF,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC5C,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,GAAG;IACF,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,CAMA"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { FlipBackward as
|
|
4
|
-
import { cx as
|
|
5
|
-
import { AlignDropdown as
|
|
6
|
-
import { GroupByDropdown as
|
|
7
|
-
import { HideFieldsDropdown as
|
|
8
|
-
import { RowHeightDropdown as
|
|
9
|
-
import { ShowSummaryDropdown as
|
|
10
|
-
import { resolveColumnLabel as
|
|
11
|
-
import { useUndoRedoShortcuts as
|
|
12
|
-
import { ExpandableSearchInput as
|
|
13
|
-
import { Button as
|
|
1
|
+
import { jsx as n, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as S, isValidElement as M, cloneElement as k, useRef as I, useState as O, useEffect as W, useLayoutEffect as U } from "react";
|
|
3
|
+
import { FlipBackward as j, FlipForward as F, ChevronSelectorVertical as P, DotsHorizontal as H } from "@untitledui/icons";
|
|
4
|
+
import { cx as A } from "../../../utils/cn.js";
|
|
5
|
+
import { AlignDropdown as T } from "./AlignDropdown.js";
|
|
6
|
+
import { GroupByDropdown as G } from "./GroupByDropdown.js";
|
|
7
|
+
import { HideFieldsDropdown as _ } from "./HideFieldsDropdown.js";
|
|
8
|
+
import { RowHeightDropdown as B } from "./RowHeightDropdown.js";
|
|
9
|
+
import { ShowSummaryDropdown as V } from "./ShowSummaryDropdown.js";
|
|
10
|
+
import { resolveColumnLabel as $ } from "./tableToolbarHelpers.js";
|
|
11
|
+
import { useUndoRedoShortcuts as q } from "./useUndoRedoShortcuts.js";
|
|
12
|
+
import { ExpandableSearchInput as E } from "../../../primitives/select/ExpandableSearchInput.js";
|
|
13
|
+
import { Button as D } from "../../../primitives/button/button.js";
|
|
14
14
|
import { Dropdown as x } from "../../../primitives/dropdown/dropdown.js";
|
|
15
|
-
import { Icon as
|
|
16
|
-
function
|
|
17
|
-
return
|
|
15
|
+
import { Icon as J } from "../../../primitives/icon/icon.js";
|
|
16
|
+
function Q(e, i) {
|
|
17
|
+
return M(e) ? k(e, {
|
|
18
18
|
onApply: i.onApply,
|
|
19
19
|
onClear: i.onClear,
|
|
20
20
|
clearAllSorts: i.onClear
|
|
21
21
|
}) : e;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function X(e, i) {
|
|
24
|
+
return M(e) ? k(e, {
|
|
25
25
|
onApply: i.onApply,
|
|
26
26
|
onClearAll: i.onClearAll
|
|
27
27
|
}) : e;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const Y = ({ config: e }) => (q({
|
|
30
30
|
enabled: e.shortcut ?? !0,
|
|
31
31
|
canUndo: e.canUndo,
|
|
32
32
|
canRedo: e.canRedo,
|
|
@@ -34,31 +34,31 @@ const X = ({ config: e }) => ($({
|
|
|
34
34
|
onRedo: e.onRedo,
|
|
35
35
|
isDisabled: e.isDisabled
|
|
36
36
|
}), /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
37
|
+
/* @__PURE__ */ n(
|
|
38
|
+
D,
|
|
39
39
|
{
|
|
40
40
|
size: "xs",
|
|
41
41
|
color: "secondary",
|
|
42
|
-
iconLeading: /* @__PURE__ */
|
|
42
|
+
iconLeading: /* @__PURE__ */ n(j, { size: 16 }),
|
|
43
43
|
"aria-label": "Undo",
|
|
44
44
|
title: "Undo",
|
|
45
45
|
isDisabled: e.isDisabled || !e.canUndo,
|
|
46
46
|
onClick: e.onUndo
|
|
47
47
|
}
|
|
48
48
|
),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
49
|
+
/* @__PURE__ */ n(
|
|
50
|
+
D,
|
|
51
51
|
{
|
|
52
52
|
size: "xs",
|
|
53
53
|
color: "secondary",
|
|
54
|
-
iconLeading: /* @__PURE__ */
|
|
54
|
+
iconLeading: /* @__PURE__ */ n(F, { size: 16 }),
|
|
55
55
|
"aria-label": "Redo",
|
|
56
56
|
title: "Redo",
|
|
57
57
|
isDisabled: e.isDisabled || !e.canRedo,
|
|
58
58
|
onClick: e.onRedo
|
|
59
59
|
}
|
|
60
60
|
)
|
|
61
|
-
] })),
|
|
61
|
+
] })), Z = ({ config: e, content: i }) => {
|
|
62
62
|
const l = e.sorts.some((r) => r.field !== "" && r.direction !== "");
|
|
63
63
|
return /* @__PURE__ */ p(
|
|
64
64
|
x.Root,
|
|
@@ -69,45 +69,45 @@ const X = ({ config: e }) => ($({
|
|
|
69
69
|
},
|
|
70
70
|
children: [
|
|
71
71
|
/* @__PURE__ */ p(
|
|
72
|
-
|
|
72
|
+
D,
|
|
73
73
|
{
|
|
74
74
|
size: "xs",
|
|
75
75
|
color: "secondary",
|
|
76
|
-
iconLeading: /* @__PURE__ */
|
|
77
|
-
className:
|
|
76
|
+
iconLeading: /* @__PURE__ */ n(P, { size: 12 }),
|
|
77
|
+
className: A(
|
|
78
78
|
l && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
|
|
79
79
|
),
|
|
80
80
|
children: [
|
|
81
81
|
"Sort",
|
|
82
|
-
l && /* @__PURE__ */
|
|
82
|
+
l && /* @__PURE__ */ n("span", { className: "ml-1 text-xs font-semibold text-brand-600", children: e.sorts.length })
|
|
83
83
|
]
|
|
84
84
|
}
|
|
85
85
|
),
|
|
86
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ n(x.Popover, { className: "w-auto min-w-[300px]", children: i })
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
|
-
},
|
|
90
|
+
}, ee = ({ config: e, content: i }) => {
|
|
91
91
|
const l = e.meaningfulConditionsCount > 0;
|
|
92
92
|
return /* @__PURE__ */ p(x.Root, { isOpen: e.isOpen, onOpenChange: e.onOpenChange, children: [
|
|
93
93
|
/* @__PURE__ */ p(
|
|
94
|
-
|
|
94
|
+
D,
|
|
95
95
|
{
|
|
96
96
|
size: "xs",
|
|
97
97
|
color: "secondary",
|
|
98
|
-
iconLeading: /* @__PURE__ */
|
|
99
|
-
className:
|
|
98
|
+
iconLeading: /* @__PURE__ */ n(J, { name: "FilterLines", size: 12 }),
|
|
99
|
+
className: A(
|
|
100
100
|
l && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
|
|
101
101
|
),
|
|
102
102
|
children: [
|
|
103
103
|
"Filter",
|
|
104
|
-
l && /* @__PURE__ */
|
|
104
|
+
l && /* @__PURE__ */ n("span", { className: "ml-1 text-xs font-semibold text-brand-600", children: e.meaningfulConditionsCount })
|
|
105
105
|
]
|
|
106
106
|
}
|
|
107
107
|
),
|
|
108
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ n(x.Popover, { className: "w-auto min-w-[300px]", children: i })
|
|
109
109
|
] });
|
|
110
|
-
},
|
|
110
|
+
}, we = ({
|
|
111
111
|
className: e,
|
|
112
112
|
fallbackTitle: i,
|
|
113
113
|
undoRedo: l,
|
|
@@ -119,122 +119,124 @@ const X = ({ config: e }) => ($({
|
|
|
119
119
|
align: h,
|
|
120
120
|
groupBy: m,
|
|
121
121
|
summary: g,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
beforeSearch: z,
|
|
123
|
+
trailing: y,
|
|
124
|
+
searchCollapsible: o,
|
|
125
|
+
disableExtendedTools: s = !1,
|
|
126
|
+
sortContent: a,
|
|
127
|
+
filterContent: d
|
|
127
128
|
}) => {
|
|
128
|
-
const
|
|
129
|
-
() => r &&
|
|
130
|
-
[r,
|
|
131
|
-
),
|
|
132
|
-
() => t &&
|
|
133
|
-
[t,
|
|
134
|
-
),
|
|
129
|
+
const b = S(
|
|
130
|
+
() => r && a ? Q(a, r) : a,
|
|
131
|
+
[r, a]
|
|
132
|
+
), w = S(
|
|
133
|
+
() => t && d ? X(d, t) : d,
|
|
134
|
+
[t, d]
|
|
135
|
+
), N = S(() => {
|
|
135
136
|
const c = [];
|
|
136
|
-
if (l && c.push({ id: "undo-redo", node: /* @__PURE__ */
|
|
137
|
-
const
|
|
137
|
+
if (l && c.push({ id: "undo-redo", node: /* @__PURE__ */ n(Y, { config: l }) }), r && b) {
|
|
138
|
+
const f = r.sorts.some((R) => R.field !== "" && R.direction !== "");
|
|
138
139
|
c.push({
|
|
139
140
|
id: "sort",
|
|
140
|
-
widthKey:
|
|
141
|
-
node: /* @__PURE__ */
|
|
141
|
+
widthKey: f ? String(r.sorts.length) : "",
|
|
142
|
+
node: /* @__PURE__ */ n(Z, { config: r, content: b })
|
|
142
143
|
});
|
|
143
144
|
}
|
|
144
|
-
if (t &&
|
|
145
|
+
if (t && w && c.push({
|
|
145
146
|
id: "filter",
|
|
146
147
|
widthKey: t.meaningfulConditionsCount > 0 ? String(t.meaningfulConditionsCount) : "",
|
|
147
|
-
node: /* @__PURE__ */
|
|
148
|
+
node: /* @__PURE__ */ n(ee, { config: t, content: w })
|
|
148
149
|
}), C && c.push({
|
|
149
150
|
id: "row-height",
|
|
150
|
-
node: /* @__PURE__ */
|
|
151
|
+
node: /* @__PURE__ */ n(B, { ...C, isDisabled: s })
|
|
151
152
|
}), v && c.push({
|
|
152
153
|
id: "hide-fields",
|
|
153
154
|
widthKey: v.hiddenColumns.size > 0 ? String(v.hiddenColumns.size) : "",
|
|
154
|
-
node: /* @__PURE__ */
|
|
155
|
-
}), h && c.push({ id: "align", node: /* @__PURE__ */
|
|
156
|
-
const
|
|
155
|
+
node: /* @__PURE__ */ n(_, { ...v, isDisabled: s })
|
|
156
|
+
}), h && c.push({ id: "align", node: /* @__PURE__ */ n(T, { ...h, isDisabled: s }) }), m) {
|
|
157
|
+
const f = m.value ? m.schema.find((K) => K.value === m.value) : void 0, R = f ? $(f, m.labelMeta) : "";
|
|
157
158
|
c.push({
|
|
158
159
|
id: "group-by",
|
|
159
|
-
widthKey:
|
|
160
|
-
node: /* @__PURE__ */
|
|
160
|
+
widthKey: R,
|
|
161
|
+
node: /* @__PURE__ */ n(G, { ...m, isDisabled: s })
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
164
|
return g && c.push({
|
|
164
165
|
id: "summary",
|
|
165
|
-
node: /* @__PURE__ */
|
|
166
|
+
node: /* @__PURE__ */ n(V, { ...g, isDisabled: s })
|
|
166
167
|
}), c;
|
|
167
168
|
}, [
|
|
168
169
|
l,
|
|
169
170
|
r,
|
|
170
|
-
d,
|
|
171
|
-
t,
|
|
172
171
|
b,
|
|
172
|
+
t,
|
|
173
|
+
w,
|
|
173
174
|
C,
|
|
174
175
|
v,
|
|
175
176
|
h,
|
|
176
177
|
m,
|
|
177
178
|
g,
|
|
178
|
-
|
|
179
|
+
s
|
|
179
180
|
]);
|
|
180
|
-
return /* @__PURE__ */ p("div", { className:
|
|
181
|
-
|
|
181
|
+
return /* @__PURE__ */ p("div", { className: A("flex justify-between items-center gap-2", e), children: [
|
|
182
|
+
N.length > 0 ? /* @__PURE__ */ n(oe, { items: N }) : i ? /* @__PURE__ */ n("h4", { className: "text-sm font-normal text-secondary", children: i }) : /* @__PURE__ */ n("div", {}),
|
|
182
183
|
/* @__PURE__ */ p("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
z,
|
|
185
|
+
u && /* @__PURE__ */ n(
|
|
186
|
+
E,
|
|
185
187
|
{
|
|
186
188
|
size: "sm",
|
|
187
189
|
placeholder: "Search",
|
|
188
190
|
value: u.value,
|
|
189
191
|
onChange: u.onChange,
|
|
190
|
-
collapsible:
|
|
191
|
-
isDisabled:
|
|
192
|
+
collapsible: o,
|
|
193
|
+
isDisabled: s,
|
|
192
194
|
shortcut: u.shortcut
|
|
193
195
|
}
|
|
194
196
|
),
|
|
195
|
-
|
|
197
|
+
y
|
|
196
198
|
] })
|
|
197
199
|
] });
|
|
198
|
-
},
|
|
199
|
-
const i =
|
|
200
|
-
|
|
200
|
+
}, ne = 40, L = 8, oe = ({ items: e }) => {
|
|
201
|
+
const i = I(null), l = I(/* @__PURE__ */ new Map()), [r, t] = O(() => /* @__PURE__ */ new Map()), [u, C] = O(null), v = S(() => e.map((o) => `${o.id}:${o.widthKey ?? ""}`).join("|"), [e]);
|
|
202
|
+
W(() => {
|
|
201
203
|
t(/* @__PURE__ */ new Map());
|
|
202
|
-
}, [v]),
|
|
204
|
+
}, [v]), U(() => {
|
|
203
205
|
if (r.size === e.length) return;
|
|
204
|
-
const
|
|
206
|
+
const o = /* @__PURE__ */ new Map();
|
|
205
207
|
for (const s of e) {
|
|
206
208
|
const a = l.current.get(s.id);
|
|
207
|
-
a &&
|
|
209
|
+
a && o.set(s.id, a.getBoundingClientRect().width);
|
|
208
210
|
}
|
|
209
|
-
|
|
210
|
-
}, [e, r]),
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
211
|
+
o.size === e.length && t(o);
|
|
212
|
+
}, [e, r]), U(() => {
|
|
213
|
+
const o = i.current;
|
|
214
|
+
if (!o) return;
|
|
213
215
|
const s = () => {
|
|
214
216
|
i.current && C(i.current.clientWidth);
|
|
215
217
|
};
|
|
216
218
|
s();
|
|
217
219
|
const a = new ResizeObserver(s);
|
|
218
|
-
return a.observe(
|
|
220
|
+
return a.observe(o), () => a.disconnect();
|
|
219
221
|
}, []);
|
|
220
|
-
const h = r.size === e.length, { visibleIds: m, overflowIds: g } =
|
|
222
|
+
const h = r.size === e.length, { visibleIds: m, overflowIds: g } = S(() => {
|
|
221
223
|
if (!h || u == null)
|
|
222
224
|
return {
|
|
223
225
|
visibleIds: new Set(e.map((d) => d.id)),
|
|
224
226
|
overflowIds: /* @__PURE__ */ new Set()
|
|
225
227
|
};
|
|
226
|
-
let
|
|
228
|
+
let o = 0;
|
|
227
229
|
const s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
228
230
|
for (let d = 0; d < e.length; d++) {
|
|
229
|
-
const b = e[d].id,
|
|
230
|
-
if (
|
|
231
|
+
const b = e[d].id, w = r.get(b) ?? 0, c = e.length - d - 1 > 0 ? ne + L : 0;
|
|
232
|
+
if (o + w + c > u) {
|
|
231
233
|
for (let f = d; f < e.length; f++) a.add(e[f].id);
|
|
232
234
|
break;
|
|
233
235
|
}
|
|
234
|
-
|
|
236
|
+
o += w + L, s.add(b);
|
|
235
237
|
}
|
|
236
238
|
return { visibleIds: s, overflowIds: a };
|
|
237
|
-
}, [e, r, u, h]), z = e.filter((
|
|
239
|
+
}, [e, r, u, h]), z = e.filter((o) => m.has(o.id)), y = e.filter((o) => g.has(o.id));
|
|
238
240
|
return /* @__PURE__ */ p(
|
|
239
241
|
"div",
|
|
240
242
|
{
|
|
@@ -242,36 +244,36 @@ const X = ({ config: e }) => ($({
|
|
|
242
244
|
className: "flex items-center gap-2 min-w-0 flex-1 overflow-hidden",
|
|
243
245
|
style: h ? void 0 : { visibility: "hidden" },
|
|
244
246
|
children: [
|
|
245
|
-
(h ? z : e).map((
|
|
247
|
+
(h ? z : e).map((o) => /* @__PURE__ */ n(
|
|
246
248
|
"div",
|
|
247
249
|
{
|
|
248
250
|
ref: (s) => {
|
|
249
|
-
l.current.set(
|
|
251
|
+
l.current.set(o.id, s);
|
|
250
252
|
},
|
|
251
253
|
className: "shrink-0",
|
|
252
|
-
children:
|
|
254
|
+
children: o.node
|
|
253
255
|
},
|
|
254
|
-
|
|
256
|
+
o.id
|
|
255
257
|
)),
|
|
256
|
-
h &&
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
|
|
258
|
+
h && y.length > 0 && /* @__PURE__ */ p(x.Root, { children: [
|
|
259
|
+
/* @__PURE__ */ n(
|
|
260
|
+
D,
|
|
259
261
|
{
|
|
260
262
|
size: "xs",
|
|
261
263
|
color: "secondary",
|
|
262
|
-
iconLeading: /* @__PURE__ */
|
|
264
|
+
iconLeading: /* @__PURE__ */ n(H, { size: 16 }),
|
|
263
265
|
"aria-label": "More tools",
|
|
264
266
|
title: "More tools",
|
|
265
267
|
className: "shrink-0"
|
|
266
268
|
}
|
|
267
269
|
),
|
|
268
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ n(x.Popover, { className: "w-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col items-stretch gap-2 p-2 min-w-[180px]", children: y.map((o) => /* @__PURE__ */ n("div", { className: "[&>*]:w-full", children: o.node }, o.id)) }) })
|
|
269
271
|
] })
|
|
270
272
|
]
|
|
271
273
|
}
|
|
272
274
|
);
|
|
273
275
|
};
|
|
274
|
-
function
|
|
276
|
+
function xe(e) {
|
|
275
277
|
return {
|
|
276
278
|
sort: e.sort,
|
|
277
279
|
filter: e.filter,
|
|
@@ -279,6 +281,6 @@ function we(e) {
|
|
|
279
281
|
};
|
|
280
282
|
}
|
|
281
283
|
export {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
we as TableToolbar,
|
|
285
|
+
xe as pickCoreToolbarProps
|
|
284
286
|
};
|
|
@@ -4,7 +4,7 @@ import { UndoRedoToolConfig } from './toolbar/TableToolbar';
|
|
|
4
4
|
import { LegacyFilterToolConfig, LegacySortToolConfig } from './toolbar/legacyToolbarTypes';
|
|
5
5
|
import { AlignToolConfig, GroupByToolConfig, HideFieldsToolConfig, RowHeightToolConfig, SearchToolConfig, SummaryToolConfig, CellAlignment, ColumnMenuAction, ColumnMenuCapabilities, RowActionsConfig, RowGroup, SummaryFooterRowProps } from './toolbar';
|
|
6
6
|
import { TableCellRangeRect, TableCellSelection } from './cellRangeSelection';
|
|
7
|
-
export type { TableCellCoord, TableCellRangeRect, TableCellSelection } from './cellRangeSelection';
|
|
7
|
+
export type { TableCellCoord, TableCellRangeRect, TableCellSelection, } from './cellRangeSelection';
|
|
8
8
|
/** Value type used for alignment defaults and aggregation eligibility. */
|
|
9
9
|
export type TableColumnValueType = "string" | "number" | "currency" | "date" | "percentage" | "decimal_percentage" | "array" | "link";
|
|
10
10
|
/**
|
|
@@ -34,6 +34,41 @@ export interface TableColumnMenuSchema {
|
|
|
34
34
|
}
|
|
35
35
|
/** Alias for `TablePaginationConfig` — matches platform-ui `TableWrapperPaginationConfig`. */
|
|
36
36
|
export type TableWrapperPaginationConfig = TablePaginationConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Opt-in Excel-style zoom for horizontally wide tables. Values are percentages, and the
|
|
39
|
+
* zoom scales the whole grid — text, padding, row heights and column widths together —
|
|
40
|
+
* so lowering it fits more columns in the available width at a smaller size.
|
|
41
|
+
*
|
|
42
|
+
* Zooming out never paints the grid narrower than its container: the columns shrink while
|
|
43
|
+
* the grid still overflows, then hold once it exactly fills, so the table is never left
|
|
44
|
+
* with dead space to its right.
|
|
45
|
+
*
|
|
46
|
+
* Requires CSS `zoom` (Chrome 128+, Safari, Firefox 126+). On an engine without it the
|
|
47
|
+
* table falls back to its unzoomed layout and the control is not rendered, so there is no
|
|
48
|
+
* dead slider — but there is also no zoom.
|
|
49
|
+
*
|
|
50
|
+
* The object may be a fresh literal on every render; `TableWrapper` keys its internal
|
|
51
|
+
* config off the four values below, not the object identity, so an inline literal will not
|
|
52
|
+
* reset a zoom level the user has set.
|
|
53
|
+
*/
|
|
54
|
+
export type TableZoomConfig = {
|
|
55
|
+
/** Initial zoom percentage. Defaults to 100. */
|
|
56
|
+
defaultZoom?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Lowest allowed zoom percentage. Defaults to 60, and is the real limit — zooming out
|
|
59
|
+
* past the point where the grid fits is allowed, so on a table that already fills its
|
|
60
|
+
* container the columns keep shrinking and the right edge pulls in from the container.
|
|
61
|
+
*/
|
|
62
|
+
minZoom?: number;
|
|
63
|
+
/** Highest allowed zoom percentage. Defaults to 120. */
|
|
64
|
+
maxZoom?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Increment the slider snaps to, in percentage points. Defaults to 10. Steps are measured
|
|
67
|
+
* from `minZoom`, so a step that divides the range keeps the readout on round numbers.
|
|
68
|
+
* Set to 1 for continuous dragging.
|
|
69
|
+
*/
|
|
70
|
+
step?: number;
|
|
71
|
+
};
|
|
37
72
|
export type TableWrapperToolbarConfig = {
|
|
38
73
|
sort?: LegacySortToolConfig;
|
|
39
74
|
filter?: LegacyFilterToolConfig;
|
|
@@ -137,6 +172,8 @@ export type TableWrapperProps = {
|
|
|
137
172
|
labelMeta?: unknown;
|
|
138
173
|
toolbarSlot?: ReactNode;
|
|
139
174
|
fillWidth?: boolean;
|
|
175
|
+
/** Enables compact column zoom controls and calculated column widths. */
|
|
176
|
+
zoom?: TableZoomConfig;
|
|
140
177
|
rowActions?: RowActionsConfig;
|
|
141
178
|
onCellActivate?: (info: {
|
|
142
179
|
rowId: string;
|