@povio/ui 3.2.4-rc.3 → 3.3.0-rc.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/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +0 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +127 -142
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +17 -2
- package/dist/components/inputs/DateTime/shared/DateField.js +87 -92
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +0 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +134 -144
- package/dist/components/inputs/FormField/FormField.js +47 -34
- package/dist/components/inputs/FormField/formField.cva.d.ts +11 -0
- package/dist/components/inputs/FormField/formField.cva.js +16 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +1 -2
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +1 -2
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +2 -54
- package/dist/components/inputs/Selection/Select/QuerySelect.js +46 -99
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -1
- package/dist/components/inputs/shared/input.cva.js +1 -1
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/table/Table.d.ts +8 -2
- package/dist/components/table/Table.js +55 -33
- package/dist/components/table/TableColumnFilterInput.d.ts +9 -0
- package/dist/components/table/TableColumnFilterInput.js +108 -0
- package/dist/components/table/TableColumnFilterPlaceholder.d.ts +5 -0
- package/dist/components/table/TableColumnFilterPlaceholder.js +41 -0
- package/dist/components/table/TableColumnFilterRow.d.ts +16 -0
- package/dist/components/table/TableColumnFilterRow.js +68 -0
- package/dist/config/uiConfig.context.d.ts +0 -1
- package/dist/config/uiConfig.context.js +1 -2
- package/dist/config/uiOverrides.context.d.ts +1 -0
- package/dist/helpers/dynamicColumns.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/date-time.utils.d.ts +1 -0
- package/dist/utils/date-time.utils.js +45 -21
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +0 -33
- package/dist/utils/intl.utils.d.ts +0 -7
- package/dist/utils/intl.utils.js +0 -38
- package/dist/utils/intl.utils.spec.d.ts +0 -1
|
@@ -8,10 +8,9 @@ import { useState } from "react";
|
|
|
8
8
|
import { mergeRefs } from "@react-aria/utils";
|
|
9
9
|
import { Controller } from "react-hook-form";
|
|
10
10
|
//#region src/components/inputs/Selection/Select/QuerySelect.tsx
|
|
11
|
-
var
|
|
11
|
+
var QuerySelectContent = (t0) => {
|
|
12
12
|
const $ = c(31);
|
|
13
|
-
const { query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds,
|
|
14
|
-
const isQueryEnabledInitially = t1 === void 0 ? false : t1;
|
|
13
|
+
const { query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, ...props } = t0;
|
|
15
14
|
const ui = UIConfig.useConfig();
|
|
16
15
|
const [search, setSearch] = useState("");
|
|
17
16
|
const isSearchable = props.isSearchable ?? ui.select.isSearchable;
|
|
@@ -22,44 +21,44 @@ var LoadedQuerySelectContent = (t0) => {
|
|
|
22
21
|
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
23
22
|
});
|
|
24
23
|
const shouldEnableInitialQuery = selectedIdsToResolve.count > 0;
|
|
25
|
-
let
|
|
24
|
+
let t1;
|
|
26
25
|
if ($[0] !== queryMap) {
|
|
27
|
-
|
|
26
|
+
t1 = (data) => getQueryItems(data, queryMap);
|
|
28
27
|
$[0] = queryMap;
|
|
29
|
-
$[1] =
|
|
30
|
-
} else
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
if ($[2] !== query || $[3] !== queryOptions || $[4] !== queryParams || $[5] !== selectedIdsToResolve.items || $[6] !==
|
|
36
|
-
|
|
28
|
+
$[1] = t1;
|
|
29
|
+
} else t1 = $[1];
|
|
30
|
+
const t2 = resolveSelectedItemsWithIds ?? ui.querySelect?.resolveSelectedItemsWithIds;
|
|
31
|
+
const t3 = isSearchable ? search : void 0;
|
|
32
|
+
const t4 = shouldEnableInitialQuery ? false : props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled;
|
|
33
|
+
let t5;
|
|
34
|
+
if ($[2] !== query || $[3] !== queryOptions || $[4] !== queryParams || $[5] !== selectedIdsToResolve.items || $[6] !== t1 || $[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
|
|
35
|
+
t5 = {
|
|
37
36
|
query,
|
|
38
37
|
queryParams,
|
|
39
38
|
queryOptions,
|
|
40
|
-
mapItems:
|
|
41
|
-
resolveSelectedItemsWithIds:
|
|
42
|
-
search:
|
|
43
|
-
initialQueryState:
|
|
39
|
+
mapItems: t1,
|
|
40
|
+
resolveSelectedItemsWithIds: t2,
|
|
41
|
+
search: t3,
|
|
42
|
+
initialQueryState: t4,
|
|
44
43
|
selectedIdsToResolve: selectedIdsToResolve.items
|
|
45
44
|
};
|
|
46
45
|
$[2] = query;
|
|
47
46
|
$[3] = queryOptions;
|
|
48
47
|
$[4] = queryParams;
|
|
49
48
|
$[5] = selectedIdsToResolve.items;
|
|
50
|
-
$[6] =
|
|
51
|
-
$[7] =
|
|
52
|
-
$[8] =
|
|
53
|
-
$[9] =
|
|
54
|
-
$[10] =
|
|
55
|
-
} else
|
|
56
|
-
const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete(
|
|
49
|
+
$[6] = t1;
|
|
50
|
+
$[7] = t2;
|
|
51
|
+
$[8] = t3;
|
|
52
|
+
$[9] = t4;
|
|
53
|
+
$[10] = t5;
|
|
54
|
+
} else t5 = $[10];
|
|
55
|
+
const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete(t5);
|
|
57
56
|
let onSearchChange;
|
|
58
57
|
let selectProps;
|
|
59
58
|
if ($[11] !== props) {
|
|
60
|
-
const { isInitialQueryDisabled: _, onSearchChange:
|
|
61
|
-
onSearchChange =
|
|
62
|
-
selectProps =
|
|
59
|
+
const { isInitialQueryDisabled: _, onSearchChange: t6, ...t7 } = props;
|
|
60
|
+
onSearchChange = t6;
|
|
61
|
+
selectProps = t7;
|
|
63
62
|
$[11] = props;
|
|
64
63
|
$[12] = onSearchChange;
|
|
65
64
|
$[13] = selectProps;
|
|
@@ -67,9 +66,9 @@ var LoadedQuerySelectContent = (t0) => {
|
|
|
67
66
|
onSearchChange = $[12];
|
|
68
67
|
selectProps = $[13];
|
|
69
68
|
}
|
|
70
|
-
let
|
|
69
|
+
let t6;
|
|
71
70
|
if ($[14] !== handleEnableQuery || $[15] !== onSearchChange || $[16] !== setSearch) {
|
|
72
|
-
|
|
71
|
+
t6 = (value_0) => {
|
|
73
72
|
setSearch(value_0);
|
|
74
73
|
handleEnableQuery();
|
|
75
74
|
onSearchChange?.(value_0);
|
|
@@ -77,33 +76,33 @@ var LoadedQuerySelectContent = (t0) => {
|
|
|
77
76
|
$[14] = handleEnableQuery;
|
|
78
77
|
$[15] = onSearchChange;
|
|
79
78
|
$[16] = setSearch;
|
|
80
|
-
$[17] =
|
|
81
|
-
} else
|
|
82
|
-
const handleSearchChange =
|
|
83
|
-
const
|
|
84
|
-
let
|
|
79
|
+
$[17] = t6;
|
|
80
|
+
} else t6 = $[17];
|
|
81
|
+
const handleSearchChange = t6;
|
|
82
|
+
const t7 = props.searchDebounceDelay ?? ui.querySelect?.searchDebounceDelay;
|
|
83
|
+
let t8;
|
|
85
84
|
if ($[18] !== handleSearchChange || $[19] !== isSearchable) {
|
|
86
|
-
|
|
85
|
+
t8 = isSearchable && {
|
|
87
86
|
isClientSearchDisabled: true,
|
|
88
87
|
onSearchChange: handleSearchChange
|
|
89
88
|
};
|
|
90
89
|
$[18] = handleSearchChange;
|
|
91
90
|
$[19] = isSearchable;
|
|
92
|
-
$[20] =
|
|
93
|
-
} else
|
|
94
|
-
let
|
|
95
|
-
if ($[21] !== fetchNextPage || $[22] !== handleEnableQuery || $[23] !== hasNextPage || $[24] !== isLoading || $[25] !== items || $[26] !== selectProps || $[27] !==
|
|
96
|
-
|
|
91
|
+
$[20] = t8;
|
|
92
|
+
} else t8 = $[20];
|
|
93
|
+
let t9;
|
|
94
|
+
if ($[21] !== fetchNextPage || $[22] !== handleEnableQuery || $[23] !== hasNextPage || $[24] !== isLoading || $[25] !== items || $[26] !== selectProps || $[27] !== t7 || $[28] !== t8 || $[29] !== totalItems) {
|
|
95
|
+
t9 = /* @__PURE__ */ jsx(Select, {
|
|
97
96
|
...selectProps,
|
|
98
97
|
items,
|
|
99
98
|
isLoading,
|
|
100
99
|
totalItems,
|
|
101
100
|
hasLoadMore: hasNextPage,
|
|
102
101
|
onLoadMore: fetchNextPage,
|
|
103
|
-
searchDebounceDelay:
|
|
102
|
+
searchDebounceDelay: t7,
|
|
104
103
|
onMouseEnter: handleEnableQuery,
|
|
105
104
|
onFocusCapture: handleEnableQuery,
|
|
106
|
-
...
|
|
105
|
+
...t8
|
|
107
106
|
});
|
|
108
107
|
$[21] = fetchNextPage;
|
|
109
108
|
$[22] = handleEnableQuery;
|
|
@@ -111,64 +110,12 @@ var LoadedQuerySelectContent = (t0) => {
|
|
|
111
110
|
$[24] = isLoading;
|
|
112
111
|
$[25] = items;
|
|
113
112
|
$[26] = selectProps;
|
|
114
|
-
$[27] =
|
|
115
|
-
$[28] =
|
|
113
|
+
$[27] = t7;
|
|
114
|
+
$[28] = t8;
|
|
116
115
|
$[29] = totalItems;
|
|
117
|
-
$[30] =
|
|
118
|
-
} else
|
|
119
|
-
return
|
|
120
|
-
};
|
|
121
|
-
var QuerySelectContent = (props) => {
|
|
122
|
-
const $ = c(9);
|
|
123
|
-
const [isQueryMounted, setIsQueryMounted] = useState(false);
|
|
124
|
-
const value = "value" in props ? props.value : void 0;
|
|
125
|
-
if (!getSelectionIdsToResolve({
|
|
126
|
-
initialSelection: props.initialSelection,
|
|
127
|
-
value,
|
|
128
|
-
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
129
|
-
}).isResolvedByInitialSelection || isQueryMounted) {
|
|
130
|
-
let t0;
|
|
131
|
-
if ($[0] !== isQueryMounted || $[1] !== props) {
|
|
132
|
-
t0 = /* @__PURE__ */ jsx(LoadedQuerySelectContent, {
|
|
133
|
-
...props,
|
|
134
|
-
isQueryEnabledInitially: isQueryMounted
|
|
135
|
-
});
|
|
136
|
-
$[0] = isQueryMounted;
|
|
137
|
-
$[1] = props;
|
|
138
|
-
$[2] = t0;
|
|
139
|
-
} else t0 = $[2];
|
|
140
|
-
return t0;
|
|
141
|
-
}
|
|
142
|
-
let selectProps;
|
|
143
|
-
if ($[3] !== props) {
|
|
144
|
-
const { query: _, queryParams: _queryParams, queryOptions: _queryOptions, queryMap: _queryMap, resolveSelectedItemsWithIds: _resolveSelectedItemsWithIds, isInitialQueryDisabled: _isInitialQueryDisabled, ...t0 } = props;
|
|
145
|
-
selectProps = t0;
|
|
146
|
-
$[3] = props;
|
|
147
|
-
$[4] = selectProps;
|
|
148
|
-
} else selectProps = $[4];
|
|
149
|
-
let t0;
|
|
150
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
151
|
-
t0 = () => setIsQueryMounted(true);
|
|
152
|
-
$[5] = t0;
|
|
153
|
-
} else t0 = $[5];
|
|
154
|
-
const mountQuery = t0;
|
|
155
|
-
let t1;
|
|
156
|
-
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
157
|
-
t1 = [];
|
|
158
|
-
$[6] = t1;
|
|
159
|
-
} else t1 = $[6];
|
|
160
|
-
let t2;
|
|
161
|
-
if ($[7] !== selectProps) {
|
|
162
|
-
t2 = /* @__PURE__ */ jsx(Select, {
|
|
163
|
-
...selectProps,
|
|
164
|
-
items: t1,
|
|
165
|
-
onMouseEnter: mountQuery,
|
|
166
|
-
onFocusCapture: mountQuery
|
|
167
|
-
});
|
|
168
|
-
$[7] = selectProps;
|
|
169
|
-
$[8] = t2;
|
|
170
|
-
} else t2 = $[8];
|
|
171
|
-
return t2;
|
|
116
|
+
$[30] = t9;
|
|
117
|
+
} else t9 = $[30];
|
|
118
|
+
return t9;
|
|
172
119
|
};
|
|
173
120
|
var QuerySelect = (props) => {
|
|
174
121
|
const $ = c(16);
|
|
@@ -9,7 +9,6 @@ export declare const getSelectionIdsToResolve: <TInitialSelectItem, TKey extends
|
|
|
9
9
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
10
10
|
}) => {
|
|
11
11
|
count: number;
|
|
12
|
-
isResolvedByInitialSelection: boolean;
|
|
13
12
|
items: TKey[];
|
|
14
13
|
};
|
|
15
14
|
export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => SelectItem<TKey>[];
|
|
@@ -26,7 +26,6 @@ var getSelectionIdsToResolve = ({ initialSelection, value, mapInitialToSelectIte
|
|
|
26
26
|
const items = Array.from(new Set([...missingLabelInitialSelectionIds, ...values.filter((id) => !labeledInitialSelectionIds.has(id))]));
|
|
27
27
|
return {
|
|
28
28
|
count: items.length,
|
|
29
|
-
isResolvedByInitialSelection: values.length > 0 && values.every((id) => labeledInitialSelectionIds.has(id)),
|
|
30
29
|
items
|
|
31
30
|
};
|
|
32
31
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { DragEndEvent, UniqueIdentifier } from '@dnd-kit/core';
|
|
2
2
|
import { ColumnDef, ColumnOrderState, OnChangeFn, Table as ReactTable, Row, RowSelectionState, SortingState, VisibilityState } from '@tanstack/react-table';
|
|
3
3
|
import { TFunction } from 'i18next';
|
|
4
|
-
import { ComponentType, Dispatch, SetStateAction } from 'react';
|
|
4
|
+
import { ComponentType, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
5
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
6
|
+
import { InputDef } from '../inputs/Inputs/InputItem';
|
|
5
7
|
import { TableRowVariantProps } from './table.cva';
|
|
6
8
|
export type BulkSelectionActionsComponent<T> = ComponentType<{
|
|
7
9
|
table: ReactTable<T>;
|
|
@@ -30,8 +32,12 @@ export interface TableProps<T> extends TableRowVariantProps {
|
|
|
30
32
|
enableMultiRowSelection?: boolean | ((row: Row<T>) => boolean);
|
|
31
33
|
defaultSelectedRows?: RowSelectionState;
|
|
32
34
|
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
35
|
+
filterForm?: UseFormReturn<Record<string, any>>;
|
|
36
|
+
filterDefs?: InputDef<any>[];
|
|
37
|
+
headerFilterCellClassName?: string;
|
|
38
|
+
emptyContent?: ReactNode;
|
|
33
39
|
}
|
|
34
40
|
export declare const RowDragHandleCell: ({ rowId }: {
|
|
35
41
|
rowId: string;
|
|
36
42
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
-
export declare const Table: <T>({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection, defaultSelectedRows, onRowSelectionChange, ...props }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare const Table: <T>({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection, defaultSelectedRows, onRowSelectionChange, filterForm, filterDefs, headerFilterCellClassName, emptyContent, ...props }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,6 +8,7 @@ import { tableDataDefinition, tableHeadDataDefinition, tableHeadRowDefinition, t
|
|
|
8
8
|
import { CellText } from "./CellText.js";
|
|
9
9
|
import { DragIndicatorIcon } from "../../assets/icons/DragIndicator.js";
|
|
10
10
|
import { HeaderText } from "./HeaderText.js";
|
|
11
|
+
import { TableColumnFilterRow } from "./TableColumnFilterRow.js";
|
|
11
12
|
import { useTableNav } from "../../hooks/useTableNav.js";
|
|
12
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { clsx } from "clsx";
|
|
@@ -74,7 +75,7 @@ var DraggableRow = ({ row, showCellBorder, onRowClick, onDoubleClick, tableRowCv
|
|
|
74
75
|
})
|
|
75
76
|
});
|
|
76
77
|
};
|
|
77
|
-
var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange, ...props }) => {
|
|
78
|
+
var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange, filterForm, filterDefs, headerFilterCellClassName, emptyContent, ...props }) => {
|
|
78
79
|
const tableRowCva = UIOverrides.useCva("table.rowCva", tableRowDefinition);
|
|
79
80
|
const theadCva = UIOverrides.useCva("table.theadCva", theadDefinition);
|
|
80
81
|
const tableHeadRowCva = UIOverrides.useCva("table.headRowCva", tableHeadRowDefinition);
|
|
@@ -172,50 +173,71 @@ var Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, classN
|
|
|
172
173
|
const selectedRows = table.getSelectedRowModel().rows;
|
|
173
174
|
const columnCount = table.getHeaderGroups()[0].headers.length;
|
|
174
175
|
const isAnyRowSelected = selectedRows.length > 0 && !!ActionHeader;
|
|
176
|
+
const showFilterRow = !!filterForm && !!filterDefs?.length && !isAnyRowSelected;
|
|
175
177
|
const hasOnClick = !!onRowClick || !!onDoubleClick;
|
|
176
178
|
const tableElement = /* @__PURE__ */ jsxs("table", {
|
|
177
|
-
className: clsx("w-full", className),
|
|
179
|
+
className: clsx("w-full", showFilterRow && "table-fixed", className),
|
|
178
180
|
...listeners,
|
|
179
181
|
children: [/* @__PURE__ */ jsxs("thead", {
|
|
180
182
|
className: clsx(theadCva({})),
|
|
181
183
|
"data-is-sticky": isSticky || void 0,
|
|
182
|
-
children: [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return /* @__PURE__ */ jsx("
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("th", {
|
|
186
|
+
ref: stickyRef,
|
|
187
|
+
className: "-mt-px block"
|
|
188
|
+
}) }),
|
|
189
|
+
table.getHeaderGroups().map((headerGroup) => {
|
|
190
|
+
const visibleHeaders = headerGroup.headers.filter((header) => {
|
|
191
|
+
if (isAnyRowSelected && header.index > 0) return false;
|
|
192
|
+
return header.column.getIsVisible();
|
|
193
|
+
});
|
|
194
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
195
|
+
className: clsx(tableHeadRowCva({})),
|
|
196
|
+
children: visibleHeaders.map((header_0, index) => {
|
|
197
|
+
const columnMeta = header_0.column.columnDef.meta ?? {};
|
|
198
|
+
return /* @__PURE__ */ jsx("th", {
|
|
199
|
+
colSpan: isAnyRowSelected ? columnCount : header_0.colSpan,
|
|
200
|
+
tabIndex: -1,
|
|
201
|
+
className: clsx(tableHeadDataCva({ hasRightBorder: index > 0 && showCellBorder }), columnMeta.headerClass, columnMeta.width),
|
|
202
|
+
children: isAnyRowSelected ? /* @__PURE__ */ jsx(ActionHeader, { table }) : /* @__PURE__ */ jsxs("button", {
|
|
203
|
+
type: "button",
|
|
204
|
+
"aria-label": "Sort column",
|
|
205
|
+
className: clsx("flex select-none items-center gap-1 text-text-default-1", header_0.column.getCanSort() ? "h-6 cursor-pointer rounded-xs px-1 hover:bg-elevation-fill-default-2" : "cursor-default", columnMeta.sortClass),
|
|
206
|
+
onClick: header_0.column.getToggleSortingHandler(),
|
|
207
|
+
children: [typeof header_0.column.columnDef.header === "function" ? flexRender(header_0.column.columnDef.header, header_0.getContext()) : /* @__PURE__ */ jsx(HeaderText, { children: header_0.column.columnDef.header }), {
|
|
208
|
+
asc: /* @__PURE__ */ jsx(ChevronUpIcon, {
|
|
209
|
+
width: 18,
|
|
210
|
+
height: 18
|
|
211
|
+
}),
|
|
212
|
+
desc: /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
213
|
+
width: 18,
|
|
214
|
+
height: 18
|
|
215
|
+
})
|
|
216
|
+
}[header_0.column.getIsSorted()] ?? null]
|
|
209
217
|
})
|
|
210
|
-
}
|
|
218
|
+
}, header_0.id);
|
|
211
219
|
})
|
|
212
|
-
},
|
|
220
|
+
}, headerGroup.id);
|
|
221
|
+
}),
|
|
222
|
+
showFilterRow && table.getHeaderGroups().map((headerGroup_0) => {
|
|
223
|
+
return /* @__PURE__ */ jsx(TableColumnFilterRow, {
|
|
224
|
+
headers: headerGroup_0.headers.filter((header_1) => header_1.column.getIsVisible()),
|
|
225
|
+
filterForm,
|
|
226
|
+
filterDefs,
|
|
227
|
+
tableHeadDataCva,
|
|
228
|
+
rowClassName: clsx(tableHeadRowCva({})),
|
|
229
|
+
cellClassName: headerFilterCellClassName,
|
|
230
|
+
showCellBorder
|
|
231
|
+
}, `${headerGroup_0.id}-filters`);
|
|
213
232
|
})
|
|
214
|
-
|
|
233
|
+
]
|
|
215
234
|
}), /* @__PURE__ */ jsx("tbody", {
|
|
216
235
|
ref,
|
|
217
236
|
className: "relative",
|
|
218
|
-
children:
|
|
237
|
+
children: table.getRowModel().rows.length === 0 && emptyContent ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
238
|
+
colSpan: columnCount,
|
|
239
|
+
children: emptyContent
|
|
240
|
+
}) }) : enableDragDrop ? /* @__PURE__ */ jsx(SortableContext, {
|
|
219
241
|
items: dataIds,
|
|
220
242
|
strategy: verticalListSortingStrategy,
|
|
221
243
|
children: table.getRowModel().rows.map((row_0) => /* @__PURE__ */ jsx(DraggableRow, {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InputDef } from '../inputs/Inputs/InputItem';
|
|
2
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
3
|
+
interface TableColumnFilterInputProps<TFilterData extends Record<string, any>> {
|
|
4
|
+
form: UseFormReturn<TFilterData>;
|
|
5
|
+
inputDef: InputDef<TFilterData>;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const TableColumnFilterInput: <TFilterData extends Record<string, any>>({ form, inputDef, className, }: TableColumnFilterInputProps<TFilterData>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Inputs } from "../inputs/Inputs/Inputs.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
//#region src/components/table/TableColumnFilterInput.tsx
|
|
6
|
+
var TableColumnFilterInput = (t0) => {
|
|
7
|
+
const $ = c(28);
|
|
8
|
+
const { form, inputDef, className } = t0;
|
|
9
|
+
const filterKey = String(inputDef.name);
|
|
10
|
+
const inputProps = inputDef.props;
|
|
11
|
+
const t1 = inputProps?.className;
|
|
12
|
+
let t2;
|
|
13
|
+
if ($[0] !== t1) {
|
|
14
|
+
t2 = clsx("w-full min-w-0 max-w-full", t1, "[&_label]:sr-only");
|
|
15
|
+
$[0] = t1;
|
|
16
|
+
$[1] = t2;
|
|
17
|
+
} else t2 = $[1];
|
|
18
|
+
const t3 = inputProps?.containerClassName;
|
|
19
|
+
let t4;
|
|
20
|
+
if ($[2] !== t3) {
|
|
21
|
+
t4 = clsx("w-full min-w-0 max-w-full", t3);
|
|
22
|
+
$[2] = t3;
|
|
23
|
+
$[3] = t4;
|
|
24
|
+
} else t4 = $[3];
|
|
25
|
+
const t5 = inputProps?.inputClassName;
|
|
26
|
+
let t6;
|
|
27
|
+
if ($[4] !== t5) {
|
|
28
|
+
t6 = clsx("min-w-0 max-w-full truncate", t5);
|
|
29
|
+
$[4] = t5;
|
|
30
|
+
$[5] = t6;
|
|
31
|
+
} else t6 = $[5];
|
|
32
|
+
let t7;
|
|
33
|
+
if ($[6] !== inputProps || $[7] !== t2 || $[8] !== t4 || $[9] !== t6) {
|
|
34
|
+
t7 = {
|
|
35
|
+
...inputProps,
|
|
36
|
+
as: "filter",
|
|
37
|
+
className: t2,
|
|
38
|
+
containerClassName: t4,
|
|
39
|
+
inputClassName: t6,
|
|
40
|
+
hideLabel: true,
|
|
41
|
+
isClearable: true,
|
|
42
|
+
placeholder: "",
|
|
43
|
+
size: "extra-small"
|
|
44
|
+
};
|
|
45
|
+
$[6] = inputProps;
|
|
46
|
+
$[7] = t2;
|
|
47
|
+
$[8] = t4;
|
|
48
|
+
$[9] = t6;
|
|
49
|
+
$[10] = t7;
|
|
50
|
+
} else t7 = $[10];
|
|
51
|
+
const props = t7;
|
|
52
|
+
let t8;
|
|
53
|
+
if ($[11] !== filterKey || $[12] !== inputDef.label) {
|
|
54
|
+
t8 = typeof inputDef.label === "string" && inputDef.label.trim() ? inputDef.label : filterKey;
|
|
55
|
+
$[11] = filterKey;
|
|
56
|
+
$[12] = inputDef.label;
|
|
57
|
+
$[13] = t8;
|
|
58
|
+
} else t8 = $[13];
|
|
59
|
+
let t9;
|
|
60
|
+
if ($[14] !== inputDef || $[15] !== props || $[16] !== t8) {
|
|
61
|
+
t9 = {
|
|
62
|
+
...inputDef,
|
|
63
|
+
label: t8,
|
|
64
|
+
placeholder: "",
|
|
65
|
+
props
|
|
66
|
+
};
|
|
67
|
+
$[14] = inputDef;
|
|
68
|
+
$[15] = props;
|
|
69
|
+
$[16] = t8;
|
|
70
|
+
$[17] = t9;
|
|
71
|
+
} else t9 = $[17];
|
|
72
|
+
const inlineInputDef = t9;
|
|
73
|
+
let t10;
|
|
74
|
+
if ($[18] !== className) {
|
|
75
|
+
t10 = clsx("w-full min-w-0 max-w-full [&>*]:w-full [&_*]:min-w-0", className);
|
|
76
|
+
$[18] = className;
|
|
77
|
+
$[19] = t10;
|
|
78
|
+
} else t10 = $[19];
|
|
79
|
+
let t11;
|
|
80
|
+
if ($[20] !== inlineInputDef) {
|
|
81
|
+
t11 = [inlineInputDef];
|
|
82
|
+
$[20] = inlineInputDef;
|
|
83
|
+
$[21] = t11;
|
|
84
|
+
} else t11 = $[21];
|
|
85
|
+
let t12;
|
|
86
|
+
if ($[22] !== form || $[23] !== t11) {
|
|
87
|
+
t12 = /* @__PURE__ */ jsx(Inputs, {
|
|
88
|
+
form,
|
|
89
|
+
inputDefs: t11
|
|
90
|
+
});
|
|
91
|
+
$[22] = form;
|
|
92
|
+
$[23] = t11;
|
|
93
|
+
$[24] = t12;
|
|
94
|
+
} else t12 = $[24];
|
|
95
|
+
let t13;
|
|
96
|
+
if ($[25] !== t10 || $[26] !== t12) {
|
|
97
|
+
t13 = /* @__PURE__ */ jsx("div", {
|
|
98
|
+
className: t10,
|
|
99
|
+
children: t12
|
|
100
|
+
});
|
|
101
|
+
$[25] = t10;
|
|
102
|
+
$[26] = t12;
|
|
103
|
+
$[27] = t13;
|
|
104
|
+
} else t13 = $[27];
|
|
105
|
+
return t13;
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
export { TableColumnFilterInput };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
//#region src/components/table/TableColumnFilterPlaceholder.tsx
|
|
5
|
+
var columnFilterPlaceholderClassName = clsx("h-[calc(var(--spacing-input-height-xs)*2+var(--text-label-2)*var(--text-label-2--line-height)+2px)]", "flex w-full min-w-0 items-center overflow-hidden", "rounded-input-rounding-default border border-solid border-input-outlined-outline-disabled/50", "bg-input-filled-idle px-input-side-xs text-label-2");
|
|
6
|
+
var TableColumnFilterPlaceholder = (t0) => {
|
|
7
|
+
const $ = c(8);
|
|
8
|
+
const { label } = t0;
|
|
9
|
+
const t1 = label ? void 0 : true;
|
|
10
|
+
const t2 = label && "text-text-default-2";
|
|
11
|
+
let t3;
|
|
12
|
+
if ($[0] !== t2) {
|
|
13
|
+
t3 = clsx(columnFilterPlaceholderClassName, t2);
|
|
14
|
+
$[0] = t2;
|
|
15
|
+
$[1] = t3;
|
|
16
|
+
} else t3 = $[1];
|
|
17
|
+
let t4;
|
|
18
|
+
if ($[2] !== label) {
|
|
19
|
+
t4 = label ? /* @__PURE__ */ jsx("span", {
|
|
20
|
+
className: "min-w-0 truncate",
|
|
21
|
+
children: label
|
|
22
|
+
}) : null;
|
|
23
|
+
$[2] = label;
|
|
24
|
+
$[3] = t4;
|
|
25
|
+
} else t4 = $[3];
|
|
26
|
+
let t5;
|
|
27
|
+
if ($[4] !== t1 || $[5] !== t3 || $[6] !== t4) {
|
|
28
|
+
t5 = /* @__PURE__ */ jsx("div", {
|
|
29
|
+
"aria-hidden": t1,
|
|
30
|
+
className: t3,
|
|
31
|
+
children: t4
|
|
32
|
+
});
|
|
33
|
+
$[4] = t1;
|
|
34
|
+
$[5] = t3;
|
|
35
|
+
$[6] = t4;
|
|
36
|
+
$[7] = t5;
|
|
37
|
+
} else t5 = $[7];
|
|
38
|
+
return t5;
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { TableColumnFilterPlaceholder };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Header } from '@tanstack/react-table';
|
|
2
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import { InputDef } from '../inputs/Inputs/InputItem';
|
|
4
|
+
import { UIOverrides } from '../../config/uiOverrides.context';
|
|
5
|
+
import { TableHeadDataVariantProps } from './table.cva';
|
|
6
|
+
interface TableColumnFilterRowProps<T> {
|
|
7
|
+
headers: Header<T, unknown>[];
|
|
8
|
+
filterForm: UseFormReturn<Record<string, any>>;
|
|
9
|
+
filterDefs: InputDef<any>[];
|
|
10
|
+
tableHeadDataCva: UIOverrides.Cva<TableHeadDataVariantProps>;
|
|
11
|
+
rowClassName?: string;
|
|
12
|
+
cellClassName?: string;
|
|
13
|
+
showCellBorder?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const TableColumnFilterRow: <T>({ headers, filterForm, filterDefs, tableHeadDataCva, rowClassName, cellClassName, showCellBorder, }: TableColumnFilterRowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TableColumnFilterInput } from "./TableColumnFilterInput.js";
|
|
2
|
+
import { TableColumnFilterPlaceholder } from "./TableColumnFilterPlaceholder.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
//#region src/components/table/TableColumnFilterRow.tsx
|
|
7
|
+
var getColumnMeta = (header) => header.column.columnDef.meta ?? {};
|
|
8
|
+
var TableColumnFilterRow = (t0) => {
|
|
9
|
+
const $ = c(18);
|
|
10
|
+
const { headers, filterForm, filterDefs, tableHeadDataCva, rowClassName, cellClassName, showCellBorder } = t0;
|
|
11
|
+
let t1;
|
|
12
|
+
if ($[0] !== filterDefs) {
|
|
13
|
+
t1 = new Map((filterDefs ?? []).map(_temp));
|
|
14
|
+
$[0] = filterDefs;
|
|
15
|
+
$[1] = t1;
|
|
16
|
+
} else t1 = $[1];
|
|
17
|
+
const inputDefsByName = t1;
|
|
18
|
+
let t2;
|
|
19
|
+
if ($[2] !== cellClassName || $[3] !== filterForm || $[4] !== headers || $[5] !== inputDefsByName || $[6] !== showCellBorder || $[7] !== tableHeadDataCva) {
|
|
20
|
+
let t3;
|
|
21
|
+
if ($[9] !== cellClassName || $[10] !== filterForm || $[11] !== inputDefsByName || $[12] !== showCellBorder || $[13] !== tableHeadDataCva) {
|
|
22
|
+
t3 = (header, index) => {
|
|
23
|
+
const columnMeta = getColumnMeta(header);
|
|
24
|
+
const filterKey = columnMeta.filterKey ?? header.column.id;
|
|
25
|
+
const filterDef_0 = inputDefsByName.get(filterKey);
|
|
26
|
+
return /* @__PURE__ */ jsx("th", {
|
|
27
|
+
colSpan: header.colSpan,
|
|
28
|
+
tabIndex: -1,
|
|
29
|
+
className: clsx(tableHeadDataCva({ hasRightBorder: index > 0 && showCellBorder }), "min-w-0 max-w-full overflow-hidden", cellClassName, columnMeta.width),
|
|
30
|
+
children: filterDef_0 ? /* @__PURE__ */ jsx(TableColumnFilterInput, {
|
|
31
|
+
form: filterForm,
|
|
32
|
+
inputDef: filterDef_0
|
|
33
|
+
}) : /* @__PURE__ */ jsx(TableColumnFilterPlaceholder, {})
|
|
34
|
+
}, `${header.id}-filter`);
|
|
35
|
+
};
|
|
36
|
+
$[9] = cellClassName;
|
|
37
|
+
$[10] = filterForm;
|
|
38
|
+
$[11] = inputDefsByName;
|
|
39
|
+
$[12] = showCellBorder;
|
|
40
|
+
$[13] = tableHeadDataCva;
|
|
41
|
+
$[14] = t3;
|
|
42
|
+
} else t3 = $[14];
|
|
43
|
+
t2 = headers.map(t3);
|
|
44
|
+
$[2] = cellClassName;
|
|
45
|
+
$[3] = filterForm;
|
|
46
|
+
$[4] = headers;
|
|
47
|
+
$[5] = inputDefsByName;
|
|
48
|
+
$[6] = showCellBorder;
|
|
49
|
+
$[7] = tableHeadDataCva;
|
|
50
|
+
$[8] = t2;
|
|
51
|
+
} else t2 = $[8];
|
|
52
|
+
let t3;
|
|
53
|
+
if ($[15] !== rowClassName || $[16] !== t2) {
|
|
54
|
+
t3 = /* @__PURE__ */ jsx("tr", {
|
|
55
|
+
className: rowClassName,
|
|
56
|
+
children: t2
|
|
57
|
+
});
|
|
58
|
+
$[15] = rowClassName;
|
|
59
|
+
$[16] = t2;
|
|
60
|
+
$[17] = t3;
|
|
61
|
+
} else t3 = $[17];
|
|
62
|
+
return t3;
|
|
63
|
+
};
|
|
64
|
+
function _temp(filterDef) {
|
|
65
|
+
return [String(filterDef.name), filterDef];
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { TableColumnFilterRow };
|
|
@@ -48,7 +48,6 @@ export declare namespace UIConfig {
|
|
|
48
48
|
setDateValueOnDateSelection?: boolean;
|
|
49
49
|
timeZone?: string;
|
|
50
50
|
todayIconButtonComponent?: DatePickerProps["todayIconButtonComponent"];
|
|
51
|
-
allowPartialRange?: boolean;
|
|
52
51
|
};
|
|
53
52
|
actionModal: Pick<ActionModalProps, "titleTypography" | "descriptionTypography">;
|
|
54
53
|
bottomSheet: Pick<BottomSheetProps, "closeDragThreshold" | "closeVelocityThreshold" | "hideThumb" | "headerTypography">;
|