@colisweb/rescript-toolkit 2.5.1 → 2.6.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/package.json
CHANGED
|
@@ -61,6 +61,31 @@ module Int = {
|
|
|
61
61
|
type t = @decco.codec(codec) int
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
module Boolean = {
|
|
65
|
+
let encoder = value => value->Decco.boolToJson
|
|
66
|
+
|
|
67
|
+
let decoder = json =>
|
|
68
|
+
switch Js.Json.classify(json) {
|
|
69
|
+
| JSONFalse => Ok(false)
|
|
70
|
+
| JSONTrue => Ok(true)
|
|
71
|
+
| JSONString(_) =>
|
|
72
|
+
switch Decco.stringFromJson(json) {
|
|
73
|
+
| Ok(value) =>
|
|
74
|
+
switch Decco.boolFromJson(value->bool_of_string->Js.Json.boolean) {
|
|
75
|
+
| Ok(_) as value => value
|
|
76
|
+
| Error(_) as error => error
|
|
77
|
+
}
|
|
78
|
+
| Error(_) => Decco.error(~path="", "Not a boolean", json)
|
|
79
|
+
}
|
|
80
|
+
| _ => Decco.error(~path="", "Not a boolean", json)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let codec = (encoder, decoder)
|
|
84
|
+
|
|
85
|
+
@decco
|
|
86
|
+
type t = @decco.codec(codec) bool
|
|
87
|
+
}
|
|
88
|
+
|
|
64
89
|
module Float = {
|
|
65
90
|
let encoder = value => value->Decco.floatToJson
|
|
66
91
|
|
|
@@ -8,6 +8,11 @@ type filterOption = {
|
|
|
8
8
|
value: string,
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
type sortOption = {
|
|
12
|
+
id: string,
|
|
13
|
+
desc: bool,
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
type rec filterProps<'filterValue> = {column: filterColumn<'filterValue>}
|
|
12
17
|
and filterColumn<'filterValue> = {
|
|
13
18
|
filterValue: option<'filterValue>,
|
|
@@ -40,6 +45,7 @@ type rec instance<'data> = {
|
|
|
40
45
|
setAllFilters: array<filterOption> => unit,
|
|
41
46
|
setFilter: (string, string) => unit,
|
|
42
47
|
toggleSortBy: (~column: string, ~descending: bool, ~isMulti: bool) => unit,
|
|
48
|
+
setSortBy: array<sortOption> => unit,
|
|
43
49
|
}
|
|
44
50
|
and state = {
|
|
45
51
|
pageIndex: int,
|
|
@@ -149,6 +155,18 @@ external useTable6: (
|
|
|
149
155
|
plugin,
|
|
150
156
|
) => instance<'data> = "useTable"
|
|
151
157
|
|
|
158
|
+
@module("react-table")
|
|
159
|
+
external useTable7: (
|
|
160
|
+
options<'data>,
|
|
161
|
+
plugin,
|
|
162
|
+
plugin,
|
|
163
|
+
plugin,
|
|
164
|
+
plugin,
|
|
165
|
+
plugin,
|
|
166
|
+
plugin,
|
|
167
|
+
plugin,
|
|
168
|
+
) => instance<'data> = "useTable"
|
|
169
|
+
|
|
152
170
|
// Utils :
|
|
153
171
|
|
|
154
172
|
let getFiltersDictFromArray = (filters: array<currentFilter>): Js.Dict.t<string> =>
|