@crispy-seed/data-table 0.10.5 → 0.11.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/dist/data-table-recipe.css +58 -0
- package/dist/data-table-recipe.layered.css +63 -0
- package/dist/index.cjs +725 -359
- package/dist/index.d.ts +82 -15
- package/dist/index.js +725 -360
- package/dist/styles.css +63 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -57,18 +57,22 @@ interface ToolbarFilter {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
60
|
+
* Attio-parity follow-up (bring the discovery doc's PARTIAL #7 to full parity, on top
|
|
61
|
+
* of the earlier GRC live-review fix): the ColumnCalc footer's own aggregation set --
|
|
62
|
+
* six apply to every column, six more to numeric ones, one more to non-numeric ones.
|
|
63
|
+
* The six universal ops are `count` (GRC's own addition, kept) plus Attio's measured
|
|
64
|
+
* four -- `empty`/`notEmpty` labelled "Count empty"/"Count filled", `percentEmpty` /
|
|
65
|
+
* `percentFilled` -- plus `none`, which is Attio's own menu entry for "no calculation",
|
|
66
|
+
* not a conditionally-appended "Clear" item: it renders nothing (`computeColumnCalc`
|
|
67
|
+
* returns `null` for it) and, unlike `setColumnCalcOp(key, undefined)`, is a real,
|
|
68
|
+
* explicit, controllable op value so it overrides a column's `summaryDefaultOp`
|
|
69
|
+
* instead of falling back to it. Numeric columns still additionally get sum / average
|
|
70
|
+
* / median / min / max / range (GRC's set, not in Attio's own measured menu but kept --
|
|
71
|
+
* this table's contract, not a straight port); non-numeric columns still get
|
|
72
|
+
* count-unique. The styled layer picks which extra set to offer off the column's own
|
|
73
|
+
* cell type (`column-calc.tsx`'s `ColumnCalcCell`).
|
|
70
74
|
*/
|
|
71
|
-
type DataTableCalcOp = "count" | "empty" | "notEmpty" | "sum" | "average" | "median" | "min" | "max" | "range" | "countUnique";
|
|
75
|
+
type DataTableCalcOp = "count" | "empty" | "notEmpty" | "percentEmpty" | "percentFilled" | "none" | "sum" | "average" | "median" | "min" | "max" | "range" | "countUnique";
|
|
72
76
|
|
|
73
77
|
/** Everything a saved view actually captures -- deliberately the same five controlled
|
|
74
78
|
* props `useDataTableColumns` + the toolbar sort/filter hooks already expose, so
|
|
@@ -114,6 +118,15 @@ interface UseDataTableViewsProps {
|
|
|
114
118
|
storageKey?: string;
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
/** The context a consumer's `cellContextMenuItems` render slot gets -- everything it
|
|
122
|
+
* needs to build its own `MenuItem`s (which row/column this menu opened for, the raw
|
|
123
|
+
* value already read off `getColumnValue`) without re-deriving any of it itself. */
|
|
124
|
+
interface DataTableCellContextMenuContext<TRow> {
|
|
125
|
+
row: TRow;
|
|
126
|
+
column: DataTableColumn<TRow>;
|
|
127
|
+
value: unknown;
|
|
128
|
+
}
|
|
129
|
+
|
|
117
130
|
type DataTableCellType = "text" | "entity" | "url" | "email" | "tags" | "status" | "number" | "currency" | "date" | "datetime" | "rating" | "checkbox" | "chip" | "chip-list";
|
|
118
131
|
|
|
119
132
|
/** A `select`/`reference`/`actor` editor's own choice list -- `value`/`label` are
|
|
@@ -185,8 +198,11 @@ interface DataTableColumn<TRow> {
|
|
|
185
198
|
* 절대 스크롤되어 사라지지 않도록 오른쪽 끝에 고정합니다 -- 이 플래그가 있는 열은 테이블
|
|
186
199
|
* 전체의 `stickyLast`를 켜지 않아도 자동으로 그 고정 + 왼쪽 스크롤 그림자
|
|
187
200
|
* (`stickyProps`/`stickyLast`가 이미 구현한 것과 동일한 메커니즘, `data-sticky-edge-end`
|
|
188
|
-
* / `data-scrolled-end`)를 받습니다.
|
|
189
|
-
*
|
|
201
|
+
* / `data-scrolled-end`)를 받습니다. `stickyLast`는 이 플래그가 붙은 열을 직접 찾아
|
|
202
|
+
* 고정합니다 (`column-layout.ts`의 `useEffectiveColumns`) -- 더 이상 "마지막으로 보이는
|
|
203
|
+
* 열"이어야만 한다는 제약이 없습니다. 내부적으로도 `reconcileColumnOrder`(react-headless의
|
|
204
|
+
* `dom.ts`)가 이 열을 항상 맨 끝에 유지하므로, 마운트 이후 추가된 새 열이 이 열보다 뒤로
|
|
205
|
+
* 붙어 고정 셀 뒤에 가려지는 일도 없습니다.
|
|
190
206
|
*/
|
|
191
207
|
actions?: boolean;
|
|
192
208
|
/**
|
|
@@ -320,6 +336,17 @@ interface DataTableProps<TRow extends {
|
|
|
320
336
|
/** 전체 선택 체크박스가 일부만 선택됐을 때(indeterminate) 표시할 아이콘입니다.
|
|
321
337
|
* 생략하면 karrot의 minus 아이콘을 씁니다. */
|
|
322
338
|
selectionIndeterminateIcon?: react.ReactNode;
|
|
339
|
+
/**
|
|
340
|
+
* 행이 하나 이상 선택되면 테이블 하단 중앙에 뜨는 벌크 액션 바(Attio 스타일 floating
|
|
341
|
+
* pill, gap #4)에 넣을 소비자 액션입니다. 현재 선택된 행 id 목록을 받는 render prop --
|
|
342
|
+
* 이 컴포넌트는 바의 크롬("N selected" + 지우기 버튼)만 제공하고, 실제 액션 버튼(Add
|
|
343
|
+
* to list, Send email, …)은 항상 소비자 자신의 것입니다 (`toolbarActions`와 같은
|
|
344
|
+
* "크롬 vs 소비자 콘텐츠" 분리). 생략하면 바는 크롬만 보여줍니다. `selectable`이 꺼져
|
|
345
|
+
* 있으면 무시됩니다(선택 자체가 없으므로).
|
|
346
|
+
*/
|
|
347
|
+
bulkActions?: (selectedIds: string[]) => react.ReactNode;
|
|
348
|
+
/** 벌크 액션 바의 지우기(x) 버튼 접근성 이름입니다. @default "Clear selection" */
|
|
349
|
+
clearSelectionLabel?: string;
|
|
323
350
|
/** 제어할 검색어입니다. */
|
|
324
351
|
query?: string;
|
|
325
352
|
/** 비제어 방식으로 사용할 때의 초기 검색어입니다. */
|
|
@@ -429,6 +456,24 @@ interface DataTableProps<TRow extends {
|
|
|
429
456
|
* 커밋됩니다.
|
|
430
457
|
*/
|
|
431
458
|
onEdit?: (id: string, key: string, value: string) => Promise<void> | void;
|
|
459
|
+
/**
|
|
460
|
+
* Attio parity (attio-column-features-full.md gap #1) -- right-click any body cell
|
|
461
|
+
* to open a menu: Copy (any cell, built-in -- `navigator.clipboard.writeText` of the
|
|
462
|
+
* cell's own display text), Clear value/Paste (editable cells only, see
|
|
463
|
+
* `cell-context-menu.tsx`'s own `isClearableEditableCell`/`isSimpleEditableCell` for
|
|
464
|
+
* exactly which shapes qualify), and View edit history (only when
|
|
465
|
+
* `onViewEditHistory` is passed). @default true
|
|
466
|
+
*/
|
|
467
|
+
cellContextMenu?: boolean;
|
|
468
|
+
/** Shown as "View edit history" in the cell context menu, only when passed -- the
|
|
469
|
+
* consumer owns whatever history UI opens (a drawer, a modal, …); this component
|
|
470
|
+
* only fires the callback with the row and the column's key. */
|
|
471
|
+
onViewEditHistory?: (row: TRow, columnKey: string) => void;
|
|
472
|
+
/** Extra `MenuItem`s appended to the end of every cell's right-click menu (e.g. a
|
|
473
|
+
* consumer's own "Assign to…") -- rendered inside the SAME `MenuScrollArea` the
|
|
474
|
+
* built-in items are, so a `<MenuItem>` from this package's own `Menu` export
|
|
475
|
+
* composes the way `column-menu.tsx`'s own items do. */
|
|
476
|
+
cellContextMenuItems?: (ctx: DataTableCellContextMenuContext<TRow>) => react.ReactNode;
|
|
432
477
|
/** 행을 클릭할 수 있게 하는 호버 표시입니다 (crisp의 3%/4% 포그라운드 틴트). 커서
|
|
433
478
|
* 모양은 `onRowClick`이 있는지에 따로 달려 있습니다 -- 이 값과 독립적으로 켤 수
|
|
434
479
|
* 있습니다(crisp의 두 prop, `interactive`/`onRowClick`도 서로 독립적입니다). */
|
|
@@ -527,6 +572,28 @@ declare namespace DataTableViewsControl {
|
|
|
527
572
|
var displayName: string;
|
|
528
573
|
}
|
|
529
574
|
|
|
575
|
+
interface DataTableBulkBarProps {
|
|
576
|
+
/** The clear ("x") button's accessible name. @default "Clear selection" */
|
|
577
|
+
clearLabel?: string;
|
|
578
|
+
/**
|
|
579
|
+
* The consumer's own bulk-action buttons, as a render prop receiving the current
|
|
580
|
+
* selected row ids -- e.g. `<DataTableBulkBar>{(ids) => <ActionButton
|
|
581
|
+
* onClick={() => addToList(ids)}>Add to list</ActionButton>}</DataTableBulkBar>`.
|
|
582
|
+
* Omit for just the bar's own chrome ("N selected" + clear).
|
|
583
|
+
*/
|
|
584
|
+
children?: (selectedIds: string[]) => react.ReactNode;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* The floating bulk-action pill (gap #4) -- renders nothing while no row is selected
|
|
588
|
+
* (reads `selectedIds` off the table-wide context itself, so a consumer doesn't have
|
|
589
|
+
* to gate this on `selectable`/`selectedIds` on their own). Composed as the LAST
|
|
590
|
+
* child of the table's own root (`DataTable.tsx`), which is `position: relative` for
|
|
591
|
+
* exactly this reason -- see `data-table.ts`'s own `bulkBar` slot comment for why its
|
|
592
|
+
* geometry borrows `contextual-floating-button`'s already-measured vars rather than a
|
|
593
|
+
* guessed literal.
|
|
594
|
+
*/
|
|
595
|
+
declare function DataTableBulkBar({ clearLabel, children, }: DataTableBulkBarProps): react_jsx_runtime.JSX.Element | null;
|
|
596
|
+
|
|
530
597
|
type ResizablePanelSide = "left" | "right";
|
|
531
598
|
|
|
532
599
|
type ResizablePanelHandleVariant = "panel" | "column";
|
|
@@ -917,5 +984,5 @@ declare namespace RecordPreview {
|
|
|
917
984
|
var displayName: string;
|
|
918
985
|
}
|
|
919
986
|
|
|
920
|
-
export { DataTable, DataTableViewsControl, RecordPreview, ResizablePanel };
|
|
921
|
-
export type { DataTableColumn, DataTableColumnKind, DataTableProps, DataTableView, DataTableViewState, DataTableViewsControlProps, RecordPreviewHighlight, RecordPreviewProps, RecordPreviewRecord, RecordPreviewSection, RecordPreviewTab, ResizablePanelHandleVariant, ResizablePanelProps, ResizablePanelSide, ToolbarFilter, ToolbarFilterOp, ToolbarSort, ToolbarSortDirection };
|
|
987
|
+
export { DataTable, DataTableBulkBar, DataTableViewsControl, RecordPreview, ResizablePanel };
|
|
988
|
+
export type { DataTableBulkBarProps, DataTableCellContextMenuContext, DataTableColumn, DataTableColumnKind, DataTableProps, DataTableView, DataTableViewState, DataTableViewsControlProps, RecordPreviewHighlight, RecordPreviewProps, RecordPreviewRecord, RecordPreviewSection, RecordPreviewTab, ResizablePanelHandleVariant, ResizablePanelProps, ResizablePanelSide, ToolbarFilter, ToolbarFilterOp, ToolbarSort, ToolbarSortDirection };
|