@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,466 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Column,
|
|
3
|
+
ColumnDef,
|
|
4
|
+
ColumnFiltersState,
|
|
5
|
+
ColumnPinningState,
|
|
6
|
+
Row,
|
|
7
|
+
RowSelectionState,
|
|
8
|
+
SortingState,
|
|
9
|
+
VisibilityState,
|
|
10
|
+
CellContext,
|
|
11
|
+
} from "@tanstack/react-table";
|
|
12
|
+
import type { Localization } from "../date-tooltip";
|
|
13
|
+
import type { LucideIcon } from "lucide-react";
|
|
14
|
+
import { GenericObjectType } from "@rjsf/utils";
|
|
15
|
+
import { z } from "@repo/ayasofyazilim-ui/lib/zod";
|
|
16
|
+
|
|
17
|
+
export type { Localization };
|
|
18
|
+
|
|
19
|
+
export interface JSONSchemaProperty {
|
|
20
|
+
type: "string" | "number" | "integer" | "boolean" | "array" | "object";
|
|
21
|
+
format?:
|
|
22
|
+
| "int32"
|
|
23
|
+
| "date"
|
|
24
|
+
| "date-time"
|
|
25
|
+
| "email"
|
|
26
|
+
| "uri"
|
|
27
|
+
| "url"
|
|
28
|
+
| "uuid"
|
|
29
|
+
| "time"
|
|
30
|
+
| "badge";
|
|
31
|
+
enum?: Array<string | number>;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
minimum?: number;
|
|
35
|
+
maximum?: number;
|
|
36
|
+
minLength?: number;
|
|
37
|
+
maxLength?: number;
|
|
38
|
+
pattern?: string;
|
|
39
|
+
items?: JSONSchemaProperty;
|
|
40
|
+
properties?: Record<string, JSONSchemaProperty>;
|
|
41
|
+
required?: string[];
|
|
42
|
+
default?: unknown;
|
|
43
|
+
readOnly?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface JSONSchema {
|
|
47
|
+
type: "object";
|
|
48
|
+
properties: Record<string, JSONSchemaProperty>;
|
|
49
|
+
required?: string[];
|
|
50
|
+
title?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type FilterOperator =
|
|
55
|
+
| "equals"
|
|
56
|
+
| "notEquals"
|
|
57
|
+
| "contains"
|
|
58
|
+
| "notContains"
|
|
59
|
+
| "startsWith"
|
|
60
|
+
| "endsWith"
|
|
61
|
+
| "isEmpty"
|
|
62
|
+
| "isNotEmpty"
|
|
63
|
+
| "greaterThan"
|
|
64
|
+
| "greaterThanOrEqual"
|
|
65
|
+
| "lessThan"
|
|
66
|
+
| "lessThanOrEqual"
|
|
67
|
+
| "between"
|
|
68
|
+
| "inRange"
|
|
69
|
+
| "before"
|
|
70
|
+
| "after"
|
|
71
|
+
| "inList"
|
|
72
|
+
| "notInList";
|
|
73
|
+
|
|
74
|
+
export interface ColumnFilter {
|
|
75
|
+
id: string;
|
|
76
|
+
operator: FilterOperator;
|
|
77
|
+
value: unknown;
|
|
78
|
+
value2?: unknown;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface CellEditConfig<TData = unknown> {
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
mode?: "cell" | "row";
|
|
84
|
+
errorDisplayMode?: "tooltip" | "inline" | "both";
|
|
85
|
+
onRowSave?: (row: TData, changes: Partial<TData>) => void | Promise<void>;
|
|
86
|
+
onRowCancel?: (row: TData) => void;
|
|
87
|
+
isRowEditable?: (row: TData) => boolean;
|
|
88
|
+
isColumnEditable?: (columnId: string, row: TData) => boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface RowAction<TData = unknown> {
|
|
92
|
+
id: string;
|
|
93
|
+
label: string | ((row: TData) => string);
|
|
94
|
+
icon?: LucideIcon;
|
|
95
|
+
variant?:
|
|
96
|
+
| "default"
|
|
97
|
+
| "destructive"
|
|
98
|
+
| "outline"
|
|
99
|
+
| "secondary"
|
|
100
|
+
| "ghost"
|
|
101
|
+
| "link";
|
|
102
|
+
onClick?: (row: TData, event: React.MouseEvent) => void | Promise<void>;
|
|
103
|
+
disabled?: boolean | ((row: TData) => boolean);
|
|
104
|
+
hidden?: boolean | ((row: TData) => boolean);
|
|
105
|
+
className?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface TableAction<TData = unknown> {
|
|
109
|
+
id: string;
|
|
110
|
+
label: string;
|
|
111
|
+
icon?: LucideIcon;
|
|
112
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost";
|
|
113
|
+
onClick?: (selectedRows: TData[]) => void | Promise<void>;
|
|
114
|
+
disabled?: boolean | ((selectedRows: TData[]) => boolean);
|
|
115
|
+
hidden?: boolean | ((selectedRows: TData[]) => boolean);
|
|
116
|
+
requiresSelection?: boolean;
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface RowExpansionConfig<TData = unknown> {
|
|
121
|
+
enabled?: boolean;
|
|
122
|
+
renderContent?: (row: TData) => React.ReactNode;
|
|
123
|
+
defaultExpanded?: boolean;
|
|
124
|
+
expanderColumns?: Array<keyof TData> | Array<string>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface ColumnMeta {
|
|
128
|
+
schemaProperty?: JSONSchemaProperty;
|
|
129
|
+
filterOperators?: FilterOperator[];
|
|
130
|
+
[key: string]: unknown;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ColumnConfig<TData = unknown> {
|
|
134
|
+
id: string;
|
|
135
|
+
header?: string | ((info: { column: Column<TData> }) => React.ReactNode);
|
|
136
|
+
extendHeader?: boolean;
|
|
137
|
+
accessorKey?: string;
|
|
138
|
+
accessorFn?: (row: TData) => unknown;
|
|
139
|
+
enableSorting?: boolean;
|
|
140
|
+
enableFiltering?: boolean;
|
|
141
|
+
enableGrouping?: boolean;
|
|
142
|
+
enablePinning?: boolean;
|
|
143
|
+
enableResizing?: boolean;
|
|
144
|
+
enableHiding?: boolean;
|
|
145
|
+
width?: number;
|
|
146
|
+
minWidth?: number;
|
|
147
|
+
maxWidth?: number;
|
|
148
|
+
cell?: (info: {
|
|
149
|
+
getValue: () => unknown;
|
|
150
|
+
row: Row<TData>;
|
|
151
|
+
}) => React.ReactNode;
|
|
152
|
+
footer?: (info: { column: { id: string } }) => React.ReactNode;
|
|
153
|
+
meta?: ColumnMeta;
|
|
154
|
+
isExpanderColumn?: boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface GroupingConfig {
|
|
158
|
+
enabled?: boolean;
|
|
159
|
+
groupBy?: string[];
|
|
160
|
+
expanded?: Record<string, boolean>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface VirtualizationConfig {
|
|
164
|
+
enabled?: boolean;
|
|
165
|
+
estimateSize?: number;
|
|
166
|
+
overscan?: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface SelectionConfig<TData = unknown> {
|
|
170
|
+
enabled?: boolean;
|
|
171
|
+
mode?: "single" | "multiple";
|
|
172
|
+
onSelectionChange?: (selectedRows: TData[]) => void;
|
|
173
|
+
rowSelectable?: (row: TData) => boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface PinningConfig {
|
|
177
|
+
left?: string[];
|
|
178
|
+
right?: string[];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ExportConfig<TData = unknown> {
|
|
182
|
+
enabled?: boolean;
|
|
183
|
+
formats?: Array<"csv" | "excel" | "json" | "pdf">;
|
|
184
|
+
filename?: string;
|
|
185
|
+
customExport?: (data: TData[], format: string) => void | Promise<void>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface BaseServerFilterConfig {
|
|
189
|
+
key: string;
|
|
190
|
+
label: string;
|
|
191
|
+
placeholder: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface StringServerFilterConfig extends BaseServerFilterConfig {
|
|
195
|
+
type: "string";
|
|
196
|
+
validator?: z.ZodType<string | undefined>;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
interface NumberServerFilterConfig extends BaseServerFilterConfig {
|
|
200
|
+
type: "number";
|
|
201
|
+
validator?: z.ZodType<number | undefined>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface SelectServerFilterConfig extends BaseServerFilterConfig {
|
|
205
|
+
type: "select";
|
|
206
|
+
options: { label: string; value: string }[];
|
|
207
|
+
validator?: z.ZodType<string | undefined>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface ArrayServerFilterConfig extends BaseServerFilterConfig {
|
|
211
|
+
type: "array";
|
|
212
|
+
options: { label: string; value: string }[];
|
|
213
|
+
validator?: z.ZodType<string[] | undefined>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface BooleanServerFilterConfig extends BaseServerFilterConfig {
|
|
217
|
+
type: "boolean";
|
|
218
|
+
options: { label: string; value: string }[];
|
|
219
|
+
validator?: z.ZodType<boolean | undefined>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export type ServerFilterConfig =
|
|
223
|
+
| StringServerFilterConfig
|
|
224
|
+
| NumberServerFilterConfig
|
|
225
|
+
| SelectServerFilterConfig
|
|
226
|
+
| ArrayServerFilterConfig
|
|
227
|
+
| BooleanServerFilterConfig;
|
|
228
|
+
|
|
229
|
+
export interface MasterDataGridConfig<TData = unknown> {
|
|
230
|
+
schema?: JSONSchema | GenericObjectType;
|
|
231
|
+
columns?: ColumnConfig<TData>[];
|
|
232
|
+
|
|
233
|
+
t?: MasterDataGridResources;
|
|
234
|
+
|
|
235
|
+
serverFilters?: ServerFilterConfig[];
|
|
236
|
+
serverFilterLocation?: "left" | "right" | "top" | "bottom" | "toolbar";
|
|
237
|
+
enableSorting?: boolean;
|
|
238
|
+
enableFiltering?: boolean;
|
|
239
|
+
enableGrouping?: boolean;
|
|
240
|
+
enablePinning?: boolean;
|
|
241
|
+
enableResizing?: boolean;
|
|
242
|
+
enableColumnVisibility?: boolean;
|
|
243
|
+
enableRowSelection?: boolean;
|
|
244
|
+
enableVirtualization?: boolean;
|
|
245
|
+
enableExport?: boolean;
|
|
246
|
+
enableSearch?: boolean;
|
|
247
|
+
|
|
248
|
+
selection?: SelectionConfig<TData>;
|
|
249
|
+
virtualization?: VirtualizationConfig;
|
|
250
|
+
grouping?: GroupingConfig;
|
|
251
|
+
pinning?: PinningConfig;
|
|
252
|
+
editing?: CellEditConfig<TData>;
|
|
253
|
+
expansion?: RowExpansionConfig<TData>;
|
|
254
|
+
export?: ExportConfig<TData>;
|
|
255
|
+
|
|
256
|
+
rowActions?: RowAction<TData>[];
|
|
257
|
+
tableActions?: TableAction<TData>[];
|
|
258
|
+
|
|
259
|
+
className?: string;
|
|
260
|
+
containerClassName?: string;
|
|
261
|
+
tableClassName?: string;
|
|
262
|
+
headerClassName?: string;
|
|
263
|
+
bodyClassName?: string;
|
|
264
|
+
rowClassName?: string | ((row: TData) => string);
|
|
265
|
+
cellClassName?: string | ((cell: { row: TData; columnId: string }) => string);
|
|
266
|
+
|
|
267
|
+
enablePagination?: boolean;
|
|
268
|
+
pageSize?: number;
|
|
269
|
+
pageSizeOptions?: number[];
|
|
270
|
+
loading?: boolean;
|
|
271
|
+
loadingComponent?: React.ReactNode;
|
|
272
|
+
emptyComponent?: React.ReactNode;
|
|
273
|
+
|
|
274
|
+
dateOptions?: Intl.DateTimeFormatOptions;
|
|
275
|
+
localization: Localization;
|
|
276
|
+
|
|
277
|
+
customRenderers?: CustomRenderers<TData>;
|
|
278
|
+
|
|
279
|
+
columnVisibility?: {
|
|
280
|
+
mode: "show" | "hide";
|
|
281
|
+
columns: Array<keyof TData>;
|
|
282
|
+
};
|
|
283
|
+
columnOrder?: Array<keyof TData>;
|
|
284
|
+
|
|
285
|
+
enableMultiSort?: boolean;
|
|
286
|
+
enableMultiFilter?: boolean;
|
|
287
|
+
manualSorting?: boolean;
|
|
288
|
+
manualFiltering?: boolean;
|
|
289
|
+
manualPagination?: boolean;
|
|
290
|
+
rowCount?: number;
|
|
291
|
+
onSortingChange?: (sorting: SortingState) => void;
|
|
292
|
+
onFilteringChange?: (filters: ColumnFiltersState) => void;
|
|
293
|
+
onPaginationChange?: (pagination: {
|
|
294
|
+
pageIndex: number;
|
|
295
|
+
pageSize: number;
|
|
296
|
+
}) => void;
|
|
297
|
+
onRefresh?: () => void;
|
|
298
|
+
|
|
299
|
+
getRowId?: (row: TData, index: number) => string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface MasterDataGridProps<TData = unknown> {
|
|
303
|
+
data: TData[];
|
|
304
|
+
config: MasterDataGridConfig<TData>;
|
|
305
|
+
onDataChange?: (data: TData[]) => void;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface TableState {
|
|
309
|
+
sorting: SortingState;
|
|
310
|
+
columnFilters: ColumnFiltersState;
|
|
311
|
+
columnVisibility: VisibilityState;
|
|
312
|
+
rowSelection: RowSelectionState;
|
|
313
|
+
columnPinning: ColumnPinningState;
|
|
314
|
+
grouping: string[];
|
|
315
|
+
expanded: Record<string, boolean> | true;
|
|
316
|
+
pagination: {
|
|
317
|
+
pageIndex: number;
|
|
318
|
+
pageSize: number;
|
|
319
|
+
};
|
|
320
|
+
editingRows?: Record<string, Record<string, unknown>>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface CustomCellRendererProps<TData = unknown> {
|
|
324
|
+
value: unknown;
|
|
325
|
+
row: Row<TData>;
|
|
326
|
+
column: Column<TData>;
|
|
327
|
+
onUpdate?: (value: unknown) => void;
|
|
328
|
+
error?: string;
|
|
329
|
+
schemaProperty?: JSONSchemaProperty;
|
|
330
|
+
t?: MasterDataGridResources;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export type CustomCellRenderer<TData = unknown> = (
|
|
334
|
+
props: CustomCellRendererProps<TData>
|
|
335
|
+
) => React.ReactNode;
|
|
336
|
+
|
|
337
|
+
export type CustomRenderers<TData> = Partial<
|
|
338
|
+
Record<keyof TData & string, CustomCellRenderer<TData>>
|
|
339
|
+
>;
|
|
340
|
+
|
|
341
|
+
export type GeneratedColumn<TData = unknown> = ColumnDef<TData> & {
|
|
342
|
+
meta?: {
|
|
343
|
+
schemaProperty?: JSONSchemaProperty;
|
|
344
|
+
filterOperators?: FilterOperator[];
|
|
345
|
+
[key: string]: unknown;
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export type CellProps<TData = unknown, TValue = unknown> = CellContext<
|
|
350
|
+
TData,
|
|
351
|
+
TValue
|
|
352
|
+
>;
|
|
353
|
+
|
|
354
|
+
export interface ExpandableColumnMeta extends ColumnMeta {
|
|
355
|
+
isExpanderColumn?: boolean;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface ExportColumnDef<TData = unknown> {
|
|
359
|
+
accessorKey?: string;
|
|
360
|
+
accessorFn?: (row: TData, index: number) => unknown;
|
|
361
|
+
header?: string | ((info: any) => React.ReactNode);
|
|
362
|
+
id?: string;
|
|
363
|
+
meta?: ColumnMeta;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface CellRendererProps<TData = unknown> {
|
|
367
|
+
value: unknown;
|
|
368
|
+
row: Row<TData>;
|
|
369
|
+
column: Column<TData>;
|
|
370
|
+
columnId: string;
|
|
371
|
+
schemaProperty?: JSONSchemaProperty;
|
|
372
|
+
onUpdate?: (value: unknown) => void;
|
|
373
|
+
isEditing: boolean;
|
|
374
|
+
editable?: boolean;
|
|
375
|
+
error?: string;
|
|
376
|
+
t?: MasterDataGridResources;
|
|
377
|
+
errorDisplayMode?: "tooltip" | "inline" | "both";
|
|
378
|
+
className?: string;
|
|
379
|
+
dateOptions?: Intl.DateTimeFormatOptions;
|
|
380
|
+
localization?: any;
|
|
381
|
+
fieldName?: keyof TData & string;
|
|
382
|
+
customRenderers?: CustomRenderers<TData>;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface MasterDataGridResources extends Record<string, string> {
|
|
386
|
+
"toolbar.search": string;
|
|
387
|
+
"toolbar.filters": string;
|
|
388
|
+
"toolbar.client": string;
|
|
389
|
+
"toolbar.server": string;
|
|
390
|
+
"toolbar.columns": string;
|
|
391
|
+
"toolbar.export": string;
|
|
392
|
+
"toolbar.refresh": string;
|
|
393
|
+
"toolbar.reset": string;
|
|
394
|
+
"toolbar.selected": string;
|
|
395
|
+
"toolbar.actions": string;
|
|
396
|
+
|
|
397
|
+
"pagination.rowsPerPage": string;
|
|
398
|
+
"pagination.page": string;
|
|
399
|
+
"pagination.of": string;
|
|
400
|
+
"pagination.rowsSelected": string;
|
|
401
|
+
"pagination.firstPage": string;
|
|
402
|
+
"pagination.previousPage": string;
|
|
403
|
+
"pagination.nextPage": string;
|
|
404
|
+
"pagination.lastPage": string;
|
|
405
|
+
|
|
406
|
+
"column.sortAsc": string;
|
|
407
|
+
"column.sortDesc": string;
|
|
408
|
+
"column.pinLeft": string;
|
|
409
|
+
"column.pinRight": string;
|
|
410
|
+
"column.unpin": string;
|
|
411
|
+
"column.filter": string;
|
|
412
|
+
"column.resetSize": string;
|
|
413
|
+
"column.hide": string;
|
|
414
|
+
"column.edit": string;
|
|
415
|
+
"column.actions": string;
|
|
416
|
+
"column.openMenu": string;
|
|
417
|
+
|
|
418
|
+
"filter.title": string;
|
|
419
|
+
"filter.description": string;
|
|
420
|
+
"filter.where": string;
|
|
421
|
+
"filter.and": string;
|
|
422
|
+
"filter.selectColumn": string;
|
|
423
|
+
"filter.operator": string;
|
|
424
|
+
"filter.operator.equals": string;
|
|
425
|
+
"filter.operator.notEquals": string;
|
|
426
|
+
"filter.operator.contains": string;
|
|
427
|
+
"filter.operator.notContains": string;
|
|
428
|
+
"filter.operator.startsWith": string;
|
|
429
|
+
"filter.operator.endsWith": string;
|
|
430
|
+
"filter.operator.isEmpty": string;
|
|
431
|
+
"filter.operator.isNotEmpty": string;
|
|
432
|
+
"filter.operator.greaterThan": string;
|
|
433
|
+
"filter.operator.greaterThanOrEqual": string;
|
|
434
|
+
"filter.operator.lessThan": string;
|
|
435
|
+
"filter.operator.lessThanOrEqual": string;
|
|
436
|
+
"filter.operator.between": string;
|
|
437
|
+
"filter.operator.inRange": string;
|
|
438
|
+
"filter.operator.before": string;
|
|
439
|
+
"filter.operator.after": string;
|
|
440
|
+
"filter.operator.inList": string;
|
|
441
|
+
"filter.operator.notInList": string;
|
|
442
|
+
"filter.value": string;
|
|
443
|
+
"filter.value2": string;
|
|
444
|
+
"filter.valuePlaceholder": string;
|
|
445
|
+
"filter.value2Placeholder": string;
|
|
446
|
+
"filter.addFilter": string;
|
|
447
|
+
"filter.resetFilters": string;
|
|
448
|
+
"filter.apply": string;
|
|
449
|
+
"filter.close": string;
|
|
450
|
+
"filter.clear": string;
|
|
451
|
+
"filter.clearFilter": string;
|
|
452
|
+
"filter.true": string;
|
|
453
|
+
"filter.false": string;
|
|
454
|
+
"filter.min": string;
|
|
455
|
+
"filter.max": string;
|
|
456
|
+
"filter.to": string;
|
|
457
|
+
|
|
458
|
+
"columnSettings.title": string;
|
|
459
|
+
"columnSettings.description": string;
|
|
460
|
+
"columnSettings.showAll": string;
|
|
461
|
+
"columnSettings.hideAll": string;
|
|
462
|
+
|
|
463
|
+
"table.noResults": string;
|
|
464
|
+
|
|
465
|
+
"validation.invalidString": string;
|
|
466
|
+
}
|