@prairielearn/ui 3.1.3 → 3.1.5
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/CHANGELOG.md +15 -0
- package/dist/components/CategoricalColumnFilter.d.ts +2 -2
- package/dist/components/CategoricalColumnFilter.d.ts.map +1 -1
- package/dist/components/CategoricalColumnFilter.js.map +1 -1
- package/dist/components/ColumnManager.d.ts +2 -2
- package/dist/components/ColumnManager.d.ts.map +1 -1
- package/dist/components/ColumnManager.js.map +1 -1
- package/dist/components/MultiSelectColumnFilter.d.ts +2 -2
- package/dist/components/MultiSelectColumnFilter.d.ts.map +1 -1
- package/dist/components/MultiSelectColumnFilter.js.map +1 -1
- package/dist/components/TanstackTable.d.ts +7 -7
- package/dist/components/TanstackTable.d.ts.map +1 -1
- package/dist/components/TanstackTable.js +1 -1
- package/dist/components/TanstackTable.js.map +1 -1
- package/dist/components/TanstackTableHeaderCell.d.ts +2 -2
- package/dist/components/TanstackTableHeaderCell.d.ts.map +1 -1
- package/dist/components/TanstackTableHeaderCell.js.map +1 -1
- package/dist/components/useAutoSizeColumns.d.ts +2 -2
- package/dist/components/useAutoSizeColumns.d.ts.map +1 -1
- package/dist/components/useAutoSizeColumns.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CategoricalColumnFilter.tsx +2 -2
- package/src/components/ColumnManager.tsx +2 -2
- package/src/components/MultiSelectColumnFilter.tsx +2 -2
- package/src/components/TanstackTable.tsx +7 -15
- package/src/components/TanstackTableHeaderCell.tsx +2 -2
- package/src/components/useAutoSizeColumns.tsx +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Column, type Table } from '@tanstack/react-table';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ReactNode, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import Button from 'react-bootstrap/Button';
|
|
5
5
|
import Dropdown from 'react-bootstrap/Dropdown';
|
|
6
6
|
|
|
@@ -195,7 +195,7 @@ function ColumnItem<RowDataModel>({
|
|
|
195
195
|
|
|
196
196
|
interface ColumnManagerProps<RowDataModel> {
|
|
197
197
|
table: Table<RowDataModel>;
|
|
198
|
-
topContent?:
|
|
198
|
+
topContent?: ReactNode;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Column } from '@tanstack/table-core';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ReactNode, useMemo } from 'react';
|
|
4
4
|
import Dropdown from 'react-bootstrap/Dropdown';
|
|
5
5
|
|
|
6
6
|
function defaultRenderValueLabel({ value }: { value: string }) {
|
|
@@ -27,7 +27,7 @@ export function MultiSelectColumnFilter<TData, TValue extends string = string>({
|
|
|
27
27
|
}: {
|
|
28
28
|
column: Column<TData, unknown>;
|
|
29
29
|
allColumnValues: TValue[];
|
|
30
|
-
renderValueLabel?: (props: { value: TValue; isSelected: boolean }) =>
|
|
30
|
+
renderValueLabel?: (props: { value: TValue; isSelected: boolean }) => ReactNode;
|
|
31
31
|
}) {
|
|
32
32
|
const columnId = column.id;
|
|
33
33
|
|
|
@@ -2,15 +2,7 @@ import { flexRender } from '@tanstack/react-table';
|
|
|
2
2
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
3
3
|
import type { Cell, Header, Row, Table } from '@tanstack/table-core';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import {
|
|
6
|
-
type ComponentProps,
|
|
7
|
-
type JSX,
|
|
8
|
-
type ReactNode,
|
|
9
|
-
useEffect,
|
|
10
|
-
useMemo,
|
|
11
|
-
useRef,
|
|
12
|
-
useState,
|
|
13
|
-
} from 'react';
|
|
5
|
+
import { type ComponentProps, type ReactNode, useEffect, useMemo, useRef, useState } from 'react';
|
|
14
6
|
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
|
|
15
7
|
import Tooltip from 'react-bootstrap/Tooltip';
|
|
16
8
|
import { useDebouncedCallback } from 'use-debounce';
|
|
@@ -92,10 +84,10 @@ const DefaultEmptyState = (
|
|
|
92
84
|
interface TanstackTableProps<RowDataModel> {
|
|
93
85
|
table: Table<RowDataModel>;
|
|
94
86
|
title: string;
|
|
95
|
-
filters?: Record<string, (props: { header: Header<RowDataModel, unknown> }) =>
|
|
87
|
+
filters?: Record<string, (props: { header: Header<RowDataModel, unknown> }) => ReactNode>;
|
|
96
88
|
rowHeight?: number;
|
|
97
|
-
noResultsState?:
|
|
98
|
-
emptyState?:
|
|
89
|
+
noResultsState?: ReactNode;
|
|
90
|
+
emptyState?: ReactNode;
|
|
99
91
|
scrollRef?: React.RefObject<HTMLDivElement | null> | null;
|
|
100
92
|
}
|
|
101
93
|
|
|
@@ -521,10 +513,10 @@ export function TanstackTableCard<RowDataModel>({
|
|
|
521
513
|
title: string;
|
|
522
514
|
singularLabel: string;
|
|
523
515
|
pluralLabel: string;
|
|
524
|
-
headerButtons?:
|
|
516
|
+
headerButtons?: ReactNode;
|
|
525
517
|
columnManager?: {
|
|
526
|
-
buttons?:
|
|
527
|
-
topContent?:
|
|
518
|
+
buttons?: ReactNode;
|
|
519
|
+
topContent?: ReactNode;
|
|
528
520
|
};
|
|
529
521
|
globalFilter: {
|
|
530
522
|
placeholder: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { flexRender } from '@tanstack/react-table';
|
|
2
2
|
import type { Header, SortDirection, Table } from '@tanstack/table-core';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import type { CSSProperties,
|
|
4
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
function SortIcon({ sortMethod }: { sortMethod: false | SortDirection }) {
|
|
7
7
|
if (sortMethod === 'asc') {
|
|
@@ -104,7 +104,7 @@ export function TanstackTableHeaderCell<RowDataModel>({
|
|
|
104
104
|
measurementMode = false,
|
|
105
105
|
}: {
|
|
106
106
|
header: Header<RowDataModel, unknown>;
|
|
107
|
-
filters: Record<string, (props: { header: Header<RowDataModel, unknown> }) =>
|
|
107
|
+
filters: Record<string, (props: { header: Header<RowDataModel, unknown> }) => ReactNode>;
|
|
108
108
|
table: Table<RowDataModel>;
|
|
109
109
|
handleResizeEnd?: () => void;
|
|
110
110
|
isPinned: 'left' | false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColumnSizingState, Header, Table } from '@tanstack/react-table';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ReactNode, type RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { flushSync } from 'react-dom';
|
|
4
4
|
import { type Root, createRoot } from 'react-dom/client';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ function HiddenMeasurementHeader<TData>({
|
|
|
12
12
|
}: {
|
|
13
13
|
table: Table<TData>;
|
|
14
14
|
columnsToMeasure: { id: string }[];
|
|
15
|
-
filters?: Record<string, (props: { header: Header<TData, unknown> }) =>
|
|
15
|
+
filters?: Record<string, (props: { header: Header<TData, unknown> }) => ReactNode>;
|
|
16
16
|
}) {
|
|
17
17
|
const headerGroups = table.getHeaderGroups();
|
|
18
18
|
const leafHeaderGroup = headerGroups[headerGroups.length - 1];
|
|
@@ -64,7 +64,7 @@ function HiddenMeasurementHeader<TData>({
|
|
|
64
64
|
export function useAutoSizeColumns<TData>(
|
|
65
65
|
table: Table<TData>,
|
|
66
66
|
tableRef: RefObject<HTMLDivElement | null>,
|
|
67
|
-
filters?: Record<string, (props: { header: Header<TData, unknown> }) =>
|
|
67
|
+
filters?: Record<string, (props: { header: Header<TData, unknown> }) => ReactNode>,
|
|
68
68
|
): boolean {
|
|
69
69
|
const measurementContainerRef = useRef<HTMLDivElement | null>(null);
|
|
70
70
|
const measurementRootRef = useRef<Root | null>(null);
|