@postxl/ui-components 1.3.9 → 1.3.11
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 +262 -257
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3926,11 +3926,12 @@ const DataGridRow = React$29.memo(DataGridRowImpl, (prev, next) => {
|
|
|
3926
3926
|
}
|
|
3927
3927
|
if (prev.selectionSize !== next.selectionSize) return false;
|
|
3928
3928
|
if (prev.visibleColumnIds !== next.visibleColumnIds) return false;
|
|
3929
|
+
if (prev.columnPinningKey !== next.columnPinningKey) return false;
|
|
3929
3930
|
if (prev.isHighlighted !== next.isHighlighted) return false;
|
|
3930
3931
|
if (prev.columnDefsVersion !== next.columnDefsVersion) return false;
|
|
3931
3932
|
return true;
|
|
3932
3933
|
});
|
|
3933
|
-
function DataGridRowImpl({ row, virtualRowIndex, virtualStart, rowVirtualizer, rowMapRef, rowHeight, focusedCell, editingCell: _editingCell, selectionSize: _selectionSize, visibleColumnIds: _visibleColumnIds, columnDefsVersion: _columnDefsVersion, isHighlighted = false, onRowClick, ref, className,...props }) {
|
|
3934
|
+
function DataGridRowImpl({ row, virtualRowIndex, virtualStart, rowVirtualizer, rowMapRef, rowHeight, focusedCell, editingCell: _editingCell, selectionSize: _selectionSize, visibleColumnIds: _visibleColumnIds, columnPinningKey: _columnPinningKey, columnDefsVersion: _columnDefsVersion, isHighlighted = false, onRowClick, ref, className,...props }) {
|
|
3934
3935
|
const rowRef = useComposedRefs(ref, (node) => {
|
|
3935
3936
|
if (node && typeof virtualRowIndex !== "undefined") {
|
|
3936
3937
|
rowVirtualizer.measureElement(node);
|
|
@@ -4132,7 +4133,7 @@ function DataGridSearchImpl({ searchMatches, matchIndex, searchOpen, onSearchOpe
|
|
|
4132
4133
|
|
|
4133
4134
|
//#endregion
|
|
4134
4135
|
//#region src/data-grid/data-grid.tsx
|
|
4135
|
-
function DataGrid({ dataGridRef, headerRef, rowMapRef, footerRef, table, rowVirtualizer, height, searchState, columnSizeVars, onRowAdd, className,...props }) {
|
|
4136
|
+
function DataGrid({ dataGridRef, headerRef, rowMapRef, footerRef, table, rowVirtualizer, height, forceHeight = false, searchState, columnSizeVars, onRowAdd, className,...props }) {
|
|
4136
4137
|
const rows = table.getRowModel().rows;
|
|
4137
4138
|
const columns = table.getAllColumns();
|
|
4138
4139
|
const meta = table.options.meta;
|
|
@@ -4144,6 +4145,8 @@ function DataGrid({ dataGridRef, headerRef, rowMapRef, footerRef, table, rowVirt
|
|
|
4144
4145
|
const onRowClick = meta?.onRowClick;
|
|
4145
4146
|
const columnDefsVersion = meta?.columnDefsVersion ?? 0;
|
|
4146
4147
|
const visibleColumnIds = table.getVisibleLeafColumns().map((c) => c.id).join(",");
|
|
4148
|
+
const pinningState = table.getState().columnPinning;
|
|
4149
|
+
const columnPinningKey = `${(pinningState.left ?? []).join(",")}|${(pinningState.right ?? []).join(",")}`;
|
|
4147
4150
|
const prevVisibleColumnIdsRef = React$25.useRef(visibleColumnIds);
|
|
4148
4151
|
if (prevVisibleColumnIdsRef.current !== visibleColumnIds) {
|
|
4149
4152
|
rowMapRef.current.clear();
|
|
@@ -4181,10 +4184,10 @@ function DataGrid({ dataGridRef, headerRef, rowMapRef, footerRef, table, rowVirt
|
|
|
4181
4184
|
"data-slot": "grid",
|
|
4182
4185
|
tabIndex: 0,
|
|
4183
4186
|
ref: dataGridRef,
|
|
4184
|
-
className: "relative grid select-none overflow-auto rounded-md border border-border focus:outline-none",
|
|
4187
|
+
className: cn("relative grid select-none overflow-auto rounded-md border border-border focus:outline-none", forceHeight && "content-start"),
|
|
4185
4188
|
style: {
|
|
4186
4189
|
...columnSizeVars,
|
|
4187
|
-
height: `${Math.min(rowVirtualizer.getTotalSize() + headerHeight + footerHeight + scrollbarHeight + 3, height ?? Infinity)}px`
|
|
4190
|
+
height: `${forceHeight && height ? height : Math.min(rowVirtualizer.getTotalSize() + headerHeight + footerHeight + scrollbarHeight + 3, height ?? Infinity)}px`
|
|
4188
4191
|
},
|
|
4189
4192
|
onContextMenu: onGridContextMenu,
|
|
4190
4193
|
children: [
|
|
@@ -4255,6 +4258,7 @@ function DataGrid({ dataGridRef, headerRef, rowMapRef, footerRef, table, rowVirt
|
|
|
4255
4258
|
editingCell,
|
|
4256
4259
|
selectionSize,
|
|
4257
4260
|
visibleColumnIds,
|
|
4261
|
+
columnPinningKey,
|
|
4258
4262
|
columnDefsVersion,
|
|
4259
4263
|
isHighlighted: highlightedRowIndex === virtualItem.index,
|
|
4260
4264
|
onRowClick
|
|
@@ -5633,6 +5637,7 @@ function DataGridViewMenu({ table, savedViews, activeViewId, currentUserId, isAd
|
|
|
5633
5637
|
setRenameValue("");
|
|
5634
5638
|
setDeletingViewId(null);
|
|
5635
5639
|
setUpdatingViewId(null);
|
|
5640
|
+
setSearchQuery("");
|
|
5636
5641
|
}
|
|
5637
5642
|
const tableColumnOrder = table.getState().columnOrder;
|
|
5638
5643
|
React$14.useEffect(() => {
|
|
@@ -6005,6 +6010,7 @@ function DataGridViewMenu({ table, savedViews, activeViewId, currentUserId, isAd
|
|
|
6005
6010
|
isCreating ? /* @__PURE__ */ jsxs("div", {
|
|
6006
6011
|
className: "px-2 pb-2 space-y-1",
|
|
6007
6012
|
children: [/* @__PURE__ */ jsx(Input, {
|
|
6013
|
+
variant: "simple",
|
|
6008
6014
|
value: newViewName,
|
|
6009
6015
|
onChange: (e) => setNewViewName(e.target.value),
|
|
6010
6016
|
onKeyDown: (e) => {
|
|
@@ -6027,7 +6033,7 @@ function DataGridViewMenu({ table, savedViews, activeViewId, currentUserId, isAd
|
|
|
6027
6033
|
"Share with all users"
|
|
6028
6034
|
]
|
|
6029
6035
|
}), /* @__PURE__ */ jsxs("div", {
|
|
6030
|
-
className: "flex items-center gap-1",
|
|
6036
|
+
className: "ml-auto flex items-center gap-1 py-1",
|
|
6031
6037
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
6032
6038
|
variant: "ghost",
|
|
6033
6039
|
size: "sm",
|
|
@@ -6098,7 +6104,7 @@ function DataGridViewMenu({ table, savedViews, activeViewId, currentUserId, isAd
|
|
|
6098
6104
|
}),
|
|
6099
6105
|
/* @__PURE__ */ jsx("span", {
|
|
6100
6106
|
className: "truncate",
|
|
6101
|
-
children: column.columnDef.meta?.label ?? column.id
|
|
6107
|
+
children: column.columnDef.meta?.label ?? (typeof column.columnDef.header === "string" ? column.columnDef.header : column.id)
|
|
6102
6108
|
}),
|
|
6103
6109
|
/* @__PURE__ */ jsx(CheckIcon$1, { className: cn(
|
|
6104
6110
|
"ml-auto size-4 shrink-0",
|
|
@@ -6681,6 +6687,13 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
6681
6687
|
debouncedRowClick
|
|
6682
6688
|
]);
|
|
6683
6689
|
const onCellEditingStart = React$13.useCallback((rowIndex, columnId) => {
|
|
6690
|
+
const col = tableRef.current?.getColumn(columnId);
|
|
6691
|
+
const editable = col?.columnDef?.meta?.editable;
|
|
6692
|
+
if (editable === false) return;
|
|
6693
|
+
if (typeof editable === "function") {
|
|
6694
|
+
const row = tableRef.current?.getRowModel().rows[rowIndex]?.original;
|
|
6695
|
+
if (row && !editable(row)) return;
|
|
6696
|
+
}
|
|
6684
6697
|
store.batch(() => {
|
|
6685
6698
|
store.setState("focusedCell", {
|
|
6686
6699
|
rowIndex,
|