@ayasofyazilim/ui 0.0.0
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/__mocks__/canvas.ts +8 -0
- package/components.json +21 -0
- package/eslint.config.js +4 -0
- package/jest-environment.js +37 -0
- package/jest.config.ts +47 -0
- package/jest.setup.ts +69 -0
- package/package.json +124 -0
- package/postcss.config.mjs +6 -0
- package/src/aria/index.tsx +1 -0
- package/src/aria/number-field.tsx +41 -0
- package/src/components/.gitkeep +0 -0
- package/src/components/accordion.tsx +66 -0
- package/src/components/alert-dialog.tsx +157 -0
- package/src/components/alert.tsx +70 -0
- package/src/components/aspect-ratio.tsx +11 -0
- package/src/components/avatar.tsx +53 -0
- package/src/components/badge.tsx +67 -0
- package/src/components/breadcrumb.tsx +109 -0
- package/src/components/button-group.tsx +83 -0
- package/src/components/button.tsx +68 -0
- package/src/components/calendar.tsx +219 -0
- package/src/components/card.tsx +92 -0
- package/src/components/carousel.tsx +241 -0
- package/src/components/chart.tsx +363 -0
- package/src/components/checkbox.tsx +32 -0
- package/src/components/collapsible.tsx +33 -0
- package/src/components/command.tsx +184 -0
- package/src/components/context-menu.tsx +252 -0
- package/src/components/dialog.tsx +144 -0
- package/src/components/drawer.tsx +135 -0
- package/src/components/dropdown-menu.tsx +258 -0
- package/src/components/empty.tsx +100 -0
- package/src/components/field.tsx +248 -0
- package/src/components/form.tsx +169 -0
- package/src/components/hover-card.tsx +44 -0
- package/src/components/input-group.tsx +170 -0
- package/src/components/input-otp.tsx +77 -0
- package/src/components/input.tsx +21 -0
- package/src/components/item.tsx +193 -0
- package/src/components/kbd.tsx +28 -0
- package/src/components/label.tsx +24 -0
- package/src/components/menubar.tsx +276 -0
- package/src/components/navigation-menu.tsx +168 -0
- package/src/components/pagination.tsx +130 -0
- package/src/components/popover.tsx +88 -0
- package/src/components/progress.tsx +31 -0
- package/src/components/radio-group.tsx +45 -0
- package/src/components/resizable.tsx +56 -0
- package/src/components/scroll-area.tsx +58 -0
- package/src/components/select.tsx +189 -0
- package/src/components/separator.tsx +28 -0
- package/src/components/sheet.tsx +140 -0
- package/src/components/sidebar.tsx +862 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/slider.tsx +63 -0
- package/src/components/sonner.tsx +40 -0
- package/src/components/spinner.tsx +16 -0
- package/src/components/stepper.tsx +291 -0
- package/src/components/switch.tsx +31 -0
- package/src/components/table.tsx +133 -0
- package/src/components/tabs.tsx +66 -0
- package/src/components/textarea.tsx +18 -0
- package/src/components/toggle-group.tsx +83 -0
- package/src/components/toggle.tsx +47 -0
- package/src/components/tooltip.tsx +66 -0
- package/src/custom/action-button.tsx +48 -0
- package/src/custom/async-select.tsx +287 -0
- package/src/custom/awesome-not-found.tsx +116 -0
- package/src/custom/charts/area-chart.tsx +147 -0
- package/src/custom/charts/bar-chart.tsx +233 -0
- package/src/custom/charts/chart-card.tsx +103 -0
- package/src/custom/charts/index.tsx +16 -0
- package/src/custom/charts/pie-chart.tsx +168 -0
- package/src/custom/charts/radar-chart.tsx +126 -0
- package/src/custom/checkbox-tree.tsx +100 -0
- package/src/custom/combobox.tsx +296 -0
- package/src/custom/confirm-dialog.tsx +102 -0
- package/src/custom/country-selector.tsx +204 -0
- package/src/custom/date-picker/calendar-rac.tsx +109 -0
- package/src/custom/date-picker/datefield-rac.tsx +84 -0
- package/src/custom/date-picker/index.tsx +273 -0
- package/src/custom/date-picker/types/index.ts +4 -0
- package/src/custom/date-picker/utils/index.ts +42 -0
- package/src/custom/date-picker-old.tsx +50 -0
- package/src/custom/date-tooltip.tsx +98 -0
- package/src/custom/document-scanner/consts.ts +5 -0
- package/src/custom/document-scanner/corner-adjustment/action-buttons.tsx +33 -0
- package/src/custom/document-scanner/corner-adjustment/corner-handle.tsx +43 -0
- package/src/custom/document-scanner/corner-adjustment/hooks/use-corner-drag.ts +85 -0
- package/src/custom/document-scanner/corner-adjustment/index.tsx +125 -0
- package/src/custom/document-scanner/corner-adjustment/types.ts +53 -0
- package/src/custom/document-scanner/corner-adjustment/utils/clip-path.ts +22 -0
- package/src/custom/document-scanner/corner-adjustment/zoom-magnifier.tsx +115 -0
- package/src/custom/document-scanner/hooks/use-document-capture.ts +81 -0
- package/src/custom/document-scanner/hooks/use-document-scanner.ts +80 -0
- package/src/custom/document-scanner/hooks/use-perspective-crop.ts +38 -0
- package/src/custom/document-scanner/index.tsx +255 -0
- package/src/custom/document-scanner/lib.ts +407 -0
- package/src/custom/document-scanner/types.ts +205 -0
- package/src/custom/document-scanner/utils/perspective-correction.ts +139 -0
- package/src/custom/document-viewer/controllers.tsx +98 -0
- package/src/custom/document-viewer/index.tsx +43 -0
- package/src/custom/document-viewer/renderers/image.tsx +37 -0
- package/src/custom/document-viewer/renderers/index.tsx +2 -0
- package/src/custom/document-viewer/renderers/pdf.tsx +105 -0
- package/src/custom/email-input/domains.json +159 -0
- package/src/custom/email-input/email.tsx +229 -0
- package/src/custom/email-input/index.tsx +4 -0
- package/src/custom/email-input/types.ts +104 -0
- package/src/custom/file-uploader.tsx +541 -0
- package/src/custom/filter-component/fields/async-select.tsx +33 -0
- package/src/custom/filter-component/fields/date.tsx +60 -0
- package/src/custom/filter-component/fields/multi-select.tsx +30 -0
- package/src/custom/filter-component/index.tsx +217 -0
- package/src/custom/image-canvas.tsx +260 -0
- package/src/custom/json-editor.tsx +22 -0
- package/src/custom/master-data-grid/components/dialogs/column-settings-dialog.tsx +100 -0
- package/src/custom/master-data-grid/components/dialogs/index.ts +1 -0
- package/src/custom/master-data-grid/components/filters/client-filter.tsx +368 -0
- package/src/custom/master-data-grid/components/filters/filter-input.tsx +256 -0
- package/src/custom/master-data-grid/components/filters/index.ts +3 -0
- package/src/custom/master-data-grid/components/filters/inline-column-filter.tsx +233 -0
- package/src/custom/master-data-grid/components/filters/multi-filter-dialog.tsx +90 -0
- package/src/custom/master-data-grid/components/filters/server-filter.tsx +255 -0
- package/src/custom/master-data-grid/components/master-data-grid.tsx +472 -0
- package/src/custom/master-data-grid/components/pagination/index.ts +1 -0
- package/src/custom/master-data-grid/components/pagination/pagination.tsx +178 -0
- package/src/custom/master-data-grid/components/table/cell-renderer.tsx +634 -0
- package/src/custom/master-data-grid/components/table/header-cell.tsx +162 -0
- package/src/custom/master-data-grid/components/table/index.ts +4 -0
- package/src/custom/master-data-grid/components/table/table-body-renderer.tsx +113 -0
- package/src/custom/master-data-grid/components/table/virtual-body.tsx +138 -0
- package/src/custom/master-data-grid/components/toolbar/index.ts +1 -0
- package/src/custom/master-data-grid/components/toolbar/toolbar.tsx +314 -0
- package/src/custom/master-data-grid/hooks/index.ts +3 -0
- package/src/custom/master-data-grid/hooks/use-columns.tsx +332 -0
- package/src/custom/master-data-grid/hooks/use-editing.ts +106 -0
- package/src/custom/master-data-grid/hooks/use-table-state-reducer.ts +157 -0
- package/src/custom/master-data-grid/hooks/use-table-state.ts +31 -0
- package/src/custom/master-data-grid/index.ts +16 -0
- package/src/custom/master-data-grid/types.ts +466 -0
- package/src/custom/master-data-grid/utils/column-generator.tsx +306 -0
- package/src/custom/master-data-grid/utils/export-utils.ts +67 -0
- package/src/custom/master-data-grid/utils/filter-fns.ts +290 -0
- package/src/custom/master-data-grid/utils/index.ts +8 -0
- package/src/custom/master-data-grid/utils/pinning-utils.ts +88 -0
- package/src/custom/master-data-grid/utils/translation-utils.ts +42 -0
- package/src/custom/multi-select.tsx +432 -0
- package/src/custom/password-input.tsx +194 -0
- package/src/custom/phone-input.tsx +172 -0
- package/src/custom/schema-form/custom/index.tsx +1 -0
- package/src/custom/schema-form/custom/label.tsx +53 -0
- package/src/custom/schema-form/fields/base-input-field.tsx +82 -0
- package/src/custom/schema-form/fields/field.tsx +67 -0
- package/src/custom/schema-form/fields/index.tsx +5 -0
- package/src/custom/schema-form/fields/object.tsx +12 -0
- package/src/custom/schema-form/fields/table-array/array-field-item.tsx +90 -0
- package/src/custom/schema-form/fields/table-array/array-field-template.tsx +115 -0
- package/src/custom/schema-form/index.tsx +259 -0
- package/src/custom/schema-form/templates/description.tsx +20 -0
- package/src/custom/schema-form/templates/index.tsx +2 -0
- package/src/custom/schema-form/templates/submit.tsx +32 -0
- package/src/custom/schema-form/types.ts +64 -0
- package/src/custom/schema-form/utils/index.ts +4 -0
- package/src/custom/schema-form/utils/schema-dependency.ts +655 -0
- package/src/custom/schema-form/utils/schemas.ts +289 -0
- package/src/custom/schema-form/utils/validation.ts +23 -0
- package/src/custom/schema-form/widgets/boolean.tsx +77 -0
- package/src/custom/schema-form/widgets/combobox.tsx +274 -0
- package/src/custom/schema-form/widgets/date.tsx +59 -0
- package/src/custom/schema-form/widgets/email.tsx +34 -0
- package/src/custom/schema-form/widgets/index.tsx +10 -0
- package/src/custom/schema-form/widgets/password.tsx +40 -0
- package/src/custom/schema-form/widgets/phone.tsx +40 -0
- package/src/custom/schema-form/widgets/select.tsx +105 -0
- package/src/custom/schema-form/widgets/selectable.tsx +25 -0
- package/src/custom/schema-form/widgets/string-array.tsx +296 -0
- package/src/custom/schema-form/widgets/url.tsx +56 -0
- package/src/custom/section-layout-v2.tsx +212 -0
- package/src/custom/select-tabs.tsx +109 -0
- package/src/custom/selectable.tsx +316 -0
- package/src/custom/stepper.tsx +236 -0
- package/src/custom/tab-layout.tsx +213 -0
- package/src/custom/tanstack-table/fields/index.tsx +12 -0
- package/src/custom/tanstack-table/fields/tanstack-table-action-dialogs.tsx +89 -0
- package/src/custom/tanstack-table/fields/tanstack-table-column-header.tsx +66 -0
- package/src/custom/tanstack-table/fields/tanstack-table-filter-date.tsx +180 -0
- package/src/custom/tanstack-table/fields/tanstack-table-filter-faceted.tsx +158 -0
- package/src/custom/tanstack-table/fields/tanstack-table-filter-text.tsx +76 -0
- package/src/custom/tanstack-table/fields/tanstack-table-pagination.tsx +136 -0
- package/src/custom/tanstack-table/fields/tanstack-table-plain-table.tsx +142 -0
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions-confirmation.tsx +77 -0
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions-custom-dialog.tsx +87 -0
- package/src/custom/tanstack-table/fields/tanstack-table-row-actions.tsx +151 -0
- package/src/custom/tanstack-table/fields/tanstack-table-table-actions-custom-dialog.tsx +88 -0
- package/src/custom/tanstack-table/fields/tanstack-table-table-actions-schemaform-dialog.tsx +47 -0
- package/src/custom/tanstack-table/fields/tanstack-table-toolbar.tsx +143 -0
- package/src/custom/tanstack-table/fields/tanstack-table-view-options.tsx +171 -0
- package/src/custom/tanstack-table/index.tsx +244 -0
- package/src/custom/tanstack-table/types/index.ts +328 -0
- package/src/custom/tanstack-table/utils/cell-with-actions.tsx +21 -0
- package/src/custom/tanstack-table/utils/column-names.ts +26 -0
- package/src/custom/tanstack-table/utils/columns-by-row-data.tsx +312 -0
- package/src/custom/tanstack-table/utils/editable-columns-by-row-data.tsx +219 -0
- package/src/custom/tanstack-table/utils/faceted-boolean-options.tsx +22 -0
- package/src/custom/tanstack-table/utils/index.tsx +10 -0
- package/src/custom/tanstack-table/utils/pinning-styles.ts +57 -0
- package/src/custom/tanstack-table/utils/table.tsx +83 -0
- package/src/custom/tanstack-table/utils/test-conditions.ts +17 -0
- package/src/custom/timeline.tsx +208 -0
- package/src/custom/tree.tsx +200 -0
- package/src/custom/tscanify/browser.ts +66 -0
- package/src/custom/tscanify/index.ts +51 -0
- package/src/custom/tscanify/tscanify-browser.ts +522 -0
- package/src/custom/tscanify/tscanify.ts +262 -0
- package/src/custom/tscanify/types.ts +22 -0
- package/src/custom/webcam.tsx +737 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/hooks/use-callback-ref.ts +27 -0
- package/src/hooks/use-controllable-state.ts +67 -0
- package/src/hooks/use-debounce.ts +19 -0
- package/src/hooks/use-is-visible.ts +23 -0
- package/src/hooks/use-media-query.ts +21 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/hooks/use-on-window-resize.ts +15 -0
- package/src/hooks/use-scroll.tsx +22 -0
- package/src/lib/utils.ts +61 -0
- package/src/lib/zod.ts +2 -0
- package/src/styles/core.css +57 -0
- package/src/styles/globals.css +130 -0
- package/src/test/email-input.test.tsx +217 -0
- package/src/test/password-input.test.tsx +92 -0
- package/src/test/select-tabs.test.tsx +302 -0
- package/src/test/selectable.test.tsx +1093 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lint.json +8 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { SchemaFormProps } from "@repo/ayasofyazilim-ui/custom/schema-form";
|
|
2
|
+
import {
|
|
3
|
+
ColumnDef,
|
|
4
|
+
ColumnFiltersState,
|
|
5
|
+
OnChangeFn,
|
|
6
|
+
PaginationState,
|
|
7
|
+
Row,
|
|
8
|
+
TableMeta,
|
|
9
|
+
} from "@tanstack/react-table";
|
|
10
|
+
import { ComponentType, JSX } from "react";
|
|
11
|
+
|
|
12
|
+
export type NonEditableTanstackTableProps<TData> = {
|
|
13
|
+
rowCount: number;
|
|
14
|
+
data: TData[];
|
|
15
|
+
columnFilters: ColumnFiltersState;
|
|
16
|
+
pagination: PaginationState;
|
|
17
|
+
onPaginationChange?: OnChangeFn<PaginationState>;
|
|
18
|
+
onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
|
|
19
|
+
};
|
|
20
|
+
export type EditableTanstackTableProps<TData> = {
|
|
21
|
+
data: TData[];
|
|
22
|
+
meta?: TableMeta<TData>;
|
|
23
|
+
};
|
|
24
|
+
export type TanstackBaseProps<TData, TValue> = {
|
|
25
|
+
title?: string;
|
|
26
|
+
resizeable?: boolean;
|
|
27
|
+
columns: ColumnDef<TData, TValue>[];
|
|
28
|
+
columnOrder?: (keyof TData)[];
|
|
29
|
+
data: TData[];
|
|
30
|
+
columnVisibility?:
|
|
31
|
+
| {
|
|
32
|
+
columns: ("select" | keyof TData)[];
|
|
33
|
+
type: "show" | "hide";
|
|
34
|
+
}
|
|
35
|
+
| undefined;
|
|
36
|
+
pinColumns?: (keyof TData)[];
|
|
37
|
+
rowActions?: TanstackTableRowActionsType<TData>[];
|
|
38
|
+
rowCount?: number;
|
|
39
|
+
selectedRowAction?: TanstackTableSelectedRowActionType<TData>;
|
|
40
|
+
tableActions?: TanstackTableTableActionsType<TData>[] | undefined;
|
|
41
|
+
excludeColumns?: (keyof TData)[];
|
|
42
|
+
showPagination?: boolean;
|
|
43
|
+
expandedRowComponent?: (
|
|
44
|
+
row: TData,
|
|
45
|
+
toggleExpanded: () => void
|
|
46
|
+
) => JSX.Element;
|
|
47
|
+
fillerColumn?: keyof TData;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
onPaginationChange?: OnChangeFn<PaginationState>;
|
|
50
|
+
onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
|
|
51
|
+
columnFilters?: ColumnFiltersState;
|
|
52
|
+
pagination?: PaginationState;
|
|
53
|
+
filters?: TanstackTableFiltersType;
|
|
54
|
+
meta?: TableMeta<TData>;
|
|
55
|
+
};
|
|
56
|
+
export type TanstackTablePropsType<TData, TValue> = {
|
|
57
|
+
title?: string;
|
|
58
|
+
resizeable?: boolean;
|
|
59
|
+
|
|
60
|
+
data: TData[];
|
|
61
|
+
columns: ColumnDef<TData, TValue>[];
|
|
62
|
+
fillerColumn?: keyof TData;
|
|
63
|
+
pinColumns?: (keyof TData)[] | undefined;
|
|
64
|
+
columnOrder?: (keyof TData)[] | undefined;
|
|
65
|
+
columnVisibility?:
|
|
66
|
+
| {
|
|
67
|
+
columns: (keyof TData | "select")[];
|
|
68
|
+
type: "show" | "hide";
|
|
69
|
+
}
|
|
70
|
+
| undefined;
|
|
71
|
+
excludeColumns?: (keyof TData)[];
|
|
72
|
+
rowActions?: TanstackTableRowActionsType<TData>[] | undefined;
|
|
73
|
+
selectedRowAction?: TanstackTableSelectedRowActionType<TData> | undefined;
|
|
74
|
+
tableActions?: TanstackTableTableActionsType<TData>[] | undefined;
|
|
75
|
+
filters?: TanstackTableFiltersType | undefined;
|
|
76
|
+
showPagination?: boolean;
|
|
77
|
+
expandedRowComponent?:
|
|
78
|
+
| ((row: TData, toggleExpanded: () => void) => JSX.Element)
|
|
79
|
+
| undefined;
|
|
80
|
+
} & (
|
|
81
|
+
| {
|
|
82
|
+
rowCount?: number;
|
|
83
|
+
editable?: undefined;
|
|
84
|
+
onTableDataChange?: undefined;
|
|
85
|
+
}
|
|
86
|
+
| {
|
|
87
|
+
editable: true;
|
|
88
|
+
rowCount?: undefined;
|
|
89
|
+
onTableDataChange?: (data: TData[]) => void;
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
export type TanstackTableConfig = {
|
|
94
|
+
dateOptions?: Intl.DateTimeFormatOptions;
|
|
95
|
+
locale?: Intl.LocalesArgument;
|
|
96
|
+
};
|
|
97
|
+
export type TanstackTableCellCondition = {
|
|
98
|
+
conditionAccessorKey: string;
|
|
99
|
+
when: (value: string | boolean | number | Date) => boolean;
|
|
100
|
+
};
|
|
101
|
+
export type TanstackTableColumnClassNames = {
|
|
102
|
+
className?: string;
|
|
103
|
+
conditions?: TanstackTableCellCondition[];
|
|
104
|
+
};
|
|
105
|
+
export type TanstackTableFacetedFilterType = {
|
|
106
|
+
className?: string;
|
|
107
|
+
icon?: ComponentType<{ className?: string }>;
|
|
108
|
+
iconClassName?: string;
|
|
109
|
+
label: string;
|
|
110
|
+
when?: (value: string | boolean | number | Date) => boolean;
|
|
111
|
+
value: string;
|
|
112
|
+
hideColumnValue?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export type TanstackTableDateFilterType = {
|
|
115
|
+
endAccessorKey?: string;
|
|
116
|
+
label: string;
|
|
117
|
+
startAccessorKey: string;
|
|
118
|
+
canFilteredBySingleDate?: boolean;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export type TanstackTableFiltersType = {
|
|
122
|
+
dateFilters?: TanstackTableDateFilterType[];
|
|
123
|
+
facetedFilters?: Record<
|
|
124
|
+
string,
|
|
125
|
+
{
|
|
126
|
+
options: TanstackTableFacetedFilterType[];
|
|
127
|
+
title: string;
|
|
128
|
+
}
|
|
129
|
+
>;
|
|
130
|
+
textFilters?: string[];
|
|
131
|
+
filterTitles?: Record<string, string>;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type TanstackTableColumnLink = {
|
|
135
|
+
conditions?: TanstackTableCellCondition[];
|
|
136
|
+
prefix: string;
|
|
137
|
+
suffix?: string;
|
|
138
|
+
targetAccessorKey?: string;
|
|
139
|
+
};
|
|
140
|
+
export type TanstackTableColumnBadge = {
|
|
141
|
+
className?: string;
|
|
142
|
+
hideColumnValue?: boolean;
|
|
143
|
+
values: {
|
|
144
|
+
position?: "before" | "after";
|
|
145
|
+
badgeClassName?: string;
|
|
146
|
+
conditions?: TanstackTableCellCondition[];
|
|
147
|
+
label: string;
|
|
148
|
+
}[];
|
|
149
|
+
};
|
|
150
|
+
export type TanstackTableColumnIcon = {
|
|
151
|
+
icon?: ComponentType<{ className?: string }>;
|
|
152
|
+
iconClassName?: string;
|
|
153
|
+
position?: "before" | "after";
|
|
154
|
+
};
|
|
155
|
+
export type TanstackTableColumCell<TData> = {
|
|
156
|
+
conditions?: TanstackTableCellCondition[];
|
|
157
|
+
content: (row: TData, rowModel: Row<TData>) => JSX.Element | string | null;
|
|
158
|
+
showHeader?: boolean;
|
|
159
|
+
};
|
|
160
|
+
export type TanstackTableRowActionsDeleteRow = {
|
|
161
|
+
type: "delete-row";
|
|
162
|
+
};
|
|
163
|
+
export type TanstackTableRowActionsDuplicateRow = {
|
|
164
|
+
type: "duplicate-row";
|
|
165
|
+
};
|
|
166
|
+
export type TanstackTableRowActionsMoveRowUp = {
|
|
167
|
+
type: "move-row-up";
|
|
168
|
+
};
|
|
169
|
+
export type TanstackTableRowActionsMoveRowDown = {
|
|
170
|
+
type: "move-row-down";
|
|
171
|
+
};
|
|
172
|
+
export type TanstackTableRowActionsSimple<TData> = {
|
|
173
|
+
onClick: (row: TData) => void;
|
|
174
|
+
type: "simple";
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type TanstackTableRowDialog<TData> = {
|
|
178
|
+
cancelText?: string;
|
|
179
|
+
confirmationText?: string;
|
|
180
|
+
onCancel?: (row: TData) => void;
|
|
181
|
+
onConfirm?: (row: TData) => void;
|
|
182
|
+
title: string | ((row: TData) => string | JSX.Element);
|
|
183
|
+
};
|
|
184
|
+
export type TanstackTableRowActionsCustomDialog<TData> =
|
|
185
|
+
TanstackTableRowDialog<TData> & {
|
|
186
|
+
cancelText?: string;
|
|
187
|
+
confirmationText?: string;
|
|
188
|
+
content:
|
|
189
|
+
| JSX.Element
|
|
190
|
+
| ((row: TData, closeDialog?: () => void) => JSX.Element);
|
|
191
|
+
type: "custom-dialog";
|
|
192
|
+
};
|
|
193
|
+
export type TanstackTableRowActionsConfirmationDialog<TData> =
|
|
194
|
+
TanstackTableRowDialog<TData> & {
|
|
195
|
+
cancelText: string;
|
|
196
|
+
confirmationText: string;
|
|
197
|
+
description: string;
|
|
198
|
+
onCancel?: (row: TData) => void;
|
|
199
|
+
onConfirm: (row: TData) => void;
|
|
200
|
+
type: "confirmation-dialog";
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export type TanstackTableRowActionsType<TData> = {
|
|
204
|
+
actionLocation: "row";
|
|
205
|
+
cta: string;
|
|
206
|
+
condition?: (row: TData) => boolean;
|
|
207
|
+
icon?: ComponentType<{ className?: string }>;
|
|
208
|
+
} & (
|
|
209
|
+
| TanstackTableRowActionsConfirmationDialog<TData>
|
|
210
|
+
| TanstackTableRowActionsSimple<TData>
|
|
211
|
+
| TanstackTableRowActionsDeleteRow
|
|
212
|
+
| TanstackTableRowActionsDuplicateRow
|
|
213
|
+
| TanstackTableRowActionsMoveRowUp
|
|
214
|
+
| TanstackTableRowActionsMoveRowDown
|
|
215
|
+
| TanstackTableRowActionsCustomDialog<TData>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
export type TanstackTableActionsSimple = {
|
|
219
|
+
actionLocation: "table";
|
|
220
|
+
onClick: () => void;
|
|
221
|
+
type: "simple";
|
|
222
|
+
};
|
|
223
|
+
export type TanstackTableCreateRowAction = {
|
|
224
|
+
actionLocation: "table";
|
|
225
|
+
onClick?: () => void;
|
|
226
|
+
type: "create-row";
|
|
227
|
+
};
|
|
228
|
+
export type TanstackTableActionsDialog = {
|
|
229
|
+
cancelText?: string;
|
|
230
|
+
confirmationText?: string;
|
|
231
|
+
onCancel?: () => void;
|
|
232
|
+
onConfirm?: () => void;
|
|
233
|
+
title: string;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export type TanstackTableActionsSchemaFormDialog<TData> = Omit<
|
|
237
|
+
TanstackTableActionsDialog,
|
|
238
|
+
"cancelText" | "onCancel" | "confirmationText" | "onConfirm"
|
|
239
|
+
> & {
|
|
240
|
+
className?: { autoform: string; submit: string };
|
|
241
|
+
onSubmit: (values: TData | undefined) => void;
|
|
242
|
+
type: "schemaform-dialog";
|
|
243
|
+
} & Omit<SchemaFormProps<TData>, "onSubmit">;
|
|
244
|
+
export type TanstackTableActionsCustomDialog = TanstackTableActionsDialog & {
|
|
245
|
+
content: JSX.Element | ((closeDialog?: () => void) => JSX.Element);
|
|
246
|
+
type: "custom-dialog";
|
|
247
|
+
dialogClassNames?: {
|
|
248
|
+
content?: string;
|
|
249
|
+
header?: string;
|
|
250
|
+
title?: string;
|
|
251
|
+
footer?: string;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export type TanstackTableTableActionsType<TData> = {
|
|
256
|
+
actionLocation: "table";
|
|
257
|
+
cta: string;
|
|
258
|
+
icon?: ComponentType<{ className?: string }>;
|
|
259
|
+
condition?: (data: TData[]) => boolean;
|
|
260
|
+
} & (
|
|
261
|
+
| TanstackTableActionsSimple
|
|
262
|
+
| TanstackTableActionsCustomDialog
|
|
263
|
+
| TanstackTableCreateRowAction
|
|
264
|
+
| TanstackTableActionsSchemaFormDialog<TData>
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
export type TanstackTableSelectedRowActionType<TData> = {
|
|
268
|
+
actionLocation: "table";
|
|
269
|
+
cta: string;
|
|
270
|
+
icon?: ComponentType<{ className?: string }>;
|
|
271
|
+
onClick: (selectedIds: string[], selectedRows: TData[]) => void;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export type TanstackTableLanguageDataTypeWithConstantKey = {
|
|
275
|
+
constantKey: string;
|
|
276
|
+
languageData: Record<string, string>;
|
|
277
|
+
};
|
|
278
|
+
export type TanstackTableLanguageDataType =
|
|
279
|
+
| Record<string, string>
|
|
280
|
+
| TanstackTableLanguageDataTypeWithConstantKey;
|
|
281
|
+
|
|
282
|
+
export type TanstackTableCreateColumnsByRowId<T> = {
|
|
283
|
+
badges?: Partial<Record<keyof T, TanstackTableColumnBadge>>;
|
|
284
|
+
classNames?: Partial<Record<keyof T, TanstackTableColumnClassNames[]>>;
|
|
285
|
+
config?: TanstackTableConfig;
|
|
286
|
+
custom?: Partial<Record<keyof T, TanstackTableColumCell<T>>>;
|
|
287
|
+
excludeColumns?: Partial<keyof T>[];
|
|
288
|
+
expandRowTrigger?: keyof T;
|
|
289
|
+
faceted?: Partial<
|
|
290
|
+
Record<keyof T, { options: TanstackTableFacetedFilterType[] }>
|
|
291
|
+
>;
|
|
292
|
+
icons?: Partial<Record<keyof T, TanstackTableColumnIcon>>;
|
|
293
|
+
languageData?: TanstackTableLanguageDataType;
|
|
294
|
+
links?: Partial<Record<keyof T, TanstackTableColumnLink>>;
|
|
295
|
+
rows: Record<
|
|
296
|
+
keyof T,
|
|
297
|
+
{
|
|
298
|
+
format?: string;
|
|
299
|
+
type: string;
|
|
300
|
+
}
|
|
301
|
+
>;
|
|
302
|
+
selectableRows?: boolean;
|
|
303
|
+
onSelectedRowChange?: (selectedRows: T[]) => void;
|
|
304
|
+
disabledRowIds?: string[];
|
|
305
|
+
localization: { locale: string; timeZone: string; lang: string };
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export type TanstacktableEditableColumnsByRowId<T> = {
|
|
309
|
+
excludeColumns?: Partial<keyof T>[];
|
|
310
|
+
editableColumns?: Partial<keyof T>[];
|
|
311
|
+
languageData?: TanstackTableLanguageDataType;
|
|
312
|
+
rows: Record<
|
|
313
|
+
string,
|
|
314
|
+
{
|
|
315
|
+
enum?: Array<{
|
|
316
|
+
label: string;
|
|
317
|
+
value: string;
|
|
318
|
+
}>;
|
|
319
|
+
format?: string;
|
|
320
|
+
type: string;
|
|
321
|
+
}
|
|
322
|
+
>;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
export type TanstackTableCreationProps<T> = Omit<
|
|
326
|
+
TanstackTablePropsType<T, string>,
|
|
327
|
+
"columns" | "data" | "rowCount" | "editable" | "onTableDataChange"
|
|
328
|
+
>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Row, Table as TableType } from "@tanstack/react-table";
|
|
4
|
+
import { TanstackTableRowActions } from "../fields";
|
|
5
|
+
import { TanstackTableRowActionsType } from "../types";
|
|
6
|
+
|
|
7
|
+
export const CellWithActions = <TData,>(
|
|
8
|
+
table: TableType<TData>,
|
|
9
|
+
row: Row<TData>,
|
|
10
|
+
actions: TanstackTableRowActionsType<TData>[],
|
|
11
|
+
setRowAction: (
|
|
12
|
+
actions: TanstackTableRowActionsType<TData> & { row: TData }
|
|
13
|
+
) => void
|
|
14
|
+
) => (
|
|
15
|
+
<TanstackTableRowActions
|
|
16
|
+
row={row}
|
|
17
|
+
actions={actions}
|
|
18
|
+
setRowAction={setRowAction}
|
|
19
|
+
table={table}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TanstackTableLanguageDataType,
|
|
3
|
+
TanstackTableLanguageDataTypeWithConstantKey,
|
|
4
|
+
} from "../types";
|
|
5
|
+
|
|
6
|
+
const isTypeLanguageDataTypeWithConstantKey = (
|
|
7
|
+
value: object
|
|
8
|
+
): value is TanstackTableLanguageDataTypeWithConstantKey =>
|
|
9
|
+
value && typeof value !== "undefined" && "constantKey" in value;
|
|
10
|
+
|
|
11
|
+
export function tanstackTableCreateTitleWithLanguageData({
|
|
12
|
+
languageData,
|
|
13
|
+
accessorKey,
|
|
14
|
+
}: {
|
|
15
|
+
accessorKey: string;
|
|
16
|
+
languageData?:
|
|
17
|
+
| TanstackTableLanguageDataType
|
|
18
|
+
| TanstackTableLanguageDataTypeWithConstantKey;
|
|
19
|
+
}): string {
|
|
20
|
+
if (languageData && isTypeLanguageDataTypeWithConstantKey(languageData)) {
|
|
21
|
+
const { constantKey, languageData: res } = languageData;
|
|
22
|
+
return res[`${constantKey}.${accessorKey}`] || accessorKey;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return languageData?.[accessorKey] || accessorKey;
|
|
26
|
+
}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ColumnDef, Row } from "@tanstack/react-table";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { Badge } from "@repo/ayasofyazilim-ui/components/badge";
|
|
6
|
+
import { Checkbox } from "@repo/ayasofyazilim-ui/components/checkbox";
|
|
7
|
+
import { cn } from "@repo/ayasofyazilim-ui/lib/utils";
|
|
8
|
+
import { tanstackTableCreateTitleWithLanguageData, testConditions } from ".";
|
|
9
|
+
import DateTooltip, { Localization } from "../../date-tooltip";
|
|
10
|
+
import { TanstackTableColumnHeader } from "../fields";
|
|
11
|
+
import {
|
|
12
|
+
TanstackTableColumCell,
|
|
13
|
+
TanstackTableColumnBadge,
|
|
14
|
+
TanstackTableColumnClassNames,
|
|
15
|
+
TanstackTableColumnIcon,
|
|
16
|
+
TanstackTableColumnLink,
|
|
17
|
+
TanstackTableConfig,
|
|
18
|
+
TanstackTableCreateColumnsByRowId,
|
|
19
|
+
TanstackTableFacetedFilterType,
|
|
20
|
+
} from "../types";
|
|
21
|
+
import { JSX } from "react";
|
|
22
|
+
|
|
23
|
+
export function createCell<T>(props: {
|
|
24
|
+
accessorKey: keyof T;
|
|
25
|
+
row: Row<T>;
|
|
26
|
+
link?: TanstackTableColumnLink;
|
|
27
|
+
faceted?: TanstackTableFacetedFilterType[];
|
|
28
|
+
badge?: TanstackTableColumnBadge;
|
|
29
|
+
icon?: TanstackTableColumnIcon;
|
|
30
|
+
className?: TanstackTableColumnClassNames[];
|
|
31
|
+
expandRowTrigger?: boolean;
|
|
32
|
+
format?: string;
|
|
33
|
+
custom?: TanstackTableColumCell<T>;
|
|
34
|
+
config?: TanstackTableConfig;
|
|
35
|
+
localization: Localization;
|
|
36
|
+
}) {
|
|
37
|
+
const {
|
|
38
|
+
accessorKey,
|
|
39
|
+
row,
|
|
40
|
+
link,
|
|
41
|
+
badge,
|
|
42
|
+
icon,
|
|
43
|
+
className,
|
|
44
|
+
expandRowTrigger,
|
|
45
|
+
format,
|
|
46
|
+
custom,
|
|
47
|
+
config,
|
|
48
|
+
faceted,
|
|
49
|
+
localization,
|
|
50
|
+
} = props;
|
|
51
|
+
|
|
52
|
+
let content: JSX.Element | string | null =
|
|
53
|
+
row.getValue(accessorKey.toString())?.toString() || "";
|
|
54
|
+
if (format) {
|
|
55
|
+
if (format === "date" || format === "date-time") {
|
|
56
|
+
content = content ? (
|
|
57
|
+
<DateTooltip
|
|
58
|
+
date={content}
|
|
59
|
+
dateOptions={config?.dateOptions}
|
|
60
|
+
localization={localization}
|
|
61
|
+
/>
|
|
62
|
+
) : (
|
|
63
|
+
""
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (icon) {
|
|
69
|
+
const position = icon.position || "before";
|
|
70
|
+
content = (
|
|
71
|
+
<div className="inline-flex">
|
|
72
|
+
{icon.icon && position === "before" && (
|
|
73
|
+
<icon.icon className={cn("w-4 h-4 mr-2", icon.iconClassName)} />
|
|
74
|
+
)}
|
|
75
|
+
{row.getValue(accessorKey.toString())}
|
|
76
|
+
{icon.icon && position === "after" && (
|
|
77
|
+
<icon.icon className={cn("w-4 h-4 ml-2", icon.iconClassName)} />
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (badge) {
|
|
83
|
+
const position: { before: JSX.Element[]; after: JSX.Element[] } = {
|
|
84
|
+
before: [],
|
|
85
|
+
after: [],
|
|
86
|
+
};
|
|
87
|
+
badge.values.forEach((item) => {
|
|
88
|
+
const itemPosition = item.position || "before";
|
|
89
|
+
item.conditions?.forEach((condition) => {
|
|
90
|
+
if (condition.when(row.getValue(condition.conditionAccessorKey))) {
|
|
91
|
+
position[itemPosition].push(
|
|
92
|
+
<Badge
|
|
93
|
+
variant="outline"
|
|
94
|
+
className={item.badgeClassName}
|
|
95
|
+
key={item.label}
|
|
96
|
+
>
|
|
97
|
+
{item.label}
|
|
98
|
+
</Badge>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
content = (
|
|
105
|
+
<>
|
|
106
|
+
{position.before}
|
|
107
|
+
{!badge.hideColumnValue && content}
|
|
108
|
+
{position.after}
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (faceted) {
|
|
113
|
+
const facetedItem = faceted.find(
|
|
114
|
+
(item) =>
|
|
115
|
+
item.when?.(row.getValue(accessorKey.toString())) ||
|
|
116
|
+
row.getValue(accessorKey.toString()) === item.value
|
|
117
|
+
);
|
|
118
|
+
if (facetedItem) {
|
|
119
|
+
content = (
|
|
120
|
+
<div className={cn("flex items-center", facetedItem.className)}>
|
|
121
|
+
{facetedItem.icon && (
|
|
122
|
+
<facetedItem.icon
|
|
123
|
+
className={cn(
|
|
124
|
+
"text-muted-foreground mr-2 h-4 w-4",
|
|
125
|
+
facetedItem.iconClassName
|
|
126
|
+
)}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
{facetedItem.hideColumnValue ? "" : <span>{facetedItem.label}</span>}
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const containerClassName = className
|
|
135
|
+
?.map((item) => {
|
|
136
|
+
if (testConditions(item.conditions, row)) {
|
|
137
|
+
return item.className;
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
})
|
|
141
|
+
.join(" ");
|
|
142
|
+
|
|
143
|
+
if (custom) content = custom.content(row.original, row);
|
|
144
|
+
if (!link || !testConditions(link.conditions, row)) {
|
|
145
|
+
if (expandRowTrigger) {
|
|
146
|
+
return (
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
onClick={row.getToggleExpandedHandler()}
|
|
150
|
+
data-testid={`expand-row-${accessorKey.toString()}`}
|
|
151
|
+
className={cn(
|
|
152
|
+
"font-medium text-blue-700 flex items-center gap-2 cursor-pointer",
|
|
153
|
+
containerClassName
|
|
154
|
+
)}
|
|
155
|
+
>
|
|
156
|
+
{content}
|
|
157
|
+
</button>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return (
|
|
161
|
+
<div className={cn(" flex items-center gap-2", containerClassName)}>
|
|
162
|
+
{content}
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
let url = link.prefix;
|
|
167
|
+
if (link.targetAccessorKey) {
|
|
168
|
+
url += `/${row._getAllCellsByColumnId()?.[link.targetAccessorKey || ""]?.getValue()?.toString()}`;
|
|
169
|
+
}
|
|
170
|
+
if (link.suffix) {
|
|
171
|
+
url += `/${link.suffix}`;
|
|
172
|
+
}
|
|
173
|
+
return (
|
|
174
|
+
<Link
|
|
175
|
+
href={url}
|
|
176
|
+
className={cn(
|
|
177
|
+
"font-medium text-blue-700 flex items-center gap-2",
|
|
178
|
+
containerClassName
|
|
179
|
+
)}
|
|
180
|
+
>
|
|
181
|
+
{content}
|
|
182
|
+
</Link>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
export function tanstackTableCreateColumnsByRowData<T>(
|
|
186
|
+
params: TanstackTableCreateColumnsByRowId<T>
|
|
187
|
+
) {
|
|
188
|
+
const { rows, config } = params;
|
|
189
|
+
|
|
190
|
+
const {
|
|
191
|
+
excludeColumns,
|
|
192
|
+
languageData,
|
|
193
|
+
links,
|
|
194
|
+
faceted,
|
|
195
|
+
badges,
|
|
196
|
+
classNames,
|
|
197
|
+
icons,
|
|
198
|
+
expandRowTrigger,
|
|
199
|
+
custom,
|
|
200
|
+
localization,
|
|
201
|
+
onSelectedRowChange,
|
|
202
|
+
} = params;
|
|
203
|
+
const columns: ColumnDef<T>[] = [];
|
|
204
|
+
if (params.selectableRows) {
|
|
205
|
+
columns.push({
|
|
206
|
+
size: 64,
|
|
207
|
+
id: "select",
|
|
208
|
+
header: ({ table }) => (
|
|
209
|
+
<div className="w-full h-9 flex items-center justify-center">
|
|
210
|
+
<Checkbox
|
|
211
|
+
checked={
|
|
212
|
+
table
|
|
213
|
+
.getRowModel()
|
|
214
|
+
.rows.filter((row) => !params.disabledRowIds?.includes(row.id))
|
|
215
|
+
.every((row) => row.getIsSelected()) &&
|
|
216
|
+
table
|
|
217
|
+
.getRowModel()
|
|
218
|
+
.rows.some(
|
|
219
|
+
(row) =>
|
|
220
|
+
!params.disabledRowIds?.includes(row.id) &&
|
|
221
|
+
row.getIsSelected()
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
onCheckedChange={(value) => {
|
|
225
|
+
const selectedRows: T[] = [];
|
|
226
|
+
table.getRowModel().rows.forEach((row) => {
|
|
227
|
+
if (!params.disabledRowIds?.includes(row.id)) {
|
|
228
|
+
row.toggleSelected(!!value);
|
|
229
|
+
if (value) {
|
|
230
|
+
selectedRows.push(row.original);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
onSelectedRowChange?.(selectedRows);
|
|
235
|
+
}}
|
|
236
|
+
aria-label="Select all"
|
|
237
|
+
className="translate-y-0.5 align-middle"
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
),
|
|
241
|
+
|
|
242
|
+
cell: ({ row, table }) => (
|
|
243
|
+
<div className="w-full h-9 flex items-center justify-center">
|
|
244
|
+
<Checkbox
|
|
245
|
+
checked={row.getIsSelected()}
|
|
246
|
+
onCheckedChange={(value) => {
|
|
247
|
+
const selectedRows: T[] = [];
|
|
248
|
+
table.getSelectedRowModel().rows.forEach((row) => {
|
|
249
|
+
selectedRows.push(row.original);
|
|
250
|
+
});
|
|
251
|
+
if (value) {
|
|
252
|
+
selectedRows.push(row.original);
|
|
253
|
+
} else {
|
|
254
|
+
selectedRows.splice(selectedRows.indexOf(row.original), 1);
|
|
255
|
+
}
|
|
256
|
+
row.toggleSelected(!!value);
|
|
257
|
+
onSelectedRowChange?.(selectedRows);
|
|
258
|
+
}}
|
|
259
|
+
disabled={params.disabledRowIds?.some((id) => id === row.id)}
|
|
260
|
+
aria-label="Select row"
|
|
261
|
+
className="translate-y-0.5 align-top"
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
),
|
|
265
|
+
enableSorting: false,
|
|
266
|
+
enableHiding: false,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const rowKeys = Object.keys(rows) as (keyof T)[];
|
|
270
|
+
rowKeys
|
|
271
|
+
.filter((key) => !excludeColumns?.includes(key as keyof T))
|
|
272
|
+
.forEach((accessorKey) => {
|
|
273
|
+
const title = tanstackTableCreateTitleWithLanguageData({
|
|
274
|
+
languageData,
|
|
275
|
+
accessorKey: accessorKey.toString(),
|
|
276
|
+
});
|
|
277
|
+
const link = links?.[accessorKey as keyof T];
|
|
278
|
+
const { format } = rows[accessorKey];
|
|
279
|
+
const column: ColumnDef<T> = {
|
|
280
|
+
id: accessorKey.toString(),
|
|
281
|
+
accessorKey,
|
|
282
|
+
meta: title,
|
|
283
|
+
header:
|
|
284
|
+
!custom?.[accessorKey] || custom?.[accessorKey]?.showHeader
|
|
285
|
+
? ({ column }) => (
|
|
286
|
+
<TanstackTableColumnHeader column={column} title={title} />
|
|
287
|
+
)
|
|
288
|
+
: undefined,
|
|
289
|
+
cell: ({ row }) =>
|
|
290
|
+
createCell<T>({
|
|
291
|
+
accessorKey,
|
|
292
|
+
row,
|
|
293
|
+
link,
|
|
294
|
+
faceted: faceted?.[accessorKey]?.options,
|
|
295
|
+
badge: badges?.[accessorKey],
|
|
296
|
+
icon: icons?.[accessorKey],
|
|
297
|
+
className: classNames?.[accessorKey],
|
|
298
|
+
expandRowTrigger: expandRowTrigger === accessorKey,
|
|
299
|
+
format,
|
|
300
|
+
custom: custom?.[accessorKey],
|
|
301
|
+
config,
|
|
302
|
+
localization,
|
|
303
|
+
}),
|
|
304
|
+
};
|
|
305
|
+
if (faceted?.[accessorKey]) {
|
|
306
|
+
column.filterFn = (row, id, value) => value.includes(row.getValue(id));
|
|
307
|
+
}
|
|
308
|
+
columns.push(column);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
return columns;
|
|
312
|
+
}
|