@@ -51,6 +51,39 @@ const columns = [
51
51
</DSVImport>
52
52
```
53
53
54
+ ## API
55
+ The ` <DSVImport<T>> ` components has the following API:
56
+
57
+ | Property | Type | Description |
58
+ | :---------------| :-------------------------------| :-----------------------------------------------------------|
59
+ | ` columns ` | [ ColumnType] ( #columntype ) | Description of the expected columns |
60
+ | ` transformers? ` | [ Transformer] ( #transformer ) ` [] ` | Globally applied transformers |
61
+ | ` onChange? ` | ` (value: T[]) => void ` | Callback which is called after parsing the input |
62
+ | ` onValidation? ` | ` (errors: Error<T>[]) => void ` | Callback which is called if there are validation errors |
63
+
64
+ ### Types
65
+ Within this section additional types are explained.
66
+
67
+ #### ColumnType
68
+ | Property | Type | Description |
69
+ | :----------------| :-----------------------------| :------------------------------------------------------------|
70
+ | ` key ` | ` string ` | Key of the current column |
71
+ | ` label ` | ` string ` | Label of the current column, which can be shown to the user |
72
+ | ` rules? ` | [ Rule] ( #rule ) ` [] ` | Validation rules which are applied to this column |
73
+ | ` transformers? ` | [ Transformer] ( #transformer ) ` [] ` | Transformers which are applied to this column |
74
+
75
+ #### Rule
76
+ | Property | Type | Description |
77
+ | :----------------| :-----------------------------| :------------------------------------------------------------|
78
+ | ` message ` | ` string ` | Error message |
79
+ | ` contraint ` | `{ unique: boolean } | { constraint: ` [Constraint](#constraint) ` }` | Constraint for this rule |
80
+
81
+ #### Constraint
82
+ ` (value: string) => boolean `
83
+
84
+ #### Transformer
85
+ ` (value: string) => string `
86
+
54
87
## Project
55
88
This section describes the status of the project.
56
89
0 commit comments